drm/format-helper: Comment on RGB888 byte order
authorThomas Zimmermann <tzimmermann@suse.de>
Mon, 2 Jan 2023 11:29:16 +0000 (12:29 +0100)
committerThomas Zimmermann <tzimmermann@suse.de>
Tue, 3 Jan 2023 13:23:24 +0000 (14:23 +0100)
RGB888 is different than the other formats as most of its pixels are
unaligned and therefore helper functions do not use endianness conversion
helpers. Comment on this in the source code.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Maíra Canal <mcanal@igalia.com>
Reviewed-by: José Expósito <jose.exposito89@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230102112927.26565-3-tzimmermann@suse.de
drivers/gpu/drm/drm_format_helper.c
drivers/gpu/drm/tests/drm_format_helper_test.c

index 74ff33c2ddaa51d5bec4e15e854a6f5dd9296139..b98bd7c5caeeba4f01b77227358539f644c8a539 100644 (file)
@@ -404,6 +404,7 @@ static void drm_fb_xrgb8888_to_rgb888_line(void *dbuf, const void *sbuf, unsigne
 
        for (x = 0; x < pixels; x++) {
                pix = le32_to_cpu(sbuf32[x]);
+               /* write blue-green-red to output in little endianness */
                *dbuf8++ = (pix & 0x000000FF) >>  0;
                *dbuf8++ = (pix & 0x0000FF00) >>  8;
                *dbuf8++ = (pix & 0x00FF0000) >> 16;
index 2191e57f22972b1dd2bf9553018be4d1a639a8e1..cd1d7da3483c1aedaddd783c7cc7686eff97267a 100644 (file)
@@ -407,6 +407,10 @@ static void drm_test_fb_xrgb8888_to_rgb888(struct kunit *test)
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888);
        iosys_map_set_vaddr(&src, xrgb8888);
 
+       /*
+        * RGB888 expected results are already in little-endian
+        * order, so there's no need to convert the test output.
+        */
        drm_fb_xrgb8888_to_rgb888(&dst, &result->dst_pitch, &src, &fb, &params->clip);
        KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected, dst_size), 0);
 }