[PATCH 09/27] drm/atomic-helper: roll out commit synchronization

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Wed Jun 8 14:40:29 UTC 2016


Op 08-06-16 om 14:19 schreef Daniel Vetter:
> To facilitate easier reviewing this is split out from the overall
> nonblocking commit rework. It just rolls out the helper functions
> and uses them in the main drm_atomic_helper_commit() function
> to make it clear where in the flow they're used.
>
> The next patch will actually split drm_atomic_helper_commit() into
> 2 pieces, with the tail being run asynchronously from a worker.
>
> v2: Improve kerneldocs (Maarten).
>
> v3: Don't convert ERESTARTSYS to EINTR (Maarten). Also don't fail if
> the wait succeed in stall_check - we need to convert that case (it
> returns the remaining jiffies) to 0 for success.
>
> Tested-by: Tomeu Vizoso <tomeu.vizoso at collabora.com>
> Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> Cc: Tomeu Vizoso <tomeu.vizoso at gmail.com>
> Cc: Daniel Stone <daniels at collabora.com>
> Tested-by: Liviu Dudau <Liviu.Dudau at arm.com>
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 346 ++++++++++++++++++++++++++++++++++++
>  include/drm/drm_atomic_helper.h     |   7 +
>  2 files changed, 353 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 326ee34cdba4..63e46827b303 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1155,6 +1155,10 @@ int drm_atomic_helper_commit(struct drm_device *dev,
>  	if (nonblock)
>  		return -EBUSY;
>  
> +	ret = drm_atomic_helper_setup_commit(state, nonblock);
> +	if (ret)
> +		return ret;
> +
>  	ret = drm_atomic_helper_prepare_planes(dev, state);
>  	if (ret)
>  		return ret;
> @@ -1185,16 +1189,22 @@ int drm_atomic_helper_commit(struct drm_device *dev,
>  
>  	drm_atomic_helper_wait_for_fences(dev, state);
>  
> +	drm_atomic_helper_wait_for_dependencies(state);
> +
>  	drm_atomic_helper_commit_modeset_disables(dev, state);
>  
>  	drm_atomic_helper_commit_planes(dev, state, false);
>  
>  	drm_atomic_helper_commit_modeset_enables(dev, state);
>  
> +	drm_atomic_helper_commit_hw_done(state);
> +
>  	drm_atomic_helper_wait_for_vblanks(dev, state);
>  
>  	drm_atomic_helper_cleanup_planes(dev, state);
>  
> +	drm_atomic_helper_commit_cleanup_done(state);
> +
>  	drm_atomic_state_free(state);
>  
>  	return 0;
> @@ -1239,6 +1249,305 @@ EXPORT_SYMBOL(drm_atomic_helper_commit);
>   * being displayed.
>   */
>  
> +static int stall_checks(struct drm_crtc *crtc, bool nonblock)
> +{
> +	struct drm_crtc_commit *commit, *stall_commit = NULL;
> +	bool completed = true;
> +	int i, ret = 0;
^Should probably be a long ret, or truncation gets done too early if we decide to bump the timeout to infinity.

Must admit I missed the error of ret > 0 in v2.

Looking good though..

Reviewed-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>


More information about the dri-devel mailing list