Revert "drm: cleanup: remove drm_modeset_(un)lock_all()"
Subsystems (13)
Sean Paul
reviewerPATCH 1/16 Revert "drm: cleanup: remove drm_modeset_(un)lock_all()"
From: Sean Paul <[email protected]>
This reverts commit 8d813d1a535c8c7503a5f4061654a73026be8c5e.
This patchset breaks on intel platforms and was previously NACK'd by Ville.
--- drivers/gpu/drm/drm_modeset_lock.c | 94 +++++++++++++++++++++++++++++- include/drm/drm_modeset_lock.h | 2 + 2 files changed, 93 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_modeset_lock.c +91 -3
@@ -77,6 +77,93 @@static DEFINE_WW_CLASS (crtc_ww_class); +/** +* drm_modeset_lock_all - take all modeset locks +* @dev: DRM device +* +* This function takes all modeset locks, suitable where a more fine-grained +* scheme isn't (yet) implemented. Locks must be dropped by calling the +* drm_modeset_unlock_all() function. +* +* This function is deprecated. It allocates a lock acquisition context and +* stores it in &drm_device.mode_config. This facilitate conversion of +* existing code because it removes the need to manually deal with the +* acquisition context, but it is also brittle because the context is global +* and care must be taken not to nest calls. New code should use the +* drm_modeset_lock_all_ctx() function and pass in the context explicitly. +*/ +void drm_modeset_lock_all (struct drm_device *dev) +{ +struct drm_mode_config *config = &dev->mode_config; +struct drm_modeset_acquire_ctx *ctx; +int ret; + + ctx =kzalloc (sizeof (*ctx),GFP_KERNEL | __GFP_NOFAIL); +if (WARN_ON (!ctx)) +return ; + +mutex_lock (&config->mutex); + +drm_modeset_acquire_init (ctx,0 ); + +retry: + ret =drm_modeset_lock_all_ctx (dev, ctx); +if (ret <0 ) { +if (ret == -EDEADLK ) { +drm_modeset_backoff (ctx); + goto retry; + } + +drm_modeset_acquire_fini (ctx); +kfree (ctx); +return ; + } +ww_acquire_done (&ctx->ww_ctx); + +WARN_ON (config->acquire_ctx); + +/* +* We hold the locks now, so it is safe to stash the acquisition +* context for drm_modeset_unlock_all(). +*/ + config->acquire_ctx = ctx; + +drm_warn_on_modeset_not_all_locked (dev); +} +EXPORT_SYMBOL (drm_modeset_lock_all); + +/** +* drm_modeset_unlock_all - drop all modeset locks +* @dev: DRM device +* +* This function drops all modeset locks taken by a previous call to the +* drm_modeset_lock_all() function. +* +* This function is deprecated. It uses the lock acquisition context stored +* in &drm_device.mode_config. This facilitates conversion of existing +* code because it removes the need to manually deal with the acquisition +* context, but it is also brittle because the context is global and care must +* be taken not to nest calls. New code should pass the acquisition context +* directly to the drm_modeset_drop_locks() function. +*/ +void drm_modeset_unlock_all (struct drm_device *dev) +{ +struct drm_mode_config *config = &dev->mode_config; +struct drm_modeset_acquire_ctx *ctx = config->acquire_ctx; + +if (WARN_ON (!ctx)) +return ; + + config->acquire_ctx =NULL ; +drm_modeset_drop_locks (ctx); +drm_modeset_acquire_fini (ctx); + +kfree (ctx); + +mutex_unlock (&dev->mode_config.mutex); +} +EXPORT_SYMBOL (drm_modeset_unlock_all); +/** * drm_warn_on_modeset_not_all_locked - check that all modeset locks are locked * @dev: device
@@ -293,9 +380,10 @@ EXPORT_SYMBOL(drm_modeset_unlock);* This function takes all modeset locks, suitable where a more fine-grained * scheme isn't (yet) implemented. * -* It doesn't take the &drm_mode_config.mutex since that lock isn't required for -* modeset state changes. Callers which need to grab that lock too need to do so -* outside of the acquire context @ctx. +* Unlike drm_modeset_lock_all(), it doesn't take the &drm_mode_config.mutex +* since that lock isn't required for modeset state changes. Callers which +* need to grab that lock too need to do so outside of the acquire context +* @ctx. * * Locks acquired with this function should be released by calling the * drm_modeset_drop_locks() function on @ctx.
include/drm/drm_modeset_lock.h +2 -0
@@ -132,6 +132,8 @@ struct drm_device;struct drm_crtc ;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); int drm_modeset_lock_all_ctx(struct drm_device *dev,
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Sean Paul
reviewerPATCH 2/16 Revert "drm/amd: cleanup: drm_modeset_lock_all() --> DRM_MODESET_LOCK_ALL_BEGIN()"
From: Sean Paul <[email protected]>
This reverts commit 299f040e855b69c29522cde446777902381a07f5.
This patchset breaks on intel platforms and was previously NACK'd by Ville.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 21 +++----- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 50 +++++++++---------- .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 25 ++++------ 3 files changed, 43 insertions(+), 53 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +7 -14
@@ -40,7 +40,6 @@#include <drm/drm_fb_helper.h> #include <drm/drm_fourcc.h> #include <drm/drm_vblank.h> -#include <drm/drm_drv.h> static void amdgpu_display_flip_callback (struct dma_fence *f,struct dma_fence_cb *cb)
@@ -1544,21 +1543,16 @@ int amdgpu_display_suspend_helper(struct amdgpu_device *adev)struct drm_crtc *crtc;struct drm_connector *connector;struct drm_connector_list_iter iter; -struct drm_modeset_acquire_ctx ctx; -int r, ret; +int r;/* turn off display hw */ -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_lock_all (dev);drm_connector_list_iter_begin (dev, &iter);drm_for_each_connector_iter (connector, &iter)drm_helper_connector_dpms (connector,DRM_MODE_DPMS_OFF );drm_connector_list_iter_end (&iter); -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); - -if (ret) -return ret; - +drm_modeset_unlock_all (dev);/* unpin the front buffers and cursors */ list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc);
@@ -1596,8 +1590,7 @@ int amdgpu_display_resume_helper(struct amdgpu_device *adev)struct drm_connector *connector;struct drm_connector_list_iter iter;struct drm_crtc *crtc; -struct drm_modeset_acquire_ctx ctx; -int r, ret; +int r;/* pin cursors */ list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {
@@ -1619,7 +1612,7 @@ int amdgpu_display_resume_helper(struct amdgpu_device *adev)drm_helper_resume_force_mode (dev);/* turn on display hw */ -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_lock_all (dev);drm_connector_list_iter_begin (dev, &iter);drm_for_each_connector_iter (connector, &iter)
@@ -1627,8 +1620,8 @@ int amdgpu_display_resume_helper(struct amdgpu_device *adev) DRM_MODE_DPMS_ON);drm_connector_list_iter_end (&iter); -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); +drm_modeset_unlock_all (dev); -return ret; +return 0 ; }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +25 -25
102 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +11 -14
@@ -24,7 +24,6 @@*/ #include <linux/uaccess.h> -#include <drm/drm_drv.h> #include "dc.h" #include "amdgpu.h"
@@ -1192,14 +1191,12 @@ static ssize_t trigger_hotplug(struct file *f, const char __user *buf,struct drm_connector *connector = &aconnector->base;struct dc_link *link =NULL ;struct drm_device *dev = connector->dev; -struct drm_modeset_acquire_ctx ctx;enum dc_connection_type new_connection_type = dc_connection_none;char *wr_buf =NULL ;uint32_t wr_buf_size =42 ;int max_param_num =1 ;long param[1 ] = {0 };uint8_t param_nums =0 ; -int ret;if (!aconnector || !aconnector->dc_link)return -EINVAL ;
@@ -1239,6 +1236,12 @@ static ssize_t trigger_hotplug(struct file *f, const char __user *buf, goto unlock;amdgpu_dm_update_connector_after_detect (aconnector); + +drm_modeset_lock_all (dev); +dm_restore_drm_connector_state (dev, connector); +drm_modeset_unlock_all (dev); + +drm_kms_helper_hotplug_event (dev); }else if (param[0 ] ==0 ) {if (!aconnector->dc_link) goto unlock;
@@ -1256,18 +1259,12 @@ static ssize_t trigger_hotplug(struct file *f, const char __user *buf,amdgpu_dm_update_connector_after_detect (aconnector); - }else { - goto unlock; - } - -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); -dm_restore_drm_connector_state (dev, connector); -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); - -if (ret) -return ret; +drm_modeset_lock_all (dev); +dm_restore_drm_connector_state (dev, connector); +drm_modeset_unlock_all (dev); -drm_kms_helper_hotplug_event (dev); +drm_kms_helper_hotplug_event (dev); + } unlock:mutex_unlock (&aconnector->hpd_lock);
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Sean Paul
reviewerPATCH 3/16 Revert "drm/gma500: cleanup: drm_modeset_lock_all() --> DRM_MODESET_LOCK_ALL_BEGIN()"
In reply to Sean PaulFrom: Sean Paul <[email protected]>
This reverts commit 4f9e860e6ad65ff4ea8ce165a1407d96ff1b2211.
This patchset breaks on intel platforms and was previously NACK'd by Ville.
--- drivers/gpu/drm/gma500/psb_device.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/gpu/drm/gma500/psb_device.c +6 -12
@@ -8,7 +8,6 @@#include <linux/backlight.h> #include <drm/drm.h> -#include <drm/drm_drv.h> #include "gma_device.h" #include "intel_bios.h"
@@ -170,10 +169,8 @@ static int psb_save_display_registers(struct drm_device *dev) {struct drm_psb_private *dev_priv =to_drm_psb_private (dev);struct drm_crtc *crtc; -struct drm_modeset_acquire_ctx ctx;struct gma_connector *connector;struct psb_state *regs = &dev_priv->regs.psb; -int ret;/* Display arbitration control + watermarks */ regs->saveDSPARB =PSB_RVDC32 (DSPARB );
@@ -186,7 +183,7 @@ static int psb_save_display_registers(struct drm_device *dev) regs->saveCHICKENBIT =PSB_RVDC32 (DSPCHICKENBIT );/* Save crtc and output state */ -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_lock_all (dev);list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {if (drm_helper_crtc_in_use (crtc)) dev_priv->ops->save_crtc (crtc);
@@ -196,9 +193,8 @@ static int psb_save_display_registers(struct drm_device *dev)if (connector->save) connector->save (&connector->base); -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); - -return ret; +drm_modeset_unlock_all (dev); +return 0 ; }/**
@@ -211,10 +207,8 @@ static int psb_restore_display_registers(struct drm_device *dev) {struct drm_psb_private *dev_priv =to_drm_psb_private (dev);struct drm_crtc *crtc; -struct drm_modeset_acquire_ctx ctx;struct gma_connector *connector;struct psb_state *regs = &dev_priv->regs.psb; -int ret;/* Display arbitration + watermarks */ PSB_WVDC32 (regs->saveDSPARB,DSPARB );
@@ -229,7 +223,7 @@ static int psb_restore_display_registers(struct drm_device *dev)/*make sure VGA plane is off. it initializes to on after reset!*/ PSB_WVDC32 (0x80000000 ,VGACNTRL ); -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_lock_all (dev);list_for_each_entry (crtc, &dev->mode_config.crtc_list, head)if (drm_helper_crtc_in_use (crtc)) dev_priv->ops->restore_crtc (crtc);
@@ -238,8 +232,8 @@ static int psb_restore_display_registers(struct drm_device *dev)if (connector->restore) connector->restore (&connector->base); -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); -return ret; +drm_modeset_unlock_all (dev); +return 0 ; }static int psb_power_down (struct drm_device *dev)
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Sean Paul
reviewerPATCH 4/16 Revert "drm/i915: cleanup: drm_modeset_lock_all() --> DRM_MODESET_LOCK_ALL_BEGIN() part 2"
In reply to Sean PaulFrom: Sean Paul <[email protected]>
This reverts commit 984c9949f1c4cf36c35aa2de5ee2b65c39379fd9.
This patchset breaks on intel platforms and was previously NACK'd by Ville.
--- drivers/gpu/drm/i915/display/intel_overlay.c | 40 ++++++++++---------- 1 file changed, 21 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/display/intel_overlay.c +21 -19
@@ -1105,7 +1105,6 @@ int intel_overlay_put_image_ioctl(struct drm_device *dev, void *data,struct drm_crtc *drmmode_crtc;struct intel_crtc *crtc;struct drm_i915_gem_object *new_bo; -struct drm_modeset_acquire_ctx ctx;int ret; overlay = dev_priv->overlay;
@@ -1114,24 +1113,24 @@ int intel_overlay_put_image_ioctl(struct drm_device *dev, void *data,return -ENODEV ; } -if (params->flags &I915_OVERLAY_ENABLE ) { - - drmmode_crtc =drm_crtc_find (dev, file_priv, params->crtc_id); -if (!drmmode_crtc) -return -ENOENT ; - crtc =to_intel_crtc (drmmode_crtc); +if (!(params->flags &I915_OVERLAY_ENABLE )) { +drm_modeset_lock_all (dev); + ret =intel_overlay_switch_off (overlay); +drm_modeset_unlock_all (dev); - new_bo =i915_gem_object_lookup (file_priv, params->bo_handle); -if (!new_bo) -return -ENOENT ; +return ret; } -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); + drmmode_crtc =drm_crtc_find (dev, file_priv, params->crtc_id); +if (!drmmode_crtc) +return -ENOENT ; + crtc =to_intel_crtc (drmmode_crtc); -if (!(params->flags &I915_OVERLAY_ENABLE )) { - ret =intel_overlay_switch_off (overlay); - goto out_unlock; - } + new_bo =i915_gem_object_lookup (file_priv, params->bo_handle); +if (!new_bo) +return -ENOENT ; + +drm_modeset_lock_all (dev);if (i915_gem_object_is_tiled (new_bo)) { drm_dbg_kms(&dev_priv->drm,
@@ -1196,11 +1195,14 @@ int intel_overlay_put_image_ioctl(struct drm_device *dev, void *data,if (ret !=0 ) goto out_unlock; -out_unlock: -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); +drm_modeset_unlock_all (dev); +i915_gem_object_put (new_bo); + +return 0 ; -if (params->flags &I915_OVERLAY_ENABLE ) -i915_gem_object_put (new_bo); +out_unlock: +drm_modeset_unlock_all (dev); +i915_gem_object_put (new_bo);return ret; }
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Sean Paul
reviewerPATCH 5/16 Revert "drm/i915: cleanup: drm_modeset_lock_all() --> DRM_MODESET_LOCK_ALL_BEGIN()"
In reply to Sean PaulFrom: Sean Paul <[email protected]>
This reverts commit 746826bcf8fdf682668ff1c415d6b91dbf5858be.
This patchset breaks on intel platforms and was previously NACK'd by Ville.
--- drivers/gpu/drm/i915/display/intel_audio.c | 16 +++---- drivers/gpu/drm/i915/display/intel_display.c | 5 +- .../drm/i915/display/intel_display_debugfs.c | 46 +++++++------------ drivers/gpu/drm/i915/display/intel_overlay.c | 6 +-- drivers/gpu/drm/i915/display/intel_pipe_crc.c | 7 +-- drivers/gpu/drm/i915/i915_drv.c | 13 ++---- 6 files changed, 32 insertions(+), 61 deletions(-)
drivers/gpu/drm/i915/display/intel_audio.c +6 -10
@@ -26,7 +26,6 @@#include <drm/drm_edid.h> #include <drm/i915_component.h> -#include <drm/drm_drv.h> #include "i915_drv.h" #include "intel_atomic.h"
@@ -1215,8 +1214,7 @@ static int i915_audio_component_bind(struct device *i915_kdev, {struct i915_audio_component *acomp = data;struct drm_i915_private *dev_priv =kdev_to_i915 (i915_kdev); -struct drm_modeset_acquire_ctx ctx; -int i, ret; +int i;if (drm_WARN_ON (&dev_priv->drm, acomp->base.ops || acomp->base.dev))return -EEXIST ;
@@ -1226,16 +1224,16 @@ static int i915_audio_component_bind(struct device *i915_kdev, DL_FLAG_STATELESS)))return -ENOMEM ; -DRM_MODESET_LOCK_ALL_BEGIN ((&dev_priv->drm), ctx,0 , ret); +drm_modeset_lock_all (&dev_priv->drm); acomp->base.ops = &i915_audio_component_ops; acomp->base.dev = i915_kdev;BUILD_BUG_ON (MAX_PORTS !=I915_MAX_PORTS );for (i =0 ; i <ARRAY_SIZE (acomp->aud_sample_rate); i++) acomp->aud_sample_rate[i] =0 ; dev_priv->audio_component = acomp; -DRM_MODESET_LOCK_ALL_END ((&dev_priv->drm), ctx, ret); +drm_modeset_unlock_all (&dev_priv->drm); -return ret; +return 0 ; } static void i915_audio_component_unbind(struct device *i915_kdev,
@@ -1243,14 +1241,12 @@ static void i915_audio_component_unbind(struct device *i915_kdev, {struct i915_audio_component *acomp = data;struct drm_i915_private *dev_priv =kdev_to_i915 (i915_kdev); -struct drm_modeset_acquire_ctx ctx; -int ret; -DRM_MODESET_LOCK_ALL_BEGIN ((&dev_priv->drm), ctx,0 , ret); +drm_modeset_lock_all (&dev_priv->drm); acomp->base.ops =NULL ; acomp->base.dev =NULL ; dev_priv->audio_component =NULL ; -DRM_MODESET_LOCK_ALL_END ((&dev_priv->drm), ctx, ret); +drm_modeset_unlock_all (&dev_priv->drm);device_link_remove (hda_kdev, i915_kdev);
drivers/gpu/drm/i915/display/intel_display.c +2 -3
@@ -12512,7 +12512,6 @@ int intel_modeset_init_noirq(struct drm_i915_private *i915)int intel_modeset_init_nogem (struct drm_i915_private *i915) {struct drm_device *dev = &i915->drm; -struct drm_modeset_acquire_ctx ctx;enum pipe pipe;struct intel_crtc *crtc;int ret;
@@ -12564,9 +12563,9 @@ int intel_modeset_init_nogem(struct drm_i915_private *i915)intel_vga_disable (i915);intel_setup_outputs (i915); -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_lock_all (dev);intel_modeset_setup_hw_state (dev, dev->mode_config.acquire_ctx); -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); +drm_modeset_unlock_all (dev);for_each_intel_crtc (dev, crtc) {struct intel_initial_plane_config plane_config = {};
drivers/gpu/drm/i915/display/intel_display_debugfs.c +16 -30
155 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_overlay.c +2 -4
@@ -27,7 +27,6 @@*/ #include <drm/drm_fourcc.h> -#include <drm/drm_drv.h> #include "gem/i915_gem_pm.h" #include "gt/intel_gpu_commands.h"
@@ -1264,7 +1263,6 @@ int intel_overlay_attrs_ioctl(struct drm_device *dev, void *data, {struct drm_intel_overlay_attrs *attrs = data;struct drm_i915_private *dev_priv =to_i915 (dev); -struct drm_modeset_acquire_ctx ctx;struct intel_overlay *overlay;int ret;
@@ -1274,7 +1272,7 @@ int intel_overlay_attrs_ioctl(struct drm_device *dev, void *data,return -ENODEV ; } -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_lock_all (dev); ret = -EINVAL ;if (!(attrs->flags &I915_OVERLAY_UPDATE_ATTRS )) {
@@ -1331,7 +1329,7 @@ int intel_overlay_attrs_ioctl(struct drm_device *dev, void *data, ret =0 ; out_unlock: -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); +drm_modeset_unlock_all (dev);return ret; }
drivers/gpu/drm/i915/display/intel_pipe_crc.c +2 -5
@@ -29,8 +29,6 @@#include <linux/debugfs.h> #include <linux/seq_file.h> -#include <drm/drm_drv.h> -#include "intel_atomic.h" #include "intel_de.h" #include "intel_display_types.h"
@@ -78,7 +76,6 @@ static int i9xx_pipe_crc_auto_source(struct drm_i915_private *dev_priv, enum intel_pipe_crc_source *source) {struct drm_device *dev = &dev_priv->drm; -struct drm_modeset_acquire_ctx ctx;struct intel_encoder *encoder;struct intel_crtc *crtc;struct intel_digital_port *dig_port;
@@ -86,7 +83,7 @@ static int i9xx_pipe_crc_auto_source(struct drm_i915_private *dev_priv, *source =INTEL_PIPE_CRC_SOURCE_PIPE ; -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_lock_all (dev);for_each_intel_encoder (dev, encoder) {if (!encoder->base.crtc)continue ;
@@ -123,7 +120,7 @@ static int i9xx_pipe_crc_auto_source(struct drm_i915_private *dev_priv,break ; } } -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); +drm_modeset_unlock_all (dev);return ret; }
drivers/gpu/drm/i915/i915_drv.c +4 -9
@@ -44,7 +44,6 @@#include <drm/drm_ioctl.h> #include <drm/drm_managed.h> #include <drm/drm_probe_helper.h> -#include <drm/drm_drv.h> #include "display/intel_acpi.h" #include "display/intel_bw.h"
@@ -1010,35 +1009,31 @@ static void i915_driver_postclose(struct drm_device *dev, struct drm_file *file)static void intel_suspend_encoders (struct drm_i915_private *dev_priv) {struct drm_device *dev = &dev_priv->drm; -struct drm_modeset_acquire_ctx ctx;struct intel_encoder *encoder; -int ret;if (!HAS_DISPLAY (dev_priv))return ; -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_lock_all (dev);for_each_intel_encoder (dev, encoder)if (encoder->suspend) encoder->suspend (encoder); -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); +drm_modeset_unlock_all (dev); }static void intel_shutdown_encoders (struct drm_i915_private *dev_priv) {struct drm_device *dev = &dev_priv->drm; -struct drm_modeset_acquire_ctx ctx;struct intel_encoder *encoder; -int ret;if (!HAS_DISPLAY (dev_priv))return ; -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_lock_all (dev);for_each_intel_encoder (dev, encoder)if (encoder->shutdown) encoder->shutdown (encoder); -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); +drm_modeset_unlock_all (dev); }void i915_driver_shutdown (struct drm_i915_private *i915)
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Sean Paul
reviewerPATCH 6/16 Revert "drm/msm: cleanup: drm_modeset_lock_all() --> DRM_MODESET_LOCK_ALL_BEGIN()"
In reply to Sean PaulFrom: Sean Paul <[email protected]>
This reverts commit fd49ef52e2db015ce69ad02bab0702489d141a41.
This patchset breaks on intel platforms and was previously NACK'd by Ville.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +4 -6
@@ -18,7 +18,6 @@#include <drm/drm_probe_helper.h> #include <drm/drm_rect.h> #include <drm/drm_vblank.h> -#include <drm/drm_drv.h> #include "dpu_kms.h" #include "dpu_hw_lm.h"
@@ -1173,15 +1172,14 @@ static int _dpu_debugfs_status_show(struct seq_file *s, void *data)struct drm_display_mode *mode;struct drm_framebuffer *fb;struct drm_plane_state *state; -struct drm_modeset_acquire_ctx ctx;struct dpu_crtc_state *cstate; -int i, out_width, ret; +int i, out_width; dpu_crtc = s->private; crtc = &dpu_crtc->base; -DRM_MODESET_LOCK_ALL_BEGIN (crtc->dev, ctx,0 , ret); +drm_modeset_lock_all (crtc->dev); cstate =to_dpu_crtc_state (crtc->state); mode = &crtc->state->adjusted_mode;
@@ -1265,9 +1263,9 @@ static int _dpu_debugfs_status_show(struct seq_file *s, void *data) dpu_crtc->vblank_cb_time =ktime_set (0 ,0 ); } -DRM_MODESET_LOCK_ALL_END (crtc->dev, ctx, ret); +drm_modeset_unlock_all (crtc->dev); -return ret; +return 0 ; }DEFINE_SHOW_ATTRIBUTE (_dpu_debugfs_status);
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Sean Paul
reviewerPATCH 7/16 Revert "drm/nouveau: cleanup: drm_modeset_lock_all() --> DRM_MODESET_LOCK_ALL_BEGIN()"
In reply to Sean PaulFrom: Sean Paul <[email protected]>
This reverts commit 6aa2daae589b63e8b39fe6f7f2b59fb3063efa05.
This patchset breaks on intel platforms and was previously NACK'd by Ville.
--- drivers/gpu/drm/nouveau/dispnv50/disp.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/gpu/drm/nouveau/dispnv50/disp.c +5 -10
@@ -42,7 +42,6 @@#include <drm/drm_probe_helper.h> #include <drm/drm_scdc_helper.h> #include <drm/drm_vblank.h> -#include <drm/drm_drv.h> #include <nvif/push507c.h>
@@ -668,18 +667,16 @@ nv50_audio_component_bind(struct device *kdev, struct device *hda_kdev,struct drm_device *drm_dev =dev_get_drvdata (kdev);struct nouveau_drm *drm =nouveau_drm (drm_dev);struct drm_audio_component *acomp = data; -struct drm_modeset_acquire_ctx ctx; -int ret;if (WARN_ON (!device_link_add (hda_kdev, kdev,DL_FLAG_STATELESS )))return -ENOMEM ; -DRM_MODESET_LOCK_ALL_BEGIN (drm_dev, ctx,0 , ret); +drm_modeset_lock_all (drm_dev); acomp->ops = &nv50_audio_component_ops; acomp->dev = kdev; drm->audio.component = acomp; -DRM_MODESET_LOCK_ALL_END (drm_dev, ctx, ret); -return ret; +drm_modeset_unlock_all (drm_dev); +return 0 ; } static void
@@ -689,14 +686,12 @@ nv50_audio_component_unbind(struct device *kdev, struct device *hda_kdev,struct drm_device *drm_dev =dev_get_drvdata (kdev);struct nouveau_drm *drm =nouveau_drm (drm_dev);struct drm_audio_component *acomp = data; -struct drm_modeset_acquire_ctx ctx; -int ret; -DRM_MODESET_LOCK_ALL_BEGIN (drm_dev, ctx,0 , ret); +drm_modeset_lock_all (drm_dev); drm->audio.component =NULL ; acomp->ops =NULL ; acomp->dev =NULL ; -DRM_MODESET_LOCK_ALL_END (drm_dev, ctx, ret); +drm_modeset_unlock_all (drm_dev); }static const struct component_ops nv50_audio_component_bind_ops = {
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Sean Paul
reviewerPATCH 8/16 Revert "drm/omapdrm: cleanup: drm_modeset_lock_all() --> DRM_MODESET_LOCK_ALL_BEGIN()"
In reply to Sean PaulFrom: Sean Paul <[email protected]>
This reverts commit 6067fddc1a4fdf155787ab6182c192e4b360b73c.
This patchset breaks on intel platforms and was previously NACK'd by Ville.
--- drivers/gpu/drm/omapdrm/omap_fb.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/omapdrm/omap_fb.c +3 -6
@@ -9,7 +9,6 @@#include <drm/drm_modeset_helper.h> #include <drm/drm_fourcc.h> #include <drm/drm_gem_framebuffer_helper.h> -#include <drm/drm_drv.h> #include "omap_dmm_tiler.h" #include "omap_drv.h"
@@ -63,17 +62,15 @@ static int omap_framebuffer_dirty(struct drm_framebuffer *fb, unsigned num_clips) {struct drm_crtc *crtc; -struct drm_modeset_acquire_ctx ctx; -int ret; -DRM_MODESET_LOCK_ALL_BEGIN (fb->dev, ctx,0 , ret); +drm_modeset_lock_all (fb->dev);drm_for_each_crtc (crtc, fb->dev)omap_crtc_flush (crtc); -DRM_MODESET_LOCK_ALL_END (fb->dev, ctx, ret); +drm_modeset_unlock_all (fb->dev); -return ret; +return 0 ; }static const struct drm_framebuffer_funcs omap_framebuffer_funcs = {
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Sean Paul
reviewerPATCH 9/16 Revert "drm/radeon: cleanup: drm_modeset_lock_all() --> DRM_MODESET_LOCK_ALL_BEGIN()"
In reply to Sean PaulFrom: Sean Paul <[email protected]>
This reverts commit 26723c3d6b930775f9a85521d09655c533a839e6.
This patchset breaks on intel platforms and was previously NACK'd by Ville.
--- drivers/gpu/drm/radeon/radeon_device.c | 21 ++++++--------------- drivers/gpu/drm/radeon/radeon_dp_mst.c | 10 ++++------ 2 files changed, 10 insertions(+), 21 deletions(-)
drivers/gpu/drm/radeon/radeon_device.c +6 -15
@@ -37,7 +37,6 @@#include <drm/drm_cache.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_device.h> -#include <drm/drm_drv.h> #include <drm/drm_file.h> #include <drm/drm_probe_helper.h> #include <drm/radeon_drm.h>
@@ -1560,8 +1559,7 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend,struct pci_dev *pdev;struct drm_crtc *crtc;struct drm_connector *connector; -struct drm_modeset_acquire_ctx ctx; -int i, r, ret; +int i, r;if (dev ==NULL || dev->dev_private ==NULL ) {return -ENODEV ;
@@ -1575,15 +1573,12 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend,drm_kms_helper_poll_disable (dev); -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_lock_all (dev);/* turn off display hw */ list_for_each_entry (connector, &dev->mode_config.connector_list, head) {drm_helper_connector_dpms (connector,DRM_MODE_DPMS_OFF ); } -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); - -if (ret) -return ret; +drm_modeset_unlock_all (dev);/* unpin the front buffers and cursors */ list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {
@@ -1668,8 +1663,7 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon)struct radeon_device *rdev = dev->dev_private;struct pci_dev *pdev =to_pci_dev (dev->dev);struct drm_crtc *crtc; -struct drm_modeset_acquire_ctx ctx; -int r, ret; +int r;if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF )return 0 ;
@@ -1747,14 +1741,11 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon)if (fbcon) {drm_helper_resume_force_mode (dev);/* turn on display hw */ -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_lock_all (dev);list_for_each_entry (connector, &dev->mode_config.connector_list, head) {drm_helper_connector_dpms (connector,DRM_MODE_DPMS_ON ); } -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); - -if (ret) -return ret; +drm_modeset_unlock_all (dev); }drm_kms_helper_poll_enable (dev);
drivers/gpu/drm/radeon/radeon_dp_mst.c +4 -6
@@ -4,7 +4,6 @@#include <drm/drm_fb_helper.h> #include <drm/drm_file.h> #include <drm/drm_probe_helper.h> -#include <drm/drm_drv.h> #include "atom.h" #include "ni_reg.h"
@@ -738,12 +737,11 @@ static int radeon_debugfs_mst_info_show(struct seq_file *m, void *unused)struct radeon_device *rdev = (struct radeon_device *)m->private;struct drm_device *dev = rdev->ddev;struct drm_connector *connector; -struct drm_modeset_acquire_ctx ctx;struct radeon_connector *radeon_connector;struct radeon_connector_atom_dig *dig_connector; -int i, ret; +int i; -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_lock_all (dev);list_for_each_entry (connector, &dev->mode_config.connector_list, head) {if (connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort)continue ;
@@ -761,8 +759,8 @@ static int radeon_debugfs_mst_info_show(struct seq_file *m, void *unused) radeon_connector->cur_stream_attribs[i].fe, radeon_connector->cur_stream_attribs[i].slots); } -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); -return ret; +drm_modeset_unlock_all (dev); +return 0 ; }DEFINE_SHOW_ATTRIBUTE (radeon_debugfs_mst_info);
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Sean Paul
reviewerPATCH 10/16 Revert "drm/shmobile: cleanup: drm_modeset_lock_all() --> DRM_MODESET_LOCK_ALL_BEGIN()"
In reply to Sean PaulFrom: Sean Paul <[email protected]>
This reverts commit 9b8c437ef1a5f34686fc96b391c201a80f1a2ea0.
This patchset breaks on intel platforms and was previously NACK'd by Ville.
--- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/shmobile/shmob_drm_drv.c +2 -4
@@ -156,12 +156,10 @@ static int shmob_drm_pm_suspend(struct device *dev)static int shmob_drm_pm_resume (struct device *dev) {struct shmob_drm_device *sdev =dev_get_drvdata (dev); -struct drm_modeset_acquire_ctx ctx; -int ret; -DRM_MODESET_LOCK_ALL_BEGIN (sdev->ddev, ctx,0 , ret); +drm_modeset_lock_all (sdev->ddev);shmob_drm_crtc_resume (&sdev->crtc); -DRM_MODESET_LOCK_ALL_END (sdev->ddev, ctx, ret); +drm_modeset_unlock_all (sdev->ddev);drm_kms_helper_poll_enable (sdev->ddev);return 0 ;
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Sean Paul
reviewerPATCH 11/16 Revert "drm/tegra: cleanup: drm_modeset_lock_all() --> DRM_MODESET_LOCK_ALL_BEGIN()"
In reply to Sean PaulFrom: Sean Paul <[email protected]>
This reverts commit a2cd9947d99b54c959fce20dc19d81af53f4674e.
This patchset breaks on intel platforms and was previously NACK'd by Ville.
--- drivers/gpu/drm/tegra/dsi.c | 6 ++---- drivers/gpu/drm/tegra/hdmi.c | 6 ++---- drivers/gpu/drm/tegra/sor.c | 11 ++++------- 3 files changed, 8 insertions(+), 15 deletions(-)
drivers/gpu/drm/tegra/dsi.c +2 -4
@@ -23,7 +23,6 @@#include <drm/drm_mipi_dsi.h> #include <drm/drm_panel.h> #include <drm/drm_simple_kms_helper.h> -#include <drm/drm_drv.h> #include "dc.h" #include "drm.h"
@@ -203,11 +202,10 @@ static int tegra_dsi_show_regs(struct seq_file *s, void *data)struct tegra_dsi *dsi = node->info_ent->data;struct drm_crtc *crtc = dsi->output.encoder.crtc;struct drm_device *drm = node->minor->dev; -struct drm_modeset_acquire_ctx ctx;unsigned int i;int err =0 ; -DRM_MODESET_LOCK_ALL_BEGIN (drm, ctx,0 , err); +drm_modeset_lock_all (drm);if (!crtc || !crtc->state->active) { err = -EBUSY ;
@@ -222,7 +220,7 @@ static int tegra_dsi_show_regs(struct seq_file *s, void *data) } unlock: -DRM_MODESET_LOCK_ALL_END (drm, ctx, err); +drm_modeset_unlock_all (drm);return err; }
drivers/gpu/drm/tegra/hdmi.c +2 -4
@@ -22,7 +22,6 @@#include <drm/drm_fourcc.h> #include <drm/drm_probe_helper.h> #include <drm/drm_simple_kms_helper.h> -#include <drm/drm_drv.h> #include "hda.h" #include "hdmi.h"
@@ -1032,11 +1031,10 @@ static int tegra_hdmi_show_regs(struct seq_file *s, void *data)struct tegra_hdmi *hdmi = node->info_ent->data;struct drm_crtc *crtc = hdmi->output.encoder.crtc;struct drm_device *drm = node->minor->dev; -struct drm_modeset_acquire_ctx ctx;unsigned int i;int err =0 ; -DRM_MODESET_LOCK_ALL_BEGIN (drm, ctx,0 , err); +drm_modeset_lock_all (drm);if (!crtc || !crtc->state->active) { err = -EBUSY ;
@@ -1051,7 +1049,7 @@ static int tegra_hdmi_show_regs(struct seq_file *s, void *data) } unlock: -DRM_MODESET_LOCK_ALL_END (drm, ctx, err); +drm_modeset_unlock_all (drm);return err; }
drivers/gpu/drm/tegra/sor.c +4 -7
@@ -23,7 +23,6 @@#include <drm/drm_panel.h> #include <drm/drm_scdc_helper.h> #include <drm/drm_simple_kms_helper.h> -#include <drm/drm_drv.h> #include "dc.h" #include "dp.h"
@@ -1491,11 +1490,10 @@ static int tegra_sor_show_crc(struct seq_file *s, void *data)struct tegra_sor *sor = node->info_ent->data;struct drm_crtc *crtc = sor->output.encoder.crtc;struct drm_device *drm = node->minor->dev; -struct drm_modeset_acquire_ctx ctx;int err =0 ;u32 value; -DRM_MODESET_LOCK_ALL_BEGIN (drm, ctx,0 , err); +drm_modeset_lock_all (drm);if (!crtc || !crtc->state->active) { err = -EBUSY ;
@@ -1524,7 +1522,7 @@ static int tegra_sor_show_crc(struct seq_file *s, void *data)seq_printf (s,"%08x\n" , value); unlock: -DRM_MODESET_LOCK_ALL_END (drm, ctx, err); +drm_modeset_unlock_all (drm);return err; }
@@ -1654,11 +1652,10 @@ static int tegra_sor_show_regs(struct seq_file *s, void *data)struct tegra_sor *sor = node->info_ent->data;struct drm_crtc *crtc = sor->output.encoder.crtc;struct drm_device *drm = node->minor->dev; -struct drm_modeset_acquire_ctx ctx;unsigned int i;int err =0 ; -DRM_MODESET_LOCK_ALL_BEGIN (drm, ctx,0 , err); +drm_modeset_lock_all (drm);if (!crtc || !crtc->state->active) { err = -EBUSY ;
@@ -1673,7 +1670,7 @@ static int tegra_sor_show_regs(struct seq_file *s, void *data) } unlock: -DRM_MODESET_LOCK_ALL_END (drm, ctx, err); +drm_modeset_unlock_all (drm);return err; }
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Sean Paul
reviewerPATCH 12/16 Revert "drm/vmwgfx: cleanup: drm_modeset_lock_all() --> DRM_MODESET_LOCK_ALL_BEGIN()"
In reply to Sean PaulFrom: Sean Paul <[email protected]>
This reverts commit 6b92e77156c5adf6606c8ad825c71404417d88af.
This patchset breaks on intel platforms and was previously NACK'd by Ville.
--- drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | 11 ++++------- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 12 ++++-------- 2 files changed, 8 insertions(+), 15 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +4 -7
@@ -28,7 +28,6 @@#include "vmwgfx_drv.h" #include "vmwgfx_devcaps.h" #include <drm/vmwgfx_drm.h> -#include <drm/drm_drv.h> #include "vmwgfx_kms.h" int vmw_getparam_ioctl(struct drm_device *dev, void *data,
@@ -173,7 +172,6 @@ int vmw_present_ioctl(struct drm_device *dev, void *data,struct drm_vmw_rect __user *clips_ptr;struct drm_vmw_rect *clips =NULL ;struct drm_framebuffer *fb; -struct drm_modeset_acquire_ctx ctx;struct vmw_framebuffer *vfb;struct vmw_resource *res;uint32_t num_clips;
@@ -205,7 +203,7 @@ int vmw_present_ioctl(struct drm_device *dev, void *data, goto out_no_copy; } -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_lock_all (dev); fb =drm_framebuffer_lookup (dev, file_priv, arg->fb_id);if (!fb) {
@@ -233,7 +231,7 @@ int vmw_present_ioctl(struct drm_device *dev, void *data, out_no_surface:drm_framebuffer_put (fb); out_no_fb: -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); +drm_modeset_unlock_all (dev); out_no_copy:kfree (clips); out_clips:
@@ -252,7 +250,6 @@ int vmw_present_readback_ioctl(struct drm_device *dev, void *data,struct drm_vmw_rect __user *clips_ptr;struct drm_vmw_rect *clips =NULL ;struct drm_framebuffer *fb; -struct drm_modeset_acquire_ctx ctx;struct vmw_framebuffer *vfb;uint32_t num_clips;int ret;
@@ -283,7 +280,7 @@ int vmw_present_readback_ioctl(struct drm_device *dev, void *data, goto out_no_copy; } -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_lock_all (dev); fb =drm_framebuffer_lookup (dev, file_priv, arg->fb_id);if (!fb) {
@@ -306,7 +303,7 @@ int vmw_present_readback_ioctl(struct drm_device *dev, void *data, out_no_ttm_lock:drm_framebuffer_put (fb); out_no_fb: -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); +drm_modeset_unlock_all (dev); out_no_copy:kfree (clips); out_clips:
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +4 -8
@@ -33,7 +33,6 @@#include <drm/drm_rect.h> #include <drm/drm_sysfs.h> #include <drm/drm_vblank.h> -#include <drm/drm_drv.h> #include "vmwgfx_kms.h"
@@ -244,17 +243,15 @@ void vmw_kms_legacy_hotspot_clear(struct vmw_private *dev_priv)struct drm_device *dev = &dev_priv->drm;struct vmw_display_unit *du;struct drm_crtc *crtc; -struct drm_modeset_acquire_ctx ctx; -int ret; -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_lock_all (dev);drm_for_each_crtc (crtc, dev) { du =vmw_crtc_to_du (crtc); du->hotspot_x =0 ; du->hotspot_y =0 ; } -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); +drm_modeset_unlock_all (dev); }void vmw_kms_cursor_post_execbuf (struct vmw_private *dev_priv)
@@ -1015,10 +1012,9 @@ static int vmw_framebuffer_bo_dirty(struct drm_framebuffer *framebuffer,struct vmw_framebuffer_bo *vfbd =vmw_framebuffer_to_vfbd (framebuffer);struct drm_clip_rect norect; -struct drm_modeset_acquire_ctx ctx;int ret, increment =1 ; -DRM_MODESET_LOCK_ALL_BEGIN ((&dev_priv->drm), ctx,0 , ret); +drm_modeset_lock_all (&dev_priv->drm);if (!num_clips) { num_clips =1 ;
@@ -1044,7 +1040,7 @@ static int vmw_framebuffer_bo_dirty(struct drm_framebuffer *framebuffer,vmw_cmd_flush (dev_priv, false); -DRM_MODESET_LOCK_ALL_END ((&dev_priv->drm), ctx, ret); +drm_modeset_unlock_all (&dev_priv->drm);return ret; }
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Sean Paul
reviewerPATCH 13/16 Revert "drm: cleanup: drm_modeset_lock_all() --> DRM_MODESET_LOCK_ALL_BEGIN()"
In reply to Sean PaulFrom: Sean Paul <[email protected]>
This reverts commit 7c5f2eecc21f44fba1b1f13ce09c2533db9d781a.
This patchset breaks on intel platforms and was previously NACK'd by Ville.
--- drivers/gpu/drm/drm_client_modeset.c | 5 ++--- drivers/gpu/drm/drm_crtc_helper.c | 18 ++++++------------ drivers/gpu/drm/drm_fb_helper.c | 10 ++++------ drivers/gpu/drm/drm_framebuffer.c | 6 ++---- 4 files changed, 14 insertions(+), 25 deletions(-)
drivers/gpu/drm/drm_client_modeset.c +2 -3
@@ -1062,10 +1062,9 @@ static int drm_client_modeset_commit_legacy(struct drm_client_dev *client)struct drm_device *dev = client->dev;struct drm_mode_set *mode_set;struct drm_plane *plane; -struct drm_modeset_acquire_ctx ctx;int ret =0 ; -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_lock_all (dev);drm_for_each_plane (plane, dev) {if (plane->type !=DRM_PLANE_TYPE_PRIMARY )drm_plane_force_disable (plane);
@@ -1094,7 +1093,7 @@ static int drm_client_modeset_commit_legacy(struct drm_client_dev *client) goto out; } out: -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); +drm_modeset_unlock_all (dev);return ret; }
drivers/gpu/drm/drm_crtc_helper.c +6 -12
@@ -218,14 +218,11 @@ static void __drm_helper_disable_unused_functions(struct drm_device *dev)*/ void drm_helper_disable_unused_functions (struct drm_device *dev) { -struct drm_modeset_acquire_ctx ctx; -int ret; -WARN_ON (drm_drv_uses_atomic_modeset (dev)); -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_lock_all (dev);__drm_helper_disable_unused_functions (dev); -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); +drm_modeset_unlock_all (dev); }EXPORT_SYMBOL (drm_helper_disable_unused_functions);
@@ -945,14 +942,12 @@ void drm_helper_resume_force_mode(struct drm_device *dev)struct drm_crtc *crtc;struct drm_encoder *encoder;const struct drm_crtc_helper_funcs *crtc_funcs; -struct drm_modeset_acquire_ctx ctx;int encoder_dpms;bool ret; -int err;WARN_ON (drm_drv_uses_atomic_modeset (dev)); -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , err); +drm_modeset_lock_all (dev);drm_for_each_crtc (crtc, dev) {if (!crtc->enabled)
@@ -987,7 +982,7 @@ void drm_helper_resume_force_mode(struct drm_device *dev)/* disable the unused connectors while restoring the modesetting */ __drm_helper_disable_unused_functions (dev); -DRM_MODESET_LOCK_ALL_END (dev, ctx, err); +drm_modeset_unlock_all (dev); }EXPORT_SYMBOL (drm_helper_resume_force_mode);
@@ -1007,10 +1002,9 @@ EXPORT_SYMBOL(drm_helper_resume_force_mode);int drm_helper_force_disable_all (struct drm_device *dev) {struct drm_crtc *crtc; -struct drm_modeset_acquire_ctx ctx;int ret =0 ; -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_lock_all (dev);drm_for_each_crtc (crtc, dev)if (crtc->enabled) { struct drm_mode_set set = {
@@ -1022,7 +1016,7 @@ int drm_helper_force_disable_all(struct drm_device *dev) goto out; } out: -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); +drm_modeset_unlock_all (dev);return ret; }EXPORT_SYMBOL (drm_helper_force_disable_all);
drivers/gpu/drm/drm_fb_helper.c +4 -6
@@ -940,11 +940,10 @@ static int setcmap_legacy(struct fb_cmap *cmap, struct fb_info *info)struct drm_fb_helper *fb_helper = info->par;struct drm_mode_set *modeset;struct drm_crtc *crtc; -struct drm_modeset_acquire_ctx ctx;u16 *r, *g, *b;int ret =0 ; -DRM_MODESET_LOCK_ALL_BEGIN (fb_helper->dev, ctx,0 , ret); +drm_modeset_lock_all (fb_helper->dev);drm_client_for_each_modeset (modeset, &fb_helper->client) { crtc = modeset->crtc;if (!crtc->funcs->gamma_set || !crtc->gamma_size) {
@@ -971,7 +970,7 @@ static int setcmap_legacy(struct fb_cmap *cmap, struct fb_info *info) goto out; } out: -DRM_MODESET_LOCK_ALL_END (fb_helper->dev, ctx, ret); +drm_modeset_unlock_all (fb_helper->dev);return ret; }
@@ -1442,11 +1441,10 @@ static int pan_display_legacy(struct fb_var_screeninfo *var,struct drm_fb_helper *fb_helper = info->par;struct drm_client_dev *client = &fb_helper->client;struct drm_mode_set *modeset; -struct drm_modeset_acquire_ctx ctx;int ret =0 ;mutex_lock (&client->modeset_mutex); -DRM_MODESET_LOCK_ALL_BEGIN (fb_helper->dev, ctx,0 , ret); +drm_modeset_lock_all (fb_helper->dev);drm_client_for_each_modeset (modeset, client) { modeset->x = var->xoffset; modeset->y = var->yoffset;
@@ -1459,7 +1457,7 @@ static int pan_display_legacy(struct fb_var_screeninfo *var, } } } -DRM_MODESET_LOCK_ALL_END (fb_helper->dev, ctx, ret); +drm_modeset_unlock_all (fb_helper->dev);mutex_unlock (&client->modeset_mutex);return ret;
drivers/gpu/drm/drm_framebuffer.c +2 -4
@@ -1059,10 +1059,8 @@ static void legacy_remove_fb(struct drm_framebuffer *fb)struct drm_device *dev = fb->dev;struct drm_crtc *crtc;struct drm_plane *plane; -struct drm_modeset_acquire_ctx ctx; -int ret; -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_lock_all (dev);/* remove from any CRTC */ drm_for_each_crtc (crtc, dev) {if (crtc->primary->fb == fb) {
@@ -1084,7 +1082,7 @@ static void legacy_remove_fb(struct drm_framebuffer *fb)drm_plane_force_disable (plane); } } -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); +drm_modeset_unlock_all (dev); }/**
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Sean Paul
reviewerPATCH 14/16 Revert "drm/msm: cleanup: drm_modeset_lock_all_ctx() --> DRM_MODESET_LOCK_ALL_BEGIN()"
In reply to Sean PaulFrom: Sean Paul <[email protected]>
This reverts commit 4c048437ef7adb2d81fe4ddc5c04179126eefcf2.
This patchset breaks on intel platforms and was previously NACK'd by Ville.
--- drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c +6 -6
@@ -5,8 +5,6 @@#define pr_fmt (fmt) "[drm:%s:%d] " fmt, __func__, __LINE__ -#include <drm/drm_drv.h> -#include "msm_disp_snapshot.h" static void msm_disp_state_dump_regs (u32 **reg,u32 aligned_len,void __iomem *base_addr)
@@ -101,18 +99,20 @@ static void msm_disp_capture_atomic_state(struct msm_disp_state *disp_state) {struct drm_device *ddev;struct drm_modeset_acquire_ctx ctx; -int ret; disp_state->timestamp =ktime_get (); ddev = disp_state->drm_dev; -DRM_MODESET_LOCK_ALL_BEGIN (ddev, ctx,0 , ret); +drm_modeset_acquire_init (&ctx,0 ); + +while (drm_modeset_lock_all_ctx (ddev, &ctx) !=0 ) +drm_modeset_backoff (&ctx); disp_state->atomic_state =drm_atomic_helper_duplicate_state (ddev, &ctx); - -DRM_MODESET_LOCK_ALL_END (ddev, ctx, ret); +drm_modeset_drop_locks (&ctx); +drm_modeset_acquire_fini (&ctx); }void msm_disp_snapshot_capture_state (struct msm_disp_state *disp_state)
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Sean Paul
reviewerPATCH 15/16 Revert "drm/i915: cleanup: drm_modeset_lock_all_ctx() --> DRM_MODESET_LOCK_ALL_BEGIN()"
In reply to Sean PaulFrom: Sean Paul <[email protected]>
This reverts commit 399190e70816886e2bca1f3f3bc3d9c544af88e7.
This patchset breaks on intel platforms and was previously NACK'd by Ville.
--- drivers/gpu/drm/i915/display/intel_display.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +13 -5
@@ -43,7 +43,6 @@#include <drm/drm_plane_helper.h> #include <drm/drm_probe_helper.h> #include <drm/drm_rect.h> -#include <drm/drm_drv.h> #include "display/intel_audio.h" #include "display/intel_crt.h"
@@ -13477,13 +13476,22 @@ void intel_display_resume(struct drm_device *dev)if (state) state->acquire_ctx = &ctx; -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_acquire_init (&ctx,0 ); - ret =__intel_display_resume (dev, state, &ctx); +while (1 ) { + ret =drm_modeset_lock_all_ctx (dev, &ctx); +if (ret != -EDEADLK ) +break ; -intel_enable_ipc (dev_priv); +drm_modeset_backoff (&ctx); + } + +if (!ret) + ret =__intel_display_resume (dev, state, &ctx); -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); +intel_enable_ipc (dev_priv); +drm_modeset_drop_locks (&ctx); +drm_modeset_acquire_fini (&ctx);if (ret) drm_err(&dev_priv->drm,
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Re: [PATCH 15/16] Revert "drm/i915: cleanup: drm_modeset_lock_all_ctx() --> DRM_MODESET_LOCK_ALL_BEGIN()"
Quoted 10 lines · Sean Paul
From: Sean Paul <[email protected]>
This reverts commit
399190e70816886e2bca1f3f3bc3d9c544af88e7.This patchset breaks on intel platforms and was previously NACK'd by Ville.
Cc Ville Syrjälä <[email protected]>Cc Fernando Ramos <[email protected]>Signed-off-by Sean Paul <[email protected]>
Yeah, best to try again from the start I think.
For the series
Quoted 45 lines
--- drivers/gpu/drm/i915/display/intel_display.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/display/intel_display.c +13
-5@@ -43,7 +43,6 @@#include <drm/drm_plane_helper.h> #include <drm/drm_probe_helper.h> #include <drm/drm_rect.h> -#include <drm/drm_drv.h> #include "display/intel_audio.h" #include "display/intel_crt.h" @@ -13477,13 +13476,22 @@ void intel_display_resume(struct drm_device *dev)if (state) state->acquire_ctx = &ctx; -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_acquire_init (&ctx,0 ); - ret =__intel_display_resume (dev, state, &ctx); +while (1 ) { + ret =drm_modeset_lock_all_ctx (dev, &ctx); +if (ret != -EDEADLK ) +break ; -intel_enable_ipc (dev_priv); +drm_modeset_backoff (&ctx); + } + +if (!ret) + ret =__intel_display_resume (dev, state, &ctx); -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); +intel_enable_ipc (dev_priv); +drm_modeset_drop_locks (&ctx); +drm_modeset_acquire_fini (&ctx);if (ret) drm_err(&dev_priv->drm,Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Signature · 2 lines
Ville Syrjälä Intel
Sean Paul
reviewerRe: [PATCH 15/16] Revert "drm/i915: cleanup: drm_modeset_lock_all_ctx() --> DRM_MODESET_LOCK_ALL_BEGIN()"
Quoted 5 lines · Ville Syrjälä
Quoted 4 lines · Sean Paul
From: Sean Paul <[email protected]>
This reverts commit
399190e70816886e2bca1f3f3bc3d9c544af88e7.
Quoted 8 lines
Quoted 6 lines
This patchset breaks on intel platforms and was previously NACK'd by Ville.
Cc Ville Syrjälä <[email protected]>Cc Fernando Ramos <[email protected]>Signed-off-by Sean Paul <[email protected]>Yeah, best to try again from the start I think.
Pushed the revert set (and left the TODO item out for now). Thanks for raising the issue.
@Fernando, hopefully you can revise and post again. Thank you for your patches and your effort!
Sean
Quoted 53 lines
For the series
Acked-by Ville Syrjälä <[email protected]>Quoted 45 lines
--- drivers/gpu/drm/i915/display/intel_display.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/display/intel_display.c +13
-5@@ -43,7 +43,6 @@#include <drm/drm_plane_helper.h> #include <drm/drm_probe_helper.h> #include <drm/drm_rect.h> -#include <drm/drm_drv.h> #include "display/intel_audio.h" #include "display/intel_crt.h" @@ -13477,13 +13476,22 @@ void intel_display_resume(struct drm_device *dev)if (state) state->acquire_ctx = &ctx; -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , ret); +drm_modeset_acquire_init (&ctx,0 ); - ret =__intel_display_resume (dev, state, &ctx); +while (1 ) { + ret =drm_modeset_lock_all_ctx (dev, &ctx); +if (ret != -EDEADLK ) +break ; -intel_enable_ipc (dev_priv); +drm_modeset_backoff (&ctx); + } + +if (!ret) + ret =__intel_display_resume (dev, state, &ctx); -DRM_MODESET_LOCK_ALL_END (dev, ctx, ret); +intel_enable_ipc (dev_priv); +drm_modeset_drop_locks (&ctx); +drm_modeset_acquire_fini (&ctx);if (ret) drm_err(&dev_priv->drm,Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OSSignature · 2 lines
Ville Syrjälä Intel
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Re: [PATCH 15/16] Revert "drm/i915: cleanup: drm_modeset_lock_all_ctx() --> DRM_MODESET_LOCK_ALL_BEGIN()"
Quoted 2 lines · Sean Paul
@Fernando, hopefully you can revise and post again. Thank you for your patches and your effort!
No problem :)
Just to be sure I do the right thing this time (and to better understand the process), please confirm that this is the correct sequence of events:
1. I fix the lock issue and test on my local machine.
2. I then post this new patch set (v3) rebased on top of drm-tip (instead of drm-next). This will automatically trigger tests on intel hardware (and maybe in other hardwares?)
NOTE: I originally chose drm-next because that's what is mentioned here:
https://01.org/linuxgraphics/gfx-docs/drm/gpu/introduction.html#contribution-process
Maybe this doc should be updated?
3. Once reviewed and approved, someone (Sean?) merges them into "somewhere" (drm-next? drm-misc-next? drm-intel-next? How is this decided?).
4. Eventually, that other branch from the previous point is merged into drm-tip.
5. ??
6. The branch is merged into linux-next.
There must be something wrong in my description above, as it doesn't make sense to post the patch series based on "drm-tip" only to later have one of the mainteiners merge them into a different branch that will eventually be merged back into "drm-tip".
Sorry for being completely lost! Is there a document explaining how all of this works so that I can learn for the next time?
Thanks!
Re: [PATCH 15/16] Revert "drm/i915: cleanup: drm_modeset_lock_all_ctx() --> DRM_MODESET_LOCK_ALL_BEGIN()"
Quoted 22 lines · Fernando Ramos
Quoted 2 lines · Sean Paul
@Fernando, hopefully you can revise and post again. Thank you for your patches and your effort!
No problem :)
Just to be sure I do the right thing this time (and to better understand the process), please confirm that this is the correct sequence of events:
1. I fix the lock issue and test on my local machine.
2. I then post this new patch set (v3) rebased on top of drm-tip (instead of drm-next). This will automatically trigger tests on intel hardware (and maybe in other hardwares?)
NOTE: I originally chose drm-next because that's what is mentioned here:
https://01.org/linuxgraphics/gfx-docs/drm/gpu/introduction.html#contribution-process
Maybe this doc should be updated?3. Once reviewed and approved, someone (Sean?) merges them into "somewhere" (drm-next? drm-misc-next? drm-intel-next? How is this decided?).
Quoted 6 lines
4. Eventually, that other branch from the previous point is merged into drm-tip.
5. ??
6. The branch is merged into linux-next.
This part should happen automatically, plus/minus right around the merge window. At least not your problem.
Otherwise don't worry, and don't sweat it too much. We know that our CI situation just isn't great yet for drm contributors :-/ There's plans to improve it though, but it all takes time.
Quoted 7 lines
There must be something wrong in my description above, as it doesn't make sense to post the patch series based on "drm-tip" only to later have one of the mainteiners merge them into a different branch that will eventually be merged back into "drm-tip".
Sorry for being completely lost! Is there a document explaining how all of this works so that I can learn for the next time?
drm-tip is just linux-next for drm area, it's the same principle. If there are conflicts while merging, maintainers will sort these out. And yeah that's a bit a speciality of linux with the multi-branch model for development.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Sean Paul
reviewerPATCH 16/16 Revert "drm: cleanup: drm_modeset_lock_all_ctx() --> DRM_MODESET_LOCK_ALL_BEGIN()"
In reply to Sean PaulFrom: Sean Paul <[email protected]>
This reverts commit 21dde40902d2636f70766b3154931de57e1215e9.
This patchset breaks on intel platforms and was previously NACK'd by Ville.
--- drivers/gpu/drm/drm_client_modeset.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_client_modeset.c +6 -3
@@ -574,7 +574,6 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,int num_connectors_detected =0 ;int num_tiled_conns =0 ;struct drm_modeset_acquire_ctx ctx; -int err;if (!drm_drv_uses_atomic_modeset (dev))return false;
@@ -586,7 +585,10 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,if (!save_enabled)return false; -DRM_MODESET_LOCK_ALL_BEGIN (dev, ctx,0 , err); +drm_modeset_acquire_init (&ctx,0 ); + +while (drm_modeset_lock_all_ctx (dev, &ctx) !=0 ) +drm_modeset_backoff (&ctx);memcpy (save_enabled, enabled, count); mask =GENMASK (count -1 ,0 );
@@ -741,7 +743,8 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, ret = false; } -DRM_MODESET_LOCK_ALL_END (dev, ctx, err); +drm_modeset_drop_locks (&ctx); +drm_modeset_acquire_fini (&ctx);kfree (save_enabled);return ret;
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS