summaryrefslogtreecommitdiff
path: root/tests/gem_exec_nop.c
diff options
context:
space:
mode:
authorMichał Winiarski <michal.winiarski@intel.com>2017-10-16 11:05:17 +0200
committerArkadiusz Hiler <arkadiusz.hiler@intel.com>2017-10-17 10:26:30 +0300
commit6853f8bad8ce5770d28a621a7e15449930d56d9f (patch)
tree554b2e5737a43a670213ca8854db2288fbff0858 /tests/gem_exec_nop.c
parent131ad520cb44c7dafacc6ef327d9fa6cda9067ab (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_nop.c')
-rw-r--r--tests/gem_exec_nop.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/tests/gem_exec_nop.c b/tests/gem_exec_nop.c
index 8fd31e83..37cddd8c 100644
--- a/tests/gem_exec_nop.c
+++ b/tests/gem_exec_nop.c
@@ -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;