summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorKristian H. Kristensen <hoegsberg@chromium.org>2019-01-17 11:32:14 -0800
committerKristian H. Kristensen <hoegsberg@chromium.org>2019-01-18 14:27:12 -0800
commit60c6778ddaed35d010b2d6c8f4d9dfd3415fff33 (patch)
treefa533cf10560043bcc53a2f6c3d376d664e9efbc /src/gallium
parent64b8c86d37ebb1e1d286c69d642d52b7bcf051d3 (diff)
freedreno: Synchronize batch and flush for staging resource
Staging blit downloads would wait on the src resource instead of the staging resource and didn't make sure to submit the blit batch first. Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org> Reviewed-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_resource.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index f19f38add85..14751074ace 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -498,7 +498,21 @@ fd_resource_transfer_map(struct pipe_context *pctx,
if (usage & PIPE_TRANSFER_READ) {
fd_blit_to_staging(ctx, trans);
- fd_bo_cpu_prep(rsc->bo, ctx->pipe, DRM_FREEDRENO_PREP_READ);
+
+ struct fd_batch *batch = NULL;
+ fd_batch_reference(&batch, staging_rsc->write_batch);
+
+ /* we can't fd_bo_cpu_prep() until the blit to staging
+ * is submitted to kernel.. in that case write_batch
+ * wouldn't be NULL yet:
+ */
+ if (batch) {
+ fd_batch_sync(batch);
+ fd_batch_reference(&batch, NULL);
+ }
+
+ fd_bo_cpu_prep(staging_rsc->bo, ctx->pipe,
+ DRM_FREEDRENO_PREP_READ);
}
buf = fd_bo_map(staging_rsc->bo);