[PATCH 4/9] drm/i915: Add gen5 support to mi_set_context

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It's similar enough to the other gens that we don't really need a
distinct function to do it.

NOTE: The new function removes the MI_FLUSH that was at the end of the
old Ironlake switching code. Recent docs can find neither the
requirement for the MI_FLUSH or the MI_SUSPEND_FLUSH. Since I remember
clearly seeing the latter in a doc at one point however, I am going to
leave it there. I had Ken look at his docs as well, and he could also
find no note of either.

NOTE2: Remember to put NOTE1 in the commit where we start using the new
function for ILK.

CC: Kenneth Graunke <kenneth at whitecape.org>
Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_gem_context.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 2c25006..a9beaaa 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -369,11 +369,18 @@ mi_set_context(struct intel_ring_buffer *ring,
 	if (ret)
 		return ret;
 
-	/* WaProgramMiArbOnOffAroundMiSetContext:ivb,vlv,hsw */
-	if (IS_GEN7(ring->dev))
+	switch (INTEL_INFO(ring->dev)->gen) {
+	case 7:
+		/* WaProgramMiArbOnOffAroundMiSetContext:ivb,vlv,hsw */
 		intel_ring_emit(ring, MI_ARB_ON_OFF | MI_ARB_DISABLE);
-	else
+		break;
+	case 5:
+		intel_ring_emit(ring, MI_SUSPEND_FLUSH | MI_SUSPEND_FLUSH_EN);
+		break;
+	default:
 		intel_ring_emit(ring, MI_NOOP);
+		break;
+	}
 
 	intel_ring_emit(ring, MI_NOOP);
 	intel_ring_emit(ring, MI_SET_CONTEXT);
@@ -385,14 +392,22 @@ mi_set_context(struct intel_ring_buffer *ring,
 	/* w/a: MI_SET_CONTEXT must always be followed by MI_NOOP */
 	intel_ring_emit(ring, MI_NOOP);
 
-	if (IS_GEN7(ring->dev))
+	switch (INTEL_INFO(ring->dev)->gen) {
+	case 7:
 		intel_ring_emit(ring, MI_ARB_ON_OFF | MI_ARB_ENABLE);
-	else
+		break;
+	case 5:
+		intel_ring_emit(ring, MI_SUSPEND_FLUSH);
+		break;
+	default:
 		intel_ring_emit(ring, MI_NOOP);
+		break;
+	}
 
 	intel_ring_advance(ring);
 
 	return ret;
+
 }
 
 static int do_switch(struct i915_hw_context *to)
-- 
1.8.3.2



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux