Re: [PATCH 3/8] drm: Handle legacy per-crtc locking with full acquire ctx

Dave Airlie
2014-07-29T23:28:53Z

> ---
> drivers/gpu/drm/drm_crtc.c | 8 ++--
> drivers/gpu/drm/drm_modeset_lock.c | 84 ++++++++++++++++++++++++++++++++++++++
> include/drm/drm_crtc.h | 6 +++
> include/drm/drm_modeset_lock.h | 5 +++
> 4 files changed, 99 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index ff583bec31f9..c09374038f9a 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -2714,7 +2714,7 @@ static int drm_mode_cursor_common(struct drm_device *dev,
> if (crtc->cursor)
> return drm_mode_cursor_universal(crtc, req, file_priv);
>
> - drm_modeset_lock(&crtc->mutex, NULL);
> + drm_modeset_lock_crtc(crtc);
> if (req->flags & DRM_MODE_CURSOR_BO) {
> if (!crtc->funcs->cursor_set && !crtc->funcs->cursor_set2) {
> ret = -ENXIO;
> @@ -2738,7 +2738,7 @@ static int drm_mode_cursor_common(struct drm_device *dev,
> }
> }
> out:
> - drm_modeset_unlock(&crtc->mutex);
> + drm_modeset_unlock_crtc(crtc);
>
> return ret;
>
> @@ -4474,7 +4474,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
> if (!crtc)
> return -ENOENT;
>
> - drm_modeset_lock(&crtc->mutex, NULL);
> + drm_modeset_lock_crtc(crtc);
> if (crtc->primary->fb == NULL) {
> /* The framebuffer is currently unbound, presumably
> * due to a hotplug event, that userspace has not
> @@ -4558,7 +4558,7 @@ out:
> drm_framebuffer_unreference(fb);
> if (old_fb)
> drm_framebuffer_unreference(old_fb);
> - drm_modeset_unlock(&crtc->mutex);
> + drm_modeset_unlock_crtc(crtc);
>
> return ret;
> }
> diff --git a/drivers/gpu/drm/drm_modeset_lock.c b/drivers/gpu/drm/drm_modeset_lock.c
> index 73e6534fd0aa..4d2aa549c614 100644
> --- a/drivers/gpu/drm/drm_modeset_lock.c
> +++ b/drivers/gpu/drm/drm_modeset_lock.c
> @@ -130,6 +130,90 @@ void drm_modeset_unlock_all(struct drm_device *dev)
> EXPORT_SYMBOL(drm_modeset_unlock_all);
>
> /**
> + * drm_modeset_lock_crtc - lock crtc with hidden acquire ctx
> + * @crtc: drm crtc
> + *
> + * This function locks the given crtc using a hidden acquire context. This is
> + * necessary so that drivers internally using the atomic interfaces can grab
> + * furether locks with the lock acquire context.

^ typo - further

Otherwise

Reviewed-by: Dave Airlie <airlied@redhat.com>