freedreno/a5xx: Emit MSAA state for sysmem rendering, too.
authorEmma Anholt <emma@anholt.net>
Thu, 18 Nov 2021 03:28:52 +0000 (19:28 -0800)
committerMarge Bot <emma+marge@anholt.net>
Fri, 19 Nov 2021 17:24:11 +0000 (17:24 +0000)
This looked obviously wrong, we want to set the sample counts for sysmem
too just like we do on 6xx.  Turns out it fixes some piglits.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13867>

src/freedreno/ci/freedreno-a530-fails.txt
src/gallium/drivers/freedreno/a5xx/fd5_gmem.c

index a2cceb4..e4432f0 100644 (file)
@@ -303,10 +303,6 @@ spec@arb_depth_buffer_float@fbo-stencil-gl_depth32f_stencil8-copypixels,Fail
 spec@arb_direct_state_access@gettextureimage-formats,Crash
 spec@arb_draw_indirect@gl_vertexid used with gldrawarraysindirect,Fail
 spec@arb_draw_indirect@gl_vertexid used with gldrawelementsindirect,Fail
-spec@arb_framebuffer_no_attachments@arb_framebuffer_no_attachments-atomic,Fail
-spec@arb_framebuffer_no_attachments@arb_framebuffer_no_attachments-atomic@MS4,Fail
-spec@arb_framebuffer_no_attachments@arb_framebuffer_no_attachments-query,Fail
-spec@arb_framebuffer_no_attachments@arb_framebuffer_no_attachments-query@MS4,Fail
 spec@arb_framebuffer_object@arb_framebuffer_object-depth-stencil-blit depth_stencil gl_depth24_stencil8,Fail
 spec@arb_framebuffer_object@arb_framebuffer_object-depth-stencil-blit depth_stencil gl_depth32f_stencil8,Fail
 spec@arb_framebuffer_object@arb_framebuffer_object-depth-stencil-blit stencil gl_depth24_stencil8,Fail
index 851c323..48e148b 100644 (file)
@@ -234,6 +234,30 @@ emit_zs(struct fd_ringbuffer *ring, struct pipe_surface *zsbuf,
    }
 }
 
+static void
+emit_msaa(struct fd_ringbuffer *ring, uint32_t nr_samples)
+{
+   enum a3xx_msaa_samples samples = fd_msaa_samples(nr_samples);
+
+   OUT_PKT4(ring, REG_A5XX_TPL1_TP_RAS_MSAA_CNTL, 2);
+   OUT_RING(ring, A5XX_TPL1_TP_RAS_MSAA_CNTL_SAMPLES(samples));
+   OUT_RING(ring, A5XX_TPL1_TP_DEST_MSAA_CNTL_SAMPLES(samples) |
+                     COND(samples == MSAA_ONE,
+                          A5XX_TPL1_TP_DEST_MSAA_CNTL_MSAA_DISABLE));
+
+   OUT_PKT4(ring, REG_A5XX_RB_RAS_MSAA_CNTL, 2);
+   OUT_RING(ring, A5XX_RB_RAS_MSAA_CNTL_SAMPLES(samples));
+   OUT_RING(ring,
+            A5XX_RB_DEST_MSAA_CNTL_SAMPLES(samples) |
+               COND(samples == MSAA_ONE, A5XX_RB_DEST_MSAA_CNTL_MSAA_DISABLE));
+
+   OUT_PKT4(ring, REG_A5XX_GRAS_SC_RAS_MSAA_CNTL, 2);
+   OUT_RING(ring, A5XX_GRAS_SC_RAS_MSAA_CNTL_SAMPLES(samples));
+   OUT_RING(ring, A5XX_GRAS_SC_DEST_MSAA_CNTL_SAMPLES(samples) |
+                     COND(samples == MSAA_ONE,
+                          A5XX_GRAS_SC_DEST_MSAA_CNTL_MSAA_DISABLE));
+}
+
 static bool
 use_hw_binning(struct fd_batch *batch)
 {
@@ -584,26 +608,7 @@ fd5_emit_tile_renderprep(struct fd_batch *batch, const struct fd_tile *tile)
 
    emit_zs(ring, pfb->zsbuf, gmem);
    emit_mrt(ring, pfb->nr_cbufs, pfb->cbufs, gmem);
-
-   enum a3xx_msaa_samples samples = fd_msaa_samples(pfb->samples);
-
-   OUT_PKT4(ring, REG_A5XX_TPL1_TP_RAS_MSAA_CNTL, 2);
-   OUT_RING(ring, A5XX_TPL1_TP_RAS_MSAA_CNTL_SAMPLES(samples));
-   OUT_RING(ring, A5XX_TPL1_TP_DEST_MSAA_CNTL_SAMPLES(samples) |
-                     COND(samples == MSAA_ONE,
-                          A5XX_TPL1_TP_DEST_MSAA_CNTL_MSAA_DISABLE));
-
-   OUT_PKT4(ring, REG_A5XX_RB_RAS_MSAA_CNTL, 2);
-   OUT_RING(ring, A5XX_RB_RAS_MSAA_CNTL_SAMPLES(samples));
-   OUT_RING(ring,
-            A5XX_RB_DEST_MSAA_CNTL_SAMPLES(samples) |
-               COND(samples == MSAA_ONE, A5XX_RB_DEST_MSAA_CNTL_MSAA_DISABLE));
-
-   OUT_PKT4(ring, REG_A5XX_GRAS_SC_RAS_MSAA_CNTL, 2);
-   OUT_RING(ring, A5XX_GRAS_SC_RAS_MSAA_CNTL_SAMPLES(samples));
-   OUT_RING(ring, A5XX_GRAS_SC_DEST_MSAA_CNTL_SAMPLES(samples) |
-                     COND(samples == MSAA_ONE,
-                          A5XX_GRAS_SC_DEST_MSAA_CNTL_MSAA_DISABLE));
+   emit_msaa(ring, pfb->samples);
 }
 
 /*
@@ -762,21 +767,7 @@ fd5_emit_sysmem_prep(struct fd_batch *batch) assert_dt
 
    emit_zs(ring, pfb->zsbuf, NULL);
    emit_mrt(ring, pfb->nr_cbufs, pfb->cbufs, NULL);
-
-   OUT_PKT4(ring, REG_A5XX_TPL1_TP_RAS_MSAA_CNTL, 2);
-   OUT_RING(ring, A5XX_TPL1_TP_RAS_MSAA_CNTL_SAMPLES(MSAA_ONE));
-   OUT_RING(ring, A5XX_TPL1_TP_DEST_MSAA_CNTL_SAMPLES(MSAA_ONE) |
-                     A5XX_TPL1_TP_DEST_MSAA_CNTL_MSAA_DISABLE);
-
-   OUT_PKT4(ring, REG_A5XX_RB_RAS_MSAA_CNTL, 2);
-   OUT_RING(ring, A5XX_RB_RAS_MSAA_CNTL_SAMPLES(MSAA_ONE));
-   OUT_RING(ring, A5XX_RB_DEST_MSAA_CNTL_SAMPLES(MSAA_ONE) |
-                     A5XX_RB_DEST_MSAA_CNTL_MSAA_DISABLE);
-
-   OUT_PKT4(ring, REG_A5XX_GRAS_SC_RAS_MSAA_CNTL, 2);
-   OUT_RING(ring, A5XX_GRAS_SC_RAS_MSAA_CNTL_SAMPLES(MSAA_ONE));
-   OUT_RING(ring, A5XX_GRAS_SC_DEST_MSAA_CNTL_SAMPLES(MSAA_ONE) |
-                     A5XX_GRAS_SC_DEST_MSAA_CNTL_MSAA_DISABLE);
+   emit_msaa(ring, pfb->samples);
 }
 
 static void