Re: [PATCH RFC v2 11/18] drm/vkms: Introduce config for CRTC name

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

 



On Fri, 22 Nov 2024, Louis Chauvet <louis.chauvet@xxxxxxxxxxx> wrote:
> As a CRTC will be a directory in ConfigFS, add the name configuration for
> CRTC name so we will be able to reflect the configfs directory name in the
> drm name.
>
> Signed-off-by: Louis Chauvet <louis.chauvet@xxxxxxxxxxx>
> ---
>  drivers/gpu/drm/vkms/vkms_config.c | 5 +++++
>  drivers/gpu/drm/vkms/vkms_config.h | 2 ++
>  drivers/gpu/drm/vkms/vkms_crtc.c   | 2 +-
>  3 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_config.c b/drivers/gpu/drm/vkms/vkms_config.c
> index a2539fb56b602569b75748fdf9c4784f104b0bff..3252f657ce515c0193a8c0e709bfe861feba0aca 100644
> --- a/drivers/gpu/drm/vkms/vkms_config.c
> +++ b/drivers/gpu/drm/vkms/vkms_config.c
> @@ -37,6 +37,10 @@ struct vkms_config *vkms_config_alloc_default(bool enable_writeback, bool enable
>  	if (!crtc)
>  		goto err_alloc;
>  	crtc->writeback = enable_writeback;
> +	crtc->name = kzalloc(sizeof("Main CRTC"), GFP_KERNEL);
> +	if (!crtc->name)
> +		goto err_alloc;
> +	sprintf(crtc->name, "Main CRTC");

Ditto, kstrdup()

>  
>  	encoder = vkms_config_create_encoder(vkms_config);
>  	if (!encoder)
> @@ -219,6 +223,7 @@ void vkms_config_delete_crtc(struct vkms_config_crtc *vkms_config_crtc,
>  		}
>  	}
>  
> +	kfree(vkms_config_crtc->name);
>  	kfree(vkms_config_crtc);
>  }
>  
> diff --git a/drivers/gpu/drm/vkms/vkms_config.h b/drivers/gpu/drm/vkms/vkms_config.h
> index 4223edd94ec270915dd658c0b5efd489554d33a5..4a4c16dea7855cf36060986ef247be698974fafc 100644
> --- a/drivers/gpu/drm/vkms/vkms_config.h
> +++ b/drivers/gpu/drm/vkms/vkms_config.h
> @@ -29,6 +29,7 @@ struct vkms_config {
>   * struct vkms_config_crtc
>   *
>   * @link: Link to the others CRTCs
> + * @name: Name of the CRTC
>   * @possible_planes: List of planes that can be used with this CRTC
>   * @possible_encoders: List of encoders that can be used with this CRTC
>   * @crtc: Internal usage. This pointer should never be considered as valid. It can be used to
> @@ -38,6 +39,7 @@ struct vkms_config {
>  struct vkms_config_crtc {
>  	struct list_head link;
>  
> +	char *name;
>  	bool writeback;
>  	struct xarray possible_planes;
>  	struct xarray possible_encoders;
> diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
> index 3825fba57c012f84cbe67114e053dcd7fcfa283d..25a3d97a362afd0d40f3e023d9cce985d447a880 100644
> --- a/drivers/gpu/drm/vkms/vkms_crtc.c
> +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
> @@ -292,7 +292,7 @@ struct vkms_crtc *vkms_crtc_init(struct vkms_device *vkms_device,
>  
>  	vkms_crtc = drmm_crtc_alloc_with_planes(dev, struct vkms_crtc, base,
>  						primary, cursor,
> -						&vkms_crtc_funcs, NULL);
> +						&vkms_crtc_funcs, config->name);
>  	if (IS_ERR(vkms_crtc)) {
>  		DRM_DEV_ERROR(dev->dev, "Failed to init CRTC\n");
>  		return vkms_crtc;

-- 
Jani Nikula, Intel



[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