[PATCH v4 1/3] tests/kms_async_flips: Check for atomic async flip cap

Melissa Wen mwen at igalia.com
Sat Mar 29 18:29:48 UTC 2025


On 03/27, André Almeida wrote:
> If a driver doesn't support doing an async flip through the atomic uAPI,
> the atomic tests fails. Instead of failing, create a function that
> checks for this capability and skip the test if is unsupported.
> 
> Signed-off-by: André Almeida <andrealmeid at igalia.com>
> ---
>  tests/kms_async_flips.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
> index da426f753..2975925c2 100644
> --- a/tests/kms_async_flips.c
> +++ b/tests/kms_async_flips.c
> @@ -207,6 +207,12 @@ static void require_monotonic_timestamp(int fd)
>  		      "Monotonic timestamps not supported\n");
>  }
>  
> +static void require_atomic_async_cap(data_t *data)
> +{
> +	igt_require_f(igt_has_drm_cap(data->drm_fd, DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP),
> +		      "Skipping, atomic flip async flip not supported");
> +}
> +
>  static void test_init(data_t *data)
>  {
>  	drmModeModeInfo *mode;
> @@ -687,6 +693,9 @@ static void run_test(data_t *data, void (*test)(data_t *))
>  {
>  	igt_display_t *display = &data->display;
>  
> +	if (data->atomic_path)
> +		require_atomic_async_cap(data);
> +

Hey,

This doesn't work as expected because igt_has_drm_cap() has an
igt_assert() and this assert inside a igt_subtest_with_dynamics() aborts
the execution in case of failure. You can see this issue when running a
kernel without atomic async flip support.

Considering the way the atomic async tests is organized, I think a good
approach is removing the assert from igt_has_drm_cap() as below - but
feel free to suggest a different fix:

-- >8 --

>From 601b5cc7c4bb5d9d617f940c95e76455bf783a39 Mon Sep 17 00:00:00 2001
From: Melissa Wen <mwen at igalia.com>
Date: Fri, 28 Mar 2025 21:00:54 -0100
Subject: [PATCH i-g-t] lib/ioctl_wrappers: let the caller handle capability
 check result

Rework igt_has_drm_cap to just check if a DRM capability is supported
and let the called decide what to do from this check. It prevents the
test fails because of an assert done when it's called in
igt_subtest_with_dynamics.

Signed-off-by: Melissa Wen <mwen at igalia.com>
---
 lib/ioctl_wrappers.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 146973f0d..15eeb9aa4 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -1292,10 +1292,10 @@ int __kms_addfb(int fd, uint32_t handle,
  */
 bool igt_has_drm_cap(int fd, uint64_t capability)
 {
-	struct drm_get_cap cap = { .capability = capability };
-
-	igt_assert(drmIoctl(fd, DRM_IOCTL_GET_CAP, &cap) == 0);
-	return cap.value;
+	uint64_t value;
+	if (drmGetCap(fd, capability, &value))
+		return false;
+	return value ? true : false;
 }
 
 /**
-- 
2.47.2



More information about the igt-dev mailing list