panfrost: Set layer_stride for multisampled rendering
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 30 Jun 2020 20:49:52 +0000 (16:49 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 7 Jul 2020 01:13:39 +0000 (01:13 +0000)
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 274fff45aaa1acf7434ac763a8d3e0326f7c6501..6acaf3d3859abe9ab3fb44917f3f8fda975054cf 100644 (file)
@@ -211,6 +211,15 @@ panfrost_mfbd_set_cbuf(
         assert(surf->u.tex.last_layer == first_layer);
         int stride = rsrc->slices[level].stride;
 
+        /* Only set layer_stride for MSAA rendering */
+
+        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;
+
         mali_ptr base = panfrost_get_texture_address(rsrc, level, first_layer, 0);
 
         rt->format = panfrost_mfbd_format(surf);
@@ -226,6 +235,7 @@ panfrost_mfbd_set_cbuf(
 
                 rt->framebuffer = base;
                 rt->framebuffer_stride = stride / 16;
+                rt->layer_stride = layer_stride;
         } else if (rsrc->layout == MALI_TEXTURE_TILED) {
                 if (is_bifrost) {
                         rt->format.unk3 |= 0x8;
@@ -235,12 +245,14 @@ panfrost_mfbd_set_cbuf(
 
                 rt->framebuffer = base;
                 rt->framebuffer_stride = stride;
+                rt->layer_stride = layer_stride;
         } else if (rsrc->layout == MALI_TEXTURE_AFBC) {
                 rt->format.block = MALI_BLOCK_AFBC;
 
                 unsigned header_size = rsrc->slices[level].header_size;
 
                 rt->framebuffer = base + header_size;
+                rt->layer_stride = layer_stride;
                 rt->afbc.metadata = base;
                 rt->afbc.stride = 0;
                 rt->afbc.flags = MALI_AFBC_FLAGS;