Skip to contentSkip to conversation

igt/tests: Fix error checking in kms_atomic_transition

PATCH Superseded Stanislav Lisovskiy via igt-dev 2 participants 4 messages Feb 15, 2019

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 igt/tests: Fix error checking in kms_atomic_transition

From: Stanislav Lisovskiy <[email protected]>

There is no guarantee that error return value will be always EINVAL, made a check more general as it can be ERANGE, ENOSPC, EINVAL and probably others, which all mean the same in context of this test case: i.e this sprite size is not valid.

v2: Added macro to make check look a bit nicer.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109225

---
 tests/kms_atomic_transition.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
tests/kms_atomic_transition.c +8 -2
index 12bafe87..32bff1e9 100644
@@ -187,6 +187,11 @@ static void set_sprite_wh(igt_display_t *display, enum pipe pipe,
 		      LOCAL_DRM_FORMAT_MOD_NONE, sprite_fb);
 }
 
+#define is_atomic_check_failure_errno(errno) \
+		(errno == -EINVAL || \
+		errno == -ERANGE || \
+		errno == -ENOSPC)
+
 static void setup_parms(igt_display_t *display, enum pipe pipe,
 			const drmModeModeInfo *mode,
 			struct igt_fb *primary_fb,
@@ -252,7 +257,7 @@ retry:
 		wm_setup_plane(display, pipe, (1 << n_planes) - 1, parms, false);
 		ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
 
-		if (ret == -EINVAL) {
+		if (is_atomic_check_failure_errno(ret)) {
 			if (cursor_width == sprite_width &&
 			    cursor_height == sprite_height) {
 				igt_assert_f(alpha,
@@ -391,6 +396,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 	igt_plane_t *plane;
 	igt_pipe_t *pipe_obj = &display->pipes[pipe];
 	uint32_t iter_max = 1 << pipe_obj->n_planes, i;
+	iter_max = 1 << 3;
 	struct plane_parms parms[pipe_obj->n_planes];
 	unsigned flags = 0;
 	int ret;
@@ -442,7 +448,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 			igt_pipe_request_out_fence(pipe_obj);
 
 		ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
-		if (ret != -EINVAL || pipe_obj->n_planes < 3)
+		if (!is_atomic_check_failure_errno(ret) || pipe_obj->n_planes < 3)
 			break;
 
 		ret = 0;
Signature · 6 lines
2.17.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw
Quoted 47 lines · Stanislav Lisovskiy via igt-dev

From: Stanislav Lisovskiy <[email protected]>

There is no guarantee that error return value will be always EINVAL, made a check more general as it can be ERANGE, ENOSPC, EINVAL and probably others, which all mean the same in context of this test case: i.e this sprite size is not valid.

v2: Added macro to make check look a bit nicer.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109225

---
 tests/kms_atomic_transition.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
tests/kms_atomic_transition.c +5 -0
index 12bafe87..32bff1e9 100644
@@ -187,6 +187,11 @@ static void set_sprite_wh(igt_display_t
 *display, enum pipe pipe,
 		      LOCAL_DRM_FORMAT_MOD_NONE, sprite_fb);
 }
 
+#define is_atomic_check_failure_errno(errno) \
+		(errno == -EINVAL || \
+		errno == -ERANGE || \
+		errno == -ENOSPC)
+
 static void setup_parms(igt_display_t *display, enum pipe pipe,
 			const drmModeModeInfo *mode,
tests/kms_atomic_transition.c +1 -1
 			struct igt_fb *primary_fb,
@@ -252,7 +257,7 @@ retry:
 		wm_setup_plane(display, pipe, (1 << n_planes) - 1,
 parms, false);
 		ret = igt_display_try_commit_atomic(display,
 DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
 
-		if (ret == -EINVAL) {
+		if (is_atomic_check_failure_errno(ret)) {
 			if (cursor_width == sprite_width &&
tests/kms_atomic_transition.c +0 -0
 			    cursor_height == sprite_height) {
 				igt_assert_f(alpha,
@@ -391,6 +396,7 @@ run_transition_test(igt_display_t *display, enum

pipe pipe, igt_output_t *output

tests/kms_atomic_transition.c run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output · line 399

Quoted 4 lines
tests/kms_atomic_transition.c +1 -0
 	igt_plane_t *plane;
 	igt_pipe_t *pipe_obj = &display->pipes[pipe];
 	uint32_t iter_max = 1 << pipe_obj->n_planes, i;
+	iter_max = 1 << 3;

Why this added assignment?

Quoted 12 lines
tests/kms_atomic_transition.c +0 -0
 	struct plane_parms parms[pipe_obj->n_planes];
 	unsigned flags = 0;
 	int ret;
@@ -442,7 +448,7 @@ run_transition_test(igt_display_t *display, enum

pipe pipe, igt_output_t *output

tests/kms_atomic_transition.c +0 -0
 			igt_pipe_request_out_fence(pipe_obj);
 
 		ret = igt_display_try_commit_atomic(display,

DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);

tests/kms_atomic_transition.c +1 -1
-		if (ret != -EINVAL || pipe_obj->n_planes < 3)
+		if (!is_atomic_check_failure_errno(ret) || pipe_obj-
Quoted 1 line

n_planes < 3)

tests/kms_atomic_transition.c run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output · line 454

Quoted 3 lines
tests/kms_atomic_transition.c +0 -0
 			break;
 
 		ret = 0;

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#2 lore raw
Quoted 42 lines · Stuart
Quoted 40 lines · Stanislav Lisovskiy via igt-dev

From: Stanislav Lisovskiy <[email protected]>

There is no guarantee that error return value will be always EINVAL, made a check more general as it can be ERANGE, ENOSPC, EINVAL and probably others, which all mean the same in context of this test case: i.e this sprite size is not valid.

v2: Added macro to make check look a bit nicer.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109225

---
 tests/kms_atomic_transition.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
tests/kms_atomic_transition.c +5 -0
index 12bafe87..32bff1e9 100644
@@ -187,6 +187,11 @@ static void set_sprite_wh(igt_display_t
 *display, enum pipe pipe,
 		      LOCAL_DRM_FORMAT_MOD_NONE, sprite_fb);
 }
 
+#define is_atomic_check_failure_errno(errno) \
+		(errno == -EINVAL || \
+		errno == -ERANGE || \
+		errno == -ENOSPC)
+
 static void setup_parms(igt_display_t *display, enum pipe pipe,
 			const drmModeModeInfo *mode,
tests/kms_atomic_transition.c +0 -0
 			struct igt_fb *primary_fb,
@@ -252,7 +257,7 @@ retry:
 		wm_setup_plane(display, pipe, (1 << n_planes) - 1,
 parms, false);
 		ret = igt_display_try_commit_atomic(display,
 DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
 
Quoted 14 lines

tests/kms_atomic_transition.c run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output · line 399

Quoted 12 lines
tests/kms_atomic_transition.c +1 -1
-		if (ret == -EINVAL) {
+		if (is_atomic_check_failure_errno(ret)) {
 			if (cursor_width == sprite_width &&
tests/kms_atomic_transition.c +0 -0
 			    cursor_height == sprite_height) {
 				igt_assert_f(alpha,
@@ -391,6 +396,7 @@ run_transition_test(igt_display_t *display,

enum
pipe pipe, igt_output_t *output

tests/kms_atomic_transition.c +1 -0
 	igt_plane_t *plane;
 	igt_pipe_t *pipe_obj = &display->pipes[pipe];
 	uint32_t iter_max = 1 << pipe_obj->n_planes, i;
+	iter_max = 1 << 3;

Why this added assignment?

Oooh, thank you so much. I've put it here, when I was debugging and didn't remove it!..

Quoted 19 lines
Quoted 19 lines
tests/kms_atomic_transition.c +0 -0
 	struct plane_parms parms[pipe_obj->n_planes];
 	unsigned flags = 0;
 	int ret;
@@ -442,7 +448,7 @@ run_transition_test(igt_display_t *display,

enum
pipe pipe, igt_output_t *output

tests/kms_atomic_transition.c +0 -0
 			igt_pipe_request_out_fence(pipe_obj);
 
 		ret = igt_display_try_commit_atomic(display,

DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);

tests/kms_atomic_transition.c +1 -1
-		if (ret != -EINVAL || pipe_obj->n_planes < 3)
+		if (!is_atomic_check_failure_errno(ret) ||

pipe_obj-

Quoted 1 line

n_planes < 3)

tests/kms_atomic_transition.c +0 -0
 			break;
 
 		ret = 0;
Signature · 7 lines
Best Regards,

Lisovskiy Stanislav
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#3 lore raw

[igt-dev] ✗ Fi.CI.BAT: failure for igt/tests: Fix error checking in kms_atomic_transition (rev2)

In reply to Stanislav Lisovskiy via igt-dev
== Series Details ==

== Series Details ==

Series: igt/tests: Fix error checking in kms_atomic_transition (rev2)
URL : https://patchwork.freedesktop.org/series/56617/
State : failure

== Summary ==

Applying: igt/tests: Fix error checking in kms_atomic_transition Using index info to reconstruct a base tree...
M tests/kms_atomic_transition.c
Falling back to patching base and 3-way merge...
Auto-merging tests/kms_atomic_transition.c
CONFLICT (content): Merge conflict in tests/kms_atomic_transition.c Patch failed at 0001 igt/tests: Fix error checking in kms_atomic_transition When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev