Mesa (staging/22.1): zink: fix buffer transfer flushes with offsets
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 17 16:05:10 UTC 2022
Module: Mesa
Branch: staging/22.1
Commit: d7b5c1f998d4d4d9f3a8b1fcdb0790cbd09dd2da
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d7b5c1f998d4d4d9f3a8b1fcdb0790cbd09dd2da
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Thu Jun 16 14:33:46 2022 -0400
zink: fix buffer transfer flushes with offsets
the src and dst ofsets need to be adjusted by the base map offset
in order to flush the correct region
cc: mesa-stable
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17095>
(cherry picked from commit ce5aa07db1091a83321229c802f256a44f37aded)
---
.pick_status.json | 2 +-
src/gallium/drivers/zink/zink_resource.c | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 91100d5b859..0db9e5b59dc 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -94,7 +94,7 @@
"description": "zink: fix buffer transfer flushes with offsets",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index c2198b8e6a4..fa0901795f6 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -1823,10 +1823,11 @@ zink_transfer_flush_region(struct pipe_context *pctx,
struct zink_screen *screen = zink_screen(pctx->screen);
struct zink_resource *m = trans->staging_res ? zink_resource(trans->staging_res) :
res;
- ASSERTED VkDeviceSize size, src_offset;
+ ASSERTED VkDeviceSize size, src_offset, dst_offset = 0;
if (m->obj->is_buffer) {
size = box->width;
- src_offset = trans->offset;
+ src_offset = box->x + (trans->staging_res ? trans->offset : ptrans->box.x);
+ dst_offset = box->x + ptrans->box.x;
} else {
size = (VkDeviceSize)box->width * box->height * util_format_get_blocksize(m->base.b.format);
src_offset = trans->offset +
@@ -1845,7 +1846,7 @@ zink_transfer_flush_region(struct pipe_context *pctx,
struct zink_resource *staging_res = zink_resource(trans->staging_res);
if (ptrans->resource->target == PIPE_BUFFER)
- zink_copy_buffer(ctx, res, staging_res, box->x, src_offset, box->width);
+ zink_copy_buffer(ctx, res, staging_res, dst_offset, src_offset, size);
else
zink_transfer_copy_bufimage(ctx, res, staging_res, trans);
}
More information about the mesa-commit
mailing list