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>
This commit is contained in:
Emma Anholt
2021-06-22 15:10:12 -07:00
committed by Marge Bot
parent ed1f1dea28
commit 88161ced8d
@@ -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);