diff options
author | Daniel Stone <daniels@collabora.com> | 2016-12-09 18:03:31 +0000 |
---|---|---|
committer | Daniel Stone <daniels@collabora.com> | 2017-02-07 19:16:33 +0000 |
commit | 5e1d47ea06e1f55b34899ce0e26f55f1f06731ab (patch) | |
tree | 8f1b78e0cac58d9d816b0d9c3b35e55e103695fc | |
parent | 1b23e2c4d4a8f545a3e52f63a93d94f0d072d948 (diff) |
compositor-drm: Ignore occluded views
When trying to assign planes, keep track of the areas which are
already occluded, and ignore views which are completely occluded. This
allows us to build a state using planes only, when there are occluded
views which cannot go into a plane behind views which can.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D1531
-rw-r--r-- | libweston/compositor-drm.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c index 9855e614..c32c3954 100644 --- a/libweston/compositor-drm.c +++ b/libweston/compositor-drm.c @@ -2627,7 +2627,7 @@ drm_output_propose_state(struct weston_output *output_base) struct drm_output *output = to_drm_output(output_base); struct drm_output_state *state; struct weston_view *ev; - pixman_region32_t surface_overlap, renderer_region; + pixman_region32_t surface_overlap, renderer_region, occluded_region; struct weston_plane *primary = &output_base->compositor->primary_plane; assert(!output->state_last); @@ -2649,9 +2649,11 @@ drm_output_propose_state(struct weston_output *output_base) * as we do for flipping full screen surfaces. */ pixman_region32_init(&renderer_region); + pixman_region32_init(&occluded_region); wl_list_for_each(ev, &output_base->compositor->view_list, link) { struct weston_plane *next_plane = NULL; + bool occluded = false; /* If this view doesn't touch our output at all, there's no * reason to do anything with it. */ @@ -2663,6 +2665,16 @@ drm_output_propose_state(struct weston_output *output_base) if (ev->output_mask != (1u << output->base.id)) next_plane = primary; + /* Ignore views we know to be totally occluded. */ + pixman_region32_init(&surface_overlap); + pixman_region32_subtract(&surface_overlap, + &ev->transform.boundingbox, + &occluded_region); + occluded = !pixman_region32_not_empty(&surface_overlap); + pixman_region32_fini(&surface_overlap); + if (occluded) + continue; + /* Since we process views from top to bottom, we know that if * the view intersects the calculated renderer region, it must * be part of, or occluded by, it, and cannot go on a plane. */ @@ -2673,6 +2685,11 @@ drm_output_propose_state(struct weston_output *output_base) next_plane = primary; pixman_region32_fini(&surface_overlap); + if (drm_view_is_opaque(ev)) + pixman_region32_union(&occluded_region, + &occluded_region, + &ev->transform.boundingbox); + if (next_plane == NULL) next_plane = drm_output_prepare_cursor_view(state, ev); if (next_plane == NULL) @@ -2688,6 +2705,7 @@ drm_output_propose_state(struct weston_output *output_base) &ev->transform.boundingbox); } pixman_region32_fini(&renderer_region); + pixman_region32_fini(&occluded_region); return state; } |