From: Chia-I Wu Date: Tue, 11 Nov 2014 03:21:01 +0000 (+0800) Subject: ilo: add 3DSTATE_SO_BUFFER variants X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c637075ea29811194d12611ec79b3ba4858d1e37;p=mesa.git ilo: add 3DSTATE_SO_BUFFER variants Add gen7_disable_3DSTATE_SO_BUFFER() to disable SO buffers. Signed-off-by: Chia-I Wu --- diff --git a/src/gallium/drivers/ilo/ilo_builder_3d_top.h b/src/gallium/drivers/ilo/ilo_builder_3d_top.h index 8f2a25a6a49..5f758a1ccbd 100644 --- a/src/gallium/drivers/ilo/ilo_builder_3d_top.h +++ b/src/gallium/drivers/ilo/ilo_builder_3d_top.h @@ -956,52 +956,55 @@ gen7_3DSTATE_SO_DECL_LIST(struct ilo_builder *builder, } static inline void -gen7_3DSTATE_SO_BUFFER(struct ilo_builder *builder, - int index, int base, int stride, +gen7_3DSTATE_SO_BUFFER(struct ilo_builder *builder, int index, int stride, const struct pipe_stream_output_target *so_target) { const uint8_t cmd_len = 4; - const uint32_t dw0 = GEN7_RENDER_CMD(3D, 3DSTATE_SO_BUFFER) | - (cmd_len - 2); struct ilo_buffer *buf; - int end; + int start, end; uint32_t *dw; unsigned pos; ILO_DEV_ASSERT(builder->dev, 7, 7.5); - if (!so_target || !so_target->buffer) { - ilo_builder_batch_pointer(builder, cmd_len, &dw); - dw[0] = dw0; - dw[1] = index << GEN7_SO_BUF_DW1_INDEX__SHIFT; - dw[2] = 0; - dw[3] = 0; - - return; - } - buf = ilo_buffer(so_target->buffer); /* DWord-aligned */ - assert(stride % 4 == 0 && base % 4 == 0); + assert(stride % 4 == 0); assert(so_target->buffer_offset % 4 == 0); stride &= ~3; - base = (base + so_target->buffer_offset) & ~3; - end = (base + so_target->buffer_size) & ~3; + start = so_target->buffer_offset & ~3; + end = (start + so_target->buffer_size) & ~3; pos = ilo_builder_batch_pointer(builder, cmd_len, &dw); - dw[0] = dw0; + dw[0] = GEN7_RENDER_CMD(3D, 3DSTATE_SO_BUFFER) | (cmd_len - 2); dw[1] = index << GEN7_SO_BUF_DW1_INDEX__SHIFT | stride; ilo_builder_batch_reloc(builder, pos + 2, - buf->bo, base, INTEL_RELOC_WRITE); + buf->bo, start, INTEL_RELOC_WRITE); ilo_builder_batch_reloc(builder, pos + 3, buf->bo, end, INTEL_RELOC_WRITE); } +static inline void +gen7_disable_3DSTATE_SO_BUFFER(struct ilo_builder *builder, int index) +{ + const uint8_t cmd_len = 4; + uint32_t *dw; + + ILO_DEV_ASSERT(builder->dev, 7, 7.5); + + ilo_builder_batch_pointer(builder, cmd_len, &dw); + + dw[0] = GEN7_RENDER_CMD(3D, 3DSTATE_SO_BUFFER) | (cmd_len - 2); + dw[1] = index << GEN7_SO_BUF_DW1_INDEX__SHIFT; + dw[2] = 0; + dw[3] = 0; +} + static inline void gen6_3DSTATE_BINDING_TABLE_POINTERS(struct ilo_builder *builder, uint32_t vs_binding_table, diff --git a/src/gallium/drivers/ilo/ilo_render_gen7.c b/src/gallium/drivers/ilo/ilo_render_gen7.c index 8830db4e852..2051f1254bb 100644 --- a/src/gallium/drivers/ilo/ilo_render_gen7.c +++ b/src/gallium/drivers/ilo/ilo_render_gen7.c @@ -458,14 +458,12 @@ gen7_draw_sol(struct ilo_render *r, for (i = 0; i < vec->so.count; i++) { const int stride = so_info->stride[i] * 4; /* in bytes */ - int base = 0; - gen7_3DSTATE_SO_BUFFER(r->builder, i, base, stride, - vec->so.states[i]); + gen7_3DSTATE_SO_BUFFER(r->builder, i, stride, vec->so.states[i]); } for (; i < 4; i++) - gen7_3DSTATE_SO_BUFFER(r->builder, i, 0, 0, NULL); + gen7_disable_3DSTATE_SO_BUFFER(r->builder, i); } /* 3DSTATE_SO_DECL_LIST */