panfrost: Respect buffer_offset when mapping to CPU

Previously not seen since mesa/st seems to leave this zero for uniforms.
Still wrong, though.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>
This commit is contained in:
Alyssa Rosenzweig 2021-02-09 09:46:12 -05:00 committed by Marge Bot
parent 21c3e82495
commit 0dc539a872
1 changed files with 4 additions and 4 deletions

View File

@ -965,14 +965,14 @@ panfrost_map_constant_buffer_cpu(struct panfrost_context *ctx,
struct pipe_constant_buffer *cb = &buf->cb[index];
struct panfrost_resource *rsrc = pan_resource(cb->buffer);
if (rsrc)
return rsrc->bo->ptr.cpu;
else if (cb->user_buffer) {
if (rsrc) {
panfrost_bo_mmap(rsrc->bo);
panfrost_flush_batches_accessing_bo(ctx, rsrc->bo, false);
panfrost_bo_wait(rsrc->bo, INT64_MAX, false);
return cb->user_buffer;
return rsrc->bo->ptr.cpu + cb->buffer_offset;
} else if (cb->user_buffer) {
return cb->user_buffer + cb->buffer_offset;
} else
unreachable("No constant buffer");
}