Re: [PATCH] drm/atomic-helper: add unlocked disable all outputs helper

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

 



On Fri, Aug 12, 2016 at 5:07 AM, Lucas Stach <l.stach@xxxxxxxxxxxxxx> wrote:
> This adds the unlocked variant of drm_atomic_helper_disable_all(),
> which takes all the required modeset locks itself. This is intended
> to be used when shutting down the driver, without retaining any
> state.
>
> Signed-off-by: Lucas Stach <l.stach@xxxxxxxxxxxxxx>

So I suppose this is the atomic equivalent of
drm_crtc_force_disable_all? Should you perhaps update the legacy
helper to call this new function?

Sean


> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 43 +++++++++++++++++++++++++++++++++++++
>  include/drm/drm_atomic_helper.h     |  1 +
>  2 files changed, 44 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 99365087645b..6673021ab21e 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2435,6 +2435,49 @@ free:
>  EXPORT_SYMBOL(drm_atomic_helper_disable_all);
>
>  /**
> + * drm_atomic_helper_disable_all_unlocked - disable all currently active
> + * outputs taking the modeset locks itself
> + * @dev: DRM device
> + *
> + * Loops through all connectors, finding those that aren't turned off and then
> + * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
> + * that they are connected to.
> + *
> + * This is used for example when shutting down the DRM device.
> + *
> + * Returns:
> + * 0 on success or a negative error code on failure.
> + */
> +int drm_atomic_helper_disable_all_unlocked(struct drm_device *dev)
> +{
> +       struct drm_modeset_acquire_ctx ctx;
> +       int err;
> +
> +       drm_modeset_acquire_init(&ctx, 0);
> +
> +retry:
> +       err = drm_modeset_lock_all_ctx(dev, &ctx);
> +       if (err < 0)
> +               goto unlock;
> +
> +       err = drm_atomic_helper_disable_all(dev, &ctx);
> +       if (err < 0)
> +               goto unlock;
> +
> +unlock:
> +       if (err == -EDEADLK) {
> +               drm_modeset_backoff(&ctx);
> +               goto retry;
> +       }
> +
> +       drm_modeset_drop_locks(&ctx);
> +       drm_modeset_acquire_fini(&ctx);
> +
> +       return err;
> +}
> +EXPORT_SYMBOL(drm_atomic_helper_disable_all_unlocked);
> +
> +/**
>   * drm_atomic_helper_suspend - subsystem-level suspend helper
>   * @dev: DRM device
>   *
> diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
> index d86ae5dcd7b4..104d310c2c70 100644
> --- a/include/drm/drm_atomic_helper.h
> +++ b/include/drm/drm_atomic_helper.h
> @@ -99,6 +99,7 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
>
>  int drm_atomic_helper_disable_all(struct drm_device *dev,
>                                   struct drm_modeset_acquire_ctx *ctx);
> +int drm_atomic_helper_disable_all_unlocked(struct drm_device *dev);
>  struct drm_atomic_state *drm_atomic_helper_suspend(struct drm_device *dev);
>  int drm_atomic_helper_resume(struct drm_device *dev,
>                              struct drm_atomic_state *state);
> --
> 2.8.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux