[PATCH i-g-t] igt/gem_exec_nop/headless: Verify GT performance in headless mode

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

 



From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>

Check that no-op execution speed is the same in headless mode
and with the display active.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100572
Cc: Imre Deak <imre.deak@xxxxxxxxx>
---
 tests/gem_exec_nop.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/tests/gem_exec_nop.c b/tests/gem_exec_nop.c
index 5d0d4957545e..e0e53a3108c6 100644
--- a/tests/gem_exec_nop.c
+++ b/tests/gem_exec_nop.c
@@ -112,6 +112,45 @@ static void single(int fd, uint32_t handle,
 		 ring_name, count, time*1e6 / count);
 }
 
+static void headless(int fd, uint32_t handle)
+{
+	const struct intel_execution_engine *e = &intel_execution_engines[0];
+	unsigned int nr_connected = 0;
+	drmModeConnector *connector;
+	drmModeRes *res;
+	unsigned long n1, n2;
+	double delta;
+
+	res = drmModeGetResources(fd);
+	igt_assert(res);
+
+	/* require one connected connector for the test */
+	for (int i = 0; i < res->count_connectors; i++) {
+		connector = drmModeGetConnectorCurrent(fd, res->connectors[i]);
+		if (connector->connection == DRM_MODE_CONNECTED)
+			nr_connected++;
+		drmModeFreeConnector(connector);
+	}
+	igt_require(nr_connected == 1);
+
+	/* warmup */
+	nop_on_ring(fd, handle, e->exec_id | e->flags, 2, &n1);
+	/* benchmark nops */
+	nop_on_ring(fd, handle, e->exec_id | e->flags, 2, &n1);
+
+	/* force the last connector off */
+	kmstest_unset_all_crtcs(fd, res);
+
+	/* warmup */
+	nop_on_ring(fd, handle, e->exec_id | e->flags, 2, &n2);
+	/* benchmark nops again */
+	nop_on_ring(fd, handle, e->exec_id | e->flags, 2, &n2);
+
+	/* check that the two execution speeds are roughly the same */
+	delta = abs((long)n2 - (long)n1);
+	igt_assert(delta < n1 * 0.1f);
+}
+
 static bool ignore_engine(int fd, unsigned engine)
 {
 	if (engine == 0)
@@ -494,6 +533,9 @@ igt_main
 	igt_subtest("context-sequential")
 		sequential(device, handle, FORKED | CONTEXT, 150);
 
+	igt_subtest("headless")
+		headless(device, handle);
+
 	igt_fixture {
 		igt_stop_hang_detector();
 		gem_close(device, handle);
-- 
2.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://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