diff options
author | Rob Clark <[email protected]> | 2017-04-16 14:52:16 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2017-04-18 16:32:00 -0400 |
commit | df37902e346e0fc8e7db4cecb6f2dbd6aa370adb (patch) | |
tree | 15e3004428932e6160ba4914bf2c9620e74af0ae /src/gallium/drivers/freedreno | |
parent | 71f9e03d211a17e7c53de595966d4c0ed41a97f1 (diff) |
freedreno: add helper to mark all state clean
Note that this involves juggling around a bit when we emit and clear
texture state. So split out from the patch that adds the helper to set
all state dirty.
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r-- | src/gallium/drivers/freedreno/a2xx/fd2_draw.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a2xx/fd2_emit.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a3xx/fd3_draw.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a3xx/fd3_emit.c | 20 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a4xx/fd4_draw.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a4xx/fd4_emit.c | 20 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a5xx/fd5_draw.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a5xx/fd5_emit.c | 28 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_context.h | 6 |
9 files changed, 34 insertions, 52 deletions
diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_draw.c b/src/gallium/drivers/freedreno/a2xx/fd2_draw.c index a824018174a..e47ae9b8afd 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_draw.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_draw.c @@ -116,6 +116,8 @@ fd2_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info) emit_cacheflush(ring); + fd_context_all_clean(ctx); + return true; } diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_emit.c b/src/gallium/drivers/freedreno/a2xx/fd2_emit.c index 5193b896ffc..fe2750ba10b 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_emit.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_emit.c @@ -182,7 +182,7 @@ fd2_emit_vertex_bufs(struct fd_ringbuffer *ring, uint32_t val, } void -fd2_emit_state(struct fd_context *ctx, uint32_t dirty) +fd2_emit_state(struct fd_context *ctx, const uint32_t dirty) { struct fd2_blend_stateobj *blend = fd2_blend_stateobj(ctx->blend); struct fd2_zsa_stateobj *zsa = fd2_zsa_stateobj(ctx->zsa); @@ -311,8 +311,6 @@ fd2_emit_state(struct fd_context *ctx, uint32_t dirty) if (dirty & (FD_DIRTY_VERTTEX | FD_DIRTY_FRAGTEX | FD_DIRTY_PROG)) emit_textures(ring, ctx); - - ctx->dirty &= ~dirty; } /* emit per-context initialization: diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_draw.c b/src/gallium/drivers/freedreno/a3xx/fd3_draw.c index afa2c3c7ef7..c36e5071660 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_draw.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_draw.c @@ -163,6 +163,8 @@ fd3_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info) emit.fp = NULL; draw_impl(ctx, ctx->batch->binning, &emit); + fd_context_all_clean(ctx); + return true; } diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c index 377085e7159..9e9d2d9bc4d 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c @@ -490,7 +490,7 @@ fd3_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring, { const struct ir3_shader_variant *vp = fd3_emit_get_vp(emit); const struct ir3_shader_variant *fp = fd3_emit_get_fp(emit); - uint32_t dirty = emit->dirty; + const uint32_t dirty = emit->dirty; emit_marker(ring, 5); @@ -786,21 +786,11 @@ fd3_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring, if (dirty & (FD_DIRTY_VERTTEX | FD_DIRTY_FRAGTEX)) fd_wfi(ctx->batch, ring); - if (dirty & FD_DIRTY_VERTTEX) { - if (vp->has_samp) - emit_textures(ctx, ring, SB_VERT_TEX, &ctx->tex[PIPE_SHADER_VERTEX]); - else - dirty &= ~FD_DIRTY_VERTTEX; - } - - if (dirty & FD_DIRTY_FRAGTEX) { - if (fp->has_samp) - emit_textures(ctx, ring, SB_FRAG_TEX, &ctx->tex[PIPE_SHADER_FRAGMENT]); - else - dirty &= ~FD_DIRTY_FRAGTEX; - } + if (dirty & FD_DIRTY_VERTTEX) + emit_textures(ctx, ring, SB_VERT_TEX, &ctx->tex[PIPE_SHADER_VERTEX]); - ctx->dirty &= ~dirty; + if (dirty & FD_DIRTY_FRAGTEX) + emit_textures(ctx, ring, SB_FRAG_TEX, &ctx->tex[PIPE_SHADER_FRAGMENT]); } /* emit setup at begin of new cmdstream buffer (don't rely on previous diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_draw.c b/src/gallium/drivers/freedreno/a4xx/fd4_draw.c index c0ada87f83e..869c69b25b3 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_draw.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_draw.c @@ -168,6 +168,8 @@ fd4_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info) emit.fp = NULL; draw_impl(ctx, ctx->batch->binning, &emit); + fd_context_all_clean(ctx); + return true; } diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c index adda4a0460b..997d04a83cf 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c @@ -499,7 +499,7 @@ fd4_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring, { const struct ir3_shader_variant *vp = fd4_emit_get_vp(emit); const struct ir3_shader_variant *fp = fd4_emit_get_fp(emit); - uint32_t dirty = emit->dirty; + const uint32_t dirty = emit->dirty; emit_marker(ring, 5); @@ -740,21 +740,11 @@ fd4_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring, OUT_RING(ring, A4XX_RB_BLEND_ALPHA_F32(bcolor->color[3])); } - if (dirty & FD_DIRTY_VERTTEX) { - if (vp->has_samp) - emit_textures(ctx, ring, SB4_VS_TEX, &ctx->tex[PIPE_SHADER_VERTEX], vp); - else - dirty &= ~FD_DIRTY_VERTTEX; - } - - if (dirty & FD_DIRTY_FRAGTEX) { - if (fp->has_samp) - emit_textures(ctx, ring, SB4_FS_TEX, &ctx->tex[PIPE_SHADER_FRAGMENT], fp); - else - dirty &= ~FD_DIRTY_FRAGTEX; - } + if (dirty & FD_DIRTY_VERTTEX) + emit_textures(ctx, ring, SB4_VS_TEX, &ctx->tex[PIPE_SHADER_VERTEX], vp); - ctx->dirty &= ~dirty; + if (dirty & FD_DIRTY_FRAGTEX) + emit_textures(ctx, ring, SB4_FS_TEX, &ctx->tex[PIPE_SHADER_FRAGMENT], fp); } /* emit setup at begin of new cmdstream buffer (don't rely on previous diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_draw.c b/src/gallium/drivers/freedreno/a5xx/fd5_draw.c index b7417ec92a9..147f7070039 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_draw.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_draw.c @@ -154,6 +154,8 @@ fd5_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info) } } + fd_context_all_clean(ctx); + return true; } diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_emit.c b/src/gallium/drivers/freedreno/a5xx/fd5_emit.c index b3307422ea3..db85573592b 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_emit.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_emit.c @@ -398,7 +398,7 @@ fd5_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring, { const struct ir3_shader_variant *vp = fd5_emit_get_vp(emit); const struct ir3_shader_variant *fp = fd5_emit_get_fp(emit); - uint32_t dirty = emit->dirty; + const uint32_t dirty = emit->dirty; bool needs_border = false; emit_marker5(ring, 5); @@ -648,31 +648,21 @@ fd5_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring, } if (dirty & FD_DIRTY_VERTTEX) { - if (vp->has_samp) { - needs_border |= emit_textures(ctx, ring, SB4_VS_TEX, - &ctx->tex[PIPE_SHADER_VERTEX]); - OUT_PKT4(ring, REG_A5XX_TPL1_VS_TEX_COUNT, 1); - OUT_RING(ring, ctx->tex[PIPE_SHADER_VERTEX].num_textures); - } else { - dirty &= ~FD_DIRTY_VERTTEX; - } + needs_border |= emit_textures(ctx, ring, SB4_VS_TEX, + &ctx->tex[PIPE_SHADER_VERTEX]); + OUT_PKT4(ring, REG_A5XX_TPL1_VS_TEX_COUNT, 1); + OUT_RING(ring, ctx->tex[PIPE_SHADER_VERTEX].num_textures); } if (dirty & FD_DIRTY_FRAGTEX) { - if (fp->has_samp) { - needs_border |= emit_textures(ctx, ring, SB4_FS_TEX, - &ctx->tex[PIPE_SHADER_FRAGMENT]); - OUT_PKT4(ring, REG_A5XX_TPL1_FS_TEX_COUNT, 1); - OUT_RING(ring, ctx->tex[PIPE_SHADER_FRAGMENT].num_textures); - } else { - dirty &= ~FD_DIRTY_FRAGTEX; - } + needs_border |= emit_textures(ctx, ring, SB4_FS_TEX, + &ctx->tex[PIPE_SHADER_FRAGMENT]); + OUT_PKT4(ring, REG_A5XX_TPL1_FS_TEX_COUNT, 1); + OUT_RING(ring, ctx->tex[PIPE_SHADER_FRAGMENT].num_textures); } if (needs_border) emit_border_color(ctx, ring); - - ctx->dirty &= ~dirty; } /* emit setup at begin of new cmdstream buffer (don't rely on previous diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h index 9db34ef8a03..7f47eaf2a71 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.h +++ b/src/gallium/drivers/freedreno/freedreno_context.h @@ -332,6 +332,12 @@ fd_context_all_dirty(struct fd_context *ctx) ctx->dirty = ~0; } +static inline void +fd_context_all_clean(struct fd_context *ctx) +{ + ctx->dirty = 0; +} + static inline struct pipe_scissor_state * fd_context_get_scissor(struct fd_context *ctx) { |