From c4fa24ff0873b7b9a5c4dacbd2c130788e88ad35 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 21 Jun 2013 14:29:08 +0800 Subject: [PATCH] ilo: use ilo_shader_state exclusively in GPE This allows us to remove ilo_shader_internal.h from ilo_gpe_gen7.c. The unfinished code in 3DSTATE_DS, 3DSTATE_HS, and INTERFACE_DESCRIPTOR_DATA are partly or entirely removed. --- src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c | 8 +-- src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c | 12 ++-- src/gallium/drivers/ilo/ilo_gpe_gen6.c | 22 +++---- src/gallium/drivers/ilo/ilo_gpe_gen6.h | 10 +-- src/gallium/drivers/ilo/ilo_gpe_gen7.c | 87 +++++--------------------- src/gallium/drivers/ilo/ilo_gpe_gen7.h | 12 ++-- 6 files changed, 44 insertions(+), 107 deletions(-) diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c index e4bf1d8..771372d 100644 --- a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c +++ b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c @@ -626,12 +626,8 @@ gen6_pipeline_sf(struct ilo_3d_pipeline *p, { /* 3DSTATE_SF */ if (DIRTY(RASTERIZER) || DIRTY(VS) || DIRTY(GS) || DIRTY(FS)) { - const struct ilo_shader *fs = (ilo->fs)? ilo->fs->shader : NULL; - const struct ilo_shader *last_sh = - (ilo->gs)? ilo->gs->shader : - (ilo->vs)? ilo->vs->shader : NULL; - - p->gen6_3DSTATE_SF(p->dev, ilo->rasterizer, fs, last_sh, p->cp); + p->gen6_3DSTATE_SF(p->dev, ilo->rasterizer, ilo->fs, + (ilo->gs) ? ilo->gs : ilo->vs, p->cp); } } diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c index 49f5049..ac1d79b 100644 --- a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c +++ b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c @@ -319,7 +319,7 @@ gen7_pipeline_hs(struct ilo_3d_pipeline *p, /* 3DSTATE_CONSTANT_HS and 3DSTATE_HS */ if (session->hw_ctx_changed) { p->gen7_3DSTATE_CONSTANT_HS(p->dev, 0, 0, 0, p->cp); - p->gen7_3DSTATE_HS(p->dev, NULL, 0, 0, p->cp); + p->gen7_3DSTATE_HS(p->dev, NULL, 0, p->cp); } /* 3DSTATE_BINDING_TABLE_POINTERS_HS */ @@ -345,7 +345,7 @@ gen7_pipeline_ds(struct ilo_3d_pipeline *p, /* 3DSTATE_CONSTANT_DS and 3DSTATE_DS */ if (session->hw_ctx_changed) { p->gen7_3DSTATE_CONSTANT_DS(p->dev, 0, 0, 0, p->cp); - p->gen7_3DSTATE_DS(p->dev, NULL, 0, 0, p->cp); + p->gen7_3DSTATE_DS(p->dev, NULL, 0, p->cp); } /* 3DSTATE_BINDING_TABLE_POINTERS_DS */ @@ -439,12 +439,8 @@ gen7_pipeline_sf(struct ilo_3d_pipeline *p, { /* 3DSTATE_SBE */ if (DIRTY(RASTERIZER) || DIRTY(VS) || DIRTY(GS) || DIRTY(FS)) { - const struct ilo_shader *fs = (ilo->fs)? ilo->fs->shader : NULL; - const struct ilo_shader *last_sh = - (ilo->gs)? ilo->gs->shader : - (ilo->vs)? ilo->vs->shader : NULL; - - p->gen7_3DSTATE_SBE(p->dev, ilo->rasterizer, fs, last_sh, p->cp); + p->gen7_3DSTATE_SBE(p->dev, ilo->rasterizer, ilo->fs, + (ilo->gs) ? ilo->gs : ilo->vs, ilo->cp); } /* 3DSTATE_SF */ diff --git a/src/gallium/drivers/ilo/ilo_gpe_gen6.c b/src/gallium/drivers/ilo/ilo_gpe_gen6.c index 9c7223d..c0ed42d 100644 --- a/src/gallium/drivers/ilo/ilo_gpe_gen6.c +++ b/src/gallium/drivers/ilo/ilo_gpe_gen6.c @@ -1814,10 +1814,12 @@ ilo_gpe_gen6_fill_3dstate_sf_raster(const struct ilo_dev_info *dev, void ilo_gpe_gen6_fill_3dstate_sf_sbe(const struct ilo_dev_info *dev, const struct ilo_rasterizer_state *rasterizer, - const struct ilo_shader *fs, - const struct ilo_shader *last_sh, + const struct ilo_shader_state *fs_state, + const struct ilo_shader_state *last_sh_state, uint32_t *dw, int num_dwords) { + const struct ilo_shader *fs = fs_state->shader; + const struct ilo_shader *last_sh = last_sh_state->shader; uint32_t point_sprite_enable, const_interp_enable; uint16_t attr_ctrl[PIPE_MAX_SHADER_INPUTS]; int vue_offset, vue_len; @@ -2010,8 +2012,8 @@ ilo_gpe_gen6_fill_3dstate_sf_sbe(const struct ilo_dev_info *dev, static void gen6_emit_3DSTATE_SF(const struct ilo_dev_info *dev, const struct ilo_rasterizer_state *rasterizer, - const struct ilo_shader *fs, - const struct ilo_shader *last_sh, + const struct ilo_shader_state *fs, + const struct ilo_shader_state *last_sh, struct ilo_cp *cp) { const uint32_t cmd = ILO_GPE_CMD(0x3, 0x0, 0x13); @@ -3222,7 +3224,7 @@ gen6_emit_3DPRIMITIVE(const struct ilo_dev_info *dev, static uint32_t gen6_emit_INTERFACE_DESCRIPTOR_DATA(const struct ilo_dev_info *dev, - const struct ilo_shader **cs, + const struct ilo_shader_state **cs, uint32_t *sampler_state, int *num_samplers, uint32_t *binding_table_state, @@ -3254,18 +3256,14 @@ gen6_emit_INTERFACE_DESCRIPTOR_DATA(const struct ilo_dev_info *dev, state_len, state_align, &state_offset); for (i = 0; i < num_ids; i++) { - int curbe_read_len; - - curbe_read_len = (cs[i]->pcb.clip_state_size + 31) / 32; - - dw[0] = cs[i]->cache_offset; + dw[0] = ilo_shader_get_kernel_offset(cs[i]); dw[1] = 1 << 18; /* SPF */ dw[2] = sampler_state[i] | (num_samplers[i] + 3) / 4 << 2; dw[3] = binding_table_state[i] | num_surfaces[i]; - dw[4] = curbe_read_len << 16 | /* CURBE Read Length */ - 0; /* CURBE Read Offset */ + dw[4] = 0 << 16 | /* CURBE Read Length */ + 0; /* CURBE Read Offset */ dw[5] = 0; /* Barrier ID */ dw[6] = 0; dw[7] = 0; diff --git a/src/gallium/drivers/ilo/ilo_gpe_gen6.h b/src/gallium/drivers/ilo/ilo_gpe_gen6.h index 511529b..7eba6c1 100644 --- a/src/gallium/drivers/ilo/ilo_gpe_gen6.h +++ b/src/gallium/drivers/ilo/ilo_gpe_gen6.h @@ -257,8 +257,8 @@ typedef void typedef void (*ilo_gpe_gen6_3DSTATE_SF)(const struct ilo_dev_info *dev, const struct ilo_rasterizer_state *rasterizer, - const struct ilo_shader *fs, - const struct ilo_shader *last_sh, + const struct ilo_shader_state *fs, + const struct ilo_shader_state *last_sh, struct ilo_cp *cp); typedef void @@ -367,7 +367,7 @@ typedef void typedef uint32_t (*ilo_gpe_gen6_INTERFACE_DESCRIPTOR_DATA)(const struct ilo_dev_info *dev, - const struct ilo_shader **cs, + const struct ilo_shader_state **cs, uint32_t *sampler_state, int *num_samplers, uint32_t *binding_table_state, @@ -552,8 +552,8 @@ ilo_gpe_gen6_fill_3dstate_sf_raster(const struct ilo_dev_info *dev, void ilo_gpe_gen6_fill_3dstate_sf_sbe(const struct ilo_dev_info *dev, const struct ilo_rasterizer_state *rasterizer, - const struct ilo_shader *fs, - const struct ilo_shader *last_sh, + const struct ilo_shader_state *fs, + const struct ilo_shader_state *last_sh, uint32_t *dw, int num_dwords); #endif /* ILO_GPE_GEN6_H */ diff --git a/src/gallium/drivers/ilo/ilo_gpe_gen7.c b/src/gallium/drivers/ilo/ilo_gpe_gen7.c index 41eb0b3..21764c9 100644 --- a/src/gallium/drivers/ilo/ilo_gpe_gen7.c +++ b/src/gallium/drivers/ilo/ilo_gpe_gen7.c @@ -29,7 +29,6 @@ #include "brw_defines.h" #include "intel_reg.h" -#include "shader/ilo_shader_internal.h" #include "ilo_cp.h" #include "ilo_format.h" #include "ilo_resource.h" @@ -529,51 +528,24 @@ gen7_emit_3DSTATE_CONSTANT_DS(const struct ilo_dev_info *dev, static void gen7_emit_3DSTATE_HS(const struct ilo_dev_info *dev, - const struct ilo_shader *hs, - int max_threads, int num_samplers, + const struct ilo_shader_state *hs, + int num_samplers, struct ilo_cp *cp) { const uint32_t cmd = ILO_GPE_CMD(0x3, 0x0, 0x1b); const uint8_t cmd_len = 7; - uint32_t dw1, dw2, dw5; ILO_GPE_VALID_GEN(dev, 7, 7); - if (!hs) { - ilo_cp_begin(cp, cmd_len); - ilo_cp_write(cp, cmd | (cmd_len - 2)); - ilo_cp_write(cp, 0); - ilo_cp_write(cp, 0); - ilo_cp_write(cp, 0); - ilo_cp_write(cp, 0); - ilo_cp_write(cp, 0); - ilo_cp_write(cp, 0); - ilo_cp_end(cp); - - return; - } - - dw1 = (num_samplers + 3) / 4 << 27 | - 0 << 18 | - (max_threads - 1); - if (false) - dw1 |= 1 << 16; - - dw2 = 1 << 31 | /* HS Enable */ - 1 << 29 | /* HS Statistics Enable */ - 0; /* Instance Count */ - - dw5 = hs->in.start_grf << 19 | - 0 << 11 | - 0 << 4; + assert(!hs); ilo_cp_begin(cp, cmd_len); ilo_cp_write(cp, cmd | (cmd_len - 2)); - ilo_cp_write(cp, dw1); - ilo_cp_write(cp, dw2); - ilo_cp_write(cp, hs->cache_offset); ilo_cp_write(cp, 0); - ilo_cp_write(cp, dw5); + ilo_cp_write(cp, 0); + ilo_cp_write(cp, 0); + ilo_cp_write(cp, 0); + ilo_cp_write(cp, 0); ilo_cp_write(cp, 0); ilo_cp_end(cp); } @@ -597,51 +569,26 @@ gen7_emit_3DSTATE_TE(const struct ilo_dev_info *dev, static void gen7_emit_3DSTATE_DS(const struct ilo_dev_info *dev, - const struct ilo_shader *ds, - int max_threads, int num_samplers, + const struct ilo_shader_state *ds, + int num_samplers, struct ilo_cp *cp) { const uint32_t cmd = ILO_GPE_CMD(0x3, 0x0, 0x1d); const uint8_t cmd_len = 6; - uint32_t dw2, dw4, dw5; ILO_GPE_VALID_GEN(dev, 7, 7); - if (!ds) { - ilo_cp_begin(cp, cmd_len); - ilo_cp_write(cp, cmd | (cmd_len - 2)); - ilo_cp_write(cp, 0); - ilo_cp_write(cp, 0); - ilo_cp_write(cp, 0); - ilo_cp_write(cp, 0); - ilo_cp_write(cp, 0); - ilo_cp_end(cp); - - return; - } - - dw2 = (num_samplers + 3) / 4 << 27 | - 0 << 18 | - (max_threads - 1); - if (false) - dw2 |= 1 << 16; - - dw4 = ds->in.start_grf << 20 | - 0 << 11 | - 0 << 4; - - dw5 = (max_threads - 1) << 25 | - 1 << 10 | - 1; + assert(!ds); ilo_cp_begin(cp, cmd_len); ilo_cp_write(cp, cmd | (cmd_len - 2)); - ilo_cp_write(cp, ds->cache_offset); - ilo_cp_write(cp, dw2); ilo_cp_write(cp, 0); - ilo_cp_write(cp, dw4); - ilo_cp_write(cp, dw5); + ilo_cp_write(cp, 0); + ilo_cp_write(cp, 0); + ilo_cp_write(cp, 0); + ilo_cp_write(cp, 0); ilo_cp_end(cp); + } static void @@ -709,8 +656,8 @@ gen7_emit_3DSTATE_STREAMOUT(const struct ilo_dev_info *dev, static void gen7_emit_3DSTATE_SBE(const struct ilo_dev_info *dev, const struct ilo_rasterizer_state *rasterizer, - const struct ilo_shader *fs, - const struct ilo_shader *last_sh, + const struct ilo_shader_state *fs, + const struct ilo_shader_state *last_sh, struct ilo_cp *cp) { const uint32_t cmd = ILO_GPE_CMD(0x3, 0x0, 0x1f); diff --git a/src/gallium/drivers/ilo/ilo_gpe_gen7.h b/src/gallium/drivers/ilo/ilo_gpe_gen7.h index da172df..3212015 100644 --- a/src/gallium/drivers/ilo/ilo_gpe_gen7.h +++ b/src/gallium/drivers/ilo/ilo_gpe_gen7.h @@ -201,8 +201,8 @@ typedef void typedef void (*ilo_gpe_gen7_3DSTATE_HS)(const struct ilo_dev_info *dev, - const struct ilo_shader *hs, - int max_threads, int num_samplers, + const struct ilo_shader_state *hs, + int num_samplers, struct ilo_cp *cp); typedef void @@ -211,8 +211,8 @@ typedef void typedef void (*ilo_gpe_gen7_3DSTATE_DS)(const struct ilo_dev_info *dev, - const struct ilo_shader *ds, - int max_threads, int num_samplers, + const struct ilo_shader_state *ds, + int num_samplers, struct ilo_cp *cp); typedef void @@ -225,8 +225,8 @@ typedef void typedef void (*ilo_gpe_gen7_3DSTATE_SBE)(const struct ilo_dev_info *dev, const struct ilo_rasterizer_state *rasterizer, - const struct ilo_shader *fs, - const struct ilo_shader *last_sh, + const struct ilo_shader_state *fs, + const struct ilo_shader_state *last_sh, struct ilo_cp *cp); typedef void -- 2.7.4