diff options
author | Ilia Mirkin <[email protected]> | 2016-06-23 22:33:59 -0400 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2016-06-24 09:53:13 -0400 |
commit | b433cb51e50cab878cbaa023662bacd1f923a183 (patch) | |
tree | 9cb50a7ffbf7017218e4e595f44b684ab190e558 | |
parent | 3f0fa3b32dec4aed3ee3fb95ac7b53cbf4af3091 (diff) |
nvc0: when mapping directly, provide accurate xfer info + start
We were ignoring the incoming box parameters, and were providing totally
bogus stride/layer stride, and other bits, for when a non-full-surface
map was requested.
Signed-off-by: Ilia Mirkin <[email protected]>
Tested-by: Samuel Pitoiset <[email protected]>
Cc: <[email protected]>
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c | 17 |
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; |