[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240905123413.3127-1-jose.exposito89@gmail.com>
Date: Thu, 5 Sep 2024 14:34:13 +0200
From: José Expósito <jose.exposito89@...il.com>
To: louis.chauvet@...tlin.com
Cc: airlied@...il.com,
arthurgrillo@...eup.net,
daniel@...ll.ch,
dri-devel@...ts.freedesktop.org,
hamohammed.sa@...il.com,
jeremie.dautheribes@...tlin.com,
linux-kernel@...r.kernel.org,
maarten.lankhorst@...ux.intel.com,
mairacanal@...eup.net,
melissa.srw@...il.com,
miquel.raynal@...tlin.com,
mripard@...nel.org,
nicolejadeyee@...gle.com,
rodrigosiqueiramelo@...il.com,
seanpaul@...gle.com,
thomas.petazzoni@...tlin.com,
tzimmermann@...e.de
Subject: [PATCH RFC 07/15] drm/vkms: Introduce plane name configuration
> As a plane will be a folder in ConfigFS, add name configuration for plane
> so it will reflect the folder name.
>
> Signed-off-by: Louis Chauvet <louis.chauvet@...tlin.com>
> ---
> drivers/gpu/drm/vkms/vkms_config.c | 14 ++++++++++++++
> drivers/gpu/drm/vkms/vkms_config.h | 2 ++
> drivers/gpu/drm/vkms/vkms_plane.c | 2 +-
> 3 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_config.c b/drivers/gpu/drm/vkms/vkms_config.c
> index b1c6160d350f..b8e235a22e90 100644
> --- a/drivers/gpu/drm/vkms/vkms_config.c
> +++ b/drivers/gpu/drm/vkms/vkms_config.c
> @@ -34,6 +34,10 @@ struct vkms_config *vkms_config_alloc_default(bool enable_writeback, bool enable
> goto err_alloc;
>
> plane->type = DRM_PLANE_TYPE_PRIMARY;
> + plane->name = kzalloc(sizeof("primary"), GFP_KERNEL);
> + if (!plane->name)
> + goto err_alloc;
> + sprintf(plane->name, "primary");
I think that, since all planes will have a name, you could make the
name a function param and kmemdup() it in vkms_config_create_plane().
The same could apply for CRTCs and encoders in patches 13 and 14.
>
> if (enable_overlay) {
> for (int i = 0; i < NUM_OVERLAY_PLANES; i++) {
> @@ -41,6 +45,10 @@ struct vkms_config *vkms_config_alloc_default(bool enable_writeback, bool enable
> if (!plane)
> goto err_alloc;
> plane->type = DRM_PLANE_TYPE_OVERLAY;
> + plane->name = kzalloc(10, GFP_KERNEL);
> + if (!plane->name)
> + goto err_alloc;
> + snprintf(plane->name, 10, "plane-%d", i);
> }
> }
> if (enable_cursor) {
> @@ -48,6 +56,10 @@ struct vkms_config *vkms_config_alloc_default(bool enable_writeback, bool enable
> if (!plane)
> goto err_alloc;
> plane->type = DRM_PLANE_TYPE_CURSOR;
> + plane->name = kzalloc(sizeof("cursor"), GFP_KERNEL);
> + if (!plane->name)
> + goto err_alloc;
> + sprintf(plane->name, "cursor");
> }
>
> return vkms_config;
> @@ -79,6 +91,7 @@ void vkms_config_delete_plane(struct vkms_config_plane *vkms_config_overlay)
> if (!vkms_config_overlay)
> return;
> list_del(&vkms_config_overlay->link);
> + kfree(vkms_config_overlay->name);
> kfree(vkms_config_overlay);
> }
>
> @@ -131,6 +144,7 @@ static int vkms_config_show(struct seq_file *m, void *data)
> seq_printf(m, "writeback=%d\n", vkmsdev->config->writeback);
> list_for_each_entry(config_plane, &vkmsdev->config->planes, link) {
> seq_puts(m, "plane:\n");
> + seq_printf(m, "\tname: %s\n", config_plane->name);
> seq_printf(m, "\ttype: %d\n", config_plane->type);
> }
>
> diff --git a/drivers/gpu/drm/vkms/vkms_config.h b/drivers/gpu/drm/vkms/vkms_config.h
> index 77c1c3934189..792c5e904aa1 100644
> --- a/drivers/gpu/drm/vkms/vkms_config.h
> +++ b/drivers/gpu/drm/vkms/vkms_config.h
> @@ -25,6 +25,7 @@ struct vkms_config {
> * struct vkms_config_plane
> *
> * @link: Link to the others planes
> + * @name: Name of the plane
> * @type: Type of the plane. The creator of configuration needs to ensures that at least one
> * plane is primary.
> * @plane: Internal usage. This pointer should never be considered as valid. It can be used to
> @@ -34,6 +35,7 @@ struct vkms_config {
> struct vkms_config_plane {
> struct list_head link;
>
> + char *name;
> enum drm_plane_type type;
>
> /* Internal usage */
> diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
> index dc9bccf60071..d2b1b524499f 100644
> --- a/drivers/gpu/drm/vkms/vkms_plane.c
> +++ b/drivers/gpu/drm/vkms/vkms_plane.c
> @@ -231,7 +231,7 @@ struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
> plane = drmm_universal_plane_alloc(dev, struct vkms_plane, base, 0,
> &vkms_plane_funcs,
> vkms_formats, ARRAY_SIZE(vkms_formats),
> - NULL, config->type, NULL);
> + NULL, config->type, config->name);
> if (IS_ERR(plane))
> return plane;
>
>
Powered by blists - more mailing lists