hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/gpu/drm/drm_modeset_lock.c
....@@ -21,8 +21,9 @@
2121 * OTHER DEALINGS IN THE SOFTWARE.
2222 */
2323
24
-#include <drm/drmP.h>
24
+#include <drm/drm_atomic.h>
2525 #include <drm/drm_crtc.h>
26
+#include <drm/drm_device.h>
2627 #include <drm/drm_modeset_lock.h>
2728
2829 /**
....@@ -35,7 +36,7 @@
3536 * of extra utility/tracking out of our acquire-ctx. This is provided
3637 * by &struct drm_modeset_lock and &struct drm_modeset_acquire_ctx.
3738 *
38
- * For basic principles of &ww_mutex, see: Documentation/locking/ww-mutex-design.txt
39
+ * For basic principles of &ww_mutex, see: Documentation/locking/ww-mutex-design.rst
3940 *
4041 * The basic usage pattern is to::
4142 *
....@@ -55,6 +56,10 @@
5556 * out:
5657 * drm_modeset_drop_locks(ctx);
5758 * drm_modeset_acquire_fini(ctx);
59
+ *
60
+ * For convenience this control flow is implemented in
61
+ * DRM_MODESET_LOCK_ALL_BEGIN() and DRM_MODESET_LOCK_ALL_END() for the case
62
+ * where all modeset locks need to be taken through drm_modeset_lock_all_ctx().
5863 *
5964 * If all that is needed is a single modeset lock, then the &struct
6065 * drm_modeset_acquire_ctx is not needed and the locking can be simplified
....@@ -383,11 +388,14 @@
383388 * Locks acquired with this function should be released by calling the
384389 * drm_modeset_drop_locks() function on @ctx.
385390 *
391
+ * See also: DRM_MODESET_LOCK_ALL_BEGIN() and DRM_MODESET_LOCK_ALL_END()
392
+ *
386393 * Returns: 0 on success or a negative error-code on failure.
387394 */
388395 int drm_modeset_lock_all_ctx(struct drm_device *dev,
389396 struct drm_modeset_acquire_ctx *ctx)
390397 {
398
+ struct drm_private_obj *privobj;
391399 struct drm_crtc *crtc;
392400 struct drm_plane *plane;
393401 int ret;
....@@ -408,6 +416,12 @@
408416 return ret;
409417 }
410418
419
+ drm_for_each_privobj(privobj, dev) {
420
+ ret = drm_modeset_lock(&privobj->lock, ctx);
421
+ if (ret)
422
+ return ret;
423
+ }
424
+
411425 return 0;
412426 }
413427 EXPORT_SYMBOL(drm_modeset_lock_all_ctx);