[PATCH i-g-t 10/39] lib/vkms: Test CRTC default files
Louis Chauvet
louis.chauvet at bootlin.com
Thu Feb 27 13:15:24 UTC 2025
Le 18/02/2025 à 17:49, José Expósito a écrit :
> Add a helper to create a CRTC and a test checking that the default
> files and directories are created.
>
> Signed-off-by: José Expósito <jose.exposito89 at gmail.com>
Reviewed-by: Louis Chauvet <louis.chauvet at bootlin.com>
> ---
> lib/igt_vkms.c | 12 ++++++++++++
> lib/igt_vkms.h | 2 ++
> tests/vkms/vkms_configfs.c | 29 +++++++++++++++++++++++++++++
> 3 files changed, 43 insertions(+)
>
> diff --git a/lib/igt_vkms.c b/lib/igt_vkms.c
> index ca6f37975..a7dad43e2 100644
> --- a/lib/igt_vkms.c
> +++ b/lib/igt_vkms.c
> @@ -365,3 +365,15 @@ void igt_vkms_plane_set_type(igt_vkms_t *dev, const char *name, int type)
>
> write_int(path, type);
> }
> +
> +/**
> + * igt_vkms_device_add_crtc:
> + * @dev: Device to add the CRTC to
> + * @name: CRTC name
> + *
> + * Add a new CRTC to the VKMS device.
> + */
> +void igt_vkms_device_add_crtc(igt_vkms_t *dev, const char *name)
> +{
> + add_pipeline_item(dev, VKMS_PIPELINE_ITEM_CRTC, name);
> +}
> diff --git a/lib/igt_vkms.h b/lib/igt_vkms.h
> index 283be5699..7f70f92d3 100644
> --- a/lib/igt_vkms.h
> +++ b/lib/igt_vkms.h
> @@ -33,4 +33,6 @@ void igt_vkms_device_add_plane(igt_vkms_t *dev, const char *name);
> int igt_vkms_plane_get_type(igt_vkms_t *dev, const char *name);
> void igt_vkms_plane_set_type(igt_vkms_t *dev, const char *name, int type);
>
> +void igt_vkms_device_add_crtc(igt_vkms_t *dev, const char *name);
> +
> #endif /* __IGT_VKMS_H__ */
> diff --git a/tests/vkms/vkms_configfs.c b/tests/vkms/vkms_configfs.c
> index d607b1a5a..398232c03 100644
> --- a/tests/vkms/vkms_configfs.c
> +++ b/tests/vkms/vkms_configfs.c
> @@ -272,6 +272,34 @@ static void test_plane_wrong_values(void)
> igt_vkms_device_destroy(dev);
> }
>
> +/**
> + * SUBTEST: crtc-default-files
> + * Description: Test that creating a CRTC creates the default files and
> + * directories.
> + */
> +
> +static void test_crtc_default_files(void)
> +{
> + igt_vkms_t *dev;
> + char path[PATH_MAX];
> +
> + const char *files[] = {
> + "writeback",
> + };
> +
> + dev = igt_vkms_device_create(__func__);
> + igt_assert(dev);
> +
> + igt_vkms_device_add_crtc(dev, "crtc0");
> +
> + snprintf(path, sizeof(path), "%s/crtcs/crtc0", dev->path);
> + assert_default_files(path,
> + files, ARRAY_SIZE(files),
> + NULL, 0);
> +
> + igt_vkms_device_destroy(dev);
> +}
> +
> igt_main
> {
> struct {
> @@ -284,6 +312,7 @@ igt_main
> { "plane-default-files", test_plane_default_files },
> { "plane-default-values", test_plane_default_values },
> { "plane-wrong-values", test_plane_wrong_values },
> + { "crtc-default-files", test_crtc_default_files },
> };
>
> igt_fixture {
--
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
More information about the igt-dev
mailing list