From 90ca709f6de551892d84491ae2893301bc55fcbb Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 28 Aug 2019 17:50:13 -0700 Subject: [PATCH] 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. --- src/gallium/drivers/iris/iris_resource.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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, -- 2.30.2