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>
diff --git a/tests/gem_exec_schedule.c b/tests/gem_exec_schedule.c
index ad3688c..f5c849d 100644
--- a/tests/gem_exec_schedule.c
+++ b/tests/gem_exec_schedule.c
@@ -1000,45 +1000,9 @@
 	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_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 @@
 			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++) {