[Intel-gfx] [PATCH 50/66] drm/i915: Remove ring specificity from contexts

Ben Widawsky ben at bwidawsk.net
Fri Jun 28 01:30:51 CEST 2013


When originally implementing HW contexts it was not clear if we'd
strongly associate a context with a ring. Now it is clear, a context
will not belong to a ring. We've removed all remnants of it's usage. So
drop it completely now.

Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_drv.h         | 1 -
 drivers/gpu/drm/i915/i915_gem_context.c | 8 ++------
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 4fbc4ab..fa8a432 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -582,7 +582,6 @@ struct i915_hw_context {
 	int id;
 	bool is_initialized;
 	struct drm_i915_file_private *file_priv;
-	struct intel_ring_buffer *ring;
 	struct drm_i915_gem_object *obj;
 	struct i915_ctx_hang_stats hang_stats;
 
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 0d6ed19..faddf43 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -166,12 +166,6 @@ create_hw_context(struct drm_device *dev,
 			goto err_out;
 	}
 
-	/* The ring associated with the context object is handled by the normal
-	 * object tracking code. We give an initial ring value simple to pass an
-	 * assertion in the context switch code.
-	 */
-	ctx->ring = &dev_priv->ring[RCS];
-
 	ret = i915_gem_ppgtt_init(dev, &ctx->ppgtt);
 	if (ret)
 		goto err_out;
@@ -215,6 +209,7 @@ static int create_default_context(struct drm_i915_private *dev_priv,
 	BUG_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex));
 
 	if (dev_priv->ring[RCS].default_context) {
+		/* NB: RCS will hold a ref for all rings */
 		ring->default_context = dev_priv->ring[RCS].default_context;
 		return 0;
 	}
@@ -378,6 +373,7 @@ void i915_gem_context_fini(struct drm_device *dev)
 		if (ring->last_context)
 			i915_gem_context_unreference(ring->last_context);
 		ring->default_context = NULL;
+		ring->last_context = NULL;
 	}
 
 	i915_gem_object_unpin(dctx->obj);
-- 
1.8.3.1




More information about the Intel-gfx mailing list