[PATCH 2/4] shell: Fix repaint debugging
Kristian Høgsberg
hoegsberg at gmail.com
Thu Aug 9 11:37:53 PDT 2012
On Thu, Aug 09, 2012 at 04:44:59PM +0300, Ander Conselvan de Oliveira wrote:
> 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.
Ah heh, good catch and good fix. I tweaked the patch slightly to just
make the temp plane a local variable in debug_repaint_binding().
thanks,
Kristian
> ---
> src/shell.c | 22 ++++++++++++++--------
> 1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/src/shell.c b/src/shell.c
> index 6c810ff..834e05e 100644
> --- a/src/shell.c
> +++ b/src/shell.c
> @@ -124,6 +124,7 @@ struct desktop_shell {
> uint32_t binding_modifier;
> enum animation_type win_animation_type;
> struct weston_surface *debug_repaint_surface;
> + struct weston_plane debug_repaint_plane;
> };
>
> enum shell_surface_type {
> @@ -3137,16 +3138,17 @@ 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. */
> +
> + surface->plane = &shell->debug_repaint_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;
> }
> }
>
> @@ -3219,6 +3221,8 @@ shell_destroy(struct wl_listener *listener, void *data)
> container_of(listener, struct desktop_shell, destroy_listener);
> struct workspace **ws;
>
> + weston_plane_release(&shell->debug_repaint_plane);
> +
> if (shell->child.client)
> wl_client_destroy(shell->child.client);
>
> @@ -3359,6 +3363,8 @@ shell_init(struct weston_compositor *ec)
> wl_list_init(&shell->workspaces.animation.link);
> shell->workspaces.animation.frame = animate_workspace_change_frame;
>
> + weston_plane_init(&shell->debug_repaint_plane, 0, 0);
> +
> if (wl_display_add_global(ec->wl_display, &wl_shell_interface,
> shell, bind_shell) == NULL)
> return -1;
> --
> 1.7.9.5
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list