Re: [PATCH v14 34/41] compositor-drm: Ignore occluded views
Hi Pekka, On Fri, 26 Jan 2018 at 12:45, Pekka Paalanen wrote: > On Wed, 20 Dec 2017 12:26:51 + Daniel Stone wrote: > > @@ -3116,9 +3136,16 @@ drm_output_propose_state(struct weston_output > > *output_base, > > if (next_plane == primary) > > pixman_region32_union(_region, > > _region, > > - >transform.boundingbox); > > + _view); > > + else if (output->cursor_plane && > > + next_plane != >cursor_plane->base) > > Should this not be: > > if (!output->cursor_plane || next_plane != > >cursor_plane->base) > > so that lack of a cursor plane goes straight to occluded? Very right. I've force-pushed this fix (and the resultant changes when rebasing 'Add modes to drm_output_propose_state' as well as 'Return plane state from plane preparation') to the v17 branch on Collabora GitLab, but happy to re-send if that makes life easier. Cheers, Daniel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH v14 34/41] compositor-drm: Ignore occluded views
On Wed, 20 Dec 2017 12:26:51 + Daniel Stonewrote: > 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 > --- > libweston/compositor-drm.c | 37 - > 1 file changed, 32 insertions(+), 5 deletions(-) > > diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c > index 845f43e5b..71027a5ae 100644 > --- a/libweston/compositor-drm.c > +++ b/libweston/compositor-drm.c > @@ -3054,7 +3054,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 = _base->compositor->primary_plane; > > assert(!output->state_last); > @@ -3076,9 +3076,12 @@ drm_output_propose_state(struct weston_output > *output_base, >* as we do for flipping full screen surfaces. >*/ > pixman_region32_init(_region); > + pixman_region32_init(_region); > > wl_list_for_each(ev, _base->compositor->view_list, link) { > struct weston_plane *next_plane = NULL; > + pixman_region32_t clipped_view; > + bool occluded = false; > > /* If this view doesn't touch our output at all, there's no >* reason to do anything with it. */ > @@ -3090,13 +3093,27 @@ 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(_view); > + pixman_region32_intersect(_view, > + >transform.boundingbox, > + >base.region); > + > + pixman_region32_init(_overlap); > + pixman_region32_subtract(_overlap, _view, > + _region); > + occluded = !pixman_region32_not_empty(_overlap); > + if (occluded) { > + pixman_region32_fini(_overlap); > + pixman_region32_fini(_view); > + 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. */ > - pixman_region32_init(_overlap); > pixman_region32_intersect(_overlap, _region, > - >transform.boundingbox); > - > + _view); > if (pixman_region32_not_empty(_overlap)) > next_plane = primary; > pixman_region32_fini(_overlap); > @@ -3104,6 +3121,9 @@ drm_output_propose_state(struct weston_output > *output_base, > if (next_plane == NULL) > next_plane = drm_output_prepare_cursor_view(state, ev); > > + if (next_plane == NULL && !drm_view_is_opaque(ev)) > + next_plane = primary; > + > if (next_plane == NULL) > next_plane = drm_output_prepare_scanout_view(state, ev); > > @@ -3116,9 +3136,16 @@ drm_output_propose_state(struct weston_output > *output_base, > if (next_plane == primary) > pixman_region32_union(_region, > _region, > - >transform.boundingbox); > + _view); > + else if (output->cursor_plane && > + next_plane != >cursor_plane->base) Should this not be: if (!output->cursor_plane || next_plane != >cursor_plane->base) so that lack of a cursor plane goes straight to occluded? > + pixman_region32_union(_region, > + _region, > + _view); > + pixman_region32_fini(_view); > } > pixman_region32_fini(_region); > + pixman_region32_fini(_region); > > return state; > } I cannot find any other fault here, and I stared at this for a long time. Thanks, pq pgpG17crgeJCa.pgp Description: OpenPGP digital signature ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org
[PATCH v14 34/41] 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--- libweston/compositor-drm.c | 37 - 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c index 845f43e5b..71027a5ae 100644 --- a/libweston/compositor-drm.c +++ b/libweston/compositor-drm.c @@ -3054,7 +3054,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 = _base->compositor->primary_plane; assert(!output->state_last); @@ -3076,9 +3076,12 @@ drm_output_propose_state(struct weston_output *output_base, * as we do for flipping full screen surfaces. */ pixman_region32_init(_region); + pixman_region32_init(_region); wl_list_for_each(ev, _base->compositor->view_list, link) { struct weston_plane *next_plane = NULL; + pixman_region32_t clipped_view; + bool occluded = false; /* If this view doesn't touch our output at all, there's no * reason to do anything with it. */ @@ -3090,13 +3093,27 @@ 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(_view); + pixman_region32_intersect(_view, + >transform.boundingbox, + >base.region); + + pixman_region32_init(_overlap); + pixman_region32_subtract(_overlap, _view, +_region); + occluded = !pixman_region32_not_empty(_overlap); + if (occluded) { + pixman_region32_fini(_overlap); + pixman_region32_fini(_view); + 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. */ - pixman_region32_init(_overlap); pixman_region32_intersect(_overlap, _region, - >transform.boundingbox); - + _view); if (pixman_region32_not_empty(_overlap)) next_plane = primary; pixman_region32_fini(_overlap); @@ -3104,6 +3121,9 @@ drm_output_propose_state(struct weston_output *output_base, if (next_plane == NULL) next_plane = drm_output_prepare_cursor_view(state, ev); + if (next_plane == NULL && !drm_view_is_opaque(ev)) + next_plane = primary; + if (next_plane == NULL) next_plane = drm_output_prepare_scanout_view(state, ev); @@ -3116,9 +3136,16 @@ drm_output_propose_state(struct weston_output *output_base, if (next_plane == primary) pixman_region32_union(_region, _region, - >transform.boundingbox); + _view); + else if (output->cursor_plane && +next_plane != >cursor_plane->base) + pixman_region32_union(_region, + _region, + _view); + pixman_region32_fini(_view); } pixman_region32_fini(_region); + pixman_region32_fini(_region); return state; } -- 2.14.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel