summaryrefslogtreecommitdiffstats
path: root/include/drm/drm_modeset_lock.h
diff options
context:
space:
mode:
authorVinod Koul <vkoul@kernel.org>2020-09-11 14:15:36 +0200
committerVinod Koul <vkoul@kernel.org>2020-09-11 14:15:36 +0200
commit4c80e9323967125ab8aa7c271ccc7624abc08832 (patch)
treec9881b5814c184aa0c1cb58c6383beab9173e388 /include/drm/drm_modeset_lock.h
parentdmaengine: dmatest: Print error codes as signed value (diff)
parentLinux 5.9-rc4 (diff)
downloadlinux-4c80e9323967125ab8aa7c271ccc7624abc08832.tar.xz
linux-4c80e9323967125ab8aa7c271ccc7624abc08832.zip
Merge tag 'v5.9-rc4' into next
Linux 5.9-rc4
Diffstat (limited to 'include/drm/drm_modeset_lock.h')
-rw-r--r--include/drm/drm_modeset_lock.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/drm/drm_modeset_lock.h b/include/drm/drm_modeset_lock.h
index 4fc9a43ac45a..aafd07388eb7 100644
--- a/include/drm/drm_modeset_lock.h
+++ b/include/drm/drm_modeset_lock.h
@@ -164,6 +164,8 @@ int drm_modeset_lock_all_ctx(struct drm_device *dev,
* is 0, so no error checking is necessary
*/
#define DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, flags, ret) \
+ if (!drm_drv_uses_atomic_modeset(dev)) \
+ mutex_lock(&dev->mode_config.mutex); \
drm_modeset_acquire_init(&ctx, flags); \
modeset_lock_retry: \
ret = drm_modeset_lock_all_ctx(dev, &ctx); \
@@ -172,6 +174,7 @@ modeset_lock_retry: \
/**
* DRM_MODESET_LOCK_ALL_END - Helper to release and cleanup modeset locks
+ * @dev: drm device
* @ctx: local modeset acquire context, will be dereferenced
* @ret: local ret/err/etc variable to track error status
*
@@ -188,7 +191,7 @@ modeset_lock_retry: \
* to that failure. In both of these cases the code between BEGIN/END will not
* be run, so the failure will reflect the inability to grab the locks.
*/
-#define DRM_MODESET_LOCK_ALL_END(ctx, ret) \
+#define DRM_MODESET_LOCK_ALL_END(dev, ctx, ret) \
modeset_lock_fail: \
if (ret == -EDEADLK) { \
ret = drm_modeset_backoff(&ctx); \
@@ -196,6 +199,8 @@ modeset_lock_fail: \
goto modeset_lock_retry; \
} \
drm_modeset_drop_locks(&ctx); \
- drm_modeset_acquire_fini(&ctx);
+ drm_modeset_acquire_fini(&ctx); \
+ if (!drm_drv_uses_atomic_modeset(dev)) \
+ mutex_unlock(&dev->mode_config.mutex);
#endif /* DRM_MODESET_LOCK_H_ */