diff options
author | Chia-I Wu <[email protected]> | 2014-11-11 10:35:24 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2014-11-11 13:52:22 +0800 |
commit | 421b565b3bdc1b8646c32f4292f180a86bad952b (patch) | |
tree | 638896145b2ae3347c43bf39d7b92db6fef80e14 /src | |
parent | 63ded78e1cc1748bd5e74fcb4bcead6d58093668 (diff) |
ilo: add variants of 3DSTATE_GS
Add gen6_so_3DSTATE_GS(), gen6_disable_3DSTATE_GS(), and
gen7_disable_3DSTATE_GS() to do SO on GEN6 or to disable GS.
Signed-off-by: Chia-I Wu <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/ilo/ilo_builder_3d_top.h | 145 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_render_gen6.c | 14 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_render_gen7.c | 4 |
3 files changed, 100 insertions, 63 deletions
diff --git a/src/gallium/drivers/ilo/ilo_builder_3d_top.h b/src/gallium/drivers/ilo/ilo_builder_3d_top.h index 9794e92393e..d440e980b43 100644 --- a/src/gallium/drivers/ilo/ilo_builder_3d_top.h +++ b/src/gallium/drivers/ilo/ilo_builder_3d_top.h @@ -649,64 +649,69 @@ gen7_3DSTATE_DS(struct ilo_builder *builder, static inline void gen6_3DSTATE_GS(struct ilo_builder *builder, - const struct ilo_shader_state *gs, - const struct ilo_shader_state *vs, - int verts_per_prim) + const struct ilo_shader_state *gs) { const uint8_t cmd_len = 7; - uint32_t dw1, dw2, dw4, dw5, dw6, *dw; + const struct ilo_shader_cso *cso; + uint32_t dw2, dw4, dw5, dw6, *dw; ILO_DEV_ASSERT(builder->dev, 6, 6); - if (gs) { - const struct ilo_shader_cso *cso; + cso = ilo_shader_get_kernel_cso(gs); + dw2 = cso->payload[0]; + dw4 = cso->payload[1]; + dw5 = cso->payload[2]; + dw6 = cso->payload[3]; - dw1 = ilo_shader_get_kernel_offset(gs); + ilo_builder_batch_pointer(builder, cmd_len, &dw); - cso = ilo_shader_get_kernel_cso(gs); - dw2 = cso->payload[0]; - dw4 = cso->payload[1]; - dw5 = cso->payload[2]; - dw6 = cso->payload[3]; - } - else if (vs && ilo_shader_get_kernel_param(vs, ILO_KERNEL_VS_GEN6_SO)) { - struct ilo_shader_cso cso; - enum ilo_kernel_param param; + dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_GS) | (cmd_len - 2); + dw[1] = ilo_shader_get_kernel_offset(gs); + dw[2] = dw2; + dw[3] = 0; /* scratch */ + dw[4] = dw4; + dw[5] = dw5; + dw[6] = dw6; +} - switch (verts_per_prim) { - case 1: - param = ILO_KERNEL_VS_GEN6_SO_POINT_OFFSET; - break; - case 2: - param = ILO_KERNEL_VS_GEN6_SO_LINE_OFFSET; - break; - default: - param = ILO_KERNEL_VS_GEN6_SO_TRI_OFFSET; - break; - } +static inline void +gen6_so_3DSTATE_GS(struct ilo_builder *builder, + const struct ilo_shader_state *vs, + int verts_per_prim) +{ + const uint8_t cmd_len = 7; + struct ilo_shader_cso cso; + enum ilo_kernel_param param; + uint32_t dw2, dw4, dw5, dw6, *dw; + + ILO_DEV_ASSERT(builder->dev, 6, 6); - dw1 = ilo_shader_get_kernel_offset(vs) + - ilo_shader_get_kernel_param(vs, param); + assert(ilo_shader_get_kernel_param(vs, ILO_KERNEL_VS_GEN6_SO)); - /* cannot use VS's CSO */ - ilo_gpe_init_gs_cso(builder->dev, vs, &cso); - dw2 = cso.payload[0]; - dw4 = cso.payload[1]; - dw5 = cso.payload[2]; - dw6 = cso.payload[3]; - } - else { - dw1 = 0; - dw2 = 0; - dw4 = 1 << GEN6_GS_DW4_URB_READ_LEN__SHIFT; - dw5 = GEN6_GS_DW5_STATISTICS; - dw6 = 0; + switch (verts_per_prim) { + case 1: + param = ILO_KERNEL_VS_GEN6_SO_POINT_OFFSET; + break; + case 2: + param = ILO_KERNEL_VS_GEN6_SO_LINE_OFFSET; + break; + default: + param = ILO_KERNEL_VS_GEN6_SO_TRI_OFFSET; + break; } + /* cannot use VS's CSO */ + ilo_gpe_init_gs_cso(builder->dev, vs, &cso); + dw2 = cso.payload[0]; + dw4 = cso.payload[1]; + dw5 = cso.payload[2]; + dw6 = cso.payload[3]; + ilo_builder_batch_pointer(builder, cmd_len, &dw); dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_GS) | (cmd_len - 2); - dw[1] = dw1; + dw[1] = ilo_shader_get_kernel_offset(vs) + + ilo_shader_get_kernel_param(vs, param); dw[2] = dw2; dw[3] = 0; dw[4] = dw4; @@ -715,6 +720,26 @@ gen6_3DSTATE_GS(struct ilo_builder *builder, } static inline void +gen6_disable_3DSTATE_GS(struct ilo_builder *builder) +{ + const uint8_t cmd_len = 7; + uint32_t *dw; + + ILO_DEV_ASSERT(builder->dev, 6, 6); + + ilo_builder_batch_pointer(builder, cmd_len, &dw); + + dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_GS) | (cmd_len - 2); + dw[1] = 0; + dw[2] = 0; + dw[3] = 0; + /* honor the valid range of URB read length */ + dw[4] = 1 << GEN6_GS_DW4_URB_READ_LEN__SHIFT; + dw[5] = GEN6_GS_DW5_STATISTICS; + dw[6] = 0; +} + +static inline void gen6_3DSTATE_GS_SVB_INDEX(struct ilo_builder *builder, int index, unsigned svbi, unsigned max_svbi, @@ -743,24 +768,11 @@ gen7_3DSTATE_GS(struct ilo_builder *builder, const struct ilo_shader_state *gs) { const uint8_t cmd_len = 7; - const uint32_t dw0 = GEN6_RENDER_CMD(3D, 3DSTATE_GS) | (cmd_len - 2); const struct ilo_shader_cso *cso; uint32_t dw2, dw4, dw5, *dw; ILO_DEV_ASSERT(builder->dev, 7, 7.5); - if (!gs) { - ilo_builder_batch_pointer(builder, cmd_len, &dw); - dw[0] = dw0; - dw[1] = 0; - dw[2] = 0; - dw[3] = 0; - dw[4] = 0; - dw[5] = GEN7_GS_DW5_STATISTICS; - dw[6] = 0; - return; - } - cso = ilo_shader_get_kernel_cso(gs); dw2 = cso->payload[0]; dw4 = cso->payload[1]; @@ -768,7 +780,7 @@ gen7_3DSTATE_GS(struct ilo_builder *builder, ilo_builder_batch_pointer(builder, cmd_len, &dw); - dw[0] = dw0; + dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_GS) | (cmd_len - 2); dw[1] = ilo_shader_get_kernel_offset(gs); dw[2] = dw2; dw[3] = 0; /* scratch */ @@ -778,6 +790,25 @@ gen7_3DSTATE_GS(struct ilo_builder *builder, } static inline void +gen7_disable_3DSTATE_GS(struct ilo_builder *builder) +{ + const uint8_t cmd_len = 7; + uint32_t *dw; + + ILO_DEV_ASSERT(builder->dev, 7, 7.5); + + ilo_builder_batch_pointer(builder, cmd_len, &dw); + + dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_GS) | (cmd_len - 2); + dw[1] = 0; + dw[2] = 0; + dw[3] = 0; + dw[4] = 0; + dw[5] = GEN7_GS_DW5_STATISTICS; + dw[6] = 0; +} + +static inline void gen7_3DSTATE_STREAMOUT(struct ilo_builder *builder, unsigned buffer_mask, int vertex_attrib_count, diff --git a/src/gallium/drivers/ilo/ilo_render_gen6.c b/src/gallium/drivers/ilo/ilo_render_gen6.c index fcdbd676270..cf37aed057d 100644 --- a/src/gallium/drivers/ilo/ilo_render_gen6.c +++ b/src/gallium/drivers/ilo/ilo_render_gen6.c @@ -534,9 +534,15 @@ gen6_draw_gs(struct ilo_render *r, /* 3DSTATE_GS */ if (DIRTY(GS) || DIRTY(VS) || session->prim_changed || r->instruction_bo_changed) { - const int verts_per_prim = u_vertices_per_prim(session->reduced_prim); - - gen6_3DSTATE_GS(r->builder, vec->gs, vec->vs, verts_per_prim); + if (vec->gs) { + gen6_3DSTATE_GS(r->builder, vec->gs); + } else if (vec->vs && + ilo_shader_get_kernel_param(vec->vs, ILO_KERNEL_VS_GEN6_SO)) { + const int verts_per_prim = u_vertices_per_prim(session->reduced_prim); + gen6_so_3DSTATE_GS(r->builder, vec->vs, verts_per_prim); + } else { + gen6_disable_3DSTATE_GS(r->builder); + } } } @@ -849,7 +855,7 @@ gen6_rectlist_vs_to_sf(struct ilo_render *r, gen6_wa_post_3dstate_constant_vs(r); gen6_3DSTATE_CONSTANT_GS(r->builder, NULL, NULL, 0); - gen6_3DSTATE_GS(r->builder, NULL, NULL, 0); + gen6_disable_3DSTATE_GS(r->builder); gen6_disable_3DSTATE_CLIP(r->builder); gen6_3DSTATE_SF(r->builder, NULL, NULL); diff --git a/src/gallium/drivers/ilo/ilo_render_gen7.c b/src/gallium/drivers/ilo/ilo_render_gen7.c index a8c24434bce..9943ec50336 100644 --- a/src/gallium/drivers/ilo/ilo_render_gen7.c +++ b/src/gallium/drivers/ilo/ilo_render_gen7.c @@ -421,7 +421,7 @@ gen7_draw_gs(struct ilo_render *r, /* 3DSTATE_CONSTANT_GS and 3DSTATE_GS */ if (r->hw_ctx_changed) { gen7_3DSTATE_CONSTANT_GS(r->builder, 0, 0, 0); - gen7_3DSTATE_GS(r->builder, NULL); + gen7_disable_3DSTATE_GS(r->builder); } /* 3DSTATE_BINDING_TABLE_POINTERS_GS */ @@ -732,7 +732,7 @@ gen7_rectlist_vs_to_sf(struct ilo_render *r, gen7_3DSTATE_DS(r->builder, NULL); gen7_3DSTATE_CONSTANT_GS(r->builder, NULL, NULL, 0); - gen7_3DSTATE_GS(r->builder, NULL); + gen7_disable_3DSTATE_GS(r->builder); gen7_3DSTATE_STREAMOUT(r->builder, 0x0, 0, false); |