]> Gentwo Git Trees - linux/.git/commitdiff
drm/vkms: Add config for default plane pipeline
authorLouis Chauvet <louis.chauvet@bootlin.com>
Sat, 15 Nov 2025 00:01:41 +0000 (17:01 -0700)
committerSimon Ser <contact@emersion.fr>
Wed, 26 Nov 2025 22:03:33 +0000 (23:03 +0100)
With the introduction of color pipeline in VKMS, the default device may
have planes with color pipelines. To avoid breaking existing uAPI,
create a kernel argument to disable them by default and a vkms_config
field to configure the plane.

This field is not definitive and will be replaced once the uAPI will be
able to configure color pipelines. For now devices created with ConfigFS
will not have any color pipeline so we can decide later how the uAPI
will look like.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
Signed-off-by: Simon Ser <contact@emersion.fr>
Link: https://patch.msgid.link/20251115000237.3561250-17-alex.hung@amd.com
drivers/gpu/drm/vkms/tests/vkms_config_test.c
drivers/gpu/drm/vkms/vkms_config.c
drivers/gpu/drm/vkms/vkms_config.h
drivers/gpu/drm/vkms/vkms_drv.c
drivers/gpu/drm/vkms/vkms_plane.c

index d75a6252e4d2893c8afae271e0deab84064d7b34..1e4ea1863420fa50451f6902d7bce557a0c5e360 100644 (file)
@@ -83,6 +83,7 @@ struct default_config_case {
        bool enable_cursor;
        bool enable_writeback;
        bool enable_overlay;
+       bool enable_plane_pipeline;
 };
 
 static void vkms_config_test_empty_config(struct kunit *test)
@@ -108,14 +109,22 @@ static void vkms_config_test_empty_config(struct kunit *test)
 }
 
 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 },
+       { false, false, false, false },
+       { true, false, false, false },
+       { true, true, false, false },
+       { true, false, true, false },
+       { false, true, false, false },
+       { false, true, true, false },
+       { false, false, true, false },
+       { true, true, true, false },
+       { false, false, false, true },
+       { true, false, false, true },
+       { true, true, false, true },
+       { true, false, true, true },
+       { false, true, false, true },
+       { false, true, true, true },
+       { false, false, true, true },
+       { true, true, true, true },
 };
 
 KUNIT_ARRAY_PARAM(default_config, default_config_cases, NULL);
@@ -132,11 +141,15 @@ static void vkms_config_test_default_config(struct kunit *test)
 
        config = vkms_config_default_create(params->enable_cursor,
                                            params->enable_writeback,
-                                           params->enable_overlay);
+                                           params->enable_overlay,
+                                           params->enable_plane_pipeline);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, config);
 
        /* Planes */
        vkms_config_for_each_plane(config, plane_cfg) {
+               KUNIT_EXPECT_EQ(test,
+                               vkms_config_plane_get_default_pipeline(plane_cfg),
+                               params->enable_plane_pipeline);
                switch (vkms_config_plane_get_type(plane_cfg)) {
                case DRM_PLANE_TYPE_PRIMARY:
                        n_primaries++;
@@ -368,7 +381,7 @@ static void vkms_config_test_invalid_plane_number(struct kunit *test)
        struct vkms_config_plane *plane_cfg;
        int n;
 
-       config = vkms_config_default_create(false, false, false);
+       config = vkms_config_default_create(false, false, false, false);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, config);
 
        /* Invalid: No planes */
@@ -393,7 +406,7 @@ static void vkms_config_test_valid_plane_type(struct kunit *test)
        struct vkms_config_encoder *encoder_cfg;
        int err;
 
-       config = vkms_config_default_create(false, false, false);
+       config = vkms_config_default_create(false, false, false, false);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, config);
 
        plane_cfg = get_first_plane(config);
@@ -474,7 +487,7 @@ static void vkms_config_test_valid_plane_possible_crtcs(struct kunit *test)
        struct vkms_config_plane *plane_cfg;
        struct vkms_config_crtc *crtc_cfg;
 
-       config = vkms_config_default_create(false, false, false);
+       config = vkms_config_default_create(false, false, false, false);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, config);
 
        plane_cfg = get_first_plane(config);
@@ -493,7 +506,7 @@ static void vkms_config_test_invalid_crtc_number(struct kunit *test)
        struct vkms_config_crtc *crtc_cfg;
        int n;
 
-       config = vkms_config_default_create(false, false, false);
+       config = vkms_config_default_create(false, false, false, false);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, config);
 
        /* Invalid: No CRTCs */
@@ -516,7 +529,7 @@ static void vkms_config_test_invalid_encoder_number(struct kunit *test)
        struct vkms_config_encoder *encoder_cfg;
        int n;
 
-       config = vkms_config_default_create(false, false, false);
+       config = vkms_config_default_create(false, false, false, false);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, config);
 
        /* Invalid: No encoders */
@@ -541,7 +554,7 @@ static void vkms_config_test_valid_encoder_possible_crtcs(struct kunit *test)
        struct vkms_config_encoder *encoder_cfg;
        int err;
 
-       config = vkms_config_default_create(false, false, false);
+       config = vkms_config_default_create(false, false, false, false);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, config);
 
        crtc_cfg1 = get_first_crtc(config);
@@ -587,7 +600,7 @@ static void vkms_config_test_invalid_connector_number(struct kunit *test)
        struct vkms_config_connector *connector_cfg;
        int n;
 
-       config = vkms_config_default_create(false, false, false);
+       config = vkms_config_default_create(false, false, false, false);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, config);
 
        /* Invalid: No connectors */
@@ -610,7 +623,7 @@ static void vkms_config_test_valid_connector_possible_encoders(struct kunit *tes
        struct vkms_config_encoder *encoder_cfg;
        struct vkms_config_connector *connector_cfg;
 
-       config = vkms_config_default_create(false, false, false);
+       config = vkms_config_default_create(false, false, false, false);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, config);
 
        encoder_cfg = get_first_encoder(config);
index f8394a063ecf57d6c33dc7ddbaf3b526b2f2ec86..8788df9edb7cabd06629bac27df163fea7a2c04f 100644 (file)
@@ -33,7 +33,8 @@ EXPORT_SYMBOL_IF_KUNIT(vkms_config_create);
 
 struct vkms_config *vkms_config_default_create(bool enable_cursor,
                                               bool enable_writeback,
-                                              bool enable_overlay)
+                                              bool enable_overlay,
+                                              bool enable_plane_pipeline)
 {
        struct vkms_config *config;
        struct vkms_config_plane *plane_cfg;
@@ -58,6 +59,7 @@ struct vkms_config *vkms_config_default_create(bool enable_cursor,
 
        if (vkms_config_plane_attach_crtc(plane_cfg, crtc_cfg))
                goto err_alloc;
+       vkms_config_plane_set_default_pipeline(plane_cfg, enable_plane_pipeline);
 
        if (enable_overlay) {
                for (n = 0; n < NUM_OVERLAY_PLANES; n++) {
@@ -67,6 +69,7 @@ struct vkms_config *vkms_config_default_create(bool enable_cursor,
 
                        vkms_config_plane_set_type(plane_cfg,
                                                   DRM_PLANE_TYPE_OVERLAY);
+                       vkms_config_plane_set_default_pipeline(plane_cfg, enable_plane_pipeline);
 
                        if (vkms_config_plane_attach_crtc(plane_cfg, crtc_cfg))
                                goto err_alloc;
@@ -79,6 +82,7 @@ struct vkms_config *vkms_config_default_create(bool enable_cursor,
                        goto err_alloc;
 
                vkms_config_plane_set_type(plane_cfg, DRM_PLANE_TYPE_CURSOR);
+               vkms_config_plane_set_default_pipeline(plane_cfg, enable_plane_pipeline);
 
                if (vkms_config_plane_attach_crtc(plane_cfg, crtc_cfg))
                        goto err_alloc;
@@ -389,6 +393,7 @@ struct vkms_config_plane *vkms_config_create_plane(struct vkms_config *config)
                return ERR_PTR(-ENOMEM);
 
        plane_cfg->config = config;
+       plane_cfg->default_pipeline = false;
        vkms_config_plane_set_type(plane_cfg, DRM_PLANE_TYPE_OVERLAY);
        xa_init_flags(&plane_cfg->possible_crtcs, XA_FLAGS_ALLOC);
 
index 4c8d668e7ef8e52b86f38a11f876803605b5c813..8f7f286a4bdd711ab31bd7ff8cf6303b2123bb1b 100644 (file)
@@ -49,6 +49,7 @@ struct vkms_config_plane {
 
        enum drm_plane_type type;
        struct xarray possible_crtcs;
+       bool default_pipeline;
 
        /* Internal usage */
        struct vkms_plane *plane;
@@ -203,7 +204,8 @@ struct vkms_config *vkms_config_create(const char *dev_name);
  */
 struct vkms_config *vkms_config_default_create(bool enable_cursor,
                                               bool enable_writeback,
-                                              bool enable_overlay);
+                                              bool enable_overlay,
+                                              bool enable_plane_pipeline);
 
 /**
  * vkms_config_destroy() - Free a VKMS configuration
@@ -288,6 +290,30 @@ vkms_config_plane_set_type(struct vkms_config_plane *plane_cfg,
        plane_cfg->type = type;
 }
 
+/**
+ * vkms_config_plane_get_default_pipeline() - Return if the plane will
+ * be created with the default pipeline
+ * @plane_cfg: Plane to get the information from
+ */
+static inline bool
+vkms_config_plane_get_default_pipeline(struct vkms_config_plane *plane_cfg)
+{
+       return plane_cfg->default_pipeline;
+}
+
+/**
+ * vkms_config_plane_set_default_pipeline() - Set if the plane will
+ * be created with the default pipeline
+ * @plane_cfg: Plane to configure the pipeline
+ * @default_pipeline: New default pipeline value
+ */
+static inline void
+vkms_config_plane_set_default_pipeline(struct vkms_config_plane *plane_cfg,
+                                      bool default_pipeline)
+{
+       plane_cfg->default_pipeline = default_pipeline;
+}
+
 /**
  * vkms_config_plane_attach_crtc - Attach a plane to a CRTC
  * @plane_cfg: Plane to attach
index c659de653197c491a0438714d424e2cb168fad49..dd1402f437736954bb724bcf820c81df8f152425 100644 (file)
@@ -51,6 +51,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 enable_plane_pipeline;
+module_param_named(enable_plane_pipeline, enable_plane_pipeline, bool, 0444);
+MODULE_PARM_DESC(enable_plane_pipeline, "Enable/Disable plane pipeline 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");
@@ -227,7 +231,8 @@ static int __init vkms_init(void)
        if (!create_default_dev)
                return 0;
 
-       config = vkms_config_default_create(enable_cursor, enable_writeback, enable_overlay);
+       config = vkms_config_default_create(enable_cursor, enable_writeback,
+                                           enable_overlay, enable_plane_pipeline);
        if (IS_ERR(config))
                return PTR_ERR(config);
 
index 92345ba32b93720f5039ca58b6c45fed214d6fef..19fe6acad306e409e4a9f5416729f53094246ecc 100644 (file)
@@ -246,7 +246,8 @@ struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
                                          DRM_COLOR_YCBCR_BT601,
                                          DRM_COLOR_YCBCR_FULL_RANGE);
 
-       vkms_initialize_colorops(&plane->base);
+       if (vkms_config_plane_get_default_pipeline(plane_cfg))
+               vkms_initialize_colorops(&plane->base);
 
        return plane;
 }