From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2089.outbound.protection.outlook.com [40.107.100.89]) by gabe.freedesktop.org (Postfix) with ESMTPS id D802010E6AD for ; Fri, 15 Sep 2023 22:53:13 +0000 (UTC) From: Alex Hung To: Date: Fri, 15 Sep 2023 16:52:35 -0600 Message-ID: <20230915225237.116176-2-alex.hung@amd.com> In-Reply-To: <20230915225237.116176-1-alex.hung@amd.com> References: <20230915225237.116176-1-alex.hung@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Subject: [igt-dev] [PATCH 1/3][i-g-t][V3] lib/igt_fb: use the entire 32 bit for fnv1a_crc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: brian.starkey@arm.com, maxime@cerno.tech Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: 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. Signed-off-by: Alex Hung --- 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 4b592825d..f60150017 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -4779,16 +4779,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; } } -- 2.42.0