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.
dev
Ander Conselvan de Oliveira 12 years ago committed by Kristian Høgsberg
parent 3b70b66fa9
commit 383b671ccf
  1. 20
      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);
}
}

Loading…
Cancel
Save