ilo: use ilo_shader_state exclusively in GPE
authorChia-I Wu <olvaffe@gmail.com>
Fri, 21 Jun 2013 06:29:08 +0000 (14:29 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Tue, 25 Jun 2013 05:18:08 +0000 (13:18 +0800)
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
src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c
src/gallium/drivers/ilo/ilo_gpe_gen6.c
src/gallium/drivers/ilo/ilo_gpe_gen6.h
src/gallium/drivers/ilo/ilo_gpe_gen7.c
src/gallium/drivers/ilo/ilo_gpe_gen7.h

index e4bf1d816508b014eae7a5693cfc290546be410d..771372df05f2b1ca8e3682171cc61462691b26c0 100644 (file)
@@ -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);
    }
 }
 
index 49f5049cb2e41e3f9ef60c77964a142ac0af5466..ac1d79bc71af23349b832bb6605715281517c349 100644 (file)
@@ -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 */
index 9c7223d3c2d51882bf17ece793a8caa526771423..c0ed42dfe8ce93916e3ff8fc2cdaee1e1f9dfd8d 100644 (file)
@@ -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;
index 511529b3415c0263b7680b2c07ca7da5349ef2d1..7eba6c1c2bfc546ec5d718c978549ae9cdb8c3a9 100644 (file)
@@ -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 */
index 41eb0b31cc65de61ac6e52adb686e4a674409f32..21764c9ff3c6937745593441d40f60de363c77ee 100644 (file)
@@ -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);
index da172dfcb4b03032b3ab7506e7517402bbb8ae93..321201548867b1f121ef000339cc187b0bc9e36f 100644 (file)
@@ -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