[Mesa-dev] [PATCH 1/2] i965: Program 3DSTATE_AA_LINE_PARAMETERS in upload_invariant_state

Anuj Phogat anuj.phogat at gmail.com
Mon Oct 31 20:04:16 UTC 2016


On Wed, Oct 26, 2016 at 11:23 AM, Nanley Chery <nanleychery at gmail.com> wrote:
> This packet is non-pipelined and doesn't ever change across emissions.
>
> Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_misc_state.c   | 41 +++++++---------------------
>  src/mesa/drivers/dri/i965/brw_state.h        |  1 -
>  src/mesa/drivers/dri/i965/brw_state_upload.c |  4 ---
>  3 files changed, 10 insertions(+), 36 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c
> index cc62dab..9997db6 100644
> --- a/src/mesa/drivers/dri/i965/brw_misc_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
> @@ -795,37 +795,6 @@ const struct brw_tracked_state brw_polygon_stipple_offset = {
>  };
>
>  /**
> - * AA Line parameters
> - */
> -static void
> -upload_aa_line_parameters(struct brw_context *brw)
> -{
> -   struct gl_context *ctx = &brw->ctx;
> -
> -   if (!ctx->Line.SmoothFlag)
> -      return;
> -
> -   /* Original Gen4 doesn't have 3DSTATE_AA_LINE_PARAMETERS. */
> -   if (brw->gen == 4 && !brw->is_g4x)
> -      return;
> -
> -   BEGIN_BATCH(3);
> -   OUT_BATCH(_3DSTATE_AA_LINE_PARAMETERS << 16 | (3 - 2));
> -   /* use legacy aa line coverage computation */
> -   OUT_BATCH(0);
> -   OUT_BATCH(0);
> -   ADVANCE_BATCH();
> -}
> -
> -const struct brw_tracked_state brw_aa_line_parameters = {
> -   .dirty = {
> -      .mesa = _NEW_LINE,
> -      .brw = BRW_NEW_CONTEXT,
> -   },
> -   .emit = upload_aa_line_parameters
> -};
> -
> -/**
>   * Line stipple packet
>   */
>  static void
> @@ -1029,6 +998,16 @@ brw_upload_invariant_state(struct brw_context *brw)
>        ADVANCE_BATCH();
>     }
>
> +   /* Original Gen4 doesn't have 3DSTATE_AA_LINE_PARAMETERS. */
> +   if (!is_965) {
> +      BEGIN_BATCH(3);
> +      OUT_BATCH(_3DSTATE_AA_LINE_PARAMETERS << 16 | (3 - 2));
> +      /* use legacy aa line coverage computation */
> +      OUT_BATCH(0);
> +      OUT_BATCH(0);
> +      ADVANCE_BATCH();
> +   }
> +
>     const uint32_t _3DSTATE_VF_STATISTICS =
>        is_965 ? GEN4_3DSTATE_VF_STATISTICS : GM45_3DSTATE_VF_STATISTICS;
>     BEGIN_BATCH(1);
> diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
> index 1420aab..75e497f 100644
> --- a/src/mesa/drivers/dri/i965/brw_state.h
> +++ b/src/mesa/drivers/dri/i965/brw_state.h
> @@ -57,7 +57,6 @@ extern const struct brw_tracked_state brw_invariant_state;
>  extern const struct brw_tracked_state brw_fs_samplers;
>  extern const struct brw_tracked_state brw_gs_unit;
>  extern const struct brw_tracked_state brw_line_stipple;
> -extern const struct brw_tracked_state brw_aa_line_parameters;
>  extern const struct brw_tracked_state brw_binding_table_pointers;
>  extern const struct brw_tracked_state brw_depthbuffer;
>  extern const struct brw_tracked_state brw_polygon_stipple_offset;
> diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
> index 015ea6e..2461ee5 100644
> --- a/src/mesa/drivers/dri/i965/brw_state_upload.c
> +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
> @@ -90,7 +90,6 @@ static const struct brw_tracked_state *gen4_atoms[] =
>     &brw_polygon_stipple_offset,
>
>     &brw_line_stipple,
> -   &brw_aa_line_parameters,
>
>     &brw_psp_urb_cbs,
>
> @@ -160,7 +159,6 @@ static const struct brw_tracked_state *gen6_atoms[] =
>     &brw_polygon_stipple_offset,
>
>     &brw_line_stipple,
> -   &brw_aa_line_parameters,
>
>     &brw_drawing_rect,
>
> @@ -251,7 +249,6 @@ static const struct brw_tracked_state *gen7_render_atoms[] =
>     &brw_polygon_stipple_offset,
>
>     &brw_line_stipple,
> -   &brw_aa_line_parameters,
>
>     &brw_drawing_rect,
>
> @@ -360,7 +357,6 @@ static const struct brw_tracked_state *gen8_render_atoms[] =
>     &brw_polygon_stipple_offset,
>
>     &brw_line_stipple,
> -   &brw_aa_line_parameters,
>
>     &brw_drawing_rect,
>
> --
> 2.10.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

I think it should be fine programming it in brw_upload_invariant_state().

Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the mesa-dev mailing list