[Mesa-dev] [PATCH 20/22] radeonsi: move some inline functions from si_pipe.h to si_state.c

Michel Dänzer michel at daenzer.net
Wed Jan 22 19:46:01 PST 2014


On Mit, 2014-01-22 at 21:13 +0100, Marek Olšák wrote:
> 
> index 3eab4d9..fd4e26a 100644
> --- a/src/gallium/drivers/radeonsi/si_state.c
> +++ b/src/gallium/drivers/radeonsi/si_state.c
> @@ -166,6 +166,36 @@ static unsigned cik_db_pipe_config(struct si_screen *sscreen, unsigned tile_mode
>  	}
>  }
>  
> +static INLINE unsigned si_map_swizzle(unsigned swizzle)
> +{
> +	switch (swizzle) {
> +	case UTIL_FORMAT_SWIZZLE_Y:
> +		return V_008F0C_SQ_SEL_Y;
> +	case UTIL_FORMAT_SWIZZLE_Z:
> +		return V_008F0C_SQ_SEL_Z;
> +	case UTIL_FORMAT_SWIZZLE_W:
> +		return V_008F0C_SQ_SEL_W;
> +	case UTIL_FORMAT_SWIZZLE_0:
> +		return V_008F0C_SQ_SEL_0;
> +	case UTIL_FORMAT_SWIZZLE_1:
> +		return V_008F0C_SQ_SEL_1;
> +	default: /* UTIL_FORMAT_SWIZZLE_X */
> +		return V_008F0C_SQ_SEL_X;
> +	}
> +}
> +
> +static INLINE uint32_t S_FIXED(float value, uint32_t frac_bits)
> +{
> +	return value * (1 << frac_bits);
> +}
> +
> +/* 12.4 fixed-point */
> +static INLINE unsigned si_pack_float_12p4(float x)
> +{
> +	return x <= 0    ? 0 :
> +	       x >= 4096 ? 0xffff : x * 16;
> +}
> +
>  /*
>   * inferred framebuffer and blender state
>   */

Any reason for keeping these INLINE? I think the compilers are getting
pretty good at automatically inlining static functions as appropriate.


-- 
Earthling Michel Dänzer            |                  http://www.amd.com
Libre software enthusiast          |                Mesa and X developer



More information about the mesa-dev mailing list