[Intel-gfx] [PATCH 27/50] drm/i915/bdw: Status page for LR contexts

oscar.mateo at intel.com oscar.mateo at intel.com
Fri May 9 14:08:57 CEST 2014


From: Ben Widawsky <benjamin.widawsky at intel.com>

The status page with logical ring contexts is included already in the
context object. Update the init and cleanup functions to reflect that. The
status page is offset 0 from the context object when using logical ring
contexts.

Signed-off-by: Ben Widawsky <ben at bwidawsk.net>

v2: Several rebases.

Signed-off-by: Oscar Mateo <oscar.mateo at intel.com>
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 8b0260d..eef7094 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1319,16 +1319,21 @@ i915_dispatch_execbuffer(struct intel_engine *ring,
 
 static void cleanup_status_page(struct intel_engine *ring)
 {
+	struct drm_i915_private *dev_priv = to_i915(ring->dev);
 	struct drm_i915_gem_object *obj;
 
 	obj = ring->status_page.obj;
 	if (obj == NULL)
 		return;
+	ring->status_page.obj = NULL;
 
 	kunmap(sg_page(obj->pages->sgl));
+
+	if (dev_priv->lrc_enabled)
+		return;
+
 	i915_gem_object_ggtt_unpin(obj);
 	drm_gem_object_unreference(&obj->base);
-	ring->status_page.obj = NULL;
 }
 
 static int init_status_page(struct intel_engine *ring)
@@ -1455,15 +1460,22 @@ static int intel_init_ring(struct drm_device *dev,
 	init_waitqueue_head(&ring->irq_queue);
 
 	if (dev_priv->lrc_enabled) {
+		struct drm_i915_gem_object *obj;
+
 		ret = gen8_create_lr_context(ring->default_context, ring, NULL);
 		if (ret) {
 			DRM_ERROR("Create LR context for %s failed: %d\n",
 					ring->name, ret);
 			return ret;
 		}
-	}
 
-	if (I915_NEED_GFX_HWS(dev)) {
+		obj = ring->default_context->engine[ring->id].obj;
+		ring->status_page.gfx_addr = i915_gem_obj_ggtt_offset(obj);
+		ring->status_page.page_addr = kmap(sg_page(obj->pages->sgl));
+		if (ring->status_page.page_addr == NULL)
+			return -ENOMEM;
+		ring->status_page.obj = obj;
+	} else if (I915_NEED_GFX_HWS(dev)) {
 		ret = init_status_page(ring);
 		if (ret)
 			return ret;
-- 
1.9.0




More information about the Intel-gfx mailing list