tu: Integrate WFI/WAIT_FOR_ME/WAIT_MEM_WRITES with cache tracking
authorConnor Abbott <cwabbott0@gmail.com>
Mon, 20 Jul 2020 11:12:32 +0000 (13:12 +0200)
committerConnor Abbott <cwabbott0@gmail.com>
Fri, 24 Jul 2020 17:20:44 +0000 (19:20 +0200)
commita0ca688a674d9b85d7efecc8a0199be80c26b501
tree01862ecd56a1f46db19521d766b0a222966b71ec
parentcd78a7a5ff5590bdc3c118e553affd11d9438cf7
tu: Integrate WFI/WAIT_FOR_ME/WAIT_MEM_WRITES with cache tracking

Track them via pending_flush_bits. Previously WFI was only tracked in
flush_bits and WAIT_FOR_ME was emitted directly. This means that we don't
emit WAIT_FOR_ME or WAIT_FOR_IDLE if there wasn't a cache flush or other
write by the GPU. Also split up host writes from sysmem writes, as only
the former require WFI/WAIT_FOR_ME.

Along the way, I also realized that we were missing proper handling of
transform feedback counter writes which require WAIT_MEM_WRITES. Plumb
that through as well. And CmdDrawIndirectByteCountEXT needs a
WAIT_FOR_ME as it does not wait for WFI internally.

As an example of what this does, a typical barrier for transform
feedback with srcAccess = VK_TRANSFORM_FEEDBACK_WRITE_COUNTER_BIT_EXT
and dstAccess = VK_ACCESS_INDIRECT_COMMAND_READ_BIT used to emit on
A650:

- WAIT_FOR_IDLE

and now we emit:

- WAIT_MEM_WRITES
- WAIT_FOR_ME

So we've eliminated a useless WFI and added some necessary waits.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6007>
src/freedreno/vulkan/tu_cmd_buffer.c
src/freedreno/vulkan/tu_private.h