panfrost: Enable MSAA if we render to such a surface
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 3 Jul 2020 16:04:53 +0000 (12:04 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 7 Jul 2020 01:13:39 +0000 (01:13 +0000)
We hit this case for clears of MSAA surfaces without draws.

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 880a1aaf19ca3f1ce04d1ffa7c30423b1ea6b387..558ba866c56027b3cc3e5e658f6e7ea7210a2872 100644 (file)
@@ -224,6 +224,9 @@ panfrost_mfbd_set_cbuf(
 
         rt->format = panfrost_mfbd_format(surf);
 
+        if (layer_stride)
+                rt->format.flags |= MALI_MFBD_FORMAT_MSAA | MALI_MFBD_FORMAT_LAYERED;
+
         /* Now, we set the layout specific pieces */
 
         if (rsrc->layout == MALI_TEXTURE_LINEAR) {
@@ -521,6 +524,14 @@ panfrost_mfbd_fragment(struct panfrost_batch *batch, bool has_draws)
                 struct pipe_surface *surf = batch->key.cbufs[cb];
 
                 if (surf) {
+                        unsigned nr_samples = surf->nr_samples;
+
+                        if (!nr_samples)
+                                nr_samples = surf->texture->nr_samples;
+
+                        if (nr_samples > 1)
+                                batch->requirements |= PAN_REQ_MSAA;
+
                         panfrost_mfbd_set_cbuf(&rts[cb], surf);
 
                         /* What is this? Looks like some extension of the bpp