Skip to contentSkip to conversation

drm/vkms: Add configfs support

PATCH Applied José Expósito 4 participants 24 messages May 7, 2025 – Aug 4, 2025

Subsystems (4)

v5 of 7 Applied Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v5 cover drm/vkms: Add configfs support

Hi everyone,

This series allow to configure one or more VKMS instances without having to reload the driver using configfs.

The series is structured in 3 blocks:

- Patches 1..11: Basic device configuration. For simplicity, I kept the available options as minimal as possible.

- Patches 12 and 13: New option to skip the default device creation and to-do cleanup.

- Patches 14, 15 and 16: Allow to hot-plug and unplug connectors. This is not part of the minimal set of options, but I included in this series so it can be used as a template/example of how new configurations can be added.

The process of configuring a VKMS device is documented in "vkms.rst".

Finally, the code is thoroughly tested by a collection of IGT tests [1].

Best wishes,
José Expósito

[1] https://lists.freedesktop.org/archives/igt-dev/2025-February/086071.html

Changes in v5:

- Added Reviewed-by tags, thanks Louis!
- Rebased on top of drm-misc-next
- Link to v4: https://lore.kernel.org/dri-devel/[email protected]/

Changes in v4:

- Since Louis and I worked on this together, set him as the author of some of the patches and me as co-developed-by to reflect this joint effort.
- Rebased on top of drm-misc-next
- Link to v3: https://lore.kernel.org/all/[email protected]/

Changes in v3:

- Applied review comments by Louis Chauvet: (thanks!!)
- Use scoped_guard() instead of guard(mutex)(...)
- Fix a use-after-free error in the connector hot-plug code
- Rebased on top of drm-misc-next
- Link to v2: https://lore.kernel.org/all/[email protected]/

Changes in v2:

- Applied review comments by Louis Chauvet:
- Use guard(mutex)(...) instead of lock/unlock
- Return -EBUSY when trying to modify a enabled device
- Move the connector hot-plug related patches to the end
- Rebased on top of drm-misc-next
- Link to v1: https://lore.kernel.org/dri-devel/[email protected]/T/

José Expósito (6):
drm/vkms: Expose device creation and destruction drm/vkms: Allow to configure the default device creation drm/vkms: Remove completed task from the TODO list drm/vkms: Allow to configure connector status drm/vkms: Allow to update the connector status drm/vkms: Allow to configure connector status via configfs

Louis Chauvet (10):
drm/vkms: Add and remove VKMS instances via configfs drm/vkms: Allow to configure multiple planes via configfs drm/vkms: Allow to configure the plane type via configfs drm/vkms: Allow to configure multiple CRTCs via configfs drm/vkms: Allow to configure CRTC writeback support via configfs drm/vkms: Allow to attach planes and CRTCs via configfs drm/vkms: Allow to configure multiple encoders via configfs drm/vkms: Allow to attach encoders and CRTCs via configfs drm/vkms: Allow to configure multiple connectors via configfs drm/vkms: Allow to attach connectors and encoders via configfs

 Documentation/gpu/vkms.rst                    | 100 ++-
 drivers/gpu/drm/vkms/Kconfig                  |   1 +
 drivers/gpu/drm/vkms/Makefile                 |   3 +-
 drivers/gpu/drm/vkms/tests/vkms_config_test.c |  24 +
 drivers/gpu/drm/vkms/vkms_config.c            |   8 +-
 drivers/gpu/drm/vkms/vkms_config.h            |  26 +
 drivers/gpu/drm/vkms/vkms_configfs.c          | 833 ++++++++++++++++++
 drivers/gpu/drm/vkms/vkms_configfs.h          |   8 +
 drivers/gpu/drm/vkms/vkms_connector.c         |  35 +
 drivers/gpu/drm/vkms/vkms_connector.h         |   9 +
 drivers/gpu/drm/vkms/vkms_drv.c               |  18 +-
 drivers/gpu/drm/vkms/vkms_drv.h               |  20 +
 12 files changed, 1072 insertions(+), 13 deletions(-)
 create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.c
 create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.h

base-commit: a6c0a91ccb257eaec2aee080df06863ce7601315

Signature · 1 line
2.49.0
#1 lore raw

PATCH v5 1/16 drm/vkms: Expose device creation and destruction

In preparation for configfs support, expose vkms_create() and vkms_destroy().

---
 drivers/gpu/drm/vkms/vkms_drv.c |  4 ++--
 drivers/gpu/drm/vkms/vkms_drv.h | 20 ++++++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
drivers/gpu/drm/vkms/vkms_drv.c +2 -2
index a24d1655f7b8..23817c7b997e 100644
@@ -146,7 +146,7 @@ static int vkms_modeset_init(struct vkms_device *vkmsdev)
 	return vkms_output_init(vkmsdev);
 }
 
-static int vkms_create(struct vkms_config *config)
+int vkms_create(struct vkms_config *config)
 {
 	int ret;
 	struct platform_device *pdev;
@@ -229,7 +229,7 @@ static int __init vkms_init(void)
 	return 0;
 }
 
-static void vkms_destroy(struct vkms_config *config)
+void vkms_destroy(struct vkms_config *config)
 {
 	struct platform_device *pdev;
 
drivers/gpu/drm/vkms/vkms_drv.h +20 -0
index a74a7fc3a056..2ad8e3da3b7b 100644
@@ -223,6 +223,26 @@ struct vkms_device {
 #define to_vkms_plane_state(target)\
 	container_of(target, struct vkms_plane_state, base.base)
 
+/**
+ * vkms_create() - Create a device from a configuration
+ * @config: Config used to configure the new device
+ *
+ * A pointer to the created vkms_device is stored in @config
+ *
+ * Returns:
+ * 0 on success or an error.
+ */
+int vkms_create(struct vkms_config *config);
+
+/**
+ * vkms_destroy() - Destroy a device
+ * @config: Config from which the device was created
+ *
+ * The device is completely removed, but the @config is not freed. It can be
+ * reused or destroyed with vkms_config_destroy().
+ */
+void vkms_destroy(struct vkms_config *config);
+
 /**
  * vkms_crtc_init() - Initialize a CRTC for VKMS
  * @dev: DRM device associated with the VKMS buffer
Signature · 1 line
2.49.0
#2 lore raw

PATCH v5 2/16 drm/vkms: Add and remove VKMS instances via configfs

In reply to José Expósito

From: Louis Chauvet <[email protected]>

Allow to create, enable, disable and destroy VKMS instances using configfs.

For the moment, it is not possible to add pipeline items, so trying to enable the device will fail printing an informative error to the log.

---
 Documentation/gpu/vkms.rst           |  32 +++++
 drivers/gpu/drm/vkms/Kconfig         |   1 +
 drivers/gpu/drm/vkms/Makefile        |   3 +-
 drivers/gpu/drm/vkms/vkms_configfs.c | 172 +++++++++++++++++++++++++++
 drivers/gpu/drm/vkms/vkms_configfs.h |   8 ++
 drivers/gpu/drm/vkms/vkms_drv.c      |   7 ++
 6 files changed, 222 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.c
 create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.h
Documentation/gpu/vkms.rst +32 -0
index ba04ac7c2167..423bdf86b5b1 100644
@@ -51,6 +51,38 @@ To disable the driver, use ::
 
   sudo modprobe -r vkms
 
+Configuring With Configfs
+=========================
+
+It is possible to create and configure multiple VKMS instances via configfs.
+
+Start by mounting configfs and loading VKMS::
+
+  sudo mount -t configfs none /config
+  sudo modprobe vkms
+
+Once VKMS is loaded, ``/config/vkms`` is created automatically. Each directory
+under ``/config/vkms`` represents a VKMS instance, create a new one::
+
+  sudo mkdir /config/vkms/my-vkms
+
+By default, the instance is disabled::
+
+  cat /config/vkms/my-vkms/enabled
+  0
+
+Once you are done configuring the VKMS instance, enable it::
+
+  echo "1" | sudo tee /config/vkms/my-vkms/enabled
+
+Finally, you can remove the VKMS instance disabling it::
+
+  echo "0" | sudo tee /config/vkms/my-vkms/enabled
+
+And removing the top level directory::
+
+  sudo rmdir /config/vkms/my-vkms
+
 Testing With IGT
 ================
 
drivers/gpu/drm/vkms/Kconfig +1 -0
index 3c02f928ffe6..3977bbb99f7d 100644
@@ -7,6 +7,7 @@ config DRM_VKMS
 	select DRM_KMS_HELPER
 	select DRM_GEM_SHMEM_HELPER
 	select CRC32
+	select CONFIGFS_FS
 	default n
 	help
 	  Virtual Kernel Mode-Setting (VKMS) is used for testing or for
drivers/gpu/drm/vkms/Makefile +2 -1
index d657865e573f..939991fc8233 100644
@@ -8,7 +8,8 @@ vkms-y := \
 	vkms_composer.o \
 	vkms_writeback.o \
 	vkms_connector.o \
-	vkms_config.o
+	vkms_config.o \
+	vkms_configfs.o
 
 obj-$(CONFIG_DRM_VKMS) += vkms.o
 obj-$(CONFIG_DRM_VKMS_KUNIT_TEST) += tests/
drivers/gpu/drm/vkms/vkms_configfs.c new file +172 -0

172 lines not on this page · raw message

drivers/gpu/drm/vkms/vkms_configfs.h new file +8 -0
new file mode 100644
index 000000000000..e9020b0043db
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+#ifndef _VKMS_CONFIGFS_H_
+#define _VKMS_CONFIGFS_H_
+
+int vkms_configfs_register(void);
+void vkms_configfs_unregister(void);
+
+#endif /* _VKMS_CONFIGFS_H_ */
drivers/gpu/drm/vkms/vkms_drv.c +7 -0
index 23817c7b997e..5bcfbcb6c0c5 100644
@@ -28,6 +28,7 @@
 #include <drm/drm_vblank.h>
 
 #include "vkms_config.h"
+#include "vkms_configfs.h"
 #include "vkms_drv.h"
 
 #define DRIVER_NAME	"vkms"
@@ -214,6 +215,10 @@ static int __init vkms_init(void)
 	int ret;
 	struct vkms_config *config;
 
+	ret = vkms_configfs_register();
+	if (ret)
+		return ret;
+
 	config = vkms_config_default_create(enable_cursor, enable_writeback, enable_overlay);
 	if (IS_ERR(config))
 		return PTR_ERR(config);
@@ -250,6 +255,8 @@ void vkms_destroy(struct vkms_config *config)
 
 static void __exit vkms_exit(void)
 {
+	vkms_configfs_unregister();
+
 	if (!default_config)
 		return;
 
Signature · 1 line
2.49.0
#3 lore raw

PATCH v5 3/16 drm/vkms: Allow to configure multiple planes via configfs

In reply to José Expósito

From: Louis Chauvet <[email protected]>

Create a default subgroup at /config/vkms/planes to allow to create as many planes as required.

---
 Documentation/gpu/vkms.rst           | 16 ++++-
 drivers/gpu/drm/vkms/vkms_configfs.c | 88 ++++++++++++++++++++++++++++
 2 files changed, 103 insertions(+), 1 deletion(-)
Documentation/gpu/vkms.rst +15 -1
index 423bdf86b5b1..bf23d0da33fe 100644
@@ -71,6 +71,19 @@ By default, the instance is disabled::
   cat /config/vkms/my-vkms/enabled
   0
 
+And directories are created for each configurable item of the display pipeline::
+
+  tree /config/vkms/my-vkms
+  ├── enabled
+  └── planes
+
+To add items to the display pipeline, create one or more directories under the
+available paths.
+
+Start by creating one or more planes::
+
+  sudo mkdir /config/vkms/my-vkms/planes/plane0
+
 Once you are done configuring the VKMS instance, enable it::
 
   echo "1" | sudo tee /config/vkms/my-vkms/enabled
@@ -79,8 +92,9 @@ Finally, you can remove the VKMS instance disabling it::
 
   echo "0" | sudo tee /config/vkms/my-vkms/enabled
 
-And removing the top level directory::
+And removing the top level directory and its subdirectories::
 
+  sudo rmdir /config/vkms/my-vkms/planes/*
   sudo rmdir /config/vkms/my-vkms
 
 Testing With IGT
drivers/gpu/drm/vkms/vkms_configfs.c +88 -0

116 lines not on this page · raw message

Signature · 1 line
2.49.0
#4 lore raw

PATCH v5 4/16 drm/vkms: Allow to configure the plane type via configfs

In reply to José Expósito

From: Louis Chauvet <[email protected]>

When a plane is created, add a type file to allow to set the type:

- 0 overlay
- 1 primary
- 2 cursor

---
 Documentation/gpu/vkms.rst           |  5 +++
 drivers/gpu/drm/vkms/vkms_configfs.c | 46 ++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+)
Documentation/gpu/vkms.rst +5 -0
index bf23d0da33fe..a87e0925bebb 100644
@@ -84,6 +84,11 @@ Start by creating one or more planes::
 
   sudo mkdir /config/vkms/my-vkms/planes/plane0
 
+Planes have 1 configurable attribute:
+
+- type: Plane type: 0 overlay, 1 primary, 2 cursor (same values as those
+  exposed by the "type" property of a plane)
+
 Once you are done configuring the VKMS instance, enable it::
 
   echo "1" | sudo tee /config/vkms/my-vkms/enabled
drivers/gpu/drm/vkms/vkms_configfs.c +46 -0

58 lines not on this page · raw message

Signature · 1 line
2.49.0
#5 lore raw

PATCH v5 5/16 drm/vkms: Allow to configure multiple CRTCs via configfs

In reply to José Expósito

From: Louis Chauvet <[email protected]>

Create a default subgroup at /config/vkms/crtcs to allow to create as many CRTCs as required.

---
 Documentation/gpu/vkms.rst           |  6 ++
 drivers/gpu/drm/vkms/vkms_configfs.c | 85 ++++++++++++++++++++++++++++
 2 files changed, 91 insertions(+)
Documentation/gpu/vkms.rst +6 -0
index a87e0925bebb..e0699603ef53 100644
@@ -74,6 +74,7 @@ By default, the instance is disabled::
 And directories are created for each configurable item of the display pipeline::
 
   tree /config/vkms/my-vkms
+  ├── crtcs
   ├── enabled
   └── planes
 
@@ -89,6 +90,10 @@ Planes have 1 configurable attribute:
 - type: Plane type: 0 overlay, 1 primary, 2 cursor (same values as those
   exposed by the "type" property of a plane)
 
+Continue by creating one or more CRTCs::
+
+  sudo mkdir /config/vkms/my-vkms/crtcs/crtc0
+
 Once you are done configuring the VKMS instance, enable it::
 
   echo "1" | sudo tee /config/vkms/my-vkms/enabled
@@ -100,6 +105,7 @@ Finally, you can remove the VKMS instance disabling it::
 And removing the top level directory and its subdirectories::
 
   sudo rmdir /config/vkms/my-vkms/planes/*
+  sudo rmdir /config/vkms/my-vkms/crtcs/*
   sudo rmdir /config/vkms/my-vkms
 
 Testing With IGT
drivers/gpu/drm/vkms/vkms_configfs.c +85 -0

115 lines not on this page · raw message

Signature · 1 line
2.49.0
#6 lore raw

PATCH v5 6/16 drm/vkms: Allow to configure CRTC writeback support via configfs

In reply to José Expósito

From: Louis Chauvet <[email protected]>

When a CRTC is created, add a writeback file to allow to enable or disable writeback connector support

---
 Documentation/gpu/vkms.rst           |  4 +++
 drivers/gpu/drm/vkms/vkms_configfs.c | 42 ++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)
Documentation/gpu/vkms.rst +4 -0
index e0699603ef53..abe7a0f5a4ab 100644
@@ -94,6 +94,10 @@ Continue by creating one or more CRTCs::
 
   sudo mkdir /config/vkms/my-vkms/crtcs/crtc0
 
+CRTCs have 1 configurable attribute:
+
+- writeback: Enable or disable writeback connector support by writing 1 or 0
+
 Once you are done configuring the VKMS instance, enable it::
 
   echo "1" | sudo tee /config/vkms/my-vkms/enabled
drivers/gpu/drm/vkms/vkms_configfs.c +42 -0

54 lines not on this page · raw message

Signature · 1 line
2.49.0
#7 lore raw

PATCH v5 7/16 drm/vkms: Allow to attach planes and CRTCs via configfs

In reply to José Expósito

From: Louis Chauvet <[email protected]>

Create a default subgroup at /config/vkms/planes/plane/possible_crtcs that will contain symbolic links to the possible CRTCs for the plane.

---
 Documentation/gpu/vkms.rst           |  9 +++++
 drivers/gpu/drm/vkms/vkms_configfs.c | 58 ++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+)
Documentation/gpu/vkms.rst +9 -0
index abe7a0f5a4ab..13b96837a266 100644
@@ -98,6 +98,14 @@ CRTCs have 1 configurable attribute:
 
 - writeback: Enable or disable writeback connector support by writing 1 or 0
 
+To finish the configuration, link the different pipeline items::
+
+  sudo ln -s /config/vkms/my-vkms/crtcs/crtc0 /config/vkms/my-vkms/planes/plane0/possible_crtcs
+
+Since at least one primary plane is required, make sure to set the right type::
+
+  echo "1" | sudo tee /config/vkms/my-vkms/planes/plane0/type
+
 Once you are done configuring the VKMS instance, enable it::
 
   echo "1" | sudo tee /config/vkms/my-vkms/enabled
@@ -108,6 +116,7 @@ Finally, you can remove the VKMS instance disabling it::
 
 And removing the top level directory and its subdirectories::
 
+  sudo rm /config/vkms/my-vkms/planes/*/possible_crtcs/*
   sudo rmdir /config/vkms/my-vkms/planes/*
   sudo rmdir /config/vkms/my-vkms/crtcs/*
   sudo rmdir /config/vkms/my-vkms
drivers/gpu/drm/vkms/vkms_configfs.c +58 -0

87 lines not on this page · raw message

Signature · 1 line
2.49.0
#8 lore raw

PATCH v5 8/16 drm/vkms: Allow to configure multiple encoders via configfs

In reply to José Expósito

From: Louis Chauvet <[email protected]>

Create a default subgroup at /config/vkms/encoders to allow to create as many encoders as required.

---
 Documentation/gpu/vkms.rst           |  6 ++
 drivers/gpu/drm/vkms/vkms_configfs.c | 87 ++++++++++++++++++++++++++++
 2 files changed, 93 insertions(+)
Documentation/gpu/vkms.rst +6 -0
index 13b96837a266..e24767448775 100644
@@ -76,6 +76,7 @@ And directories are created for each configurable item of the display pipeline::
   tree /config/vkms/my-vkms
   ├── crtcs
   ├── enabled
+  ├── encoders
   └── planes
 
 To add items to the display pipeline, create one or more directories under the
@@ -98,6 +99,10 @@ CRTCs have 1 configurable attribute:
 
 - writeback: Enable or disable writeback connector support by writing 1 or 0
 
+Next, create one or more encoders::
+
+  sudo mkdir /config/vkms/my-vkms/encoders/encoder0
+
 To finish the configuration, link the different pipeline items::
 
   sudo ln -s /config/vkms/my-vkms/crtcs/crtc0 /config/vkms/my-vkms/planes/plane0/possible_crtcs
@@ -119,6 +124,7 @@ And removing the top level directory and its subdirectories::
   sudo rm /config/vkms/my-vkms/planes/*/possible_crtcs/*
   sudo rmdir /config/vkms/my-vkms/planes/*
   sudo rmdir /config/vkms/my-vkms/crtcs/*
+  sudo rmdir /config/vkms/my-vkms/encoders/*
   sudo rmdir /config/vkms/my-vkms
 
 Testing With IGT
drivers/gpu/drm/vkms/vkms_configfs.c +87 -0

123 lines not on this page · raw message

Signature · 1 line
2.49.0
#9 lore raw

PATCH v5 9/16 drm/vkms: Allow to attach encoders and CRTCs via configfs

In reply to José Expósito

From: Louis Chauvet <[email protected]>

Create a default subgroup at /config/vkms/encoders/encoder/possible_crtcs that will contain symbolic links to the possible CRTCs for the encoder.

---
 Documentation/gpu/vkms.rst           |  2 +
 drivers/gpu/drm/vkms/vkms_configfs.c | 58 ++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+)
Documentation/gpu/vkms.rst +2 -0
index e24767448775..650dbfa76f59 100644
@@ -106,6 +106,7 @@ Next, create one or more encoders::
 To finish the configuration, link the different pipeline items::
 
   sudo ln -s /config/vkms/my-vkms/crtcs/crtc0 /config/vkms/my-vkms/planes/plane0/possible_crtcs
+  sudo ln -s /config/vkms/my-vkms/crtcs/crtc0 /config/vkms/my-vkms/encoders/encoder0/possible_crtcs
 
 Since at least one primary plane is required, make sure to set the right type::
 
@@ -122,6 +123,7 @@ Finally, you can remove the VKMS instance disabling it::
 And removing the top level directory and its subdirectories::
 
   sudo rm /config/vkms/my-vkms/planes/*/possible_crtcs/*
+  sudo rm /config/vkms/my-vkms/encoders/*/possible_crtcs/*
   sudo rmdir /config/vkms/my-vkms/planes/*
   sudo rmdir /config/vkms/my-vkms/crtcs/*
   sudo rmdir /config/vkms/my-vkms/encoders/*
drivers/gpu/drm/vkms/vkms_configfs.c +58 -0

87 lines not on this page · raw message

Signature · 1 line
2.49.0
#10 lore raw

PATCH v5 10/16 drm/vkms: Allow to configure multiple connectors via configfs

In reply to José Expósito

From: Louis Chauvet <[email protected]>

Create a default subgroup at
/config/vkms/connectors to allow to create as many connectors as required.

---
 Documentation/gpu/vkms.rst           |  6 ++
 drivers/gpu/drm/vkms/vkms_configfs.c | 87 ++++++++++++++++++++++++++++
 2 files changed, 93 insertions(+)
Documentation/gpu/vkms.rst +6 -0
index 650dbfa76f59..744e2355db23 100644
@@ -74,6 +74,7 @@ By default, the instance is disabled::
 And directories are created for each configurable item of the display pipeline::
 
   tree /config/vkms/my-vkms
+  ├── connectors
   ├── crtcs
   ├── enabled
   ├── encoders
@@ -103,6 +104,10 @@ Next, create one or more encoders::
 
   sudo mkdir /config/vkms/my-vkms/encoders/encoder0
 
+Last but not least, create one or more connectors::
+
+  sudo mkdir /config/vkms/my-vkms/connectors/connector0
+
 To finish the configuration, link the different pipeline items::
 
   sudo ln -s /config/vkms/my-vkms/crtcs/crtc0 /config/vkms/my-vkms/planes/plane0/possible_crtcs
@@ -127,6 +132,7 @@ And removing the top level directory and its subdirectories::
   sudo rmdir /config/vkms/my-vkms/planes/*
   sudo rmdir /config/vkms/my-vkms/crtcs/*
   sudo rmdir /config/vkms/my-vkms/encoders/*
+  sudo rmdir /config/vkms/my-vkms/connectors/*
   sudo rmdir /config/vkms/my-vkms
 
 Testing With IGT
drivers/gpu/drm/vkms/vkms_configfs.c +87 -0

123 lines not on this page · raw message

Signature · 1 line
2.49.0
#11 lore raw

PATCH v5 11/16 drm/vkms: Allow to attach connectors and encoders via configfs

In reply to José Expósito

From: Louis Chauvet <[email protected]>

Create a default subgroup at /config/vkms/connectors/connector/possible_encoders that will contain symbolic links to the possible encoders for the connector.

---
 Documentation/gpu/vkms.rst           |  2 +
 drivers/gpu/drm/vkms/vkms_configfs.c | 62 ++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+)
Documentation/gpu/vkms.rst +2 -0
index 744e2355db23..74126d2e32e4 100644
@@ -112,6 +112,7 @@ To finish the configuration, link the different pipeline items::
 
   sudo ln -s /config/vkms/my-vkms/crtcs/crtc0 /config/vkms/my-vkms/planes/plane0/possible_crtcs
   sudo ln -s /config/vkms/my-vkms/crtcs/crtc0 /config/vkms/my-vkms/encoders/encoder0/possible_crtcs
+  sudo ln -s /config/vkms/my-vkms/encoders/encoder0 /config/vkms/my-vkms/connectors/connector0/possible_encoders
 
 Since at least one primary plane is required, make sure to set the right type::
 
@@ -129,6 +130,7 @@ And removing the top level directory and its subdirectories::
 
   sudo rm /config/vkms/my-vkms/planes/*/possible_crtcs/*
   sudo rm /config/vkms/my-vkms/encoders/*/possible_crtcs/*
+  sudo rm /config/vkms/my-vkms/connectors/*/possible_encoders/*
   sudo rmdir /config/vkms/my-vkms/planes/*
   sudo rmdir /config/vkms/my-vkms/crtcs/*
   sudo rmdir /config/vkms/my-vkms/encoders/*
drivers/gpu/drm/vkms/vkms_configfs.c +62 -0

91 lines not on this page · raw message

Signature · 1 line
2.49.0
#12 lore raw

PATCH v5 12/16 drm/vkms: Allow to configure the default device creation

In reply to José Expósito

Add a new module param to allow to create or not the default VKMS instance. Useful when combined with configfs to avoid having additional VKMS instances.

---
 drivers/gpu/drm/vkms/vkms_drv.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/vkms/vkms_drv.c +7 -0
index 5bcfbcb6c0c5..b4ed19c97576 100644
@@ -50,6 +50,10 @@ static bool enable_overlay;
 module_param_named(enable_overlay, enable_overlay, bool, 0444);
 MODULE_PARM_DESC(enable_overlay, "Enable/Disable overlay support");
 
+static bool create_default_dev = true;
+module_param_named(create_default_dev, create_default_dev, bool, 0444);
+MODULE_PARM_DESC(create_default_dev, "Create or not the default VKMS device");
+
 DEFINE_DRM_GEM_FOPS(vkms_driver_fops);
 
 static void vkms_atomic_commit_tail(struct drm_atomic_state *old_state)
@@ -219,6 +223,9 @@ static int __init vkms_init(void)
 	if (ret)
 		return ret;
 
+	if (!create_default_dev)
+		return 0;
+
 	config = vkms_config_default_create(enable_cursor, enable_writeback, enable_overlay);
 	if (IS_ERR(config))
 		return PTR_ERR(config);
Signature · 1 line
2.49.0
#13 lore raw

PATCH v5 13/16 drm/vkms: Remove completed task from the TODO list

In reply to José Expósito

Remove the configfs related TODO items from the "Runtime Configuration" section.

---
 Documentation/gpu/vkms.rst | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
Documentation/gpu/vkms.rst +1 -8
index 74126d2e32e4..c551241fe873 100644
@@ -222,21 +222,14 @@ Runtime Configuration
 ---------------------
 
 We want to be able to reconfigure vkms instance without having to reload the
-module. Use/Test-cases:
+module through configfs. Use/Test-cases:
 
 - Hotplug/hotremove connectors on the fly (to be able to test DP MST handling
   of compositors).
 
-- Configure planes/crtcs/connectors (we'd need some code to have more than 1 of
-  them first).
-
 - Change output configuration: Plug/unplug screens, change EDID, allow changing
   the refresh rate.
 
-The currently proposed solution is to expose vkms configuration through
-configfs. All existing module options should be supported through configfs
-too.
-
 Writeback support
 -----------------
 
Signature · 1 line
2.49.0
#14 lore raw

PATCH v5 14/16 drm/vkms: Allow to configure connector status

In reply to José Expósito

Allow to store the connector status in vkms_config_connector and add a getter and a setter functions as well a KUnit test.

This change only adds the configuration, the connector status is not used yet.

---
 drivers/gpu/drm/vkms/tests/vkms_config_test.c | 24 +++++++++++++++++
 drivers/gpu/drm/vkms/vkms_config.c            |  8 ++++--
 drivers/gpu/drm/vkms/vkms_config.h            | 26 +++++++++++++++++++
 3 files changed, 56 insertions(+), 2 deletions(-)
drivers/gpu/drm/vkms/tests/vkms_config_test.c +24 -0
index ff4566cf9925..3574a829a6ed 100644
@@ -916,6 +916,29 @@ static void vkms_config_test_connector_get_possible_encoders(struct kunit *test)
 	vkms_config_destroy(config);
 }
 
+static void vkms_config_test_connector_status(struct kunit *test)
+{
+	struct vkms_config *config;
+	struct vkms_config_connector *connector_cfg;
+	enum drm_connector_status status;
+
+	config = vkms_config_create("test");
+	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, config);
+
+	connector_cfg = vkms_config_create_connector(config);
+	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, connector_cfg);
+
+	status = vkms_config_connector_get_status(connector_cfg);
+	KUNIT_EXPECT_EQ(test, status, connector_status_connected);
+
+	vkms_config_connector_set_status(connector_cfg,
+					 connector_status_disconnected);
+	status = vkms_config_connector_get_status(connector_cfg);
+	KUNIT_EXPECT_EQ(test, status, connector_status_disconnected);
+
+	vkms_config_destroy(config);
+}
+
 static struct kunit_case vkms_config_test_cases[] = {
 	KUNIT_CASE(vkms_config_test_empty_config),
 	KUNIT_CASE_PARAM(vkms_config_test_default_config,
@@ -937,6 +960,7 @@ static struct kunit_case vkms_config_test_cases[] = {
 	KUNIT_CASE(vkms_config_test_plane_get_possible_crtcs),
 	KUNIT_CASE(vkms_config_test_encoder_get_possible_crtcs),
 	KUNIT_CASE(vkms_config_test_connector_get_possible_encoders),
+	KUNIT_CASE(vkms_config_test_connector_status),
 	{}
 };
 
drivers/gpu/drm/vkms/vkms_config.c +6 -2
index a1df5659b0fb..f8394a063ecf 100644
@@ -361,8 +361,11 @@ static int vkms_config_show(struct seq_file *m, void *data)
 	vkms_config_for_each_encoder(vkmsdev->config, encoder_cfg)
 		seq_puts(m, "encoder\n");
 
-	vkms_config_for_each_connector(vkmsdev->config, connector_cfg)
-		seq_puts(m, "connector\n");
+	vkms_config_for_each_connector(vkmsdev->config, connector_cfg) {
+		seq_puts(m, "connector:\n");
+		seq_printf(m, "\tstatus=%d\n",
+			   vkms_config_connector_get_status(connector_cfg));
+	}
 
 	return 0;
 }
@@ -588,6 +591,7 @@ struct vkms_config_connector *vkms_config_create_connector(struct vkms_config *c
 		return ERR_PTR(-ENOMEM);
 
 	connector_cfg->config = config;
+	connector_cfg->status = connector_status_connected;
 	xa_init_flags(&connector_cfg->possible_encoders, XA_FLAGS_ALLOC);
 
 	list_add_tail(&connector_cfg->link, &config->connectors);
drivers/gpu/drm/vkms/vkms_config.h +26 -0
index 0118e3f99706..e202b5a84ddd 100644
@@ -7,6 +7,8 @@
 #include <linux/types.h>
 #include <linux/xarray.h>
 
+#include <drm/drm_connector.h>
+
 #include "vkms_drv.h"
 
 /**
@@ -99,6 +101,7 @@ struct vkms_config_encoder {
  *
  * @link: Link to the others connector in vkms_config
  * @config: The vkms_config this connector belongs to
+ * @status: Status (connected, disconnected...) of the connector
  * @possible_encoders: Array of encoders that can be used with this connector
  * @connector: Internal usage. This pointer should never be considered as valid.
  *             It can be used to store a temporary reference to a VKMS connector
@@ -109,6 +112,7 @@ struct vkms_config_connector {
 	struct list_head link;
 	struct vkms_config *config;
 
+	enum drm_connector_status status;
 	struct xarray possible_encoders;
 
 	/* Internal usage */
@@ -434,4 +438,26 @@ int __must_check vkms_config_connector_attach_encoder(struct vkms_config_connect
 void vkms_config_connector_detach_encoder(struct vkms_config_connector *connector_cfg,
 					  struct vkms_config_encoder *encoder_cfg);
 
+/**
+ * vkms_config_connector_get_status() - Return the status of the connector
+ * @connector_cfg: Connector to get the status from
+ */
+static inline enum drm_connector_status
+vkms_config_connector_get_status(struct vkms_config_connector *connector_cfg)
+{
+	return connector_cfg->status;
+}
+
+/**
+ * vkms_config_crtc_set_writeback() - If a writeback connector will be created
+ * @crtc_cfg: Target CRTC
+ * @writeback: Enable or disable the writeback connector
+ */
+static inline void
+vkms_config_connector_set_status(struct vkms_config_connector *connector_cfg,
+				 enum drm_connector_status status)
+{
+	connector_cfg->status = status;
+}
+
 #endif /* _VKMS_CONFIG_H_ */
Signature · 1 line
2.49.0
#15 lore raw

PATCH v5 15/16 drm/vkms: Allow to update the connector status

In reply to José Expósito

Implement the drm_connector_funcs.detect() callback to update the connector status by returning the status stored in the configuration.

---
 drivers/gpu/drm/vkms/vkms_connector.c | 28 +++++++++++++++++++++++++++
 drivers/gpu/drm/vkms/vkms_connector.h |  3 +++
 2 files changed, 31 insertions(+)
drivers/gpu/drm/vkms/vkms_connector.c +28 -0
index 48b10cba322a..89fa8d9d739b 100644
@@ -5,9 +5,37 @@
 #include <drm/drm_managed.h>
 #include <drm/drm_probe_helper.h>
 
+#include "vkms_config.h"
 #include "vkms_connector.h"
 
+static enum drm_connector_status vkms_connector_detect(struct drm_connector *connector,
+						       bool force)
+{
+	struct drm_device *dev = connector->dev;
+	struct vkms_device *vkmsdev = drm_device_to_vkms_device(dev);
+	struct vkms_connector *vkms_connector;
+	enum drm_connector_status status;
+	struct vkms_config_connector *connector_cfg;
+
+	vkms_connector = drm_connector_to_vkms_connector(connector);
+
+	/*
+	 * The connector configuration might not exist if its configfs directory
+	 * was deleted. Therefore, use the configuration if present or keep the
+	 * current status if we can not access it anymore.
+	 */
+	status = connector->status;
+
+	vkms_config_for_each_connector(vkmsdev->config, connector_cfg) {
+		if (connector_cfg->connector == vkms_connector)
+			status = vkms_config_connector_get_status(connector_cfg);
+	}
+
+	return status;
+}
+
 static const struct drm_connector_funcs vkms_connector_funcs = {
+	.detect = vkms_connector_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.reset = drm_atomic_helper_connector_reset,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
drivers/gpu/drm/vkms/vkms_connector.h +3 -0
index c9149c1b7af0..90f835f70b3b 100644
@@ -5,6 +5,9 @@
 
 #include "vkms_drv.h"
 
+#define drm_connector_to_vkms_connector(target) \
+	container_of(target, struct vkms_connector, base)
+
 /**
  * struct vkms_connector - VKMS custom type wrapping around the DRM connector
  *
Signature · 1 line
2.49.0
#16 lore raw

PATCH v5 16/16 drm/vkms: Allow to configure connector status via configfs

In reply to José Expósito

When a connector is created, add a status file to allow to update the connector status to:

- 1 connector_status_connected
- 2 connector_status_disconnected
- 3 connector_status_unknown

If the device is enabled, updating the status hot-plug or unplugs the connector.

---
 Documentation/gpu/vkms.rst            |  5 +++
 drivers/gpu/drm/vkms/vkms_configfs.c  | 48 +++++++++++++++++++++++++++
 drivers/gpu/drm/vkms/vkms_connector.c |  7 ++++
 drivers/gpu/drm/vkms/vkms_connector.h |  6 ++++
 4 files changed, 66 insertions(+)
Documentation/gpu/vkms.rst +5 -0
index c551241fe873..7c54099b1dc6 100644
@@ -108,6 +108,11 @@ Last but not least, create one or more connectors::
 
   sudo mkdir /config/vkms/my-vkms/connectors/connector0
 
+Connectors have 1 configurable attribute:
+
+- status: Connection status: 1 connected, 2 disconnected, 3 unknown (same values
+  as those exposed by the "status" property of a connector)
+
 To finish the configuration, link the different pipeline items::
 
   sudo ln -s /config/vkms/my-vkms/crtcs/crtc0 /config/vkms/my-vkms/planes/plane0/possible_crtcs
drivers/gpu/drm/vkms/vkms_configfs.c +48 -0

66 lines not on this page · raw message

drivers/gpu/drm/vkms/vkms_connector.c +7 -0
index 89fa8d9d739b..b0a6b212d3f4 100644
@@ -87,3 +87,10 @@ struct vkms_connector *vkms_connector_init(struct vkms_device *vkmsdev)
 
 	return connector;
 }
+
+void vkms_trigger_connector_hotplug(struct vkms_device *vkmsdev)
+{
+	struct drm_device *dev = &vkmsdev->drm;
+
+	drm_kms_helper_hotplug_event(dev);
+}
drivers/gpu/drm/vkms/vkms_connector.h +6 -0
index 90f835f70b3b..35f2adf97e32 100644
@@ -26,4 +26,10 @@ struct vkms_connector {
  */
 struct vkms_connector *vkms_connector_init(struct vkms_device *vkmsdev);
 
+/**
+ * struct vkms_device *vkmsdev() - Update the device's connectors status
+ * @vkmsdev: VKMS device to update
+ */
+void vkms_trigger_connector_hotplug(struct vkms_device *vkmsdev);
+
 #endif /* _VKMS_CONNECTOR_H_ */
Signature · 1 line
2.49.0
maintainer
#17 lore raw
In reply to José Expósito

Hi everyone,

I have reviewed all the series, but I would appreciate an additional review for two important reasons:
- This series introduces a new uAPI, and I believe it is crucial to have at least a third perspective before merging.
- I was heavily involved in the creation of these patches, so an external review would be very valuable.

Could someone please look at it so we can move forward? We have many new parameters to introduce, such as plane configuration and dynamic connectors, but everything depends on this series.

Thank you very much for your help!

Best regards,
Louis Chauvet

Le 07/05/2025 à 15:54, José Expósito a écrit :

Quoted 94 lines

Hi everyone,

This series allow to configure one or more VKMS instances without having to reload the driver using configfs.

The series is structured in 3 blocks:

- Patches 1..11: Basic device configuration. For simplicity, I kept the available options as minimal as possible.

- Patches 12 and 13: New option to skip the default device creation and to-do cleanup.

- Patches 14, 15 and 16: Allow to hot-plug and unplug connectors. This is not part of the minimal set of options, but I included in this series so it can be used as a template/example of how new configurations can be added.

The process of configuring a VKMS device is documented in "vkms.rst".

Finally, the code is thoroughly tested by a collection of IGT tests [1].

Best wishes,
José Expósito

[1] https://lists.freedesktop.org/archives/igt-dev/2025-February/086071.html

Changes in v5:

- Added Reviewed-by tags, thanks Louis!
- Rebased on top of drm-misc-next
- Link to v4: https://lore.kernel.org/dri-devel/[email protected]/

Changes in v4:

- Since Louis and I worked on this together, set him as the author of some of the patches and me as co-developed-by to reflect this joint effort.
- Rebased on top of drm-misc-next
- Link to v3: https://lore.kernel.org/all/[email protected]/

Changes in v3:

- Applied review comments by Louis Chauvet: (thanks!!)
- Use scoped_guard() instead of guard(mutex)(...)
- Fix a use-after-free error in the connector hot-plug code
- Rebased on top of drm-misc-next
- Link to v2: https://lore.kernel.org/all/[email protected]/

Changes in v2:

- Applied review comments by Louis Chauvet:
- Use guard(mutex)(...) instead of lock/unlock
- Return -EBUSY when trying to modify a enabled device
- Move the connector hot-plug related patches to the end
- Rebased on top of drm-misc-next
- Link to v1: https://lore.kernel.org/dri-devel/[email protected]/T/

José Expósito (6):
drm/vkms: Expose device creation and destruction drm/vkms: Allow to configure the default device creation drm/vkms: Remove completed task from the TODO list drm/vkms: Allow to configure connector status drm/vkms: Allow to update the connector status drm/vkms: Allow to configure connector status via configfs

Louis Chauvet (10):
drm/vkms: Add and remove VKMS instances via configfs drm/vkms: Allow to configure multiple planes via configfs drm/vkms: Allow to configure the plane type via configfs drm/vkms: Allow to configure multiple CRTCs via configfs drm/vkms: Allow to configure CRTC writeback support via configfs drm/vkms: Allow to attach planes and CRTCs via configfs drm/vkms: Allow to configure multiple encoders via configfs drm/vkms: Allow to attach encoders and CRTCs via configfs drm/vkms: Allow to configure multiple connectors via configfs drm/vkms: Allow to attach connectors and encoders via configfs

  Documentation/gpu/vkms.rst                    | 100 ++-
  drivers/gpu/drm/vkms/Kconfig                  |   1 +
  drivers/gpu/drm/vkms/Makefile                 |   3 +-
  drivers/gpu/drm/vkms/tests/vkms_config_test.c |  24 +
  drivers/gpu/drm/vkms/vkms_config.c            |   8 +-
  drivers/gpu/drm/vkms/vkms_config.h            |  26 +
  drivers/gpu/drm/vkms/vkms_configfs.c          | 833 ++++++++++++++++++
  drivers/gpu/drm/vkms/vkms_configfs.h          |   8 +
  drivers/gpu/drm/vkms/vkms_connector.c         |  35 +
  drivers/gpu/drm/vkms/vkms_connector.h         |   9 +
  drivers/gpu/drm/vkms/vkms_drv.c               |  18 +-
  drivers/gpu/drm/vkms/vkms_drv.h               |  20 +
  12 files changed, 1072 insertions(+), 13 deletions(-)

create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.c create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.h

base-commit: a6c0a91ccb257eaec2aee080df06863ce7601315

Signature · 3 lines
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
maintainer
#18 lore raw
In reply to José Expósito

+CC: Mark (Google), Sebastian (Mutter), Xaver (KWin), Victoria (Cosmic)

Hi everyone,

Last week, I presented this work at the Display Next Hackfest, and the feedback from compositors was very positive. At least KWin, Mutter, and Cosmic are interested in integrating it into their tests, so it would be great if someone could review it.

Sebastian quickly tested this work (using [2] for full features) with their existing VKMS tests [1], and it worked. From what I understand, the tests are quite basic —just sanity checks— but we were able to reproduce the default vkms device using ConfigFS.

If another compositor wants to test the ConfigFS interface (I will try to keep [2] updated), that would be amazing. Feel free to send feedback!

A small note: This series has a minor conflict since the conversion to the faux device, but it can be applied using b4 am -3 ... && git am -3 .... @josé, if you send a new iteration, can you add [email protected] in copy, and maybe Sebastian, Xaver, Victoria if they want to follow the upstreaming?

Thank you,
Louis Chauvet

[1]:https://gitlab.gnome.org/swick/mutter/-/commit/88a7354942d9728dae06fb83cc4f2d2c7b08b694 [2]:https://github.com/Fomys/linux/tree/configfs-everything

Le 07/05/2025 à 15:54, José Expósito a écrit :

Quoted 94 lines

Hi everyone,

This series allow to configure one or more VKMS instances without having to reload the driver using configfs.

The series is structured in 3 blocks:

- Patches 1..11: Basic device configuration. For simplicity, I kept the available options as minimal as possible.

- Patches 12 and 13: New option to skip the default device creation and to-do cleanup.

- Patches 14, 15 and 16: Allow to hot-plug and unplug connectors. This is not part of the minimal set of options, but I included in this series so it can be used as a template/example of how new configurations can be added.

The process of configuring a VKMS device is documented in "vkms.rst".

Finally, the code is thoroughly tested by a collection of IGT tests [1].

Best wishes,
José Expósito

[1] https://lists.freedesktop.org/archives/igt-dev/2025-February/086071.html

Changes in v5:

- Added Reviewed-by tags, thanks Louis!
- Rebased on top of drm-misc-next
- Link to v4: https://lore.kernel.org/dri-devel/[email protected]/

Changes in v4:

- Since Louis and I worked on this together, set him as the author of some of the patches and me as co-developed-by to reflect this joint effort.
- Rebased on top of drm-misc-next
- Link to v3: https://lore.kernel.org/all/[email protected]/

Changes in v3:

- Applied review comments by Louis Chauvet: (thanks!!)
- Use scoped_guard() instead of guard(mutex)(...)
- Fix a use-after-free error in the connector hot-plug code
- Rebased on top of drm-misc-next
- Link to v2: https://lore.kernel.org/all/[email protected]/

Changes in v2:

- Applied review comments by Louis Chauvet:
- Use guard(mutex)(...) instead of lock/unlock
- Return -EBUSY when trying to modify a enabled device
- Move the connector hot-plug related patches to the end
- Rebased on top of drm-misc-next
- Link to v1: https://lore.kernel.org/dri-devel/[email protected]/T/

José Expósito (6):
drm/vkms: Expose device creation and destruction drm/vkms: Allow to configure the default device creation drm/vkms: Remove completed task from the TODO list drm/vkms: Allow to configure connector status drm/vkms: Allow to update the connector status drm/vkms: Allow to configure connector status via configfs

Louis Chauvet (10):
drm/vkms: Add and remove VKMS instances via configfs drm/vkms: Allow to configure multiple planes via configfs drm/vkms: Allow to configure the plane type via configfs drm/vkms: Allow to configure multiple CRTCs via configfs drm/vkms: Allow to configure CRTC writeback support via configfs drm/vkms: Allow to attach planes and CRTCs via configfs drm/vkms: Allow to configure multiple encoders via configfs drm/vkms: Allow to attach encoders and CRTCs via configfs drm/vkms: Allow to configure multiple connectors via configfs drm/vkms: Allow to attach connectors and encoders via configfs

  Documentation/gpu/vkms.rst                    | 100 ++-
  drivers/gpu/drm/vkms/Kconfig                  |   1 +
  drivers/gpu/drm/vkms/Makefile                 |   3 +-
  drivers/gpu/drm/vkms/tests/vkms_config_test.c |  24 +
  drivers/gpu/drm/vkms/vkms_config.c            |   8 +-
  drivers/gpu/drm/vkms/vkms_config.h            |  26 +
  drivers/gpu/drm/vkms/vkms_configfs.c          | 833 ++++++++++++++++++
  drivers/gpu/drm/vkms/vkms_configfs.h          |   8 +
  drivers/gpu/drm/vkms/vkms_connector.c         |  35 +
  drivers/gpu/drm/vkms/vkms_connector.h         |   9 +
  drivers/gpu/drm/vkms/vkms_drv.c               |  18 +-
  drivers/gpu/drm/vkms/vkms_drv.h               |  20 +
  12 files changed, 1072 insertions(+), 13 deletions(-)

create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.c create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.h

base-commit: a6c0a91ccb257eaec2aee080df06863ce7601315

Signature · 3 lines
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Tested-by Applied
#19 lore raw

Merged into Android tree:
https://android-review.git.corp.google.com/c/kernel/common-modules/virtual-device/+/3661920
I'm able to use configfs as expected.

Quoted 146 lines · Louis Chauvet

+CC: Mark (Google), Sebastian (Mutter), Xaver (KWin), Victoria (Cosmic)

Hi everyone,

Last week, I presented this work at the Display Next Hackfest, and the feedback from compositors was very positive. At least KWin, Mutter, and Cosmic are interested in integrating it into their tests, so it would be great if someone could review it.

Sebastian quickly tested this work (using [2] for full features) with their existing VKMS tests [1], and it worked. From what I understand, the tests are quite basic —just sanity checks— but we were able to reproduce the default vkms device using ConfigFS.

If another compositor wants to test the ConfigFS interface (I will try to keep [2] updated), that would be amazing. Feel free to send feedback!

A small note: This series has a minor conflict since the conversion to the faux device, but it can be applied using b4 am -3 ... && git am -3 ....
@josé, if you send a new iteration, can you add [email protected] in copy, and maybe Sebastian, Xaver, Victoria if they want to follow the upstreaming?

Thank you,
Louis Chauvet

[1]:
https://gitlab.gnome.org/swick/mutter/-/commit/88a7354942d9728dae06fb83cc4f2d2c7b08b694
[2]:https://github.com/Fomys/linux/tree/configfs-everything

Quoted 8 lines · José Expósito

Hi everyone,

This series allow to configure one or more VKMS instances without having to reload the driver using configfs.

The series is structured in 3 blocks:

- Patches 1..11: Basic device configuration. For simplicity, I kept

the

Quoted 3 lines

available options as minimal as possible.

- Patches 12 and 13: New option to skip the default device creation

and to-do

Quoted 3 lines

cleanup.

- Patches 14, 15 and 16: Allow to hot-plug and unplug connectors.

This is not

Quoted 1 line

part of the minimal set of options, but I included in this series

so it can

Quoted 1 line

be used as a template/example of how new configurations can be

added.

Quoted 9 lines

The process of configuring a VKMS device is documented in "vkms.rst".

Finally, the code is thoroughly tested by a collection of IGT tests [1].

Best wishes,
José Expósito

[1]

https://lists.freedesktop.org/archives/igt-dev/2025-February/086071.html

Quoted 6 lines

Changes in v5:

- Added Reviewed-by tags, thanks Louis!
- Rebased on top of drm-misc-next
- Link to v4:

https://lore.kernel.org/dri-devel/[email protected]/

Quoted 4 lines

Changes in v4:

- Since Louis and I worked on this together, set him as the author of

some of

Quoted 3 lines

the patches and me as co-developed-by to reflect this joint effort.
- Rebased on top of drm-misc-next
- Link to v3:

https://lore.kernel.org/all/[email protected]/

Quoted 8 lines

Changes in v3:

- Applied review comments by Louis Chauvet: (thanks!!)
- Use scoped_guard() instead of guard(mutex)(...)
- Fix a use-after-free error in the connector hot-plug code
- Rebased on top of drm-misc-next
- Link to v2:

https://lore.kernel.org/all/[email protected]/

Quoted 9 lines

Changes in v2:

- Applied review comments by Louis Chauvet:
- Use guard(mutex)(...) instead of lock/unlock
- Return -EBUSY when trying to modify a enabled device
- Move the connector hot-plug related patches to the end
- Rebased on top of drm-misc-next
- Link to v1:

https://lore.kernel.org/dri-devel/[email protected]/T/

Quoted 34 lines

José Expósito (6):
drm/vkms: Expose device creation and destruction drm/vkms: Allow to configure the default device creation drm/vkms: Remove completed task from the TODO list drm/vkms: Allow to configure connector status drm/vkms: Allow to update the connector status drm/vkms: Allow to configure connector status via configfs

Louis Chauvet (10):
drm/vkms: Add and remove VKMS instances via configfs drm/vkms: Allow to configure multiple planes via configfs drm/vkms: Allow to configure the plane type via configfs drm/vkms: Allow to configure multiple CRTCs via configfs drm/vkms: Allow to configure CRTC writeback support via configfs drm/vkms: Allow to attach planes and CRTCs via configfs drm/vkms: Allow to configure multiple encoders via configfs drm/vkms: Allow to attach encoders and CRTCs via configfs drm/vkms: Allow to configure multiple connectors via configfs drm/vkms: Allow to attach connectors and encoders via configfs

  Documentation/gpu/vkms.rst                    | 100 ++-
  drivers/gpu/drm/vkms/Kconfig                  |   1 +
  drivers/gpu/drm/vkms/Makefile                 |   3 +-
  drivers/gpu/drm/vkms/tests/vkms_config_test.c |  24 +
  drivers/gpu/drm/vkms/vkms_config.c            |   8 +-
  drivers/gpu/drm/vkms/vkms_config.h            |  26 +
  drivers/gpu/drm/vkms/vkms_configfs.c          | 833 ++++++++++++++++++
  drivers/gpu/drm/vkms/vkms_configfs.h          |   8 +
  drivers/gpu/drm/vkms/vkms_connector.c         |  35 +
  drivers/gpu/drm/vkms/vkms_connector.h         |   9 +
  drivers/gpu/drm/vkms/vkms_drv.c               |  18 +-
  drivers/gpu/drm/vkms/vkms_drv.h               |  20 +
  12 files changed, 1072 insertions(+), 13 deletions(-)
Quoted 5 lines

create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.c create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.h

base-commit: a6c0a91ccb257eaec2aee080df06863ce7601315

--
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Tested-by Applied
#20 lore raw
In reply to Louis Chauvet

Merged into Android tree:
https://android-review.git.corp.google.com/c/kernel/common-modules/virtual-device/+/3661920
I'm able to use configfs as expected.

Quoted 134 lines · Louis Chauvet

+CC: Mark (Google), Sebastian (Mutter), Xaver (KWin), Victoria (Cosmic)

Hi everyone,

Last week, I presented this work at the Display Next Hackfest, and the feedback from compositors was very positive. At least KWin, Mutter, and Cosmic are interested in integrating it into their tests, so it would be great if someone could review it.

Sebastian quickly tested this work (using [2] for full features) with their existing VKMS tests [1], and it worked. From what I understand, the tests are quite basic —just sanity checks— but we were able to reproduce the default vkms device using ConfigFS.

If another compositor wants to test the ConfigFS interface (I will try to keep [2] updated), that would be amazing. Feel free to send feedback!

A small note: This series has a minor conflict since the conversion to the faux device, but it can be applied using b4 am -3 ... && git am -3 ....
@josé, if you send a new iteration, can you add [email protected] in copy, and maybe Sebastian, Xaver, Victoria if they want to follow the upstreaming?

Thank you,
Louis Chauvet

[1]:https://gitlab.gnome.org/swick/mutter/-/commit/88a7354942d9728dae06fb83cc4f2d2c7b08b694 [2]:https://github.com/Fomys/linux/tree/configfs-everything

Quoted 89 lines · José Expósito

Hi everyone,

This series allow to configure one or more VKMS instances without having to reload the driver using configfs.

The series is structured in 3 blocks:

- Patches 1..11: Basic device configuration. For simplicity, I kept the available options as minimal as possible.

- Patches 12 and 13: New option to skip the default device creation and to-do cleanup.

- Patches 14, 15 and 16: Allow to hot-plug and unplug connectors. This is not part of the minimal set of options, but I included in this series so it can be used as a template/example of how new configurations can be added.

The process of configuring a VKMS device is documented in "vkms.rst".

Finally, the code is thoroughly tested by a collection of IGT tests [1].

Best wishes,
José Expósito

[1] https://lists.freedesktop.org/archives/igt-dev/2025-February/086071.html

Changes in v5:

- Added Reviewed-by tags, thanks Louis!
- Rebased on top of drm-misc-next
- Link to v4: https://lore.kernel.org/dri-devel/[email protected]/

Changes in v4:

- Since Louis and I worked on this together, set him as the author of some of the patches and me as co-developed-by to reflect this joint effort.
- Rebased on top of drm-misc-next
- Link to v3: https://lore.kernel.org/all/[email protected]/

Changes in v3:

- Applied review comments by Louis Chauvet: (thanks!!)
- Use scoped_guard() instead of guard(mutex)(...)
- Fix a use-after-free error in the connector hot-plug code
- Rebased on top of drm-misc-next
- Link to v2: https://lore.kernel.org/all/[email protected]/

Changes in v2:

- Applied review comments by Louis Chauvet:
- Use guard(mutex)(...) instead of lock/unlock
- Return -EBUSY when trying to modify a enabled device
- Move the connector hot-plug related patches to the end
- Rebased on top of drm-misc-next
- Link to v1: https://lore.kernel.org/dri-devel/[email protected]/T/

José Expósito (6):
drm/vkms: Expose device creation and destruction drm/vkms: Allow to configure the default device creation drm/vkms: Remove completed task from the TODO list drm/vkms: Allow to configure connector status drm/vkms: Allow to update the connector status drm/vkms: Allow to configure connector status via configfs

Louis Chauvet (10):
drm/vkms: Add and remove VKMS instances via configfs drm/vkms: Allow to configure multiple planes via configfs drm/vkms: Allow to configure the plane type via configfs drm/vkms: Allow to configure multiple CRTCs via configfs drm/vkms: Allow to configure CRTC writeback support via configfs drm/vkms: Allow to attach planes and CRTCs via configfs drm/vkms: Allow to configure multiple encoders via configfs drm/vkms: Allow to attach encoders and CRTCs via configfs drm/vkms: Allow to configure multiple connectors via configfs drm/vkms: Allow to attach connectors and encoders via configfs

  Documentation/gpu/vkms.rst                    | 100 ++-
  drivers/gpu/drm/vkms/Kconfig                  |   1 +
  drivers/gpu/drm/vkms/Makefile                 |   3 +-
  drivers/gpu/drm/vkms/tests/vkms_config_test.c |  24 +
  drivers/gpu/drm/vkms/vkms_config.c            |   8 +-
  drivers/gpu/drm/vkms/vkms_config.h            |  26 +
  drivers/gpu/drm/vkms/vkms_configfs.c          | 833 ++++++++++++++++++
  drivers/gpu/drm/vkms/vkms_configfs.h          |   8 +
  drivers/gpu/drm/vkms/vkms_connector.c         |  35 +
  drivers/gpu/drm/vkms/vkms_connector.h         |   9 +
  drivers/gpu/drm/vkms/vkms_drv.c               |  18 +-
  drivers/gpu/drm/vkms/vkms_drv.h               |  20 +
  12 files changed, 1072 insertions(+), 13 deletions(-)
Quoted 5 lines

create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.c create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.h

base-commit: a6c0a91ccb257eaec2aee080df06863ce7601315

--
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#21 lore raw
In reply to Louis Chauvet

Hi,

FWIW, we (Weston) also use vkms in CI and we have in plan to make use of these changes to exercise some internal code paths and enhance our tests. Look forward to getting these into the tree and have it a in release. We tend to follow with a branch/stable release so I suppose that's going be a while. Just wanted to also say thanks a lot for driving this.

Just curios, in the current form would it be possible to configure the plane's zpos position? Apart from testing underlay/overlay in the same time, some drivers today allows the primary to be independently positioned. Simulating these type of configurations would allow see what architectural changes we might need to do to transition towards a place where we can use any other plane as a (fallback) compositing one like we do today with the primary one.

Quoted 132 lines · Louis Chauvet

+CC: Mark (Google), Sebastian (Mutter), Xaver (KWin), Victoria (Cosmic)

Hi everyone,

Last week, I presented this work at the Display Next Hackfest, and the feedback from compositors was very positive. At least KWin, Mutter, and Cosmic are interested in integrating it into their tests, so it would be great if someone could review it.

Sebastian quickly tested this work (using [2] for full features) with their existing VKMS tests [1], and it worked. From what I understand, the tests are quite basic —just sanity checks— but we were able to reproduce the default vkms device using ConfigFS.

If another compositor wants to test the ConfigFS interface (I will try to keep [2] updated), that would be amazing. Feel free to send feedback!

A small note: This series has a minor conflict since the conversion to the faux device, but it can be applied using b4 am -3 ... && git am -3 .... @josé, if you send a new iteration, can you add [email protected] in copy, and maybe Sebastian, Xaver, Victoria if they want to follow the upstreaming?

Thank you,
Louis Chauvet

[1]:https://gitlab.gnome.org/swick/mutter/-/commit/88a7354942d9728dae06fb83cc4f2d2c7b08b694 [2]:https://github.com/Fomys/linux/tree/configfs-everything

Le 07/05/2025 à 15:54, José Expósito a écrit :

Quoted 94 lines

Hi everyone,

This series allow to configure one or more VKMS instances without having to reload the driver using configfs.

The series is structured in 3 blocks:

- Patches 1..11: Basic device configuration. For simplicity, I kept the available options as minimal as possible.

- Patches 12 and 13: New option to skip the default device creation and to-do cleanup.

- Patches 14, 15 and 16: Allow to hot-plug and unplug connectors. This is not part of the minimal set of options, but I included in this series so it can be used as a template/example of how new configurations can be added.

The process of configuring a VKMS device is documented in "vkms.rst".

Finally, the code is thoroughly tested by a collection of IGT tests [1].

Best wishes,
José Expósito

[1] https://lists.freedesktop.org/archives/igt-dev/2025-February/086071.html

Changes in v5:

- Added Reviewed-by tags, thanks Louis!
- Rebased on top of drm-misc-next
- Link to v4: https://lore.kernel.org/dri-devel/[email protected]/

Changes in v4:

- Since Louis and I worked on this together, set him as the author of some of the patches and me as co-developed-by to reflect this joint effort.
- Rebased on top of drm-misc-next
- Link to v3: https://lore.kernel.org/all/[email protected]/

Changes in v3:

- Applied review comments by Louis Chauvet: (thanks!!)
- Use scoped_guard() instead of guard(mutex)(...)
- Fix a use-after-free error in the connector hot-plug code
- Rebased on top of drm-misc-next
- Link to v2: https://lore.kernel.org/all/[email protected]/

Changes in v2:

- Applied review comments by Louis Chauvet:
- Use guard(mutex)(...) instead of lock/unlock
- Return -EBUSY when trying to modify a enabled device
- Move the connector hot-plug related patches to the end
- Rebased on top of drm-misc-next
- Link to v1: https://lore.kernel.org/dri-devel/[email protected]/T/

José Expósito (6):
drm/vkms: Expose device creation and destruction drm/vkms: Allow to configure the default device creation drm/vkms: Remove completed task from the TODO list drm/vkms: Allow to configure connector status drm/vkms: Allow to update the connector status drm/vkms: Allow to configure connector status via configfs

Louis Chauvet (10):
drm/vkms: Add and remove VKMS instances via configfs drm/vkms: Allow to configure multiple planes via configfs drm/vkms: Allow to configure the plane type via configfs drm/vkms: Allow to configure multiple CRTCs via configfs drm/vkms: Allow to configure CRTC writeback support via configfs drm/vkms: Allow to attach planes and CRTCs via configfs drm/vkms: Allow to configure multiple encoders via configfs drm/vkms: Allow to attach encoders and CRTCs via configfs drm/vkms: Allow to configure multiple connectors via configfs drm/vkms: Allow to attach connectors and encoders via configfs

  Documentation/gpu/vkms.rst                    | 100 ++-
  drivers/gpu/drm/vkms/Kconfig                  |   1 +
  drivers/gpu/drm/vkms/Makefile                 |   3 +-
  drivers/gpu/drm/vkms/tests/vkms_config_test.c |  24 +
  drivers/gpu/drm/vkms/vkms_config.c            |   8 +-
  drivers/gpu/drm/vkms/vkms_config.h            |  26 +
  drivers/gpu/drm/vkms/vkms_configfs.c          | 833 ++++++++++++++++++
  drivers/gpu/drm/vkms/vkms_configfs.h          |   8 +
  drivers/gpu/drm/vkms/vkms_connector.c         |  35 +
  drivers/gpu/drm/vkms/vkms_connector.h         |   9 +
  drivers/gpu/drm/vkms/vkms_drv.c               |  18 +-
  drivers/gpu/drm/vkms/vkms_drv.h               |  20 +
  12 files changed, 1072 insertions(+), 13 deletions(-)

create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.c create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.h

base-commit: a6c0a91ccb257eaec2aee080df06863ce7601315

Signature · 3 lines
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
maintainer
#22 lore raw

Le 18/07/2025 à 15:03, Marius Vlad a écrit :

Quoted 7 lines

Hi,

FWIW, we (Weston) also use vkms in CI and we have in plan to make use of these changes to exercise some internal code paths and enhance our tests. Look forward to getting these into the tree and have it a in release. We tend to follow with a branch/stable release so I suppose that's going be a while. Just wanted to also say thanks a lot for driving this.

Hi,

Thanks a lot for this positive feedback!

Quoted 7 lines

Just curios, in the current form would it be possible to configure the plane's zpos position? Apart from testing underlay/overlay in the same time, some drivers today allows the primary to be independently positioned. Simulating these type of configurations would allow see what architectural changes we might need to do to transition towards a place where we can use any other plane as a (fallback) compositing one like we do today with the primary one.

Currently nothing is done to do a proper z-pos managment, and even worse: the z-order is not really predictable (order of creation in configfs, so if userspace creates cursor-primary, the cursor will be behind the primary plane).

We need to change this before merging ConfigFS. Fir the first iteration, we can simply: make primary plane always at the back (zpos=0), overlay with undefined ordering (zpos=1), cursor on top (zpos=2) directly in vkms_plane_init. I need to check if this will be a uAPI break if we add later some configfs attributes like default_zpos / zpos_min / zpos_max.

Even with this, we need to fix [1] to compose planes in the correct order (I don't think this is broken right now because we create primary then overlays then cursor, so the composition order will be correct).

[1]:https://elixir.bootlin.com/linux/v6.15.6/source/drivers/gpu/drm/vkms/vkms_composer.c#L392-L394

@José, I will fix the vkms_composer to use plane->state->zpos or normalized_zpos.

Thanks a lot for this suggestion which showed a flaw in the current implementation!

Louis Chauvet

Quoted 133 lines · Louis Chauvet
Quoted 132 lines

+CC: Mark (Google), Sebastian (Mutter), Xaver (KWin), Victoria (Cosmic)

Hi everyone,

Last week, I presented this work at the Display Next Hackfest, and the feedback from compositors was very positive. At least KWin, Mutter, and Cosmic are interested in integrating it into their tests, so it would be great if someone could review it.

Sebastian quickly tested this work (using [2] for full features) with their existing VKMS tests [1], and it worked. From what I understand, the tests are quite basic —just sanity checks— but we were able to reproduce the default vkms device using ConfigFS.

If another compositor wants to test the ConfigFS interface (I will try to keep [2] updated), that would be amazing. Feel free to send feedback!

A small note: This series has a minor conflict since the conversion to the faux device, but it can be applied using b4 am -3 ... && git am -3 .... @josé, if you send a new iteration, can you add [email protected] in copy, and maybe Sebastian, Xaver, Victoria if they want to follow the upstreaming?

Thank you,
Louis Chauvet

[1]:https://gitlab.gnome.org/swick/mutter/-/commit/88a7354942d9728dae06fb83cc4f2d2c7b08b694 [2]:https://github.com/Fomys/linux/tree/configfs-everything

Le 07/05/2025 à 15:54, José Expósito a écrit :

Quoted 94 lines

Hi everyone,

This series allow to configure one or more VKMS instances without having to reload the driver using configfs.

The series is structured in 3 blocks:

- Patches 1..11: Basic device configuration. For simplicity, I kept the available options as minimal as possible.

- Patches 12 and 13: New option to skip the default device creation and to-do cleanup.

- Patches 14, 15 and 16: Allow to hot-plug and unplug connectors. This is not part of the minimal set of options, but I included in this series so it can be used as a template/example of how new configurations can be added.

The process of configuring a VKMS device is documented in "vkms.rst".

Finally, the code is thoroughly tested by a collection of IGT tests [1].

Best wishes,
José Expósito

[1] https://lists.freedesktop.org/archives/igt-dev/2025-February/086071.html

Changes in v5:

- Added Reviewed-by tags, thanks Louis!
- Rebased on top of drm-misc-next
- Link to v4: https://lore.kernel.org/dri-devel/[email protected]/

Changes in v4:

- Since Louis and I worked on this together, set him as the author of some of the patches and me as co-developed-by to reflect this joint effort.
- Rebased on top of drm-misc-next
- Link to v3: https://lore.kernel.org/all/[email protected]/

Changes in v3:

- Applied review comments by Louis Chauvet: (thanks!!)
- Use scoped_guard() instead of guard(mutex)(...)
- Fix a use-after-free error in the connector hot-plug code
- Rebased on top of drm-misc-next
- Link to v2: https://lore.kernel.org/all/[email protected]/

Changes in v2:

- Applied review comments by Louis Chauvet:
- Use guard(mutex)(...) instead of lock/unlock
- Return -EBUSY when trying to modify a enabled device
- Move the connector hot-plug related patches to the end
- Rebased on top of drm-misc-next
- Link to v1: https://lore.kernel.org/dri-devel/[email protected]/T/

José Expósito (6):
drm/vkms: Expose device creation and destruction drm/vkms: Allow to configure the default device creation drm/vkms: Remove completed task from the TODO list drm/vkms: Allow to configure connector status drm/vkms: Allow to update the connector status drm/vkms: Allow to configure connector status via configfs

Louis Chauvet (10):
drm/vkms: Add and remove VKMS instances via configfs drm/vkms: Allow to configure multiple planes via configfs drm/vkms: Allow to configure the plane type via configfs drm/vkms: Allow to configure multiple CRTCs via configfs drm/vkms: Allow to configure CRTC writeback support via configfs drm/vkms: Allow to attach planes and CRTCs via configfs drm/vkms: Allow to configure multiple encoders via configfs drm/vkms: Allow to attach encoders and CRTCs via configfs drm/vkms: Allow to configure multiple connectors via configfs drm/vkms: Allow to attach connectors and encoders via configfs

   Documentation/gpu/vkms.rst                    | 100 ++-
   drivers/gpu/drm/vkms/Kconfig                  |   1 +
   drivers/gpu/drm/vkms/Makefile                 |   3 +-
   drivers/gpu/drm/vkms/tests/vkms_config_test.c |  24 +
   drivers/gpu/drm/vkms/vkms_config.c            |   8 +-
   drivers/gpu/drm/vkms/vkms_config.h            |  26 +
   drivers/gpu/drm/vkms/vkms_configfs.c          | 833 ++++++++++++++++++
   drivers/gpu/drm/vkms/vkms_configfs.h          |   8 +
   drivers/gpu/drm/vkms/vkms_connector.c         |  35 +
   drivers/gpu/drm/vkms/vkms_connector.h         |   9 +
   drivers/gpu/drm/vkms/vkms_drv.c               |  18 +-
   drivers/gpu/drm/vkms/vkms_drv.h               |  20 +
   12 files changed, 1072 insertions(+), 13 deletions(-)

create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.c create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.h

base-commit: a6c0a91ccb257eaec2aee080df06863ce7601315

Signature · 3 lines
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Signature · 3 lines
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#23 lore raw

Hi everyone,

Quoted 23 lines · Louis Chauvet

Le 18/07/2025 à 15:03, Marius Vlad a écrit :

Quoted 7 lines

Hi,

FWIW, we (Weston) also use vkms in CI and we have in plan to make use of these changes to exercise some internal code paths and enhance our tests. Look forward to getting these into the tree and have it a in release. We tend to follow with a branch/stable release so I suppose that's going be a while. Just wanted to also say thanks a lot for driving this.

Hi,

Thanks a lot for this positive feedback!

Quoted 7 lines

Just curios, in the current form would it be possible to configure the plane's zpos position? Apart from testing underlay/overlay in the same time, some drivers today allows the primary to be independently positioned. Simulating these type of configurations would allow see what architectural changes we might need to do to transition towards a place where we can use any other plane as a (fallback) compositing one like we do today with the primary one.

Quoted 4 lines

Currently nothing is done to do a proper z-pos managment, and even worse:
the z-order is not really predictable (order of creation in configfs, so if userspace creates cursor-primary, the cursor will be behind the primary plane).

Back from holiday and catching up on email.

First, thanks for presenting this in the Display Next Hackfest :D I couldn't attend, is there a link to the presentation?

Back to zpos, as far as I can tell, we do not expose this property at the moment for any plane type.

3 years ago I sent a patch adding the property and blending following the zpos order, but it wasn't merged:
https://github.com/JoseExposito/linux/commit/befc79a1341b27eb328b582c3841097d17ccce71

Code has changed since then, but we might be able to reuse some bits. CC me if you send a patch and I'll review it :)

Quoted 5 lines

We need to change this before merging ConfigFS. Fir the first iteration, we can simply: make primary plane always at the back (zpos=0), overlay with undefined ordering (zpos=1), cursor on top (zpos=2) directly in vkms_plane_init. I need to check if this will be a uAPI break if we add later some configfs attributes like default_zpos / zpos_min / zpos_max.

If we don't set the zpos at the moment, I don't think we need to add it before configfs. I'd prefer to merge configfs as it is and then support zpos both in the default VKMS device and in the custom ones. In this way, we might avoid unexpected user-space changes.

Anyway, this is something we can discuss in the series adding zpos rather than here.

Quoted 8 lines

Even with this, we need to fix [1] to compose planes in the correct order (I don't think this is broken right now because we create primary then overlays then cursor, so the composition order will be correct).

[1]:https://elixir.bootlin.com/linux/v6.15.6/source/drivers/gpu/drm/vkms/vkms_composer.c#L392-L394

@José, I will fix the vkms_composer to use plane->state->zpos or normalized_zpos.

Check my patch, it is already done. But for the configs code we might need a different solution.

Thanks to everyone for your interest in this series, José Expósito

Quoted 144 lines

Thanks a lot for this suggestion which showed a flaw in the current implementation!

Louis Chauvet

Quoted 133 lines · Louis Chauvet
Quoted 132 lines

+CC: Mark (Google), Sebastian (Mutter), Xaver (KWin), Victoria (Cosmic)

Hi everyone,

Last week, I presented this work at the Display Next Hackfest, and the feedback from compositors was very positive. At least KWin, Mutter, and Cosmic are interested in integrating it into their tests, so it would be great if someone could review it.

Sebastian quickly tested this work (using [2] for full features) with their existing VKMS tests [1], and it worked. From what I understand, the tests are quite basic —just sanity checks— but we were able to reproduce the default vkms device using ConfigFS.

If another compositor wants to test the ConfigFS interface (I will try to keep [2] updated), that would be amazing. Feel free to send feedback!

A small note: This series has a minor conflict since the conversion to the faux device, but it can be applied using b4 am -3 ... && git am -3 .... @josé, if you send a new iteration, can you add [email protected] in copy, and maybe Sebastian, Xaver, Victoria if they want to follow the upstreaming?

Thank you,
Louis Chauvet

[1]:https://gitlab.gnome.org/swick/mutter/-/commit/88a7354942d9728dae06fb83cc4f2d2c7b08b694 [2]:https://github.com/Fomys/linux/tree/configfs-everything

Le 07/05/2025 à 15:54, José Expósito a écrit :

Quoted 94 lines

Hi everyone,

This series allow to configure one or more VKMS instances without having to reload the driver using configfs.

The series is structured in 3 blocks:

- Patches 1..11: Basic device configuration. For simplicity, I kept the available options as minimal as possible.

- Patches 12 and 13: New option to skip the default device creation and to-do cleanup.

- Patches 14, 15 and 16: Allow to hot-plug and unplug connectors. This is not part of the minimal set of options, but I included in this series so it can be used as a template/example of how new configurations can be added.

The process of configuring a VKMS device is documented in "vkms.rst".

Finally, the code is thoroughly tested by a collection of IGT tests [1].

Best wishes,
José Expósito

[1] https://lists.freedesktop.org/archives/igt-dev/2025-February/086071.html

Changes in v5:

- Added Reviewed-by tags, thanks Louis!
- Rebased on top of drm-misc-next
- Link to v4: https://lore.kernel.org/dri-devel/[email protected]/

Changes in v4:

- Since Louis and I worked on this together, set him as the author of some of the patches and me as co-developed-by to reflect this joint effort.
- Rebased on top of drm-misc-next
- Link to v3: https://lore.kernel.org/all/[email protected]/

Changes in v3:

- Applied review comments by Louis Chauvet: (thanks!!)
- Use scoped_guard() instead of guard(mutex)(...)
- Fix a use-after-free error in the connector hot-plug code
- Rebased on top of drm-misc-next
- Link to v2: https://lore.kernel.org/all/[email protected]/

Changes in v2:

- Applied review comments by Louis Chauvet:
- Use guard(mutex)(...) instead of lock/unlock
- Return -EBUSY when trying to modify a enabled device
- Move the connector hot-plug related patches to the end
- Rebased on top of drm-misc-next
- Link to v1: https://lore.kernel.org/dri-devel/[email protected]/T/

José Expósito (6):
drm/vkms: Expose device creation and destruction drm/vkms: Allow to configure the default device creation drm/vkms: Remove completed task from the TODO list drm/vkms: Allow to configure connector status drm/vkms: Allow to update the connector status drm/vkms: Allow to configure connector status via configfs

Louis Chauvet (10):
drm/vkms: Add and remove VKMS instances via configfs drm/vkms: Allow to configure multiple planes via configfs drm/vkms: Allow to configure the plane type via configfs drm/vkms: Allow to configure multiple CRTCs via configfs drm/vkms: Allow to configure CRTC writeback support via configfs drm/vkms: Allow to attach planes and CRTCs via configfs drm/vkms: Allow to configure multiple encoders via configfs drm/vkms: Allow to attach encoders and CRTCs via configfs drm/vkms: Allow to configure multiple connectors via configfs drm/vkms: Allow to attach connectors and encoders via configfs

   Documentation/gpu/vkms.rst                    | 100 ++-
   drivers/gpu/drm/vkms/Kconfig                  |   1 +
   drivers/gpu/drm/vkms/Makefile                 |   3 +-
   drivers/gpu/drm/vkms/tests/vkms_config_test.c |  24 +
   drivers/gpu/drm/vkms/vkms_config.c            |   8 +-
   drivers/gpu/drm/vkms/vkms_config.h            |  26 +
   drivers/gpu/drm/vkms/vkms_configfs.c          | 833 ++++++++++++++++++
   drivers/gpu/drm/vkms/vkms_configfs.h          |   8 +
   drivers/gpu/drm/vkms/vkms_connector.c         |  35 +
   drivers/gpu/drm/vkms/vkms_connector.h         |   9 +
   drivers/gpu/drm/vkms/vkms_drv.c               |  18 +-
   drivers/gpu/drm/vkms/vkms_drv.h               |  20 +
   12 files changed, 1072 insertions(+), 13 deletions(-)

create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.c create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.h

base-commit: a6c0a91ccb257eaec2aee080df06863ce7601315

Signature · 3 lines
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Signature · 3 lines
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com