]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/i915/execlists: Skip redundant resubmission
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 3 Oct 2019 21:00:56 +0000 (22:00 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 4 Oct 2019 11:52:24 +0000 (12:52 +0100)
If we unwind the active requests, and on resubmission discover that we
intend to preempt the active contexts with themselves, simply skip the
ELSP submission.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191003210100.22250-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gt/intel_lrc.c

index 431d3b8c3371f335fdf6122f8e899404145c3aa4..3cfea1758fd2fe7c2b2ad0cffd43dea2f8463a34 100644 (file)
@@ -1739,11 +1739,26 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
 
        if (submit) {
                *port = execlists_schedule_in(last, port - execlists->pending);
-               memset(port + 1, 0, (last_port - port) * sizeof(*port));
                execlists->switch_priority_hint =
                        switch_prio(engine, *execlists->pending);
+
+               /*
+                * Skip if we ended up with exactly the same set of requests,
+                * e.g. trying to timeslice a pair of ordered contexts
+                */
+               if (!memcmp(execlists->active, execlists->pending,
+                           (port - execlists->pending + 1) * sizeof(*port))) {
+                       do
+                               execlists_schedule_out(fetch_and_zero(port));
+                       while (port-- != execlists->pending);
+
+                       goto skip_submit;
+               }
+
+               memset(port + 1, 0, (last_port - port) * sizeof(*port));
                execlists_submit_ports(engine);
        } else {
+skip_submit:
                ring_set_paused(engine, 0);
        }
 }