diff options
author | Robert Mader <robert.mader@collabora.com> | 2023-03-01 22:04:49 +0100 |
---|---|---|
committer | Robert Mader <robert.mader@collabora.com> | 2023-03-04 22:13:45 +0100 |
commit | ef2e9dade88ee6af0de5b484371e625f79a5dd70 (patch) | |
tree | d0171a1ac2f3bdb73c0d92d9621a075af23123e4 | |
parent | 8b4256476371c693ca2f3754e11a80fa591ef399 (diff) | |
download | mutter-ef2e9dade88ee6af0de5b484371e625f79a5dd70.tar.gz |
wayland/surface: Fix can_scanout_untransformed() for transform+viewport
The buffer needs to match the untransformed layout size.
While on it simplify the check from floats to ints where possible - and
improve logging a bit.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2394>
-rw-r--r-- | src/wayland/meta-wayland-surface.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 199b652ac..e5def80a2 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -2241,24 +2241,40 @@ meta_wayland_surface_can_scanout_untransformed (MetaWaylandSurface *surface, { MetaRectangle view_layout; float view_scale; + float untransformed_layout_width; + float untransformed_layout_height; clutter_stage_view_get_layout (CLUTTER_STAGE_VIEW (view), &view_layout); view_scale = clutter_stage_view_get_scale (CLUTTER_STAGE_VIEW (view)); - if (!G_APPROX_VALUE (view_layout.width, surface->viewport.dst_width, - FLT_EPSILON) || - !G_APPROX_VALUE (view_layout.height, surface->viewport.dst_height, - FLT_EPSILON) || - !G_APPROX_VALUE (view_layout.width * view_scale, + if (meta_monitor_transform_is_rotated (meta_renderer_view_get_transform (view))) + { + untransformed_layout_width = view_layout.height * view_scale; + untransformed_layout_height = view_layout.width * view_scale; + } + else + { + untransformed_layout_width = view_layout.width * view_scale; + untransformed_layout_height = view_layout.height * view_scale; + } + + if (view_layout.width != surface->viewport.dst_width || + view_layout.height != surface->viewport.dst_height || + !G_APPROX_VALUE (untransformed_layout_width, get_buffer_width (surface), FLT_EPSILON) || - !G_APPROX_VALUE (view_layout.height * view_scale, + !G_APPROX_VALUE (untransformed_layout_height, get_buffer_height (surface), FLT_EPSILON)) { meta_topic (META_DEBUG_RENDER, "Surface can not be scanned out untransformed: viewport " - "destination size does not match stage-view layout"); + "destination or buffer size does not match stage-view " + "layout. (%d != %d || %d != %d || %f != %d %f != %d)", + view_layout.width, surface->viewport.dst_width, + view_layout.height, surface->viewport.dst_height, + untransformed_layout_width, get_buffer_width (surface), + untransformed_layout_height, get_buffer_height (surface)); return FALSE; } } |