[PATCH weston v11 10/13] compositor-drm: Use drm_plane for scanout plane

Philipp Zabel p.zabel at pengutronix.de
Fri Jul 21 12:30:04 UTC 2017


Hi Daniel,

On Tue, 2017-07-18 at 14:14 +0100, Daniel Stone wrote:
> Use a real drm_plane to back the scanout plane, displacing
> output->fb_{last,cur,pending} to their plane-tracked equivalents.
> 
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> ---
>  libweston/compositor-drm.c | 157 ++++++++++++++++++++++++++-------------------
>  1 file changed, 91 insertions(+), 66 deletions(-)
> 
> diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
> index 2ede76b6..bf3273ba 100644
> --- a/libweston/compositor-drm.c
> +++ b/libweston/compositor-drm.c
[...]
> @@ -3755,6 +3784,15 @@ drm_output_enable(struct weston_output *base)
>  	if (b->pageflip_timeout)
>  		drm_output_pageflip_timer_create(output);
>  
> +	output->scanout_plane =
> +		drm_output_find_special_plane(b, output,
> +					      WDRM_PLANE_TYPE_PRIMARY);
> +	if (!output->scanout_plane) {
> +		weston_log("Failed to find primary plane for output %s\n",
> +			   output->base.name);
> +		goto err;
> +	}
> +
>  	/* Failing to find a cursor plane is not fatal, as we'll fall back
>  	 * to software cursor. */
>  	output->cursor_plane =
> @@ -3795,8 +3833,6 @@ drm_output_enable(struct weston_output *base)
>  	    output->connector->connector_type == DRM_MODE_CONNECTOR_eDP)
>  		output->base.connection_internal = 1;
>  
> -	weston_plane_init(&output->scanout_plane, b->compositor, 0, 0);
> -
>  	if (output->cursor_plane)
>  		weston_compositor_stack_plane(b->compositor,
>  					      &output->cursor_plane->base,
> @@ -3804,7 +3840,8 @@ drm_output_enable(struct weston_output *base)
>  	else
>  		b->cursors_are_broken = 1;
>  
> -	weston_compositor_stack_plane(b->compositor, &output->scanout_plane,
> +	weston_compositor_stack_plane(b->compositor,
> +				      &output->scanout_plane->base,
>  				      &b->compositor->primary_plane);

If the scanout plane is still stacked during output enable ...

>  	weston_log("Output %s, (connector %d, crtc %d)\n",
> @@ -3831,20 +3868,11 @@ drm_output_deinit(struct weston_output *base)
>  	struct drm_output *output = to_drm_output(base);
>  	struct drm_backend *b = to_drm_backend(base->compositor);
>  
> -	/* output->fb_last and output->fb_pending must not be set here;
> -	 * destroy_pending/disable_pending exist to guarantee exactly this. */
> -	assert(!output->fb_last);
> -	assert(!output->fb_pending);
> -	drm_fb_unref(output->fb_current);
> -	output->fb_current = NULL;
> -
>  	if (b->use_pixman)
>  		drm_output_fini_pixman(output);
>  	else
>  		drm_output_fini_egl(output);
>  
> -	weston_plane_release(&output->scanout_plane);
> -

... but not released anymore during deinit, won't then unplugging and
plugging in a monitor cause the second drm_output_enable to try to
insert the scanout plane into ec->plane_list a second time?

Also, will all view->plane references to the scanout plane in the
compositor->view_list still be cleared with this removed?

regards
Philipp



More information about the wayland-devel mailing list