If we are about to do another context-switch in the near future skip
doing performing a lite-restore now. (Forcing a lite-restore just before
a context-switch effectively doubles the cost of that context-switch, so
long as we can handle the interrupt and resubmit before the GPU powers
down, which under normal conditions is expected.)

Signed-off-by: Chris Wilson <[email protected]>
Cc: Mika Kuoppala <[email protected]>
Cc: Joonas Lahtinen <[email protected]>
Cc: Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/intel_lrc.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 6191a2e59e8a..2edd57b3d53e 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -628,6 +628,19 @@ static void execlists_dequeue(struct intel_engine_cs 
*engine)
                        if (port_count(&port[1]))
                                goto unlock;
 
+                       /*
+                        * If we are about to do another context-switch in
+                        * the near future skip doing performing a lite-restore
+                        * now. (Forcing a lite-restore just before a
+                        * context-switch effectively doubles the cost of that
+                        * context-switch, so long as we can handle the
+                        * interrupt and resubmit before the GPU powers down,
+                        * which under normal conditions is expected.)
+                        */
+                       if (i915_seqno_passed(intel_engine_get_seqno(engine),
+                                             last->global_seqno - 1))
+                               goto unlock;
+
                        /* WaIdleLiteRestore:bdw,skl
                         * Apply the wa NOOPs to prevent
                         * ring:HEAD == req:TAIL as we resubmit the
-- 
2.15.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to