[Intel-gfx] [PATCH 18/22] flip_test: make page flip tests conditional

Imre Deak imre.deak at intel.com
Tue Oct 16 16:34:52 CEST 2012


Since later we want to add vblank tests where we don't want to flip,
make the flips and corresponding state checks conditional.

No functional change.

Signed-off-by: Imre Deak <imre.deak at intel.com>
---
 tests/flip_test.c |   33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/tests/flip_test.c b/tests/flip_test.c
index a0c1e5d..45bd9e5 100644
--- a/tests/flip_test.c
+++ b/tests/flip_test.c
@@ -48,6 +48,7 @@
 #define TEST_CHECK_TS		(1 << 4)
 #define TEST_EBUSY		(1 << 5)
 #define TEST_EINVAL		(1 << 6)
+#define TEST_FLIP		(1 << 7)
 
 drmModeRes *resources;
 int drm_fd;
@@ -251,7 +252,8 @@ static void check_state(struct test_output *o, struct event_state *es)
 
 static void check_all_state(struct test_output *o)
 {
-	check_state(o, &o->flip_state);
+	if (o->flags & TEST_FLIP)
+		check_state(o, &o->flip_state);
 }
 
 static void run_test_step(struct test_output *o)
@@ -259,6 +261,9 @@ static void run_test_step(struct test_output *o)
 	unsigned int new_fb_id;
 	/* for funny reasons page_flip returns -EBUSY on disabled crtcs ... */
 	int expected_einval = o->flags & TEST_MODESET ? -EBUSY : -EINVAL;
+	bool do_flip;
+
+	do_flip = o->flags & TEST_FLIP;
 
 	/* pan before the flip completes */
 	if (o->flags & TEST_PAN) {
@@ -282,7 +287,7 @@ static void run_test_step(struct test_output *o)
 	o->current_fb_id = !o->current_fb_id;
 	new_fb_id = o->fb_ids[o->current_fb_id];
 
-	if ((o->flags & TEST_EINVAL) && o->flip_state.count > 0)
+	if (do_flip && (o->flags & TEST_EINVAL) && o->flip_state.count > 0)
 		assert(do_page_flip(o, new_fb_id) == expected_einval);
 
 	if (o->flags & TEST_MODESET) {
@@ -301,9 +306,10 @@ static void run_test_step(struct test_output *o)
 
 	printf("."); fflush(stdout);
 
-	do_or_die(do_page_flip(o, new_fb_id));
+	if (do_flip)
+		do_or_die(do_page_flip(o, new_fb_id));
 
-	if (o->flags & TEST_EBUSY)
+	if (do_flip && (o->flags & TEST_EBUSY))
 		assert(do_page_flip(o, new_fb_id) == -EBUSY);
 
 	if (o->flags & TEST_DPMS)
@@ -320,7 +326,7 @@ static void run_test_step(struct test_output *o)
 		}
 	}
 
-	if (o->flags & TEST_EINVAL)
+	if (do_flip && (o->flags & TEST_EINVAL))
 		assert(do_page_flip(o, new_fb_id) == expected_einval);
 }
 
@@ -593,7 +599,8 @@ static void flip_mode(struct test_output *o, int duration)
 
 	ellapsed = event_loop(o, duration);
 
-	check_final_state(o, &o->flip_state, ellapsed);
+	if (o->flags & TEST_FLIP)
+		check_final_state(o, &o->flip_state, ellapsed);
 
 	fprintf(stdout, "\n%s on crtc %d, connector %d: PASSED\n\n",
 		o->test_name, crtc, o->id);
@@ -642,13 +649,13 @@ int main(int argc, char **argv)
 		int flags;
 		const char *name;
 	} tests[] = {
-		{ 15, TEST_CHECK_TS | TEST_EBUSY , "plain flip" },
-		{ 30, TEST_DPMS | TEST_EINVAL, "flip vs dpms" },
-		{ 30, TEST_DPMS | TEST_WITH_DUMMY_LOAD, "delayed flip vs. dpms" },
-		{ 5, TEST_PAN, "flip vs panning" },
-		{ 30, TEST_PAN | TEST_WITH_DUMMY_LOAD, "delayed flip vs panning" },
-		{ 30, TEST_MODESET | TEST_EINVAL, "flip vs modeset" },
-		{ 30, TEST_MODESET | TEST_WITH_DUMMY_LOAD, "delayed flip vs modeset" },
+		{ 15, TEST_FLIP | TEST_CHECK_TS | TEST_EBUSY , "plain flip" },
+		{ 30, TEST_FLIP | TEST_DPMS | TEST_EINVAL, "flip vs dpms" },
+		{ 30, TEST_FLIP | TEST_DPMS | TEST_WITH_DUMMY_LOAD, "delayed flip vs dpms" },
+		{ 5,  TEST_FLIP | TEST_PAN, "flip vs panning" },
+		{ 30, TEST_FLIP | TEST_PAN | TEST_WITH_DUMMY_LOAD, "delayed flip vs panning" },
+		{ 30, TEST_FLIP | TEST_MODESET | TEST_EINVAL, "flip vs modeset" },
+		{ 30, TEST_FLIP | TEST_MODESET | TEST_WITH_DUMMY_LOAD, "delayed flip vs modeset" },
 	};
 	int i;
 
-- 
1.7.9.5




More information about the Intel-gfx mailing list