Mesa (main): u_transfer_helper: flush temporary transfer first for MSAA

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 8 20:19:37 UTC 2022


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

Author: Vasily Khoruzhick <anarsoul at gmail.com>
Date:   Tue Jun  7 22:18:12 2022 -0700

u_transfer_helper: flush temporary transfer first for MSAA

vtbl->transfer_map may return staging buffer and not real one and it
exposes a problem in MSAA resolve path, since u_transfer_helper does
blit from a resource that is still mapped and it's not flushed yet.

Add explicit flush_region() for a temporary transfer before doing flush
for MSAA resolve.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16923>

---

 src/gallium/auxiliary/util/u_transfer_helper.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_transfer_helper.c b/src/gallium/auxiliary/util/u_transfer_helper.c
index b380c0e46d2..5c3ce26a91f 100644
--- a/src/gallium/auxiliary/util/u_transfer_helper.c
+++ b/src/gallium/auxiliary/util/u_transfer_helper.c
@@ -492,17 +492,18 @@ u_transfer_helper_transfer_flush_region(struct pipe_context *pctx,
    if (handle_transfer(ptrans->resource)) {
       struct u_transfer *trans = u_transfer(ptrans);
 
-      flush_region(pctx, ptrans, box);
-
       /* handle MSAA case, since there could be multiple levels of
        * wrapped transfer, call pctx->transfer_flush_region()
        * instead of helper->vtbl->transfer_flush_region()
        */
       if (trans->ss) {
          pctx->transfer_flush_region(pctx, trans->trans, box);
+         flush_region(pctx, ptrans, box);
          return;
       }
 
+      flush_region(pctx, ptrans, box);
+
       helper->vtbl->transfer_flush_region(pctx, trans->trans, box);
       if (trans->trans2)
          helper->vtbl->transfer_flush_region(pctx, trans->trans2, box);
@@ -524,6 +525,8 @@ u_transfer_helper_transfer_unmap(struct pipe_context *pctx,
       if (!(ptrans->usage & PIPE_MAP_FLUSH_EXPLICIT)) {
          struct pipe_box box;
          u_box_2d(0, 0, ptrans->box.width, ptrans->box.height, &box);
+         if (trans->ss)
+            pctx->transfer_flush_region(pctx, trans->trans, &box);
          flush_region(pctx, ptrans, &box);
       }
 



More information about the mesa-commit mailing list