@@ -289,27 +289,29 @@ test_engine_hang(const intel_ctx_t *ctx,
const struct intel_execution_engine2 *e, unsigned int flags)
{
const struct intel_execution_engine2 *other;
- const intel_ctx_t *tmp_ctx;
+ const intel_ctx_t *local_ctx[GEM_MAX_ENGINES];
igt_spin_t *spin, *next;
IGT_LIST_HEAD(list);
uint64_t ahnd = get_reloc_ahnd(device, ctx->id), ahndN;
+ int num_ctx;
igt_skip_on(flags & IGT_SPIN_INVALID_CS &&
gem_engine_has_cmdparser(device, &ctx->cfg, e->flags));
/* Fill all the other engines with background load */
+ num_ctx = 0;
for_each_ctx_engine(device, ctx, other) {
if (other->flags == e->flags)
continue;
- tmp_ctx = intel_ctx_create(device, &ctx->cfg);
- ahndN = get_reloc_ahnd(device, tmp_ctx->id);
+ local_ctx[num_ctx] = intel_ctx_create(device, &ctx->cfg);
+ ahndN = get_reloc_ahnd(device, local_ctx[num_ctx]->id);
spin = __igt_spin_new(device,
.ahnd = ahndN,
- .ctx = tmp_ctx,
+ .ctx = local_ctx[num_ctx],
.engine = other->flags,
.flags = IGT_SPIN_FENCE_OUT);
- intel_ctx_destroy(device, tmp_ctx);
+ num_ctx++;
igt_list_move(&spin->link, &list);
}
@@ -339,7 +341,10 @@ test_engine_hang(const intel_ctx_t *ctx,
igt_spin_free(device, spin);
put_ahnd(ahndN);
}
+
put_ahnd(ahnd);
+ while (num_ctx)
+ intel_ctx_destroy(device, local_ctx[--num_ctx]);
check_alive();
}