[PATCH i-g-t] tests/kms_atomic: Read the error msg on atomic_ioctl failure

Arun R Murthy arun.r.murthy at intel.com
Fri Aug 22 06:55:35 UTC 2025


On atomic_ioctl failure compare the failure flag with the expected
invalid reason and pass if same else fail the test.

The corresponding KMD changes are pushed for review @
https://patchwork.freedesktop.org/series/152276/

Signed-off-by: Arun R Murthy <arun.r.murthy at intel.com>
---
 tests/kms_atomic.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index 474df3fa4..c335c8999 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -996,13 +996,17 @@ static void crtc_invalid_params_fence(data_t *data, igt_output_t *output)
 static void atomic_invalid_params(data_t *data, igt_output_t *output)
 {
 	struct drm_mode_atomic ioc;
+	struct drm_mode_atomic_err_code *err_code;
 	uint32_t obj_raw[16]; /* array of objects (sized by count_objs) */
 	uint32_t num_props_raw[16]; /* array of num props per obj (ditto) */
 	uint32_t props_raw[256]; /* array of props (sum of count_props) */
 	uint64_t values_raw[256]; /* array of values for properties (ditto) */
 	int i;
 
+	err_code = malloc(sizeof(struct drm_mode_atomic_err_code));
+	memset(err_code, 0, sizeof(struct drm_mode_atomic_err_code));
 	memset(&ioc, 0, sizeof(ioc));
+	ioc.reserved = (uintptr_t)err_code;
 
 	/* An empty request should do nothing. */
 	do_ioctl(data->drm_fd, DRM_IOCTL_MODE_ATOMIC, &ioc);
@@ -1027,10 +1031,12 @@ static void atomic_invalid_params(data_t *data, igt_output_t *output)
 	/* Valid noop, but with event set should fail. */
 	ioc.flags = DRM_MODE_PAGE_FLIP_EVENT;
 	do_ioctl_err(data->drm_fd, DRM_IOCTL_MODE_ATOMIC, &ioc, EINVAL);
+	igt_assert_eq(err_code->failure_flags, DRM_MODE_ATOMIC_CAP_NOT_ENABLED);
 
 	/* Nonsense flags. */
 	ioc.flags = 0xdeadbeef;
 	do_ioctl_err(data->drm_fd, DRM_IOCTL_MODE_ATOMIC, &ioc, EINVAL);
+	igt_assert_eq(err_code->failure_flags, DRM_MODE_ATOMIC_INVALID_FLAG);
 
 	ioc.flags = 0;
 	/* Safety check that flags is reset properly. */
-- 
2.25.1



More information about the igt-dev mailing list