zink: wait for transfer when reading
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 12 Jul 2019 10:58:49 +0000 (12:58 +0200)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 28 Oct 2019 08:51:46 +0000 (08:51 +0000)
TODO: this could really benefit from a separate transfer-queue, I think.
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
src/gallium/drivers/zink/zink_resource.c

index 029e5e91942a73c2c4e411aaf3dc7b655a6c0bf7..781e865cbf86cde950d16f5a58d6d9806a63b768 100644 (file)
@@ -456,6 +456,15 @@ zink_transfer_map(struct pipe_context *pctx,
                                                    false);
             if (ret == false)
                return NULL;
+
+            /* need to wait for rendering to finish */
+            struct pipe_fence_handle *fence = NULL;
+            pctx->flush(pctx, &fence, PIPE_FLUSH_HINT_FINISH);
+            if (fence) {
+               pctx->screen->fence_finish(pctx->screen, NULL, fence,
+                                          PIPE_TIMEOUT_INFINITE);
+               pctx->screen->fence_reference(pctx->screen, &fence, NULL);
+            }
          }
 
          VkResult result = vkMapMemory(screen->dev, staging_res->mem,