[PATCH i-g-t 22/39] tests/vkms_configfs: Test adding too many planes

Louis Chauvet louis.chauvet at bootlin.com
Thu Feb 27 14:53:44 UTC 2025



Le 18/02/2025 à 17:49, José Expósito a écrit :
> 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.
> 
> Signed-off-by: José Expósito <jose.exposito89 at gmail.com>

Reviewed-by: Louis Chauvet <louis.chauvet at bootlin.com>

> ---
>   tests/vkms/vkms_configfs.c | 53 ++++++++++++++++++++++++++++++++++++++
>   1 file changed, 53 insertions(+)
> 
> diff --git a/tests/vkms/vkms_configfs.c b/tests/vkms/vkms_configfs.c
> index 47cfa475f..7df9bda01 100644
> --- a/tests/vkms/vkms_configfs.c
> +++ b/tests/vkms/vkms_configfs.c
> @@ -787,6 +787,58 @@ 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];
> +
> +	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++) {
> +		snprintf(plane_names[n], sizeof(plane_names[n]), "plane%d", 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 {
> @@ -811,6 +863,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 {

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



More information about the igt-dev mailing list