summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c b/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c
index 24d23d29bbf..14fb53cb8f7 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c
@@ -390,15 +390,22 @@ nvc0_miptree_transfer_map(struct pipe_context *pctx,
}
tx->nlayers = box->depth;
- tx->base.stride = tx->nblocksx * util_format_get_blocksize(res->format);
- tx->base.layer_stride = tx->nblocksy * tx->base.stride;
-
if (usage & PIPE_TRANSFER_MAP_DIRECTLY) {
- tx->base.stride = align(tx->base.stride, 128);
+ tx->base.stride = mt->level[level].pitch;
+ tx->base.layer_stride = mt->layer_stride;
+ uint32_t offset = box->y * tx->base.stride +
+ util_format_get_stride(res->format, box->x);
+ if (!mt->layout_3d)
+ offset += mt->layer_stride * box->z;
+ else
+ offset += nvc0_mt_zslice_offset(mt, level, box->z);
*ptransfer = &tx->base;
- return mt->base.bo->map + mt->base.offset;
+ return mt->base.bo->map + mt->base.offset + offset;
}
+ tx->base.stride = tx->nblocksx * util_format_get_blocksize(res->format);
+ tx->base.layer_stride = tx->nblocksy * tx->base.stride;
+
nv50_m2mf_rect_setup(&tx->rect[0], res, level, box->x, box->y, box->z);
size = tx->base.layer_stride;