From 83d7e327f91dc96c24f28bea9b41e696bd0fef99 Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Thu, 27 Jul 2023 15:12:59 +0200 Subject: [PATCH] etnaviv: switch to S_FIXED(..) macro In different traces for different GPU models I see the same pattern: 0x00c80000, /* [00A00] PA.VIEWPORT_SCALE_X = 200.000000 */ 0xff880000, /* [00A04] PA.VIEWPORT_SCALE_Y = -120.000000 */ etna_f32_to_fixp16(..) handles the negative case differently then blob. In the concrete example -120 gets converted to 0xff880001. Switch to S_FIXED(..) to simplify our code and to get the same results as blob. Signed-off-by: Christian Gmeiner Reviewed-by: Lucas Stach Part-of: --- src/gallium/drivers/etnaviv/etnaviv_util.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_util.h b/src/gallium/drivers/etnaviv/etnaviv_util.h index 0c2b98b..c2ecb02 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_util.h +++ b/src/gallium/drivers/etnaviv/etnaviv_util.h @@ -76,13 +76,7 @@ etna_log2_fixp88(unsigned width) static inline uint32_t etna_f32_to_fixp16(float f) { - if (f >= (32768.0f - 1.0f / 65536.0f)) - return 0x7fffffff; - - if (f < -32768.0f) - return 0x80000000; - - return (int32_t)(f * 65536.0f + 0.5f); + return S_FIXED(f, 16); } #endif -- 2.7.4