From c1668116959664f04e509130e76a18d55429ca65 Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Sat, 18 Dec 2021 21:45:52 +0100 Subject: [PATCH] wayland/surface: Use correct default viewport for surface damage If no viewport is set, the neutral viewport is the surface size without viewport destination size applied - i.e. transform and scale applied to the buffer size. Change it accordingly, giving us the same values we'd return in `get_width` in this case. As result, this only changes cases where a viewport destination size but no viewport source rectangle is set. The change fixes exactly such cases, e.g. the Gstreamer Wayland sink. Can be tested with: `gst-play-1.0 --videosink=waylandsink`. Part-of: --- src/wayland/meta-wayland-surface.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 612787725..f0f742f04 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -365,9 +365,22 @@ surface_process_damage (MetaWaylandSurface *surface, } else { + int width, height; + + if (meta_monitor_transform_is_rotated (surface->buffer_transform)) + { + width = get_buffer_height (surface); + height = get_buffer_width (surface); + } + else + { + width = get_buffer_width (surface); + height = get_buffer_height (surface); + } + src_rect = (graphene_rect_t) { - .size.width = surface_rect.width, - .size.height = surface_rect.height + .size.width = width / surface->scale, + .size.height = height / surface->scale }; } viewport_region = meta_region_crop_and_scale (surface_region,