Mesa (master): ilo: add 3DSTATE_AA_LINE_PARAMETERS to ilo_state_raster

Chia-I Wu olv at kemper.freedesktop.org
Mon Jun 15 07:06:27 UTC 2015


Module: Mesa
Branch: master
Commit: 8f37e8e64fc897180603a7247e2fd47bf0ffb834
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f37e8e64fc897180603a7247e2fd47bf0ffb834

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Mon Jun 15 11:57:10 2015 +0800

ilo: add 3DSTATE_AA_LINE_PARAMETERS to ilo_state_raster

Utilize ilo_state_raster to avoid redundant state change.

---

 src/gallium/drivers/ilo/core/ilo_builder_3d_bottom.h |   18 +++++++++++-------
 src/gallium/drivers/ilo/core/ilo_state_raster.c      |    3 ++-
 src/gallium/drivers/ilo/core/ilo_state_raster.h      |    1 +
 src/gallium/drivers/ilo/ilo_render_gen6.c            |    5 +++--
 4 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/ilo/core/ilo_builder_3d_bottom.h b/src/gallium/drivers/ilo/core/ilo_builder_3d_bottom.h
index 88ed6ea..7c1825b 100644
--- a/src/gallium/drivers/ilo/core/ilo_builder_3d_bottom.h
+++ b/src/gallium/drivers/ilo/core/ilo_builder_3d_bottom.h
@@ -646,18 +646,22 @@ gen6_3DSTATE_LINE_STIPPLE(struct ilo_builder *builder,
 }
 
 static inline void
-gen6_3DSTATE_AA_LINE_PARAMETERS(struct ilo_builder *builder)
+gen6_3DSTATE_AA_LINE_PARAMETERS(struct ilo_builder *builder,
+                                const struct ilo_state_raster *rs)
 {
    const uint8_t cmd_len = 3;
-   const uint32_t dw[3] = {
-      GEN6_RENDER_CMD(3D, 3DSTATE_AA_LINE_PARAMETERS) | (cmd_len - 2),
-      0 << GEN6_AA_LINE_DW1_BIAS__SHIFT | 0,
-      0 << GEN6_AA_LINE_DW2_CAP_BIAS__SHIFT | 0,
-   };
+   uint32_t *dw;
 
    ILO_DEV_ASSERT(builder->dev, 6, 8);
 
-   ilo_builder_batch_write(builder, cmd_len, dw);
+   ilo_builder_batch_pointer(builder, cmd_len, &dw);
+
+   dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_AA_LINE_PARAMETERS) | (cmd_len - 2);
+   /* constant */
+   dw[1] = 0 << GEN6_AA_LINE_DW1_BIAS__SHIFT |
+           0 << GEN6_AA_LINE_DW1_SLOPE__SHIFT;
+   dw[2] = 0 << GEN6_AA_LINE_DW2_CAP_BIAS__SHIFT |
+           0 << GEN6_AA_LINE_DW2_CAP_SLOPE__SHIFT;
 }
 
 static inline void
diff --git a/src/gallium/drivers/ilo/core/ilo_state_raster.c b/src/gallium/drivers/ilo/core/ilo_state_raster.c
index 2b7567e..a33812d 100644
--- a/src/gallium/drivers/ilo/core/ilo_state_raster.c
+++ b/src/gallium/drivers/ilo/core/ilo_state_raster.c
@@ -985,7 +985,8 @@ ilo_state_raster_full_delta(const struct ilo_state_raster *rs,
                   ILO_STATE_RASTER_3DSTATE_SF |
                   ILO_STATE_RASTER_3DSTATE_MULTISAMPLE |
                   ILO_STATE_RASTER_3DSTATE_SAMPLE_MASK |
-                  ILO_STATE_RASTER_3DSTATE_WM;
+                  ILO_STATE_RASTER_3DSTATE_WM |
+                  ILO_STATE_RASTER_3DSTATE_AA_LINE_PARAMETERS;
 
    if (ilo_dev_gen(dev) >= ILO_GEN(8)) {
       delta->dirty |= ILO_STATE_RASTER_3DSTATE_RASTER |
diff --git a/src/gallium/drivers/ilo/core/ilo_state_raster.h b/src/gallium/drivers/ilo/core/ilo_state_raster.h
index 0b4665b..add26cd 100644
--- a/src/gallium/drivers/ilo/core/ilo_state_raster.h
+++ b/src/gallium/drivers/ilo/core/ilo_state_raster.h
@@ -41,6 +41,7 @@ enum ilo_state_raster_dirty_bits {
    ILO_STATE_RASTER_3DSTATE_SAMPLE_MASK            = (1 << 4),
    ILO_STATE_RASTER_3DSTATE_WM                     = (1 << 5),
    ILO_STATE_RASTER_3DSTATE_WM_HZ_OP               = (1 << 6),
+   ILO_STATE_RASTER_3DSTATE_AA_LINE_PARAMETERS     = (1 << 7),
 };
 
 enum ilo_state_raster_earlyz_op {
diff --git a/src/gallium/drivers/ilo/ilo_render_gen6.c b/src/gallium/drivers/ilo/ilo_render_gen6.c
index 30abead..22081e4 100644
--- a/src/gallium/drivers/ilo/ilo_render_gen6.c
+++ b/src/gallium/drivers/ilo/ilo_render_gen6.c
@@ -774,11 +774,12 @@ gen6_draw_wm_raster(struct ilo_render *r,
    }
 
    /* 3DSTATE_AA_LINE_PARAMETERS */
-   if (DIRTY(RASTERIZER) && vec->rasterizer->state.line_smooth) {
+   if (session->rs_delta.dirty &
+         ILO_STATE_RASTER_3DSTATE_AA_LINE_PARAMETERS) {
       if (ilo_dev_gen(r->dev) == ILO_GEN(6))
          gen6_wa_pre_non_pipelined(r);
 
-      gen6_3DSTATE_AA_LINE_PARAMETERS(r->builder);
+      gen6_3DSTATE_AA_LINE_PARAMETERS(r->builder, &vec->rasterizer->rs);
    }
 }
 




More information about the mesa-commit mailing list