|
@@ -343,6 +343,40 @@ i915_gem_create_context(struct drm_device *dev,
|
|
|
return ctx;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * i915_gem_context_create_gvt - create a GVT GEM context
|
|
|
+ * @dev: drm device *
|
|
|
+ *
|
|
|
+ * This function is used to create a GVT specific GEM context.
|
|
|
+ *
|
|
|
+ * Returns:
|
|
|
+ * pointer to i915_gem_context on success, error pointer if failed
|
|
|
+ *
|
|
|
+ */
|
|
|
+struct i915_gem_context *
|
|
|
+i915_gem_context_create_gvt(struct drm_device *dev)
|
|
|
+{
|
|
|
+ struct i915_gem_context *ctx;
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
|
|
|
+ return ERR_PTR(-ENODEV);
|
|
|
+
|
|
|
+ ret = i915_mutex_lock_interruptible(dev);
|
|
|
+ if (ret)
|
|
|
+ return ERR_PTR(ret);
|
|
|
+
|
|
|
+ ctx = i915_gem_create_context(dev, NULL);
|
|
|
+ if (IS_ERR(ctx))
|
|
|
+ goto out;
|
|
|
+
|
|
|
+ ctx->execlists_force_single_submission = true;
|
|
|
+ ctx->ring_size = 512 * PAGE_SIZE; /* Max ring buffer size */
|
|
|
+out:
|
|
|
+ mutex_unlock(&dev->struct_mutex);
|
|
|
+ return ctx;
|
|
|
+}
|
|
|
+
|
|
|
static void i915_gem_context_unpin(struct i915_gem_context *ctx,
|
|
|
struct intel_engine_cs *engine)
|
|
|
{
|