[igt-dev] [PATCH i-g-t v4 1/3] lib/igt_v3d: Rework igt_v3d_get_param()

Maíra Canal mcanal at igalia.com
Thu Jan 12 14:00:52 UTC 2023


Instead of assuming that igt_v3d_get_param() will succeed, allow the
ioctl to fail and return 0. This way, it will be possible to check if the
kernel has the capabilities needed by the test by checking if the return
of the igt_v3d_get_param() function is different than zero.

Signed-off-by: Maíra Canal <mcanal at igalia.com>
---
 lib/igt_v3d.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/igt_v3d.c b/lib/igt_v3d.c
index 68d11d7f..28d1ab6b 100644
--- a/lib/igt_v3d.c
+++ b/lib/igt_v3d.c
@@ -89,11 +89,14 @@ igt_v3d_get_bo_offset(int fd, uint32_t handle)
 uint32_t
 igt_v3d_get_param(int fd, enum drm_v3d_param param)
 {
+	int ret;
 	struct drm_v3d_get_param get = {
 		.param = param,
 	};
 
-	do_ioctl(fd, DRM_IOCTL_V3D_GET_PARAM, &get);
+	ret = igt_ioctl(fd, DRM_IOCTL_V3D_GET_PARAM, &get);
+	if (ret)
+		return 0;
 
 	return get.value;
 }
-- 
2.39.0



More information about the igt-dev mailing list