[PATCH] drm/i915: Let number of workarounds more clear

Rodrigo Vivi
2014-09-24T22:47:30Z

This helps when including or removing cs workarounds.

v2: Rebase after other Mika's patch that removed some BDW production workarounds.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
drivers/gpu/drm/i915/intel_ringbuffer.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index b583a60..0a4fd37 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -694,6 +694,7 @@ static int bdw_init_workarounds(struct intel_engine_cs *ring)
int ret;
struct drm_device *dev = ring->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
+ int wa_amount;

/*
* workarounds applied in this fn are part of register state context,
@@ -704,10 +705,11 @@ static int bdw_init_workarounds(struct intel_engine_cs *ring)
memset(dev_priv->intel_wa_regs, 0, sizeof(dev_priv->intel_wa_regs));

/*
- * update the number of dwords required based on the
- * actual number of workarounds applied
+ * update the number of workarounds when adding or removing was
+ * in order the have propper dwords
*/
- ret = intel_ring_begin(ring, 18);
+ wa_amount = 6;
+ ret = intel_ring_begin(ring, 3 * wa_amount);
if (ret)
return ret;

@@ -764,6 +766,7 @@ static int chv_init_workarounds(struct intel_engine_cs *ring)
int ret;
struct drm_device *dev = ring->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
+ int wa_amount;

/*
* workarounds applied in this fn are part of register state context,
@@ -773,7 +776,12 @@ static int chv_init_workarounds(struct intel_engine_cs *ring)
dev_priv->num_wa_regs = 0;
memset(dev_priv->intel_wa_regs, 0, sizeof(dev_priv->intel_wa_regs));

- ret = intel_ring_begin(ring, 12);
+ /*
+ * update the number of workarounds when adding or removing was
+ * in order the have propper dwords
+ */
+ wa_amount = 4;
+ ret = intel_ring_begin(ring, 3 * wa_amount);
if (ret)
return ret;

--
1.9.3