diff mbox

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

Message ID 1373818974-23102-5-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
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@whitecape.org>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_gem_context.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)
diff mbox

Patch

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)