Mesa (master): freedreno: rebind_resource() *before* bo changes

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 29 00:27:30 UTC 2020


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

Author: Rob Clark <robdclark at chromium.org>
Date:   Fri Apr 24 15:10:49 2020 -0700

freedreno: rebind_resource() *before* bo changes

This will matter in the next patch, where we need the original
rsc->seqno.

It means slight shuffling of where we call rebind_resource() in the
`fd_try_shadow_resource()` path.

Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4744>

---

 src/gallium/drivers/freedreno/freedreno_resource.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index a4933acdf3b..88967bf9777 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -264,6 +264,7 @@ fd_try_shadow_resource(struct fd_context *ctx, struct fd_resource *rsc,
 	 * should empty/destroy rsc->batches hashset)
 	 */
 	fd_bc_invalidate_resource(rsc, false);
+	rebind_resource(rsc);
 
 	mtx_lock(&ctx->screen->lock);
 
@@ -386,8 +387,6 @@ fd_resource_uncompress(struct fd_context *ctx, struct fd_resource *rsc)
 
 	/* shadow should not fail in any cases where we need to uncompress: */
 	debug_assert(success);
-
-	rebind_resource(rsc);
 }
 
 static struct fd_resource *
@@ -635,8 +634,8 @@ fd_resource_transfer_map(struct pipe_context *pctx,
 
 	if (usage & PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE) {
 		if (needs_flush || fd_resource_busy(rsc, op)) {
-			realloc_bo(rsc, fd_bo_size(rsc->bo));
 			rebind_resource(rsc);
+			realloc_bo(rsc, fd_bo_size(rsc->bo));
 		}
 	} else if ((usage & PIPE_TRANSFER_WRITE) &&
 			   prsc->target == PIPE_BUFFER &&
@@ -679,7 +678,6 @@ fd_resource_transfer_map(struct pipe_context *pctx,
 			if (needs_flush && fd_try_shadow_resource(ctx, rsc, level,
 							box, DRM_FORMAT_MOD_LINEAR)) {
 				needs_flush = busy = false;
-				rebind_resource(rsc);
 				ctx->stats.shadow_uploads++;
 			} else {
 				struct fd_resource *staging_rsc;



More information about the mesa-commit mailing list