ilo: add variants of 3DSTATE_PS
authorChia-I Wu <olvaffe@gmail.com>
Tue, 11 Nov 2014 02:50:31 +0000 (10:50 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Tue, 11 Nov 2014 05:51:31 +0000 (13:51 +0800)
Add gen7_disable_3DSTATE_PS() to disable PS.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
src/gallium/drivers/ilo/ilo_builder_3d_bottom.h
src/gallium/drivers/ilo/ilo_render_gen7.c

index 15921855b0f84ccc4a452d669f57c16c4d6d4e42..d7b6104f62a229b45d589a50183db8569a5ed9a3 100644 (file)
@@ -415,45 +415,11 @@ gen7_3DSTATE_PS(struct ilo_builder *builder,
                 bool dual_blend)
 {
    const uint8_t cmd_len = 8;
-   const uint32_t dw0 = GEN7_RENDER_CMD(3D, 3DSTATE_PS) | (cmd_len - 2);
    const struct ilo_shader_cso *cso;
    uint32_t dw2, dw4, dw5, *dw;
 
    ILO_DEV_ASSERT(builder->dev, 7, 7.5);
 
-   if (!fs) {
-      int max_threads;
-
-      /* GPU hangs if none of the dispatch enable bits is set */
-      dw4 = GEN7_PS_DW4_8_PIXEL_DISPATCH;
-
-      /* see brwCreateContext() */
-      switch (ilo_dev_gen(builder->dev)) {
-      case ILO_GEN(7.5):
-         max_threads = (builder->dev->gt == 3) ? 408 :
-                       (builder->dev->gt == 2) ? 204 : 102;
-         dw4 |= (max_threads - 1) << GEN75_PS_DW4_MAX_THREADS__SHIFT;
-         break;
-      case ILO_GEN(7):
-      default:
-         max_threads = (builder->dev->gt == 2) ? 172 : 48;
-         dw4 |= (max_threads - 1) << GEN7_PS_DW4_MAX_THREADS__SHIFT;
-         break;
-      }
-
-      ilo_builder_batch_pointer(builder, cmd_len, &dw);
-      dw[0] = dw0;
-      dw[1] = 0;
-      dw[2] = 0;
-      dw[3] = 0;
-      dw[4] = dw4;
-      dw[5] = 0;
-      dw[6] = 0;
-      dw[7] = 0;
-
-      return;
-   }
-
    cso = ilo_shader_get_kernel_cso(fs);
    dw2 = cso->payload[0];
    dw4 = cso->payload[1];
@@ -463,7 +429,8 @@ gen7_3DSTATE_PS(struct ilo_builder *builder,
       dw4 |= GEN7_PS_DW4_DUAL_SOURCE_BLEND;
 
    ilo_builder_batch_pointer(builder, cmd_len, &dw);
-   dw[0] = dw0;
+
+   dw[0] = GEN7_RENDER_CMD(3D, 3DSTATE_PS) | (cmd_len - 2);
    dw[1] = ilo_shader_get_kernel_offset(fs);
    dw[2] = dw2;
    dw[3] = 0; /* scratch */
@@ -473,6 +440,44 @@ gen7_3DSTATE_PS(struct ilo_builder *builder,
    dw[7] = 0; /* kernel 2 */
 }
 
+static inline void
+gen7_disable_3DSTATE_PS(struct ilo_builder *builder)
+{
+   const uint8_t cmd_len = 8;
+   int max_threads;
+   uint32_t dw4, *dw;
+
+   ILO_DEV_ASSERT(builder->dev, 7, 7.5);
+
+   /* GPU hangs if none of the dispatch enable bits is set */
+   dw4 = GEN7_PS_DW4_8_PIXEL_DISPATCH;
+
+   /* see brwCreateContext() */
+   switch (ilo_dev_gen(builder->dev)) {
+   case ILO_GEN(7.5):
+      max_threads = (builder->dev->gt == 3) ? 408 :
+                    (builder->dev->gt == 2) ? 204 : 102;
+      dw4 |= (max_threads - 1) << GEN75_PS_DW4_MAX_THREADS__SHIFT;
+      break;
+   case ILO_GEN(7):
+   default:
+      max_threads = (builder->dev->gt == 2) ? 172 : 48;
+      dw4 |= (max_threads - 1) << GEN7_PS_DW4_MAX_THREADS__SHIFT;
+      break;
+   }
+
+   ilo_builder_batch_pointer(builder, cmd_len, &dw);
+
+   dw[0] = GEN7_RENDER_CMD(3D, 3DSTATE_PS) | (cmd_len - 2);
+   dw[1] = 0;
+   dw[2] = 0;
+   dw[3] = 0;
+   dw[4] = dw4;
+   dw[5] = 0;
+   dw[6] = 0;
+   dw[7] = 0;
+}
+
 static inline void
 gen6_3DSTATE_CONSTANT_PS(struct ilo_builder *builder,
                          const uint32_t *bufs, const int *sizes,
index ab27a3d0b623fa72226a24482437cb92480cfd64..34a881aa067bba9dbc045bbb2b95a0be19e895dd 100644 (file)
@@ -770,7 +770,7 @@ gen7_rectlist_wm(struct ilo_render *r,
    gen7_3DSTATE_CONSTANT_PS(r->builder, NULL, NULL, 0);
 
    gen7_wa_pre_3dstate_ps_max_threads(r);
-   gen7_3DSTATE_PS(r->builder, NULL, false);
+   gen7_disable_3DSTATE_PS(r->builder);
 }
 
 static void