[PATCH 5/5] tests/kms_cursor_crc: Add dpms and suspend tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There was some confusion about whether we restore cursors correctly
after dpms and suspend/resume. Apparently we still do!

Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx>
---
 tests/kms_cursor_crc.c | 42 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 0bfe15ee03d4..d33ee932d673 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -63,8 +63,12 @@ typedef struct {
 	int cursor_max_w, cursor_max_h;
 	igt_pipe_crc_t *pipe_crc;
 	uint32_t devid;
+	unsigned flags;
 } data_t;
 
+#define TEST_DPMS (1<<0)
+#define TEST_SUSPEND (1<<1)
+
 static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch)
 {
 	int wl, wr, ht, hb;
@@ -124,6 +128,27 @@ static void do_single_test(data_t *data, int x, int y)
 	igt_display_commit(display);
 	igt_wait_for_vblank(data->drm_fd, data->pipe);
 	igt_pipe_crc_collect_crc(pipe_crc, &crc);
+
+	if (data->flags & (TEST_DPMS | TEST_SUSPEND)) {
+		igt_crc_t crc_after;
+
+		if (data->flags & TEST_DPMS) {
+			igt_debug("dpms off/on cycle\n");
+			kmstest_set_connector_dpms(data->drm_fd,
+						   data->output->config.connector,
+						   DRM_MODE_DPMS_OFF);
+			kmstest_set_connector_dpms(data->drm_fd,
+						   data->output->config.connector,
+						   DRM_MODE_DPMS_ON);
+		}
+
+		if (data->flags & TEST_SUSPEND)
+			igt_system_suspend_autoresume();
+
+		igt_pipe_crc_collect_crc(pipe_crc, &crc_after);
+		igt_assert_crc_equal(&crc, &crc_after);
+	}
+
 	cursor_disable(data);
 	igt_display_commit(display);
 
@@ -248,10 +273,12 @@ static void test_crc_sliding(data_t *data)
 
 static void test_crc_random(data_t *data)
 {
-	int i;
+	int i, max;
+
+	max = data->flags & (TEST_DPMS | TEST_SUSPEND) ? 2 : 50;
 
 	/* Random cursor placement */
-	for (i = 0; i < 50; i++) {
+	for (i = 0; i < max; i++) {
 		int x = rand() % (data->screenw + data->curw * 2) - data->curw;
 		int y = rand() % (data->screenh + data->curh * 2) - data->curh;
 		do_single_test(data, x, y);
@@ -474,6 +501,17 @@ static void run_test_generic(data_t *data)
 			run_test(data, test_crc_sliding, w, h);
 		igt_subtest_f("cursor-%dx%d-random", w, h)
 			run_test(data, test_crc_random, w, h);
+		igt_subtest_f("cursor-%dx%d-dpms", w, h) {
+			data->flags = TEST_DPMS;
+			run_test(data, test_crc_random, w, h);
+			data->flags = 0;
+		}
+
+		igt_subtest_f("cursor-%dx%d-suspend", w, h) {
+			data->flags = TEST_SUSPEND;
+			run_test(data, test_crc_random, w, h);
+			data->flags = 0;
+		}
 
 		igt_fixture
 			igt_remove_fb(data->drm_fd, &data->fb);
-- 
1.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux