Skip to contentSkip to conversation

lib: Extract helpers for determining submission method

PATCH In review Michał Winiarski 3 participants 8 messages Oct 16, 2017 – Oct 17, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 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

---
 lib/igt_aux.c               | 18 +++++++++++++
 lib/igt_aux.h               |  2 ++
 lib/igt_gt.c                | 63 +++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_gt.h                |  7 +++++
 tests/gem_ctx_thrash.c      | 19 ++------------
 tests/gem_eio.c             | 45 ++------------------------------
 tests/gem_exec_await.c      | 39 ++--------------------------
 tests/gem_exec_fence.c      | 41 +++--------------------------
 tests/gem_exec_latency.c    | 31 +---------------------
 tests/gem_exec_nop.c        | 31 +---------------------
 tests/gem_exec_schedule.c   | 40 ++--------------------------
 tests/gem_exec_whisper.c    | 31 +---------------------
 tests/gem_read_read_speed.c | 17 +-----------
 tests/gem_sync.c            | 31 +---------------------
 14 files changed, 106 insertions(+), 309 deletions(-)
lib/igt_aux.c +18 -0
index fa6594c3..cacc8f98 100644
@@ -1455,6 +1455,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)
 {
lib/igt_aux.h +2 -0
index 499a1679..1fdb2259 100644
@@ -278,6 +278,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);
lib/igt_gt.c +63 -0

66 lines not on this page · raw message

lib/igt_gt.h +7 -0
index 2579cbd3..6b8f78eb 100644
@@ -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 */
tests/gem_ctx_thrash.c +2 -17
index f79a1f4f..c0740b9f 100644
@@ -42,21 +42,6 @@ static void xchg_int(void *array, unsigned i, unsigned j)
 	igt_swap(A[i], A[j]);
 }
 
-static bool has_execlists(int fd)
-{
-	bool enabled = false;
-	int dir;
-
-	dir = igt_sysfs_open_parameters(fd);
-	if (dir < 0)
-		return false;
-
-	enabled = igt_sysfs_get_boolean(dir, "enable_execlists");
-	close(dir);
-
-	return enabled;
-}
-
 static unsigned context_size(int fd)
 {
 	const int gen = intel_gen(intel_get_drm_devid(fd));
@@ -86,7 +71,7 @@ static unsigned get_num_contexts(int fd, int num_engines)
 	ggtt_size = gem_global_aperture_size(fd);
 
 	size = context_size(fd);
-	if (has_execlists(fd)) {
+	if (gem_has_execlists(fd)) {
 		size += 4 << 12; /* ringbuffer as well */
 		if (num_engines) /* one per engine with execlists */
 			size *= num_engines;
@@ -95,7 +80,7 @@ static unsigned get_num_contexts(int fd, int num_engines)
 	count = 3 * (ggtt_size / size) / 2;
 	igt_info("Creating %lld contexts (assuming of size %lld%s)\n",
 		 (long long)count, (long long)size,
-		 has_execlists(fd) ? " with execlists" : "");
+		 gem_has_execlists(fd) ? " with execlists" : "");
 
 	intel_require_memory(count, size, CHECK_RAM | CHECK_SWAP);
 	return count;
tests/gem_eio.c +2 -43

69 lines not on this page · raw message

tests/gem_exec_await.c +2 -37
index fb5c0f30..326783a1 100644
@@ -246,40 +246,6 @@ static void wide(int fd, int ring_size, int timeout, unsigned int flags)
 	free(exec);
 }
 
-#define HAVE_EXECLISTS 0x1
-static unsigned int print_welcome(int fd)
-{
-	unsigned int result = 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) {
-		igt_info("Using GuC submission\n");
-		result |= HAVE_EXECLISTS;
-		goto out;
-	}
-
-	active = igt_sysfs_get_boolean(dir, "enable_execlists");
-	if (active) {
-		igt_info("Using Execlists submission\n");
-		result |= HAVE_EXECLISTS;
-		goto out;
-	}
-
-	active = igt_sysfs_get_boolean(dir, "semaphores");
-	igt_info("Using Legacy submission%s\n",
-		 active ? ", with semaphores" : "");
-
-out:
-	close(dir);
-	return result;
-}
-
 struct cork {
 	int device;
 	uint32_t handle;
@@ -374,14 +340,13 @@ igt_main
 	int device = -1;
 
 	igt_fixture {
-		unsigned int caps;
 
 		device = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(device);
-		caps = print_welcome(device);
+		gem_show_submission_method(device);
 
 		ring_size = measure_ring_size(device) - 10;
-		if (!(caps & HAVE_EXECLISTS))
+		if (!gem_has_execlists(device))
 			ring_size /= 2;
 		igt_info("Ring size: %d batches\n", ring_size);
 		igt_require(ring_size > 0);
tests/gem_exec_fence.c +3 -38

71 lines not on this page · raw message

tests/gem_exec_latency.c +1 -30
index f86dfcb5..a942c205 100644
@@ -407,35 +407,6 @@ static void latency_from_ring(int fd,
 	gem_close(fd, obj[2].handle);
 }
 
-static void print_welcome(int fd)
-{
-	bool active;
-	int dir;
-
-	dir = igt_sysfs_open_parameters(fd);
-	if (dir < 0)
-		return;
-
-	active = igt_sysfs_get_boolean(dir, "enable_guc_submission");
-	if (active) {
-		igt_info("Using GuC submission\n");
-		goto out;
-	}
-
-	active = igt_sysfs_get_boolean(dir, "enable_execlists");
-	if (active) {
-		igt_info("Using Execlists submission\n");
-		goto out;
-	}
-
-	active = igt_sysfs_get_boolean(dir, "semaphores");
-	igt_info("Using Legacy submission%s\n",
-		 active ? ", with semaphores" : "");
-
-out:
-	close(dir);
-}
-
 igt_main
 {
 	const struct intel_execution_engine *e;
@@ -446,7 +417,7 @@ igt_main
 		igt_require_gem(device);
 		gem_require_mmap_wc(device);
 
-		print_welcome(device);
+		gem_show_submission_method(device);
 
 		ring_size = measure_ring_size(device);
 		igt_info("Ring size: %d batches\n", ring_size);
tests/gem_exec_nop.c +1 -30
index 0af64557..feb89ee3 100644
@@ -665,35 +665,6 @@ static void preempt(int fd, uint32_t handle,
 		 ring_name, count, elapsed(&start, &now)*1e6 / count);
 }
 
-static void print_welcome(int fd)
-{
-	bool active;
-	int dir;
-
-	dir = igt_sysfs_open_parameters(fd);
-	if (dir < 0)
-		return;
-
-	active = igt_sysfs_get_boolean(dir, "enable_guc_submission");
-	if (active) {
-		igt_info("Using GuC submission\n");
-		goto out;
-	}
-
-	active = igt_sysfs_get_boolean(dir, "enable_execlists");
-	if (active) {
-		igt_info("Using Execlists submission\n");
-		goto out;
-	}
-
-	active = igt_sysfs_get_boolean(dir, "semaphores");
-	igt_info("Using Legacy submission%s\n",
-		 active ? ", with semaphores" : "");
-
-out:
-	close(dir);
-}
-
 static unsigned int has_scheduler(int fd)
 {
 	drm_i915_getparam_t gp;
@@ -727,7 +698,7 @@ igt_main
 
 		device = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(device);
-		print_welcome(device);
+		gem_show_submission_method(device);
 		sched_caps = has_scheduler(device);
 
 		handle = gem_create(device, 4096);
tests/gem_exec_schedule.c +2 -38
index ad3688cf..f5c849d0 100644
@@ -1000,45 +1000,9 @@ static unsigned int has_scheduler(int fd)
 	return caps;
 }
 
-#define HAVE_EXECLISTS 0x1
-#define HAVE_GUC 0x2
-static unsigned print_welcome(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) {
-		igt_info("Using GuC submission\n");
-		flags |= HAVE_GUC | HAVE_EXECLISTS;
-		goto out;
-	}
-
-	active = igt_sysfs_get_boolean(dir, "enable_execlists");
-	if (active) {
-		igt_info("Using Execlists submission\n");
-		flags |= HAVE_EXECLISTS;
-		goto out;
-	}
-
-	active = igt_sysfs_get_boolean(dir, "semaphores");
-	igt_info("Using Legacy submission%s\n",
-		 active ? ", with semaphores" : "");
-
-out:
-	close(dir);
-	return flags;
-}
-
 igt_main
 {
 	const struct intel_execution_engine *e;
-	unsigned int exec_caps = 0;
 	unsigned int sched_caps = 0;
 	int fd = -1;
 
@@ -1046,7 +1010,7 @@ igt_main
 
 	igt_fixture {
 		fd = drm_open_driver_master(DRIVER_INTEL);
-		exec_caps = print_welcome(fd);
+		gem_show_submission_method(fd);
 		sched_caps = has_scheduler(fd);
 		igt_require_gem(fd);
 		gem_require_mmap_wc(fd);
@@ -1135,7 +1099,7 @@ igt_main
 			ctx_has_priority(fd);
 
 			/* need separate rings */
-			igt_require(exec_caps & HAVE_EXECLISTS);
+			igt_require(gem_has_execlists(fd));
 		}
 
 		for (e = intel_execution_engines; e->name; e++) {
tests/gem_exec_whisper.c +1 -30
index 15989616..e7f7b1f1 100644
@@ -552,35 +552,6 @@ static void whisper(int fd, unsigned engine, unsigned flags)
 	close(debugfs);
 }
 
-static void print_welcome(int fd)
-{
-	bool active;
-	int dir;
-
-	dir = igt_sysfs_open_parameters(fd);
-	if (dir < 0)
-		return;
-
-	active = igt_sysfs_get_boolean(dir, "enable_guc_submission");
-	if (active) {
-		igt_info("Using GuC submission\n");
-		goto out;
-	}
-
-	active = igt_sysfs_get_boolean(dir, "enable_execlists");
-	if (active) {
-		igt_info("Using Execlists submission\n");
-		goto out;
-	}
-
-	active = igt_sysfs_get_boolean(dir, "semaphores");
-	igt_info("Using Legacy submission%s\n",
-		 active ? ", with semaphores" : "");
-
-out:
-	close(dir);
-}
-
 igt_main
 {
 	const struct mode {
@@ -615,7 +586,7 @@ igt_main
 		fd = drm_open_driver_master(DRIVER_INTEL);
 		igt_require_gem(fd);
 		igt_require(gem_can_store_dword(fd, 0));
-		print_welcome(fd);
+		gem_show_submission_method(fd);
 
 		igt_fork_hang_detector(fd);
 	}
tests/gem_read_read_speed.c +1 -16
index c1d30f24..bbd8e54e 100644
@@ -49,21 +49,6 @@ igt_render_copyfunc_t rendercopy;
 struct intel_batchbuffer *batch;
 int width, height;
 
-static int semaphores_enabled(int fd)
-{
-	bool enabled = false;
-	int dir;
-
-	dir = igt_sysfs_open_parameters(fd);
-	if (dir < 0)
-		return false;
-
-	enabled = igt_sysfs_get_boolean(dir, "semaphores");
-	close(dir);
-
-	return enabled;
-}
-
 static drm_intel_bo *rcs_copy_bo(drm_intel_bo *dst, drm_intel_bo *src)
 {
 	struct igt_buf d = {
@@ -212,7 +197,7 @@ igt_main
 
 		batch =  intel_batchbuffer_alloc(bufmgr, devid);
 
-		igt_info("Semaphores: %d\n", semaphores_enabled(fd));
+		gem_show_submission_method(fd);
 	}
 
 	for (i = 0; sizes[i] != 0; i++) {
tests/gem_sync.c +1 -30
index c9e2f014..f0c5d76f 100644
@@ -807,35 +807,6 @@ preempt(int fd, unsigned ring, int num_children, int timeout)
 	gem_context_destroy(fd, ctx[0]);
 }
 
-static void print_welcome(int fd)
-{
-	bool active;
-	int dir;
-
-	dir = igt_sysfs_open_parameters(fd);
-	if (dir < 0)
-		return;
-
-	active = igt_sysfs_get_boolean(dir, "enable_guc_submission");
-	if (active) {
-		igt_info("Using GuC submission\n");
-		goto out;
-	}
-
-	active = igt_sysfs_get_boolean(dir, "enable_execlists");
-	if (active) {
-		igt_info("Using Execlists submission\n");
-		goto out;
-	}
-
-	active = igt_sysfs_get_boolean(dir, "semaphores");
-	igt_info("Using Legacy submission %s\n",
-		 active ? ", with semaphores" : "");
-
-out:
-	close(dir);
-}
-
 static unsigned int has_scheduler(int fd)
 {
 	drm_i915_getparam_t gp;
@@ -869,7 +840,7 @@ igt_main
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(fd);
-		print_welcome(fd);
+		gem_show_submission_method(fd);
 		sched_caps = has_scheduler(fd);
 
 		igt_fork_hang_detector(fd);
Signature · 6 lines
2.13.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH v2 2/4 lib/i915: Extract helpers for determining scheduler capabilities

Couple of tests are using either determining scheduler capabilities or pretty printing. Let's move those to helpers in lib. We can also keep the value obtained from getparam static.

v2: Break the trend of expanding ioctl_wrappers

---
 .../intel-gpu-tools/intel-gpu-tools-docs.xml       |   5 +
 lib/Makefile.sources                               |   2 +
 lib/i915/gem_scheduler.c                           | 125 +++++++++++++++++++++
 lib/i915/gem_scheduler.h                           |  37 ++++++
 lib/ioctl_wrappers.h                               |   2 +
 lib/meson.build                                    |  10 +-
 tests/gem_exec_nop.c                               |  34 +-----
 tests/gem_exec_schedule.c                          |  47 ++------
 tests/gem_exec_whisper.c                           |  22 +---
 tests/gem_sync.c                                   |  34 +-----
 10 files changed, 189 insertions(+), 129 deletions(-)
 create mode 100644 lib/i915/gem_scheduler.c
 create mode 100644 lib/i915/gem_scheduler.h
docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml +5 -0
index 04a0485c..8c14bd07 100644
@@ -44,6 +44,11 @@
     <xi:include href="xml/intel_io.xml"/>
     <xi:include href="xml/ioctl_wrappers.xml"/>
     <xi:include href="xml/sw_sync.xml"/>
+
+  </chapter>
+  <chapter>
+    <title>igt/i915 API Reference</title>
+    <xi:include href="xml/gem_scheduler.xml"/>
   </chapter>
   <xi:include href="xml/igt_test_programs.xml"/>
 
lib/Makefile.sources +2 -0
index 965e230e..c33723f9 100644
@@ -3,6 +3,8 @@ lib_source_list =	 	\
 	drmtest.c		\
 	drmtest.h		\
 	i830_reg.h		\
+	i915/gem_scheduler.c	\
+	i915/gem_scheduler.h	\
 	i915_3d.h		\
 	i915_reg.h		\
 	i915_pciids.h		\
lib/i915/gem_scheduler.c new file +125 -0

125 lines not on this page · raw message

lib/i915/gem_scheduler.h new file +37 -0
new file mode 100644
index 00000000..9fcb0266
@@ -0,0 +1,37 @@
+/*
+ * Copyright © 2017 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.
+ */
+
+#ifndef GEM_SCHEDULER_H
+#define GEM_SCHEDULER_H
+
+#define LOCAL_I915_SCHEDULER_CAP_ENABLED	(1 << 0)
+#define LOCAL_I915_SCHEDULER_CAP_PRIORITY	(1 << 1)
+#define LOCAL_I915_SCHEDULER_CAP_PREEMPTION	(1 << 2)
+
+unsigned gem_scheduler_capability(int fd);
+bool gem_scheduler_enabled(int fd);
+bool gem_scheduler_has_ctx_priority(int fd);
+bool gem_scheduler_has_preemption(int fd);
+void gem_scheduler_print_capability(int fd);
+
+#endif /* GEM_SCHEDULER_H */
lib/ioctl_wrappers.h +2 -0
index 1663b7f8..76a4e80d 100644
@@ -36,6 +36,8 @@
 #include <intel_bufmgr.h>
 #include <i915_drm.h>
 
+#include "i915/gem_scheduler.h"
+
 /**
  * igt_ioctl:
  * @fd: file descriptor
lib/meson.build +3 -7
index 89ed2723..22811743 100644
@@ -2,6 +2,7 @@ lib_headers = [
 	'debug.h',
 	'drmtest.h',
 	'i830_reg.h',
+	'i915/gem_scheduler.h',
 	'i915_3d.h',
 	'i915_reg.h',
 	'i915_pciids.h',
@@ -48,6 +49,7 @@ lib_headers = [
 
 lib_sources = [
 	'drmtest.c',
+	'i915/gem_scheduler.c',
 	'igt_debugfs.c',
 	'igt_aux.c',
 	'igt_gt.c',
@@ -152,13 +154,7 @@ lib_version = vcs_tag(input : 'version.h.in', output : 'version.h',
 
 lib_intermediates = []
 foreach f: lib_sources
-    # No / in the target name
-    if f.contains('uwildmat')
-        name = 'uwildmat'
-    else
-        name = f
-    endif
-
+    name = f.underscorify(f)
     lib = static_library('igt-' + name,
 	[ f, lib_version ],
 	include_directories: inc,
tests/gem_exec_nop.c +3 -31
index feb89ee3..8fd31e83 100644
@@ -44,8 +44,6 @@
 #include <time.h>
 #include "drm.h"
 
-#define BIT(x) (1ul << (x))
-
 #define LOCAL_I915_EXEC_NO_RELOC (1<<11)
 #define LOCAL_I915_EXEC_HANDLE_LUT (1<<12)
 
@@ -54,10 +52,6 @@
 
 #define ENGINE_FLAGS  (I915_EXEC_RING_MASK | LOCAL_I915_EXEC_BSD_MASK)
 
-#define LOCAL_PARAM_HAS_SCHEDULER 41
-#define   HAS_SCHEDULER		BIT(0)
-#define   HAS_PRIORITY		BIT(1)
-#define   HAS_PREEMPTION	BIT(2)
 #define LOCAL_CONTEXT_PARAM_PRIORITY 6
 #define   MAX_PRIO 1023
 #define   MIN_PRIO -1023
@@ -665,31 +659,9 @@ static void preempt(int fd, uint32_t handle,
 		 ring_name, count, elapsed(&start, &now)*1e6 / count);
 }
 
-static unsigned int has_scheduler(int fd)
-{
-	drm_i915_getparam_t gp;
-	unsigned int caps = 0;
-
-	gp.param = LOCAL_PARAM_HAS_SCHEDULER;
-	gp.value = (int *)&caps;
-	drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
-
-	if (!caps)
-		return 0;
-
-	igt_info("Has kernel scheduler\n");
-	if (caps & HAS_PRIORITY)
-		igt_info(" - With priority sorting\n");
-	if (caps & HAS_PREEMPTION)
-		igt_info(" - With preemption enabled\n");
-
-	return caps;
-}
-
 igt_main
 {
 	const struct intel_execution_engine *e;
-	unsigned int sched_caps = 0;
 	uint32_t handle = 0;
 	int device = -1;
 
@@ -699,7 +671,7 @@ igt_main
 		device = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(device);
 		gem_show_submission_method(device);
-		sched_caps = has_scheduler(device);
+		gem_scheduler_print_capability(device);
 
 		handle = gem_create(device, 4096);
 		gem_write(device, handle, 0, &bbe, sizeof(bbe));
@@ -746,8 +718,8 @@ igt_main
 
 	igt_subtest_group {
 		igt_fixture {
-			igt_require(sched_caps & HAS_PRIORITY);
-			igt_require(sched_caps & HAS_PREEMPTION);
+			igt_require(gem_scheduler_has_ctx_priority(device));
+			igt_require(gem_scheduler_has_preemption(device));
 		}
 
 		for (e = intel_execution_engines; e->name; e++) {
tests/gem_exec_schedule.c +7 -40

98 lines not on this page · raw message

tests/gem_exec_whisper.c +2 -20
index e7f7b1f1..5ff8f396 100644
@@ -191,21 +191,8 @@ static void fini_hang(struct hang *h)
 	close(h->fd);
 }
 
-#define LOCAL_PARAM_HAS_SCHEDULER 41
 #define LOCAL_CONTEXT_PARAM_PRIORITY 6
 
-static bool __has_scheduler(int fd)
-{
-	drm_i915_getparam_t gp;
-	int has = -1;
-
-	gp.param = LOCAL_PARAM_HAS_SCHEDULER;
-	gp.value = &has;
-	drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
-
-	return has > 0;
-}
-
 static int __ctx_set_priority(int fd, uint32_t ctx, int prio)
 {
 	struct local_i915_gem_context_param param;
@@ -250,13 +237,8 @@ static void whisper(int fd, unsigned engine, unsigned flags)
 	int debugfs;
 
 	if (flags & PRIORITY) {
-		int __fd = drm_open_driver(DRIVER_INTEL);
-		bool has_scheduler = __has_scheduler(__fd);
-		bool ctx_has_priority =
-			__ctx_set_priority(__fd, 0, 1) == 0;
-		close(__fd);
-
-		igt_require(has_scheduler && ctx_has_priority);
+		igt_require(gem_scheduler_enabled(fd));
+		igt_require(gem_scheduler_has_ctx_priority(fd));
 	}
 
 	debugfs = igt_debugfs_dir(fd);
tests/gem_sync.c +3 -31
index f0c5d76f..fda70344 100644
@@ -27,18 +27,12 @@
 #include "igt.h"
 #include "igt_sysfs.h"
 
-#define BIT(x) (1ul << (x))
-
 #define LOCAL_I915_EXEC_NO_RELOC (1<<11)
 #define LOCAL_I915_EXEC_HANDLE_LUT (1<<12)
 
 #define LOCAL_I915_EXEC_BSD_SHIFT      (13)
 #define LOCAL_I915_EXEC_BSD_MASK       (3 << LOCAL_I915_EXEC_BSD_SHIFT)
 
-#define LOCAL_PARAM_HAS_SCHEDULER 41
-#define   HAS_SCHEDULER		BIT(0)
-#define   HAS_PRIORITY		BIT(1)
-#define   HAS_PREEMPTION	BIT(2)
 #define LOCAL_CONTEXT_PARAM_PRIORITY 6
 #define   MAX_PRIO 1023
 #define   MIN_PRIO -1023
@@ -807,32 +801,10 @@ preempt(int fd, unsigned ring, int num_children, int timeout)
 	gem_context_destroy(fd, ctx[0]);
 }
 
-static unsigned int has_scheduler(int fd)
-{
-	drm_i915_getparam_t gp;
-	unsigned int caps = 0;
-
-	gp.param = LOCAL_PARAM_HAS_SCHEDULER;
-	gp.value = (int *)&caps;
-	drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
-
-	if (!caps)
-		return 0;
-
-	igt_info("Has kernel scheduler\n");
-	if (caps & HAS_PRIORITY)
-		igt_info(" - With priority sorting\n");
-	if (caps & HAS_PREEMPTION)
-		igt_info(" - With preemption enabled\n");
-
-	return caps;
-}
-
 igt_main
 {
 	const struct intel_execution_engine *e;
 	const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
-	unsigned int sched_caps = 0;
 	int fd = -1;
 
 	igt_skip_on_simulation();
@@ -841,7 +813,7 @@ igt_main
 		fd = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(fd);
 		gem_show_submission_method(fd);
-		sched_caps = has_scheduler(fd);
+		gem_scheduler_print_capability(fd);
 
 		igt_fork_hang_detector(fd);
 	}
@@ -886,8 +858,8 @@ igt_main
 
 	igt_subtest_group {
 		igt_fixture {
-			igt_require(sched_caps & HAS_PRIORITY);
-			igt_require(sched_caps & HAS_PREEMPTION);
+			igt_require(gem_scheduler_has_ctx_priority(fd));
+			igt_require(gem_scheduler_has_preemption(fd));
 		}
 
 		igt_subtest("preempt-all")
Signature · 6 lines
2.13.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH 3/4 lib/i915: Move context related helpers to lib/i915/gem_context

In reply to Michał Winiarski

We'd like to make ioctl_wrappers a bit thinner, and we plan to add new helpers in the following patch. Let's move context related helpers before adding more content.

---
 .../intel-gpu-tools/intel-gpu-tools-docs.xml       |   1 +
 lib/Makefile.sources                               |   2 +
 lib/i915/gem_context.c                             | 199 +++++++++++++++++++++
 lib/i915/gem_context.h                             |  48 +++++
 lib/ioctl_wrappers.c                               | 157 +---------------
 lib/ioctl_wrappers.h                               |  22 +--
 lib/meson.build                                    |   2 +
 7 files changed, 254 insertions(+), 177 deletions(-)
 create mode 100644 lib/i915/gem_context.c
 create mode 100644 lib/i915/gem_context.h
docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml +1 -0
index 8c14bd07..c5be60d0 100644
@@ -48,6 +48,7 @@
   </chapter>
   <chapter>
     <title>igt/i915 API Reference</title>
+    <xi:include href="xml/gem_context.xml"/>
     <xi:include href="xml/gem_scheduler.xml"/>
   </chapter>
   <xi:include href="xml/igt_test_programs.xml"/>
lib/Makefile.sources +2 -0
index c33723f9..09c9ef9f 100644
@@ -3,6 +3,8 @@ lib_source_list =	 	\
 	drmtest.c		\
 	drmtest.h		\
 	i830_reg.h		\
+	i915/gem_context.c	\
+	i915/gem_context.h	\
 	i915/gem_scheduler.c	\
 	i915/gem_scheduler.h	\
 	i915_3d.h		\
lib/i915/gem_context.c new file +199 -0

199 lines not on this page · raw message

lib/i915/gem_context.h new file +48 -0

48 lines not on this page · raw message

lib/ioctl_wrappers.c +1 -156

169 lines not on this page · raw message

lib/ioctl_wrappers.h +1 -21
index 76a4e80d..f7752aea 100644
@@ -36,6 +36,7 @@
 #include <intel_bufmgr.h>
 #include <i915_drm.h>
 
+#include "i915/gem_context.h"
 #include "i915/gem_scheduler.h"
 
 /**
@@ -121,27 +122,6 @@ int gem_munmap(void *ptr, uint64_t size);
 
 int gem_madvise(int fd, uint32_t handle, int state);
 
-uint32_t gem_context_create(int fd);
-void gem_context_destroy(int fd, uint32_t ctx_id);
-int __gem_context_destroy(int fd, uint32_t ctx_id);
-struct local_i915_gem_context_param {
-	uint32_t context;
-	uint32_t size;
-	uint64_t param;
-#define LOCAL_CONTEXT_PARAM_BAN_PERIOD	0x1
-#define LOCAL_CONTEXT_PARAM_NO_ZEROMAP	0x2
-#define LOCAL_CONTEXT_PARAM_GTT_SIZE	0x3
-#define LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE	0x4
-#define LOCAL_CONTEXT_PARAM_BANNABLE	0x5
-	uint64_t value;
-};
-void gem_context_require_bannable(int fd);
-void gem_context_require_param(int fd, uint64_t param);
-void gem_context_get_param(int fd, struct local_i915_gem_context_param *p);
-void gem_context_set_param(int fd, struct local_i915_gem_context_param *p);
-int __gem_context_set_param(int fd, struct local_i915_gem_context_param *p);
-int __gem_context_get_param(int fd, struct local_i915_gem_context_param *p);
-
 #define LOCAL_I915_GEM_USERPTR       0x33
 #define LOCAL_IOCTL_I915_GEM_USERPTR DRM_IOWR (DRM_COMMAND_BASE + LOCAL_I915_GEM_USERPTR, struct local_i915_gem_userptr)
 struct local_i915_gem_userptr {
lib/meson.build +2 -0
index 22811743..f0125a6d 100644
@@ -2,6 +2,7 @@ lib_headers = [
 	'debug.h',
 	'drmtest.h',
 	'i830_reg.h',
+	'i915/gem_context.h',
 	'i915/gem_scheduler.h',
 	'i915_3d.h',
 	'i915_reg.h',
@@ -49,6 +50,7 @@ lib_headers = [
 
 lib_sources = [
 	'drmtest.c',
+	'i915/gem_context.c',
 	'i915/gem_scheduler.c',
 	'igt_debugfs.c',
 	'igt_aux.c',
Signature · 6 lines
2.13.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

PATCH v2 4/4 lib/i915: Extract context priority setparam to a helper

In reply to Michał Winiarski

Another example of something that is used across different tests, and should be moved to lib.

v2: Break the trend of expanding ioctl_wrappers

---
 lib/i915/gem_context.c    | 40 +++++++++++++++++++++++++++++++
 lib/i915/gem_context.h    |  6 +++++
 tests/gem_exec_nop.c      | 26 ++++----------------
 tests/gem_exec_schedule.c | 60 ++++++++++++++++-------------------------------
 tests/gem_exec_whisper.c  | 23 ++++--------------
 tests/gem_sync.c          | 27 ++++-----------------
 6 files changed, 78 insertions(+), 104 deletions(-)
lib/i915/gem_context.c +40 -0
index ba826ae3..6d9edf5e 100644
@@ -197,3 +197,43 @@ void gem_context_require_bannable(int fd)
 
 	igt_require(has_ban_period || has_bannable);
 }
+
+#define LOCAL_I915_CONTEXT_PARAM_PRIORITY 0x6
+
+/**
+ * __gem_context_set_priority:
+ * @fd: open i915 drm file descriptor
+ * @ctx_id: i915 context id
+ * @prio: desired context priority
+ *
+ * This function modifies priority property of the context.
+ * It is used by the scheduler to decide on the ordering of requests submitted
+ * to the hardware.
+ *
+ * Returns: An integer equal to zero for success and negative for failure
+ */
+int __gem_context_set_priority(int fd, uint32_t ctx_id, int prio)
+{
+	struct local_i915_gem_context_param p;
+
+	memset(&p, 0, sizeof(p));
+	p.context = ctx_id;
+	p.size = 0;
+	p.param = LOCAL_I915_CONTEXT_PARAM_PRIORITY;
+	p.value = prio;
+
+	return __gem_context_set_param(fd, &p);
+}
+
+/**
+ * gem_context_set_priority:
+ * @fd: open i915 drm file descriptor
+ * @ctx_id: i915 context id
+ * @prio: desired context priority
+ *
+ * Like __gem_context_set_priority(), except we assert on failure.
+ */
+void gem_context_set_priority(int fd, uint32_t ctx_id, int prio)
+{
+	igt_assert(__gem_context_set_priority(fd, ctx_id, prio) == 0);
+}
lib/i915/gem_context.h +6 -0
index 06b2ca99..a2339c4b 100644
@@ -45,4 +45,10 @@ void gem_context_set_param(int fd, struct local_i915_gem_context_param *p);
 int __gem_context_set_param(int fd, struct local_i915_gem_context_param *p);
 int __gem_context_get_param(int fd, struct local_i915_gem_context_param *p);
 
+#define LOCAL_I915_CONTEXT_MAX_USER_PRIORITY	1023
+#define LOCAL_I915_CONTEXT_DEFAULT_PRIORITY	0
+#define LOCAL_I915_CONTEXT_MIN_USER_PRIORITY	-1023
+int __gem_context_set_priority(int fd, uint32_t ctx, int prio);
+void gem_context_set_priority(int fd, uint32_t ctx, int prio);
+
 #endif /* GEM_CONTEXT_H */
tests/gem_exec_nop.c +4 -22
index 8fd31e83..37cddd8c 100644
@@ -52,9 +52,8 @@
 
 #define ENGINE_FLAGS  (I915_EXEC_RING_MASK | LOCAL_I915_EXEC_BSD_MASK)
 
-#define LOCAL_CONTEXT_PARAM_PRIORITY 6
-#define   MAX_PRIO 1023
-#define   MIN_PRIO -1023
+#define MAX_PRIO LOCAL_I915_CONTEXT_MAX_USER_PRIORITY
+#define MIN_PRIO LOCAL_I915_CONTEXT_MIN_USER_PRIORITY
 
 #define FORKED 1
 #define CHAINED 2
@@ -585,23 +584,6 @@ static void fence_signal(int fd, uint32_t handle,
 	igt_info("Signal %s: %'lu cycles (%'lu signals): %.3fus\n",
 		 ring_name, count, signal, elapsed(&start, &now) * 1e6 / count);
 }
-static int __ctx_set_priority(int fd, uint32_t ctx, int prio)
-{
-	struct local_i915_gem_context_param param;
-
-	memset(&param, 0, sizeof(param));
-	param.context = ctx;
-	param.size = 0;
-	param.param = LOCAL_CONTEXT_PARAM_PRIORITY;
-	param.value = prio;
-
-	return __gem_context_set_param(fd, &param);
-}
-
-static void ctx_set_priority(int fd, uint32_t ctx, int prio)
-{
-	igt_assert_eq(__ctx_set_priority(fd, ctx, prio), 0);
-}
 
 static void preempt(int fd, uint32_t handle,
 		   unsigned ring_id, const char *ring_name)
@@ -615,10 +597,10 @@ static void preempt(int fd, uint32_t handle,
 	gem_require_ring(fd, ring_id);
 
 	ctx[0] = gem_context_create(fd);
-	ctx_set_priority(fd, ctx[0], MIN_PRIO);
+	gem_context_set_priority(fd, ctx[0], MIN_PRIO);
 
 	ctx[1] = gem_context_create(fd);
-	ctx_set_priority(fd, ctx[1], MAX_PRIO);
+	gem_context_set_priority(fd, ctx[1], MAX_PRIO);
 
 	memset(&obj, 0, sizeof(obj));
 	obj.handle = handle;
tests/gem_exec_schedule.c +20 -40

164 lines not on this page · raw message

tests/gem_exec_whisper.c +4 -19
index 5ff8f396..dfa8a3b4 100644
@@ -191,25 +191,10 @@ static void fini_hang(struct hang *h)
 	close(h->fd);
 }
 
-#define LOCAL_CONTEXT_PARAM_PRIORITY 6
-
-static int __ctx_set_priority(int fd, uint32_t ctx, int prio)
-{
-	struct local_i915_gem_context_param param;
-
-	memset(&param, 0, sizeof(param));
-	param.context = ctx;
-	param.size = 0;
-	param.param = LOCAL_CONTEXT_PARAM_PRIORITY;
-	param.value = prio;
-
-	return __gem_context_set_param(fd, &param);
-}
-
-static void ctx_set_priority(int fd, uint32_t ctx)
+static void ctx_set_random_priority(int fd, uint32_t ctx)
 {
 	int prio = hars_petruska_f54_1_random_unsafe_max(1024) - 512;
-	igt_assert_eq(__ctx_set_priority(fd, ctx, prio), 0);
+	gem_context_set_priority(fd, ctx, prio);
 };
 
 static void whisper(int fd, unsigned engine, unsigned flags)
@@ -430,7 +415,7 @@ static void whisper(int fd, unsigned engine, unsigned flags)
 							gem_open(this_fd,
 									gem_flink(fd, handle[1]));
 						if (flags & PRIORITY)
-							ctx_set_priority(this_fd, 0);
+							ctx_set_random_priority(this_fd, 0);
 					}
 
 					if (!(flags & CHAIN)) {
@@ -440,7 +425,7 @@ static void whisper(int fd, unsigned engine, unsigned flags)
 					if (flags & CONTEXTS) {
 						execbuf.rsvd1 = contexts[rand() % 64];
 						if (flags & PRIORITY)
-							ctx_set_priority(this_fd, execbuf.rsvd1);
+							ctx_set_random_priority(this_fd, execbuf.rsvd1);
 					}
 
 					gem_execbuf(this_fd, &execbuf);
tests/gem_sync.c +4 -23
index fda70344..6ead76b8 100644
@@ -33,9 +33,8 @@
 #define LOCAL_I915_EXEC_BSD_SHIFT      (13)
 #define LOCAL_I915_EXEC_BSD_MASK       (3 << LOCAL_I915_EXEC_BSD_SHIFT)
 
-#define LOCAL_CONTEXT_PARAM_PRIORITY 6
-#define   MAX_PRIO 1023
-#define   MIN_PRIO -1023
+#define MAX_PRIO LOCAL_I915_CONTEXT_MAX_USER_PRIORITY
+#define MIN_PRIO LOCAL_I915_CONTEXT_MIN_USER_PRIORITY
 
 #define ENGINE_MASK  (I915_EXEC_RING_MASK | LOCAL_I915_EXEC_BSD_MASK)
 
@@ -690,24 +689,6 @@ store_all(int fd, int num_children, int timeout)
 	igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
 }
 
-static int __ctx_set_priority(int fd, uint32_t ctx, int prio)
-{
-	struct local_i915_gem_context_param param;
-
-	memset(&param, 0, sizeof(param));
-	param.context = ctx;
-	param.size = 0;
-	param.param = LOCAL_CONTEXT_PARAM_PRIORITY;
-	param.value = prio;
-
-	return __gem_context_set_param(fd, &param);
-}
-
-static void ctx_set_priority(int fd, uint32_t ctx, int prio)
-{
-	igt_assert_eq(__ctx_set_priority(fd, ctx, prio), 0);
-}
-
 static void
 preempt(int fd, unsigned ring, int num_children, int timeout)
 {
@@ -746,10 +727,10 @@ preempt(int fd, unsigned ring, int num_children, int timeout)
 	}
 
 	ctx[0] = gem_context_create(fd);
-	ctx_set_priority(fd, ctx[0], MIN_PRIO);
+	gem_context_set_priority(fd, ctx[0], MIN_PRIO);
 
 	ctx[1] = gem_context_create(fd);
-	ctx_set_priority(fd, ctx[1], MAX_PRIO);
+	gem_context_set_priority(fd, ctx[1], MAX_PRIO);
 
 	intel_detect_and_clear_missed_interrupts(fd);
 	igt_fork(child, num_children) {
Signature · 6 lines
2.13.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

✓ Fi.CI.BAT: success for series starting with [v2,1/4] lib: Extract helpers for determining submission method

In reply to Michał Winiarski
== Series Details ==

== Series Details ==

Series: series starting with [v2,1/4] lib: Extract helpers for determining submission method
URL : https://patchwork.freedesktop.org/series/32020/
State : success

== Summary ==

IGT patchset tested on top of latest successful build d4d976de7e022cb56a2dbfe96c4ab10549e24acc igt/gem_mocs_settings: Skip non-existent engines

with latest DRM-Tip kernel build CI_DRM_3242
d6b500e96a1b drm-tip: 2017y-10m-16d-13h-20m-58s UTC integration manifest

No testlist changes.

Test chamelium:

        Subgroup dp-crc-fast:
                pass       -> FAIL       (fi-kbl-7500u) fdo#102514
Test debugfs_test:
        Subgroup read_all_entries:
                pass       -> DMESG-WARN (fi-kbl-7500u) fdo#103285
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                dmesg-warn -> PASS       (fi-byt-n2820) fdo#101705

fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514
fdo#103285 https://bugs.freedesktop.org/show_bug.cgi?id=103285
fdo#101705 https://bugs.freedesktop.org/show_bug.cgi?id=101705

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:455s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:479s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:391s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:571s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:286s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:527s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:526s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:550s
fi-byt-n2820     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:528s
fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:567s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:434s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:278s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:607s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:441s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:460s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:507s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:478s
fi-kbl-7500u     total:289  pass:262  dwarn:2   dfail:0   fail:1   skip:24  time:493s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:585s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:491s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:596s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:654s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:473s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:661s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:534s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:512s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:477s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:591s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:431s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_364/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

✗ Fi.CI.IGT: failure for series starting with [v2,1/4] lib: Extract helpers for determining submission method

In reply to Michał Winiarski
== Series Details ==

== Series Details ==

Series: series starting with [v2,1/4] lib: Extract helpers for determining submission method
URL : https://patchwork.freedesktop.org/series/32020/
State : failure

== Summary ==

Test kms_pipe_crc_basic:

        Subgroup read-crc-pipe-C-frame-sequence:
                pass       -> FAIL       (shard-hsw)
Test kms_setmode:
        Subgroup basic:
                pass       -> FAIL       (shard-hsw) fdo#99912
Test kms_flip:
        Subgroup dpms-vs-vblank-race-interruptible:
                fail       -> PASS       (shard-hsw) fdo#103060

fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060

shard-hsw total:2553 pass:1440 dwarn:0 dfail:0 fail:10 skip:1103 time:9685s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_364/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw
In reply to Michał Winiarski

Quoting Michał Winiarski (2017-10-16 10:05:14)

Quoted 15 lines
lib/igt_aux.c +7 -0
index fa6594c3..cacc8f98 100644
@@ -1455,6 +1455,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;

lib/igt_aux.c igt_show_stat(proc_t *info, int *state, const char *fn) · line 1474

Quoted 10 lines
lib/igt_aux.c +10 -0
+       }
+
+       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" : "");
+}

You managed to hide it inside an #ifdef HAVE_PROCPS, or how to confuse me with weird build failures.

Don't we have a lib/i915/gem_scheduler.c for this now? -Chris
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

Quoting Chris Wilson (2017-10-18 00:01:35)

Quoted 30 lines

Quoting Michał Winiarski (2017-10-16 10:05:14)

Quoted 15 lines
lib/igt_aux.c +7 -0
index fa6594c3..cacc8f98 100644
@@ -1455,6 +1455,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;

lib/igt_aux.c igt_show_stat(proc_t *info, int *state, const char *fn) · line 1474

Quoted 10 lines
lib/igt_aux.c +10 -0
+       }
+
+       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" : "");
+}

You managed to hide it inside an #ifdef HAVE_PROCPS, or how to confuse me with weird build failures.

Quoted 1 line

Don't we have a lib/i915/gem_scheduler.c for this now?

Ok, scheduler isn't a good fit, do I hear a cry of lib/i915/gem_submission.c?
-Chris
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx