[PATCH v19 04/10] compositor-drm: Return plane state from plane preparation

Pekka Paalanen ppaalanen at gmail.com
Wed Jul 11 09:51:09 UTC 2018


On Tue, 10 Jul 2018 18:58:43 +0100
Daniel Stone <daniels at collabora.com> wrote:

> Return a pointer to the plane state, rather than returning its
> underlying weston_plane.
> 
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> Tested-by: Emre Ucan <eucan at de.adit-jv.com>
> ---
>  libweston/compositor-drm.c | 53 ++++++++++++++++++--------------------
>  1 file changed, 25 insertions(+), 28 deletions(-)
> 
> diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
> index d4898bc46..28a580cd2 100644
> --- a/libweston/compositor-drm.c
> +++ b/libweston/compositor-drm.c


> @@ -3271,7 +3270,6 @@ drm_output_propose_state(struct weston_output *output_base,
>  	struct drm_output_state *state;
>  	struct weston_view *ev;
>  	pixman_region32_t surface_overlap, renderer_region, occluded_region;
> -	struct weston_plane *primary = &output_base->compositor->primary_plane;
>  	bool planes_ok = (mode != DRM_OUTPUT_PROPOSE_STATE_RENDERER_ONLY);
>  
>  	assert(!output->state_last);
> @@ -3298,7 +3296,8 @@ drm_output_propose_state(struct weston_output *output_base,
>  	pixman_region32_init(&occluded_region);
>  
>  	wl_list_for_each(ev, &output_base->compositor->view_list, link) {
> -		struct weston_plane *next_plane = NULL;
> +		struct drm_plane_state *ps = NULL;
> +		bool force_renderer = false;
>  		pixman_region32_t clipped_view;
>  		bool occluded = false;
>  
> @@ -3310,7 +3309,7 @@ drm_output_propose_state(struct weston_output *output_base,
>  		/* We only assign planes to views which are exclusively present
>  		 * on our output. */
>  		if (ev->output_mask != (1u << output->base.id))
> -			next_plane = primary;
> +			force_renderer = true;
>  
>  		/* Ignore views we know to be totally occluded. */
>  		pixman_region32_init(&clipped_view);
> @@ -3334,7 +3333,7 @@ drm_output_propose_state(struct weston_output *output_base,
>  		pixman_region32_intersect(&surface_overlap, &renderer_region,
>  					  &clipped_view);
>  		if (pixman_region32_not_empty(&surface_overlap))
> -			next_plane = primary;
> +			force_renderer = true;
>  
>  		/* We do not control the stacking order of overlay planes;
>  		 * the scanout plane is strictly stacked bottom and the cursor
> @@ -3344,28 +3343,27 @@ drm_output_propose_state(struct weston_output *output_base,
>  		pixman_region32_intersect(&surface_overlap, &occluded_region,
>  					  &clipped_view);
>  		if (pixman_region32_not_empty(&surface_overlap))
> -			next_plane = primary;
> +			force_renderer = true;
>  		pixman_region32_fini(&surface_overlap);
>  
>  		/* The cursor plane is 'special' in the sense that we can still
>  		 * place it in the legacy API, and we gate that with a separate
>  		 * cursors_are_broken flag. */
> -		if (next_plane == NULL && !b->cursors_are_broken)
> -			next_plane = drm_output_prepare_cursor_view(state, ev);
> -
> -		if (next_plane == NULL && !drm_view_is_opaque(ev))
> -			next_plane = primary;
> +		if (!force_renderer && !b->cursors_are_broken)
> +			ps = drm_output_prepare_cursor_view(state, ev);
>  
> -		if (next_plane == NULL && !planes_ok)
> -			next_plane = primary;
> +		if (!planes_ok)
> +			force_renderer = true;

planes_ok is guaranteed to the true.

>  
> -		if (next_plane == NULL)
> -			next_plane = drm_output_prepare_scanout_view(state, ev);
> +		if (!drm_view_is_opaque(ev))
> +			force_renderer = true;

This is not a bug, because ps will be set so force_renderer does not
matter below, but it does look a little strange that a cursor surface
can first hit the cursor plane, and being non-opaque it also sets
force_renderer.

Actually, I think this will become a problem with "Add planes-only mode
to state proposal" patch.

Should probably be
	if (!ps && !drm_view_is_opaque(ev))

If so, that's good by me.

With the above issues fixed:

Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>


Thanks,
pq

>  
> -		if (next_plane == NULL)
> -			next_plane = drm_output_prepare_overlay_view(state, ev);
> +		if (!force_renderer && !ps)
> +			ps = drm_output_prepare_scanout_view(state, ev);
> +		if (!force_renderer && !ps)
> +			ps = drm_output_prepare_overlay_view(state, ev);
>  
> -		if (next_plane && next_plane != primary) {
> +		if (ps) {
>  			/* 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
> @@ -3373,8 +3371,7 @@ drm_output_propose_state(struct weston_output *output_base,
>  			 * the content underneath it: the area should neither
>  			 * be added to the renderer region nor the occluded
>  			 * region. */
> -			if (!output->cursor_plane ||
> -			    next_plane != &output->cursor_plane->base) {
> +			if (ps->plane->type != WDRM_PLANE_TYPE_CURSOR) {
>  				pixman_region32_union(&occluded_region,
>  						      &occluded_region,
>  						      &clipped_view);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20180711/0d6cc499/attachment.sig>


More information about the wayland-devel mailing list