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 <robdclark@gmail.com>
This commit is contained in:
Rob Clark 2017-04-16 14:52:16 -04:00
parent 71f9e03d21
commit df37902e34
9 changed files with 34 additions and 52 deletions

View file

@ -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;
}

View file

@ -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:

View file

@ -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;
}

View file

@ -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_VERTTEX)
emit_textures(ctx, ring, SB_VERT_TEX, &ctx->tex[PIPE_SHADER_VERTEX]);
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;
}
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

View file

@ -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;
}

View file

@ -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_VERTTEX)
emit_textures(ctx, ring, SB4_VS_TEX, &ctx->tex[PIPE_SHADER_VERTEX], vp);
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;
}
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

View file

@ -154,6 +154,8 @@ fd5_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info)
}
}
fd_context_all_clean(ctx);
return true;
}

View file

@ -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

View file

@ -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)
{