Re: [PATCH] drm: make mode_valid callback optional

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

 



On Wed, Apr 02, 2014 at 10:34:04AM +0200, Andrzej Hajda wrote:
> Many drm connectors do not need mode validation.
> The patch makes this callback optional and removes dumb implementations.
> 
> Signed-off-by: Andrzej Hajda <a.hajda@xxxxxxxxxxx>
> ---
> Hi,
> 
> This patch is based on the latest drm-next.
> I have removed all dumb implementations except for qxl_display.c,
> which is not entirely dumb - it contains log and TODO comments.
> 
> Changes seems to be quite obvious so I have put everything into single patch.

Can you please also update the drm DocBook and add a small comment stating
that this callback is now optional? Looks good to me otherwise.

Thanks, Daniel

> 
> Regards
> Andrzej
> ---
>  drivers/gpu/drm/ast/ast_mode.c             | 7 -------
>  drivers/gpu/drm/bridge/ptn3460.c           | 7 -------
>  drivers/gpu/drm/cirrus/cirrus_mode.c       | 8 --------
>  drivers/gpu/drm/drm_crtc_helper.c          | 2 +-
>  drivers/gpu/drm/exynos/exynos_dp_core.c    | 7 -------
>  drivers/gpu/drm/exynos/exynos_drm_dpi.c    | 7 -------
>  drivers/gpu/drm/exynos/exynos_drm_vidi.c   | 7 -------
>  drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c  | 7 -------
>  drivers/gpu/drm/rcar-du/rcar_du_vgacon.c   | 7 -------
>  drivers/gpu/drm/shmobile/shmob_drm_crtc.c  | 7 -------
>  drivers/staging/imx-drm/imx-hdmi.c         | 8 --------
>  drivers/staging/imx-drm/imx-ldb.c          | 7 -------
>  drivers/staging/imx-drm/parallel-display.c | 7 -------
>  13 files changed, 1 insertion(+), 87 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> index a4afdc8..e599d64 100644
> --- a/drivers/gpu/drm/ast/ast_mode.c
> +++ b/drivers/gpu/drm/ast/ast_mode.c
> @@ -743,12 +743,6 @@ static int ast_get_modes(struct drm_connector *connector)
>  	return 0;
>  }
>  
> -static int ast_mode_valid(struct drm_connector *connector,
> -			  struct drm_display_mode *mode)
> -{
> -	return MODE_OK;
> -}
> -
>  static void ast_connector_destroy(struct drm_connector *connector)
>  {
>  	struct ast_connector *ast_connector = to_ast_connector(connector);
> @@ -765,7 +759,6 @@ ast_connector_detect(struct drm_connector *connector, bool force)
>  }
>  
>  static const struct drm_connector_helper_funcs ast_connector_helper_funcs = {
> -	.mode_valid = ast_mode_valid,
>  	.get_modes = ast_get_modes,
>  	.best_encoder = ast_best_single_encoder,
>  };
> diff --git a/drivers/gpu/drm/bridge/ptn3460.c b/drivers/gpu/drm/bridge/ptn3460.c
> index a9e5c1a..3ff2813 100644
> --- a/drivers/gpu/drm/bridge/ptn3460.c
> +++ b/drivers/gpu/drm/bridge/ptn3460.c
> @@ -225,12 +225,6 @@ out:
>  	return num_modes;
>  }
>  
> -static int ptn3460_mode_valid(struct drm_connector *connector,
> -		struct drm_display_mode *mode)
> -{
> -	return MODE_OK;
> -}
> -
>  struct drm_encoder *ptn3460_best_encoder(struct drm_connector *connector)
>  {
>  	struct ptn3460_bridge *ptn_bridge;
> @@ -242,7 +236,6 @@ struct drm_encoder *ptn3460_best_encoder(struct drm_connector *connector)
>  
>  struct drm_connector_helper_funcs ptn3460_connector_helper_funcs = {
>  	.get_modes = ptn3460_get_modes,
> -	.mode_valid = ptn3460_mode_valid,
>  	.best_encoder = ptn3460_best_encoder,
>  };
>  
> diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c
> index 2d64aea..057c7d1 100644
> --- a/drivers/gpu/drm/cirrus/cirrus_mode.c
> +++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
> @@ -502,13 +502,6 @@ static int cirrus_vga_get_modes(struct drm_connector *connector)
>  	return count;
>  }
>  
> -static int cirrus_vga_mode_valid(struct drm_connector *connector,
> -				 struct drm_display_mode *mode)
> -{
> -	/* Any mode we've added is valid */
> -	return MODE_OK;
> -}
> -
>  static struct drm_encoder *cirrus_connector_best_encoder(struct drm_connector
>  						  *connector)
>  {
> @@ -543,7 +536,6 @@ static void cirrus_connector_destroy(struct drm_connector *connector)
>  
>  struct drm_connector_helper_funcs cirrus_vga_connector_helper_funcs = {
>  	.get_modes = cirrus_vga_get_modes,
> -	.mode_valid = cirrus_vga_mode_valid,
>  	.best_encoder = cirrus_connector_best_encoder,
>  };
>  
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
> index 1fbe842..3ca0aed 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -186,7 +186,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
>  	drm_mode_validate_flag(connector, mode_flags);
>  
>  	list_for_each_entry(mode, &connector->modes, head) {
> -		if (mode->status == MODE_OK)
> +		if (mode->status == MODE_OK && connector_funcs->mode_valid)
>  			mode->status = connector_funcs->mode_valid(connector,
>  								   mode);
>  	}
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
> index a59bca9..a135025 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
> @@ -949,12 +949,6 @@ static int exynos_dp_get_modes(struct drm_connector *connector)
>  	return 1;
>  }
>  
> -static int exynos_dp_mode_valid(struct drm_connector *connector,
> -			struct drm_display_mode *mode)
> -{
> -	return MODE_OK;
> -}
> -
>  static struct drm_encoder *exynos_dp_best_encoder(
>  			struct drm_connector *connector)
>  {
> @@ -965,7 +959,6 @@ static struct drm_encoder *exynos_dp_best_encoder(
>  
>  static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = {
>  	.get_modes = exynos_dp_get_modes,
> -	.mode_valid = exynos_dp_mode_valid,
>  	.best_encoder = exynos_dp_best_encoder,
>  };
>  
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
> index 2b09c7c..82e52c7 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
> @@ -94,12 +94,6 @@ static int exynos_dpi_get_modes(struct drm_connector *connector)
>  	return 0;
>  }
>  
> -static int exynos_dpi_mode_valid(struct drm_connector *connector,
> -				 struct drm_display_mode *mode)
> -{
> -	return MODE_OK;
> -}
> -
>  static struct drm_encoder *
>  exynos_dpi_best_encoder(struct drm_connector *connector)
>  {
> @@ -110,7 +104,6 @@ exynos_dpi_best_encoder(struct drm_connector *connector)
>  
>  static struct drm_connector_helper_funcs exynos_dpi_connector_helper_funcs = {
>  	.get_modes = exynos_dpi_get_modes,
> -	.mode_valid = exynos_dpi_mode_valid,
>  	.best_encoder = exynos_dpi_best_encoder,
>  };
>  
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
> index 7afead9..b698086 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
> @@ -533,12 +533,6 @@ static int vidi_get_modes(struct drm_connector *connector)
>  	return drm_add_edid_modes(connector, edid);
>  }
>  
> -static int vidi_mode_valid(struct drm_connector *connector,
> -			struct drm_display_mode *mode)
> -{
> -	return MODE_OK;
> -}
> -
>  static struct drm_encoder *vidi_best_encoder(struct drm_connector *connector)
>  {
>  	struct vidi_context *ctx = ctx_from_connector(connector);
> @@ -548,7 +542,6 @@ static struct drm_encoder *vidi_best_encoder(struct drm_connector *connector)
>  
>  static struct drm_connector_helper_funcs vidi_connector_helper_funcs = {
>  	.get_modes = vidi_get_modes,
> -	.mode_valid = vidi_mode_valid,
>  	.best_encoder = vidi_best_encoder,
>  };
>  
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c
> index 4f3ba93..289048d 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c
> @@ -57,15 +57,8 @@ static int rcar_du_lvds_connector_get_modes(struct drm_connector *connector)
>  	return 1;
>  }
>  
> -static int rcar_du_lvds_connector_mode_valid(struct drm_connector *connector,
> -					    struct drm_display_mode *mode)
> -{
> -	return MODE_OK;
> -}
> -
>  static const struct drm_connector_helper_funcs connector_helper_funcs = {
>  	.get_modes = rcar_du_lvds_connector_get_modes,
> -	.mode_valid = rcar_du_lvds_connector_mode_valid,
>  	.best_encoder = rcar_du_connector_best_encoder,
>  };
>  
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c b/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c
> index 41d563a..ccfe64c 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c
> @@ -25,15 +25,8 @@ static int rcar_du_vga_connector_get_modes(struct drm_connector *connector)
>  	return 0;
>  }
>  
> -static int rcar_du_vga_connector_mode_valid(struct drm_connector *connector,
> -					    struct drm_display_mode *mode)
> -{
> -	return MODE_OK;
> -}
> -
>  static const struct drm_connector_helper_funcs connector_helper_funcs = {
>  	.get_modes = rcar_du_vga_connector_get_modes,
> -	.mode_valid = rcar_du_vga_connector_mode_valid,
>  	.best_encoder = rcar_du_connector_best_encoder,
>  };
>  
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> index e9e5e6d..faf176b 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> @@ -674,12 +674,6 @@ static int shmob_drm_connector_get_modes(struct drm_connector *connector)
>  	return 1;
>  }
>  
> -static int shmob_drm_connector_mode_valid(struct drm_connector *connector,
> -					  struct drm_display_mode *mode)
> -{
> -	return MODE_OK;
> -}
> -
>  static struct drm_encoder *
>  shmob_drm_connector_best_encoder(struct drm_connector *connector)
>  {
> @@ -690,7 +684,6 @@ shmob_drm_connector_best_encoder(struct drm_connector *connector)
>  
>  static const struct drm_connector_helper_funcs connector_helper_funcs = {
>  	.get_modes = shmob_drm_connector_get_modes,
> -	.mode_valid = shmob_drm_connector_mode_valid,
>  	.best_encoder = shmob_drm_connector_best_encoder,
>  };
>  
> diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c
> index f996e08..11ba1ea 100644
> --- a/drivers/staging/imx-drm/imx-hdmi.c
> +++ b/drivers/staging/imx-drm/imx-hdmi.c
> @@ -1560,13 +1560,6 @@ static int imx_hdmi_connector_get_modes(struct drm_connector *connector)
>  	return 0;
>  }
>  
> -static int imx_hdmi_connector_mode_valid(struct drm_connector *connector,
> -			  struct drm_display_mode *mode)
> -{
> -
> -	return MODE_OK;
> -}
> -
>  static struct drm_encoder *imx_hdmi_connector_best_encoder(struct drm_connector
>  							   *connector)
>  {
> @@ -1656,7 +1649,6 @@ static struct drm_connector_funcs imx_hdmi_connector_funcs = {
>  
>  static struct drm_connector_helper_funcs imx_hdmi_connector_helper_funcs = {
>  	.get_modes = imx_hdmi_connector_get_modes,
> -	.mode_valid = imx_hdmi_connector_mode_valid,
>  	.best_encoder = imx_hdmi_connector_best_encoder,
>  };
>  
> diff --git a/drivers/staging/imx-drm/imx-ldb.c b/drivers/staging/imx-drm/imx-ldb.c
> index c703e98..1ce0927 100644
> --- a/drivers/staging/imx-drm/imx-ldb.c
> +++ b/drivers/staging/imx-drm/imx-ldb.c
> @@ -120,12 +120,6 @@ static int imx_ldb_connector_get_modes(struct drm_connector *connector)
>  	return num_modes;
>  }
>  
> -static int imx_ldb_connector_mode_valid(struct drm_connector *connector,
> -			  struct drm_display_mode *mode)
> -{
> -	return 0;
> -}
> -
>  static struct drm_encoder *imx_ldb_connector_best_encoder(
>  		struct drm_connector *connector)
>  {
> @@ -331,7 +325,6 @@ static struct drm_connector_funcs imx_ldb_connector_funcs = {
>  static struct drm_connector_helper_funcs imx_ldb_connector_helper_funcs = {
>  	.get_modes = imx_ldb_connector_get_modes,
>  	.best_encoder = imx_ldb_connector_best_encoder,
> -	.mode_valid = imx_ldb_connector_mode_valid,
>  };
>  
>  static struct drm_encoder_funcs imx_ldb_encoder_funcs = {
> diff --git a/drivers/staging/imx-drm/parallel-display.c b/drivers/staging/imx-drm/parallel-display.c
> index 823d015..7b9da66 100644
> --- a/drivers/staging/imx-drm/parallel-display.c
> +++ b/drivers/staging/imx-drm/parallel-display.c
> @@ -85,12 +85,6 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
>  	return num_modes;
>  }
>  
> -static int imx_pd_connector_mode_valid(struct drm_connector *connector,
> -			  struct drm_display_mode *mode)
> -{
> -	return 0;
> -}
> -
>  static struct drm_encoder *imx_pd_connector_best_encoder(
>  		struct drm_connector *connector)
>  {
> @@ -147,7 +141,6 @@ static struct drm_connector_funcs imx_pd_connector_funcs = {
>  static struct drm_connector_helper_funcs imx_pd_connector_helper_funcs = {
>  	.get_modes = imx_pd_connector_get_modes,
>  	.best_encoder = imx_pd_connector_best_encoder,
> -	.mode_valid = imx_pd_connector_mode_valid,
>  };
>  
>  static struct drm_encoder_funcs imx_pd_encoder_funcs = {
> -- 
> 1.8.3.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://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