diff mbox

[04/10] drm/i915: move dri1 dungeon out of dev_priv

Message ID 1351882511-21290-5-git-send-email-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter Nov. 2, 2012, 6:55 p.m. UTC
Also, move dev_priv->counter there, it's only used in i915_dma.c

And also move the dri1 dungeon at the end of dev_priv where no one
cares about it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/i915_dma.c | 28 ++++++++++++++--------------
 drivers/gpu/drm/i915/i915_drv.h | 31 +++++++++++++++++--------------
 2 files changed, 31 insertions(+), 28 deletions(-)

Comments

Jesse Barnes Nov. 2, 2012, 7:09 p.m. UTC | #1
On Fri,  2 Nov 2012 19:55:05 +0100
Daniel Vetter <daniel.vetter@ffwll.ch> wrote:

> Also, move dev_priv->counter there, it's only used in i915_dma.c
> 
> And also move the dri1 dungeon at the end of dev_priv where no one
> cares about it.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/i915_dma.c | 28 ++++++++++++++--------------
>  drivers/gpu/drm/i915/i915_drv.h | 31 +++++++++++++++++--------------
>  2 files changed, 31 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index a794d3b..320e2c9 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -451,16 +451,16 @@ static void i915_emit_breadcrumb(struct drm_device *dev)
>  	drm_i915_private_t *dev_priv = dev->dev_private;
>  	struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
>  
> -	dev_priv->counter++;
> -	if (dev_priv->counter > 0x7FFFFFFFUL)
> -		dev_priv->counter = 0;
> +	dev_priv->dri1.counter++;
> +	if (dev_priv->dri1.counter > 0x7FFFFFFFUL)
> +		dev_priv->dri1.counter = 0;
>  	if (master_priv->sarea_priv)
> -		master_priv->sarea_priv->last_enqueue = dev_priv->counter;
> +		master_priv->sarea_priv->last_enqueue = dev_priv->dri1.counter;
>  
>  	if (BEGIN_LP_RING(4) == 0) {
>  		OUT_RING(MI_STORE_DWORD_INDEX);
>  		OUT_RING(I915_BREADCRUMB_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
> -		OUT_RING(dev_priv->counter);
> +		OUT_RING(dev_priv->dri1.counter);
>  		OUT_RING(0);
>  		ADVANCE_LP_RING();
>  	}
> @@ -602,12 +602,12 @@ static int i915_dispatch_flip(struct drm_device * dev)
>  
>  	ADVANCE_LP_RING();
>  
> -	master_priv->sarea_priv->last_enqueue = dev_priv->counter++;
> +	master_priv->sarea_priv->last_enqueue = dev_priv->dri1.counter++;
>  
>  	if (BEGIN_LP_RING(4) == 0) {
>  		OUT_RING(MI_STORE_DWORD_INDEX);
>  		OUT_RING(I915_BREADCRUMB_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
> -		OUT_RING(dev_priv->counter);
> +		OUT_RING(dev_priv->dri1.counter);
>  		OUT_RING(0);
>  		ADVANCE_LP_RING();
>  	}
> @@ -775,21 +775,21 @@ static int i915_emit_irq(struct drm_device * dev)
>  
>  	DRM_DEBUG_DRIVER("\n");
>  
> -	dev_priv->counter++;
> -	if (dev_priv->counter > 0x7FFFFFFFUL)
> -		dev_priv->counter = 1;
> +	dev_priv->dri1.counter++;
> +	if (dev_priv->dri1.counter > 0x7FFFFFFFUL)
> +		dev_priv->dri1.counter = 1;
>  	if (master_priv->sarea_priv)
> -		master_priv->sarea_priv->last_enqueue = dev_priv->counter;
> +		master_priv->sarea_priv->last_enqueue = dev_priv->dri1.counter;
>  
>  	if (BEGIN_LP_RING(4) == 0) {
>  		OUT_RING(MI_STORE_DWORD_INDEX);
>  		OUT_RING(I915_BREADCRUMB_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
> -		OUT_RING(dev_priv->counter);
> +		OUT_RING(dev_priv->dri1.counter);
>  		OUT_RING(MI_USER_INTERRUPT);
>  		ADVANCE_LP_RING();
>  	}
>  
> -	return dev_priv->counter;
> +	return dev_priv->dri1.counter;
>  }
>  
>  static int i915_wait_irq(struct drm_device * dev, int irq_nr)
> @@ -820,7 +820,7 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr)
>  
>  	if (ret == -EBUSY) {
>  		DRM_ERROR("EBUSY -- rec: %d emitted: %d\n",
> -			  READ_BREADCRUMB(dev_priv), (int)dev_priv->counter);
> +			  READ_BREADCRUMB(dev_priv), (int)dev_priv->dri1.counter);
>  	}
>  
>  	return ret;
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 69cf5fa..98b52e7 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -586,6 +586,19 @@ struct intel_ilk_power_mgmt {
>  	struct drm_i915_gem_object *renderctx;
>  };
>  
> +struct i915_dri1_state {
> +	unsigned allow_batchbuffer : 1;
> +	u32 __iomem *gfx_hws_cpu_addr;
> +
> +	unsigned int cpp;
> +	int back_offset;
> +	int front_offset;
> +	int current_page;
> +	int page_flipping;
> +
> +	uint32_t counter;
> +};
> +
>  typedef struct drm_i915_private {
>  	struct drm_device *dev;
>  
> @@ -620,7 +633,6 @@ typedef struct drm_i915_private {
>  	uint32_t next_seqno;
>  
>  	drm_dma_handle_t *status_page_dmah;
> -	uint32_t counter;
>  	struct resource mch_res;
>  
>  	atomic_t irq_received;
> @@ -827,19 +839,6 @@ typedef struct drm_i915_private {
>  		u32 object_count;
>  	} mm;
>  
> -	/* Old dri1 support infrastructure, beware the dragons ya fools entering
> -	 * here! */
> -	struct {
> -		unsigned allow_batchbuffer : 1;
> -		u32 __iomem *gfx_hws_cpu_addr;
> -
> -		unsigned int cpp;
> -		int back_offset;
> -		int front_offset;
> -		int current_page;
> -		int page_flipping;
> -	} dri1;
> -
>  	/* Kernel Modesetting */
>  
>  	struct sdvo_device_mapping sdvo_mappings[2];
> @@ -893,6 +892,10 @@ typedef struct drm_i915_private {
>  	uint32_t hw_context_size;
>  
>  	struct i915_suspend_saved_registers regfile;
> +
> +	/* Old dri1 support infrastructure, beware the dragons ya fools entering
> +	 * here! */
> +	struct i915_dri1_state dri1;
>  } drm_i915_private_t;
>  
>  /* Iterate over initialised rings */

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index a794d3b..320e2c9 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -451,16 +451,16 @@  static void i915_emit_breadcrumb(struct drm_device *dev)
 	drm_i915_private_t *dev_priv = dev->dev_private;
 	struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
 
-	dev_priv->counter++;
-	if (dev_priv->counter > 0x7FFFFFFFUL)
-		dev_priv->counter = 0;
+	dev_priv->dri1.counter++;
+	if (dev_priv->dri1.counter > 0x7FFFFFFFUL)
+		dev_priv->dri1.counter = 0;
 	if (master_priv->sarea_priv)
-		master_priv->sarea_priv->last_enqueue = dev_priv->counter;
+		master_priv->sarea_priv->last_enqueue = dev_priv->dri1.counter;
 
 	if (BEGIN_LP_RING(4) == 0) {
 		OUT_RING(MI_STORE_DWORD_INDEX);
 		OUT_RING(I915_BREADCRUMB_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
-		OUT_RING(dev_priv->counter);
+		OUT_RING(dev_priv->dri1.counter);
 		OUT_RING(0);
 		ADVANCE_LP_RING();
 	}
@@ -602,12 +602,12 @@  static int i915_dispatch_flip(struct drm_device * dev)
 
 	ADVANCE_LP_RING();
 
-	master_priv->sarea_priv->last_enqueue = dev_priv->counter++;
+	master_priv->sarea_priv->last_enqueue = dev_priv->dri1.counter++;
 
 	if (BEGIN_LP_RING(4) == 0) {
 		OUT_RING(MI_STORE_DWORD_INDEX);
 		OUT_RING(I915_BREADCRUMB_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
-		OUT_RING(dev_priv->counter);
+		OUT_RING(dev_priv->dri1.counter);
 		OUT_RING(0);
 		ADVANCE_LP_RING();
 	}
@@ -775,21 +775,21 @@  static int i915_emit_irq(struct drm_device * dev)
 
 	DRM_DEBUG_DRIVER("\n");
 
-	dev_priv->counter++;
-	if (dev_priv->counter > 0x7FFFFFFFUL)
-		dev_priv->counter = 1;
+	dev_priv->dri1.counter++;
+	if (dev_priv->dri1.counter > 0x7FFFFFFFUL)
+		dev_priv->dri1.counter = 1;
 	if (master_priv->sarea_priv)
-		master_priv->sarea_priv->last_enqueue = dev_priv->counter;
+		master_priv->sarea_priv->last_enqueue = dev_priv->dri1.counter;
 
 	if (BEGIN_LP_RING(4) == 0) {
 		OUT_RING(MI_STORE_DWORD_INDEX);
 		OUT_RING(I915_BREADCRUMB_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
-		OUT_RING(dev_priv->counter);
+		OUT_RING(dev_priv->dri1.counter);
 		OUT_RING(MI_USER_INTERRUPT);
 		ADVANCE_LP_RING();
 	}
 
-	return dev_priv->counter;
+	return dev_priv->dri1.counter;
 }
 
 static int i915_wait_irq(struct drm_device * dev, int irq_nr)
@@ -820,7 +820,7 @@  static int i915_wait_irq(struct drm_device * dev, int irq_nr)
 
 	if (ret == -EBUSY) {
 		DRM_ERROR("EBUSY -- rec: %d emitted: %d\n",
-			  READ_BREADCRUMB(dev_priv), (int)dev_priv->counter);
+			  READ_BREADCRUMB(dev_priv), (int)dev_priv->dri1.counter);
 	}
 
 	return ret;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 69cf5fa..98b52e7 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -586,6 +586,19 @@  struct intel_ilk_power_mgmt {
 	struct drm_i915_gem_object *renderctx;
 };
 
+struct i915_dri1_state {
+	unsigned allow_batchbuffer : 1;
+	u32 __iomem *gfx_hws_cpu_addr;
+
+	unsigned int cpp;
+	int back_offset;
+	int front_offset;
+	int current_page;
+	int page_flipping;
+
+	uint32_t counter;
+};
+
 typedef struct drm_i915_private {
 	struct drm_device *dev;
 
@@ -620,7 +633,6 @@  typedef struct drm_i915_private {
 	uint32_t next_seqno;
 
 	drm_dma_handle_t *status_page_dmah;
-	uint32_t counter;
 	struct resource mch_res;
 
 	atomic_t irq_received;
@@ -827,19 +839,6 @@  typedef struct drm_i915_private {
 		u32 object_count;
 	} mm;
 
-	/* Old dri1 support infrastructure, beware the dragons ya fools entering
-	 * here! */
-	struct {
-		unsigned allow_batchbuffer : 1;
-		u32 __iomem *gfx_hws_cpu_addr;
-
-		unsigned int cpp;
-		int back_offset;
-		int front_offset;
-		int current_page;
-		int page_flipping;
-	} dri1;
-
 	/* Kernel Modesetting */
 
 	struct sdvo_device_mapping sdvo_mappings[2];
@@ -893,6 +892,10 @@  typedef struct drm_i915_private {
 	uint32_t hw_context_size;
 
 	struct i915_suspend_saved_registers regfile;
+
+	/* Old dri1 support infrastructure, beware the dragons ya fools entering
+	 * here! */
+	struct i915_dri1_state dri1;
 } drm_i915_private_t;
 
 /* Iterate over initialised rings */