zink: use only the extents for buffer unmap flushes
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Thu, 16 Jun 2022 18:56:32 +0000 (14:56 -0400)
committerMarge Bot <emma+marge@anholt.net>
Fri, 17 Jun 2022 00:56:33 +0000 (00:56 +0000)
flush_region is relative to the map, so passing in the offsets again
breaks the flush (if the flush hook is implemented correctly)

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17095>

src/gallium/drivers/zink/zink_resource.c

index bea54ac..8a59a52 100644 (file)
@@ -2009,7 +2009,10 @@ transfer_unmap(struct pipe_context *pctx, struct pipe_transfer *ptrans)
    struct zink_transfer *trans = (struct zink_transfer *)ptrans;
 
    if (!(trans->base.b.usage & (PIPE_MAP_FLUSH_EXPLICIT | PIPE_MAP_COHERENT))) {
-      zink_transfer_flush_region(pctx, ptrans, &ptrans->box);
+      /* flush_region is relative to the mapped region: use only the extents */
+      struct pipe_box box = ptrans->box;
+      box.x = box.y = box.z = 0;
+      zink_transfer_flush_region(pctx, ptrans, &box);
    }
 
    if ((trans->base.b.usage & PIPE_MAP_PERSISTENT) && !(trans->base.b.usage & PIPE_MAP_COHERENT))