diff mbox

[01/16] omapdrm: only take crtc->mutex in crtc callbacks

Message ID 1359044448-3861-2-git-send-email-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter Jan. 24, 2013, 4:20 p.m. UTC
Omapdrm doesn't do anything nefarious with crtc load detection or has
any shared resources, so this is enough. We also need to adjust the
WARN_ON.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/staging/omapdrm/omap_crtc.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

Comments

Rob Clark Jan. 24, 2013, 4:45 p.m. UTC | #1
On Thu, Jan 24, 2013 at 10:20 AM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Omapdrm doesn't do anything nefarious with crtc load detection or has
> any shared resources, so this is enough. We also need to adjust the
> WARN_ON.

looks good, after I double checked the locking in setplane.  In case I
didn't send this earlier,

Reviewed-by: Rob Clark <rob@ti.com>

> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/staging/omapdrm/omap_crtc.c |   12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/staging/omapdrm/omap_crtc.c b/drivers/staging/omapdrm/omap_crtc.c
> index 510942e..fb5d722 100644
> --- a/drivers/staging/omapdrm/omap_crtc.c
> +++ b/drivers/staging/omapdrm/omap_crtc.c
> @@ -274,17 +274,16 @@ static void page_flip_worker(struct work_struct *work)
>         struct omap_crtc *omap_crtc =
>                         container_of(work, struct omap_crtc, page_flip_work);
>         struct drm_crtc *crtc = &omap_crtc->base;
> -       struct drm_device *dev = crtc->dev;
>         struct drm_display_mode *mode = &crtc->mode;
>         struct drm_gem_object *bo;
>
> -       drm_modeset_lock_all(dev);
> +       mutex_lock(&crtc->mutex);
>         omap_plane_mode_set(omap_crtc->plane, crtc, crtc->fb,
>                         0, 0, mode->hdisplay, mode->vdisplay,
>                         crtc->x << 16, crtc->y << 16,
>                         mode->hdisplay << 16, mode->vdisplay << 16,
>                         vblank_cb, crtc);
> -       drm_modeset_unlock_all(dev);
> +       mutex_unlock(&crtc->mutex);
>
>         bo = omap_framebuffer_bo(crtc->fb, 0);
>         drm_gem_object_unreference_unlocked(bo);
> @@ -417,7 +416,7 @@ static void apply_worker(struct work_struct *work)
>          * the callbacks and list modification all serialized
>          * with respect to modesetting ioctls from userspace.
>          */
> -       drm_modeset_lock_all(dev);
> +       mutex_lock(&crtc->mutex);
>         dispc_runtime_get();
>
>         /*
> @@ -462,16 +461,15 @@ static void apply_worker(struct work_struct *work)
>
>  out:
>         dispc_runtime_put();
> -       drm_modeset_unlock_all(dev);
> +       mutex_unlock(&crtc->mutex);
>  }
>
>  int omap_crtc_apply(struct drm_crtc *crtc,
>                 struct omap_drm_apply *apply)
>  {
>         struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
> -       struct drm_device *dev = crtc->dev;
>
> -       WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
> +       WARN_ON(!mutex_is_locked(&crtc->mutex));
>
>         /* no need to queue it again if it is already queued: */
>         if (apply->queued)
> --
> 1.7.10.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/staging/omapdrm/omap_crtc.c b/drivers/staging/omapdrm/omap_crtc.c
index 510942e..fb5d722 100644
--- a/drivers/staging/omapdrm/omap_crtc.c
+++ b/drivers/staging/omapdrm/omap_crtc.c
@@ -274,17 +274,16 @@  static void page_flip_worker(struct work_struct *work)
 	struct omap_crtc *omap_crtc =
 			container_of(work, struct omap_crtc, page_flip_work);
 	struct drm_crtc *crtc = &omap_crtc->base;
-	struct drm_device *dev = crtc->dev;
 	struct drm_display_mode *mode = &crtc->mode;
 	struct drm_gem_object *bo;
 
-	drm_modeset_lock_all(dev);
+	mutex_lock(&crtc->mutex);
 	omap_plane_mode_set(omap_crtc->plane, crtc, crtc->fb,
 			0, 0, mode->hdisplay, mode->vdisplay,
 			crtc->x << 16, crtc->y << 16,
 			mode->hdisplay << 16, mode->vdisplay << 16,
 			vblank_cb, crtc);
-	drm_modeset_unlock_all(dev);
+	mutex_unlock(&crtc->mutex);
 
 	bo = omap_framebuffer_bo(crtc->fb, 0);
 	drm_gem_object_unreference_unlocked(bo);
@@ -417,7 +416,7 @@  static void apply_worker(struct work_struct *work)
 	 * the callbacks and list modification all serialized
 	 * with respect to modesetting ioctls from userspace.
 	 */
-	drm_modeset_lock_all(dev);
+	mutex_lock(&crtc->mutex);
 	dispc_runtime_get();
 
 	/*
@@ -462,16 +461,15 @@  static void apply_worker(struct work_struct *work)
 
 out:
 	dispc_runtime_put();
-	drm_modeset_unlock_all(dev);
+	mutex_unlock(&crtc->mutex);
 }
 
 int omap_crtc_apply(struct drm_crtc *crtc,
 		struct omap_drm_apply *apply)
 {
 	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
-	struct drm_device *dev = crtc->dev;
 
-	WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
+	WARN_ON(!mutex_is_locked(&crtc->mutex));
 
 	/* no need to queue it again if it is already queued: */
 	if (apply->queued)