From 11f971c18ebad912d2bf3022fe62aa804a59c274 Mon Sep 17 00:00:00 2001 From: Ander Conselvan de Oliveira Date: Thu, 22 Nov 2012 15:57:00 +0200 Subject: [PATCH] compositor: Move clearing of primary plane damage to the backends Backends may move surfaces to different planes, in which case damage is generated in the primary plane. This damage is usually passed to the renderer, but in some cases the backend may decide to not render anything (that's the case when drm compositor scans out a client buffer). In that case the damage on the primary plane would be discarded, leading to artifacts later. This patch makes the backend's responsibility to clear the damage on the primary plane, so that unrendered damage is kept for as long as necessary. --- src/compositor-android.c | 4 ++++ src/compositor-drm.c | 3 +++ src/compositor-wayland.c | 4 ++++ src/compositor-x11.c | 3 +++ src/compositor.c | 2 -- 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/compositor-android.c b/src/compositor-android.c index 3c0273a16..a55c9b0a1 100644 --- a/src/compositor-android.c +++ b/src/compositor-android.c @@ -128,10 +128,14 @@ android_output_repaint(struct weston_output *base, pixman_region32_t *damage) { struct android_output *output = to_android_output(base); struct android_compositor *compositor = output->compositor; + struct weston_plane *primary_plane = &compositor->base.primary_plane; struct wl_event_loop *loop; compositor->base.renderer->repaint_output(&output->base, damage); + pixman_region32_subtract(&primary_plane->damage, + &primary_plane->damage, damage); + /* FIXME: does Android have a way to signal page flip done? */ loop = wl_display_get_event_loop(compositor->base.wl_display); wl_event_loop_add_idle(loop, android_finish_frame, output); diff --git a/src/compositor-drm.c b/src/compositor-drm.c index 2dca85c92..8956c8cbf 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -330,6 +330,9 @@ drm_output_render(struct drm_output *output, pixman_region32_t *damage) ec->renderer->repaint_output(&output->base, damage); + pixman_region32_subtract(&ec->primary_plane.damage, + &ec->primary_plane.damage, damage); + bo = gbm_surface_lock_front_buffer(output->surface); if (!bo) { weston_log("failed to lock front buffer: %m\n"); diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c index 56759fc0d..d42d56f1a 100644 --- a/src/compositor-wayland.c +++ b/src/compositor-wayland.c @@ -311,6 +311,10 @@ wayland_output_repaint(struct weston_output *output_base, wl_callback_add_listener(callback, &frame_listener, output); ec->renderer->repaint_output(&output->base, damage); + + pixman_region32_subtract(&ec->primary_plane.damage, + &ec->primary_plane.damage, damage); + } static void diff --git a/src/compositor-x11.c b/src/compositor-x11.c index c575f25ed..20aede813 100644 --- a/src/compositor-x11.c +++ b/src/compositor-x11.c @@ -363,6 +363,9 @@ x11_output_repaint(struct weston_output *output_base, ec->renderer->repaint_output(output_base, damage); + pixman_region32_subtract(&ec->primary_plane.damage, + &ec->primary_plane.damage, damage); + wl_event_source_timer_update(output->finish_frame_timer, 10); } diff --git a/src/compositor.c b/src/compositor.c index 55d206068..5da3925f0 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -985,8 +985,6 @@ weston_output_repaint(struct weston_output *output, uint32_t msecs) pixman_region32_init(&output_damage); pixman_region32_intersect(&output_damage, &ec->primary_plane.damage, &output->region); - pixman_region32_subtract(&ec->primary_plane.damage, - &ec->primary_plane.damage, &output->region); if (output->dirty) weston_output_update_matrix(output);