Re: [PATCH 1/2] drm/i915: Allow control of PSR at runtime through debugfs, v4.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Op 31-07-18 om 15:35 schreef Maarten Lankhorst:
> Currently tests modify i915.enable_psr and then do a modeset cycle
> to change PSR. We can write a value to i915_edp_psr_debug to force
> a certain PSR mode without a modeset.
>
> To retain compatibility with older userspace, we also still allow
> the override through the module parameter, and add some tracking
> to check whether a debugfs mode is specified.
>
> Changes since v1:
> - Rename dev_priv->psr.enabled to .dp, and .hw_configured to .enabled.
> - Fix i915_psr_debugfs_mode to match the writes to debugfs.
> - Rename __i915_edp_psr_write to intel_psr_set_debugfs_mode, simplify
>   it and move it to intel_psr.c. This keeps all internals in intel_psr.c
> - Perform an interruptible wait for hw completion outside of the psr
>   lock, instead of being forced to trywait and return -EBUSY.
> Changes since v2:
> - Rebase on top of intel_psr changes.
> Changes since v3:
> - Assign psr.dp during init. (dhnkrn)
> - Add prepared bool, which should be used instead of relying on psr.dp. (dhnkrn)
> - Fix -EDEADLK handling in debugfs. (dhnkrn)
> - Clean up waiting for idle in intel_psr_set_debugfs_mode.
> - Print PSR mode when trying to enable PSR. (dhnkrn)
> - Move changing psr debug setting to i915_edp_psr_debug_set. (dhnkrn)
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
> Cc: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c |  21 ++++-
>  drivers/gpu/drm/i915/i915_drv.h     |  12 ++-
>  drivers/gpu/drm/i915/i915_irq.c     |   2 +-
>  drivers/gpu/drm/i915/intel_drv.h    |   5 +-
>  drivers/gpu/drm/i915/intel_psr.c    | 136 +++++++++++++++++++++++-----
>  5 files changed, 144 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 59dc0610ea44..a7e927413e8e 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2705,7 +2705,7 @@ static int i915_edp_psr_status(struct seq_file *m, void *data)
>  	intel_runtime_pm_get(dev_priv);
>  
>  	mutex_lock(&dev_priv->psr.lock);
> -	seq_printf(m, "Enabled: %s\n", yesno((bool)dev_priv->psr.enabled));
> +	seq_printf(m, "Enabled: %s\n", yesno(dev_priv->psr.enabled));
>  	seq_printf(m, "Busy frontbuffer bits: 0x%03x\n",
>  		   dev_priv->psr.busy_frontbuffer_bits);
>  
> @@ -2747,14 +2747,29 @@ static int
>  i915_edp_psr_debug_set(void *data, u64 val)
>  {
>  	struct drm_i915_private *dev_priv = data;
> +	struct drm_modeset_acquire_ctx ctx;
> +	int ret;
>  
>  	if (!CAN_PSR(dev_priv))
>  		return -ENODEV;
>  
> -	DRM_DEBUG_KMS("PSR debug %s\n", enableddisabled(val));
> +	DRM_DEBUG_KMS("Setting PSR debug to %llx\n", val);
>  
>  	intel_runtime_pm_get(dev_priv);
> -	intel_psr_irq_control(dev_priv, !!val);
> +
> +	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
> +
> +retry:
> +	ret = intel_psr_set_debugfs_mode(dev_priv, &ctx, val);
> +	if (ret == -EDEADLK) {
> +		ret = drm_modeset_backoff(&ctx);
> +		if (!ret)
> +			goto retry;
> +	}
> +
> +	drm_modeset_drop_locks(&ctx);
> +	drm_modeset_acquire_fini(&ctx);
> +
>  	intel_runtime_pm_put(dev_priv);
>  
>  	return 0;
^Oops, needs to be changed to return ret;

~Maarten
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux