From: Rob Clark Date: Fri, 12 Oct 2018 18:47:13 +0000 (-0400) Subject: freedreno/a6xx: move framebuffer state emit to emit_mrt() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2ffc79c7d14e93e1755e8d165294dc4fece3fdaa;p=mesa.git freedreno/a6xx: move framebuffer state emit to emit_mrt() No point in checking this per-draw, since framebuffer change means new batch. Signed-off-by: Rob Clark --- diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c index d2c9878e500..1591c202580 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c @@ -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; diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c index 40c76f9314d..279f02ba549 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c @@ -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