diff mbox

[i-g-t,v1,5/6] tests/kms_cursor_legacy: Switch to using for_each_pipe construct

Message ID 20170119163506.13270-6-robert.foss@collabora.com (mailing list archive)
State New, archived
Headers show

Commit Message

Robert Foss Jan. 19, 2017, 4:35 p.m. UTC
Avoid using hand-rolled construct for iterating over all pipes.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_cursor_legacy.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

Comments

Chris Wilson Jan. 19, 2017, 5:17 p.m. UTC | #1
On Thu, Jan 19, 2017 at 11:35:05AM -0500, Robert Foss wrote:
> Avoid using hand-rolled construct for iterating over all pipes.

display->n_pipes is a variable and depends upon the drmModeGetResources().
It not only changes between machines, but we don't probe the resources
when listing tests. Both lead to variable sets of tests.
-Chris
Robert Foss Jan. 19, 2017, 5:35 p.m. UTC | #2
On 2017-01-19 12:17 PM, Chris Wilson wrote:
> On Thu, Jan 19, 2017 at 11:35:05AM -0500, Robert Foss wrote:
>> Avoid using hand-rolled construct for iterating over all pipes.
>
> display->n_pipes is a variable and depends upon the drmModeGetResources().
> It not only changes between machines, but we don't probe the resources
> when listing tests. Both lead to variable sets of tests.
> -Chris
>

Primarily I was intending to avoid the igt_skip_on()_on by using a 
commonly used structures that Should Just Work, for_each_pipe().

Does that make sense?


Rob.
Chris Wilson Jan. 19, 2017, 7:01 p.m. UTC | #3
On Thu, Jan 19, 2017 at 12:35:48PM -0500, Robert Foss wrote:
> 
> 
> On 2017-01-19 12:17 PM, Chris Wilson wrote:
> >On Thu, Jan 19, 2017 at 11:35:05AM -0500, Robert Foss wrote:
> >>Avoid using hand-rolled construct for iterating over all pipes.
> >
> >display->n_pipes is a variable and depends upon the drmModeGetResources().
> >It not only changes between machines, but we don't probe the resources
> >when listing tests. Both lead to variable sets of tests.
> >-Chris
> >
> 
> Primarily I was intending to avoid the igt_skip_on()_on by using a
> commonly used structures that Should Just Work, for_each_pipe().
> 
> Does that make sense?

Sure it makes sense. It just doesn't work right now.
-Chris
diff mbox

Patch

diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index 5e9f5f39..156bd0c7 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -1360,6 +1360,7 @@  igt_main
 {
 	const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
 	igt_display_t display = { .drm_fd = -1 };
+	enum pipe pipe;
 	int i;
 
 	igt_skip_on_simulation();
@@ -1373,27 +1374,23 @@  igt_main
 	}
 
 	igt_subtest_group {
-		for (int n = 0; n < I915_MAX_PIPES; n++) {
+		for_each_pipe(&display, pipe) {
 			errno = 0;
 
-			igt_fixture {
-				igt_skip_on(n >= display.n_pipes);
-			}
-
-			igt_subtest_f("pipe-%s-single-bo", kmstest_pipe_name(n))
-				stress(&display, n, 1, DRM_MODE_CURSOR_BO, 20);
-			igt_subtest_f("pipe-%s-single-move", kmstest_pipe_name(n))
-				stress(&display, n, 1, DRM_MODE_CURSOR_MOVE, 20);
+			igt_subtest_f("pipe-%s-single-bo", kmstest_pipe_name(pipe))
+				stress(&display, pipe, 1, DRM_MODE_CURSOR_BO, 20);
+			igt_subtest_f("pipe-%s-single-move", kmstest_pipe_name(pipe))
+				stress(&display, pipe, 1, DRM_MODE_CURSOR_MOVE, 20);
 
-			igt_subtest_f("pipe-%s-forked-bo", kmstest_pipe_name(n))
-				stress(&display, n, ncpus, DRM_MODE_CURSOR_BO, 20);
-			igt_subtest_f("pipe-%s-forked-move", kmstest_pipe_name(n))
-				stress(&display, n, ncpus, DRM_MODE_CURSOR_MOVE, 20);
+			igt_subtest_f("pipe-%s-forked-bo", kmstest_pipe_name(pipe))
+				stress(&display, pipe, ncpus, DRM_MODE_CURSOR_BO, 20);
+			igt_subtest_f("pipe-%s-forked-move", kmstest_pipe_name(pipe))
+				stress(&display, pipe, ncpus, DRM_MODE_CURSOR_MOVE, 20);
 
-			igt_subtest_f("pipe-%s-torture-bo", kmstest_pipe_name(n))
-				stress(&display, n, -ncpus, DRM_MODE_CURSOR_BO, 20);
-			igt_subtest_f("pipe-%s-torture-move", kmstest_pipe_name(n))
-				stress(&display, n, -ncpus, DRM_MODE_CURSOR_MOVE, 20);
+			igt_subtest_f("pipe-%s-torture-bo", kmstest_pipe_name(pipe))
+				stress(&display, pipe, -ncpus, DRM_MODE_CURSOR_BO, 20);
+			igt_subtest_f("pipe-%s-torture-move", kmstest_pipe_name(pipe))
+				stress(&display, pipe, -ncpus, DRM_MODE_CURSOR_MOVE, 20);
 		}
 	}