Mesa (main): freedreno: Swap needs_ubwc_clear when shadowing.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 30 21:57:29 UTC 2021


Module: Mesa
Branch: main
Commit: 88161ced8d092e6e654d3c45466f132b0142f0fd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=88161ced8d092e6e654d3c45466f132b0142f0fd

Author: Emma Anholt <emma at anholt.net>
Date:   Tue Jun 22 15:10:12 2021 -0700

freedreno: Swap needs_ubwc_clear when shadowing.

The destination of the upcoming blit (the old rsc struct that houses the
fresh BO) wouldn't have its ubwc cleared first, which if it got
unfortunate data in a recycled BO could lead to blit failures.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11544>

---

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

diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index 95c51956254..1bfded8a2ff 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -443,6 +443,12 @@ fd_try_shadow_resource(struct fd_context *ctx, struct fd_resource *rsc,
 
    swap(rsc->bo, shadow->bo);
    swap(rsc->valid, shadow->valid);
+
+   /* swap() doesn't work because you can't typeof() the bitfield. */
+   bool temp = shadow->needs_ubwc_clear;
+   shadow->needs_ubwc_clear = rsc->needs_ubwc_clear;
+   rsc->needs_ubwc_clear = temp;
+
    swap(rsc->layout, shadow->layout);
    rsc->seqno = p_atomic_inc_return(&ctx->screen->rsc_seqno);
 



More information about the mesa-commit mailing list