diff mbox

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

Message ID 1486458995-31018-24-git-send-email-shawnguo@kernel.org (mailing list archive)
State New, archived
Headers show

Commit Message

Shawn Guo Feb. 7, 2017, 9:16 a.m. UTC
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.

The functions are moved around to save forward declaration.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 drivers/gpu/drm/zte/zx_drm_drv.c |  2 --
 drivers/gpu/drm/zte/zx_vou.c     | 61 +++++++++++++++-------------------------
 drivers/gpu/drm/zte/zx_vou.h     |  3 --
 3 files changed, 23 insertions(+), 43 deletions(-)

Comments

Sean Paul Feb. 7, 2017, 3:34 p.m. UTC | #1
On Tue, Feb 07, 2017 at 05:16:35PM +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.
> 
> The functions are moved around to save forward declaration.
> 

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

> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
>  drivers/gpu/drm/zte/zx_drm_drv.c |  2 --
>  drivers/gpu/drm/zte/zx_vou.c     | 61 +++++++++++++++-------------------------
>  drivers/gpu/drm/zte/zx_vou.h     |  3 --
>  3 files changed, 23 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c
> index afd713a954c6..b24a70ba4b83 100644
> --- a/drivers/gpu/drm/zte/zx_drm_drv.c
> +++ b/drivers/gpu/drm/zte/zx_drm_drv.c
> @@ -71,8 +71,6 @@ static void zx_drm_lastclose(struct drm_device *drm)
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME |
>  			   DRIVER_ATOMIC,
>  	.lastclose = zx_drm_lastclose,
> -	.enable_vblank = zx_vou_enable_vblank,
> -	.disable_vblank = zx_vou_disable_vblank,
>  	.gem_free_object = drm_gem_cma_free_object,
>  	.gem_vm_ops = &drm_gem_cma_vm_ops,
>  	.dumb_create = drm_gem_cma_dumb_create,
> diff --git a/drivers/gpu/drm/zte/zx_vou.c b/drivers/gpu/drm/zte/zx_vou.c
> index cf92d675feaa..b500c8dd0d9d 100644
> --- a/drivers/gpu/drm/zte/zx_vou.c
> +++ b/drivers/gpu/drm/zte/zx_vou.c
> @@ -470,6 +470,27 @@ static void zx_crtc_atomic_flush(struct drm_crtc *crtc,
>  	.atomic_flush = zx_crtc_atomic_flush,
>  };
>  
> +static int zx_vou_enable_vblank(struct drm_crtc *crtc)
> +{
> +	struct zx_crtc *zcrtc = to_zx_crtc(crtc);
> +	struct zx_vou_hw *vou = crtc_to_vou(crtc);
> +	u32 int_frame_mask = zcrtc->bits->int_frame_mask;
> +
> +	zx_writel_mask(vou->timing + TIMING_INT_CTRL, int_frame_mask,
> +		       int_frame_mask);
> +
> +	return 0;
> +}
> +
> +static void zx_vou_disable_vblank(struct drm_crtc *crtc)
> +{
> +	struct zx_crtc *zcrtc = to_zx_crtc(crtc);
> +	struct zx_vou_hw *vou = crtc_to_vou(crtc);
> +
> +	zx_writel_mask(vou->timing + TIMING_INT_CTRL,
> +		       zcrtc->bits->int_frame_mask, 0);
> +}
> +
>  static const struct drm_crtc_funcs zx_crtc_funcs = {
>  	.destroy = drm_crtc_cleanup,
>  	.set_config = drm_atomic_helper_set_config,
> @@ -477,6 +498,8 @@ static void zx_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 = zx_vou_enable_vblank,
> +	.disable_vblank = zx_vou_disable_vblank,
>  };
>  
>  static int zx_crtc_init(struct drm_device *drm, struct zx_vou_hw *vou,
> @@ -553,44 +576,6 @@ static int zx_crtc_init(struct drm_device *drm, struct zx_vou_hw *vou,
>  	return 0;
>  }
>  
> -int zx_vou_enable_vblank(struct drm_device *drm, unsigned int pipe)
> -{
> -	struct drm_crtc *crtc;
> -	struct zx_crtc *zcrtc;
> -	struct zx_vou_hw *vou;
> -	u32 int_frame_mask;
> -
> -	crtc = drm_crtc_from_index(drm, pipe);
> -	if (!crtc)
> -		return 0;
> -
> -	vou = crtc_to_vou(crtc);
> -	zcrtc = to_zx_crtc(crtc);
> -	int_frame_mask = zcrtc->bits->int_frame_mask;
> -
> -	zx_writel_mask(vou->timing + TIMING_INT_CTRL, int_frame_mask,
> -		       int_frame_mask);
> -
> -	return 0;
> -}
> -
> -void zx_vou_disable_vblank(struct drm_device *drm, unsigned int pipe)
> -{
> -	struct drm_crtc *crtc;
> -	struct zx_crtc *zcrtc;
> -	struct zx_vou_hw *vou;
> -
> -	crtc = drm_crtc_from_index(drm, pipe);
> -	if (!crtc)
> -		return;
> -
> -	vou = crtc_to_vou(crtc);
> -	zcrtc = to_zx_crtc(crtc);
> -
> -	zx_writel_mask(vou->timing + TIMING_INT_CTRL,
> -		       zcrtc->bits->int_frame_mask, 0);
> -}
> -
>  void zx_vou_layer_enable(struct drm_plane *plane)
>  {
>  	struct zx_crtc *zcrtc = to_zx_crtc(plane->state->crtc);
> diff --git a/drivers/gpu/drm/zte/zx_vou.h b/drivers/gpu/drm/zte/zx_vou.h
> index 57e3c31ee6a5..97d72bfce982 100644
> --- a/drivers/gpu/drm/zte/zx_vou.h
> +++ b/drivers/gpu/drm/zte/zx_vou.h
> @@ -61,9 +61,6 @@ struct vou_div_config {
>  void zx_vou_config_dividers(struct drm_crtc *crtc,
>  			    struct vou_div_config *configs, int num);
>  
> -int zx_vou_enable_vblank(struct drm_device *drm, unsigned int pipe);
> -void zx_vou_disable_vblank(struct drm_device *drm, unsigned int pipe);
> -
>  void zx_vou_layer_enable(struct drm_plane *plane);
>  void zx_vou_layer_disable(struct drm_plane *plane);
>  
> -- 
> 1.9.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c
index afd713a954c6..b24a70ba4b83 100644
--- a/drivers/gpu/drm/zte/zx_drm_drv.c
+++ b/drivers/gpu/drm/zte/zx_drm_drv.c
@@ -71,8 +71,6 @@  static void zx_drm_lastclose(struct drm_device *drm)
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME |
 			   DRIVER_ATOMIC,
 	.lastclose = zx_drm_lastclose,
-	.enable_vblank = zx_vou_enable_vblank,
-	.disable_vblank = zx_vou_disable_vblank,
 	.gem_free_object = drm_gem_cma_free_object,
 	.gem_vm_ops = &drm_gem_cma_vm_ops,
 	.dumb_create = drm_gem_cma_dumb_create,
diff --git a/drivers/gpu/drm/zte/zx_vou.c b/drivers/gpu/drm/zte/zx_vou.c
index cf92d675feaa..b500c8dd0d9d 100644
--- a/drivers/gpu/drm/zte/zx_vou.c
+++ b/drivers/gpu/drm/zte/zx_vou.c
@@ -470,6 +470,27 @@  static void zx_crtc_atomic_flush(struct drm_crtc *crtc,
 	.atomic_flush = zx_crtc_atomic_flush,
 };
 
+static int zx_vou_enable_vblank(struct drm_crtc *crtc)
+{
+	struct zx_crtc *zcrtc = to_zx_crtc(crtc);
+	struct zx_vou_hw *vou = crtc_to_vou(crtc);
+	u32 int_frame_mask = zcrtc->bits->int_frame_mask;
+
+	zx_writel_mask(vou->timing + TIMING_INT_CTRL, int_frame_mask,
+		       int_frame_mask);
+
+	return 0;
+}
+
+static void zx_vou_disable_vblank(struct drm_crtc *crtc)
+{
+	struct zx_crtc *zcrtc = to_zx_crtc(crtc);
+	struct zx_vou_hw *vou = crtc_to_vou(crtc);
+
+	zx_writel_mask(vou->timing + TIMING_INT_CTRL,
+		       zcrtc->bits->int_frame_mask, 0);
+}
+
 static const struct drm_crtc_funcs zx_crtc_funcs = {
 	.destroy = drm_crtc_cleanup,
 	.set_config = drm_atomic_helper_set_config,
@@ -477,6 +498,8 @@  static void zx_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 = zx_vou_enable_vblank,
+	.disable_vblank = zx_vou_disable_vblank,
 };
 
 static int zx_crtc_init(struct drm_device *drm, struct zx_vou_hw *vou,
@@ -553,44 +576,6 @@  static int zx_crtc_init(struct drm_device *drm, struct zx_vou_hw *vou,
 	return 0;
 }
 
-int zx_vou_enable_vblank(struct drm_device *drm, unsigned int pipe)
-{
-	struct drm_crtc *crtc;
-	struct zx_crtc *zcrtc;
-	struct zx_vou_hw *vou;
-	u32 int_frame_mask;
-
-	crtc = drm_crtc_from_index(drm, pipe);
-	if (!crtc)
-		return 0;
-
-	vou = crtc_to_vou(crtc);
-	zcrtc = to_zx_crtc(crtc);
-	int_frame_mask = zcrtc->bits->int_frame_mask;
-
-	zx_writel_mask(vou->timing + TIMING_INT_CTRL, int_frame_mask,
-		       int_frame_mask);
-
-	return 0;
-}
-
-void zx_vou_disable_vblank(struct drm_device *drm, unsigned int pipe)
-{
-	struct drm_crtc *crtc;
-	struct zx_crtc *zcrtc;
-	struct zx_vou_hw *vou;
-
-	crtc = drm_crtc_from_index(drm, pipe);
-	if (!crtc)
-		return;
-
-	vou = crtc_to_vou(crtc);
-	zcrtc = to_zx_crtc(crtc);
-
-	zx_writel_mask(vou->timing + TIMING_INT_CTRL,
-		       zcrtc->bits->int_frame_mask, 0);
-}
-
 void zx_vou_layer_enable(struct drm_plane *plane)
 {
 	struct zx_crtc *zcrtc = to_zx_crtc(plane->state->crtc);
diff --git a/drivers/gpu/drm/zte/zx_vou.h b/drivers/gpu/drm/zte/zx_vou.h
index 57e3c31ee6a5..97d72bfce982 100644
--- a/drivers/gpu/drm/zte/zx_vou.h
+++ b/drivers/gpu/drm/zte/zx_vou.h
@@ -61,9 +61,6 @@  struct vou_div_config {
 void zx_vou_config_dividers(struct drm_crtc *crtc,
 			    struct vou_div_config *configs, int num);
 
-int zx_vou_enable_vblank(struct drm_device *drm, unsigned int pipe);
-void zx_vou_disable_vblank(struct drm_device *drm, unsigned int pipe);
-
 void zx_vou_layer_enable(struct drm_plane *plane);
 void zx_vou_layer_disable(struct drm_plane *plane);