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.
This commit is contained in:
Ander Conselvan de Oliveira 2012-11-22 15:57:00 +02:00 committed by Kristian Høgsberg
parent 7e918da36f
commit 0a887728ea
7 changed files with 21 additions and 2 deletions

View File

@ -92,10 +92,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);

View File

@ -357,6 +357,9 @@ drm_output_render(struct drm_output *output, pixman_region32_t *damage)
c->base.renderer->repaint_output(&output->base, damage);
pixman_region32_subtract(&c->base.primary_plane.damage,
&c->base.primary_plane.damage, damage);
bo = gbm_surface_lock_front_buffer(output->surface);
if (!bo) {
weston_log("failed to lock front buffer: %m\n");

View File

@ -66,6 +66,9 @@ headless_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, 16);
return;

View File

@ -914,6 +914,7 @@ rpi_output_repaint(struct weston_output *base, pixman_region32_t *damage)
{
struct rpi_output *output = to_rpi_output(base);
struct rpi_compositor *compositor = output->compositor;
struct weston_plane *primary_plane = &compositor->base.primary_plane;
struct rpi_element *element;
DISPMANX_UPDATE_HANDLE_T update;
int layer = 10000;
@ -942,6 +943,9 @@ rpi_output_repaint(struct weston_output *base, pixman_region32_t *damage)
*/
compositor->base.renderer->repaint_output(&output->base, damage);
pixman_region32_subtract(&primary_plane->damage,
&primary_plane->damage, damage);
/* Move the list of elements into the old_element_list. */
wl_list_insert_list(&output->old_element_list, &output->element_list);
wl_list_init(&output->element_list);

View File

@ -137,6 +137,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

View File

@ -314,6 +314,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);
}

View File

@ -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);