diff mbox

[2/9] drm/i915: Convert renderctx to a regular context

Message ID 1373818974-23102-3-git-send-email-ben@bwidawsk.net (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Widawsky July 14, 2013, 4:22 p.m. UTC
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@bwidawsk.net>
---
 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(-)

Comments

Chris Wilson July 15, 2013, 10:24 a.m. UTC | #1
On Sun, Jul 14, 2013 at 09:22:46AM -0700, Ben Widawsky wrote:
> @@ -3650,10 +3650,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];
> +	}

Make this a bit more consistent style wise. You are mixing here !obj and
obj == NULL, along with a superfluous else{}.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 8637979..5e88ef6 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1347,9 +1347,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 03ab05c..64c6ae0 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -789,7 +789,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 ab72c72..2c25006 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -589,7 +589,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 2673602..10f8f7cd 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3615,10 +3615,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) {
@@ -3650,10 +3650,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);