drm/i915/gem: Add an intermediate proto_context struct (v5)
[sfrench/cifs-2.6.git] / drivers / gpu / drm / i915 / gem / selftests / mock_context.c
index 51b5a3421b40092c02a754192727c68bc57564d4..e0f512ef7f3c6f3aa88e6e554aeeac9645706b46 100644 (file)
@@ -80,11 +80,17 @@ void mock_init_contexts(struct drm_i915_private *i915)
 struct i915_gem_context *
 live_context(struct drm_i915_private *i915, struct file *file)
 {
+       struct i915_gem_proto_context *pc;
        struct i915_gem_context *ctx;
        int err;
        u32 id;
 
-       ctx = i915_gem_create_context(i915, 0);
+       pc = proto_context_create(i915, 0);
+       if (IS_ERR(pc))
+               return ERR_CAST(pc);
+
+       ctx = i915_gem_create_context(i915, pc);
+       proto_context_close(pc);
        if (IS_ERR(ctx))
                return ctx;
 
@@ -142,8 +148,14 @@ struct i915_gem_context *
 kernel_context(struct drm_i915_private *i915)
 {
        struct i915_gem_context *ctx;
+       struct i915_gem_proto_context *pc;
+
+       pc = proto_context_create(i915, 0);
+       if (IS_ERR(pc))
+               return ERR_CAST(pc);
 
-       ctx = i915_gem_create_context(i915, 0);
+       ctx = i915_gem_create_context(i915, pc);
+       proto_context_close(pc);
        if (IS_ERR(ctx))
                return ctx;