freedreno/a6xx: move framebuffer state emit to emit_mrt()
authorRob Clark <robdclark@gmail.com>
Fri, 12 Oct 2018 18:47:13 +0000 (14:47 -0400)
committerRob Clark <robdclark@gmail.com>
Wed, 17 Oct 2018 16:44:48 +0000 (12:44 -0400)
No point in checking this per-draw, since framebuffer change means new
batch.

Signed-off-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/a6xx/fd6_emit.c
src/gallium/drivers/freedreno/a6xx/fd6_gmem.c

index d2c9878e5001f742ebe97bead87f9bf409388743..1591c202580d655197b56309752d31e5db4eec2f 100644 (file)
@@ -596,35 +596,6 @@ fd6_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring,
 
        emit_marker6(ring, 5);
 
-       if ((dirty & FD_DIRTY_FRAMEBUFFER) && !emit->binning_pass) {
-               unsigned char mrt_comp[A6XX_MAX_RENDER_TARGETS] = {0};
-
-               for (unsigned i = 0; i < pfb->nr_cbufs; i++) {
-                       mrt_comp[i] = ((i < pfb->nr_cbufs) && pfb->cbufs[i]) ? 0xf : 0;
-               }
-
-               OUT_PKT4(ring, REG_A6XX_RB_RENDER_COMPONENTS, 1);
-               OUT_RING(ring, A6XX_RB_RENDER_COMPONENTS_RT0(mrt_comp[0]) |
-                               A6XX_RB_RENDER_COMPONENTS_RT1(mrt_comp[1]) |
-                               A6XX_RB_RENDER_COMPONENTS_RT2(mrt_comp[2]) |
-                               A6XX_RB_RENDER_COMPONENTS_RT3(mrt_comp[3]) |
-                               A6XX_RB_RENDER_COMPONENTS_RT4(mrt_comp[4]) |
-                               A6XX_RB_RENDER_COMPONENTS_RT5(mrt_comp[5]) |
-                               A6XX_RB_RENDER_COMPONENTS_RT6(mrt_comp[6]) |
-                               A6XX_RB_RENDER_COMPONENTS_RT7(mrt_comp[7]));
-
-               OUT_PKT4(ring, REG_A6XX_SP_FS_RENDER_COMPONENTS, 1);
-               OUT_RING(ring,
-                                A6XX_SP_FS_RENDER_COMPONENTS_RT0(mrt_comp[0]) |
-                                A6XX_SP_FS_RENDER_COMPONENTS_RT1(mrt_comp[1]) |
-                                A6XX_SP_FS_RENDER_COMPONENTS_RT2(mrt_comp[2]) |
-                                A6XX_SP_FS_RENDER_COMPONENTS_RT3(mrt_comp[3]) |
-                                A6XX_SP_FS_RENDER_COMPONENTS_RT4(mrt_comp[4]) |
-                                A6XX_SP_FS_RENDER_COMPONENTS_RT5(mrt_comp[5]) |
-                                A6XX_SP_FS_RENDER_COMPONENTS_RT6(mrt_comp[6]) |
-                                A6XX_SP_FS_RENDER_COMPONENTS_RT7(mrt_comp[7]));
-       }
-
        if (dirty & FD_DIRTY_ZSA) {
                struct fd6_zsa_stateobj *zsa = fd6_zsa_stateobj(ctx->zsa);
                uint32_t rb_alpha_control = zsa->rb_alpha_control;
index 40c76f9314dc9ca158cdbee2a31d43ad849d590b..279f02ba54912df02809badafff3231f29a3e376 100644 (file)
@@ -52,6 +52,7 @@ static void
 emit_mrt(struct fd_ringbuffer *ring, struct pipe_framebuffer_state *pfb,
                struct fd_gmem_stateobj *gmem)
 {
+       unsigned char mrt_comp[A6XX_MAX_RENDER_TARGETS] = {0};
        unsigned srgb_cntl = 0;
        unsigned i;
 
@@ -67,6 +68,8 @@ emit_mrt(struct fd_ringbuffer *ring, struct pipe_framebuffer_state *pfb,
                if (!pfb->cbufs[i])
                        continue;
 
+               mrt_comp[i] = 0xf;
+
                struct pipe_surface *psurf = pfb->cbufs[i];
                enum pipe_format pformat = psurf->format;
                rsc = fd_resource(psurf->texture);
@@ -121,6 +124,27 @@ emit_mrt(struct fd_ringbuffer *ring, struct pipe_framebuffer_state *pfb,
 
        OUT_PKT4(ring, REG_A6XX_SP_SRGB_CNTL, 1);
        OUT_RING(ring, srgb_cntl);
+
+       OUT_PKT4(ring, REG_A6XX_RB_RENDER_COMPONENTS, 1);
+       OUT_RING(ring, A6XX_RB_RENDER_COMPONENTS_RT0(mrt_comp[0]) |
+                       A6XX_RB_RENDER_COMPONENTS_RT1(mrt_comp[1]) |
+                       A6XX_RB_RENDER_COMPONENTS_RT2(mrt_comp[2]) |
+                       A6XX_RB_RENDER_COMPONENTS_RT3(mrt_comp[3]) |
+                       A6XX_RB_RENDER_COMPONENTS_RT4(mrt_comp[4]) |
+                       A6XX_RB_RENDER_COMPONENTS_RT5(mrt_comp[5]) |
+                       A6XX_RB_RENDER_COMPONENTS_RT6(mrt_comp[6]) |
+                       A6XX_RB_RENDER_COMPONENTS_RT7(mrt_comp[7]));
+
+       OUT_PKT4(ring, REG_A6XX_SP_FS_RENDER_COMPONENTS, 1);
+       OUT_RING(ring,
+                       A6XX_SP_FS_RENDER_COMPONENTS_RT0(mrt_comp[0]) |
+                       A6XX_SP_FS_RENDER_COMPONENTS_RT1(mrt_comp[1]) |
+                       A6XX_SP_FS_RENDER_COMPONENTS_RT2(mrt_comp[2]) |
+                       A6XX_SP_FS_RENDER_COMPONENTS_RT3(mrt_comp[3]) |
+                       A6XX_SP_FS_RENDER_COMPONENTS_RT4(mrt_comp[4]) |
+                       A6XX_SP_FS_RENDER_COMPONENTS_RT5(mrt_comp[5]) |
+                       A6XX_SP_FS_RENDER_COMPONENTS_RT6(mrt_comp[6]) |
+                       A6XX_SP_FS_RENDER_COMPONENTS_RT7(mrt_comp[7]));
 }
 
 static void