[PATCH i-g-t] i915: Add gem_exec_endless

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

 



Verify that an endless batch is not forcibly reset across suspend, but
allowed to finish its task on resume.

Just an initial stub for the most concerning problem.

Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
---
 tests/Makefile.sources        |  3 ++
 tests/i915/gem_exec_endless.c | 94 +++++++++++++++++++++++++++++++++++
 tests/meson.build             |  1 +
 3 files changed, 98 insertions(+)
 create mode 100644 tests/i915/gem_exec_endless.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 08c664776..d63f14b06 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -259,6 +259,9 @@ gem_exec_schedule_SOURCES = i915/gem_exec_schedule.c
 TESTS_progs += gem_exec_store
 gem_exec_store_SOURCES = i915/gem_exec_store.c
 
+TESTS_progs += gem_exec_endless
+gem_exec_endless_SOURCES = i915/gem_exec_endless.c
+
 TESTS_progs += gem_exec_suspend
 gem_exec_suspend_SOURCES = i915/gem_exec_suspend.c
 
diff --git a/tests/i915/gem_exec_endless.c b/tests/i915/gem_exec_endless.c
new file mode 100644
index 000000000..89f7123bd
--- /dev/null
+++ b/tests/i915/gem_exec_endless.c
@@ -0,0 +1,94 @@
+/*
+ * Copyright © 2019 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "igt.h"
+#include "i915/gem_ring.h"
+#include "sw_sync.h"
+
+#define MAX_ENGINES 64
+
+static void endless_suspend(int i915, int state)
+{
+	struct intel_execution_engine2 *e;
+	igt_spin_t *spin[MAX_ENGINES];
+	igt_spin_t *wait[MAX_ENGINES];
+	int count;
+
+	gem_quiescent_gpu(i915);
+
+	count = 0;
+	__for_each_physical_engine(i915, e) {
+		spin[count++] = igt_spin_new(i915,
+					     .engine = e->flags,
+					     .flags = (IGT_SPIN_FENCE_OUT |
+						       IGT_SPIN_NO_PREEMPTION));
+		wait[count++] = igt_spin_new(i915,
+					     .engine = e->flags,
+					     .flags = IGT_SPIN_POLL_RUN);
+	}
+
+	igt_system_suspend_autoresume(state & 0xffff, state >> 16);
+
+	for (int n = 0; n < count; n++) {
+		igt_assert(gem_bo_busy(i915, spin[n]->handle));
+		igt_assert(gem_bo_busy(i915, wait[n]->handle));
+		igt_assert(!igt_spin_has_started(wait[n]));
+
+		igt_spin_end(spin[n]);
+		igt_spin_busywait_until_started(wait[n]);
+
+		igt_assert(!gem_bo_busy(i915, spin[n]->handle));
+		igt_assert_eq(sync_fence_status(spin[n]->out_fence), 0);
+		igt_spin_free(i915, spin[n]);
+
+		igt_assert(gem_bo_busy(i915, wait[n]->handle));
+		igt_spin_free(i915, wait[n]);
+	}
+
+	gem_quiescent_gpu(i915);
+}
+
+igt_main
+{
+	int i915 = -1;
+
+	igt_skip_on_simulation();
+
+	igt_fixture {
+		i915 = drm_open_driver(DRIVER_INTEL);
+		igt_require_gem(i915);
+	}
+
+	igt_subtest_with_dynamic("suspend") {
+		igt_dynamic("S0")
+			endless_suspend(i915, SUSPEND_STATE_FREEZE);
+		igt_dynamic("S3")
+			endless_suspend(i915, SUSPEND_STATE_MEM);
+		igt_dynamic("S4-devices")
+			endless_suspend(i915,
+					SUSPEND_STATE_DISK |
+					SUSPEND_TEST_DEVICES << 16);
+		igt_dynamic("S4")
+			endless_suspend(i915, SUSPEND_STATE_DISK);
+	}
+}
diff --git a/tests/meson.build b/tests/meson.build
index 154b7ad16..65a5b4d2a 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -138,6 +138,7 @@ i915_progs = [
 	'gem_exec_big',
 	'gem_exec_capture',
 	'gem_exec_create',
+	'gem_exec_endless',
 	'gem_exec_faulting_reloc',
 	'gem_exec_fence',
 	'gem_exec_flush',
-- 
2.25.0

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




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux