[PATCH i-g-t 27/39] tests/vkms_configfs: Test enabling a device without CRTCs

Louis Chauvet louis.chauvet at bootlin.com
Thu Feb 27 15:15:58 UTC 2025



Le 18/02/2025 à 17:49, José Expósito a écrit :
> Try to enable a VKMS device without adding CRTCs and test that it fails.
> 
> Signed-off-by: José Expósito <jose.exposito89 at gmail.com>
> ---
>   tests/vkms/vkms_configfs.c | 42 ++++++++++++++++++++++++++++++++++++++
>   1 file changed, 42 insertions(+)
> 
> diff --git a/tests/vkms/vkms_configfs.c b/tests/vkms/vkms_configfs.c
> index 7d6437c87..59365c91b 100644
> --- a/tests/vkms/vkms_configfs.c
> +++ b/tests/vkms/vkms_configfs.c
> @@ -1054,6 +1054,47 @@ static void test_enable_plane_no_crtcs(void)
>   	igt_vkms_device_destroy(dev);
>   }
>   
> +/**
> + * SUBTEST: enable-no-crtcs
> + * Description: Try to enable a VKMS device without adding CRTCs and test that
> + *              it fails.
> + */
> +
> +static void test_enable_no_crtcs(void)
> +{
> +	igt_vkms_t *dev;
> +
> +	igt_vkms_config_t cfg = {
> +		.device_name = __func__,
> +		.planes = {
> +			{
> +				.name = "plane0",
> +				.type = DRM_PLANE_TYPE_PRIMARY,
> +				.possible_crtcs = {},
> +			},
> +		},
> +		.crtcs = { {} },

Again, a strange empty item in crtcs, is it normal?

> +		.encoders = {
> +			{ .name = "encoder0", .possible_crtcs = { "crtc0" } },
> +		},
> +		.connectors = {
> +			{
> +				.name = "connector0",
> +				.possible_encoders = { "encoder0" },
> +			},
> +		},
> +	};
> +
> +	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 {
> @@ -1083,6 +1124,7 @@ igt_main
>   		{ "enable-multiple-primary-planes", test_enable_multiple_primary_planes },
>   		{ "enable-multiple-cursor-planes", test_enable_multiple_cursor_planes },
>   		{ "enable-plane-no-crtcs", test_enable_plane_no_crtcs },
> +		{ "enable-no-crtcs", test_enable_no_crtcs },
>   	};
>   
>   	igt_fixture {

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



More information about the igt-dev mailing list