Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: Remove drm_modeset_legacy_acquire_ctx and crtc->acquire_ctx

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

+4 -50
-14
drivers/gpu/drm/drm_atomic.c
··· 1516 1516 void drm_atomic_legacy_backoff(struct drm_atomic_state *state) 1517 1517 { 1518 1518 struct drm_device *dev = state->dev; 1519 - unsigned crtc_mask = 0; 1520 - struct drm_crtc *crtc; 1521 1519 int ret; 1522 1520 bool global = false; 1523 - 1524 - drm_for_each_crtc(crtc, dev) { 1525 - if (crtc->acquire_ctx != state->acquire_ctx) 1526 - continue; 1527 - 1528 - crtc_mask |= drm_crtc_mask(crtc); 1529 - crtc->acquire_ctx = NULL; 1530 - } 1531 1521 1532 1522 if (WARN_ON(dev->mode_config.acquire_ctx == state->acquire_ctx)) { 1533 1523 global = true; ··· 1531 1541 ret = drm_modeset_lock_all_ctx(dev, state->acquire_ctx); 1532 1542 if (ret) 1533 1543 goto retry; 1534 - 1535 - drm_for_each_crtc(crtc, dev) 1536 - if (drm_crtc_mask(crtc) & crtc_mask) 1537 - crtc->acquire_ctx = state->acquire_ctx; 1538 1544 1539 1545 if (global) 1540 1546 dev->mode_config.acquire_ctx = state->acquire_ctx;
+1 -1
drivers/gpu/drm/drm_atomic_helper.c
··· 2975 2975 if (!state) 2976 2976 return -ENOMEM; 2977 2977 2978 - state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc); 2978 + state->acquire_ctx = crtc->dev->mode_config.acquire_ctx; 2979 2979 retry: 2980 2980 crtc_state = drm_atomic_get_crtc_state(state, crtc); 2981 2981 if (IS_ERR(crtc_state)) {
-21
drivers/gpu/drm/drm_modeset_lock.c
··· 149 149 EXPORT_SYMBOL(drm_modeset_unlock_all); 150 150 151 151 /** 152 - * drm_modeset_legacy_acquire_ctx - find acquire ctx for legacy ioctls 153 - * @crtc: drm crtc 154 - * 155 - * Legacy ioctl operations like cursor updates or page flips only have per-crtc 156 - * locking, and store the acquire ctx in the corresponding crtc. All other 157 - * legacy operations take all locks and use a global acquire context. This 158 - * function grabs the right one. 159 - */ 160 - struct drm_modeset_acquire_ctx * 161 - drm_modeset_legacy_acquire_ctx(struct drm_crtc *crtc) 162 - { 163 - if (crtc->acquire_ctx) 164 - return crtc->acquire_ctx; 165 - 166 - WARN_ON(!crtc->dev->mode_config.acquire_ctx); 167 - 168 - return crtc->dev->mode_config.acquire_ctx; 169 - } 170 - EXPORT_SYMBOL(drm_modeset_legacy_acquire_ctx); 171 - 172 - /** 173 152 * drm_warn_on_modeset_not_all_locked - check that all modeset locks are locked 174 153 * @dev: device 175 154 *
+2 -2
drivers/gpu/drm/i915/intel_display.c
··· 10715 10715 state = drm_atomic_state_alloc(dev); 10716 10716 if (!state) 10717 10717 return -ENOMEM; 10718 - state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc); 10718 + state->acquire_ctx = dev->mode_config.acquire_ctx; 10719 10719 10720 10720 retry: 10721 10721 plane_state = drm_atomic_get_plane_state(state, primary); ··· 13075 13075 return; 13076 13076 } 13077 13077 13078 - state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc); 13078 + state->acquire_ctx = crtc->dev->mode_config.acquire_ctx; 13079 13079 13080 13080 retry: 13081 13081 crtc_state = drm_atomic_get_crtc_state(state, crtc);
+1 -1
drivers/gpu/drm/i915/intel_pipe_crc.c
··· 522 522 goto unlock; 523 523 } 524 524 525 - state->acquire_ctx = drm_modeset_legacy_acquire_ctx(&crtc->base); 525 + state->acquire_ctx = crtc->base.dev->mode_config.acquire_ctx; 526 526 pipe_config = intel_atomic_get_crtc_state(state, crtc); 527 527 if (IS_ERR(pipe_config)) { 528 528 ret = PTR_ERR(pipe_config);
-9
include/drm/drm_crtc.h
··· 782 782 */ 783 783 spinlock_t commit_lock; 784 784 785 - /** 786 - * @acquire_ctx: 787 - * 788 - * Per-CRTC implicit acquire context used by atomic drivers for legacy 789 - * IOCTLs, so that atomic drivers can get at the locking acquire 790 - * context. 791 - */ 792 - struct drm_modeset_acquire_ctx *acquire_ctx; 793 - 794 785 #ifdef CONFIG_DEBUG_FS 795 786 /** 796 787 * @debugfs_entry:
-2
include/drm/drm_modeset_lock.h
··· 122 122 void drm_modeset_lock_all(struct drm_device *dev); 123 123 void drm_modeset_unlock_all(struct drm_device *dev); 124 124 void drm_warn_on_modeset_not_all_locked(struct drm_device *dev); 125 - struct drm_modeset_acquire_ctx * 126 - drm_modeset_legacy_acquire_ctx(struct drm_crtc *crtc); 127 125 128 126 int drm_modeset_lock_all_ctx(struct drm_device *dev, 129 127 struct drm_modeset_acquire_ctx *ctx);