[Intel-gfx] [PATCH 2/9] drm/i915: Convert renderctx to a regular context

Chris Wilson chris at chris-wilson.co.uk
Thu Sep 5 15:18:34 CEST 2013


From: Ben Widawsky <ben at bwidawsk.net>

The medium term plan is to just use the existing context code on ILK as
well. The conversion just assists. Therefore, this is somewhat transient
as I plan to kill renderctx quite soon.

Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
Tested-by: Chris Wilson <chris at chris-wilson.co.uk> # X still works!
---
 drivers/gpu/drm/i915/i915_debugfs.c     |    4 ++--
 drivers/gpu/drm/i915/i915_drv.h         |    2 +-
 drivers/gpu/drm/i915/i915_gem_context.c |    2 +-
 drivers/gpu/drm/i915/intel_pm.c         |   18 +++++++++++-------
 4 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index a6f4cb5..76da70f 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1454,9 +1454,9 @@ static int i915_context_status(struct seq_file *m, void *unused)
 		seq_putc(m, '\n');
 	}
 
-	if (dev_priv->ips.renderctx) {
+	if (dev_priv->ips.renderctx.obj) {
 		seq_puts(m, "render context ");
-		describe_obj(m, dev_priv->ips.renderctx);
+		describe_obj(m, dev_priv->ips.renderctx.obj);
 		seq_putc(m, '\n');
 	}
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 694188f..f2ef59e 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -873,7 +873,7 @@ struct intel_ilk_power_mgmt {
 	int r_t;
 
 	struct drm_i915_gem_object *pwrctx;
-	struct drm_i915_gem_object *renderctx;
+	struct i915_hw_context renderctx;
 };
 
 /* Power well structure for haswell */
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 50aa6cb..82106c1 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -575,7 +575,7 @@ int ironlake_setup_rc6_hw_context(struct drm_i915_private *dev_priv)
 
 	intel_ring_emit(ring, MI_SUSPEND_FLUSH | MI_SUSPEND_FLUSH_EN);
 	intel_ring_emit(ring, MI_SET_CONTEXT);
-	intel_ring_emit(ring, i915_gem_obj_ggtt_offset(dev_priv->ips.renderctx) |
+	intel_ring_emit(ring, i915_gem_obj_ggtt_offset(dev_priv->ips.renderctx.obj) |
 			MI_MM_SPACE_GTT |
 			MI_SAVE_EXT_STATE_EN |
 			MI_RESTORE_EXT_STATE_EN |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 42634f5..e68fdb4 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3877,10 +3877,10 @@ void ironlake_teardown_rc6(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (dev_priv->ips.renderctx) {
-		i915_gem_object_unpin(dev_priv->ips.renderctx);
-		drm_gem_object_unreference(&dev_priv->ips.renderctx->base);
-		dev_priv->ips.renderctx = NULL;
+	if (dev_priv->ips.renderctx.obj) {
+		i915_gem_object_unpin(dev_priv->ips.renderctx.obj);
+		drm_gem_object_unreference(&dev_priv->ips.renderctx.obj->base);
+		dev_priv->ips.renderctx.obj = NULL;
 	}
 
 	if (dev_priv->ips.pwrctx) {
@@ -3912,10 +3912,14 @@ static int ironlake_setup_rc6(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (dev_priv->ips.renderctx == NULL)
-		dev_priv->ips.renderctx = intel_alloc_context_page(dev);
-	if (!dev_priv->ips.renderctx)
+	if (dev_priv->ips.renderctx.obj == NULL)
+		dev_priv->ips.renderctx.obj = intel_alloc_context_page(dev);
+	if (!dev_priv->ips.renderctx.obj)
 		return -ENOMEM;
+	else {
+		dev_priv->ips.renderctx.id = DEFAULT_CONTEXT_ID;
+		dev_priv->ips.renderctx.ring = &dev_priv->ring[RCS];
+	}
 
 	if (dev_priv->ips.pwrctx == NULL)
 		dev_priv->ips.pwrctx = intel_alloc_context_page(dev);
-- 
1.7.9.5




More information about the Intel-gfx mailing list