freedreno: fix multi-layer transfer_map's
authorRob Clark <robclark@freedesktop.org>
Wed, 11 May 2016 15:28:13 +0000 (11:28 -0400)
committerRob Clark <robclark@freedesktop.org>
Wed, 11 May 2016 16:03:21 +0000 (12:03 -0400)
The use of transfer_inline_write() in TexSubImage path (see fb9fe352ea4)
exposed a bug for "layer_first" resources (ie. a4xx) not setting correct
layer_stride.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/freedreno_resource.c

index 44558185a6b0a8cc259e874bcf26cff3519dbb8c..ded814743314c78a837a1694f3aa886f8b824b49 100644 (file)
@@ -299,7 +299,7 @@ fd_resource_transfer_map(struct pipe_context *pctx,
        ptrans->usage = usage;
        ptrans->box = *box;
        ptrans->stride = util_format_get_nblocksx(format, slice->pitch) * rsc->cpp;
-       ptrans->layer_stride = slice->size0;
+       ptrans->layer_stride = rsc->layer_first ? rsc->layer_size : slice->size0;
 
        if (usage & PIPE_TRANSFER_READ)
                op |= DRM_FREEDRENO_PREP_READ;