From: Alyssa Rosenzweig Date: Fri, 3 Jan 2020 19:15:28 +0000 (-0500) Subject: panfrost: Support rendering to non-zero Z/S layers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ef0084987707e4c37435f19284b58919f6164bea;p=mesa.git panfrost: Support rendering to non-zero Z/S layers Fixes abort in STK's shadow implementation. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Tomeu Vizoso --- diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c b/src/gallium/drivers/panfrost/pan_mfbd.c index 0f2931a58b3..5140f3ba9bb 100644 --- a/src/gallium/drivers/panfrost/pan_mfbd.c +++ b/src/gallium/drivers/panfrost/pan_mfbd.c @@ -235,16 +235,16 @@ panfrost_mfbd_set_zsbuf( struct panfrost_resource *rsrc = pan_resource(surf->texture); unsigned level = surf->u.tex.level; - assert(surf->u.tex.first_layer == 0); + unsigned first_layer = surf->u.tex.first_layer; + assert(surf->u.tex.last_layer == first_layer); - unsigned offset = rsrc->slices[level].offset; + mali_ptr base = panfrost_get_texture_address(rsrc, level, first_layer); if (rsrc->layout == PAN_AFBC) { /* The only Z/S format we can compress is Z24S8 or variants * thereof (handled by the state tracker) */ assert(panfrost_is_z24s8_variant(surf->format)); - mali_ptr base = rsrc->bo->gpu + offset; unsigned header_size = rsrc->slices[level].header_size; fb->mfbd_flags |= MALI_MFBD_EXTRA; @@ -270,7 +270,7 @@ panfrost_mfbd_set_zsbuf( fb->mfbd_flags |= MALI_MFBD_EXTRA; fbx->flags |= MALI_EXTRA_PRESENT | MALI_EXTRA_ZS; - fbx->ds_linear.depth = rsrc->bo->gpu + offset; + fbx->ds_linear.depth = base; fbx->ds_linear.depth_stride = stride; if (panfrost_is_z24s8_variant(surf->format)) { @@ -289,7 +289,7 @@ panfrost_mfbd_set_zsbuf( struct panfrost_resource *stencil = rsrc->separate_stencil; struct panfrost_slice stencil_slice = stencil->slices[level]; - fbx->ds_linear.stencil = stencil->bo->gpu + stencil_slice.offset; + fbx->ds_linear.stencil = panfrost_get_texture_address(stencil, level, first_layer); fbx->ds_linear.stencil_stride = stencil_slice.stride; }