As an encoder will be a directory in ConfigFS, add the configuration for encoder 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 | 6 ++++++ drivers/gpu/drm/vkms/vkms_config.h | 2 ++ drivers/gpu/drm/vkms/vkms_drv.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vkms/vkms_config.c b/drivers/gpu/drm/vkms/vkms_config.c index fcd4a128c21b..7ef525091967 100644 --- a/drivers/gpu/drm/vkms/vkms_config.c +++ b/drivers/gpu/drm/vkms/vkms_config.c @@ -39,6 +39,10 @@ struct vkms_config *vkms_config_alloc_default(bool enable_writeback, bool enable encoder = vkms_config_create_encoder(vkms_config); if (!encoder) goto err_alloc; + encoder->name = kzalloc(sizeof("Main Encoder"), GFP_KERNEL); + if (!encoder->name) + goto err_alloc; + sprintf(encoder->name, "Main Encoder"); if (vkms_config_encoder_attach_crtc(encoder, crtc)) goto err_alloc; @@ -232,6 +236,7 @@ void vkms_config_delete_encoder(struct vkms_config_encoder *vkms_config_encoder, } } + kfree(vkms_config_encoder->name); kfree(vkms_config_encoder); } @@ -394,6 +399,7 @@ static int vkms_config_show(struct seq_file *m, void *data) list_for_each_entry(config_encoder, &vkmsdev->config->encoders, link) { seq_puts(m, "encoder:\n"); + seq_printf(m, "\tname: %s\n", config_encoder->name); } list_for_each_entry(config_crtc, &vkmsdev->config->crtcs, link) { diff --git a/drivers/gpu/drm/vkms/vkms_config.h b/drivers/gpu/drm/vkms/vkms_config.h index 8f247fc09373..4223edd94ec2 100644 --- a/drivers/gpu/drm/vkms/vkms_config.h +++ b/drivers/gpu/drm/vkms/vkms_config.h @@ -50,6 +50,7 @@ struct vkms_config_crtc { * struct vkms_config_encoder * * @link: Link to the others encoders + * @name: Name of the encoder * @possible_crtcs: List of CRTC that can be used with this encoder * @encoder: Internal usage. This pointer should never be considered as valid. It can be used to * store a temporary reference to a vkms encoder during device creation. This pointer is @@ -58,6 +59,7 @@ struct vkms_config_crtc { struct vkms_config_encoder { struct list_head link; + char *name; struct xarray possible_crtcs; /* Internal usage */ diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c index 6deff5099322..cd3920270905 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.c +++ b/drivers/gpu/drm/vkms/vkms_drv.c @@ -216,7 +216,7 @@ static int vkms_output_init(struct vkms_device *vkmsdev) if (!config_encoder->encoder) return -ENOMEM; ret = drmm_encoder_init(dev, config_encoder->encoder, &vkms_encoder_funcs, - DRM_MODE_ENCODER_VIRTUAL, NULL); + DRM_MODE_ENCODER_VIRTUAL, config_encoder->name); if (ret) { DRM_ERROR("Failed to init encoder\n"); return ret; -- 2.44.2