Re: [PATCH 2/3] drm/vkms: Add encoder initialization

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

 



On Wed, May 16, 2018 at 12:07:12AM -0300, Rodrigo Siqueira wrote:
> This commit adds a single and simple virtual encoder to VKMS.
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@xxxxxxxxx>

Doesn't this break bisection, i.e. between patch 1&2 vkms looks broken
(because the encoder is missing)?

If so probably better to merge this into patch 1.
-Daniel

> ---
>  drivers/gpu/drm/vkms/vkms_display.c | 25 +++++++++++++++++++++++++
>  drivers/gpu/drm/vkms/vkms_drv.h     |  2 ++
>  2 files changed, 27 insertions(+)
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_display.c b/drivers/gpu/drm/vkms/vkms_display.c
> index b20b41f9590b..d6702128b5f7 100644
> --- a/drivers/gpu/drm/vkms/vkms_display.c
> +++ b/drivers/gpu/drm/vkms/vkms_display.c
> @@ -44,11 +44,16 @@ static const struct drm_connector_funcs vkms_connector_funcs = {
>  	.destroy = vkms_connector_destroy,
>  };
>  
> +static const struct drm_encoder_funcs vkms_encoder_funcs = {
> +	.destroy = drm_encoder_cleanup,
> +};
> +
>  static int vkms_output_init(struct vkms_device *vkmsdev)
>  {
>  	struct vkms_output *output = &vkmsdev->output;
>  	struct drm_device *dev = &vkmsdev->drm;
>  	struct drm_connector *connector = &output->connector;
> +	struct drm_encoder *encoder = &output->encoder;
>  	struct drm_crtc *crtc = &output->crtc;
>  	struct drm_plane *primary;
>  	int ret;
> @@ -78,10 +83,30 @@ static int vkms_output_init(struct vkms_device *vkmsdev)
>  		goto err_connector_register;
>  	}
>  
> +	ret = drm_encoder_init(dev, encoder, &vkms_encoder_funcs,
> +			       DRM_MODE_ENCODER_VIRTUAL, NULL);
> +	if (ret) {
> +		DRM_ERROR("Failed to init encoder\n");
> +		goto err_encoder;
> +	}
> +	encoder->possible_crtcs = 1;
> +
> +	ret = drm_mode_connector_attach_encoder(connector, encoder);
> +	if (ret) {
> +		DRM_ERROR("Failed to attach connector to encoder\n");
> +		goto err_attach;
> +	}
> +
>  	drm_mode_config_reset(dev);
>  
>  	return 0;
>  
> +err_attach:
> +	drm_encoder_cleanup(encoder);
> +
> +err_encoder:
> +	drm_connector_unregister(connector);
> +
>  err_connector_register:
>  	drm_connector_cleanup(connector);
>  
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> index 292bdea9c785..933eedc5b25b 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.h
> +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> @@ -3,6 +3,7 @@
>  
>  #include <drm/drmP.h>
>  #include <drm/drm.h>
> +#include <drm/drm_encoder.h>
>  
>  static const u32 vkms_formats[] = {
>  	DRM_FORMAT_XRGB8888,
> @@ -17,6 +18,7 @@ static const u32 vkms_formats[] = {
>  
>  struct vkms_output {
>  	struct drm_crtc crtc;
> +	struct drm_encoder encoder;
>  	struct drm_connector connector;
>  };
>  
> -- 
> 2.17.0
> 

-- 
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