From b625cdcf20e7b97db21b73731625030eae9dfba6 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Tue, 25 Aug 2020 17:37:34 +0100 Subject: [PATCH] drm/state-propose: Remove special casing for cursor plane Previously we assumed that cursor planes occluded nothing and would always be blended, but overlay and scanout planes would always occlude what's behind them. This is not actually true, as we can support alpha blending on any kind of plane type now. Remove the special case, which might hopefully fix some weird display issues along the way. (Noticed by inspection.) Signed-off-by: Daniel Stone --- libweston/backend-drm/state-propose.c | 38 ++++++++++++--------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/libweston/backend-drm/state-propose.c b/libweston/backend-drm/state-propose.c index e0960489..cc4672bf 100644 --- a/libweston/backend-drm/state-propose.c +++ b/libweston/backend-drm/state-propose.c @@ -929,27 +929,17 @@ drm_output_propose_state(struct weston_output *output_base, drm_debug(b, "\t\t\t[plane] next zpos to use %"PRIu64"\n", current_lowest_zpos); - /* If we have been assigned to an overlay or scanout - * plane, add this area to the occluded region, so - * other views are known to be behind it. The cursor - * plane, however, is special, in that it blends with - * the content underneath it: the area should neither - * be added to the renderer region nor the occluded - * region. */ - if (ps->plane->type != WDRM_PLANE_TYPE_CURSOR) { - if (!weston_view_is_opaque(ev, &clipped_view)) - pixman_region32_intersect(&clipped_view, - &clipped_view, - &ev->transform.opaque); - /* the visible-and-opaque region of this view - * will occlude views underneath it */ - pixman_region32_union(&occluded_region, - &occluded_region, - &clipped_view); - - pixman_region32_fini(&clipped_view); + if (!weston_view_is_opaque(ev, &clipped_view)) + pixman_region32_intersect(&clipped_view, + &clipped_view, + &ev->transform.opaque); + /* the visible-and-opaque region of this view + * will occlude views underneath it */ + pixman_region32_union(&occluded_region, + &occluded_region, + &clipped_view); - } + pixman_region32_fini(&clipped_view); continue; } @@ -964,15 +954,21 @@ drm_output_propose_state(struct weston_output *output_base, goto err_region; } + /* clipped_view contains the area that's going to be visible + * on screen; add this to the renderer region */ pixman_region32_union(&renderer_region, &renderer_region, &clipped_view); + /* Opaque areas of our clipped view occlude areas behind it; + * however, anything not in the opaque region (which is the + * entire clipped area if the whole view is known to be + * opaque) does not necessarily occlude what's behind it, as + * it could be alpha-blended. */ if (!weston_view_is_opaque(ev, &clipped_view)) pixman_region32_intersect(&clipped_view, &clipped_view, &ev->transform.opaque); - pixman_region32_union(&occluded_region, &occluded_region, &clipped_view);