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_exec_whisper.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_exec_whisper.c')
-rw-r--r-- | tests/gem_exec_whisper.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/tests/gem_exec_whisper.c b/tests/gem_exec_whisper.c index 5ff8f396..dfa8a3b4 100644 --- a/tests/gem_exec_whisper.c +++ b/tests/gem_exec_whisper.c @@ -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(¶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) +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); |