summaryrefslogtreecommitdiff
path: root/tests/i915/gem_ctx_switch.c
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>2020-01-23 13:10:01 +0000
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>2020-01-27 09:16:01 +0000
commit88ba27126a3fa6f267fb722242ea313fad197436 (patch)
treee63487a920c6f9d55c6b0307697f4df3c7b6d3d5 /tests/i915/gem_ctx_switch.c
parenteedff4ebbaac8de51728247311e534e67ce6b859 (diff)
i915/gem_engine_topology: Introduce and use gem_context_clone_with_engines
In test cases which create new contexts and submit work against them using the passed in engine index we are sometimes unsure whether this engine index was potentially created based on a default context with engine map configured (such as when under the __for_each_physical_engine iterator. To simplify test code we add gem_context/queue_clone_with_engines which is to be used in such scenario instead of the current pattern of gem_context_create followed by gem_context_set_all_engines (which is also removed by the patch). v2: * Fix swapped arguments to gem_context_clone. (Chris) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Suggested-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/i915/gem_ctx_switch.c')
-rw-r--r--tests/i915/gem_ctx_switch.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/tests/i915/gem_ctx_switch.c b/tests/i915/gem_ctx_switch.c
index 6bbd2497..a65d1b02 100644
--- a/tests/i915/gem_ctx_switch.c
+++ b/tests/i915/gem_ctx_switch.c
@@ -63,10 +63,8 @@ static int measure_qlen(int fd,
uint32_t ctx[64];
int min = INT_MAX, max = 0;
- for (int i = 0; i < ARRAY_SIZE(ctx); i++) {
- ctx[i] = gem_context_create(fd);
- gem_context_set_all_engines(fd, ctx[i]);
- }
+ for (int i = 0; i < ARRAY_SIZE(ctx); i++)
+ ctx[i] = gem_context_clone_with_engines(fd, 0);
for (unsigned int n = 0; n < engines->nengines; n++) {
uint64_t saved = execbuf->flags;
@@ -130,12 +128,9 @@ static void single(int fd, uint32_t handle,
for (n = 0; n < 64; n++) {
if (flags & QUEUE)
- contexts[n] = gem_queue_create(fd);
+ contexts[n] = gem_queue_clone_with_engines(fd, 0);
else
- contexts[n] = gem_context_create(fd);
-
- if (gem_context_has_engine_map(fd, 0))
- gem_context_set_all_engines(fd, contexts[n]);
+ contexts[n] = gem_context_clone_with_engines(fd, 0);
}
memset(&obj, 0, sizeof(obj));
@@ -237,11 +232,9 @@ static void all(int fd, uint32_t handle, unsigned flags, int timeout)
for (n = 0; n < ARRAY_SIZE(contexts); n++) {
if (flags & QUEUE)
- contexts[n] = gem_queue_create(fd);
+ contexts[n] = gem_queue_clone_with_engines(fd, 0);
else
- contexts[n] = gem_context_create(fd);
-
- gem_context_set_all_engines(fd, contexts[n]);
+ contexts[n] = gem_context_clone_with_engines(fd, 0);
}
memset(obj, 0, sizeof(obj));