Re: [PATCH 07/11] drm/vmwgfx: Add and connect connector helper function

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

 



On Mon, Mar 27, 2017 at 03:01:00PM -0700, Sinclair Yeh wrote:
> Since the link between connector and encoder is always fixed in our case,
> just return the one encoder.
> 
> These helpers won't be called until we flip on the atomic support
> flag or set drm_crtc_funcs->set_config to using the atomic
> helper.
> 
> Signed-off-by: Sinclair Yeh <syeh@xxxxxxxxxx>
> Reviewed-by: Thomas Hellstrom <thellstrom@xxxxxxxxxx>
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c  | 18 ++++++++++++++++++
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.h  |  2 ++
>  drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c  |  7 +++++++
>  drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c |  9 +++++++++
>  drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c |  8 ++++++++
>  5 files changed, 44 insertions(+)
> 
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> index d00ff21..2250a34a 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> @@ -2223,6 +2223,24 @@ vmw_du_connector_atomic_get_property(struct drm_connector *connector,
>  }
>  
>  
> +/**
> + * vmw_du_connector_best_encoder - there's only one
> + *
> + * @connector - connector the property is associated with
> + *
> + * In our case, there is only one encoder per connector
> + */
> +struct drm_encoder *
> +vmw_du_connector_best_encoder(struct drm_connector *connector)
> +{
> +	struct vmw_display_unit *du;
> +
> +	du = vmw_connector_to_du(connector);
> +
> +	return &du->encoder;
> +}

Please just use drm_atomic_helper_best_encoder.
-Daniel

> +
> +
>  int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
>  				struct drm_file *file_priv)
>  {
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
> index de6a0b6..3251562 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
> @@ -267,6 +267,8 @@ vmw_du_connector_atomic_get_property(struct drm_connector *connector,
>  				     const struct drm_connector_state *state,
>  				     struct drm_property *property,
>  				     uint64_t *val);
> +struct drm_encoder *
> +vmw_du_connector_best_encoder(struct drm_connector *connector);
>  int vmw_du_connector_dpms(struct drm_connector *connector, int mode);
>  void vmw_du_connector_save(struct drm_connector *connector);
>  void vmw_du_connector_restore(struct drm_connector *connector);
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
> index 1d734de..282a0ef 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
> @@ -389,6 +389,11 @@ static const struct drm_connector_funcs vmw_legacy_connector_funcs = {
>  	.atomic_get_property = vmw_du_connector_atomic_get_property,
>  };
>  
> +static const struct
> +drm_connector_helper_funcs vmw_ldu_connector_helper_funcs = {
> +	.best_encoder = vmw_du_connector_best_encoder,
> +};
> +
>  /*
>   * Legacy Display Plane Functions
>   */
> @@ -555,6 +560,8 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)
>  		DRM_ERROR("Failed to initialize connector\n");
>  		goto err_free;
>  	}
> +
> +	drm_connector_helper_add(connector, &vmw_ldu_connector_helper_funcs);
>  	connector->status = vmw_du_connector_detect(connector, true);
>  	vmw_connector_state_to_vcs(connector->state)->is_implicit = true;
>  
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
> index eca055e..e4154f1 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
> @@ -608,6 +608,14 @@ static const struct drm_connector_funcs vmw_sou_connector_funcs = {
>  	.atomic_get_property = vmw_du_connector_atomic_get_property,
>  };
>  
> +
> +static const struct
> +drm_connector_helper_funcs vmw_sou_connector_helper_funcs = {
> +	.best_encoder = vmw_du_connector_best_encoder,
> +};
> +
> +
> +
>  /*
>   * Screen Object Display Plane Functions
>   */
> @@ -827,6 +835,7 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit)
>  		goto err_free;
>  	}
>  
> +	drm_connector_helper_add(connector, &vmw_sou_connector_helper_funcs);
>  	connector->status = vmw_du_connector_detect(connector, true);
>  	vmw_connector_state_to_vcs(connector->state)->is_implicit = false;
>  
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
> index cce5e5b..708d063 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
> @@ -1189,6 +1189,12 @@ static const struct drm_connector_funcs vmw_stdu_connector_funcs = {
>  };
>  
>  
> +static const struct
> +drm_connector_helper_funcs vmw_stdu_connector_helper_funcs = {
> +	.best_encoder = vmw_du_connector_best_encoder,
> +};
> +
> +
>  
>  /******************************************************************************
>   * Screen Target Display Plane Functions
> @@ -1549,6 +1555,8 @@ static int vmw_stdu_init(struct vmw_private *dev_priv, unsigned unit)
>  		DRM_ERROR("Failed to initialize connector\n");
>  		goto err_free;
>  	}
> +
> +	drm_connector_helper_add(connector, &vmw_stdu_connector_helper_funcs);
>  	connector->status = vmw_du_connector_detect(connector, false);
>  	vmw_connector_state_to_vcs(connector->state)->is_implicit = false;
>  
> -- 
> 2.7.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
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