diff mbox

[20/49] drm/i915/bdw: Status page for LR contexts

Message ID 1395943218-7708-21-git-send-email-oscar.mateo@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

oscar.mateo@intel.com March 27, 2014, 5:59 p.m. UTC
From: Ben Widawsky <benjamin.widawsky@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@bwidawsk.net>

v2: Several rebases.

Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index a552c48..d334f5a 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1306,16 +1306,21 @@  i915_dispatch_execbuffer(struct intel_engine *ring,
 
 static void cleanup_status_page(struct intel_engine *ring)
 {
+	struct drm_i915_private *dev_priv = ring->dev->dev_private;
 	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)
@@ -1444,7 +1449,14 @@  static int intel_init_ring(struct drm_device *dev,
 
 	init_waitqueue_head(&ring->irq_queue);
 
-	if (I915_NEED_GFX_HWS(dev)) {
+	if (dev_priv->lrc_enabled) {
+		obj = ring->default_context->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;