ilo: add 3DSTATE_AA_LINE_PARAMETERS to ilo_state_raster
authorChia-I Wu <olvaffe@gmail.com>
Mon, 15 Jun 2015 03:57:10 +0000 (11:57 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Mon, 15 Jun 2015 07:06:11 +0000 (15:06 +0800)
Utilize ilo_state_raster to avoid redundant state change.

src/gallium/drivers/ilo/core/ilo_builder_3d_bottom.h
src/gallium/drivers/ilo/core/ilo_state_raster.c
src/gallium/drivers/ilo/core/ilo_state_raster.h
src/gallium/drivers/ilo/ilo_render_gen6.c

index 88ed6ea054cb7da89e6bc2222ade344e0a397b8d..7c1825b6b13fb22f8d5ba36412707ffcf3fb932e 100644 (file)
@@ -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
index 2b7567e31114193932f5056211bf7ebd34cd038e..a33812d7638d8a8cc16b81ccdf09122de265bbe1 100644 (file)
@@ -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 |
index 0b4665b5de8af05d711d07aac97460d57f7e138e..add26cd0a48cca152c7f7d776e2323500a921a41 100644 (file)
@@ -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 {
index 30abead0cdc433fecaa7da72db40173fecf381ec..22081e44c038a590431f09feeccf8b16f69b9732 100644 (file)
@@ -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);
    }
 }