[PATCH RESEND v2 06/32] drm/vkms: Introduce configfs for plane name

Louis Chauvet
2025-10-29T14:37:02Z

Planes can have name, create a plane attribute to configure it. Currently
plane name is mainly used in logs.

Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
Documentation/gpu/vkms.rst | 3 ++-
drivers/gpu/drm/vkms/vkms_configfs.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/Documentation/gpu/vkms.rst b/Documentation/gpu/vkms.rst
index 3574e01b928d..1fe6e420c963 100644
--- a/Documentation/gpu/vkms.rst
+++ b/Documentation/gpu/vkms.rst
@@ -87,10 +87,11 @@ Start by creating one or more planes::

sudo mkdir /config/vkms/my-vkms/planes/plane0

-Planes have 1 configurable attribute:
+Planes have 2 configurable attributes:

- type: Plane type: 0 overlay, 1 primary, 2 cursor (same values as those
exposed by the "type" property of a plane)
+- name: Name of the plane

Continue by creating one or more CRTCs::

diff --git a/drivers/gpu/drm/vkms/vkms_configfs.c b/drivers/gpu/drm/vkms/vkms_configfs.c
index 07ab794e1052..be6c3ba998b9 100644
--- a/drivers/gpu/drm/vkms/vkms_configfs.c
+++ b/drivers/gpu/drm/vkms/vkms_configfs.c
@@ -322,10 +322,42 @@ static ssize_t plane_type_store(struct config_item *item, const char *page,
return (ssize_t)count;
}

+static ssize_t plane_name_show(struct config_item *item, char *page)
+{
+ struct vkms_configfs_plane *plane;
+ const char *name;
+
+ plane = plane_item_to_vkms_configfs_plane(item);
+
+ scoped_guard(mutex, &plane->dev->lock)
+ name = vkms_config_plane_get_name(plane->config);
+
+ return sprintf(page, "%s\n", name);
+}
+
+static ssize_t plane_name_store(struct config_item *item, const char *page,
+ size_t count)
+{
+ struct vkms_configfs_plane *plane;
+
+ plane = plane_item_to_vkms_configfs_plane(item);
+
+ scoped_guard(mutex, &plane->dev->lock) {
+ if (plane->dev->enabled)
+ return -EBUSY;
+
+ vkms_config_plane_set_name(plane->config, page);
+ }
+
+ return (ssize_t)count;
+}
+
CONFIGFS_ATTR(plane_, type);
+CONFIGFS_ATTR(plane_, name);

static struct configfs_attribute *plane_item_attrs[] = {
&plane_attr_type,
+ &plane_attr_name,
NULL,
};

--
2.51.0