asahi: Implement valid buffer range tracking
authorAsahi Lina <lina@asahilina.net>
Wed, 29 Mar 2023 10:20:12 +0000 (19:20 +0900)
committerMarge Bot <emma+marge@anholt.net>
Fri, 7 Apr 2023 03:23:04 +0000 (03:23 +0000)
commitfcf594d00b1e06f6d86c5a31dac4beba3f548b34
tree3e7e4e4c6a2f1addb91de0228865fe7085c2fad6
parent00064ba4e303cde7f628bf09474fbdcdf5900ae2
asahi: Implement valid buffer range tracking

A common pattern is to allocate a vertex/etc buffer and write to it in
subsets. Some games interleave this with draw calls using the buffer.
This causes very expensive flushing for every draw call.

Fix this by tracking which range of a buffer has been written to, and
elide syncs when the range was previously uninitialized.

Fixes Source engine game performance and probably helps a bunch of
others.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
src/gallium/drivers/asahi/agx_batch.c
src/gallium/drivers/asahi/agx_pipe.c
src/gallium/drivers/asahi/agx_state.h