summaryrefslogtreecommitdiff
path: root/lib/i915
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>2018-03-29 14:05:27 +0100
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>2018-04-03 16:39:57 +0100
commit3df3dcf6fca6174c9dad49f37f019ce50aaf2885 (patch)
tree1c9a3a013f9a2917796efe3e414dde3def2095d3 /lib/i915
parentda00bf83aba3b516922efa1f338381189461aa4a (diff)
tests/gem_eio: Never re-use contexts which were in the middle of GPU reset
Contexts executing when reset triggers are potentialy corrupt so trying to use them from a subsequent test (like the default context) can hang the GPU or even the driver. Workaround that by always creating a dedicated context which will be running when GPU reset happens. v2: * Export and use gem_reopen_device so the test works on old gens as well. (Chris Wilson) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/i915')
-rw-r--r--lib/i915/gem_submission.c11
-rw-r--r--lib/i915/gem_submission.h2
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/i915/gem_submission.c b/lib/i915/gem_submission.c
index 7d3cbdbf..2fd460d5 100644
--- a/lib/i915/gem_submission.c
+++ b/lib/i915/gem_submission.c
@@ -165,7 +165,14 @@ bool gem_has_guc_submission(int fd)
return gem_submission_method(fd) & GEM_SUBMISSION_GUC;
}
-static int reopen_driver(int fd)
+/**
+ * gem_reopen_driver:
+ * @fd: re-open the i915 drm file descriptor
+ *
+ * Re-opens the drm fd which is useful in instances where a clean default
+ * context is needed.
+ */
+int gem_reopen_driver(int fd)
{
char path[256];
@@ -201,7 +208,7 @@ void gem_test_engine(int i915, unsigned int engine)
.buffer_count = 1,
};
- i915 = reopen_driver(i915);
+ i915 = gem_reopen_driver(i915);
igt_assert(!is_wedged(i915));
obj.handle = gem_create(i915, 4096);
diff --git a/lib/i915/gem_submission.h b/lib/i915/gem_submission.h
index 6b39a053..f94eabb2 100644
--- a/lib/i915/gem_submission.h
+++ b/lib/i915/gem_submission.h
@@ -35,4 +35,6 @@ bool gem_has_guc_submission(int fd);
void gem_test_engine(int fd, unsigned int engine);
+int gem_reopen_driver(int fd);
+
#endif /* GEM_SUBMISSION_H */