summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichał Winiarski <michal.winiarski@intel.com>2017-10-16 11:05:14 +0200
committerArkadiusz Hiler <arkadiusz.hiler@intel.com>2017-10-17 10:26:30 +0300
commitf6dfe556659f5473e4bf13cc8d4770ac39c7d678 (patch)
treed28fb03f0832c680e67771df4722cc3ccd3b9302 /lib
parentd4d976de7e022cb56a2dbfe96c4ab10549e24acc (diff)
lib: Extract helpers for determining submission method
Couple of tests are using either determining submission method, or pretty printing. Let's move those to helpers in lib. v2: s/igt_show/gem_show Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Katarzyna Dec <katarzyna.dec@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Katarzyna Dec <katarzyna.dec@intel.com> Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_aux.c18
-rw-r--r--lib/igt_aux.h2
-rw-r--r--lib/igt_gt.c63
-rw-r--r--lib/igt_gt.h7
4 files changed, 90 insertions, 0 deletions
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index ee53559c..c1082143 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -1493,6 +1493,24 @@ igt_show_stat(proc_t *info, int *state, const char *fn)
++*state;
}
+void gem_show_submission_method(int fd)
+{
+ const unsigned flags = gem_submission_method(fd);
+
+ if (flags & GEM_SUBMISSION_GUC) {
+ igt_info("Using GuC submission\n");
+ return;
+ }
+
+ if (flags & GEM_SUBMISSION_EXECLISTS) {
+ igt_info("Using Execlists submission\n");
+ return;
+ }
+
+ igt_info("Using Legacy submission%s\n",
+ flags & GEM_SUBMISSION_SEMAPHORES ? ", with semaphores" : "");
+}
+
static void
__igt_lsof_fds(proc_t *proc_info, int *state, char *proc_path, const char *dir)
{
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 688ad1b8..e4a48eba 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -280,6 +280,8 @@ void igt_unlock_mem(void);
ret_; \
})
+void gem_show_submission_method(int fd);
+
struct igt_mean;
void igt_start_siglatency(int sig); /* 0 => SIGRTMIN (default) */
double igt_stop_siglatency(struct igt_mean *result);
diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index f6cc20b0..601b03f6 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -607,3 +607,66 @@ bool gem_can_store_dword(int fd, unsigned int engine)
return true;
}
+
+/**
+ * gem_submission_method:
+ * @fd: open i915 drm file descriptor
+ *
+ * Returns: Submission method bitmap.
+ */
+unsigned gem_submission_method(int fd)
+{
+ unsigned flags = 0;
+ bool active;
+ int dir;
+
+ dir = igt_sysfs_open_parameters(fd);
+ if (dir < 0)
+ return 0;
+
+ active = igt_sysfs_get_boolean(dir, "enable_guc_submission");
+ if (active) {
+ flags |= GEM_SUBMISSION_GUC | GEM_SUBMISSION_EXECLISTS;
+ goto out;
+ }
+
+ active = igt_sysfs_get_boolean(dir, "enable_execlists");
+ if (active) {
+ flags |= GEM_SUBMISSION_EXECLISTS;
+ goto out;
+ }
+
+ active = igt_sysfs_get_boolean(dir, "semaphores");
+ if (active) {
+ flags |= GEM_SUBMISSION_SEMAPHORES;
+ }
+
+out:
+ close(dir);
+ return flags;
+}
+
+
+/**
+ * gem_has_semaphores:
+ * @fd: open i915 drm file descriptor
+ *
+ * Feature test macro to query whether the driver is using semaphores for
+ * synchronization between engines.
+ */
+bool gem_has_semaphores(int fd)
+{
+ return gem_submission_method(fd) & GEM_SUBMISSION_SEMAPHORES;
+}
+
+/**
+ * gem_has_execlists:
+ * @fd: open i915 drm file descriptor
+ *
+ * Feature test macro to query whether the driver is using execlists as a
+ * hardware submission method.
+ */
+bool gem_has_execlists(int fd)
+{
+ return gem_submission_method(fd) & GEM_SUBMISSION_EXECLISTS;
+}
diff --git a/lib/igt_gt.h b/lib/igt_gt.h
index 2579cbd3..6b8f78eb 100644
--- a/lib/igt_gt.h
+++ b/lib/igt_gt.h
@@ -80,4 +80,11 @@ extern const struct intel_execution_engine {
bool gem_can_store_dword(int fd, unsigned int engine);
+#define GEM_SUBMISSION_SEMAPHORES (1 << 0)
+#define GEM_SUBMISSION_EXECLISTS (1 << 1)
+#define GEM_SUBMISSION_GUC (1 << 2)
+unsigned gem_submission_method(int fd);
+bool gem_has_semaphores(int fd);
+bool gem_has_execlists(int fd);
+
#endif /* IGT_GT_H */