From 383b671ccf45a97cc7893954bda3b839af960fbe Mon Sep 17 00:00:00 2001 From: Ander Conselvan de Oliveira Date: Thu, 9 Aug 2012 16:44:59 +0300 Subject: [PATCH] shell: Fix repaint debugging Since weston_surface_update_transform() was changed so it called surface_damage_below() instead of surface_damage(), the trick of clearing the surface damage did not work anymore. Fix this by moving the repaint surface to a special plane before calling update_transform. The move is made manually (as opposed to calling weston_surface_move_to_plane()) to avoid the call to weston_surface_damage_below(). The transform update causes the damage to be added to this special plane, which is simply ignored. After the geometry.dirty bit is clear, the surface is moved back to the primary plane. --- src/shell.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/shell.c b/src/shell.c index 35b19a1a..53127094 100644 --- a/src/shell.c +++ b/src/shell.c @@ -3154,6 +3154,7 @@ debug_repaint_binding(struct wl_seat *seat, uint32_t time, uint32_t key, struct desktop_shell *shell = data; struct weston_compositor *compositor = shell->compositor; struct weston_surface *surface; + struct weston_plane plane; if (shell->debug_repaint_surface) { weston_surface_destroy(shell->debug_repaint_surface); @@ -3168,16 +3169,19 @@ debug_repaint_binding(struct wl_seat *seat, uint32_t time, uint32_t key, pixman_region32_init(&surface->input); /* Here's the dirty little trick that makes the - * repaint debugging work: we force an - * update_transform first to update dependent state - * and clear the geometry.dirty bit. Then we clear - * the surface damage so it only gets repainted - * piecewise as we repaint other things. */ - + * repaint debugging work: we move the surface to a + * different plane and force an update_transform to + * update dependent state and clear the + * geometry.dirty bit. This way the call to + * damage_below() in update_transform() does not + * add damage to the primary plane. */ + + weston_plane_init(&plane, 0, 0); + surface->plane = &plane; weston_surface_update_transform(surface); - pixman_region32_fini(&surface->damage); - pixman_region32_init(&surface->damage); shell->debug_repaint_surface = surface; + surface->plane = &compositor->primary_plane; + weston_plane_release(&plane); } }