summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/gem/selftests/mock_context.c
diff options
context:
space:
mode:
authorJason Ekstrand <jason@jlekstrand.net>2021-07-08 18:48:32 +0300
committerDaniel Vetter <daniel.vetter@ffwll.ch>2021-07-08 20:49:18 +0300
commit5888d588597408ea8208e89497dbbdb72d405071 (patch)
tree5f49ff4d858cc4efa00c3c85a747689f197e1d6d /drivers/gpu/drm/i915/gem/selftests/mock_context.c
parentd9d29c747df844e946ecd6089893be80c5d32403 (diff)
downloadlinux-5888d588597408ea8208e89497dbbdb72d405071.tar.xz
drm/i915/selftests: Take a VM in kernel_context()
This better models where we want to go with contexts in general where things like the VM and engine set are create parameters instead of being set after the fact. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20210708154835.528166-28-jason@jlekstrand.net
Diffstat (limited to 'drivers/gpu/drm/i915/gem/selftests/mock_context.c')
-rw-r--r--drivers/gpu/drm/i915/gem/selftests/mock_context.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/gem/selftests/mock_context.c b/drivers/gpu/drm/i915/gem/selftests/mock_context.c
index 61aaac4a334c..500ef27ba477 100644
--- a/drivers/gpu/drm/i915/gem/selftests/mock_context.c
+++ b/drivers/gpu/drm/i915/gem/selftests/mock_context.c
@@ -150,7 +150,8 @@ live_context_for_engine(struct intel_engine_cs *engine, struct file *file)
}
struct i915_gem_context *
-kernel_context(struct drm_i915_private *i915)
+kernel_context(struct drm_i915_private *i915,
+ struct i915_address_space *vm)
{
struct i915_gem_context *ctx;
struct i915_gem_proto_context *pc;
@@ -159,6 +160,12 @@ kernel_context(struct drm_i915_private *i915)
if (IS_ERR(pc))
return ERR_CAST(pc);
+ if (vm) {
+ if (pc->vm)
+ i915_vm_put(pc->vm);
+ pc->vm = i915_vm_get(vm);
+ }
+
ctx = i915_gem_create_context(i915, pc);
proto_context_close(pc);
if (IS_ERR(ctx))