From 44abfaaffde1c575e044dfd8df2db02fd8dde1b7 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Tue, 10 Jul 2018 14:31:06 +0100 Subject: [PATCH] compositor-drm: Use sprites_are_broken for scanout plane When the sprites_are_broken variable is set, do not attempt to promote client surfaces to the scanout plane. We are currently assuming that every client buffer will be compatible with the scanout plane, but that is not the case, particularly with more exotic tiled/compressed buffers. Once we promote the client buffer to scanout, there is no going back: if the repaint fails, we do not mark this as failed and go back to repaint through composition. This permanently removes the ability for scanout bypass when using the non-atomic path. Future patches lift the restriction when using atomic modesetting, as we can actually test and ensure that the view is compatible with scanout. Signed-off-by: Daniel Stone Reviewed-by: Pekka Paalanen Reported-by: Pekka Paalanen --- libweston/compositor-drm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c index 2305f708..d045778a 100644 --- a/libweston/compositor-drm.c +++ b/libweston/compositor-drm.c @@ -1944,11 +1944,14 @@ drm_output_prepare_scanout_view(struct drm_output_state *output_state, struct weston_view *ev) { struct drm_output *output = output_state->output; + struct drm_backend *b = to_drm_backend(output->base.compositor); struct drm_plane *scanout_plane = output->scanout_plane; struct drm_plane_state *state; struct drm_fb *fb; pixman_box32_t *extents; + assert(!b->sprites_are_broken); + /* Check the view spans exactly the output size, calculated in the * logical co-ordinate space. */ extents = pixman_region32_extents(&ev->transform.boundingbox); @@ -3004,8 +3007,7 @@ drm_output_prepare_overlay_view(struct drm_output_state *output_state, struct drm_fb *fb; unsigned int i; - if (b->sprites_are_broken) - return NULL; + assert(!b->sprites_are_broken); fb = drm_fb_get_from_view(output_state, ev); if (!fb) @@ -3260,6 +3262,7 @@ drm_output_propose_state(struct weston_output *output_base, struct drm_pending_state *pending_state) { struct drm_output *output = to_drm_output(output_base); + struct drm_backend *b = to_drm_backend(output->base.compositor); struct drm_output_state *state; struct weston_view *ev; pixman_region32_t surface_overlap, renderer_region, occluded_region; @@ -3342,6 +3345,9 @@ drm_output_propose_state(struct weston_output *output_base, if (next_plane == NULL && !drm_view_is_opaque(ev)) next_plane = primary; + if (next_plane == NULL && b->sprites_are_broken) + next_plane = primary; + if (next_plane == NULL) next_plane = drm_output_prepare_scanout_view(state, ev);