[igt-dev] [PATCH i-g-t 2/3] lib/igt_fb: allow igt_fb_get_fnv1a_crc() to handle YUV formats

Abhinav Kumar quic_abhinavk at quicinc.com
Mon Aug 7 22:48:27 UTC 2023


To validate YUV formats for writeback, allow igt_fb_get_fnv1a_crc()
to handle YUV formats.

Signed-off-by: Abhinav Kumar <quic_abhinavk at quicinc.com>
---
 lib/igt_fb.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 55ef63cc71dc..1e3deeaf551a 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 (!igt_format_is_yuv(fb->drm_format) || fb->drm_format != DRM_FORMAT_XRGB8888)
 		return -EINVAL;
 
 	ptr = igt_fb_map_buffer(fb->fd, fb);
@@ -4782,7 +4782,8 @@ int igt_fb_get_fnv1a_crc(struct igt_fb *fb, igt_crc_t *crc)
 		for (x = 0; x < fb->width; x++) {
 			unsigned int i;
 			uint32_t pixel = le32_to_cpu(line[x]);
-			pixel &= 0x00ffffff;
+			if (fb->drm_format == DRM_FORMAT_XRGB8888)
+				pixel &= 0x00ffffff;
 
 			for (i = 0; i < sizeof(pixel); i++) {
 				uint8_t component = (pixel >> (i * 8)) & 0xff;
-- 
2.40.1



More information about the igt-dev mailing list