iris: Don't auto-flush/dirty on transfer unmap for coherent buffers

When u_upload_mgr fills up a buffer, it unmaps and destroys it.  Our
unmap function was automatically performing the equivalent of a
FlushMappedBufferRange call in this case.  Because the buffer mapping
is persistent and coherent, we don't actually do any flushing when we
do the rest of the writes to the buffer - we were just doing one final
one at the end.  But we would be using the uploaded contents on the
GPU the whole time.

This certainly shouldn't be necessary for streaming buffers, and if
such flushing and dirtying is necessary for coherent buffers, this is
wildly insufficient.

Drops a small number of constant packets and PIPE_CONTROL flushes from
most benchmarks that I've looked at.  Doesn't seem to make much of an
impact on performance, however.

Thanks to Felix Degrood for noticing that we were emitting more
3DSTATE_CONSTANT_* packets than we needed to.
This commit is contained in:
Kenneth Graunke 2019-08-28 17:50:13 -07:00
parent 5f3eb6ef29
commit 90ca709f6d
1 changed files with 2 additions and 1 deletions

View File

@ -1847,7 +1847,8 @@ iris_transfer_unmap(struct pipe_context *ctx, struct pipe_transfer *xfer)
struct iris_context *ice = (struct iris_context *)ctx;
struct iris_transfer *map = (void *) xfer;
if (!(xfer->usage & PIPE_TRANSFER_FLUSH_EXPLICIT)) {
if (!(xfer->usage & (PIPE_TRANSFER_FLUSH_EXPLICIT |
PIPE_TRANSFER_COHERENT))) {
struct pipe_box flush_box = {
.x = 0, .y = 0, .z = 0,
.width = xfer->box.width,