public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] tests/kms_atomic: Read the error msg on atomic_ioctl failure
@ 2025-08-22  6:55 Arun R Murthy
  2026-02-10  8:53 ` Arun R Murthy
  0 siblings, 1 reply; 7+ messages in thread
From: Arun R Murthy @ 2025-08-22  6:55 UTC (permalink / raw)
  To: igt-dev; +Cc: Arun R Murthy

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH i-g-t] tests/kms_atomic: Read the error msg on atomic_ioctl failure
  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
  2026-02-18 13:18   ` Kamil Konieczny
  2026-03-31 10:29   ` [PATCH i-g-t 1/3] include/drm-uapi: Add atomic_ioctl error codes Arun R Murthy
  0 siblings, 2 replies; 7+ messages in thread
From: Arun R Murthy @ 2026-02-10  8:53 UTC (permalink / raw)
  To: igt-dev; +Cc: Arun R Murthy

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH i-g-t] tests/kms_atomic: Read the error msg on atomic_ioctl failure
  2026-02-10  8:53 ` Arun R Murthy
@ 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
  1 sibling, 1 reply; 7+ messages in thread
From: Kamil Konieczny @ 2026-02-18 13:18 UTC (permalink / raw)
  To: Arun R Murthy; +Cc: igt-dev

Hi Arun,
On 2026-02-10 at 14:23:33 +0530, Arun R Murthy wrote:
> 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));

Use calloc.

>  	memset(&ioc, 0, sizeof(ioc));
> +	ioc.reserved = (uintptr_t)err_code;

It is better using function to_user_pointer()

>  
>  	/* 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);

Where is free(err_code)?

Regards,
Kamil 
>  
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH i-g-t] tests/kms_atomic: Read the error msg on atomic_ioctl failure
  2026-02-18 13:18   ` Kamil Konieczny
@ 2026-02-19  3:05     ` Murthy, Arun R
  0 siblings, 0 replies; 7+ messages in thread
From: Murthy, Arun R @ 2026-02-19  3:05 UTC (permalink / raw)
  To: Kamil Konieczny, igt-dev

Hi Kamil,

     Thanks for the review.
Sorry I forgot to add [DO_NOT_REVIEW] tag for this patch.
This patch was pushed just to get to know the usage from user for 
reviewing the KMD patch.
I will be enhance the test and will push the patch for review.

Thanks and Regards,
Arun R Murthy
--------------------

On 18-02-2026 18:48, Kamil Konieczny wrote:
> Hi Arun,
> On 2026-02-10 at 14:23:33 +0530, Arun R Murthy wrote:
>> 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));
> Use calloc.
>
>>   	memset(&ioc, 0, sizeof(ioc));
>> +	ioc.reserved = (uintptr_t)err_code;
> It is better using function to_user_pointer()
>
>>   
>>   	/* 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);
> Where is free(err_code)?
>
> Regards,
> Kamil
>>   
>> -- 
>> 2.25.1
>>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH i-g-t 1/3] include/drm-uapi: Add atomic_ioctl error codes
  2026-02-10  8:53 ` Arun R Murthy
  2026-02-18 13:18   ` Kamil Konieczny
@ 2026-03-31 10:29   ` 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
  1 sibling, 2 replies; 7+ messages in thread
From: Arun R Murthy @ 2026-03-31 10:29 UTC (permalink / raw)
  To: igt-dev; +Cc: Arun R Murthy

KMD adds a new feature to return a user readable error code on
atomic_ioctl failure. This error code can be used to take corrective
measurements and also be used for error/debug logging.
The corresponding KMD patches are under review @
https://patchwork.freedesktop.org/series/152275/

Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
---
 include/drm-uapi/drm_mode.h | 56 +++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/include/drm-uapi/drm_mode.h b/include/drm-uapi/drm_mode.h
index de10ce859..f5e88cd7a 100644
--- a/include/drm-uapi/drm_mode.h
+++ b/include/drm-uapi/drm_mode.h
@@ -45,6 +45,7 @@ extern "C" {
 #define DRM_CONNECTOR_NAME_LEN	32
 #define DRM_DISPLAY_MODE_LEN	32
 #define DRM_PROP_NAME_LEN	32
+#define DRM_MODE_ATOMIC_FAILURE_STRING_LEN	128
 
 #define DRM_MODE_TYPE_BUILTIN	(1<<0) /* deprecated */
 #define DRM_MODE_TYPE_CLOCK_C	((1<<1) | DRM_MODE_TYPE_BUILTIN) /* deprecated */
@@ -1241,6 +1242,61 @@ struct drm_mode_destroy_dumb {
 		DRM_MODE_ATOMIC_NONBLOCK |\
 		DRM_MODE_ATOMIC_ALLOW_MODESET)
 
+/**
+ * enum drm_mode_atomic_failure_codes -  error codes for failures in atomic_ioctl
+ * @DRM_MODE_ATOMIC_UNSPECIFIED_ERROR: this is the default/unspecified error.
+ * @DRM_MODE_ATOMIC_INVALID_API_USAGE: invallid API usage(DRM_ATOMIC not
+ *				       enabled, invalid falg, page_flip event
+ *				       with test-only, etc)
+ * @DRM_MODE_ATOMIC_NEED_FULL_MODESET: Need full modeset on all connected crtc's
+ * @DRM_MODE_ATOMIC_ASYNC_PROP_CHANGED: Property changed in async flip
+ * @DRM_MODE_ATOMIC_SCANOUT_BW: For a given resolution, refresh rate and the
+ *                              color depth cannot be accomodated. Resolution
+ *                              is to lower the refresh rate or color depth.
+ * @DRM_MODE_ATOMIC_CONNECTOR_BW: Refers to the limitation on the link rate on
+ *                                a given connector.
+ * @DRM_MODE_ATOMIC_PIPE_BW: Limitation on the pipe, either pipe not available
+ *                           or the pipe scaling factor limitation.
+ * @DRM_MODE_ATOMIC_MEMORY_DOMAIN: Any other memory/bandwidth related limitation
+ *                                 other then the ones specified above.
+ * @DRM_MODE_ATOMIC_SPEC_VIOLOATION: Limitation of a particular feature on that
+ *                                   hardware. To get to know the feature, the
+ *                                   property/object causing this is being sent
+ *                                   back to user @failure_objs_ptr in the
+ *                                   struct drm_mode_atomic_err_code
+ */
+enum drm_mode_atomic_failure_codes {
+	DRM_MODE_ATOMIC_UNSPECIFIED_ERROR,
+	DRM_MODE_ATOMIC_INVALID_API_USAGE,
+	DRM_MODE_ATOMIC_NEED_FULL_MODESET,
+	DRM_MODE_ATOMIC_ASYNC_PROP_CHANGED,
+	DRM_MODE_ATOMIC_SCANOUT_BW,
+	DRM_MODE_ATTOMIC_CONNECTOR_BW,
+	DRM_MODE_ATTOMIC_PIPE_BW,
+	DRM_MODE_ATOMIC_MEMORY_DOMAIN,
+	DRM_MODE_ATOMIC_SPEC_VIOLOATION,
+};
+
+/**
+ * struct drm_mode_atomic_err_code - struct to store the error code
+ *
+ * pointer to this struct will be stored in reserved variable of
+ * struct drm_mode_atomic to report the failure cause to the user.
+ *
+ * @failure_code: error codes defined in enum drm_moide_atomic_failure_code
+ * @failure_objs_ptr: pointer to the drm_object that caused error
+ * @reserved: reserved for future use
+ * @count_objs: count of drm_objects if multiple drm_objects caused error
+ * @failure_string: user readable error message string
+ */
+struct drm_mode_atomic_err_code {
+	__u64 failure_code;
+	__u64 failure_objs_ptr;
+	__u64 reserved;
+	__u32 count_objs;
+	char failure_string[DRM_MODE_ATOMIC_FAILURE_STRING_LEN];
+};
+
 struct drm_mode_atomic {
 	__u32 flags;
 	__u32 count_objs;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH i-g-t 2/3] include/drm-uapi: Add ERROR_REPORTING capability
  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     ` 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
  1 sibling, 0 replies; 7+ messages in thread
From: Arun R Murthy @ 2026-03-31 10:29 UTC (permalink / raw)
  To: igt-dev; +Cc: Arun R Murthy

KMD adds error reporting on atomic_ioctl failure. A capability has been
added for the same to check the compatability.

KMD patch is under review @
https://patchwork.freedesktop.org/series/152275/

Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
---
 include/drm-uapi/drm.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/drm-uapi/drm.h b/include/drm-uapi/drm.h
index baa620e3f..dd3fa4350 100644
--- a/include/drm-uapi/drm.h
+++ b/include/drm-uapi/drm.h
@@ -775,6 +775,13 @@ struct drm_gem_open {
  * commits.
  */
 #define DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP	0x15
+/**
+ * DRM_CAP_ATOMIC_ERROR_REPORTING
+ *
+ * If set to 1, the driver supports reporting of failure codes on error in
+ * atomic ioctl().
+ */
+#define DRM_CAP_ATOMIC_ERROR_REPORTING	0x16
 
 /* DRM_IOCTL_GET_CAP ioctl argument type */
 struct drm_get_cap {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH i-g-t 3/3] tests/kms_atomic: Read the error msg on atomic_ioctl failure
  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     ` Arun R Murthy
  1 sibling, 0 replies; 7+ messages in thread
From: Arun R Murthy @ 2026-03-31 10:29 UTC (permalink / raw)
  To: igt-dev; +Cc: Arun R Murthy

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 | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index ce5b00cd3..b28714981 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -1043,6 +1043,7 @@ 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) */
@@ -1050,6 +1051,7 @@ static void atomic_invalid_params(data_t *data, igt_output_t *output)
 	int i;
 
 	memset(&ioc, 0, sizeof(ioc));
+	ioc.reserved = to_user_pointer(&err_code);
 
 	/* An empty request should do nothing. */
 	do_ioctl(data->drm_fd, DRM_IOCTL_MODE_ATOMIC, &ioc);
@@ -1078,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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-31 10:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox