From b904dcad67245b47c0d4c0ff61c22ff29b62656d Mon Sep 17 00:00:00 2001 From: Alex Hung <alex.hung@amd.com> Date: Fri, 23 Jun 2023 17:40:10 -0600 Subject: [PATCH] lib/igt_fb: use the entire 32 bit for fnv1a_crc The function was implemented as a 32-bit hashing function. Commit 85f4c1005150 ("lib/igt_fb: Ignore the X component when computing CRC") broke this behavior by hashing 8-bit portions. Restore the 32-bit hasing behavior while still ignoring the X compoment. Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> --- lib/igt_fb.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/igt_fb.c b/lib/igt_fb.c index c8a7b31a8..ec69b8a37 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -4780,16 +4780,11 @@ int igt_fb_get_fnv1a_crc(struct igt_fb *fb, igt_crc_t *crc) igt_memcpy_from_wc(line, ptr, fb->width * cpp); for (x = 0; x < fb->width; x++) { - unsigned int i; uint32_t pixel = le32_to_cpu(line[x]); pixel &= 0x00ffffff; - for (i = 0; i < sizeof(pixel); i++) { - uint8_t component = (pixel >> (i * 8)) & 0xff; - - hash ^= component; - hash *= FNV1a_PRIME; - } + hash ^= pixel; + hash *= FNV1a_PRIME; } } -- GitLab