drm/vkms: Allow to configure device
Subsystems (4)
v4 cover drm/vkms: Allow to configure device
Hi everyone,
In preparation for ConfigFS support, a flexible way to configure VKMS device(s) is required.
This series adds the required APIs to create a configuration, the code changes required to apply it and KUnit test validating the changes.
Louis Chauvet and I are working on ConfigFS support. In this series I tried to merge his changes [1] with mine [2].
I kept his Signed-off-by to reflect that, even if I show up as the author of some/most of the patches, this was a joint effort.
I'll send the ConfigFS code [3] and its IGT tests [4] code this week. Meanwhile, the IGT tests also exercise this series and can be used for additional test coverage.
Best wishes,
José Expósito
[1] https://patchwork.kernel.org/project/dri-devel/cover/20250121-google-remove-crtc-index-from-parameter-v3-0-cac00a3c3544@bootlin.com/
[2] https://patchwork.kernel.org/project/dri-devel/cover/[email protected]/
[3] https://github.com/JoseExposito/linux/commits/patch-vkms-configfs/
[4] https://gitlab.freedesktop.org/jexposit/igt-gpu-tools/-/commits/vkms-configfs
Changes in v4:
- Applied review comments by Louis Chauvet: (thanks!!)
- Do not access "private" struct fields in tests
- Reviewed-by in all patches
- Rebased on top of drm-misc-next
- Link to v3: https://lore.kernel.org/dri-devel/[email protected]/T/
Changes in v3:
- Applied review comments by Louis Chauvet:
- Moved drm_vblank_init(..., vkms_config_get_num_crtcs()) to a different patch
- Improved error handling in vkms_config_*_attach_*() functions
- Fixed compilation errors when CONFIG_DRM_VKMS_KUNIT_TEST=m
- Used for_each iterators in vkms_config_test_default_config(). A leftover from the removed connector hot-add code
- Validated that vkms_config.dev wasn't NULL before calling drm_info()
- Kept vkms_device.config as a const pointer (at the cost of casting in list_count_nodes())
- Renamed "CONFIG_DRM_VKMS_KUNIT_TESTS" to "CONFIG_DRM_VKMS_KUNIT_TEST" for consistency with other options
- 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:
- Added Co-developped-by tags where required
- Split the first patch in 2: vkms_connector.h/c creation and struct vkms_connector creation
- Fixes a user after free/double free bug. The bug is already present
in drm-misc-next and the fix could be merged independently
- Implemented for_each macros for the config
- Other naming fixes
- Link to v1: https://lore.kernel.org/all/[email protected]/
José Expósito (13):
drm/vkms: Extract vkms_connector header drm/vkms: Create vkms_connector struct
drm/vkms: Add KUnit test scaffolding
drm/vkms: Extract vkms_config header
drm/vkms: Move default_config creation to its own function drm/vkms: Set device name from vkms_config drm/vkms: Allow to configure multiple planes drm/vkms: Allow to configure multiple CRTCs drm/vkms: Allow to attach planes and CRTCs drm/vkms: Allow to configure multiple encoders drm/vkms: Allow to attach encoders and CRTCs drm/vkms: Allow to configure multiple connectors drm/vkms: Allow to attach connectors and encoders
Louis Chauvet (1):
drm/vkms: Add a validation function for VKMS configuration
.clang-format | 7 + drivers/gpu/drm/vkms/Kconfig | 15 + drivers/gpu/drm/vkms/Makefile | 5 +- drivers/gpu/drm/vkms/tests/.kunitconfig | 4 + drivers/gpu/drm/vkms/tests/Makefile | 3 + drivers/gpu/drm/vkms/tests/vkms_config_test.c | 951 ++++++++++++++++++ drivers/gpu/drm/vkms/vkms_config.c | 640 ++++++++++++ drivers/gpu/drm/vkms/vkms_config.h | 437 ++++++++ drivers/gpu/drm/vkms/vkms_connector.c | 61 ++ drivers/gpu/drm/vkms/vkms_connector.h | 26 + drivers/gpu/drm/vkms/vkms_drv.c | 45 +- drivers/gpu/drm/vkms/vkms_drv.h | 17 +- drivers/gpu/drm/vkms/vkms_output.c | 176 ++-- 13 files changed, 2246 insertions(+), 141 deletions(-) create mode 100644 drivers/gpu/drm/vkms/tests/.kunitconfig create mode 100644 drivers/gpu/drm/vkms/tests/Makefile create mode 100644 drivers/gpu/drm/vkms/tests/vkms_config_test.c create mode 100644 drivers/gpu/drm/vkms/vkms_config.c create mode 100644 drivers/gpu/drm/vkms/vkms_config.h create mode 100644 drivers/gpu/drm/vkms/vkms_connector.c create mode 100644 drivers/gpu/drm/vkms/vkms_connector.h
Signature · 1 line
2.48.1
PATCH v4 1/14 drm/vkms: Extract vkms_connector header
Up until now, the logic to manage connectors was in vkms_output.c.
Since more options will be added to connectors in the future, extract the code to its own file.
Refactor, no functional changes.
--- drivers/gpu/drm/vkms/Makefile | 3 +- drivers/gpu/drm/vkms/vkms_connector.c | 50 +++++++++++++++++++++++++++ drivers/gpu/drm/vkms/vkms_connector.h | 17 +++++++++ drivers/gpu/drm/vkms/vkms_output.c | 41 +++------------------- 4 files changed, 73 insertions(+), 38 deletions(-) create mode 100644 drivers/gpu/drm/vkms/vkms_connector.c create mode 100644 drivers/gpu/drm/vkms/vkms_connector.h
drivers/gpu/drm/vkms/Makefile +2 -1
@@ -6,6 +6,7 @@ vkms-y := \ vkms_formats.o \ vkms_crtc.o \ vkms_composer.o \ - vkms_writeback.o + vkms_writeback.o \ + vkms_connector.o obj-$(CONFIG_DRM_VKMS) += vkms.o
drivers/gpu/drm/vkms/vkms_connector.c new file +50 -0
50 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_connector.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef _VKMS_CONNECTOR_H_ +#define _VKMS_CONNECTOR_H_ + +#include "vkms_drv.h" + +/** +* vkms_connector_init() - Initialize a connector +* @vkmsdev: VKMS device containing the connector +* +* Returns: +* The connector or an error on failure. +*/ +struct drm_connector *vkms_connector_init (struct vkms_device *vkmsdev); + +#endif /* _VKMS_CONNECTOR_H_ */
drivers/gpu/drm/vkms/vkms_output.c +4 -37
57 lines not on this page · raw message
Signature · 1 line
2.48.1
PATCH v4 2/14 drm/vkms: Create vkms_connector struct
In reply to José ExpósitoCreate a structure wrapping the drm_connector.
--- drivers/gpu/drm/vkms/vkms_connector.c | 8 ++++---- drivers/gpu/drm/vkms/vkms_connector.h | 11 ++++++++++- drivers/gpu/drm/vkms/vkms_output.c | 4 ++-- 3 files changed, 16 insertions(+), 7 deletions(-)
drivers/gpu/drm/vkms/vkms_connector.c +4 -4
@@ -29,22 +29,22 @@ static const struct drm_connector_helper_funcs vkms_conn_helper_funcs = { .get_modes = vkms_conn_get_modes, }; -struct drm_connector *vkms_connector_init (struct vkms_device *vkmsdev) +struct vkms_connector *vkms_connector_init (struct vkms_device *vkmsdev) {struct drm_device *dev = &vkmsdev->drm; -struct drm_connector *connector; +struct vkms_connector *connector;int ret; connector =drmm_kzalloc (dev,sizeof (*connector),GFP_KERNEL );if (!connector)return ERR_PTR (-ENOMEM ); - ret =drmm_connector_init (dev, connector, &vkms_connector_funcs, + ret =drmm_connector_init (dev, &connector->base, &vkms_connector_funcs,DRM_MODE_CONNECTOR_VIRTUAL ,NULL );if (ret)return ERR_PTR (ret); -drm_connector_helper_add (connector, &vkms_conn_helper_funcs); +drm_connector_helper_add (&connector->base, &vkms_conn_helper_funcs);return connector; }
drivers/gpu/drm/vkms/vkms_connector.h +10 -1
@@ -5,6 +5,15 @@#include "vkms_drv.h" +/** +* struct vkms_connector - VKMS custom type wrapping around the DRM connector +* +* @drm: Base DRM connector +*/ +struct vkms_connector { +struct drm_connector base; +}; +/** * vkms_connector_init() - Initialize a connector * @vkmsdev: VKMS device containing the connector
@@ -12,6 +21,6 @@* Returns: * The connector or an error on failure. */ -struct drm_connector *vkms_connector_init (struct vkms_device *vkmsdev); +struct vkms_connector *vkms_connector_init (struct vkms_device *vkmsdev);#endif /* _VKMS_CONNECTOR_H_ */
drivers/gpu/drm/vkms/vkms_output.c +2 -2
@@ -7,7 +7,7 @@int vkms_output_init (struct vkms_device *vkmsdev) {struct drm_device *dev = &vkmsdev->drm; -struct drm_connector *connector; +struct vkms_connector *connector;struct drm_encoder *encoder;struct vkms_output *output;struct vkms_plane *primary, *overlay, *cursor =NULL ;
@@ -69,7 +69,7 @@ int vkms_output_init(struct vkms_device *vkmsdev) encoder->possible_crtcs =drm_crtc_mask (&output->crtc);/* Attach the encoder and the connector */ - ret =drm_connector_attach_encoder (connector, encoder); + ret =drm_connector_attach_encoder (&connector->base, encoder);if (ret) {DRM_ERROR ("Failed to attach connector to encoder\n" );return ret;
Signature · 1 line
2.48.1
PATCH v4 3/14 drm/vkms: Add KUnit test scaffolding
In reply to José ExpósitoAdd the required boilerplate to start creating KUnit test.
To run the tests:
$ ./tools/testing/kunit/kunit.py run \
--kunitconfig=drivers/gpu/drm/vkms/tests--- drivers/gpu/drm/vkms/Kconfig | 15 +++++++++++++++ drivers/gpu/drm/vkms/Makefile | 1 + drivers/gpu/drm/vkms/tests/.kunitconfig | 4 ++++ drivers/gpu/drm/vkms/tests/Makefile | 3 +++ drivers/gpu/drm/vkms/tests/vkms_config_test.c | 19 +++++++++++++++++++ 5 files changed, 42 insertions(+) create mode 100644 drivers/gpu/drm/vkms/tests/.kunitconfig create mode 100644 drivers/gpu/drm/vkms/tests/Makefile create mode 100644 drivers/gpu/drm/vkms/tests/vkms_config_test.c
drivers/gpu/drm/vkms/Kconfig +15 -0
@@ -14,3 +14,18 @@ config DRM_VKMS a VKMS. If M is selected the module will be called vkms. + +config DRM_VKMS_KUNIT_TEST + tristate "KUnit tests for VKMS" if !KUNIT_ALL_TESTS + depends on DRM_VKMS && KUNIT + default KUNIT_ALL_TESTS + help + This builds unit tests for VKMS. This option is not useful for + distributions or general kernels, but only for kernel + developers working on VKMS. + + For more information on KUnit and unit tests in general, + please refer to the KUnit documentation in + Documentation/dev-tools/kunit/. + + If in doubt, say "N".
drivers/gpu/drm/vkms/Makefile +1 -0
@@ -10,3 +10,4 @@ vkms-y := \ vkms_connector.o obj-$(CONFIG_DRM_VKMS) += vkms.o +obj-$(CONFIG_DRM_VKMS_KUNIT_TEST) += tests/
drivers/gpu/drm/vkms/tests/.kunitconfig new file +4 -0
@@ -0,0 +1,4 @@ +CONFIG_KUNIT=y +CONFIG_DRM=y +CONFIG_DRM_VKMS=y +CONFIG_DRM_VKMS_KUNIT_TEST=y
drivers/gpu/drm/vkms/tests/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only + +obj-$(CONFIG_DRM_VKMS_KUNIT_TEST) += vkms_config_test.o
drivers/gpu/drm/vkms/tests/vkms_config_test.c new file +19 -0
@@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include <kunit/test.h> + +MODULE_IMPORT_NS ("EXPORTED_FOR_KUNIT_TESTING" ); + +static struct kunit_case vkms_config_test_cases[] = { + {} +}; + +static struct kunit_suite vkms_config_test_suite = { + .name ="vkms-config" , + .test_cases = vkms_config_test_cases, +}; + +kunit_test_suite (vkms_config_test_suite); + +MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Kunit test for vkms config utility" );
Signature · 1 line
2.48.1
PATCH v4 4/14 drm/vkms: Extract vkms_config header
In reply to José ExpósitoCreating a new vkms_config structure will be more complex once we start adding more options.
Extract the vkms_config structure to its own header and source files and add functions to create and delete a vkms_config and to initialize debugfs.
Refactor, no functional changes.
--- drivers/gpu/drm/vkms/Makefile | 3 +- drivers/gpu/drm/vkms/tests/vkms_config_test.c | 13 +++++ drivers/gpu/drm/vkms/vkms_config.c | 50 +++++++++++++++++++ drivers/gpu/drm/vkms/vkms_config.h | 47 +++++++++++++++++ drivers/gpu/drm/vkms/vkms_drv.c | 34 +++---------- drivers/gpu/drm/vkms/vkms_drv.h | 15 +----- drivers/gpu/drm/vkms/vkms_output.c | 1 + 7 files changed, 121 insertions(+), 42 deletions(-) create mode 100644 drivers/gpu/drm/vkms/vkms_config.c create mode 100644 drivers/gpu/drm/vkms/vkms_config.h
drivers/gpu/drm/vkms/Makefile +2 -1
@@ -7,7 +7,8 @@ vkms-y := \ vkms_crtc.o \ vkms_composer.o \ vkms_writeback.o \ - vkms_connector.o + vkms_connector.o \ + vkms_config.o obj-$(CONFIG_DRM_VKMS) += vkms.o obj-$(CONFIG_DRM_VKMS_KUNIT_TEST) += tests/
drivers/gpu/drm/vkms/tests/vkms_config_test.c +13 -0
@@ -2,9 +2,22 @@#include <kunit/test.h> +#include "../vkms_config.h" +MODULE_IMPORT_NS ("EXPORTED_FOR_KUNIT_TESTING" ); +static void vkms_config_test_empty_config (struct kunit *test) +{ +struct vkms_config *config; + + config =vkms_config_create (); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, config); + +vkms_config_destroy (config); +} +static struct kunit_case vkms_config_test_cases[] = { +KUNIT_CASE (vkms_config_test_empty_config), {} };
drivers/gpu/drm/vkms/vkms_config.c new file +50 -0
50 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_config.h new file +47 -0
47 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_drv.c +7 -27
@@ -27,11 +27,9 @@#include <drm/drm_gem_shmem_helper.h> #include <drm/drm_vblank.h> +#include "vkms_config.h" #include "vkms_drv.h" -#include <drm/drm_print.h> -#include <drm/drm_debugfs.h> -#define DRIVER_NAME "vkms"#define DRIVER_DESC "Virtual Kernel Mode Setting"#define DRIVER_MAJOR 1
@@ -81,23 +79,6 @@ static void vkms_atomic_commit_tail(struct drm_atomic_state *old_state)drm_atomic_helper_cleanup_planes (dev, old_state); } -static int vkms_config_show (struct seq_file *m,void *data) -{ -struct drm_debugfs_entry *entry = m->private; -struct drm_device *dev = entry->dev; -struct vkms_device *vkmsdev =drm_device_to_vkms_device (dev); - -seq_printf (m,"writeback=%d\n" , vkmsdev->config->writeback); -seq_printf (m,"cursor=%d\n" , vkmsdev->config->cursor); -seq_printf (m,"overlay=%d\n" , vkmsdev->config->overlay); - -return 0 ; -} - -static const struct drm_debugfs_info vkms_config_debugfs_list[] = { - {"vkms_config" , vkms_config_show,0 }, -}; -static const struct drm_driver vkms_driver = { .driver_features =DRIVER_MODESET |DRIVER_ATOMIC |DRIVER_GEM , .fops = &vkms_driver_fops,
@@ -208,8 +189,7 @@ static int vkms_create(struct vkms_config *config)if (ret) goto out_devres; -drm_debugfs_add_files (&vkms_device->drm, vkms_config_debugfs_list, -ARRAY_SIZE (vkms_config_debugfs_list)); +vkms_config_register_debugfs (vkms_device); ret =drm_dev_register (&vkms_device->drm,0 );if (ret)
@@ -231,9 +211,9 @@ static int __init vkms_init(void)int ret;struct vkms_config *config; - config =kmalloc (sizeof (*config),GFP_KERNEL ); -if (!config) -return -ENOMEM ; + config =vkms_config_create (); +if (IS_ERR (config)) +return PTR_ERR (config); config->cursor = enable_cursor; config->writeback = enable_writeback;
@@ -241,7 +221,7 @@ static int __init vkms_init(void) ret =vkms_create (config);if (ret) { -kfree (config); +vkms_config_destroy (config);return ret; }
@@ -275,7 +255,7 @@ static void __exit vkms_exit(void)return ;vkms_destroy (default_config); -kfree (default_config); +vkms_config_destroy (default_config); }module_init (vkms_init);
drivers/gpu/drm/vkms/vkms_drv.h +1 -14
@@ -189,20 +189,7 @@ struct vkms_output {spinlock_t composer_lock; }; -/** -* struct vkms_config - General configuration for VKMS driver -* -* @writeback: If true, a writeback buffer can be attached to the CRTC -* @cursor: If true, a cursor plane is created in the VKMS device -* @overlay: If true, NUM_OVERLAY_PLANES will be created for the VKMS device -* @dev: Used to store the current VKMS device. Only set when the device is instantiated. -*/ -struct vkms_config { -bool writeback; -bool cursor; -bool overlay; -struct vkms_device *dev; -}; +struct vkms_config ;/** * struct vkms_device - Description of a VKMS device
drivers/gpu/drm/vkms/vkms_output.c +1 -0
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0+ +#include "vkms_config.h" #include "vkms_connector.h" #include "vkms_drv.h" #include <drm/drm_managed.h>
Signature · 1 line
2.48.1
PATCH v4 5/14 drm/vkms: Move default_config creation to its own function
In reply to José ExpósitoExtract the initialization of the default configuration to a function. Refactor, no functional changes.
--- drivers/gpu/drm/vkms/tests/vkms_config_test.c | 38 +++++++++++++++++++ drivers/gpu/drm/vkms/vkms_config.c | 18 +++++++++ drivers/gpu/drm/vkms/vkms_config.h | 14 +++++++ drivers/gpu/drm/vkms/vkms_drv.c | 6 +-- 4 files changed, 71 insertions(+), 5 deletions(-)
drivers/gpu/drm/vkms/tests/vkms_config_test.c +38 -0
@@ -6,6 +6,12 @@MODULE_IMPORT_NS ("EXPORTED_FOR_KUNIT_TESTING" ); +struct default_config_case { +bool enable_cursor; +bool enable_writeback; +bool enable_overlay; +}; +static void vkms_config_test_empty_config (struct kunit *test) {struct vkms_config *config;
@@ -16,8 +22,40 @@ static void vkms_config_test_empty_config(struct kunit *test)vkms_config_destroy (config); } +static struct default_config_case default_config_cases[] = { + { false, false, false }, + { true, false, false }, + { true, true, false }, + { true, false, true }, + { false, true, false }, + { false, true, true }, + { false, false, true }, + { true, true, true }, +}; + +KUNIT_ARRAY_PARAM (default_config, default_config_cases,NULL ); + +static void vkms_config_test_default_config (struct kunit *test) +{ +const struct default_config_case *params = test->param_value; +struct vkms_config *config; + + config =vkms_config_default_create (params->enable_cursor, + params->enable_writeback, + params->enable_overlay); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, config); + +KUNIT_EXPECT_EQ (test, config->cursor, params->enable_cursor); +KUNIT_EXPECT_EQ (test, config->writeback, params->enable_writeback); +KUNIT_EXPECT_EQ (test, config->overlay, params->enable_overlay); + +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, + default_config_gen_params), {} };
drivers/gpu/drm/vkms/vkms_config.c +18 -0
@@ -20,6 +20,24 @@ struct vkms_config *vkms_config_create(void) }EXPORT_SYMBOL_IF_KUNIT (vkms_config_create); +struct vkms_config *vkms_config_default_create (bool enable_cursor, +bool enable_writeback, +bool enable_overlay) +{ +struct vkms_config *config; + + config =vkms_config_create (); +if (IS_ERR (config)) +return config; + + config->cursor = enable_cursor; + config->writeback = enable_writeback; + config->overlay = enable_overlay; + +return config; +} +EXPORT_SYMBOL_IF_KUNIT (vkms_config_default_create); +void vkms_config_destroy (struct vkms_config *config) {kfree (config);
drivers/gpu/drm/vkms/vkms_config.h +14 -0
@@ -31,6 +31,20 @@ struct vkms_config {*/ struct vkms_config *vkms_config_create (void ); +/** +* vkms_config_default_create() - Create the configuration for the default device +* @enable_cursor: Create or not a cursor plane +* @enable_writeback: Create or not a writeback connector +* @enable_overlay: Create or not overlay planes +* +* Returns: +* The default vkms_config or an error. Call vkms_config_destroy() to free the +* returned configuration. +*/ +struct vkms_config *vkms_config_default_create (bool enable_cursor, +bool enable_writeback, +bool enable_overlay); +/** * vkms_config_destroy() - Free a VKMS configuration * @config: vkms_config to free
drivers/gpu/drm/vkms/vkms_drv.c +1 -5
@@ -211,14 +211,10 @@ static int __init vkms_init(void)int ret;struct vkms_config *config; - config =vkms_config_create (); + config =vkms_config_default_create (enable_cursor, enable_writeback, enable_overlay);if (IS_ERR (config))return PTR_ERR (config); - config->cursor = enable_cursor; - config->writeback = enable_writeback; - config->overlay = enable_overlay; - ret =vkms_create (config);if (ret) {vkms_config_destroy (config);
Signature · 1 line
2.48.1
PATCH v4 6/14 drm/vkms: Set device name from vkms_config
In reply to José ExpósitoIn order to be able to create multiple devices, the device name needs to be unique.
Allow to set it in the VKMS configuration.
--- drivers/gpu/drm/vkms/tests/vkms_config_test.c | 7 ++++++- drivers/gpu/drm/vkms/vkms_config.c | 14 ++++++++++++-- drivers/gpu/drm/vkms/vkms_config.h | 18 +++++++++++++++++- drivers/gpu/drm/vkms/vkms_drv.c | 4 +++- drivers/gpu/drm/vkms/vkms_drv.h | 2 ++ 5 files changed, 40 insertions(+), 5 deletions(-)
drivers/gpu/drm/vkms/tests/vkms_config_test.c +6 -1
@@ -15,10 +15,15 @@ struct default_config_case {static void vkms_config_test_empty_config (struct kunit *test) {struct vkms_config *config; +const char *dev_name ="test" ; - config =vkms_config_create (); + config =vkms_config_create (dev_name);KUNIT_ASSERT_NOT_ERR_OR_NULL (test, config); +/* The dev_name string and the config have different lifetimes */ + dev_name =NULL ; +KUNIT_EXPECT_STREQ (test,vkms_config_get_device_name (config),"test" ); +vkms_config_destroy (config); }
drivers/gpu/drm/vkms/vkms_config.c +12 -2
@@ -8,7 +8,7 @@#include "vkms_config.h" -struct vkms_config *vkms_config_create (void ) +struct vkms_config *vkms_config_create (const char *dev_name) {struct vkms_config *config;
@@ -16,6 +16,12 @@ struct vkms_config *vkms_config_create(void)if (!config)return ERR_PTR (-ENOMEM ); + config->dev_name =kstrdup_const (dev_name,GFP_KERNEL ); +if (!config->dev_name) { +kfree (config); +return ERR_PTR (-ENOMEM ); + } +return config; }EXPORT_SYMBOL_IF_KUNIT (vkms_config_create);
@@ -26,7 +32,7 @@ struct vkms_config *vkms_config_default_create(bool enable_cursor, {struct vkms_config *config; - config =vkms_config_create (); + config =vkms_config_create (DEFAULT_DEVICE_NAME );if (IS_ERR (config))return config;
@@ -40,6 +46,7 @@ EXPORT_SYMBOL_IF_KUNIT(vkms_config_default_create);void vkms_config_destroy (struct vkms_config *config) { +kfree_const (config->dev_name);kfree (config); }EXPORT_SYMBOL_IF_KUNIT (vkms_config_destroy);
@@ -49,7 +56,10 @@ static int vkms_config_show(struct seq_file *m, void *data)struct drm_debugfs_entry *entry = m->private;struct drm_device *dev = entry->dev;struct vkms_device *vkmsdev =drm_device_to_vkms_device (dev); +const char *dev_name; + dev_name =vkms_config_get_device_name ((struct vkms_config *)vkmsdev->config); +seq_printf (m,"dev_name=%s\n" , dev_name);seq_printf (m,"writeback=%d\n" , vkmsdev->config->writeback);seq_printf (m,"cursor=%d\n" , vkmsdev->config->cursor);seq_printf (m,"overlay=%d\n" , vkmsdev->config->overlay);
drivers/gpu/drm/vkms/vkms_config.h +17 -1
@@ -10,12 +10,14 @@/** * struct vkms_config - General configuration for VKMS driver * +* @dev_name: Name of the device * @writeback: If true, a writeback buffer can be attached to the CRTC * @cursor: If true, a cursor plane is created in the VKMS device * @overlay: If true, NUM_OVERLAY_PLANES will be created for the VKMS device * @dev: Used to store the current VKMS device. Only set when the device is instantiated. */ struct vkms_config { +const char *dev_name;bool writeback;bool cursor;bool overlay;
@@ -24,12 +26,13 @@ struct vkms_config {/** * vkms_config_create() - Create a new VKMS configuration +* @dev_name: Name of the device * * Returns: * The new vkms_config or an error. Call vkms_config_destroy() to free the * returned configuration. */ -struct vkms_config *vkms_config_create (void ); +struct vkms_config *vkms_config_create (const char *dev_name);/** * vkms_config_default_create() - Create the configuration for the default device
@@ -51,6 +54,19 @@ struct vkms_config *vkms_config_default_create(bool enable_cursor,*/ void vkms_config_destroy (struct vkms_config *config); +/** +* vkms_config_get_device_name() - Return the name of the device +* @config: Configuration to get the device name from +* +* Returns: +* The device name. Only valid while @config is valid. +*/ +static inline const char * +vkms_config_get_device_name (struct vkms_config *config) +{ +return config->dev_name; +} +/** * vkms_config_register_debugfs() - Register a debugfs file to show the device's * configuration
drivers/gpu/drm/vkms/vkms_drv.c +3 -1
@@ -151,8 +151,10 @@ static int vkms_create(struct vkms_config *config)int ret;struct platform_device *pdev;struct vkms_device *vkms_device; +const char *dev_name; - pdev =platform_device_register_simple (DRIVER_NAME ,-1 ,NULL ,0 ); + dev_name =vkms_config_get_device_name (config); + pdev =platform_device_register_simple (dev_name,-1 ,NULL ,0 );if (IS_ERR (pdev))return PTR_ERR (pdev);
drivers/gpu/drm/vkms/vkms_drv.h +2 -0
@@ -12,6 +12,8 @@#include <drm/drm_encoder.h> #include <drm/drm_writeback.h> +#define DEFAULT_DEVICE_NAME "vkms" +#define XRES_MIN 10#define YRES_MIN 10
Signature · 1 line
2.48.1
PATCH v4 7/14 drm/vkms: Add a validation function for VKMS configuration
In reply to José ExpósitoFrom: Louis Chauvet <[email protected]>
As the configuration will be used by userspace, add a validator to avoid creating a broken DRM device.
For the moment, the function always returns true, but rules will be added in future patches.
--- drivers/gpu/drm/vkms/tests/vkms_config_test.c | 2 ++ drivers/gpu/drm/vkms/vkms_config.c | 6 ++++++ drivers/gpu/drm/vkms/vkms_config.h | 10 ++++++++++ drivers/gpu/drm/vkms/vkms_output.c | 3 +++ 4 files changed, 21 insertions(+)
drivers/gpu/drm/vkms/tests/vkms_config_test.c +2 -0
@@ -54,6 +54,8 @@ static void vkms_config_test_default_config(struct kunit *test)KUNIT_EXPECT_EQ (test, config->writeback, params->enable_writeback);KUNIT_EXPECT_EQ (test, config->overlay, params->enable_overlay); +KUNIT_EXPECT_TRUE (test,vkms_config_is_valid (config)); +vkms_config_destroy (config); }
drivers/gpu/drm/vkms/vkms_config.c +6 -0
@@ -51,6 +51,12 @@ void vkms_config_destroy(struct vkms_config *config) }EXPORT_SYMBOL_IF_KUNIT (vkms_config_destroy); +bool vkms_config_is_valid (const struct vkms_config *config) +{ +return true; +} +EXPORT_SYMBOL_IF_KUNIT (vkms_config_is_valid); +static int vkms_config_show (struct seq_file *m,void *data) {struct drm_debugfs_entry *entry = m->private;
drivers/gpu/drm/vkms/vkms_config.h +10 -0
@@ -67,6 +67,16 @@ vkms_config_get_device_name(struct vkms_config *config)return config->dev_name; } +/** +* vkms_config_is_valid() - Validate a configuration +* @config: Configuration to validate +* +* Returns: +* Whether the configuration is valid or not. +* For example, a configuration without primary planes is not valid. +*/ +bool vkms_config_is_valid (const struct vkms_config *config); +/** * vkms_config_register_debugfs() - Register a debugfs file to show the device's * configuration
drivers/gpu/drm/vkms/vkms_output.c +3 -0
@@ -16,6 +16,9 @@ int vkms_output_init(struct vkms_device *vkmsdev)int writeback;unsigned int n; +if (!vkms_config_is_valid (vkmsdev->config)) +return -EINVAL ; +/* * Initialize used plane. One primary plane is required to perform the composition. *
Signature · 1 line
2.48.1
PATCH v4 8/14 drm/vkms: Allow to configure multiple planes
In reply to José ExpósitoAdd a list of planes to vkms_config and create as many planes as configured during output initialization.
For backwards compatibility, add one primary plane and, if configured, one cursor plane and NUM_OVERLAY_PLANES planes to the default configuration.
--- .clang-format | 1 + drivers/gpu/drm/vkms/tests/vkms_config_test.c | 161 +++++++++++++++++- drivers/gpu/drm/vkms/vkms_config.c | 127 +++++++++++++- drivers/gpu/drm/vkms/vkms_config.h | 75 +++++++- drivers/gpu/drm/vkms/vkms_output.c | 42 ++--- 5 files changed, 370 insertions(+), 36 deletions(-)
.clang-format +1 -0
@@ -690,6 +690,7 @@ ForEachMacros: - 'v4l2_m2m_for_each_src_buf' - 'v4l2_m2m_for_each_src_buf_safe' - 'virtio_device_for_each_vq' + - 'vkms_config_for_each_plane' - 'while_for_each_ftrace_op' - 'xa_for_each' - 'xa_for_each_marked'
drivers/gpu/drm/vkms/tests/vkms_config_test.c +159 -2
193 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_config.c +123 -4
172 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_config.h +71 -4
99 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_output.c +16 -26
61 lines not on this page · raw message
Signature · 1 line
2.48.1
PATCH v4 9/14 drm/vkms: Allow to configure multiple CRTCs
In reply to José ExpósitoAdd a list of CRTCs to vkms_config and helper functions to add and remove as many CRTCs as wanted.
For backwards compatibility, add one CRTC to the default configuration.
A future patch will allow to attach planes and CRTCs, but for the moment there are no changes in the way the output is configured.
--- .clang-format | 1 + drivers/gpu/drm/vkms/tests/vkms_config_test.c | 83 ++++++++++++++++++- drivers/gpu/drm/vkms/vkms_config.c | 63 +++++++++++++- drivers/gpu/drm/vkms/vkms_config.h | 80 ++++++++++++++++++ 4 files changed, 222 insertions(+), 5 deletions(-)
.clang-format +1 -0
@@ -690,6 +690,7 @@ ForEachMacros: - 'v4l2_m2m_for_each_src_buf' - 'v4l2_m2m_for_each_src_buf_safe' - 'virtio_device_for_each_vq' + - 'vkms_config_for_each_crtc' - 'vkms_config_for_each_plane' - 'while_for_each_ftrace_op' - 'xa_for_each'
drivers/gpu/drm/vkms/tests/vkms_config_test.c +81 -2
132 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_config.c +60 -3
125 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_config.h +80 -0
114 lines not on this page · raw message
Signature · 1 line
2.48.1
PATCH v4 10/14 drm/vkms: Allow to attach planes and CRTCs
In reply to José ExpósitoAdd a list of possible CRTCs to the plane configuration and helpers to attach, detach and get the primary and cursor planes attached to a CRTC.
Now that the default configuration has its planes and CRTC correctly attached, configure the output following the configuration.
--- .clang-format | 1 + drivers/gpu/drm/vkms/tests/vkms_config_test.c | 222 ++++++++++++++++++ drivers/gpu/drm/vkms/vkms_config.c | 154 ++++++++++-- drivers/gpu/drm/vkms/vkms_config.h | 59 ++++- drivers/gpu/drm/vkms/vkms_drv.c | 3 +- drivers/gpu/drm/vkms/vkms_output.c | 51 ++-- 6 files changed, 454 insertions(+), 36 deletions(-)
.clang-format +1 -0
@@ -692,6 +692,7 @@ ForEachMacros: - 'virtio_device_for_each_vq' - 'vkms_config_for_each_crtc' - 'vkms_config_for_each_plane' + - 'vkms_config_plane_for_each_possible_crtc' - 'while_for_each_ftrace_op' - 'xa_for_each' - 'xa_for_each_marked'
drivers/gpu/drm/vkms/tests/vkms_config_test.c +222 -0
277 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_config.c +140 -14
236 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_config.h +57 -2
105 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_drv.c +2 -1
@@ -181,7 +181,8 @@ static int vkms_create(struct vkms_config *config) goto out_devres; } - ret =drm_vblank_init (&vkms_device->drm,1 ); + ret =drm_vblank_init (&vkms_device->drm, +vkms_config_get_num_crtcs (config));if (ret) {DRM_ERROR ("Failed to vblank\n" ); goto out_devres;
drivers/gpu/drm/vkms/vkms_output.c +32 -19
79 lines not on this page · raw message
Signature · 1 line
2.48.1
PATCH v4 11/14 drm/vkms: Allow to configure multiple encoders
In reply to José ExpósitoAdd a list of encoders to vkms_config and helper functions to add and remove as many encoders as wanted.
For backwards compatibility, add one encoder to the default configuration.
A future patch will allow to attach encoders and CRTCs, but for the moment there are no changes in the way the output is configured.
--- .clang-format | 1 + drivers/gpu/drm/vkms/tests/vkms_config_test.c | 94 +++++++++++++++++++ drivers/gpu/drm/vkms/vkms_config.c | 54 +++++++++++ drivers/gpu/drm/vkms/vkms_config.h | 46 +++++++++ 4 files changed, 195 insertions(+)
.clang-format +1 -0
@@ -691,6 +691,7 @@ ForEachMacros: - 'v4l2_m2m_for_each_src_buf_safe' - 'virtio_device_for_each_vq' - 'vkms_config_for_each_crtc' + - 'vkms_config_for_each_encoder' - 'vkms_config_for_each_plane' - 'vkms_config_plane_for_each_possible_crtc' - 'while_for_each_ftrace_op'
drivers/gpu/drm/vkms/tests/vkms_config_test.c +94 -0
140 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_config.c +54 -0
111 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_config.h +46 -0
74 lines not on this page · raw message
Signature · 1 line
2.48.1
PATCH v4 12/14 drm/vkms: Allow to attach encoders and CRTCs
In reply to José ExpósitoAdd a list of possible CRTCs to the encoder configuration and helpers to attach and detach them.
Now that the default configuration has its encoder and CRTC correctly attached, configure the output following the configuration.
--- .clang-format | 1 + drivers/gpu/drm/vkms/tests/vkms_config_test.c | 125 ++++++++++++++++++ drivers/gpu/drm/vkms/vkms_config.c | 82 ++++++++++++ drivers/gpu/drm/vkms/vkms_config.h | 29 ++++ drivers/gpu/drm/vkms/vkms_output.c | 49 ++++--- 5 files changed, 266 insertions(+), 20 deletions(-)
.clang-format +1 -0
@@ -693,6 +693,7 @@ ForEachMacros: - 'vkms_config_for_each_crtc' - 'vkms_config_for_each_encoder' - 'vkms_config_for_each_plane' + - 'vkms_config_encoder_for_each_possible_crtc' - 'vkms_config_plane_for_each_possible_crtc' - 'while_for_each_ftrace_op' - 'xa_for_each'
drivers/gpu/drm/vkms/tests/vkms_config_test.c +125 -0
183 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_config.c +82 -0
123 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_config.h +29 -0
@@ -76,6 +76,7 @@ struct vkms_config_crtc {* * @link: Link to the others encoders in vkms_config * @config: The vkms_config this CRTC belongs to +* @possible_crtcs: Array of CRTCs 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 not managed by the
@@ -85,6 +86,8 @@ struct vkms_config_encoder {struct list_head link;struct vkms_config *config; +struct xarray possible_crtcs; +/* Internal usage */ struct drm_encoder *encoder; };
@@ -123,6 +126,16 @@ struct vkms_config_encoder {#define vkms_config_plane_for_each_possible_crtc (plane_cfg, idx, possible_crtc) \ xa_for_each(&(plane_cfg)->possible_crtcs, idx, (possible_crtc)) +/** +* vkms_config_encoder_for_each_possible_crtc - Iterate over the +* vkms_config_encoder possible CRTCs +* @encoder_cfg: &struct vkms_config_encoder pointer +* @idx: Index of the cursor +* @possible_crtc: &struct vkms_config_crtc pointer used as cursor +*/ +#define vkms_config_encoder_for_each_possible_crtc (encoder_cfg, idx, possible_crtc) \ + xa_for_each(&(encoder_cfg)->possible_crtcs, idx, (possible_crtc)) +/** * vkms_config_create() - Create a new VKMS configuration * @dev_name: Name of the device
@@ -332,4 +345,20 @@ struct vkms_config_encoder *vkms_config_create_encoder(struct vkms_config *confivoid vkms_config_destroy_encoder (struct vkms_config *config,struct vkms_config_encoder *encoder_cfg); +/** +* vkms_config_encoder_attach_crtc - Attach a encoder to a CRTC +* @encoder_cfg: Encoder to attach +* @crtc_cfg: CRTC to attach @encoder_cfg to +*/ +int __must_check vkms_config_encoder_attach_crtc (struct vkms_config_encoder *encoder_cfg, +struct vkms_config_crtc *crtc_cfg); + +/** +* vkms_config_encoder_detach_crtc - Detach a encoder from a CRTC +* @encoder_cfg: Encoder to detach +* @crtc_cfg: CRTC to detach @encoder_cfg from +*/ +void vkms_config_encoder_detach_crtc (struct vkms_config_encoder *encoder_cfg, +struct vkms_config_crtc *crtc_cfg); +#endif /* _VKMS_CONFIG_H_ */
drivers/gpu/drm/vkms/vkms_output.c +29 -20
70 lines not on this page · raw message
Signature · 1 line
2.48.1
PATCH v4 13/14 drm/vkms: Allow to configure multiple connectors
In reply to José ExpósitoAdd a list of connectors to vkms_config and helper functions to add and remove as many connectors as wanted.
For backwards compatibility, add one enabled connector to the default configuration.
A future patch will allow to attach connectors and encoders, but for the moment there are no changes in the way the output is configured.
--- .clang-format | 1 + drivers/gpu/drm/vkms/tests/vkms_config_test.c | 95 +++++++++++++++++++ drivers/gpu/drm/vkms/vkms_config.c | 54 +++++++++++ drivers/gpu/drm/vkms/vkms_config.h | 44 +++++++++ drivers/gpu/drm/vkms/vkms_connector.c | 11 +++ 5 files changed, 205 insertions(+)
.clang-format +1 -0
@@ -690,6 +690,7 @@ ForEachMacros: - 'v4l2_m2m_for_each_src_buf' - 'v4l2_m2m_for_each_src_buf_safe' - 'virtio_device_for_each_vq' + - 'vkms_config_for_each_connector' - 'vkms_config_for_each_crtc' - 'vkms_config_for_each_encoder' - 'vkms_config_for_each_plane'
drivers/gpu/drm/vkms/tests/vkms_config_test.c +95 -0
143 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_config.c +54 -0
111 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_config.h +44 -0
72 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_connector.c +11 -0
@@ -25,8 +25,19 @@ static int vkms_conn_get_modes(struct drm_connector *connector)return count; } +static struct drm_encoder *vkms_conn_best_encoder (struct drm_connector *connector) +{ +struct drm_encoder *encoder; + +drm_connector_for_each_possible_encoder (connector, encoder) +return encoder; + +return NULL ; +} +static const struct drm_connector_helper_funcs vkms_conn_helper_funcs = { .get_modes = vkms_conn_get_modes, + .best_encoder = vkms_conn_best_encoder, };struct vkms_connector *vkms_connector_init (struct vkms_device *vkmsdev)
Signature · 1 line
2.48.1
PATCH v4 14/14 drm/vkms: Allow to attach connectors and encoders
In reply to José ExpósitoAdd a list of possible encoders to the connector configuration and helpers to attach and detach them.
Now that the default configuration has its connector and encoder correctly, configure the output following the configuration.
--- .clang-format | 1 + drivers/gpu/drm/vkms/tests/vkms_config_test.c | 102 ++++++++++++++++++ drivers/gpu/drm/vkms/vkms_config.c | 64 +++++++++++ drivers/gpu/drm/vkms/vkms_config.h | 29 +++++ drivers/gpu/drm/vkms/vkms_output.c | 33 +++--- 5 files changed, 216 insertions(+), 13 deletions(-)
.clang-format +1 -0
@@ -694,6 +694,7 @@ ForEachMacros: - 'vkms_config_for_each_crtc' - 'vkms_config_for_each_encoder' - 'vkms_config_for_each_plane' + - 'vkms_config_connector_for_each_possible_encoder' - 'vkms_config_encoder_for_each_possible_crtc' - 'vkms_config_plane_for_each_possible_crtc' - 'while_for_each_ftrace_op'
drivers/gpu/drm/vkms/tests/vkms_config_test.c +102 -0
152 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_config.c +64 -0
101 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_config.h +29 -0
@@ -99,6 +99,7 @@ struct vkms_config_encoder {* * @link: Link to the others connector in vkms_config * @config: The vkms_config this connector belongs to +* @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 * during device creation. This pointer is not managed by the
@@ -108,6 +109,8 @@ struct vkms_config_connector {struct list_head link;struct vkms_config *config; +struct xarray possible_encoders; +/* Internal usage */ struct vkms_connector *connector; };
@@ -164,6 +167,16 @@ struct vkms_config_connector {#define vkms_config_encoder_for_each_possible_crtc (encoder_cfg, idx, possible_crtc) \ xa_for_each(&(encoder_cfg)->possible_crtcs, idx, (possible_crtc)) +/** +* vkms_config_connector_for_each_possible_encoder - Iterate over the +* vkms_config_connector possible encoders +* @connector_cfg: &struct vkms_config_connector pointer +* @idx: Index of the cursor +* @possible_encoder: &struct vkms_config_encoder pointer used as cursor +*/ +#define vkms_config_connector_for_each_possible_encoder (connector_cfg, idx, possible_encoder) \ + xa_for_each(&(connector_cfg)->possible_encoders, idx, (possible_encoder)) +/** * vkms_config_create() - Create a new VKMS configuration * @dev_name: Name of the device
@@ -405,4 +418,20 @@ struct vkms_config_connector *vkms_config_create_connector(struct vkms_config *c*/ void vkms_config_destroy_connector (struct vkms_config_connector *connector_cfg); +/** +* vkms_config_connector_attach_encoder - Attach a connector to an encoder +* @connector_cfg: Connector to attach +* @encoder_cfg: Encoder to attach @connector_cfg to +*/ +int __must_check vkms_config_connector_attach_encoder (struct vkms_config_connector *connector_cfg, +struct vkms_config_encoder *encoder_cfg); + +/** +* vkms_config_connector_detach_encoder - Detach a connector from an encoder +* @connector_cfg: Connector to detach +* @encoder_cfg: Encoder to detach @connector_cfg from +*/ +void vkms_config_connector_detach_encoder (struct vkms_config_connector *connector_cfg, +struct vkms_config_encoder *encoder_cfg); +#endif /* _VKMS_CONFIG_H_ */
drivers/gpu/drm/vkms/vkms_output.c +20 -13
@@ -8,10 +8,10 @@int vkms_output_init (struct vkms_device *vkmsdev) {struct drm_device *dev = &vkmsdev->drm; -struct vkms_connector *connector;struct vkms_config_plane *plane_cfg;struct vkms_config_crtc *crtc_cfg;struct vkms_config_encoder *encoder_cfg; +struct vkms_config_connector *connector_cfg;int ret;int writeback;
@@ -83,22 +83,29 @@ int vkms_output_init(struct vkms_device *vkmsdev) } } - connector =vkms_connector_init (vkmsdev); -if (IS_ERR (connector)) { -DRM_ERROR ("Failed to init connector\n" ); -return PTR_ERR (connector); - } +vkms_config_for_each_connector (vkmsdev->config, connector_cfg) { +struct vkms_config_encoder *possible_encoder; +unsigned long idx =0 ; -/* Attach the encoder and the connector */ -vkms_config_for_each_encoder (vkmsdev->config, encoder_cfg) { - ret =drm_connector_attach_encoder (&connector->base, encoder_cfg->encoder); -if (ret) { -DRM_ERROR ("Failed to attach connector to encoder\n" ); -return ret; + connector_cfg->connector =vkms_connector_init (vkmsdev); +if (IS_ERR (connector_cfg->connector)) { +DRM_ERROR ("Failed to init connector\n" ); +return PTR_ERR (connector_cfg->connector); + } + +vkms_config_connector_for_each_possible_encoder (connector_cfg, + idx, + possible_encoder) { + ret =drm_connector_attach_encoder (&connector_cfg->connector->base, + possible_encoder->encoder); +if (ret) { +DRM_ERROR ("Failed to attach connector to encoder\n" ); +return ret; + } } }drm_mode_config_reset (dev); -return ret; +return 0 ; }
Signature · 1 line
2.48.1
Louis Chauvet
maintainerLe 18/02/2025 à 11:12, José Expósito a écrit :
Quoted 12 lines
Hi everyone,
In preparation for ConfigFS support, a flexible way to configure VKMS device(s) is required.
This series adds the required APIs to create a configuration, the code changes required to apply it and KUnit test validating the changes.Louis Chauvet and I are working on ConfigFS support. In this series I tried to merge his changes [1] with mine [2].
I kept his Signed-off-by to reflect that, even if I show up as the author of some/most of the patches, this was a joint effort.
Quoted 6 lines
I'll send the ConfigFS code [3] and its IGT tests [4] code this week. Meanwhile, the IGT tests also exercise this series and can be used for additional test coverage.
Best wishes,
José Expósito
Hi all,
I am trying to apply this series but I am encountering some issues. Most of the patches have the following trailers:
When I use dim b4-shazam, the result is:
However, checkpatch is not happy with this because it removes my Signed-off-by line immediately after Co-developed-by.
I then tried to add it myself:
But this time, checkpatch complains that I have my Signed-off-by line twice.
And if I don't add the last Signed-off-by, checkpatch is indeed not happy too:
How should I proceed in this situation? Should I ignore some warnings? If so, what are the expected trailers?
Thanks!
Quoted 81 lines
[1] https://patchwork.kernel.org/project/dri-devel/cover/20250121-google-remove-crtc-index-from-parameter-v3-0-cac00a3c3544@bootlin.com/
[2] https://patchwork.kernel.org/project/dri-devel/cover/[email protected]/
[3] https://github.com/JoseExposito/linux/commits/patch-vkms-configfs/
[4] https://gitlab.freedesktop.org/jexposit/igt-gpu-tools/-/commits/vkms-configfsChanges in v4:
- Applied review comments by Louis Chauvet: (thanks!!)
- Do not access "private" struct fields in tests
- Reviewed-by in all patches
- Rebased on top of drm-misc-next
- Link to v3: https://lore.kernel.org/dri-devel/[email protected]/T/Changes in v3:
- Applied review comments by Louis Chauvet:
- Moveddrm_vblank_init(..., vkms_config_get_num_crtcs())to a different patch
- Improved error handling in vkms_config_*_attach_*() functions
- Fixed compilation errors whenCONFIG_DRM_VKMS_KUNIT_TEST=m
- Usedfor_eachiterators invkms_config_test_default_config(). A leftover from the removed connector hot-add code
- Validated that vkms_config.dev wasn't NULL before callingdrm_info()
- Kept vkms_device.config as a const pointer (at the cost of casting inlist_count_nodes())
- Renamed "CONFIG_DRM_VKMS_KUNIT_TESTS" to "CONFIG_DRM_VKMS_KUNIT_TEST" for consistency with other options
- 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:
- Added Co-developped-by tags where required
- Split the first patch in 2: vkms_connector.h/c creation and structvkms_connectorcreation
- Fixes a user after free/double free bug. The bug is already present
in drm-misc-next and the fix could be merged independently
- Implementedfor_eachmacros for the config
- Other naming fixes
- Link to v1: https://lore.kernel.org/all/[email protected]/José Expósito (13):
drm/vkms: Extractvkms_connectorheader drm/vkms: Createvkms_connectorstruct
drm/vkms: Add KUnit test scaffolding
drm/vkms: Extractvkms_configheader
drm/vkms: Movedefault_configcreation to its own function drm/vkms: Set device name fromvkms_configdrm/vkms: Allow to configure multiple planes drm/vkms: Allow to configure multiple CRTCs drm/vkms: Allow to attach planes and CRTCs drm/vkms: Allow to configure multiple encoders drm/vkms: Allow to attach encoders and CRTCs drm/vkms: Allow to configure multiple connectors drm/vkms: Allow to attach connectors and encodersLouis Chauvet (1):
drm/vkms: Add a validation function for VKMS configuration.clang-format | 7 + drivers/gpu/drm/vkms/Kconfig | 15 + drivers/gpu/drm/vkms/Makefile | 5 +- drivers/gpu/drm/vkms/tests/.kunitconfig | 4 + drivers/gpu/drm/vkms/tests/Makefile | 3 + drivers/gpu/drm/vkms/tests/vkms_config_test.c | 951 ++++++++++++++++++ drivers/gpu/drm/vkms/vkms_config.c | 640 ++++++++++++ drivers/gpu/drm/vkms/vkms_config.h | 437 ++++++++ drivers/gpu/drm/vkms/vkms_connector.c | 61 ++ drivers/gpu/drm/vkms/vkms_connector.h | 26 + drivers/gpu/drm/vkms/vkms_drv.c | 45 +- drivers/gpu/drm/vkms/vkms_drv.h | 17 +- drivers/gpu/drm/vkms/vkms_output.c | 176 ++-- 13 files changed, 2246 insertions(+), 141 deletions(-)create mode 100644
drivers/gpu/drm/vkms/tests/.kunitconfigcreate mode 100644drivers/gpu/drm/vkms/tests/Makefilecreate mode 100644drivers/gpu/drm/vkms/tests/vkms_config_test.ccreate mode 100644drivers/gpu/drm/vkms/vkms_config.ccreate mode 100644drivers/gpu/drm/vkms/vkms_config.hcreate mode 100644drivers/gpu/drm/vkms/vkms_connector.ccreate mode 100644drivers/gpu/drm/vkms/vkms_connector.h
Signature · 3 lines
Louis Chauvet, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Maxime Ripard
maintainerQuoted 52 lines · Louis Chauvet
Le 18/02/2025 à 11:12, José Expósito a écrit :
Quoted 12 lines
Hi everyone,
In preparation for ConfigFS support, a flexible way to configure VKMS device(s) is required.
This series adds the required APIs to create a configuration, the code changes required to apply it and KUnit test validating the changes.Louis Chauvet and I are working on ConfigFS support. In this series I tried to merge his changes [1] with mine [2].
I kept his Signed-off-by to reflect that, even if I show up as the author of some/most of the patches, this was a joint effort.Quoted 6 lines
I'll send the ConfigFS code [3] and its IGT tests [4] code this week. Meanwhile, the IGT tests also exercise this series and can be used for additional test coverage.
Best wishes,
José ExpósitoHi all,
I am trying to apply this series but I am encountering some issues. Most of the patches have the following trailers:
Co-developed-by Louis ChauvetSigned-off-by Louis ChauvetSigned-off-by José ExpositoWhen I use dim b4-shazam, the result is:
Co-developed-by Louis ChauvetSigned-off-by José ExpositoSigned-off-by Louis ChauvetHowever, checkpatch is not happy with this because it removes my Signed-off-by line immediately after Co-developed-by.
I then tried to add it myself:
Co-developed-by Louis ChauvetSigned-off-by Louis ChauvetSigned-off-by José ExpositoSigned-off-by Louis ChauvetBut this time, checkpatch complains that I have my Signed-off-by line twice.
And if I don't add the last Signed-off-by, checkpatch is indeed not happy too:
Quoted 6 lines
Co-developed-by Louis ChauvetSigned-off-by Louis ChauvetSigned-off-by José ExpositoHow should I proceed in this situation? Should I ignore some warnings? If so, what are the expected trailers?
I assume Jose is the author and you're the committer? If so, I guess I'd expect the second to be the most relevant, but it's going to suck anyway.
I kind of side-stepped the problem and applied the series
Maxime