Mesa (main): zink: stop allocating such massive staging regions for buffer maps
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jan 20 16:08:02 UTC 2022
Module: Mesa
Branch: main
Commit: d83b52928c46089c16145f8d8c56fcb0c49dbeda
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d83b52928c46089c16145f8d8c56fcb0c49dbeda
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Fri Jan 7 12:58:06 2022 -0500
zink: stop allocating such massive staging regions for buffer maps
this would allocate a new stream uploader for every map if the offset was
large (e.g., all sparse buffer usage), which almost immediately consumes all vram
cc: mesa-stable
fixes KHR-GL46.CommonBugs.CommonBug_SparseBuffersWithCopyOps
Acked-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14381>
---
src/gallium/drivers/zink/zink_resource.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index dcc896639a1..d172a4654a1 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -1320,13 +1320,13 @@ zink_buffer_map(struct pipe_context *pctx,
mgr = ctx->tc->base.stream_uploader;
else
mgr = ctx->base.stream_uploader;
- u_upload_alloc(mgr, 0, box->width + box->x,
+ u_upload_alloc(mgr, 0, box->width,
screen->info.props.limits.minMemoryMapAlignment, &offset,
(struct pipe_resource **)&trans->staging_res, (void **)&ptr);
res = zink_resource(trans->staging_res);
- trans->offset = offset + box->x;
+ trans->offset = offset;
usage |= PIPE_MAP_UNSYNCHRONIZED;
- ptr = ((uint8_t *)ptr) + box->x;
+ ptr = ((uint8_t *)ptr);
} else {
/* At this point, the buffer is always idle (we checked it above). */
usage |= PIPE_MAP_UNSYNCHRONIZED;
More information about the mesa-commit
mailing list