wayland/surface: Unconditionally set scanout destination rect
The cogl_scanout_get_dst_rect() fell back on the buffer dimensions as the destination rectangle when nothing was explicitly set. This, however, is not necessarily correct. For example, if a buffer is larger the CRTC resolution, but the surface is scaled to exactly match the CRTC view, the expected destination size should match the CRTC resolution, not the buffer dimension, which would be the case if no explicit destination was set. In meta_wayland_try_aquire_scanout() we're in a good position to determine the destination rect in the CRTC primary plane, since we have all the prerequisits, i.e. that the surface effectively covers the whole CRTC, the actor allocation box (the non-black border part), the scale and transform of the view. This tweaks the CoglScanout API a bit to make it explicit that the dst_rect must be unconditionally provided, and removes the fallback to the buffer dimension as the destination rectangle, which sometimes resulted in a destination rectangle being larger than the primary plane itself, resulting in clipping and incorrect scaling. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3773 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4147>
This commit is contained in:
@ -924,9 +924,9 @@ try_acquire_egl_image_scanout (MetaWaylandBuffer *buffer,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
scanout = cogl_scanout_new (COGL_SCANOUT_BUFFER (g_steal_pointer (&fb)));
|
||||
scanout = cogl_scanout_new (COGL_SCANOUT_BUFFER (g_steal_pointer (&fb)),
|
||||
dst_rect);
|
||||
cogl_scanout_set_src_rect (scanout, src_rect);
|
||||
cogl_scanout_set_dst_rect (scanout, dst_rect);
|
||||
if (!meta_onscreen_native_is_buffer_scanout_compatible (onscreen, scanout))
|
||||
return NULL;
|
||||
|
||||
|
Reference in New Issue
Block a user