[PATCH i-g-t 11/39] lib/vkms: Test CRTC default values
Louis Chauvet
louis.chauvet at bootlin.com
Thu Feb 27 13:12:47 UTC 2025
Le 18/02/2025 à 17:49, José Expósito a écrit :
> Add a helper to get the CRTC writeback status and test that the default
> value is set when a new CRTC is 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 | 19 +++++++++++++++++++
> lib/igt_vkms.h | 1 +
> tests/vkms/vkms_configfs.c | 20 ++++++++++++++++++++
> 3 files changed, 40 insertions(+)
>
> diff --git a/lib/igt_vkms.c b/lib/igt_vkms.c
> index a7dad43e2..4021f9aea 100644
> --- a/lib/igt_vkms.c
> +++ b/lib/igt_vkms.c
> @@ -24,6 +24,7 @@
> #define VKMS_ROOT_DIR_NAME "vkms"
> #define VKMS_FILE_ENABLED "enabled"
> #define VKMS_FILE_PLANE_TYPE "type"
> +#define VKMS_FILE_CRTC_WRITEBACK "writeback"
>
> enum vkms_pipeline_item {
> VKMS_PIPELINE_ITEM_PLANE,
> @@ -377,3 +378,21 @@ void igt_vkms_device_add_crtc(igt_vkms_t *dev, const char *name)
> {
> add_pipeline_item(dev, VKMS_PIPELINE_ITEM_CRTC, name);
> }
> +
> +/**
> + * igt_vkms_crtc_is_writeback_enabled:
> + * @dev: Device the CRTC belongs to
> + * @name: CRTC name
> + *
> + * Indicate whether a VKMS CRTC writeback connector is enabled or not.
> + */
> +bool igt_vkms_crtc_is_writeback_enabled(igt_vkms_t *dev, const char *name)
> +{
> + char path[PATH_MAX];
> +
> + snprintf(path, sizeof(path), "%s/%s/%s/%s", dev->path,
> + get_pipeline_item_dir_name(VKMS_PIPELINE_ITEM_CRTC), name,
> + VKMS_FILE_CRTC_WRITEBACK);
> +
> + return read_bool(path);
> +}
> diff --git a/lib/igt_vkms.h b/lib/igt_vkms.h
> index 7f70f92d3..59f6a9775 100644
> --- a/lib/igt_vkms.h
> +++ b/lib/igt_vkms.h
> @@ -34,5 +34,6 @@ 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);
> +bool igt_vkms_crtc_is_writeback_enabled(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 398232c03..95779d336 100644
> --- a/tests/vkms/vkms_configfs.c
> +++ b/tests/vkms/vkms_configfs.c
> @@ -300,6 +300,25 @@ static void test_crtc_default_files(void)
> igt_vkms_device_destroy(dev);
> }
>
> +/**
> + * SUBTEST: crtc-default-values
> + * Description: Check that the default values for the CRTC are correct.
> + */
> +
> +static void test_crtc_default_values(void)
> +{
> + igt_vkms_t *dev;
> +
> + dev = igt_vkms_device_create(__func__);
> + igt_assert(dev);
> +
> + igt_vkms_device_add_crtc(dev, "crtc0");
> +
> + igt_assert(!igt_vkms_crtc_is_writeback_enabled(dev, "crtc0"));
> +
> + igt_vkms_device_destroy(dev);
> +}
> +
> igt_main
> {
> struct {
> @@ -313,6 +332,7 @@ igt_main
> { "plane-default-values", test_plane_default_values },
> { "plane-wrong-values", test_plane_wrong_values },
> { "crtc-default-files", test_crtc_default_files },
> + { "crtc-default-values", test_crtc_default_values },
> };
>
> igt_fixture {
--
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
More information about the igt-dev
mailing list