panfrost: Set depth/stencil_layer_stride accordingly
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 3 Jul 2020 16:04:36 +0000 (12:04 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 7 Jul 2020 01:13:39 +0000 (01:13 +0000)
Same logic as colour layer stride, I think.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5782>

src/gallium/drivers/panfrost/pan_mfbd.c

index 6acaf3d3859abe9ab3fb44917f3f8fda975054cf..880a1aaf19ca3f1ce04d1ffa7c30423b1ea6b387 100644 (file)
@@ -312,6 +312,13 @@ panfrost_mfbd_set_zsbuf(
 
                 int stride = rsrc->slices[level].stride;
 
+                unsigned nr_samples = surf->nr_samples;
+
+                if (!nr_samples)
+                        nr_samples = surf->texture->nr_samples;
+
+                unsigned layer_stride = (nr_samples > 1) ? rsrc->slices[level].size0 : 0;
+
                 fb->mfbd_flags |= MALI_MFBD_EXTRA;
                 fbx->flags_hi |= MALI_EXTRA_PRESENT;
                 fbx->flags_lo |= MALI_EXTRA_ZS;
@@ -321,6 +328,7 @@ panfrost_mfbd_set_zsbuf(
                 if (rsrc->layout == MALI_TEXTURE_LINEAR) {
                         fbx->zs_block = MALI_BLOCK_LINEAR;
                         fbx->ds_linear.depth_stride = stride / 16;
+                        fbx->ds_linear.depth_layer_stride = layer_stride;
                 } else {
                         if (is_bifrost) {
                                 fbx->zs_block = MALI_BLOCK_UNKNOWN;
@@ -331,6 +339,7 @@ panfrost_mfbd_set_zsbuf(
                         }
 
                         fbx->ds_linear.depth_stride = stride;
+                        fbx->ds_linear.depth_layer_stride = layer_stride;
                 }
 
                 if (panfrost_is_z24s8_variant(surf->format)) {
@@ -347,9 +356,11 @@ panfrost_mfbd_set_zsbuf(
 
                         struct panfrost_resource *stencil = rsrc->separate_stencil;
                         struct panfrost_slice stencil_slice = stencil->slices[level];
+                        unsigned stencil_layer_stride = (nr_samples > 1) ? stencil_slice.size0 : 0;
 
                         fbx->ds_linear.stencil = panfrost_get_texture_address(stencil, level, first_layer, 0);
                         fbx->ds_linear.stencil_stride = stencil_slice.stride;
+                        fbx->ds_linear.stencil_layer_stride = stencil_layer_stride;
                 }
 
         } else {