diff options
author | Michał Winiarski <michal.winiarski@intel.com> | 2017-10-16 11:05:15 +0200 |
---|---|---|
committer | Arkadiusz Hiler <arkadiusz.hiler@intel.com> | 2017-10-17 10:26:30 +0300 |
commit | 588555f779095a9d282f414aec22e5532891ecdc (patch) | |
tree | bfdf1caa268e1e9edda392942e122a6156f6a1ed /tests/gem_exec_schedule.c | |
parent | f6dfe556659f5473e4bf13cc8d4770ac39c7d678 (diff) |
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
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 'tests/gem_exec_schedule.c')
-rw-r--r-- | tests/gem_exec_schedule.c | 47 |
1 files changed, 7 insertions, 40 deletions
diff --git a/tests/gem_exec_schedule.c b/tests/gem_exec_schedule.c index f5c849d0..66e24244 100644 --- a/tests/gem_exec_schedule.c +++ b/tests/gem_exec_schedule.c @@ -33,12 +33,6 @@ #include "igt_rand.h" #include "igt_sysfs.h" -#define BIT(x) (1ul << (x)) - -#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 LO 0 @@ -70,11 +64,6 @@ static void ctx_set_priority(int fd, uint32_t ctx, int prio) igt_assert_eq(__ctx_set_priority(fd, ctx, prio), 0); } -static void ctx_has_priority(int fd) -{ - igt_require(__ctx_set_priority(fd, 0, MAX_PRIO) == 0); -} - static void store_dword(int fd, uint32_t ctx, unsigned ring, uint32_t target, uint32_t offset, uint32_t value, uint32_t cork, unsigned write_domain) @@ -979,31 +968,9 @@ static void test_pi_ringfull(int fd, unsigned int engine) munmap(result, 4096); } -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 *)∩︀ - 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; int fd = -1; igt_skip_on_simulation(); @@ -1011,7 +978,7 @@ igt_main igt_fixture { fd = drm_open_driver_master(DRIVER_INTEL); gem_show_submission_method(fd); - sched_caps = has_scheduler(fd); + gem_scheduler_print_capability(fd); igt_require_gem(fd); gem_require_mmap_wc(fd); igt_fork_hang_detector(fd); @@ -1033,8 +1000,8 @@ igt_main igt_subtest_group { igt_fixture { - igt_require(sched_caps & HAS_SCHEDULER); - ctx_has_priority(fd); + igt_require(gem_scheduler_enabled(fd)); + igt_require(gem_scheduler_has_ctx_priority(fd)); } igt_subtest("smoketest-all") @@ -1062,7 +1029,7 @@ igt_main igt_subtest_group { igt_fixture { - igt_require(sched_caps & HAS_PREEMPTION); + igt_require(gem_scheduler_has_preemption(fd)); } igt_subtest_f("preempt-%s", e->name) @@ -1095,8 +1062,8 @@ igt_main igt_subtest_group { igt_fixture { - igt_require(sched_caps & HAS_SCHEDULER); - ctx_has_priority(fd); + igt_require(gem_scheduler_enabled(fd)); + igt_require(gem_scheduler_has_ctx_priority(fd)); /* need separate rings */ igt_require(gem_has_execlists(fd)); @@ -1106,7 +1073,7 @@ igt_main igt_subtest_group { igt_fixture { gem_require_ring(fd, e->exec_id | e->flags); - igt_require(sched_caps & HAS_PREEMPTION); + igt_require(gem_scheduler_has_preemption(fd)); } igt_subtest_f("pi-ringfull-%s", e->name) |