[Mesa-dev] [PATCH] i965: Use BRW_MATH_DATA_SCALAR when source regioning is scalar.

Kenneth Graunke kenneth at whitecape.org
Mon Sep 29 12:32:14 PDT 2014


On Monday, September 29, 2014 11:02:32 AM Matt Turner wrote:
> Notice the mistaken (but harmless) argument swapping in brw_math_invert().

Yuck :) Thanks for fixing that.

This looks good to me.  It would be great to have some benchmark numbers (on anything), but it also cleans up the code, so...

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

> ---
>  src/mesa/drivers/dri/i965/brw_eu.h               | 1 -
>  src/mesa/drivers/dri/i965/brw_eu_emit.c          | 9 ++++++++-
>  src/mesa/drivers/dri/i965/brw_eu_util.c          | 3 +--
>  src/mesa/drivers/dri/i965/brw_fs_generator.cpp   | 3 ---
>  src/mesa/drivers/dri/i965/brw_sf_emit.c          | 2 --
>  src/mesa/drivers/dri/i965/brw_vec4_generator.cpp | 2 --
>  6 files changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h
> index e6c26e3..db40497 100644
> --- a/src/mesa/drivers/dri/i965/brw_eu.h
> +++ b/src/mesa/drivers/dri/i965/brw_eu.h
> @@ -291,7 +291,6 @@ void gen4_math(struct brw_compile *p,
>  	       unsigned function,
>  	       unsigned msg_reg_nr,
>  	       struct brw_reg src,
> -	       unsigned data_type,
>  	       unsigned precision );
>  
>  void gen6_math(struct brw_compile *p,
> diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c
> index 15e1da7..e4488fc 100644
> --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
> +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
> @@ -1879,11 +1879,18 @@ void gen4_math(struct brw_compile *p,
>  	       unsigned function,
>  	       unsigned msg_reg_nr,
>  	       struct brw_reg src,
> -	       unsigned data_type,
>  	       unsigned precision )
>  {
>     struct brw_context *brw = p->brw;
>     brw_inst *insn = next_insn(p, BRW_OPCODE_SEND);
> +   unsigned data_type;
> +   if (src.vstride == BRW_VERTICAL_STRIDE_0 &&
> +       src.width == BRW_WIDTH_1 &&
> +       src.hstride == BRW_HORIZONTAL_STRIDE_0) {
> +      data_type = BRW_MATH_DATA_SCALAR;
> +   } else {
> +      data_type = BRW_MATH_DATA_VECTOR;
> +   }
>  
>     assert(brw->gen < 6);
>  
> diff --git a/src/mesa/drivers/dri/i965/brw_eu_util.c b/src/mesa/drivers/dri/i965/brw_eu_util.c
> index 0950fad..af4cfaf 100644
> --- a/src/mesa/drivers/dri/i965/brw_eu_util.c
> +++ b/src/mesa/drivers/dri/i965/brw_eu_util.c
> @@ -44,8 +44,7 @@ void brw_math_invert( struct brw_compile *p,
>  	     BRW_MATH_FUNCTION_INV,
>  	     0,
>  	     src,
> -	     BRW_MATH_PRECISION_FULL,
> -	     BRW_MATH_DATA_VECTOR );
> +	     BRW_MATH_PRECISION_FULL);
>  }
>  
>  
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> index 1bc10f5..e523df5 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> @@ -342,7 +342,6 @@ fs_generator::generate_math_gen4(fs_inst *inst,
>     gen4_math(p, dst,
>  	     op,
>  	     inst->base_mrf, src,
> -	     BRW_MATH_DATA_VECTOR,
>  	     BRW_MATH_PRECISION_FULL);
>  
>     if (dispatch_width == 16) {
> @@ -350,7 +349,6 @@ fs_generator::generate_math_gen4(fs_inst *inst,
>        gen4_math(p, sechalf(dst),
>  	        op,
>  	        inst->base_mrf + 1, sechalf(src),
> -	        BRW_MATH_DATA_VECTOR,
>  	        BRW_MATH_PRECISION_FULL);
>  
>        brw_set_default_compression_control(p, BRW_COMPRESSION_COMPRESSED);
> @@ -376,7 +374,6 @@ fs_generator::generate_math_g45(fs_inst *inst,
>     gen4_math(p, dst,
>               op,
>               inst->base_mrf, src,
> -             BRW_MATH_DATA_VECTOR,
>               BRW_MATH_PRECISION_FULL);
>  }
>  
> diff --git a/src/mesa/drivers/dri/i965/brw_sf_emit.c b/src/mesa/drivers/dri/i965/brw_sf_emit.c
> index 04d21a8..e8bf716 100644
> --- a/src/mesa/drivers/dri/i965/brw_sf_emit.c
> +++ b/src/mesa/drivers/dri/i965/brw_sf_emit.c
> @@ -327,7 +327,6 @@ static void invert_det( struct brw_sf_compile *c)
>  	     BRW_MATH_FUNCTION_INV,
>  	     0,
>  	     c->det,
> -	     BRW_MATH_DATA_SCALAR,
>  	     BRW_MATH_PRECISION_FULL);
>  
>  }
> @@ -616,7 +615,6 @@ void brw_emit_point_sprite_setup(struct brw_sf_compile *c, bool allocate)
>  		   BRW_MATH_FUNCTION_INV,
>  		   0,
>  		   c->dx0,
> -		   BRW_MATH_DATA_SCALAR,
>  		   BRW_MATH_PRECISION_FULL);
>  
>  	 brw_set_default_access_mode(p, BRW_ALIGN_16);
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
> index 8869538..e522567 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
> @@ -157,7 +157,6 @@ vec4_generator::generate_math1_gen4(vec4_instruction *inst,
>  	     brw_math_function(inst->opcode),
>  	     inst->base_mrf,
>  	     src,
> -	     BRW_MATH_DATA_VECTOR,
>  	     BRW_MATH_PRECISION_FULL);
>  }
>  
> @@ -218,7 +217,6 @@ vec4_generator::generate_math2_gen4(vec4_instruction *inst,
>  	     brw_math_function(inst->opcode),
>  	     inst->base_mrf,
>  	     op0,
> -	     BRW_MATH_DATA_VECTOR,
>  	     BRW_MATH_PRECISION_FULL);
>  }
>  
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140929/579a7261/attachment-0001.sig>


More information about the mesa-dev mailing list