RE: [Linux-graphics-maintainer] [PATCH] drm/vmwgfx: Convert drm_atomic_helper_suspend/resume()

From: Deepak Singh Rawat
Date: Mon Aug 20 2018 - 17:34:16 EST


Hi, thanks for the patch. Perhaps can get rid of vmw_kms_resume
and vmw_kms_suspend, otherwise looks good to me.

>
> convert drm_atomic_helper_suspend/resume() to use
> drm_mode_config_helper_suspend/resume().
>
> suspend_state can be removed from vmw_private as
> it will not be used anymore.
>
> Signed-off-by: Ajit Negi <ajitn.linux@xxxxxxxxx>
> Signed-off-by: Souptick Joarder <jrdr.linux@xxxxxxxxx>
> ---
> drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 6 +++---
> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 1 -
> drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 25 ++-----------------------
> 3 files changed, 5 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> index bb6dbbe..a317cda 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> @@ -1521,7 +1521,7 @@ static int vmw_pm_freeze(struct device *kdev)
> WARN_ON(vmw_request_device_late(dev_priv));
> dev_priv->suspend_locked = false;
> ttm_suspend_unlock(&dev_priv->reservation_sem);
> - if (dev_priv->suspend_state)
> + if (dev->mode_config.suspend_state)
> vmw_kms_resume(dev);
> if (dev_priv->enable_fb)
> vmw_fb_on(dev_priv);
> @@ -1558,8 +1558,8 @@ static int vmw_pm_restore(struct device *kdev)
> vmw_fence_fifo_up(dev_priv->fman);
> dev_priv->suspend_locked = false;
> ttm_suspend_unlock(&dev_priv->reservation_sem);
> - if (dev_priv->suspend_state)
> - vmw_kms_resume(dev_priv->dev);
> + if (dev->mode_config.suspend_state)
> + vmw_kms_resume(dev);
>
> if (dev_priv->enable_fb)
> vmw_fb_on(dev_priv);
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
> b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
> index 1abe217..b8e200b 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
> @@ -438,7 +438,6 @@ struct vmw_private {
> struct vmw_framebuffer *implicit_fb;
> struct mutex global_kms_state_mutex;
> spinlock_t cursor_lock;
> - struct drm_atomic_state *suspend_state;
>
> /*
> * Context and surface management.
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> index 23beff5..2d011a1 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> @@ -3028,19 +3028,7 @@ int vmw_kms_set_config(struct drm_mode_set
> *set,
> */
> int vmw_kms_suspend(struct drm_device *dev)
> {
> - struct vmw_private *dev_priv = vmw_priv(dev);
> -
> - dev_priv->suspend_state = drm_atomic_helper_suspend(dev);
> - if (IS_ERR(dev_priv->suspend_state)) {
> - int ret = PTR_ERR(dev_priv->suspend_state);
> -
> - DRM_ERROR("Failed kms suspend: %d\n", ret);
> - dev_priv->suspend_state = NULL;
> -
> - return ret;
> - }
> -
> - return 0;
> + return drm_mode_config_helper_suspend(dev);
> }
>
>
> @@ -3055,16 +3043,7 @@ int vmw_kms_suspend(struct drm_device *dev)
> */
> int vmw_kms_resume(struct drm_device *dev)
> {
> - struct vmw_private *dev_priv = vmw_priv(dev);
> - int ret;
> -
> - if (WARN_ON(!dev_priv->suspend_state))
> - return 0;
> -
> - ret = drm_atomic_helper_resume(dev, dev_priv->suspend_state);
> - dev_priv->suspend_state = NULL;
> -
> - return ret;
> + return drm_mode_config_helper_resume(dev);
> }
>
> /**
> --
> 1.9.1