[PATCH v5 1/4] lib/ioctl_wrappers: let the caller handle capability check result

André Almeida andrealmeid at igalia.com
Wed Apr 2 02:29:19 UTC 2025


From: Melissa Wen <mwen at igalia.com>

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.49.0



More information about the igt-dev mailing list