[Intel-gfx] [PATCH 10/18] drm/i915: use the default context
Ben Widawsky
ben at bwidawsk.net
Sun Mar 18 21:39:50 CET 2012
With the code to do HW context switches in place have the driver load the
default context for the render ring when the driver loads.
The default context will be an ever present context that is available to
switch to at any time for the given ring.
Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
drivers/gpu/drm/i915/i915_gem_context.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index f1559285..d9a08f2 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -37,6 +37,9 @@
static struct i915_hw_context *
i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id);
+static int do_switch(struct drm_i915_gem_object *from_obj,
+ struct i915_hw_context *to, u32 seqno,
+ u32 flags);
static int get_context_size(struct drm_device *dev)
{
@@ -182,6 +185,14 @@ static int create_default_context(struct drm_i915_private *dev_priv)
if (ret)
do_destroy(ctx);
+ ret = do_switch(NULL, ctx, 0, I915_CONTEXT_INITIAL_SWITCH);
+ if (ret) {
+ i915_gem_object_unpin(ctx->obj);
+ BUG_ON(kref_put(&dev_priv->ring[RCS].default_context->nref,
+ destroy_hw_context) == 0);
+ } else
+ DRM_DEBUG_DRIVER("Default HW context loaded\n");
+
return ret;
}
--
1.7.9.4
More information about the Intel-gfx
mailing list