Skip to content

Commit 44d0a9c

Browse files
committed
drm/i915/execlists: Skip redundant resubmission
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 <[email protected]> Reviewed-by: Tvrtko Ursulin <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 3032c0b commit 44d0a9c

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

drivers/gpu/drm/i915/gt/intel_lrc.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1739,11 +1739,26 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
17391739

17401740
if (submit) {
17411741
*port = execlists_schedule_in(last, port - execlists->pending);
1742-
memset(port + 1, 0, (last_port - port) * sizeof(*port));
17431742
execlists->switch_priority_hint =
17441743
switch_prio(engine, *execlists->pending);
1744+
1745+
/*
1746+
* Skip if we ended up with exactly the same set of requests,
1747+
* e.g. trying to timeslice a pair of ordered contexts
1748+
*/
1749+
if (!memcmp(execlists->active, execlists->pending,
1750+
(port - execlists->pending + 1) * sizeof(*port))) {
1751+
do
1752+
execlists_schedule_out(fetch_and_zero(port));
1753+
while (port-- != execlists->pending);
1754+
1755+
goto skip_submit;
1756+
}
1757+
1758+
memset(port + 1, 0, (last_port - port) * sizeof(*port));
17451759
execlists_submit_ports(engine);
17461760
} else {
1761+
skip_submit:
17471762
ring_set_paused(engine, 0);
17481763
}
17491764
}

0 commit comments

Comments
 (0)