Commit c31c9e82 authored by Chris Wilson's avatar Chris Wilson

drm/i915/selftests: Teach switch_to_context() to use the context

The context details which engines to use, so use the ctx->engines[] to
generate the requests to cause the context switch.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191022130221.20644-2-chris@chris-wilson.co.uk
parent ae2e28b0
...@@ -15,16 +15,15 @@ ...@@ -15,16 +15,15 @@
#include "igt_flush_test.h" #include "igt_flush_test.h"
#include "mock_drm.h" #include "mock_drm.h"
static int switch_to_context(struct drm_i915_private *i915, static int switch_to_context(struct i915_gem_context *ctx)
struct i915_gem_context *ctx)
{ {
struct intel_engine_cs *engine; struct i915_gem_engines_iter it;
enum intel_engine_id id; struct intel_context *ce;
for_each_engine(engine, i915, id) { for_each_gem_engine(ce, i915_gem_context_lock_engines(ctx), it) {
struct i915_request *rq; struct i915_request *rq;
rq = igt_request_alloc(ctx, engine); rq = intel_context_create_request(ce);
if (IS_ERR(rq)) if (IS_ERR(rq))
return PTR_ERR(rq); return PTR_ERR(rq);
...@@ -140,7 +139,7 @@ static int igt_gem_suspend(void *arg) ...@@ -140,7 +139,7 @@ static int igt_gem_suspend(void *arg)
err = -ENOMEM; err = -ENOMEM;
ctx = live_context(i915, file); ctx = live_context(i915, file);
if (!IS_ERR(ctx)) if (!IS_ERR(ctx))
err = switch_to_context(i915, ctx); err = switch_to_context(ctx);
if (err) if (err)
goto out; goto out;
...@@ -155,7 +154,7 @@ static int igt_gem_suspend(void *arg) ...@@ -155,7 +154,7 @@ static int igt_gem_suspend(void *arg)
pm_resume(i915); pm_resume(i915);
err = switch_to_context(i915, ctx); err = switch_to_context(ctx);
out: out:
mock_file_free(i915, file); mock_file_free(i915, file);
return err; return err;
...@@ -175,7 +174,7 @@ static int igt_gem_hibernate(void *arg) ...@@ -175,7 +174,7 @@ static int igt_gem_hibernate(void *arg)
err = -ENOMEM; err = -ENOMEM;
ctx = live_context(i915, file); ctx = live_context(i915, file);
if (!IS_ERR(ctx)) if (!IS_ERR(ctx))
err = switch_to_context(i915, ctx); err = switch_to_context(ctx);
if (err) if (err)
goto out; goto out;
...@@ -190,7 +189,7 @@ static int igt_gem_hibernate(void *arg) ...@@ -190,7 +189,7 @@ static int igt_gem_hibernate(void *arg)
pm_resume(i915); pm_resume(i915);
err = switch_to_context(i915, ctx); err = switch_to_context(ctx);
out: out:
mock_file_free(i915, file); mock_file_free(i915, file);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment