From: Rob Clark Date: Sat, 13 Oct 2018 17:24:24 +0000 (-0400) Subject: freedreno/a6xx: move VBO state to stateobj X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b23fc4cacb7ab59805751da3aefec9d958dfdd8d;p=mesa.git freedreno/a6xx: move VBO state to stateobj Signed-off-by: Rob Clark --- diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_draw.c b/src/gallium/drivers/freedreno/a6xx/fd6_draw.c index adb1e4ea1bb..a8701b44f3d 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_draw.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_draw.c @@ -123,10 +123,15 @@ draw_impl(struct fd_context *ctx, struct fd_ringbuffer *ring, const struct pipe_draw_info *info = emit->info; enum pc_di_primtype primtype = ctx->primtypes[info->mode]; - fd6_emit_state(ring, emit); + if (emit->dirty & (FD_DIRTY_VTXBUF | FD_DIRTY_VTXSTATE)) { + struct fd_ringbuffer *state; + + state = fd6_build_vbo_state(emit, emit->vs); + fd6_emit_add_group(emit, state, FD6_GROUP_VBO, 0x7); + fd_ringbuffer_del(state); + } - if (emit->dirty & (FD_DIRTY_VTXBUF | FD_DIRTY_VTXSTATE)) - fd6_emit_vertex_bufs(ring, emit); + fd6_emit_state(ring, emit); OUT_PKT4(ring, REG_A6XX_VFD_INDEX_OFFSET, 2); OUT_RING(ring, info->index_size ? info->index_bias : info->start); /* VFD_INDEX_OFFSET */ diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c index 353fa5c9f66..b164d8bc2da 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c @@ -528,12 +528,15 @@ emit_ssbos(struct fd_context *ctx, struct fd_ringbuffer *ring, } } -void -fd6_emit_vertex_bufs(struct fd_ringbuffer *ring, struct fd6_emit *emit) +struct fd_ringbuffer * +fd6_build_vbo_state(struct fd6_emit *emit, const struct ir3_shader_variant *vp) { - int32_t i, j; const struct fd_vertex_state *vtx = emit->vtx; - const struct ir3_shader_variant *vp = emit->vs; + int32_t i, j; + + struct fd_ringbuffer *ring = + fd_ringbuffer_new_flags(emit->ctx->pipe, 4 * (10 * vp->inputs_count + 2), + FD_RINGBUFFER_OBJECT | FD_RINGBUFFER_STREAMING); for (i = 0, j = 0; i <= vp->inputs_count; i++) { if (vp->inputs[i].sysval) @@ -581,6 +584,8 @@ fd6_emit_vertex_bufs(struct fd_ringbuffer *ring, struct fd6_emit *emit) OUT_PKT4(ring, REG_A6XX_VFD_CONTROL_0, 1); OUT_RING(ring, A6XX_VFD_CONTROL_0_VTXCNT(j) | (j << 8)); + + return ring; } static struct fd_ringbuffer * diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.h b/src/gallium/drivers/freedreno/a6xx/fd6_emit.h index 450cb5e8734..83d0ede82ff 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.h +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.h @@ -46,6 +46,7 @@ enum fd6_state_id { FD6_GROUP_PROG, FD6_GROUP_ZSA, FD6_GROUP_ZSA_BINNING, + FD6_GROUP_VBO, FD6_GROUP_VS_CONST, FD6_GROUP_FS_CONST, FD6_GROUP_VS_TEX, @@ -171,7 +172,7 @@ bool fd6_emit_textures(struct fd_pipe *pipe, struct fd_ringbuffer *ring, enum a6xx_state_block sb, struct fd_texture_stateobj *tex, unsigned bcolor_offset); -void fd6_emit_vertex_bufs(struct fd_ringbuffer *ring, struct fd6_emit *emit); +struct fd_ringbuffer * fd6_build_vbo_state(struct fd6_emit *emit, const struct ir3_shader_variant *vp); void fd6_emit_state(struct fd_ringbuffer *ring, struct fd6_emit *emit);