[Mesa-dev] [PATCH] i965: Move binding table update packets to binding table setup time.

Kenneth Graunke kenneth at whitecape.org
Sun Jan 19 16:20:07 PST 2014


On 01/15/2014 09:43 PM, Eric Anholt wrote:
> This keeps us from needing to reemit all the other stage state just
> because a surface changed.
> 
> Improves unoptimized glamor x11perf -f8text by 1.10201% +/- 0.489869%
> (n=296).
> ---
>  src/mesa/drivers/dri/i965/brw_binding_tables.c | 51 ++++++++++++++++++++------
>  src/mesa/drivers/dri/i965/gen7_gs_state.c      |  7 ----
>  src/mesa/drivers/dri/i965/gen7_vs_state.c      |  7 ----
>  src/mesa/drivers/dri/i965/gen7_wm_state.c      |  7 ----
>  4 files changed, 39 insertions(+), 33 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_binding_tables.c b/src/mesa/drivers/dri/i965/brw_binding_tables.c
> index b39bd10..ca42472 100644
> --- a/src/mesa/drivers/dri/i965/brw_binding_tables.c
> +++ b/src/mesa/drivers/dri/i965/brw_binding_tables.c
> @@ -50,7 +50,7 @@
>   * This copies brw_stage_state::surf_offset[] into the indirect state section
>   * of the batchbuffer (allocated by brw_state_batch()).
>   */
> -static void
> +static bool
>  brw_upload_binding_table(struct brw_context *brw,
>                           GLbitfield brw_new_binding_table,
>                           struct brw_stage_state *stage_state)
> @@ -63,8 +63,9 @@ brw_upload_binding_table(struct brw_context *brw,
>        if (stage_state->bind_bo_offset != 0) {
>           brw->state.dirty.brw |= brw_new_binding_table;
>           stage_state->bind_bo_offset = 0;
> +         return true;
>        }
> -      return;
> +      return false;
>     }
>  
>     if (INTEL_DEBUG & DEBUG_SHADER_TIME) {
> @@ -81,6 +82,7 @@ brw_upload_binding_table(struct brw_context *brw,
>     memcpy(bind, stage_state->surf_offset, prog_data->binding_table.size_bytes);
>  
>     brw->state.dirty.brw |= brw_new_binding_table;
> +   return true;
>  }
>  
>  /**
> @@ -92,15 +94,23 @@ brw_upload_binding_table(struct brw_context *brw,
>  static void
>  brw_vs_upload_binding_table(struct brw_context *brw)
>  {
> -   brw_upload_binding_table(brw, BRW_NEW_VS_BINDING_TABLE, &brw->vs.base);
> +   if (brw_upload_binding_table(brw, BRW_NEW_VS_BINDING_TABLE, &brw->vs.base)) {
> +      if (brw->gen >= 7) {
> +         BEGIN_BATCH(2);
> +         OUT_BATCH(_3DSTATE_BINDING_TABLE_POINTERS_VS << 16 | (2 - 2));
> +         OUT_BATCH(brw->vs.base.bind_bo_offset);
> +         ADVANCE_BATCH();
> +      }
> +   }

As is, this patch is
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

That said, I wonder if you couldn't pass the
_3DSTATE_BINDING_TABLE_POINTERS_[VHGDP]S enum to
brw_upload_binding_table and do this small BEGIN_BATCH there.

Would save some code...


More information about the mesa-dev mailing list