[Mesa-dev] [PATCH 1/2] i965: Set brw->batch.emit only #ifdef DEBUG.

Iago Toral itoral at igalia.com
Thu Jul 9 06:58:02 PDT 2015


Even if your next patch needs more work this one alone still makes
sense:

Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>

Iago

On Wed, 2015-07-08 at 14:00 -0700, Matt Turner wrote:
> It's only used inside #ifdef DEBUG. Cuts ~1.7k of .text, and more
> importantly prevents a larger code size regression in the next commit
> when the .used field is replaced and calculated on demand.
> 
>    text     data      bss      dec      hex  filename
> 4945468   195152    26192  5166812   4ed6dc  i965_dri.so before
> 4943740   195152    26192  5165084   4ed01c  i965_dri.so after
> 
> And surround the emit and total fields with #ifdef DEBUG to prevent
> such mistakes from happening again.
> ---
>  src/mesa/drivers/dri/i965/brw_context.h       | 2 ++
>  src/mesa/drivers/dri/i965/intel_batchbuffer.h | 2 +-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
> index 7596139..afb714b 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -872,7 +872,9 @@ struct intel_batchbuffer {
>     /** BO for post-sync nonzero writes for gen6 workaround. */
>     drm_intel_bo *workaround_bo;
>  
> +#ifdef DEBUG
>     uint16_t emit, total;
> +#endif
>     uint16_t used, reserved_space;
>     uint32_t *map;
>     uint32_t *cpu_map;
> diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.h b/src/mesa/drivers/dri/i965/intel_batchbuffer.h
> index fdd07e0..f0971e9 100644
> --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.h
> +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.h
> @@ -134,8 +134,8 @@ intel_batchbuffer_begin(struct brw_context *brw, int n, enum brw_gpu_ring ring)
>  {
>     intel_batchbuffer_require_space(brw, n * 4, ring);
>  
> -   brw->batch.emit = brw->batch.used;
>  #ifdef DEBUG
> +   brw->batch.emit = brw->batch.used;
>     brw->batch.total = n;
>  #endif
>  }




More information about the mesa-dev mailing list