From: Ilia Mirkin Date: Fri, 24 Jun 2016 02:33:59 +0000 (-0400) Subject: nvc0: when mapping directly, provide accurate xfer info + start X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b433cb51e50cab878cbaa023662bacd1f923a183;p=mesa.git 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 Tested-by: Samuel Pitoiset Cc: --- 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;