drm: Remove drm_modeset_legacy_acquire_ctx and crtc->acquire_ctx
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 3 Apr 2017 08:32:52 +0000 (10:32 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 5 Apr 2017 07:26:45 +0000 (09:26 +0200)
With all the callers of drm_modeset_lock_crtc gone, and all the places
it was formerly used properly wiring the acquire ctx through, we can
remove this.

The only hidden context magic we still have is now the global one.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170403083304.9083-4-daniel.vetter@ffwll.ch
drivers/gpu/drm/drm_atomic.c
drivers/gpu/drm/drm_atomic_helper.c
drivers/gpu/drm/drm_modeset_lock.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_pipe_crc.c
include/drm/drm_crtc.h
include/drm/drm_modeset_lock.h

index 9b892af7811a959aa66f0288d5123877199a66a2..345310213820f87631898cae4986baf11111357e 100644 (file)
@@ -1516,19 +1516,9 @@ EXPORT_SYMBOL(drm_atomic_add_affected_planes);
 void drm_atomic_legacy_backoff(struct drm_atomic_state *state)
 {
        struct drm_device *dev = state->dev;
-       unsigned crtc_mask = 0;
-       struct drm_crtc *crtc;
        int ret;
        bool global = false;
 
-       drm_for_each_crtc(crtc, dev) {
-               if (crtc->acquire_ctx != state->acquire_ctx)
-                       continue;
-
-               crtc_mask |= drm_crtc_mask(crtc);
-               crtc->acquire_ctx = NULL;
-       }
-
        if (WARN_ON(dev->mode_config.acquire_ctx == state->acquire_ctx)) {
                global = true;
 
@@ -1542,10 +1532,6 @@ retry:
        if (ret)
                goto retry;
 
-       drm_for_each_crtc(crtc, dev)
-               if (drm_crtc_mask(crtc) & crtc_mask)
-                       crtc->acquire_ctx = state->acquire_ctx;
-
        if (global)
                dev->mode_config.acquire_ctx = state->acquire_ctx;
 }
index c3994b4d5f324702afbc06e4da10f76d93438fac..3160d08813483910bf8f63777125a5753029eda8 100644 (file)
@@ -2975,7 +2975,7 @@ int drm_atomic_helper_connector_dpms(struct drm_connector *connector,
        if (!state)
                return -ENOMEM;
 
-       state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
+       state->acquire_ctx = crtc->dev->mode_config.acquire_ctx;
 retry:
        crtc_state = drm_atomic_get_crtc_state(state, crtc);
        if (IS_ERR(crtc_state)) {
index c3ca6b859236832ae28ce74de65b75d64c439e97..64ef09a6cccb2d47e2443ca9a3bd56206031047b 100644 (file)
@@ -148,27 +148,6 @@ void drm_modeset_unlock_all(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_modeset_unlock_all);
 
-/**
- * drm_modeset_legacy_acquire_ctx - find acquire ctx for legacy ioctls
- * @crtc: drm crtc
- *
- * Legacy ioctl operations like cursor updates or page flips only have per-crtc
- * locking, and store the acquire ctx in the corresponding crtc. All other
- * legacy operations take all locks and use a global acquire context. This
- * function grabs the right one.
- */
-struct drm_modeset_acquire_ctx *
-drm_modeset_legacy_acquire_ctx(struct drm_crtc *crtc)
-{
-       if (crtc->acquire_ctx)
-               return crtc->acquire_ctx;
-
-       WARN_ON(!crtc->dev->mode_config.acquire_ctx);
-
-       return crtc->dev->mode_config.acquire_ctx;
-}
-EXPORT_SYMBOL(drm_modeset_legacy_acquire_ctx);
-
 /**
  * drm_warn_on_modeset_not_all_locked - check that all modeset locks are locked
  * @dev: device
index e27ea89efd6788b47087467c29b0f991ae8d2ffd..84abff3f43d941462aa843067121293f62c5a980 100644 (file)
@@ -10715,7 +10715,7 @@ out_hang:
                state = drm_atomic_state_alloc(dev);
                if (!state)
                        return -ENOMEM;
-               state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
+               state->acquire_ctx = dev->mode_config.acquire_ctx;
 
 retry:
                plane_state = drm_atomic_get_plane_state(state, primary);
@@ -13075,7 +13075,7 @@ void intel_crtc_restore_mode(struct drm_crtc *crtc)
                return;
        }
 
-       state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
+       state->acquire_ctx = crtc->dev->mode_config.acquire_ctx;
 
 retry:
        crtc_state = drm_atomic_get_crtc_state(state, crtc);
index 9fd9c70baeed826fb2088843cc53053a0ac9541a..206ee4f0150e7fc339018611b50dbcda7b2205a7 100644 (file)
@@ -522,7 +522,7 @@ static void hsw_trans_edp_pipe_A_crc_wa(struct drm_i915_private *dev_priv,
                goto unlock;
        }
 
-       state->acquire_ctx = drm_modeset_legacy_acquire_ctx(&crtc->base);
+       state->acquire_ctx = crtc->base.dev->mode_config.acquire_ctx;
        pipe_config = intel_atomic_get_crtc_state(state, crtc);
        if (IS_ERR(pipe_config)) {
                ret = PTR_ERR(pipe_config);
index 2be2192b13733cf2b6b714bea65ce56cab868f7e..ede60d67976ff3ca1e867e34a3457a3ac498f76a 100644 (file)
@@ -782,15 +782,6 @@ struct drm_crtc {
         */
        spinlock_t commit_lock;
 
-       /**
-        * @acquire_ctx:
-        *
-        * Per-CRTC implicit acquire context used by atomic drivers for legacy
-        * IOCTLs, so that atomic drivers can get at the locking acquire
-        * context.
-        */
-       struct drm_modeset_acquire_ctx *acquire_ctx;
-
 #ifdef CONFIG_DEBUG_FS
        /**
         * @debugfs_entry:
index 2bb065bf05932c79cbd0c4e5e8706ee052d2fb4d..4b27c2bb955c4687c9f43bad8d8cfa5b608f7189 100644 (file)
@@ -122,8 +122,6 @@ struct drm_plane;
 void drm_modeset_lock_all(struct drm_device *dev);
 void drm_modeset_unlock_all(struct drm_device *dev);
 void drm_warn_on_modeset_not_all_locked(struct drm_device *dev);
-struct drm_modeset_acquire_ctx *
-drm_modeset_legacy_acquire_ctx(struct drm_crtc *crtc);
 
 int drm_modeset_lock_all_ctx(struct drm_device *dev,
                             struct drm_modeset_acquire_ctx *ctx);