@@ -164,6 +164,8 @@ int drm_modeset_lock_all_ctx(struct drm_device *dev,
164
164
* is 0, so no error checking is necessary
165
165
*/
166
166
#define DRM_MODESET_LOCK_ALL_BEGIN (dev , ctx , flags , ret ) \
167
+ if (!drm_drv_uses_atomic_modeset(dev)) \
168
+ mutex_lock(&dev->mode_config.mutex); \
167
169
drm_modeset_acquire_init(&ctx, flags); \
168
170
modeset_lock_retry: \
169
171
ret = drm_modeset_lock_all_ctx(dev, &ctx); \
@@ -172,6 +174,7 @@ modeset_lock_retry: \
172
174
173
175
/**
174
176
* DRM_MODESET_LOCK_ALL_END - Helper to release and cleanup modeset locks
177
+ * @dev: drm device
175
178
* @ctx: local modeset acquire context, will be dereferenced
176
179
* @ret: local ret/err/etc variable to track error status
177
180
*
@@ -188,14 +191,16 @@ modeset_lock_retry: \
188
191
* to that failure. In both of these cases the code between BEGIN/END will not
189
192
* be run, so the failure will reflect the inability to grab the locks.
190
193
*/
191
- #define DRM_MODESET_LOCK_ALL_END (ctx , ret ) \
194
+ #define DRM_MODESET_LOCK_ALL_END (dev , ctx , ret ) \
192
195
modeset_lock_fail: \
193
196
if (ret == -EDEADLK) { \
194
197
ret = drm_modeset_backoff(&ctx); \
195
198
if (!ret) \
196
199
goto modeset_lock_retry; \
197
200
} \
198
201
drm_modeset_drop_locks(&ctx); \
199
- drm_modeset_acquire_fini(&ctx);
202
+ drm_modeset_acquire_fini(&ctx); \
203
+ if (!drm_drv_uses_atomic_modeset(dev)) \
204
+ mutex_unlock(&dev->mode_config.mutex);
200
205
201
206
#endif /* DRM_MODESET_LOCK_H_ */
0 commit comments