[v3,10/23] drm: hibmc: use vblank hooks in struct drm_crtc_funcs

Message ID 1486458995-31018-11-git-send-email-shawnguo@kernel.org
State New
Headers show
Series
  • Add vblank hooks to struct drm_crtc_funcs
Related show

Commit Message

Shawn Guo Feb. 7, 2017, 9:16 a.m.
From: Shawn Guo <shawn.guo@linaro.org>

The vblank hooks in struct drm_driver are deprecated and only meant for
legacy drivers.  For modern drivers with DRIVER_MODESET flag, the hooks
in struct drm_crtc_funcs should be used instead.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
---
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c  | 20 ++++++++++++++++++++
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 22 ----------------------
 2 files changed, 20 insertions(+), 22 deletions(-)

Comments

Sean Paul Feb. 8, 2017, 3:39 p.m. | #1
On Tue, Feb 07, 2017 at 05:16:22PM +0800, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> The vblank hooks in struct drm_driver are deprecated and only meant for
> legacy drivers.  For modern drivers with DRIVER_MODESET flag, the hooks
> in struct drm_crtc_funcs should be used instead.
> 

Reviewed-by: Sean Paul <seanpaul@chromium.org>

> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c  | 20 ++++++++++++++++++++
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 22 ----------------------
>  2 files changed, 20 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> index c655883d3613..59542bddc980 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> @@ -423,6 +423,24 @@ static void hibmc_crtc_atomic_flush(struct drm_crtc *crtc,
>  	spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
>  }
>  
> +static int hibmc_crtc_enable_vblank(struct drm_crtc *crtc)
> +{
> +	struct hibmc_drm_private *priv = crtc->dev->dev_private;
> +
> +	writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(1),
> +	       priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> +
> +	return 0;
> +}
> +
> +static void hibmc_crtc_disable_vblank(struct drm_crtc *crtc)
> +{
> +	struct hibmc_drm_private *priv = crtc->dev->dev_private;
> +
> +	writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(0),
> +	       priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> +}
> +
>  static const struct drm_crtc_funcs hibmc_crtc_funcs = {
>  	.page_flip = drm_atomic_helper_page_flip,
>  	.set_config = drm_atomic_helper_set_config,
> @@ -430,6 +448,8 @@ static void hibmc_crtc_atomic_flush(struct drm_crtc *crtc,
>  	.reset = drm_atomic_helper_crtc_reset,
>  	.atomic_duplicate_state =  drm_atomic_helper_crtc_duplicate_state,
>  	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
> +	.enable_vblank = hibmc_crtc_enable_vblank,
> +	.disable_vblank = hibmc_crtc_disable_vblank,
>  };
>  
>  static const struct drm_crtc_helper_funcs hibmc_crtc_helper_funcs = {
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index 8cac70454b57..2ffdbf9801bd 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -37,26 +37,6 @@
>  	.llseek		= no_llseek,
>  };
>  
> -static int hibmc_enable_vblank(struct drm_device *dev, unsigned int pipe)
> -{
> -	struct hibmc_drm_private *priv =
> -		(struct hibmc_drm_private *)dev->dev_private;
> -
> -	writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(1),
> -	       priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> -
> -	return 0;
> -}
> -
> -static void hibmc_disable_vblank(struct drm_device *dev, unsigned int pipe)
> -{
> -	struct hibmc_drm_private *priv =
> -		(struct hibmc_drm_private *)dev->dev_private;
> -
> -	writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(0),
> -	       priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> -}
> -
>  irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
>  {
>  	struct drm_device *dev = (struct drm_device *)arg;
> @@ -84,8 +64,6 @@ irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
>  	.desc			= "hibmc drm driver",
>  	.major			= 1,
>  	.minor			= 0,
> -	.enable_vblank		= hibmc_enable_vblank,
> -	.disable_vblank		= hibmc_disable_vblank,
>  	.gem_free_object_unlocked = hibmc_gem_free_object,
>  	.dumb_create            = hibmc_dumb_create,
>  	.dumb_map_offset        = hibmc_dumb_mmap_offset,
> -- 
> 1.9.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Xinliang Liu Feb. 16, 2017, 3:28 a.m. | #2
On 7 February 2017 at 17:16, Shawn Guo <shawnguo@kernel.org> wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
>
> The vblank hooks in struct drm_driver are deprecated and only meant for
> legacy drivers.  For modern drivers with DRIVER_MODESET flag, the hooks
> in struct drm_crtc_funcs should be used instead.
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>

Thanks Shawn for the rework patches,
For the hibmc,
Reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>

Thanks,
-xinliang

> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c  | 20 ++++++++++++++++++++
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 22 ----------------------
>  2 files changed, 20 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> index c655883d3613..59542bddc980 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> @@ -423,6 +423,24 @@ static void hibmc_crtc_atomic_flush(struct drm_crtc *crtc,
>         spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
>  }
>
> +static int hibmc_crtc_enable_vblank(struct drm_crtc *crtc)
> +{
> +       struct hibmc_drm_private *priv = crtc->dev->dev_private;
> +
> +       writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(1),
> +              priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> +
> +       return 0;
> +}
> +
> +static void hibmc_crtc_disable_vblank(struct drm_crtc *crtc)
> +{
> +       struct hibmc_drm_private *priv = crtc->dev->dev_private;
> +
> +       writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(0),
> +              priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> +}
> +
>  static const struct drm_crtc_funcs hibmc_crtc_funcs = {
>         .page_flip = drm_atomic_helper_page_flip,
>         .set_config = drm_atomic_helper_set_config,
> @@ -430,6 +448,8 @@ static void hibmc_crtc_atomic_flush(struct drm_crtc *crtc,
>         .reset = drm_atomic_helper_crtc_reset,
>         .atomic_duplicate_state =  drm_atomic_helper_crtc_duplicate_state,
>         .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
> +       .enable_vblank = hibmc_crtc_enable_vblank,
> +       .disable_vblank = hibmc_crtc_disable_vblank,
>  };
>
>  static const struct drm_crtc_helper_funcs hibmc_crtc_helper_funcs = {
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index 8cac70454b57..2ffdbf9801bd 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -37,26 +37,6 @@
>         .llseek         = no_llseek,
>  };
>
> -static int hibmc_enable_vblank(struct drm_device *dev, unsigned int pipe)
> -{
> -       struct hibmc_drm_private *priv =
> -               (struct hibmc_drm_private *)dev->dev_private;
> -
> -       writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(1),
> -              priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> -
> -       return 0;
> -}
> -
> -static void hibmc_disable_vblank(struct drm_device *dev, unsigned int pipe)
> -{
> -       struct hibmc_drm_private *priv =
> -               (struct hibmc_drm_private *)dev->dev_private;
> -
> -       writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(0),
> -              priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> -}
> -
>  irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
>  {
>         struct drm_device *dev = (struct drm_device *)arg;
> @@ -84,8 +64,6 @@ irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
>         .desc                   = "hibmc drm driver",
>         .major                  = 1,
>         .minor                  = 0,
> -       .enable_vblank          = hibmc_enable_vblank,
> -       .disable_vblank         = hibmc_disable_vblank,
>         .gem_free_object_unlocked = hibmc_gem_free_object,
>         .dumb_create            = hibmc_dumb_create,
>         .dumb_map_offset        = hibmc_dumb_mmap_offset,
> --
> 1.9.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
index c655883d3613..59542bddc980 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
@@ -423,6 +423,24 @@  static void hibmc_crtc_atomic_flush(struct drm_crtc *crtc,
 	spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
 }
 
+static int hibmc_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct hibmc_drm_private *priv = crtc->dev->dev_private;
+
+	writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(1),
+	       priv->mmio + HIBMC_RAW_INTERRUPT_EN);
+
+	return 0;
+}
+
+static void hibmc_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct hibmc_drm_private *priv = crtc->dev->dev_private;
+
+	writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(0),
+	       priv->mmio + HIBMC_RAW_INTERRUPT_EN);
+}
+
 static const struct drm_crtc_funcs hibmc_crtc_funcs = {
 	.page_flip = drm_atomic_helper_page_flip,
 	.set_config = drm_atomic_helper_set_config,
@@ -430,6 +448,8 @@  static void hibmc_crtc_atomic_flush(struct drm_crtc *crtc,
 	.reset = drm_atomic_helper_crtc_reset,
 	.atomic_duplicate_state =  drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
+	.enable_vblank = hibmc_crtc_enable_vblank,
+	.disable_vblank = hibmc_crtc_disable_vblank,
 };
 
 static const struct drm_crtc_helper_funcs hibmc_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
index 8cac70454b57..2ffdbf9801bd 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
@@ -37,26 +37,6 @@ 
 	.llseek		= no_llseek,
 };
 
-static int hibmc_enable_vblank(struct drm_device *dev, unsigned int pipe)
-{
-	struct hibmc_drm_private *priv =
-		(struct hibmc_drm_private *)dev->dev_private;
-
-	writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(1),
-	       priv->mmio + HIBMC_RAW_INTERRUPT_EN);
-
-	return 0;
-}
-
-static void hibmc_disable_vblank(struct drm_device *dev, unsigned int pipe)
-{
-	struct hibmc_drm_private *priv =
-		(struct hibmc_drm_private *)dev->dev_private;
-
-	writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(0),
-	       priv->mmio + HIBMC_RAW_INTERRUPT_EN);
-}
-
 irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
 {
 	struct drm_device *dev = (struct drm_device *)arg;
@@ -84,8 +64,6 @@  irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
 	.desc			= "hibmc drm driver",
 	.major			= 1,
 	.minor			= 0,
-	.enable_vblank		= hibmc_enable_vblank,
-	.disable_vblank		= hibmc_disable_vblank,
 	.gem_free_object_unlocked = hibmc_gem_free_object,
 	.dumb_create            = hibmc_dumb_create,
 	.dumb_map_offset        = hibmc_dumb_mmap_offset,