[Mesa-dev] [PATCH 1/2] gallium/radeon: make S_FIXED function signed and move it to shared code

Roland Scheidegger sroland at vmware.com
Tue Jul 25 16:35:48 UTC 2017


Reviewed-by: Roland Scheidegger <sroland at vmware.com>

Am 25.07.2017 um 17:36 schrieb Marek Olšák:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> This fixes a bug uncovered by:
>     2412c4c81ea0488df865817a0de91ec46e359b72
>     util: Make CLAMP turn NaN into MIN.
> ---
>  src/gallium/drivers/r600/r600_pipe.h          | 4 ----
>  src/gallium/drivers/radeon/r600_pipe_common.h | 5 +++++
>  src/gallium/drivers/radeonsi/si_state.c       | 5 -----
>  3 files changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
> index 3fa7d77..c9294a7 100644
> --- a/src/gallium/drivers/r600/r600_pipe.h
> +++ b/src/gallium/drivers/r600/r600_pipe.h
> @@ -918,24 +918,20 @@ static inline void radeon_set_context_reg_flag(struct radeon_winsys_cs *cs, unsi
>  
>  static inline void radeon_set_ctl_const(struct radeon_winsys_cs *cs, unsigned reg, unsigned value)
>  {
>  	radeon_set_ctl_const_seq(cs, reg, 1);
>  	radeon_emit(cs, value);
>  }
>  
>  /*
>   * common helpers
>   */
> -static inline uint32_t S_FIXED(float value, uint32_t frac_bits)
> -{
> -	return value * (1 << frac_bits);
> -}
>  
>  /* 12.4 fixed-point */
>  static inline unsigned r600_pack_float_12p4(float x)
>  {
>  	return x <= 0    ? 0 :
>  	       x >= 4096 ? 0xffff : x * 16;
>  }
>  
>  static inline unsigned r600_get_flush_flags(enum r600_coherency coher)
>  {
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
> index 5c761f3..c2fb369 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.h
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.h
> @@ -999,11 +999,16 @@ vi_dcc_enabled(struct r600_texture *tex, unsigned level)
>  #define R600_ERR(fmt, args...) \
>  	fprintf(stderr, "EE %s:%d %s - " fmt, __FILE__, __LINE__, __func__, ##args)
>  
>  /* For MSAA sample positions. */
>  #define FILL_SREG(s0x, s0y, s1x, s1y, s2x, s2y, s3x, s3y)  \
>  	(((s0x) & 0xf) | (((unsigned)(s0y) & 0xf) << 4) |		   \
>  	(((unsigned)(s1x) & 0xf) << 8) | (((unsigned)(s1y) & 0xf) << 12) |	   \
>  	(((unsigned)(s2x) & 0xf) << 16) | (((unsigned)(s2y) & 0xf) << 20) |	   \
>  	 (((unsigned)(s3x) & 0xf) << 24) | (((unsigned)(s3y) & 0xf) << 28))
>  
> +static inline int S_FIXED(float value, unsigned frac_bits)
> +{
> +	return value * (1 << frac_bits);
> +}
> +
>  #endif
> diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
> index 7e3d1a0..42d81e7 100644
> --- a/src/gallium/drivers/radeonsi/si_state.c
> +++ b/src/gallium/drivers/radeonsi/si_state.c
> @@ -67,25 +67,20 @@ static unsigned si_map_swizzle(unsigned swizzle)
>  		return V_008F0C_SQ_SEL_W;
>  	case PIPE_SWIZZLE_0:
>  		return V_008F0C_SQ_SEL_0;
>  	case PIPE_SWIZZLE_1:
>  		return V_008F0C_SQ_SEL_1;
>  	default: /* PIPE_SWIZZLE_X */
>  		return V_008F0C_SQ_SEL_X;
>  	}
>  }
>  
> -static uint32_t S_FIXED(float value, uint32_t frac_bits)
> -{
> -	return value * (1 << frac_bits);
> -}
> -
>  /* 12.4 fixed-point */
>  static unsigned si_pack_float_12p4(float x)
>  {
>  	return x <= 0    ? 0 :
>  	       x >= 4096 ? 0xffff : x * 16;
>  }
>  
>  /*
>   * Inferred framebuffer and blender state.
>   *
> 



More information about the mesa-dev mailing list