[PATCH i-g-t v2 26/43] tests/vkms_configfs: Test adding too many planes
José Expósito
jose.exposito89 at gmail.com
Thu Mar 13 17:33:01 UTC 2025
The kernel references pipeline items with 32 bit bitmaks, therefore,
adding more than 31 items causes an overflow.
Make sure that this limit is handled correctly.
Reviewed-by: Louis Chauvet <louis.chauvet at bootlin.com>
Signed-off-by: José Expósito <jose.exposito89 at gmail.com>
---
tests/vkms/vkms_configfs.c | 57 ++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/tests/vkms/vkms_configfs.c b/tests/vkms/vkms_configfs.c
index 355f8b72a..c40c8b11e 100644
--- a/tests/vkms/vkms_configfs.c
+++ b/tests/vkms/vkms_configfs.c
@@ -851,6 +851,62 @@ static void test_enable_no_planes(void)
igt_vkms_device_destroy(dev);
}
+/**
+ * SUBTEST: enable-too-many-planes
+ * Description: Try to enable a VKMS device with too many planes and test that
+ * it fails.
+ */
+
+static void test_enable_too_many_planes(void)
+{
+ igt_vkms_t *dev;
+ char plane_names[VKMS_MAX_PIPELINE_ITEMS][8];
+ int ret;
+
+ igt_vkms_config_t cfg = {
+ .device_name = __func__,
+ .planes = {
+ {
+ .name = "plane0",
+ .type = DRM_PLANE_TYPE_PRIMARY,
+ .possible_crtcs = { "crtc0" },
+ },
+ },
+ .crtcs = {
+ { .name = "crtc0" },
+ },
+ .encoders = {
+ { .name = "encoder0", .possible_crtcs = { "crtc0" } },
+ },
+ .connectors = {
+ {
+ .name = "connector0",
+ .possible_encoders = { "encoder0" },
+ },
+ },
+ };
+
+ for (int n = 1; n < 32; n++) {
+ ret = snprintf(plane_names[n], sizeof(plane_names[n]),
+ "plane%d", n);
+ igt_assert(ret >= 0 && ret < sizeof(plane_names[n]));
+
+ cfg.planes[n] = (igt_vkms_plane_config_t){
+ .name = plane_names[n],
+ .possible_crtcs = { "crtc0" },
+ };
+ }
+
+ dev = igt_vkms_device_create_from_config(&cfg);
+ igt_assert(dev);
+
+ igt_vkms_device_set_enabled(dev, true);
+ igt_assert(!igt_vkms_device_is_enabled(dev));
+ igt_assert(!device_exists(__func__));
+
+ igt_vkms_device_destroy(dev);
+}
+
igt_main
{
struct {
@@ -878,6 +934,7 @@ igt_main
{ "attach-connector-to-encoder", test_attach_connector_to_encoder },
{ "enable-no-pipeline-items", test_enable_no_pipeline_items },
{ "enable-no-planes", test_enable_no_planes },
+ { "enable-too-many-planes", test_enable_too_many_planes },
};
igt_fixture {
--
2.48.1
More information about the igt-dev
mailing list