acquire ctx wire-up, part 2
Subsystems (11)
cover acquire ctx wire-up, part 2
Hi all,
Partially this is a resend of the patches now unblocked by the vmwgfx atomic conversion just merged. I could entirely drop the vmwgfx patch since it's all fixed now.
Then a bit of follow-up, plus converting the gamma_set/get ioctls. fbdev emulation and the property paths are still infested by drm_modeset_lock_all, but I think at least for fbdev we now have a semi-clear path with Thierry's series. Properties are still unclear to me, because it's a rather layered maze with lots of different callsites.
As always, comments and review highly welcome.
Cheers, Daniel
Daniel Vetter (15):
drm: Make drm_modeset_lock_crtc internal
drm: Remove drm_modeset_(un)lock_crtc
drm: Remove drm_modeset_legacy_acquire_ctx and crtc->acquire_ctx drm/atomic-helper: remove modeset_lock_all from helper_resume
drm: drop modeset_lock_all from drm_state_info
drm: Drop modeset_lock_all from the getproperty ioctl
drm: Only take crtc lock in get_gamma ioctl
drm/i915: Nuke intel_atomic_legacy_gamma_set
drm/msm: Nerf zpos property
drm/fb-helper: Give up on kgdb for atomic drivers
drm: Add explicit acquire ctx handling around ->gamma_set
drm: Add acquire ctx to ->gamma_set hook drm/atomic-helper: Remove legacy backoff hack from gamma_set
drm: extract legacy framebuffer remove
drm/fb-helper: Extract _legacy kms functions
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 3 +- drivers/gpu/drm/ast/ast_mode.c | 3 +- drivers/gpu/drm/cirrus/cirrus_mode.c | 3 +- drivers/gpu/drm/drm_atomic.c | 162 +++++++----------------------- drivers/gpu/drm/drm_atomic_helper.c | 35 +++---- drivers/gpu/drm/drm_color_mgmt.c | 51 +++++----- drivers/gpu/drm/drm_crtc_internal.h | 1 - drivers/gpu/drm/drm_fb_helper.c | 81 +++++++++------ drivers/gpu/drm/drm_framebuffer.c | 137 +++++++++++++++++++++---- drivers/gpu/drm/drm_modeset_lock.c | 102 ------------------- drivers/gpu/drm/drm_plane.c | 49 +++++---- drivers/gpu/drm/drm_property.c | 72 ++++++------- drivers/gpu/drm/gma500/gma_display.c | 3 +- drivers/gpu/drm/gma500/gma_display.h | 3 +- drivers/gpu/drm/i915/intel_display.c | 60 +---------- drivers/gpu/drm/i915/intel_pipe_crc.c | 2 +- drivers/gpu/drm/mgag200/mgag200_mode.c | 3 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 2 - drivers/gpu/drm/nouveau/dispnv04/crtc.c | 3 +- drivers/gpu/drm/nouveau/nv50_display.c | 13 +-- drivers/gpu/drm/radeon/radeon_display.c | 3 +- drivers/gpu/drm/vc4/vc4_crtc.c | 3 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 3 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 3 +- include/drm/drm_atomic_helper.h | 3 +- include/drm/drm_crtc.h | 12 +-- include/drm/drm_modeset_lock.h | 5 - 31 files changed, 344 insertions(+), 488 deletions(-)
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/15 drm: Make drm_modeset_lock_crtc internal
This is only for legacy paths that need to grab the crtc/plane lock combo. If you want to lock a crtc, just use drm_modeset_lock().
--- drivers/gpu/drm/drm_crtc_internal.h | 3 +++ drivers/gpu/drm/drm_modeset_lock.c | 14 -------------- include/drm/drm_modeset_lock.h | 2 -- 3 files changed, 3 insertions(+), 16 deletions(-)
drivers/gpu/drm/drm_crtc_internal.h +3 -0
@@ -61,6 +61,9 @@ int drm_mode_getresources(struct drm_device *dev, void *data, struct drm_file *file_priv); +/* drm_modeset_lock.c */ +void drm_modeset_lock_crtc (struct drm_crtc *crtc, +struct drm_plane *plane);/* drm_dumb_buffers.c */ /* IOCTLs */ int drm_mode_create_dumb_ioctl(struct drm_device *dev,
drivers/gpu/drm/drm_modeset_lock.c +0 -14
@@ -148,19 +148,6 @@ void drm_modeset_unlock_all(struct drm_device *dev) }EXPORT_SYMBOL (drm_modeset_unlock_all); -/** -* drm_modeset_lock_crtc - lock crtc with hidden acquire ctx for a plane update -* @crtc: DRM CRTC -* @plane: DRM plane to be updated on @crtc -* -* This function locks the given crtc and plane (which should be either the -* primary or cursor plane) using a hidden acquire context. This is necessary so -* that drivers internally using the atomic interfaces can grab further locks -* with the lock acquire context. -* -* Note that @plane can be NULL, e.g. when the cursor support hasn't yet been -* converted to universal planes yet. -*/ void drm_modeset_lock_crtc (struct drm_crtc *crtc,struct drm_plane *plane) {
@@ -205,7 +192,6 @@ void drm_modeset_lock_crtc(struct drm_crtc *crtc, goto retry; } } -EXPORT_SYMBOL (drm_modeset_lock_crtc);/** * drm_modeset_legacy_acquire_ctx - find acquire ctx for legacy ioctls
include/drm/drm_modeset_lock.h +0 -2
@@ -121,8 +121,6 @@ struct drm_plane;void drm_modeset_lock_all (struct drm_device *dev);void drm_modeset_unlock_all (struct drm_device *dev); -void drm_modeset_lock_crtc (struct drm_crtc *crtc, -struct drm_plane *plane);void drm_modeset_unlock_crtc (struct drm_crtc *crtc);void drm_warn_on_modeset_not_all_locked (struct drm_device *dev); struct drm_modeset_acquire_ctx *
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
kbuild test robot
build botRe: [PATCH 01/15] drm: Make drm_modeset_lock_crtc internal
url: https://github.com/0day-ci/linux/commits/Daniel-Vetter/acquire-ctx-wire-up-part-2/20170404-053514 config: i386-randconfig-x010-201714 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3)…
Hi Daniel,
[auto build test ERROR on next-20170330]
[also build test ERROR on v4.11-rc5]
[cannot apply to drm/drm-next drm-intel/for-linux-next robclark/msm-next v4.9-rc8 v4.9-rc7 v4.9-rc6] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Daniel-Vetter/acquire-ctx-wire-up-part-2/20170404-053514
config: i386-randconfig-x010-201714 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce:
# save the attached .config to linux build tree
make ARCH=i386 All errors (new ones prefixed by >>):
drivers/gpu//drm/vmwgfx/vmwgfx_kms.c: In function 'vmw_du_crtc_cursor_set2':
>> drivers/gpu//drm/vmwgfx/vmwgfx_kms.c:228:2: error: implicit declaration of function 'drm_modeset_lock_crtc' [-Werror=implicit-function-declaration]
drm_modeset_lock_crtc(crtc, crtc->cursor);
^~~~~~~~~~~~~~~~~~~~~cc1: some warnings being treated as errors
vim +/drm_modeset_lock_crtc +228 drivers/gpu//drm/vmwgfx/vmwgfx_kms.c
8fbf9d92 Thomas Hellstrom 2015-11-26 222 du->core_hotspot_x = hot_x; 8fbf9d92 Thomas Hellstrom 2015-11-26 223 du->core_hotspot_y = hot_y; 8fbf9d92 Thomas Hellstrom 2015-11-26 224 } fb1d9738 Jakob Bornecrantz 2009-12-10 225 bfb89928 Daniel Vetter 2012-12-02 226 out: bfb89928 Daniel Vetter 2012-12-02 227 drm_modeset_unlock_all(dev_priv->dev); 4d02e2de Daniel Vetter 2014-11-11 @228 drm_modeset_lock_crtc(crtc, crtc->cursor); bfb89928 Daniel Vetter 2012-12-02 229 bfb89928 Daniel Vetter 2012-12-02 230 return ret;
fb1d9738 Jakob Bornecrantz 2009-12-10 231 }
:::::: The code at line 228 was first introduced by commit :::::: 4d02e2de0e80a786452e70d7f3a20a50641e6620 drm: Per-plane locking
:::::: TO: Daniel Vetter <[email protected]>
:::::: CC: Dave Airlie <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/15 drm: Remove drm_modeset_(un)lock_crtc
In reply to Daniel VetterThe last user, the cursor ioctl, can just open-code this too. We simply have to move the acquire ctx dance from the universal function up into the top-level ioctl handler.
--- drivers/gpu/drm/drm_crtc_internal.h | 3 -- drivers/gpu/drm/drm_modeset_lock.c | 67 ------------------------------------- drivers/gpu/drm/drm_plane.c | 49 +++++++++++++-------------- include/drm/drm_modeset_lock.h | 1 - 4 files changed, 24 insertions(+), 96 deletions(-)
drivers/gpu/drm/drm_crtc_internal.h +0 -3
@@ -61,9 +61,6 @@ int drm_mode_getresources(struct drm_device *dev, void *data, struct drm_file *file_priv); -/* drm_modeset_lock.c */ -void drm_modeset_lock_crtc (struct drm_crtc *crtc, -struct drm_plane *plane);/* drm_dumb_buffers.c */ /* IOCTLs */ int drm_mode_create_dumb_ioctl(struct drm_device *dev,
drivers/gpu/drm/drm_modeset_lock.c +0 -67
79 lines not on this page · raw message
drivers/gpu/drm/drm_plane.c +24 -25
101 lines not on this page · raw message
include/drm/drm_modeset_lock.h +0 -1
@@ -121,7 +121,6 @@ struct drm_plane;void drm_modeset_lock_all (struct drm_device *dev);void drm_modeset_unlock_all (struct drm_device *dev); -void drm_modeset_unlock_crtc (struct drm_crtc *crtc);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);
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
kbuild test robot
build botRe: [PATCH 02/15] drm: Remove drm_modeset_(un)lock_crtc
url: https://github.com/0day-ci/linux/commits/Daniel-Vetter/acquire-ctx-wire-up-part-2/20170404-053514 config: i386-randconfig-x010-201714 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3)…
Hi Daniel,
[auto build test ERROR on next-20170330]
[cannot apply to drm/drm-next drm-intel/for-linux-next robclark/msm-next v4.9-rc8 v4.9-rc7 v4.9-rc6 v4.11-rc5] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Daniel-Vetter/acquire-ctx-wire-up-part-2/20170404-053514
config: i386-randconfig-x010-201714 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce:
# save the attached .config to linux build tree
make ARCH=i386 All errors (new ones prefixed by >>):
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c: In function 'vmw_du_crtc_cursor_set2':
>> drivers/gpu/drm/vmwgfx/vmwgfx_kms.c:158:2: error: implicit declaration of function 'drm_modeset_unlock_crtc' [-Werror=implicit-function-declaration]
drm_modeset_unlock_crtc(crtc);
^~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c:228:2: error: implicit declaration of function 'drm_modeset_lock_crtc' [-Werror=implicit-function-declaration]
drm_modeset_lock_crtc(crtc, crtc->cursor);
^~~~~~~~~~~~~~~~~~~~~cc1: some warnings being treated as errors
vim +/drm_modeset_unlock_crtc +158 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
bfb89928 Daniel Vetter 2012-12-02 152 * FIXME: Unclear whether there's any global state touched by the bfb89928 Daniel Vetter 2012-12-02 153 * cursor_set function, especially vmw_cursor_update_position looks bfb89928 Daniel Vetter 2012-12-02 154 * suspicious. For now take the easy route and reacquire all locks. We bfb89928 Daniel Vetter 2012-12-02 155 * can do this since the caller in the drm core doesn't check anything bfb89928 Daniel Vetter 2012-12-02 156 * which is protected by any looks. bfb89928 Daniel Vetter 2012-12-02 157 */ 21e88620 Rob Clark 2014-10-30 @158 drm_modeset_unlock_crtc(crtc); bfb89928 Daniel Vetter 2012-12-02 159 drm_modeset_lock_all(dev_priv->dev); 8fbf9d92 Thomas Hellstrom 2015-11-26 160 hotspot_x = hot_x + du->hotspot_x; 8fbf9d92 Thomas Hellstrom 2015-11-26 161 hotspot_y = hot_y + du->hotspot_y;
:::::: The code at line 158 was first introduced by commit
:::::: 21e88620aa21b48d4f62d29275e3e2944a5ea2b5 drm/vmwgfx: fix lock breakage
:::::: TO: Rob Clark <[email protected]> :::::: CC: Thomas Hellstrom <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 02/15] drm: Remove drm_modeset_(un)lock_crtc
Quoted 1 line · kbuild test robot
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
It should compile just fine on latest linux-next (if there is one) where this code in vmwgfx is already removed. Well you just need the latest drm-next from Dave Airlie.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 02/15] drm: Remove drm_modeset_(un)lock_crtc
Hi
X no longer starts for me and I've bisected it back to this commit
During bisect I ended up on commits where my laptop would lockup during boot
Regards
Mike
Quoted 4 lines · On Tue, 4 Apr 2017 at 06:39 Daniel Vetter <[email protected]> wrote:
Quoted 1 line · kbuild test robot
[if your patch is applied to the wrong git tree, please drop us a note
to help improve the system]
Quoted 13 lines
It should compile just fine on latest linux-next (if there is one) where this code in vmwgfx is already removed. Well you just need the latest drm-next from Dave Airlie.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 <+41%2079%20365%2057%2048> - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 02/15] drm: Remove drm_modeset_(un)lock_crtc
Quoted 5 lines · Mike Lothian
Hi
X no longer starts for me and I've bisected it back to this commit
During bisect I ended up on commits where my laptop would lockup during boot
The bugfix the hangs is in linux-next, but hasn't landed in drm-next yet:
commit 8cb68c83ab99a474ae847602f0c514d0fe17cc82
Author: Daniel Vetter <[email protected]> Date: Mon Apr 10 13:54:45 2017 +0200
drm: Fix get_property logic fumble
The bugfix for the issue you bisected is already fixed in
commit 2e0641631f233b5af09f0bfeaa6220d10cad75e7
Author: Daniel Vetter <[email protected]> Date: Fri Apr 7 18:48:17 2017 +0200
drm: Only take cursor locks when the cursor plane exists
If you still have troubles with those patches applied, then I need to dig more. -Daniel
Quoted 23 lines
Regards
Mike
Quoted 17 lines · On Tue, 4 Apr 2017 at 06:39 Daniel Vetter <[email protected]> wrote:
Quoted 2 lines · kbuild test robot
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
It should compile just fine on latest linux-next (if there is one) where this code in vmwgfx is already removed. Well you just need the latest drm-next from Dave Airlie.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/15 drm: Remove drm_modeset_legacy_acquire_ctx and crtc->acquire_ctx
In reply to Daniel VetterWith 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.
--- drivers/gpu/drm/drm_atomic.c | 14 -------------- drivers/gpu/drm/drm_atomic_helper.c | 2 +- drivers/gpu/drm/drm_modeset_lock.c | 21 --------------------- drivers/gpu/drm/i915/intel_display.c | 4 ++-- drivers/gpu/drm/i915/intel_pipe_crc.c | 2 +- include/drm/drm_crtc.h | 9 --------- include/drm/drm_modeset_lock.h | 2 -- 7 files changed, 4 insertions(+), 50 deletions(-)
drivers/gpu/drm/drm_atomic.c +0 -14
@@ -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 @@ void drm_atomic_legacy_backoff(struct drm_atomic_state *state)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; }
drivers/gpu/drm/drm_atomic_helper.c +1 -1
@@ -2976,7 +2976,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)) {
drivers/gpu/drm/drm_modeset_lock.c +0 -21
@@ -149,27 +149,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 *
drivers/gpu/drm/i915/intel_display.c +2 -2
@@ -10727,7 +10727,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, 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);
@@ -13090,7 +13090,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);
drivers/gpu/drm/i915/intel_pipe_crc.c +1 -1
@@ -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);
include/drm/drm_crtc.h +0 -9
@@ -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:
include/drm/drm_modeset_lock.h +0 -2
@@ -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);
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/15 drm/atomic-helper: remove modeset_lock_all from helper_resume
In reply to Daniel VetterAtomic code rely shouldn't rely on the magic hidden acquire context.
v2: Remove unused config local var (gcc).
--- drivers/gpu/drm/drm_atomic_helper.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +12 -4
@@ -2623,14 +2623,22 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_duplicated_state);int drm_atomic_helper_resume (struct drm_device *dev,struct drm_atomic_state *state) { -struct drm_mode_config *config = &dev->mode_config; +struct drm_modeset_acquire_ctx ctx;int err;drm_mode_config_reset (dev); -drm_modeset_lock_all (dev); - err =drm_atomic_helper_commit_duplicated_state (state, config->acquire_ctx); -drm_modeset_unlock_all (dev); +drm_modeset_acquire_init (&ctx,0 ); +while (1 ) { + err =drm_atomic_helper_commit_duplicated_state (state, &ctx); +if (err != -EDEADLK ) +break ; + +drm_modeset_backoff (&ctx); + } + +drm_modeset_drop_locks (&ctx); +drm_modeset_acquire_fini (&ctx);return err; }
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 04/15] drm/atomic-helper: remove modeset_lock_all from helper_resume
Quoted 1 line · Daniel Vetter
Atomic code rely shouldn't rely on the magic hidden acquire context.
Repeated rely in commit message. I'm assuming you mean:
"Atomic code shouldn't rely on the magic hidden acquire context."
Quoted 42 lines
v2: Remove unused config local var (gcc).
Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)drivers/gpu/drm/drm_atomic_helper.c +12
-5@@ -2623,14 +2623,22 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_duplicated_state);int drm_atomic_helper_resume (struct drm_device *dev,struct drm_atomic_state *state) { -struct drm_mode_config *config = &dev->mode_config; +struct drm_modeset_acquire_ctx ctx;int err;drm_mode_config_reset (dev); -drm_modeset_lock_all (dev); - err =drm_atomic_helper_commit_duplicated_state (state, config->acquire_ctx); -drm_modeset_unlock_all (dev); +drm_modeset_acquire_init (&ctx,0 ); +while (1 ) { + err =drm_atomic_helper_commit_duplicated_state (state, &ctx); +if (err != -EDEADLK ) +break ; + +drm_modeset_backoff (&ctx); + } + +drm_modeset_drop_locks (&ctx); +drm_modeset_acquire_fini (&ctx);return err; } --2.11.0
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/15 drm: drop modeset_lock_all from drm_state_info
In reply to Daniel VetterIf we push the locks down we don't have to take them all at the same time.
Aside: Making dump_info fully safe should be fairly simple, if we protect the ->state pointers with rcu. Simply putting a synchronize_rcu() into the drm_atomic_state free function should be all that's roughly needed. Well except we shouldn't block in there, so better to put that into a work_struct. But I've not set out to fix that little issue.
--- drivers/gpu/drm/drm_atomic.c | 60 ++++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 21 deletions(-)
drivers/gpu/drm/drm_atomic.c +39 -21
@@ -1676,22 +1676,8 @@ static void drm_atomic_print_state(const struct drm_atomic_state *state)drm_atomic_connector_print_state (&p, connector_state); } -/** -* drm_state_dump - dump entire device atomic state -* @dev: the drm device -* @p: where to print the state to -* -* Just for debugging. Drivers might want an option to dump state -* to dmesg in case of error irq's. (Hint, you probably want to -* ratelimit this!) -* -* The caller must drm_modeset_lock_all(), or if this is called -* from error irq handler, it should not be enabled by default. -* (Ie. if you are debugging errors you might not care that this -* is racey. But calling this without all modeset locks held is -* not inherently safe.) -*/ -void drm_state_dump (struct drm_device *dev,struct drm_printer *p) +static void __drm_state_dump (struct drm_device *dev,struct drm_printer *p, +bool take_locks) {struct drm_mode_config *config = &dev->mode_config;struct drm_plane *plane;
@@ -1702,17 +1688,51 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p)if (!drm_core_check_feature (dev,DRIVER_ATOMIC ))return ; -list_for_each_entry (plane, &config->plane_list, head) +list_for_each_entry (plane, &config->plane_list, head) { +if (take_locks) +drm_modeset_lock (&plane->mutex,NULL );drm_atomic_plane_print_state (p, plane->state); +if (take_locks) +drm_modeset_unlock (&plane->mutex); + } -list_for_each_entry (crtc, &config->crtc_list, head) +list_for_each_entry (crtc, &config->crtc_list, head) { +if (take_locks) +drm_modeset_lock (&crtc->mutex,NULL );drm_atomic_crtc_print_state (p, crtc->state); +if (take_locks) +drm_modeset_unlock (&crtc->mutex); + }drm_connector_list_iter_begin (dev, &conn_iter); +if (take_locks) +drm_modeset_lock (&dev->mode_config.connection_mutex,NULL );drm_for_each_connector_iter (connector, &conn_iter)drm_atomic_connector_print_state (p, connector->state); +if (take_locks) +drm_modeset_unlock (&dev->mode_config.connection_mutex);drm_connector_list_iter_end (&conn_iter); } + +/** +* drm_state_dump - dump entire device atomic state +* @dev: the drm device +* @p: where to print the state to +* +* Just for debugging. Drivers might want an option to dump state +* to dmesg in case of error irq's. (Hint, you probably want to +* ratelimit this!) +* +* The caller must drm_modeset_lock_all(), or if this is called +* from error irq handler, it should not be enabled by default. +* (Ie. if you are debugging errors you might not care that this +* is racey. But calling this without all modeset locks held is +* not inherently safe.) +*/ +void drm_state_dump (struct drm_device *dev,struct drm_printer *p) +{ +__drm_state_dump (dev, p, false); +}EXPORT_SYMBOL (drm_state_dump);#ifdef CONFIG_DEBUG_FS
@@ -1722,9 +1742,7 @@ static int drm_state_info(struct seq_file *m, void *data)struct drm_device *dev = node->minor->dev;struct drm_printer p =drm_seq_file_printer (m); -drm_modeset_lock_all (dev); -drm_state_dump (dev, &p); -drm_modeset_unlock_all (dev); +__drm_state_dump (dev, &p, true);return 0 ; }
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/15 drm: Drop modeset_lock_all from the getproperty ioctl
In reply to Daniel VetterProperties, i.e. the struct drm_property specifying the type and value range of a property, not the instantiation on a given object, are invariant over the lifetime of a driver.
Hence no locking at all is needed, we can just remove it.
While at it give the function some love and simplify it, to get it under the 80 char limit:
- Straighten the loops to reduce the nesting.
- use u64_to_user_ptr casting helper
- use put_user for fixed u64 copies.
Note there's a small behavioural change in that we now copy parts of the values to userspace if the arrays are a bit too small. Since userspace will immediately retry anyway, this doesn't matter.
--- drivers/gpu/drm/drm_property.c | 72 +++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 43 deletions(-)
drivers/gpu/drm/drm_property.c +29 -43
@@ -442,8 +442,7 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,struct drm_property *property;int enum_count =0 ;int value_count =0 ; -int ret =0 , i; -int copied; +int i, copied;struct drm_property_enum *prop_enum;struct drm_mode_property_enum __user *enum_ptr;uint64_t __user *values_ptr;
@@ -451,55 +450,43 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,if (!drm_core_check_feature (dev,DRIVER_MODESET ))return -EINVAL ; -drm_modeset_lock_all (dev); property =drm_property_find (dev, out_resp->prop_id); -if (!property) { - ret = -ENOENT ; - goto done; - } - -if (drm_property_type_is (property,DRM_MODE_PROP_ENUM ) || -drm_property_type_is (property,DRM_MODE_PROP_BITMASK )) { -list_for_each_entry (prop_enum, &property->enum_list, head) - enum_count++; - } - - value_count = property->num_values; +if (!property) +return -ENOENT ;strncpy (out_resp->name, property->name,DRM_PROP_NAME_LEN ); out_resp->name[DRM_PROP_NAME_LEN -1 ] =0 ; out_resp->flags = property->flags; -if ((out_resp->count_values >= value_count) && value_count) { - values_ptr = (uint64_t __user *)(unsigned long )out_resp->values_ptr; -for (i =0 ; i < value_count; i++) { -if (copy_to_user (values_ptr + i, &property->values[i],sizeof (uint64_t ))) { - ret = -EFAULT ; - goto done; - } + value_count = property->num_values; + values_ptr =u64_to_user_ptr (out_resp->values_ptr); + +for (i =0 ; i < value_count; i++) { +if (i < out_resp->count_values && +put_user (property->values[i], values_ptr + i)) { +return -EFAULT ; } } out_resp->count_values = value_count; + copied =0 ; + enum_ptr =u64_to_user_ptr (out_resp->enum_blob_ptr); +if (drm_property_type_is (property,DRM_MODE_PROP_ENUM ) || -drm_property_type_is (property,DRM_MODE_PROP_BITMASK )) { -if ((out_resp->count_enum_blobs >= enum_count) && enum_count) { - copied =0 ; - enum_ptr = (struct drm_mode_property_enum __user *)(unsigned long )out_resp->enum_blob_ptr; -list_for_each_entry (prop_enum, &property->enum_list, head) { - -if (copy_to_user (&enum_ptr[copied].value, &prop_enum->value,sizeof (uint64_t ))) { - ret = -EFAULT ; - goto done; - } - -if (copy_to_user (&enum_ptr[copied].name, - &prop_enum->name,DRM_PROP_NAME_LEN )) { - ret = -EFAULT ; - goto done; - } - copied++; - } +drm_property_type_is (property,DRM_MODE_PROP_BITMASK )) { +list_for_each_entry (prop_enum, &property->enum_list, head) { + enum_count++; +if (out_resp->count_enum_blobs <= enum_count) +continue ; + +if (copy_to_user (&enum_ptr[copied].value, + &prop_enum->value,sizeof (uint64_t ))) +return -EFAULT ; + +if (copy_to_user (&enum_ptr[copied].name, + &prop_enum->name,DRM_PROP_NAME_LEN )) +return -EFAULT ; + copied++; } out_resp->count_enum_blobs = enum_count; }
@@ -514,9 +501,8 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,*/ if (drm_property_type_is (property,DRM_MODE_PROP_BLOB )) out_resp->count_enum_blobs =0 ; -done: -drm_modeset_unlock_all (dev); -return ret; + +return 0 ; }static void drm_property_free_blob (struct kref *kref)
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 06/15] drm: Drop modeset_lock_all from the getproperty ioctl
Quoted 12 lines · Daniel Vetter
Properties, i.e. the struct
drm_propertyspecifying the type and value range of a property, not the instantiation on a given object, are invariant over the lifetime of a driver.Hence no locking at all is needed, we can just remove it.
While at it give the function some love and simplify it, to get it under the 80 char limit:
- Straighten the loops to reduce the nesting.
- useu64_to_user_ptrcasting helper
- useput_userfor fixed u64 copies.
Quoted 5 lines
Note there's a small behavioural change in that we now copy parts of the values to userspace if the arrays are a bit too small. Since userspace will immediately retry anyway, this doesn't matter.
Signed-off-by Daniel Vetter <[email protected]>
This causes a segfault in our ddx:
https://bugs.freedesktop.org/show_bug.cgi?id=100673
Alex
Quoted 115 lines
--- drivers/gpu/drm/drm_property.c | 72 +++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 43 deletions(-)drivers/gpu/drm/drm_property.c +29
-44@@ -442,8 +442,7 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,struct drm_property *property;int enum_count =0 ;int value_count =0 ; -int ret =0 , i; -int copied; +int i, copied;struct drm_property_enum *prop_enum;struct drm_mode_property_enum __user *enum_ptr;uint64_t __user *values_ptr;@@ -451,55 +450,43 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,if (!drm_core_check_feature (dev,DRIVER_MODESET ))return -EINVAL ; -drm_modeset_lock_all (dev); property =drm_property_find (dev, out_resp->prop_id); -if (!property) { - ret = -ENOENT ; - goto done; - } - -if (drm_property_type_is (property,DRM_MODE_PROP_ENUM ) || -drm_property_type_is (property,DRM_MODE_PROP_BITMASK )) { -list_for_each_entry (prop_enum, &property->enum_list, head) - enum_count++; - } - - value_count = property->num_values; +if (!property) +return -ENOENT ;strncpy (out_resp->name, property->name,DRM_PROP_NAME_LEN ); out_resp->name[DRM_PROP_NAME_LEN -1 ] =0 ; out_resp->flags = property->flags; -if ((out_resp->count_values >= value_count) && value_count) { - values_ptr = (uint64_t __user *)(unsigned long )out_resp->values_ptr; -for (i =0 ; i < value_count; i++) { -if (copy_to_user (values_ptr + i, &property->values[i],sizeof (uint64_t ))) { - ret = -EFAULT ; - goto done; - } + value_count = property->num_values; + values_ptr =u64_to_user_ptr (out_resp->values_ptr); + +for (i =0 ; i < value_count; i++) { +if (i < out_resp->count_values && +put_user (property->values[i], values_ptr + i)) { +return -EFAULT ; } } out_resp->count_values = value_count; + copied =0 ; + enum_ptr =u64_to_user_ptr (out_resp->enum_blob_ptr); +if (drm_property_type_is (property,DRM_MODE_PROP_ENUM ) || -drm_property_type_is (property,DRM_MODE_PROP_BITMASK )) { -if ((out_resp->count_enum_blobs >= enum_count) && enum_count) { - copied =0 ; - enum_ptr = (struct drm_mode_property_enum __user *)(unsigned long )out_resp->enum_blob_ptr; -list_for_each_entry (prop_enum, &property->enum_list, head) { - -if (copy_to_user (&enum_ptr[copied].value, &prop_enum->value,sizeof (uint64_t ))) { - ret = -EFAULT ; - goto done; - } - -if (copy_to_user (&enum_ptr[copied].name, - &prop_enum->name,DRM_PROP_NAME_LEN )) { - ret = -EFAULT ; - goto done; - } - copied++; - } +drm_property_type_is (property,DRM_MODE_PROP_BITMASK )) { +list_for_each_entry (prop_enum, &property->enum_list, head) { + enum_count++; +if (out_resp->count_enum_blobs <= enum_count) +continue ; + +if (copy_to_user (&enum_ptr[copied].value, + &prop_enum->value,sizeof (uint64_t ))) +return -EFAULT ; + +if (copy_to_user (&enum_ptr[copied].name, + &prop_enum->name,DRM_PROP_NAME_LEN )) +return -EFAULT ; + copied++; } out_resp->count_enum_blobs = enum_count; }@@ -514,9 +501,8 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,*/ if (drm_property_type_is (property,DRM_MODE_PROP_BLOB )) out_resp->count_enum_blobs =0 ; -done: -drm_modeset_unlock_all (dev); -return ret; + +return 0 ; }static void drm_property_free_blob (struct kref *kref) --2.11.0
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH 06/15] drm: Drop modeset_lock_all from the getproperty ioctl
Quoted 13 lines · Alex Deucher
Quoted 12 lines · Daniel Vetter
Properties, i.e. the struct
drm_propertyspecifying the type and value range of a property, not the instantiation on a given object, are invariant over the lifetime of a driver.Hence no locking at all is needed, we can just remove it.
While at it give the function some love and simplify it, to get it under the 80 char limit:
- Straighten the loops to reduce the nesting.
- useu64_to_user_ptrcasting helper
- useput_userfor fixed u64 copies.
Quoted 8 lines
Quoted 5 lines
Note there's a small behavioural change in that we now copy parts of the values to userspace if the arrays are a bit too small. Since userspace will immediately retry anyway, this doesn't matter.
Signed-off-by Daniel Vetter <[email protected]>This causes a segfault in our ddx:
https://bugs.freedesktop.org/show_bug.cgi?id=100673
Should be fixed by:
commit 8cb68c83ab99a474ae847602f0c514d0fe17cc82
Author: Daniel Vetter <[email protected]> Date: Mon Apr 10 13:54:45 2017 +0200
drm: Fix get_property logic fumble
Yet again I've proven that I can't negate conditions :(
Testcase: igt/kms_properties/get_property-sanity
Does that help?
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 7/15 drm: Only take crtc lock in get_gamma ioctl
In reply to Daniel VetterWe don't call into drivers at all here, this is enough. Also, we can reduce the critical section a bit to simplify the code. crtc->gamma_size is set up once at driver load and then invariant, so also doesn't need any protection.
--- drivers/gpu/drm/drm_color_mgmt.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/gpu/drm/drm_color_mgmt.c +6 -10
@@ -295,19 +295,15 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev,if (!drm_core_check_feature (dev,DRIVER_MODESET ))return -EINVAL ; -drm_modeset_lock_all (dev); crtc =drm_crtc_find (dev, crtc_lut->crtc_id); -if (!crtc) { - ret = -ENOENT ; - goto out; - } +if (!crtc) +return -ENOENT ;/* memcpy into gamma store */ -if (crtc_lut->gamma_size != crtc->gamma_size) { - ret = -EINVAL ; - goto out; - } +if (crtc_lut->gamma_size != crtc->gamma_size) +return -EINVAL ; +drm_modeset_lock (&crtc->mutex,NULL ); size = crtc_lut->gamma_size * (sizeof (uint16_t )); r_base = crtc->gamma_store;if (copy_to_user ((void __user *)(unsigned long )crtc_lut->red, r_base, size)) {
@@ -327,6 +323,6 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev, goto out; } out: -drm_modeset_unlock_all (dev); +drm_modeset_unlock (&crtc->mutex);return ret; }
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/15 drm/i915: Nuke intel_atomic_legacy_gamma_set
In reply to Daniel VetterWe do set DRIVER_ATOMIC now.
--- drivers/gpu/drm/i915/intel_display.c | 44 +----------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -43
@@ -13113,50 +13113,8 @@ void intel_crtc_restore_mode(struct drm_crtc *crtc)drm_atomic_state_put (state); } -/* -* FIXME: Remove this once i915 is fully DRIVER_ATOMIC by calling -* drm_atomic_helper_legacy_gamma_set() directly. -*/ -static int intel_atomic_legacy_gamma_set (struct drm_crtc *crtc, -u16 *red,u16 *green,u16 *blue, -uint32_t size) -{ -struct drm_device *dev = crtc->dev; -struct drm_mode_config *config = &dev->mode_config; -struct drm_crtc_state *state; -int ret; - - ret =drm_atomic_helper_legacy_gamma_set (crtc, red, green, blue, size); -if (ret) -return ret; - -/* -* Make sure we update the legacy properties so this works when -* atomic is not enabled. -*/ - - state = crtc->state; - -drm_object_property_set_value (&crtc->base, - config->degamma_lut_property, - (state->degamma_lut) ? - state->degamma_lut->base.id :0 ); - -drm_object_property_set_value (&crtc->base, - config->ctm_property, - (state->ctm) ? - state->ctm->base.id :0 ); - -drm_object_property_set_value (&crtc->base, - config->gamma_lut_property, - (state->gamma_lut) ? - state->gamma_lut->base.id :0 ); - -return 0 ; -} -static const struct drm_crtc_funcs intel_crtc_funcs = { - .gamma_set = intel_atomic_legacy_gamma_set, + .gamma_set = drm_atomic_helper_legacy_gamma_set, .set_config = drm_atomic_helper_set_config, .set_property = drm_atomic_helper_crtc_set_property, .destroy = intel_crtc_destroy,
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 08/15] drm/i915: Nuke intel_atomic_legacy_gamma_set
Op 03-04-17 om 10:32 schreef Daniel Vetter:
Quoted 53 lines
We do set
DRIVER_ATOMICnow.Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 44 +----------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-)drivers/gpu/drm/i915/intel_display.c +0
-38@@ -13113,50 +13113,8 @@ void intel_crtc_restore_mode(struct drm_crtc *crtc)drm_atomic_state_put (state); } -/* -* FIXME: Remove this once i915 is fully DRIVER_ATOMIC by calling -* drm_atomic_helper_legacy_gamma_set() directly. -*/ -static int intel_atomic_legacy_gamma_set (struct drm_crtc *crtc, -u16 *red,u16 *green,u16 *blue, -uint32_t size) -{ -struct drm_device *dev = crtc->dev; -struct drm_mode_config *config = &dev->mode_config; -struct drm_crtc_state *state; -int ret; - - ret =drm_atomic_helper_legacy_gamma_set (crtc, red, green, blue, size); -if (ret) -return ret; - -/* -* Make sure we update the legacy properties so this works when -* atomic is not enabled. -*/ - - state = crtc->state; - -drm_object_property_set_value (&crtc->base, - config->degamma_lut_property, - (state->degamma_lut) ? - state->degamma_lut->base.id :0 ); - -drm_object_property_set_value (&crtc->base, - config->ctm_property, - (state->ctm) ? - state->ctm->base.id :0 ); - -drm_object_property_set_value (&crtc->base, - config->gamma_lut_property, - (state->gamma_lut) ? - state->gamma_lut->base.id :0 );
drivers/gpu/drm/i915/intel_display.c void intel_crtc_restore_mode(struct drm_crtc *crtc) · line 13120
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +1
-5- -return 0 ; -} -static const struct drm_crtc_funcs intel_crtc_funcs = { - .gamma_set = intel_atomic_legacy_gamma_set, + .gamma_set = drm_atomic_helper_legacy_gamma_set, .set_config = drm_atomic_helper_set_config, .set_property = drm_atomic_helper_crtc_set_property, .destroy = intel_crtc_destroy,
I guess the comment is out of date with drm_object_property_get_value now checking for drm_drv_uses_atomic_modeset instead.
All patches in this series look good, I've seen nothing to comment on. :)
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 08/15] drm/i915: Nuke intel_atomic_legacy_gamma_set
Quoted 59 lines · Maarten Lankhorst
Op 03-04-17 om 10:32 schreef Daniel Vetter:
Quoted 58 lines
We do set
DRIVER_ATOMICnow.Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 44 +----------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-)drivers/gpu/drm/i915/intel_display.c +0
-42@@ -13113,50 +13113,8 @@ void intel_crtc_restore_mode(struct drm_crtc *crtc)drm_atomic_state_put (state); } -/* -* FIXME: Remove this once i915 is fully DRIVER_ATOMIC by calling -* drm_atomic_helper_legacy_gamma_set() directly. -*/ -static int intel_atomic_legacy_gamma_set (struct drm_crtc *crtc, -u16 *red,u16 *green,u16 *blue, -uint32_t size) -{ -struct drm_device *dev = crtc->dev; -struct drm_mode_config *config = &dev->mode_config; -struct drm_crtc_state *state; -int ret; - - ret =drm_atomic_helper_legacy_gamma_set (crtc, red, green, blue, size); -if (ret) -return ret; - -/* -* Make sure we update the legacy properties so this works when -* atomic is not enabled. -*/ - - state = crtc->state; - -drm_object_property_set_value (&crtc->base, - config->degamma_lut_property, - (state->degamma_lut) ? - state->degamma_lut->base.id :0 ); - -drm_object_property_set_value (&crtc->base, - config->ctm_property, - (state->ctm) ? - state->ctm->base.id :0 ); - -drm_object_property_set_value (&crtc->base, - config->gamma_lut_property, - (state->gamma_lut) ? - state->gamma_lut->base.id :0 ); - -return 0 ; -} -static const struct drm_crtc_funcs intel_crtc_funcs = {
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c void intel_crtc_restore_mode(struct drm_crtc *crtc) · line 13120
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-1- .gamma_set = intel_atomic_legacy_gamma_set, + .gamma_set = drm_atomic_helper_legacy_gamma_set, .set_config = drm_atomic_helper_set_config, .set_property = drm_atomic_helper_crtc_set_property, .destroy = intel_crtc_destroy,I guess the comment is out of date with
drm_object_property_get_valuenow checking fordrm_drv_uses_atomic_modesetinstead.
Good point, I added a note about that to the commit message before applying.
Quoted 4 lines
All patches in this series look good, I've seen nothing to comment on. :)
Reviewed-by Maarten Lankhorst <[email protected]>
Thanks, Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 9/15 drm/msm: Nerf zpos property
In reply to Daniel VetterIt's not wired up, and if it is, it should be moved over to the new fancy standardized zpos property exposed through drm_plane_create_zpos_property().
--- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +0 -2
@@ -108,8 +108,6 @@ static void mdp5_plane_install_properties(struct drm_plane *plane, create_enum, name##_prop_enum_list, \ ARRAY_SIZE(name##_prop_enum_list)) -INSTALL_RANGE_PROPERTY (zpos,ZPOS ,1 ,255 ,1 ); -mdp5_plane_install_rotation_property (dev, plane);#undef INSTALL_RANGE_PROPERTY
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 09/15] drm/msm: Nerf zpos property
Quoted 6 lines · Daniel Vetter
It's not wired up, and if it is, it should be moved over to the new fancy standardized zpos property exposed through
drm_plane_create_zpos_property().Cc Rob Clark <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
Discussed this with Rob Clark on irc, I was wrong, this is all properly wired up. No idea why I failed at parsing git grep output ... This should be moved over to drm_plane_create_zpos_property(), but this patch here is bogus. I'll drop it.
-Daniel
Quoted 20 lines
--- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +0
-2@@ -108,8 +108,6 @@ static void mdp5_plane_install_properties(struct drm_plane *plane, create_enum, name##_prop_enum_list, \ ARRAY_SIZE(name##_prop_enum_list)) -INSTALL_RANGE_PROPERTY (zpos,ZPOS ,1 ,255 ,1 ); -mdp5_plane_install_rotation_property (dev, plane);#undef INSTALL_RANGE_PROPERTYSignature · 1 line
2.11.0
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 10/15 drm/fb-helper: Give up on kgdb for atomic drivers
In reply to Daniel VetterIt just doesn't work. It probably stopped working way, way before that (e.g. i915 grabbed random mutexes all over in modeset code at least since gen6), but with atomic and all the ww_mutex stuff it's indeed hopeless.
Remove ->mode_set_base_atomic from the 2 atomic drivers (i915 and nouveau) that still had one (both had dummy implementations already anyway), and shunt atomic drivers in the helpers debug_enter/leave functions.
I'll leave the code in for radeon and amdgpu, but I think as soon as amdgpu is atomic we should think about just ripping it out. Only having it around for radeon and pre-nv50 is rather pointless. This would also allow us to nuke all that code from fbdev.
Funny part is that _all_ kms drivers set this hook, despite that no one else provides the required ->mode_set_base_atomic implementation.
The reason I'm jumping on this is that I want to wire up a full acquire ctx for the benefit of atomic drivers, everywhere. And the debug_enter/leave implementations call ->gamma_set. And there's just no way ever we can create an acquire_ctx in the nmi context of kgdb.
--- drivers/gpu/drm/drm_fb_helper.c | 6 ++++++ drivers/gpu/drm/i915/intel_display.c | 12 ------------ drivers/gpu/drm/nouveau/nv50_display.c | 10 ---------- 3 files changed, 6 insertions(+), 22 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +6 -0
@@ -281,6 +281,9 @@ int drm_fb_helper_debug_enter(struct fb_info *info)if (funcs->mode_set_base_atomic ==NULL )continue ; +if (drm_drv_uses_atomic_modeset (mode_set->crtc->dev)) +continue ; +drm_fb_helper_save_lut_atomic (mode_set->crtc, helper); funcs->mode_set_base_atomic(mode_set->crtc, mode_set->fb,
@@ -338,6 +341,9 @@ int drm_fb_helper_debug_leave(struct fb_info *info)if (funcs->mode_set_base_atomic ==NULL )continue ; +if (drm_drv_uses_atomic_modeset (crtc->dev)) +continue ; +drm_fb_helper_restore_lut_atomic (mode_set->crtc); funcs->mode_set_base_atomic (mode_set->crtc, fb, crtc->x, crtc->y,LEAVE_ATOMIC_MODE_SET );
drivers/gpu/drm/i915/intel_display.c +0 -12
@@ -3412,17 +3412,6 @@ static void skylake_disable_primary_plane(struct drm_plane *primary,spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); } -/* Assume fb object is pinned & idle & fenced and just update base pointers */ -static int -intel_pipe_set_base_atomic (struct drm_crtc *crtc,struct drm_framebuffer *fb, -int x,int y,enum mode_set_atomic state) -{ -/* Support for kgdboc is disabled, this needs a major rework. */ -DRM_ERROR ("legacy panic handler not supported any more.\n" ); - -return -ENODEV ; -} -static void intel_complete_page_flips (struct drm_i915_private *dev_priv) {struct intel_crtc *crtc;
@@ -11017,7 +11006,6 @@ static int intel_crtc_atomic_check(struct drm_crtc *crtc, }static const struct drm_crtc_helper_funcs intel_helper_funcs = { - .mode_set_base_atomic = intel_pipe_set_base_atomic, .atomic_begin = intel_begin_crtc_commit, .atomic_flush = intel_finish_crtc_commit, .atomic_check = intel_crtc_atomic_check,
drivers/gpu/drm/nouveau/nv50_display.c +0 -10
@@ -2210,18 +2210,8 @@ nv50_head_lut_load(struct drm_crtc *crtc) } } -static int -nv50_head_mode_set_base_atomic (struct drm_crtc *crtc, -struct drm_framebuffer *fb,int x,int y, -enum mode_set_atomic state) -{ -WARN_ON (1 ); -return 0 ; -} -static const struct drm_crtc_helper_funcs nv50_head_help = { - .mode_set_base_atomic = nv50_head_mode_set_base_atomic, .load_lut = nv50_head_lut_load, .atomic_check = nv50_head_atomic_check, };
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 11/15 drm: Add explicit acquire ctx handling around ->gamma_set
In reply to Daniel VetterJust the groundwork to prepare for adding the acquire cxt parameter to the ->gamma_set hook. Again we need a temporary hack to fill out mode_config.acquire_ctx until the atomic helpers are switched over.
--- drivers/gpu/drm/drm_color_mgmt.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-)
drivers/gpu/drm/drm_color_mgmt.c +20 -13
@@ -218,28 +218,29 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev,struct drm_crtc *crtc;void *r_base, *g_base, *b_base;int size; +struct drm_modeset_acquire_ctx ctx;int ret =0 ;if (!drm_core_check_feature (dev,DRIVER_MODESET ))return -EINVAL ; -drm_modeset_lock_all (dev); crtc =drm_crtc_find (dev, crtc_lut->crtc_id); -if (!crtc) { - ret = -ENOENT ; - goto out; - } +if (!crtc) +return -ENOENT ; -if (crtc->funcs->gamma_set ==NULL ) { - ret = -ENOSYS ; - goto out; - } +if (crtc->funcs->gamma_set ==NULL ) +return -ENOSYS ;/* memcpy into gamma store */ -if (crtc_lut->gamma_size != crtc->gamma_size) { - ret = -EINVAL ; +if (crtc_lut->gamma_size != crtc->gamma_size) +return -EINVAL ; + +drm_modeset_acquire_init (&ctx,0 ); + dev->mode_config.acquire_ctx = &ctx; +retry: + ret =drm_modeset_lock_all_ctx (dev, &ctx); +if (ret) goto out; - } size = crtc_lut->gamma_size * (sizeof (uint16_t )); r_base = crtc->gamma_store;
@@ -263,7 +264,13 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev, ret = crtc->funcs->gamma_set (crtc, r_base, g_base, b_base, crtc->gamma_size); out: -drm_modeset_unlock_all (dev); +if (ret == -EDEADLK ) { +drm_modeset_backoff (&ctx); + goto retry; + } +drm_modeset_drop_locks (&ctx); +drm_modeset_acquire_fini (&ctx); +return ret; }
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 12/15 drm: Add acquire ctx to ->gamma_set hook
In reply to Daniel VetterAtomic helpers really want this instead of the hacked-up legacy backoff trick, which unfortunately prevents drivers from using their own private drm_modeset_locks.
Aside: There's a few atomic drivers (nv50, vc4, soon vmwgfx) which don't yet use the new atomic color mgmt/gamma table stuff. Would be nice if they could switch over and just hook up drm_atomic_helper_legacy_gamma_set() instead.
--- drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 3 ++- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 3 ++- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 3 ++- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 3 ++- drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 3 ++- drivers/gpu/drm/ast/ast_mode.c | 3 ++- drivers/gpu/drm/cirrus/cirrus_mode.c | 3 ++- drivers/gpu/drm/drm_atomic_helper.c | 4 +++- drivers/gpu/drm/drm_color_mgmt.c | 3 ++- drivers/gpu/drm/drm_fb_helper.c | 3 ++- drivers/gpu/drm/gma500/gma_display.c | 3 ++- drivers/gpu/drm/gma500/gma_display.h | 3 ++- drivers/gpu/drm/mgag200/mgag200_mode.c | 3 ++- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 3 ++- drivers/gpu/drm/nouveau/nv50_display.c | 3 ++- drivers/gpu/drm/radeon/radeon_display.c | 3 ++- drivers/gpu/drm/vc4/vc4_crtc.c | 3 ++- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 3 ++- drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 3 ++- include/drm/drm_atomic_helper.h | 3 ++- include/drm/drm_crtc.h | 3 ++- 21 files changed, 43 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +2 -1
@@ -2631,7 +2631,8 @@ static void dce_v10_0_cursor_reset(struct drm_crtc *crtc) }static int dce_v10_0_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green, -u16 *blue,uint32_t size) +u16 *blue,uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc);int i;
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +2 -1
@@ -2651,7 +2651,8 @@ static void dce_v11_0_cursor_reset(struct drm_crtc *crtc) }static int dce_v11_0_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green, -u16 *blue,uint32_t size) +u16 *blue,uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc);int i;
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +2 -1
@@ -1998,7 +1998,8 @@ static void dce_v6_0_cursor_reset(struct drm_crtc *crtc) }static int dce_v6_0_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green, -u16 *blue,uint32_t size) +u16 *blue,uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc);int i;
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +2 -1
@@ -2482,7 +2482,8 @@ static void dce_v8_0_cursor_reset(struct drm_crtc *crtc) }static int dce_v8_0_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green, -u16 *blue,uint32_t size) +u16 *blue,uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc);int i;
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +2 -1
@@ -165,7 +165,8 @@ static void dce_virtual_bandwidth_update(struct amdgpu_device *adev) }static int dce_virtual_crtc_gamma_set (struct drm_crtc *crtc,u16 *red, -u16 *green,u16 *blue,uint32_t size) +u16 *green,u16 *blue,uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc);int i;
drivers/gpu/drm/ast/ast_mode.c +2 -1
@@ -645,7 +645,8 @@ static void ast_crtc_reset(struct drm_crtc *crtc) }static int ast_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green, -u16 *blue,uint32_t size) +u16 *blue,uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct ast_crtc *ast_crtc =to_ast_crtc (crtc);int i;
drivers/gpu/drm/cirrus/cirrus_mode.c +2 -1
@@ -327,7 +327,8 @@ static void cirrus_crtc_commit(struct drm_crtc *crtc)* but it's a requirement that we provide the function */ static int cirrus_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green, -u16 *blue,uint32_t size) +u16 *blue,uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct cirrus_crtc *cirrus_crtc =to_cirrus_crtc (crtc);int i;
drivers/gpu/drm/drm_atomic_helper.c +3 -1
@@ -3480,6 +3480,7 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_destroy_state);* @green: green correction table * @blue: green correction table * @size: size of the tables +* @ctx: lock acquire context * * Implements support for legacy gamma correction table for drivers * that support color management through the DEGAMMA_LUT/GAMMA_LUT
@@ -3487,7 +3488,8 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_destroy_state);*/ int drm_atomic_helper_legacy_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green,u16 *blue, -uint32_t size) +uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct drm_device *dev = crtc->dev;struct drm_mode_config *config = &dev->mode_config;
drivers/gpu/drm/drm_color_mgmt.c +2 -1
@@ -261,7 +261,8 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev, goto out; } - ret = crtc->funcs->gamma_set (crtc, r_base, g_base, b_base, crtc->gamma_size); + ret = crtc->funcs->gamma_set (crtc, r_base, g_base, b_base, + crtc->gamma_size, &ctx); out:if (ret == -EDEADLK ) {
drivers/gpu/drm/drm_fb_helper.c +2 -1
@@ -256,7 +256,8 @@ static void drm_fb_helper_restore_lut_atomic(struct drm_crtc *crtc) g_base = r_base + crtc->gamma_size; b_base = g_base + crtc->gamma_size; - crtc->funcs->gamma_set (crtc, r_base, g_base, b_base, crtc->gamma_size); + crtc->funcs->gamma_set (crtc, r_base, g_base, b_base, + crtc->gamma_size,NULL ); }/**
drivers/gpu/drm/gma500/gma_display.c +2 -1
@@ -177,7 +177,8 @@ void gma_crtc_load_lut(struct drm_crtc *crtc) }int gma_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green,u16 *blue, -u32 size) +u32 size, +struct drm_modeset_acquire_ctx *ctx) {struct gma_crtc *gma_crtc =to_gma_crtc (crtc);int i;
drivers/gpu/drm/gma500/gma_display.h +2 -1
@@ -73,7 +73,8 @@ extern int gma_crtc_cursor_set(struct drm_crtc *crtc,extern int gma_crtc_cursor_move (struct drm_crtc *crtc,int x,int y);extern void gma_crtc_load_lut (struct drm_crtc *crtc);extern int gma_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green, -u16 *blue,u32 size); +u16 *blue,u32 size, +struct drm_modeset_acquire_ctx *ctx);extern void gma_crtc_dpms (struct drm_crtc *crtc,int mode);extern void gma_crtc_prepare (struct drm_crtc *crtc);extern void gma_crtc_commit (struct drm_crtc *crtc);
drivers/gpu/drm/mgag200/mgag200_mode.c +2 -1
@@ -1393,7 +1393,8 @@ static void mga_crtc_commit(struct drm_crtc *crtc)* but it's a requirement that we provide the function */ static int mga_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green, -u16 *blue,uint32_t size) +u16 *blue,uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct mga_crtc *mga_crtc =to_mga_crtc (crtc);int i;
drivers/gpu/drm/nouveau/dispnv04/crtc.c +2 -1
@@ -788,7 +788,8 @@ nv_crtc_disable(struct drm_crtc *crtc)static int nv_crtc_gamma_set (struct drm_crtc *crtc,u16 *r,u16 *g,u16 *b, -uint32_t size) +uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct nouveau_crtc *nv_crtc =nouveau_crtc (crtc);int i;
drivers/gpu/drm/nouveau/nv50_display.c +2 -1
@@ -2218,7 +2218,8 @@ nv50_head_help = {static int nv50_head_gamma_set (struct drm_crtc *crtc,u16 *r,u16 *g,u16 *b, -uint32_t size) +uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct nouveau_crtc *nv_crtc =nouveau_crtc (crtc);u32 i;
drivers/gpu/drm/radeon/radeon_display.c +2 -1
@@ -232,7 +232,8 @@ void radeon_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, }static int radeon_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green, -u16 *blue,uint32_t size) +u16 *blue,uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct radeon_crtc *radeon_crtc =to_radeon_crtc (crtc);int i;
drivers/gpu/drm/vc4/vc4_crtc.c +2 -1
@@ -300,7 +300,8 @@ vc4_crtc_lut_load(struct drm_crtc *crtc)static int vc4_crtc_gamma_set (struct drm_crtc *crtc,u16 *r,u16 *g,u16 *b, -uint32_t size) +uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct vc4_crtc *vc4_crtc =to_vc4_crtc (crtc);u32 i;
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +2 -1
@@ -2026,7 +2026,8 @@ static int vmw_du_update_layout(struct vmw_private *dev_priv, unsigned num,int vmw_du_crtc_gamma_set (struct drm_crtc *crtc,u16 *r,u16 *g,u16 *b, -uint32_t size) +uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct vmw_private *dev_priv =vmw_priv (crtc->dev);int i;
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +2 -1
@@ -254,7 +254,8 @@ void vmw_du_crtc_save(struct drm_crtc *crtc);void vmw_du_crtc_restore (struct drm_crtc *crtc);int vmw_du_crtc_gamma_set (struct drm_crtc *crtc,u16 *r,u16 *g,u16 *b, -uint32_t size); +uint32_t size, +struct drm_modeset_acquire_ctx *ctx);int vmw_du_crtc_cursor_set2 (struct drm_crtc *crtc,struct drm_file *file_priv,uint32_t handle,uint32_t width,uint32_t height,int32_t hot_x,int32_t hot_y);
include/drm/drm_atomic_helper.h +2 -1
@@ -176,7 +176,8 @@ void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector, struct drm_connector_state *state);int drm_atomic_helper_legacy_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green,u16 *blue, -uint32_t size); +uint32_t size, +struct drm_modeset_acquire_ctx *ctx);/** * drm_atomic_crtc_for_each_plane - iterate over planes currently attached to CRTC
include/drm/drm_crtc.h +2 -1
@@ -322,7 +322,8 @@ struct drm_crtc_funcs {* hooks. */ int (*gamma_set)(struct drm_crtc *crtc,u16 *r,u16 *g,u16 *b, -uint32_t size); +uint32_t size, +struct drm_modeset_acquire_ctx *ctx);/** * @destroy:
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 12/15] drm: Add acquire ctx to ->gamma_set hook
vmwgfx part: Reviewed-by: Sinclair Yeh <[email protected]>
Quoted 347 lines · Daniel Vetter
Atomic helpers really want this instead of the hacked-up legacy backoff trick, which unfortunately prevents drivers from using their own private
drm_modeset_locks.Aside: There's a few atomic drivers (nv50, vc4, soon vmwgfx) which don't yet use the new atomic color mgmt/gamma table stuff. Would be nice if they could switch over and just hook up
drm_atomic_helper_legacy_gamma_set()instead.Cc Dave Airlie <[email protected]>Cc Alex Deucher <[email protected]>Cc Christian König <[email protected]>Cc Gerd Hoffmann <[email protected]>Cc Ben Skeggs <[email protected]>Cc Sinclair Yeh <[email protected]>Cc Thomas Hellstrom <[email protected]>Cc Eric Anholt <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 3 ++- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 3 ++- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 3 ++- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 3 ++- drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 3 ++- drivers/gpu/drm/ast/ast_mode.c | 3 ++- drivers/gpu/drm/cirrus/cirrus_mode.c | 3 ++- drivers/gpu/drm/drm_atomic_helper.c | 4 +++- drivers/gpu/drm/drm_color_mgmt.c | 3 ++- drivers/gpu/drm/drm_fb_helper.c | 3 ++- drivers/gpu/drm/gma500/gma_display.c | 3 ++- drivers/gpu/drm/gma500/gma_display.h | 3 ++- drivers/gpu/drm/mgag200/mgag200_mode.c | 3 ++- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 3 ++- drivers/gpu/drm/nouveau/nv50_display.c | 3 ++- drivers/gpu/drm/radeon/radeon_display.c | 3 ++- drivers/gpu/drm/vc4/vc4_crtc.c | 3 ++- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 3 ++- drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 3 ++- include/drm/drm_atomic_helper.h | 3 ++- include/drm/drm_crtc.h | 3 ++- 21 files changed, 43 insertions(+), 21 deletions(-)drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +2
-1@@ -2631,7 +2631,8 @@ static void dce_v10_0_cursor_reset(struct drm_crtc *crtc) }static int dce_v10_0_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green, -u16 *blue,uint32_t size) +u16 *blue,uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc);int i;drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +2
-1@@ -2651,7 +2651,8 @@ static void dce_v11_0_cursor_reset(struct drm_crtc *crtc) }static int dce_v11_0_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green, -u16 *blue,uint32_t size) +u16 *blue,uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc);int i;drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +2
-1@@ -1998,7 +1998,8 @@ static void dce_v6_0_cursor_reset(struct drm_crtc *crtc) }static int dce_v6_0_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green, -u16 *blue,uint32_t size) +u16 *blue,uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc);int i;drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +2
-1@@ -2482,7 +2482,8 @@ static void dce_v8_0_cursor_reset(struct drm_crtc *crtc) }static int dce_v8_0_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green, -u16 *blue,uint32_t size) +u16 *blue,uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc);int i;drivers/gpu/drm/amd/amdgpu/dce_virtual.c +2
-1@@ -165,7 +165,8 @@ static void dce_virtual_bandwidth_update(struct amdgpu_device *adev) }static int dce_virtual_crtc_gamma_set (struct drm_crtc *crtc,u16 *red, -u16 *green,u16 *blue,uint32_t size) +u16 *green,u16 *blue,uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc);int i;drivers/gpu/drm/ast/ast_mode.c +2
-1@@ -645,7 +645,8 @@ static void ast_crtc_reset(struct drm_crtc *crtc) }static int ast_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green, -u16 *blue,uint32_t size) +u16 *blue,uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct ast_crtc *ast_crtc =to_ast_crtc (crtc);int i;drivers/gpu/drm/cirrus/cirrus_mode.c +2
-1@@ -327,7 +327,8 @@ static void cirrus_crtc_commit(struct drm_crtc *crtc)* but it's a requirement that we provide the function */ static int cirrus_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green, -u16 *blue,uint32_t size) +u16 *blue,uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct cirrus_crtc *cirrus_crtc =to_cirrus_crtc (crtc);int i;drivers/gpu/drm/drm_atomic_helper.c +3
-1@@ -3480,6 +3480,7 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_destroy_state);* @green: green correction table * @blue: green correction table * @size: size of the tables +* @ctx: lock acquire context * * Implements support for legacy gamma correction table for drivers * that support color management through the DEGAMMA_LUT/GAMMA_LUT @@ -3487,7 +3488,8 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_destroy_state);*/ int drm_atomic_helper_legacy_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green,u16 *blue, -uint32_t size) +uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct drm_device *dev = crtc->dev;struct drm_mode_config *config = &dev->mode_config;drivers/gpu/drm/drm_color_mgmt.c +2
-1@@ -261,7 +261,8 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev, goto out; } - ret = crtc->funcs->gamma_set (crtc, r_base, g_base, b_base, crtc->gamma_size); + ret = crtc->funcs->gamma_set (crtc, r_base, g_base, b_base, + crtc->gamma_size, &ctx); out:if (ret == -EDEADLK ) {drivers/gpu/drm/drm_fb_helper.c +2
-1@@ -256,7 +256,8 @@ static void drm_fb_helper_restore_lut_atomic(struct drm_crtc *crtc) g_base = r_base + crtc->gamma_size; b_base = g_base + crtc->gamma_size; - crtc->funcs->gamma_set (crtc, r_base, g_base, b_base, crtc->gamma_size); + crtc->funcs->gamma_set (crtc, r_base, g_base, b_base, + crtc->gamma_size,NULL ); }/** drivers/gpu/drm/gma500/gma_display.c +2
-1@@ -177,7 +177,8 @@ void gma_crtc_load_lut(struct drm_crtc *crtc) }int gma_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green,u16 *blue, -u32 size) +u32 size, +struct drm_modeset_acquire_ctx *ctx) {struct gma_crtc *gma_crtc =to_gma_crtc (crtc);int i;drivers/gpu/drm/gma500/gma_display.h +2
-1@@ -73,7 +73,8 @@ extern int gma_crtc_cursor_set(struct drm_crtc *crtc,extern int gma_crtc_cursor_move (struct drm_crtc *crtc,int x,int y);extern void gma_crtc_load_lut (struct drm_crtc *crtc);extern int gma_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green, -u16 *blue,u32 size); +u16 *blue,u32 size, +struct drm_modeset_acquire_ctx *ctx);extern void gma_crtc_dpms (struct drm_crtc *crtc,int mode);extern void gma_crtc_prepare (struct drm_crtc *crtc);extern void gma_crtc_commit (struct drm_crtc *crtc);drivers/gpu/drm/mgag200/mgag200_mode.c +2
-1@@ -1393,7 +1393,8 @@ static void mga_crtc_commit(struct drm_crtc *crtc)* but it's a requirement that we provide the function */ static int mga_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green, -u16 *blue,uint32_t size) +u16 *blue,uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct mga_crtc *mga_crtc =to_mga_crtc (crtc);int i;drivers/gpu/drm/nouveau/dispnv04/crtc.c +2
-1@@ -788,7 +788,8 @@ nv_crtc_disable(struct drm_crtc *crtc)static int nv_crtc_gamma_set (struct drm_crtc *crtc,u16 *r,u16 *g,u16 *b, -uint32_t size) +uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct nouveau_crtc *nv_crtc =nouveau_crtc (crtc);int i;drivers/gpu/drm/nouveau/nv50_display.c +2
-1@@ -2218,7 +2218,8 @@ nv50_head_help = {static int nv50_head_gamma_set (struct drm_crtc *crtc,u16 *r,u16 *g,u16 *b, -uint32_t size) +uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct nouveau_crtc *nv_crtc =nouveau_crtc (crtc);u32 i;drivers/gpu/drm/radeon/radeon_display.c +2
-1@@ -232,7 +232,8 @@ void radeon_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, }static int radeon_crtc_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green, -u16 *blue,uint32_t size) +u16 *blue,uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct radeon_crtc *radeon_crtc =to_radeon_crtc (crtc);int i;drivers/gpu/drm/vc4/vc4_crtc.c +2
-1@@ -300,7 +300,8 @@ vc4_crtc_lut_load(struct drm_crtc *crtc)static int vc4_crtc_gamma_set (struct drm_crtc *crtc,u16 *r,u16 *g,u16 *b, -uint32_t size) +uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct vc4_crtc *vc4_crtc =to_vc4_crtc (crtc);u32 i;drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +2
-1@@ -2026,7 +2026,8 @@ static int vmw_du_update_layout(struct vmw_private *dev_priv, unsigned num,int vmw_du_crtc_gamma_set (struct drm_crtc *crtc,u16 *r,u16 *g,u16 *b, -uint32_t size) +uint32_t size, +struct drm_modeset_acquire_ctx *ctx) {struct vmw_private *dev_priv =vmw_priv (crtc->dev);int i;drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +2
-1@@ -254,7 +254,8 @@ void vmw_du_crtc_save(struct drm_crtc *crtc);void vmw_du_crtc_restore (struct drm_crtc *crtc);int vmw_du_crtc_gamma_set (struct drm_crtc *crtc,u16 *r,u16 *g,u16 *b, -uint32_t size); +uint32_t size, +struct drm_modeset_acquire_ctx *ctx);int vmw_du_crtc_cursor_set2 (struct drm_crtc *crtc,struct drm_file *file_priv,uint32_t handle,uint32_t width,uint32_t height,int32_t hot_x,int32_t hot_y);include/drm/drm_atomic_helper.h +2
-1@@ -176,7 +176,8 @@ void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector, struct drm_connector_state *state);int drm_atomic_helper_legacy_gamma_set (struct drm_crtc *crtc,u16 *red,u16 *green,u16 *blue, -uint32_t size); +uint32_t size, +struct drm_modeset_acquire_ctx *ctx);/** * drm_atomic_crtc_for_each_plane - iterate over planes currently attached to CRTC include/drm/drm_crtc.h +2
-1@@ -322,7 +322,8 @@ struct drm_crtc_funcs {* hooks. */ int (*gamma_set)(struct drm_crtc *crtc,u16 *r,u16 *g,u16 *b, -uint32_t size); +uint32_t size, +struct drm_modeset_acquire_ctx *ctx);/** * @destroy: Signature · 1 line
2.11.0
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 12/15] drm: Add acquire ctx to ->gamma_set hook
In reply to Daniel VetterQuoted 8 lines · Daniel Vetter
Atomic helpers really want this instead of the hacked-up legacy backoff trick, which unfortunately prevents drivers from using their own private
drm_modeset_locks.Aside: There's a few atomic drivers (nv50, vc4, soon vmwgfx) which don't yet use the new atomic color mgmt/gamma table stuff. Would be nice if they could switch over and just hook up
drm_atomic_helper_legacy_gamma_set()instead.
For notes like this, it would be helpful to have a pointer to a driver doing it cleanly the current way.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 12/15] drm: Add acquire ctx to ->gamma_set hook
Quoted 5 lines · Eric Anholt
Quoted 4 lines · Daniel Vetter
Atomic helpers really want this instead of the hacked-up legacy backoff trick, which unfortunately prevents drivers from using their own private
drm_modeset_locks.
Quoted 7 lines
Quoted 4 lines
Aside: There's a few atomic drivers (nv50, vc4, soon vmwgfx) which don't yet use the new atomic color mgmt/gamma table stuff. Would be nice if they could switch over and just hook up
drm_atomic_helper_legacy_gamma_set()instead.For notes like this, it would be helpful to have a pointer to a driver doing it cleanly the current way.
Yeah, good point. And the kernel-doc for legacy_gamma_set is also not all that awesome. So we currently have i915, mediatek and omapdrm using this, and for the new atomic gamma stuff we do have fairly reasonable docs (just a bit harder to find that I thought they'd be):
https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html#color-management-properties
I'll try and type up a patch to sprinkle a few more hints around and connect the pieces.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 13/15 drm/atomic-helper: Remove legacy backoff hack from gamma_set
In reply to Daniel VetterAnother one knocked down.
With this we can also remove the temporary hack in the gamma_set ioctl.
--- drivers/gpu/drm/drm_atomic_helper.c | 13 ++----------- drivers/gpu/drm/drm_color_mgmt.c | 1 - 2 files changed, 2 insertions(+), 12 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +2 -11
@@ -3520,8 +3520,7 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, blob_data[i].blue = blue[i]; } - state->acquire_ctx = crtc->dev->mode_config.acquire_ctx; -retry: + state->acquire_ctx = ctx; crtc_state =drm_atomic_get_crtc_state (state, crtc);if (IS_ERR (crtc_state)) { ret =PTR_ERR (crtc_state);
@@ -3545,18 +3544,10 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, goto fail; ret =drm_atomic_commit (state); -fail: -if (ret == -EDEADLK ) - goto backoff; +fail:drm_atomic_state_put (state);drm_property_blob_put (blob);return ret; - -backoff: -drm_atomic_state_clear (state); -drm_atomic_legacy_backoff (state); - - goto retry; }EXPORT_SYMBOL (drm_atomic_helper_legacy_gamma_set);
drivers/gpu/drm/drm_color_mgmt.c +0 -1
@@ -236,7 +236,6 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev,return -EINVAL ;drm_modeset_acquire_init (&ctx,0 ); - dev->mode_config.acquire_ctx = &ctx; retry: ret =drm_modeset_lock_all_ctx (dev, &ctx);if (ret)
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 14/15 drm: extract legacy framebuffer remove
In reply to Daniel VetterI got confused every time I audited what that lock_all is doing in there until realizing it's for legacy kms only. Make that a notch more obvious by having 2 entirely different paths.
While at it also move the atomic version of this into drm_framebuffer.c, there's no reason it needs to be in drm_atomic.c. That way it becomes a simple static function.
--- drivers/gpu/drm/drm_atomic.c | 88 ----------------------- drivers/gpu/drm/drm_crtc_internal.h | 1 - drivers/gpu/drm/drm_framebuffer.c | 137 ++++++++++++++++++++++++++++++------ 3 files changed, 115 insertions(+), 111 deletions(-)
drivers/gpu/drm/drm_atomic.c +0 -88
@@ -2081,94 +2081,6 @@ static void complete_crtc_signaling(struct drm_device *dev,kfree (fence_state); } -int drm_atomic_remove_fb (struct drm_framebuffer *fb) -{ -struct drm_modeset_acquire_ctx ctx; -struct drm_device *dev = fb->dev; -struct drm_atomic_state *state; -struct drm_plane *plane; -struct drm_connector *conn; -struct drm_connector_state *conn_state; -int i, ret =0 ; -unsigned plane_mask; - - state =drm_atomic_state_alloc (dev); -if (!state) -return -ENOMEM ; - -drm_modeset_acquire_init (&ctx,0 ); - state->acquire_ctx = &ctx; - -retry: - plane_mask =0 ; - ret =drm_modeset_lock_all_ctx (dev, &ctx); -if (ret) - goto unlock; - -drm_for_each_plane (plane, dev) { -struct drm_plane_state *plane_state; - -if (plane->state->fb != fb) -continue ; - - plane_state =drm_atomic_get_plane_state (state, plane); -if (IS_ERR (plane_state)) { - ret =PTR_ERR (plane_state); - goto unlock; - } - -if (plane_state->crtc->primary == plane) { -struct drm_crtc_state *crtc_state; - - crtc_state =drm_atomic_get_existing_crtc_state (state, plane_state->crtc); - - ret =drm_atomic_add_affected_connectors (state, plane_state->crtc); -if (ret) - goto unlock; - - crtc_state->active = false; - ret =drm_atomic_set_mode_for_crtc (crtc_state,NULL ); -if (ret) - goto unlock; - } - -drm_atomic_set_fb_for_plane (plane_state,NULL ); - ret =drm_atomic_set_crtc_for_plane (plane_state,NULL ); -if (ret) - goto unlock; - - plane_mask |=BIT (drm_plane_index (plane)); - - plane->old_fb = plane->fb; - } - -for_each_connector_in_state (state, conn, conn_state, i) { - ret =drm_atomic_set_crtc_for_connector (conn_state,NULL ); - -if (ret) - goto unlock; - } - -if (plane_mask) - ret =drm_atomic_commit (state); - -unlock: -if (plane_mask) -drm_atomic_clean_old_fb (dev, plane_mask, ret); - -if (ret == -EDEADLK ) { -drm_modeset_backoff (&ctx); - goto retry; - } - -drm_atomic_state_put (state); - -drm_modeset_drop_locks (&ctx); -drm_modeset_acquire_fini (&ctx); - -return ret; -} -int drm_mode_atomic_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv) {
drivers/gpu/drm/drm_crtc_internal.h +0 -1
@@ -182,7 +182,6 @@ int drm_atomic_get_property(struct drm_mode_object *obj, struct drm_property *property, uint64_t *val);int drm_mode_atomic_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv); -int drm_atomic_remove_fb (struct drm_framebuffer *fb);/* drm_plane.c */
drivers/gpu/drm/drm_framebuffer.c +115 -22
164 lines not on this page · raw message
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 15/15 drm/fb-helper: Extract _legacy kms functions
In reply to Daniel VetterThe goal is to push all the kms locking down into these separate _atomic and _legacy functions, so that we can correctly pass the acquire ctx into all atomic drivers. Instead of playing games with hidden ctx in mode_config.acquire_ctx. All the fbdev state will be protected by a new fbdev private lock that Thierry is working on.
This here is just prep by creating a clean split between atomic and legacy paths, which also simplifies the control flow a bit.
--- drivers/gpu/drm/drm_fb_helper.c | 72 +++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 28 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +44 -28
@@ -418,17 +418,12 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper) goto retry; } -static int restore_fbdev_mode (struct drm_fb_helper *fb_helper) +static int restore_fbdev_mode_legacy (struct drm_fb_helper *fb_helper) {struct drm_device *dev = fb_helper->dev;struct drm_plane *plane;int i; -drm_warn_on_modeset_not_all_locked (dev); - -if (drm_drv_uses_atomic_modeset (dev)) -return restore_fbdev_mode_atomic (fb_helper); -drm_for_each_plane (plane, dev) {if (plane->type !=DRM_PLANE_TYPE_PRIMARY )drm_plane_force_disable (plane);
@@ -462,6 +457,18 @@ static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)return 0 ; } +static int restore_fbdev_mode (struct drm_fb_helper *fb_helper) +{ +struct drm_device *dev = fb_helper->dev; + +drm_warn_on_modeset_not_all_locked (dev); + +if (drm_drv_uses_atomic_modeset (dev)) +return restore_fbdev_mode_atomic (fb_helper); +else +return restore_fbdev_mode_legacy (fb_helper); +} +/** * drm_fb_helper_restore_fbdev_mode_unlocked - restore fbdev configuration * @fb_helper: fbcon to restore
@@ -1513,34 +1520,14 @@ static int pan_display_atomic(struct fb_var_screeninfo *var, goto retry; } -/** -* drm_fb_helper_pan_display - implementation for &fb_ops.fb_pan_display -* @var: updated screen information -* @info: fbdev registered by the helper -*/ -int drm_fb_helper_pan_display (struct fb_var_screeninfo *var, +static int pan_display_legacy (struct fb_var_screeninfo *var,struct fb_info *info) {struct drm_fb_helper *fb_helper = info->par; -struct drm_device *dev = fb_helper->dev;struct drm_mode_set *modeset;int ret =0 ;int i; -if (oops_in_progress) -return -EBUSY ; - -drm_modeset_lock_all (dev); -if (!drm_fb_helper_is_bound (fb_helper)) { -drm_modeset_unlock_all (dev); -return -EBUSY ; - } - -if (drm_drv_uses_atomic_modeset (dev)) { - ret =pan_display_atomic (var, info); - goto unlock; - } -for (i =0 ; i < fb_helper->crtc_count; i++) { modeset = &fb_helper->crtc_info[i].mode_set;
@@ -1555,8 +1542,37 @@ int drm_fb_helper_pan_display(struct fb_var_screeninfo *var, } } } -unlock: + +return ret; +} + +/** +* drm_fb_helper_pan_display - implementation for &fb_ops.fb_pan_display +* @var: updated screen information +* @info: fbdev registered by the helper +*/ +int drm_fb_helper_pan_display (struct fb_var_screeninfo *var, +struct fb_info *info) +{ +struct drm_fb_helper *fb_helper = info->par; +struct drm_device *dev = fb_helper->dev; +int ret; + +if (oops_in_progress) +return -EBUSY ; + +drm_modeset_lock_all (dev); +if (!drm_fb_helper_is_bound (fb_helper)) { +drm_modeset_unlock_all (dev); +return -EBUSY ; + } + +if (drm_drv_uses_atomic_modeset (dev)) + ret =pan_display_atomic (var, info); +else + ret =pan_display_legacy (var, info);drm_modeset_unlock_all (dev); +return ret; }EXPORT_SYMBOL (drm_fb_helper_pan_display);
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for acquire ctx wire-up, part 2
In reply to Daniel Vetter== Series Details ==
== Series Details ==
Series: acquire ctx wire-up, part 2
URL : https://patchwork.freedesktop.org/series/22354/
State : success
== Summary ==
Series 22354v1 acquire ctx wire-up, part 2
https://patchwork.freedesktop.org/api/1.0/series/22354/revisions/1/mbox/
Test gem_exec_flush:
Subgroup basic-batch-kernel-default-uc:
pass -> FAIL (fi-snb-2600) fdo#100007fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time: 429s fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time: 423s fi-bsw-n3050 total:278 pass:239 dwarn:0 dfail:0 fail:0 skip:39 time: 574s fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time: 513s fi-bxt-t5700 total:278 pass:258 dwarn:0 dfail:0 fail:0 skip:20 time: 552s fi-byt-j1900 total:278 pass:251 dwarn:0 dfail:0 fail:0 skip:27 time: 485s fi-byt-n2820 total:278 pass:247 dwarn:0 dfail:0 fail:0 skip:31 time: 483s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time: 407s fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time: 409s fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time: 419s fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 492s fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 473s fi-kbl-7500u total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 453s fi-kbl-7560u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 569s fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 449s fi-skl-6700hq total:278 pass:261 dwarn:0 dfail:0 fail:0 skip:17 time: 568s fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time: 457s fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 494s fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time: 434s fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time: 524s fi-snb-2600 total:278 pass:248 dwarn:0 dfail:0 fail:1 skip:29 time: 400s
7eae9908d29d1e42ab9fdb19a7c04eb05dd23b16 drm-tip: 2017y-04m-03d-07h-59m-44s UTC integration manifest 285584b drm/fb-helper: Extract _legacy kms functions
7d9c945 drm: extract legacy framebuffer remove
af8e639 drm/atomic-helper: Remove legacy backoff hack from gamma_set
ab35545 drm: Add acquire ctx to ->gamma_set hook
46b4289 drm: Add explicit acquire ctx handling around ->gamma_set
7d1bb0f drm/fb-helper: Give up on kgdb for atomic drivers
e7dd123 drm/msm: Nerf zpos property
162c8da drm/i915: Nuke intel_atomic_legacy_gamma_set
0c3a80a drm: Only take crtc lock in get_gamma ioctl
9563470 drm: Drop modeset_lock_all from the getproperty ioctl
1cb7c34 drm: drop modeset_lock_all from drm_state_info
281bcd1 drm/atomic-helper: remove modeset_lock_all from helper_resume
9bc6756 drm: Remove drm_modeset_legacy_acquire_ctx and crtc->acquire_ctx
8ee3151 drm: Remove drm_modeset_(un)lock_crtc
b3c2439 drm: Make drm_modeset_lock_crtc internal
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4381/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 6 lines · Daniel Vetter
Hi all,
Partially this is a resend of the patches now unblocked by the vmwgfx atomic conversion just merged. I could entirely drop the vmwgfx patch since it's all fixed now.
Quoted 7 lines
Then a bit of follow-up, plus converting the gamma_set/get ioctls. fbdev emulation and the property paths are still infested by
drm_modeset_lock_all, but I think at least for fbdev we now have a semi-clear path with Thierry's series. Properties are still unclear to me, because it's a rather layered maze with lots of different callsites.As always, comments and review highly welcome.
Patches 1-3, 5-8, 10-15:
Patch 4:
typo in the commit message. With that fixed:
Quoted 53 lines
Cheers, Daniel
Daniel Vetter (15):
drm: Makedrm_modeset_lock_crtcinternal
drm: Remove drm_modeset_(un)lock_crtc
drm: Removedrm_modeset_legacy_acquire_ctxandcrtc->acquire_ctxdrm/atomic-helper: removemodeset_lock_allfromhelper_resume
drm: dropmodeset_lock_allfromdrm_state_info
drm: Dropmodeset_lock_allfrom the getproperty ioctl
drm: Only take crtc lock inget_gammaioctl
drm/i915: Nukeintel_atomic_legacy_gamma_set
drm/msm: Nerf zpos property
drm/fb-helper: Give up on kgdb for atomic drivers
drm: Add explicit acquire ctx handling around ->gamma_set
drm: Add acquire ctx to ->gamma_set hook drm/atomic-helper: Remove legacy backoff hack fromgamma_set
drm: extract legacy framebuffer remove
drm/fb-helper: Extract_legacykms functionsdrivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 3 +- drivers/gpu/drm/ast/ast_mode.c | 3 +- drivers/gpu/drm/cirrus/cirrus_mode.c | 3 +- drivers/gpu/drm/drm_atomic.c | 162 +++++++----------------------- drivers/gpu/drm/drm_atomic_helper.c | 35 +++---- drivers/gpu/drm/drm_color_mgmt.c | 51 +++++----- drivers/gpu/drm/drm_crtc_internal.h | 1 - drivers/gpu/drm/drm_fb_helper.c | 81 +++++++++------ drivers/gpu/drm/drm_framebuffer.c | 137 +++++++++++++++++++++---- drivers/gpu/drm/drm_modeset_lock.c | 102 ------------------- drivers/gpu/drm/drm_plane.c | 49 +++++---- drivers/gpu/drm/drm_property.c | 72 ++++++------- drivers/gpu/drm/gma500/gma_display.c | 3 +- drivers/gpu/drm/gma500/gma_display.h | 3 +- drivers/gpu/drm/i915/intel_display.c | 60 +---------- drivers/gpu/drm/i915/intel_pipe_crc.c | 2 +- drivers/gpu/drm/mgag200/mgag200_mode.c | 3 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 2 - drivers/gpu/drm/nouveau/dispnv04/crtc.c | 3 +- drivers/gpu/drm/nouveau/nv50_display.c | 13 +-- drivers/gpu/drm/radeon/radeon_display.c | 3 +- drivers/gpu/drm/vc4/vc4_crtc.c | 3 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 3 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 3 +- include/drm/drm_atomic_helper.h | 3 +- include/drm/drm_crtc.h | 12 +-- include/drm/drm_modeset_lock.h | 5 - 31 files changed, 344 insertions(+), 488 deletions(-)
Quoted 7 lines
--
2.11.0_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 13 lines · Alex Deucher
Quoted 12 lines · Daniel Vetter
Hi all,
Partially this is a resend of the patches now unblocked by the vmwgfx atomic conversion just merged. I could entirely drop the vmwgfx patch since it's all fixed now.
Then a bit of follow-up, plus converting the gamma_set/get ioctls. fbdev emulation and the property paths are still infested by
drm_modeset_lock_all, but I think at least for fbdev we now have a semi-clear path with Thierry's series. Properties are still unclear to me, because it's a rather layered maze with lots of different callsites.
Quoted 8 lines
Quoted 1 line
As always, comments and review highly welcome.
Patches 1-3, 5-8, 10-15:
Acked-by Alex Deucher <[email protected]>Patch 4:
typo in the commit message. With that fixed:Acked-by Alex Deucher <[email protected]>
Thanks for going through, unfortunately I applied 1-8 already. Pulled in 10-15 now too.
-Daniel
Quoted 62 lines
Quoted 62 lines
Cheers, Daniel
Daniel Vetter (15):
drm: Makedrm_modeset_lock_crtcinternal
drm: Remove drm_modeset_(un)lock_crtc
drm: Removedrm_modeset_legacy_acquire_ctxandcrtc->acquire_ctxdrm/atomic-helper: removemodeset_lock_allfromhelper_resume
drm: dropmodeset_lock_allfromdrm_state_info
drm: Dropmodeset_lock_allfrom the getproperty ioctl
drm: Only take crtc lock inget_gammaioctl
drm/i915: Nukeintel_atomic_legacy_gamma_set
drm/msm: Nerf zpos property
drm/fb-helper: Give up on kgdb for atomic drivers
drm: Add explicit acquire ctx handling around ->gamma_set
drm: Add acquire ctx to ->gamma_set hook drm/atomic-helper: Remove legacy backoff hack fromgamma_set
drm: extract legacy framebuffer remove
drm/fb-helper: Extract_legacykms functionsdrivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 3 +- drivers/gpu/drm/ast/ast_mode.c | 3 +- drivers/gpu/drm/cirrus/cirrus_mode.c | 3 +- drivers/gpu/drm/drm_atomic.c | 162 +++++++----------------------- drivers/gpu/drm/drm_atomic_helper.c | 35 +++---- drivers/gpu/drm/drm_color_mgmt.c | 51 +++++----- drivers/gpu/drm/drm_crtc_internal.h | 1 - drivers/gpu/drm/drm_fb_helper.c | 81 +++++++++------ drivers/gpu/drm/drm_framebuffer.c | 137 +++++++++++++++++++++---- drivers/gpu/drm/drm_modeset_lock.c | 102 ------------------- drivers/gpu/drm/drm_plane.c | 49 +++++---- drivers/gpu/drm/drm_property.c | 72 ++++++------- drivers/gpu/drm/gma500/gma_display.c | 3 +- drivers/gpu/drm/gma500/gma_display.h | 3 +- drivers/gpu/drm/i915/intel_display.c | 60 +---------- drivers/gpu/drm/i915/intel_pipe_crc.c | 2 +- drivers/gpu/drm/mgag200/mgag200_mode.c | 3 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 2 - drivers/gpu/drm/nouveau/dispnv04/crtc.c | 3 +- drivers/gpu/drm/nouveau/nv50_display.c | 13 +-- drivers/gpu/drm/radeon/radeon_display.c | 3 +- drivers/gpu/drm/vc4/vc4_crtc.c | 3 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 3 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 3 +- include/drm/drm_atomic_helper.h | 3 +- include/drm/drm_crtc.h | 12 +-- include/drm/drm_modeset_lock.h | 5 - 31 files changed, 344 insertions(+), 488 deletions(-)--
2.11.0_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx