public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Arun R Murthy <arun.r.murthy@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Arun R Murthy <arun.r.murthy@intel.com>
Subject: [PATCH i-g-t] tests/kms_atomic: Read the error msg on atomic_ioctl failure
Date: Tue, 10 Feb 2026 14:23:33 +0530	[thread overview]
Message-ID: <20260210085333.3250279-1-arun.r.murthy@intel.com> (raw)
In-Reply-To: <20250822065535.213451-1-arun.r.murthy@intel.com>

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@intel.com>
---
 tests/kms_atomic.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index fa321cc3c..a609a9f14 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -1041,13 +1041,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);
@@ -1076,14 +1080,18 @@ static void atomic_invalid_params(data_t *data, igt_output_t *output)
 	/* Nonsense flags. */
 	ioc.flags = 0xdeadbeef;
 	do_ioctl_err(data->drm_fd, DRM_IOCTL_MODE_ATOMIC, &ioc, EINVAL);
+	if (igt_has_drm_cap(data->drm_fd, DRM_CAP_ATOMIC_ERROR_REPORTING))
+		igt_assert_eq(err_code->failure_code, DRM_MODE_ATOMIC_INVALID_API_USAGE);
 
 	ioc.flags = 0;
 	/* Safety check that flags is reset properly. */
 	do_ioctl(data->drm_fd, DRM_IOCTL_MODE_ATOMIC, &ioc);
 
 	/* Reserved/MBZ. */
-	ioc.reserved = 1;
-	do_ioctl_err(data->drm_fd, DRM_IOCTL_MODE_ATOMIC, &ioc, EINVAL);
+	if (!igt_has_drm_cap(data->drm_fd, DRM_CAP_ATOMIC_ERROR_REPORTING)) {
+		ioc.reserved = 1;
+		do_ioctl_err(data->drm_fd, DRM_IOCTL_MODE_ATOMIC, &ioc, EINVAL);
+	}
 	ioc.reserved = 0;
 	do_ioctl(data->drm_fd, DRM_IOCTL_MODE_ATOMIC, &ioc);
 
-- 
2.25.1


  reply	other threads:[~2026-02-10  8:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-22  6:55 [PATCH i-g-t] tests/kms_atomic: Read the error msg on atomic_ioctl failure Arun R Murthy
2026-02-10  8:53 ` Arun R Murthy [this message]
2026-02-18 13:18   ` Kamil Konieczny
2026-02-19  3:05     ` Murthy, Arun R
2026-03-31 10:29   ` [PATCH i-g-t 1/3] include/drm-uapi: Add atomic_ioctl error codes Arun R Murthy
2026-03-31 10:29     ` [PATCH i-g-t 2/3] include/drm-uapi: Add ERROR_REPORTING capability Arun R Murthy
2026-03-31 10:29     ` [PATCH i-g-t 3/3] tests/kms_atomic: Read the error msg on atomic_ioctl failure Arun R Murthy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260210085333.3250279-1-arun.r.murthy@intel.com \
    --to=arun.r.murthy@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox