From 8f37e8e64fc897180603a7247e2fd47bf0ffb834 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 15 Jun 2015 11:57:10 +0800 Subject: [PATCH] ilo: add 3DSTATE_AA_LINE_PARAMETERS to ilo_state_raster Utilize ilo_state_raster to avoid redundant state change. --- .../drivers/ilo/core/ilo_builder_3d_bottom.h | 18 +++++++++++------- .../drivers/ilo/core/ilo_state_raster.c | 3 ++- .../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 88ed6ea054c..7c1825b6b13 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 2b7567e3111..a33812d7638 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 0b4665b5de8..add26cd0a48 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 30abead0cdc..22081e44c03 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); } } -- 2.30.2