ilo: simplify emit_3DSTATE_DEPTH_BUFFER()
authorChia-I Wu <olvaffe@gmail.com>
Mon, 3 Jun 2013 04:35:01 +0000 (12:35 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Fri, 7 Jun 2013 03:13:15 +0000 (11:13 +0800)
Remove hiz and dsa from the parameters.  We would know whether HiZ buffer
exists from ilo_texture once it is supported.  DSA state should not affect
3DSTATE_DEPTH_BUFFER.

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 c94a0bbda2476a24fd045ae4667e1c816b6975ab..a504acd586a3cb6b7987aa35c1625e6d1d4fb389 100644 (file)
@@ -722,8 +722,7 @@ gen6_pipeline_wm_depth(struct ilo_3d_pipeline *p,
          gen6_wa_pipe_control_wm_depth_flush(p);
       }
 
-      p->gen6_3DSTATE_DEPTH_BUFFER(p->dev,
-            ilo->fb.state.zsbuf, false, p->cp);
+      p->gen6_3DSTATE_DEPTH_BUFFER(p->dev, ilo->fb.state.zsbuf, p->cp);
 
       /* TODO */
       p->gen6_3DSTATE_CLEAR_PARAMS(p->dev, 0, p->cp);
index 1ad19d2e6758298a3e15ae5b1dd8e288346ab50e..bb9b079b9089556dc5a4d4c4a1e156c551477d25 100644 (file)
@@ -539,16 +539,9 @@ gen7_pipeline_wm(struct ilo_3d_pipeline *p,
     */
 
    /* 3DSTATE_DEPTH_BUFFER and 3DSTATE_CLEAR_PARAMS */
-   if (DIRTY(FRAMEBUFFER) || DIRTY(DEPTH_STENCIL_ALPHA) ||
-       session->state_bo_changed) {
-      const bool hiz = false;
-
-      p->gen7_3DSTATE_DEPTH_BUFFER(p->dev,
-            ilo->fb.state.zsbuf, &ilo->dsa->state, hiz, p->cp);
-
-      p->gen6_3DSTATE_HIER_DEPTH_BUFFER(p->dev,
-            (hiz) ? ilo->fb.state.zsbuf : NULL, p->cp);
-
+   if (DIRTY(FRAMEBUFFER) || session->state_bo_changed) {
+      p->gen7_3DSTATE_DEPTH_BUFFER(p->dev, ilo->fb.state.zsbuf, p->cp);
+      p->gen6_3DSTATE_HIER_DEPTH_BUFFER(p->dev, ilo->fb.state.zsbuf, p->cp);
       p->gen6_3DSTATE_STENCIL_BUFFER(p->dev, ilo->fb.state.zsbuf, p->cp);
 
       /* TODO */
index dab964f36c10f8826f7c3e7cb499a64c1135e0a4..a585819961f3a8bc063497fc3f4c63ce1cec3046 100644 (file)
@@ -2272,18 +2272,17 @@ gen6_get_depth_buffer_format(const struct ilo_dev_info *dev,
    return depth_format;
 }
 
-void
-ilo_gpe_gen6_emit_3DSTATE_DEPTH_BUFFER(const struct ilo_dev_info *dev,
-                                       const struct pipe_surface *surface,
-                                       const struct pipe_depth_stencil_alpha_state *dsa,
-                                       bool hiz,
-                                       struct ilo_cp *cp)
+static void
+gen6_emit_3DSTATE_DEPTH_BUFFER(const struct ilo_dev_info *dev,
+                               const struct pipe_surface *surface,
+                               struct ilo_cp *cp)
 {
    const uint32_t cmd = (dev->gen >= ILO_GEN(7)) ?
       ILO_GPE_CMD(0x3, 0x0, 0x05) : ILO_GPE_CMD(0x3, 0x1, 0x05);
    const uint8_t cmd_len = 7;
    const int max_2d_size = (dev->gen >= ILO_GEN(7)) ? 16384 : 8192;
    const int max_array_size = (dev->gen >= ILO_GEN(7)) ? 2048 : 512;
+   const bool hiz = false;
    struct ilo_texture *tex;
    uint32_t dw1, dw3, dw4, dw6;
    uint32_t slice_offset, x_offset, y_offset;
@@ -2465,17 +2464,15 @@ ilo_gpe_gen6_emit_3DSTATE_DEPTH_BUFFER(const struct ilo_dev_info *dev,
          (tex->bo_stride - 1);
 
    if (dev->gen >= ILO_GEN(7)) {
-      if (has_depth) {
-         if (dsa->depth.writemask)
-            dw1 |= 1 << 28;
-         if (hiz)
-            dw1 |= 1 << 22;
-      }
+      if (has_depth)
+         dw1 |= 1 << 28;
 
-      if (has_stencil &&
-          (dsa->stencil[0].writemask || dsa->stencil[1].writemask))
+      if (has_stencil)
          dw1 |= 1 << 27;
 
+      if (hiz)
+         dw1 |= 1 << 22;
+
       dw3 = (height - 1) << 18 |
             (width - 1) << 4 |
             lod;
@@ -2525,15 +2522,6 @@ ilo_gpe_gen6_emit_3DSTATE_DEPTH_BUFFER(const struct ilo_dev_info *dev,
    ilo_cp_end(cp);
 }
 
-static void
-gen6_emit_3DSTATE_DEPTH_BUFFER(const struct ilo_dev_info *dev,
-                               const struct pipe_surface *surface,
-                               bool hiz,
-                               struct ilo_cp *cp)
-{
-   ilo_gpe_gen6_emit_3DSTATE_DEPTH_BUFFER(dev, surface, NULL, hiz, cp);
-}
-
 static void
 gen6_emit_3DSTATE_POLY_STIPPLE_OFFSET(const struct ilo_dev_info *dev,
                                       int x_offset, int y_offset,
@@ -2765,12 +2753,13 @@ gen6_emit_3DSTATE_HIER_DEPTH_BUFFER(const struct ilo_dev_info *dev,
       ILO_GPE_CMD(0x3, 0x0, 0x07) :
       ILO_GPE_CMD(0x3, 0x1, 0x0f);
    const uint8_t cmd_len = 3;
+   const bool hiz = false;
    struct ilo_texture *tex;
    uint32_t slice_offset;
 
    ILO_GPE_VALID_GEN(dev, 6, 7);
 
-   if (!surface) {
+   if (!surface || !hiz) {
       ilo_cp_begin(cp, cmd_len);
       ilo_cp_write(cp, cmd | (cmd_len - 2));
       ilo_cp_write(cp, 0);
index 16445a03d9fe821307ea05f055d475fe144cebfd..c7cd7b3a53ec15959de3ef9b77d325d5abd02fec 100644 (file)
@@ -301,7 +301,6 @@ typedef void
 typedef void
 (*ilo_gpe_gen6_3DSTATE_DEPTH_BUFFER)(const struct ilo_dev_info *dev,
                                      const struct pipe_surface *surface,
-                                     bool hiz,
                                      struct ilo_cp *cp);
 
 typedef void
@@ -569,11 +568,4 @@ ilo_gpe_gen6_fill_3dstate_sf_sbe(const struct ilo_dev_info *dev,
                                  const struct ilo_shader *last_sh,
                                  uint32_t *dw, int num_dwords);
 
-void
-ilo_gpe_gen6_emit_3DSTATE_DEPTH_BUFFER(const struct ilo_dev_info *dev,
-                                       const struct pipe_surface *surface,
-                                       const struct pipe_depth_stencil_alpha_state *dsa,
-                                       bool hiz,
-                                       struct ilo_cp *cp);
-
 #endif /* ILO_GPE_GEN6_H */
index 383b7d9a3d20e01b6249771ec7bdb348ef4e5179..4ec0e8608b9a9e92214dca168fb69f6fc9692035 100644 (file)
@@ -58,16 +58,6 @@ gen7_emit_3DSTATE_CLEAR_PARAMS(const struct ilo_dev_info *dev,
    ilo_cp_end(cp);
 }
 
-static void
-gen7_emit_3DSTATE_DEPTH_BUFFER(const struct ilo_dev_info *dev,
-                               const struct pipe_surface *surface,
-                               const struct pipe_depth_stencil_alpha_state *dsa,
-                               bool hiz,
-                               struct ilo_cp *cp)
-{
-   ilo_gpe_gen6_emit_3DSTATE_DEPTH_BUFFER(dev, surface, dsa, hiz, cp);
-}
-
 static void
 gen7_emit_3dstate_pointer(const struct ilo_dev_info *dev,
                           int subop, uint32_t pointer,
@@ -1926,7 +1916,7 @@ gen7_init(struct ilo_gpe_gen7 *gen7)
    GEN7_USE(gen7, MEDIA_STATE_FLUSH, gen6);
    GEN7_SET(gen7, GPGPU_WALKER);
    GEN7_SET(gen7, 3DSTATE_CLEAR_PARAMS);
-   GEN7_SET(gen7, 3DSTATE_DEPTH_BUFFER);
+   GEN7_USE(gen7, 3DSTATE_DEPTH_BUFFER, gen6);
    GEN7_USE(gen7, 3DSTATE_STENCIL_BUFFER, gen6);
    GEN7_USE(gen7, 3DSTATE_HIER_DEPTH_BUFFER, gen6);
    GEN7_USE(gen7, 3DSTATE_VERTEX_BUFFERS, gen6);
index d270ea677d62c9ae221fd4f1d808a015c32b2c85..5cc1fb1aaf86f1dbc249374162e853e47d84f4f0 100644 (file)
@@ -141,14 +141,7 @@ typedef void
                              struct ilo_cp *cp);
 
 typedef ilo_gpe_gen6_3DSTATE_CLEAR_PARAMS ilo_gpe_gen7_3DSTATE_CLEAR_PARAMS;
-
-typedef void
-(*ilo_gpe_gen7_3DSTATE_DEPTH_BUFFER)(const struct ilo_dev_info *dev,
-                                     const struct pipe_surface *surface,
-                                     const struct pipe_depth_stencil_alpha_state *dsa,
-                                     bool hiz,
-                                     struct ilo_cp *cp);
-
+typedef ilo_gpe_gen6_3DSTATE_DEPTH_BUFFER ilo_gpe_gen7_3DSTATE_DEPTH_BUFFER;
 typedef ilo_gpe_gen6_3DSTATE_STENCIL_BUFFER ilo_gpe_gen7_3DSTATE_STENCIL_BUFFER;
 typedef ilo_gpe_gen6_3DSTATE_HIER_DEPTH_BUFFER ilo_gpe_gen7_3DSTATE_HIER_DEPTH_BUFFER;
 typedef ilo_gpe_gen6_3DSTATE_VERTEX_BUFFERS ilo_gpe_gen7_3DSTATE_VERTEX_BUFFERS;