Mesa (master): zink: add more explicit fencing for transfer maps

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 14 13:26:27 UTC 2020


Module: Mesa
Branch: master
Commit: 8dfb941a4c5f7178f818758175c64bc9093b094f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8dfb941a4c5f7178f818758175c64bc9093b094f

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Mon Jun 29 14:26:47 2020 -0400

zink: add more explicit fencing for transfer maps

we're using our (primitive) buffer r/w tracking here to ensure that our
src buffers are synchronized before we do any kind of read operation on them

this is pretty slow in some cases, but it fixes a bunch of piglit tests

Reviewed-by: Erik Faye-Lun <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6924>

---

 src/gallium/drivers/zink/zink_resource.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index a811eba5453..eab65c6adb0 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -529,6 +529,8 @@ zink_transfer_map(struct pipe_context *pctx,
 
       } else {
          assert(!res->optimial_tiling);
+         if (batch_uses >= ZINK_RESOURCE_ACCESS_WRITE)
+            zink_fence_wait(pctx);
          VkResult result = vkMapMemory(screen->dev, res->mem, res->offset, res->size, 0, &ptr);
          if (result != VK_SUCCESS)
             return NULL;
@@ -565,7 +567,9 @@ zink_transfer_unmap(struct pipe_context *pctx,
 
       if (trans->base.usage & PIPE_MAP_WRITE) {
          struct zink_context *ctx = zink_context(pctx);
-
+         uint32_t batch_uses = get_resource_usage(res);
+         if (batch_uses >= ZINK_RESOURCE_ACCESS_WRITE)
+            zink_fence_wait(pctx);
          zink_transfer_copy_bufimage(ctx, res, staging_res, trans, true);
       }
 



More information about the mesa-commit mailing list