[Intel-gfx] [PATCH 53/66] drm/i915: PPGTT should take a ppgtt argument

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


At one time I was planning to call enable for all PPGTTs. I dropped
this, however I kept around this change because it looks better to me.

Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_drv.h     | 2 +-
 drivers/gpu/drm/i915/i915_gem.c     | 4 +++-
 drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index b1b31c0..883d314 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -533,7 +533,7 @@ struct i915_hw_ppgtt {
 
 	gen6_gtt_pte_t (*pte_encode)(dma_addr_t addr,
 				     enum i915_cache_level level);
-	int (*enable)(struct drm_device *dev);
+	int (*enable)(struct i915_hw_ppgtt *ppgtt);
 	void (*cleanup)(struct i915_hw_ppgtt *ppgtt);
 };
 
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index c91abda..a4db2cc 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4328,6 +4328,7 @@ int
 i915_gem_init_hw(struct drm_device *dev)
 {
 	drm_i915_private_t *dev_priv = dev->dev_private;
+	struct i915_hw_ppgtt *ppgtt;
 	int ret;
 
 	if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
@@ -4361,7 +4362,8 @@ i915_gem_init_hw(struct drm_device *dev)
 	if (ret || !dev_priv->gtt.aliasing_ppgtt)
 		goto disable_ctx_out;
 
-	ret = dev_priv->gtt.aliasing_ppgtt->enable(dev);
+	ppgtt = dev_priv->gtt.aliasing_ppgtt;
+	ret = ppgtt->enable(ppgtt);
 	if (ret)
 		goto disable_ctx_out;
 
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index c3294c3..583d136 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -122,12 +122,12 @@ static void gen6_write_pdes(struct i915_hw_ppgtt *ppgtt)
 	readl(pd_addr);
 }
 
-static int gen6_ppgtt_enable(struct drm_device *dev)
+static int gen6_ppgtt_enable(struct i915_hw_ppgtt *ppgtt)
 {
+	struct drm_device *dev = ppgtt->base.dev;
 	drm_i915_private_t *dev_priv = dev->dev_private;
 	uint32_t pd_offset;
 	struct intel_ring_buffer *ring;
-	struct i915_hw_ppgtt *ppgtt = dev_priv->gtt.aliasing_ppgtt;
 	int i;
 
 	BUG_ON(ppgtt->pd_offset & 0x3f);
-- 
1.8.3.1




More information about the Intel-gfx mailing list