Daniel Vetter <[email protected]> writes:
> i915 needs this.
>
> Cc: Maarten Lankhorst <[email protected]>
> Cc: Ville Syrjälä <[email protected]>
> Signed-off-by: Daniel Vetter <[email protected]>
> ---
> drivers/gpu/drm/drm_atomic_helper.c | 38
> +++++++++++++++++++++++++++++++++++++
> include/drm/drm_atomic_helper.h | 1 +
> 2 files changed, 39 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> b/drivers/gpu/drm/drm_atomic_helper.c
> index cea610161af5..545328a9a769 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1763,6 +1763,44 @@ static struct drm_crtc_commit
> *preceeding_commit(struct drm_crtc *crtc)
> }
>
> /**
> + * drm_atomic_helper_sync_all - synchronize with all pending nonblocking
> commits
> + * @dev: DRM device
> + *
> + * This function synchronizes with all pending atomic commits using the
> + * nonblocking helpers (see drm_atomic_helper_setup_commit()) up to the point
> + * where all hardware commits are completed (as signalled using
> + * drm_atomic_helper_commit_hw_done().
> + *
> + * This is useful you need to synchronize with all nonblocking comits, but do
s/comits/commits
> + * not want to or cannot do a full atomic commit touching all CRTC. All CRTC
> + * looks must be held to prevent a concurrent thread from queuing yet another
s/looks/locks
> + * update. Drivers can use this for e.g. their gpu reset handling, when a gpu
> + * reset also affects the display block.
> + */
> +void drm_atomic_helper_sync_all(struct drm_device *dev)
> +{
> + struct drm_crtc *crtc;
> + struct drm_crtc_commit *commit;
> +
> + drm_for_each_crtc(crtc, dev) {
> + spin_lock(&crtc->commit_lock);
> + commit = list_first_entry_or_null(&crtc->commit_list,
> + struct drm_crtc_commit, commit_entry);
> + if (commit)
> + drm_crtc_commit_get(commit);
> + spin_unlock(&crtc->commit_lock);
> +
> + if (!commit)
> + continue;
> +
> + wait_for_completion(&commit->hw_done);
> +
> + drm_crtc_commit_put(commit);
> + }
> +}
> +EXPORT_SYMBOL(drm_atomic_helper_sync_all);
Reviewed-by: Mika Kuoppala <[email protected]>
> +
> +/**
> * drm_atomic_helper_wait_for_dependencies - wait for required preceeding
> commits
> * @old_state: atomic state object with old state structures
> *
> diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
> index ed90d0c5ba09..95bef7c3632f 100644
> --- a/include/drm/drm_atomic_helper.h
> +++ b/include/drm/drm_atomic_helper.h
> @@ -92,6 +92,7 @@ void drm_atomic_helper_swap_state(struct drm_atomic_state
> *state,
> /* nonblocking commit helpers */
> int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
> bool nonblock);
> +void drm_atomic_helper_sync_all(struct drm_device *dev);
> void drm_atomic_helper_wait_for_dependencies(struct drm_atomic_state *state);
> void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *state);
> void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *state);
> --
> 2.13.2
>
> _______________________________________________
> Intel-gfx mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx