[igt-dev] [PATCH 2/3] lib/igt_fb: add 10 bits (XRGB2101010) supports in fnv1a_crc

Alex Hung alex.hung at amd.com
Wed Aug 16 20:53:15 UTC 2023


Allow 10 bits (DRM_FORMAT_XRGB2101010) components to be hashed
as well.

Signed-off-by: Alex Hung <alex.hung at amd.com>
---
 lib/igt_fb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 9beb07049..a24b4f669 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -4755,7 +4755,7 @@ int igt_fb_get_fnv1a_crc(struct igt_fb *fb, igt_crc_t *crc)
 	if (fb->num_planes != 1)
 		return -EINVAL;
 
-	if (fb->drm_format != DRM_FORMAT_XRGB8888)
+	if (fb->drm_format != DRM_FORMAT_XRGB8888 && fb->drm_format != DRM_FORMAT_XRGB2101010)
 		return -EINVAL;
 
 	ptr = igt_fb_map_buffer(fb->fd, fb);
@@ -4781,7 +4781,11 @@ int igt_fb_get_fnv1a_crc(struct igt_fb *fb, igt_crc_t *crc)
 
 		for (x = 0; x < fb->width; x++) {
 			uint32_t pixel = le32_to_cpu(line[x]);
-			pixel &= 0x00ffffff;
+
+			if (fb->drm_format == DRM_FORMAT_XRGB8888)
+				pixel &= 0x00ffffff;
+			else if (fb->drm_format == DRM_FORMAT_XRGB2101010)
+				pixel &= 0x3fffffff;
 
 			hash ^= pixel;
 			hash *= FNV1a_PRIME;
-- 
2.34.1



More information about the igt-dev mailing list