From db7e85d5f8a2b216ad76ea2ed7f6f6785d009ea7 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 20 Jan 2022 10:27:17 -0600 Subject: [PATCH] drm: Fix hang on zoom Transforming the scanout damage by the zoom will result in rectangles outside of the display, and some with negative co-ordinates. This makes at least some drivers unhappy (tested on vmware), and the page flip fails, and weston hangs indefinitely. Clip the damage to the output so we don't fall down. Signed-off-by: Derek Foreman --- libweston/backend-drm/drm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c index 9a1a39e5..42787702 100644 --- a/libweston/backend-drm/drm.c +++ b/libweston/backend-drm/drm.c @@ -415,9 +415,16 @@ drm_output_render(struct drm_output_state *state, pixman_region32_t *damage) pixman_region32_copy(&scanout_damage, damage); if (output->base.zoom.active) { + pixman_region32_t clip; + weston_matrix_transform_region(&scanout_damage, &output->base.matrix, &scanout_damage); + pixman_region32_init_rect(&clip, 0, 0, + output->base.width, + output->base.height); + pixman_region32_intersect(&scanout_damage, &scanout_damage, &clip); + pixman_region32_fini(&clip); } else { pixman_region32_translate(&scanout_damage, -output->base.x, -output->base.y);