diff options
author | Rob Clark <[email protected]> | 2019-08-02 09:57:08 -0700 |
---|---|---|
committer | Rob Clark <[email protected]> | 2019-08-13 08:11:26 -0700 |
commit | 4b82d1bbb723e77f278d9348e8437cf12811e0ca (patch) | |
tree | 694c1dc7acc7d88a5b5bd79601729cf36baef2cd /src/gallium/drivers/freedreno/a6xx | |
parent | 4a188e421522f10af85e5bb8c42c60666d02e778 (diff) |
freedreno/a6xx: add fd_emit_take_group()
Which takes ownership of the stateobj. Useful for streaming state-
objs, to avoid an extra ref/unref
Worth ~5% at gl_driver2
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/a6xx')
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_emit.c | 25 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_emit.h | 11 |
2 files changed, 17 insertions, 19 deletions
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c index 7b858106910..ef584177d16 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c @@ -602,10 +602,8 @@ fd6_emit_combined_textures(struct fd_ringbuffer *ring, struct fd6_emit *emit, needs_border |= fd6_emit_textures(ctx->pipe, stateobj, type, tex, bcolor_offset, v, ctx); - fd6_emit_add_group(emit, stateobj, s[type].state_id, + fd6_emit_take_group(emit, stateobj, s[type].state_id, s[type].enable_mask); - - fd_ringbuffer_del(stateobj); } } @@ -793,12 +791,10 @@ fd6_emit_state(struct fd_ringbuffer *ring, struct fd6_emit *emit) struct fd_ringbuffer *state; state = build_vbo_state(emit, emit->vs); - fd6_emit_add_group(emit, state, FD6_GROUP_VBO, 0x6); - fd_ringbuffer_del(state); + fd6_emit_take_group(emit, state, FD6_GROUP_VBO, 0x6); state = build_vbo_state(emit, emit->bs); - fd6_emit_add_group(emit, state, FD6_GROUP_VBO_BINNING, 0x1); - fd_ringbuffer_del(state); + fd6_emit_take_group(emit, state, FD6_GROUP_VBO_BINNING, 0x1); } if (dirty & FD_DIRTY_ZSA) { @@ -814,12 +810,10 @@ fd6_emit_state(struct fd_ringbuffer *ring, struct fd6_emit *emit) struct fd_ringbuffer *state; state = build_lrz(emit, false); - fd6_emit_add_group(emit, state, FD6_GROUP_LRZ, 0x6); - fd_ringbuffer_del(state); + fd6_emit_take_group(emit, state, FD6_GROUP_LRZ, 0x6); state = build_lrz(emit, true); - fd6_emit_add_group(emit, state, FD6_GROUP_LRZ_BINNING, 0x1); - fd_ringbuffer_del(state); + fd6_emit_take_group(emit, state, FD6_GROUP_LRZ_BINNING, 0x1); } if (dirty & FD_DIRTY_STENCIL_REF) { @@ -946,8 +940,7 @@ fd6_emit_state(struct fd_ringbuffer *ring, struct fd6_emit *emit) if (ir3_needs_vs_driver_params(vp)) ir3_emit_vs_driver_params(vp, vsconstobj, ctx, emit->info); - fd6_emit_add_group(emit, vsconstobj, FD6_GROUP_VS_CONST, 0x7); - fd_ringbuffer_del(vsconstobj); + fd6_emit_take_group(emit, vsconstobj, FD6_GROUP_VS_CONST, 0x7); } if (ctx->dirty_shader[PIPE_SHADER_FRAGMENT] & DIRTY_CONST) { @@ -963,8 +956,7 @@ fd6_emit_state(struct fd_ringbuffer *ring, struct fd6_emit *emit) ir3_emit_image_dims(ctx->screen, fp, fsconstobj, &ctx->shaderimg[PIPE_SHADER_FRAGMENT]); - fd6_emit_add_group(emit, fsconstobj, FD6_GROUP_FS_CONST, 0x6); - fd_ringbuffer_del(fsconstobj); + fd6_emit_take_group(emit, fsconstobj, FD6_GROUP_FS_CONST, 0x6); } struct ir3_stream_output_info *info = &vp->shader->stream_output; @@ -1057,8 +1049,7 @@ fd6_emit_state(struct fd_ringbuffer *ring, struct fd6_emit *emit) OUT_PKT4(obj, REG_A6XX_SP_IBO_COUNT, 1); OUT_RING(obj, mapping->num_ibo); - fd6_emit_add_group(emit, obj, FD6_GROUP_IBO, 0x6); - fd_ringbuffer_del(obj); + fd6_emit_take_group(emit, obj, FD6_GROUP_IBO, 0x6); fd_ringbuffer_del(state); } diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.h b/src/gallium/drivers/freedreno/a6xx/fd6_emit.h index e46091a49bc..2ffb76c3900 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.h +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.h @@ -113,16 +113,23 @@ fd6_emit_get_prog(struct fd6_emit *emit) } static inline void -fd6_emit_add_group(struct fd6_emit *emit, struct fd_ringbuffer *stateobj, +fd6_emit_take_group(struct fd6_emit *emit, struct fd_ringbuffer *stateobj, enum fd6_state_id group_id, unsigned enable_mask) { debug_assert(emit->num_groups < ARRAY_SIZE(emit->groups)); struct fd6_state_group *g = &emit->groups[emit->num_groups++]; - g->stateobj = fd_ringbuffer_ref(stateobj); + g->stateobj = stateobj; g->group_id = group_id; g->enable_mask = enable_mask; } +static inline void +fd6_emit_add_group(struct fd6_emit *emit, struct fd_ringbuffer *stateobj, + enum fd6_state_id group_id, unsigned enable_mask) +{ + fd6_emit_take_group(emit, fd_ringbuffer_ref(stateobj), group_id, enable_mask); +} + static inline unsigned fd6_event_write(struct fd_batch *batch, struct fd_ringbuffer *ring, enum vgt_event_type evt, bool timestamp) |