From: Kenneth Graunke Date: Thu, 29 Aug 2019 00:50:13 +0000 (-0700) Subject: iris: Don't auto-flush/dirty on transfer unmap for coherent buffers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=90ca709f6de551892d84491ae2893301bc55fcbb;p=mesa.git 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. --- diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 93abb2ddc49..0cf4b91f927 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -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,