iris: Implement PIPE_FLUSH_DEFERRED support

Graphics / Mesa 3D Graphics Library / Mesa - Kenneth Graunke [] - 1 May 2020 19:00 EDT

(Co-authored with Chris Wilson.)

Frequently, games create fences and later check them with a timeout of 0 to see if that work has completed yet. They do not want the work to be flushed immediately upon fence creation.

This is what PIPE_FLUSH_DEFERRED does - it inhibits the flush at fence creation time, but still guarantees that a flush will occur later on once fence_finish() is called.

Since syncpts can only occur at batch boundaries, when deferring a flush, we have to wait for the syncpt at the end of the batch being constructed. This is later than desired, but safe if blocking. To avoid extra delays, we additionally insert a PIPE_CONTROL to write an availability bit at the exact point of the fence. We can poll this on the CPU, allowing us to check whether the fence has gone by, even if the batch hasn't completed. It can also let us skip kernel calls.

Improves performance in Bioshock Infinite by 10% on Icelake GT2 on-ForceCompatLevel=5 settings. Thanks to Felix Degrood and Mark Janes for helping notice the extraneous stalls and batches, Marek Olšák for adding deferred flush support to Gallium to solve this issue, and Chris Wilson for reworking a lot of the internals of this work.


1800e4b58ca iris: Implement PIPE_FLUSH_DEFERRED support.
src/gallium/drivers/iris/iris_fence.c | 96 ++++++++++++++++++++++++++++++++---
1 file changed, 90 insertions(+), 6 deletions(-)


  • Share