[PATCH 2/2] drm/atomic: Check for busy planes/connectors before setting the commit

Ville Syrjälä ville.syrjala at linux.intel.com
Mon Oct 16 13:51:37 UTC 2017


On Mon, Oct 16, 2017 at 03:29:28PM +0200, Maarten Lankhorst wrote:
> We still want to fail with -EBUSY if a plane or connector is part of
> a commit, even if it will be assigned to a new commit.
> 
> This closes a small hole left open where we should return -EBUSY.
> It's not severe, because wait_for_dependencies and swap_state helpers
> still block. But it should return -EBUSY and not stall.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> Fixes: 21a01abbe32a ("drm/atomic: Fix freeing connector/plane state too early by tracking commits, v3.")

Looks sane to me
Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index b64c8f5bc940..c2a7887deb25 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1775,16 +1775,16 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
>  	}
>  
>  	for_each_oldnew_connector_in_state(state, conn, old_conn_state, new_conn_state, i) {
> -		/* commit tracked through new_crtc_state->commit, no need to do it explicitly */
> -		if (new_conn_state->crtc)
> -			continue;
> -
>  		/* Userspace is not allowed to get ahead of the previous
>  		 * commit with nonblocking ones. */
>  		if (nonblock && old_conn_state->commit &&
>  		    !try_wait_for_completion(&old_conn_state->commit->flip_done))
>  			return -EBUSY;
>  
> +		/* commit tracked through new_crtc_state->commit, no need to do it explicitly */
> +		if (new_conn_state->crtc)
> +			continue;
> +
>  		commit = crtc_or_fake_commit(state, old_conn_state->crtc);
>  		if (!commit)
>  			return -ENOMEM;
> @@ -1793,17 +1793,16 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
>  	}
>  
>  	for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
> -		/*
> -		 * Unlike connectors, always track planes explicitly for
> -		 * async pageflip support.
> -		 */
> -
>  		/* Userspace is not allowed to get ahead of the previous
>  		 * commit with nonblocking ones. */
>  		if (nonblock && old_plane_state->commit &&
>  		    !try_wait_for_completion(&old_plane_state->commit->flip_done))
>  			return -EBUSY;
>  
> +		/*
> +		 * Unlike connectors, always track planes explicitly for
> +		 * async pageflip support.
> +		 */
>  		commit = crtc_or_fake_commit(state, old_plane_state->crtc ?: new_plane_state->crtc);
>  		if (!commit)
>  			return -ENOMEM;
> -- 
> 2.14.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC


More information about the dri-devel mailing list