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 <cgmeiner@igalia.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24364>
This commit is contained in:
Christian Gmeiner
2023-07-27 15:12:59 +02:00
committed by Marge Bot
parent 8bce68edf5
commit 83d7e327f9

View File

@@ -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