diff options
author | Michał Winiarski <michal.winiarski@intel.com> | 2017-10-16 11:05:17 +0200 |
---|---|---|
committer | Arkadiusz Hiler <arkadiusz.hiler@intel.com> | 2017-10-17 10:26:30 +0300 |
commit | 6853f8bad8ce5770d28a621a7e15449930d56d9f (patch) | |
tree | 554b2e5737a43a670213ca8854db2288fbff0858 /tests/gem_sync.c | |
parent | 131ad520cb44c7dafacc6ef327d9fa6cda9067ab (diff) |
lib/i915: Extract context priority setparam to a helper
Another example of something that is used across different tests, and
should be moved to lib.
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_sync.c')
-rw-r--r-- | tests/gem_sync.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/tests/gem_sync.c b/tests/gem_sync.c index fda70344..6ead76b8 100644 --- a/tests/gem_sync.c +++ b/tests/gem_sync.c @@ -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(¶m, 0, sizeof(param)); - param.context = ctx; - param.size = 0; - param.param = LOCAL_CONTEXT_PARAM_PRIORITY; - param.value = prio; - - return __gem_context_set_param(fd, ¶m); -} - -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) { |