[Intel-gfx] [PATCH 1/4] drm/i915: Restore default render context after hw state reset

Mika Kuoppala mika.kuoppala at linux.intel.com
Tue Oct 7 16:21:24 CEST 2014


After reset or suspend, the hardware render context state
has been cleared to default values. If this is a first
switch after such event, we need to restore the state
to get back to pre reset state.

As the render context state contains the wa
registers, on bdw, this also effectively restores the
workarounds past reset/suspend. With older gens,
explicit reinitialization of some registers by driver is
still required.

Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Brad Volkin <bradley.d.volkin at intel.com>
Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
---
 drivers/gpu/drm/i915/i915_gem_context.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index a5221d8..e7fefd7 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -577,7 +577,8 @@ static int do_switch(struct intel_engine_cs *ring,
 		vma->bind_vma(vma, to->legacy_hw_ctx.rcs_state->cache_level, GLOBAL_BIND);
 	}
 
-	if (!to->legacy_hw_ctx.initialized || i915_gem_context_is_default(to))
+	if (!to->legacy_hw_ctx.initialized ||
+	    (from != NULL && i915_gem_context_is_default(to)))
 		hw_flags |= MI_RESTORE_INHIBIT;
 
 	ret = mi_set_context(ring, to, hw_flags);
-- 
1.9.1




More information about the Intel-gfx mailing list