History log of /linux-master/drivers/gpu/drm/tests/drm_format_helper_test.c
Revision Date Author Comments
# 4cd24d4b 09-Oct-2023 Thomas Zimmermann <tzimmermann@suse.de>

drm/format-helper: Pass format-conversion state to helpers

Pass an instance of struct drm_format_conv_state to DRM's format
conversion helpers. Update all callers.

Most drivers can use the format-conversion state from their shadow-
plane state. The shadow plane's destroy function releases the
allocated buffer. Drivers will later be able to allocate a buffer
of appropriate size in their plane's atomic_check code.

The gud driver uses a separate thread for committing updates. For
now, the update worker contains its own format-conversion state.

Images in the format-helper tests are small. The tests preallocate
a static page for the temporary buffer. Unloading the module releases
the memory.

v6:
* update patch for ssd132x support
v5:
* avoid using unusupported shadow-plane state in repaper (Noralf)
* fix documentation (Noralf, kernel test robot)
v3:
* store buffer in shadow-plane state (Javier, Maxime)
* replace ARRAY_SIZE() with sizeof() (Jani)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Tested-by: Javier Martinez Canillas <javierm@redhat.com> # ssd130x
Cc: Noralf Trønnes <noralf@tronnes.org>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: David Lechner <david@lechnology.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231009141018.11291-4-tzimmermann@suse.de


# 91951d36 18-Sep-2023 Arthur Grillo <arthurgrillo@riseup.net>

drm/tests: Add new format conversion tests to better cover drm_fb_blit()

To fully cover drm_fb_blit(), add format conversion tests that are only
supported through drm_fb_blit().

Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net>
Reviewed-by: Maíra Canal <mairacanal@riseup.net>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230918-final-gsoc-v3-2-b999c042a4cc@riseup.net


# 15bda1f8 18-Sep-2023 Arthur Grillo <arthurgrillo@riseup.net>

drm/tests: Add calls to drm_fb_blit() on supported format conversion tests

Add a call to drm_fb_blit() on existing format conversion tests that
has support.

Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net>
Reviewed-by: Maíra Canal <mairacanal@riseup.net>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230918-final-gsoc-v3-1-b999c042a4cc@riseup.net


# fb0a84e6 01-Sep-2023 Arthur Grillo <arthurgrillo@riseup.net>

drm/tests: Zero initialize fourccs_out

fourccs_out array is not initialized. As the
drm_fb_build_fourcc_list() doesn't necessarily change all the array,
and the test compares all of it, the comparison could fail if the
array is not initialized. Zero initialize the array to fix this.

Fixes: 371e0b186a13 ("drm/tests: Add KUnit tests for drm_fb_build_fourcc_list()")
Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net>
Reviewed-by: Maíra Canal <mairacanal@riseup.net>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230901-zero-init-fourcc-list-test-v1-1-68bc4cc738c8@riseup.net


# bb7f98db 14-Aug-2023 Arthur Grillo <arthurgrillo@riseup.net>

drm/tests: Add KUnit tests for drm_fb_memcpy()

Insert parameterized test for the drm_fb_memcpy() to ensure correctness
and prevent future regressions. The test case can accept different
formats.

Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230814-gsoc-drm-format-test-v2-v3-6-bd3e9f9bc2fb@riseup.net


# af4fd86a 14-Aug-2023 Arthur Grillo <arthurgrillo@riseup.net>

drm/tests: Add multi-plane support to conversion_buf_size()

The drm_fb_memcpy() supports multi-plane formats. To fully test it in
the future, add multi-plane support to the conversion_buf_size() helper.

Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net>
Reviewed-by: Maíra Canal <mairacanal@riseup.net>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230814-gsoc-drm-format-test-v2-v3-5-bd3e9f9bc2fb@riseup.net


# 371e0b18 14-Aug-2023 Arthur Grillo <arthurgrillo@riseup.net>

drm/tests: Add KUnit tests for drm_fb_build_fourcc_list()

Insert parameterized test for the drm_fb_build_fourcc_list() to ensure
correctness and prevent future regressions.

Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230814-gsoc-drm-format-test-v2-v3-4-bd3e9f9bc2fb@riseup.net


# c6099d7e 14-Aug-2023 Arthur Grillo <arthurgrillo@riseup.net>

drm/tests: Add KUnit tests for drm_fb_clip_offset()

Insert parameterized test for the drm_fb_clip_offset() to ensure
correctness and prevent future regressions.

Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net>
Reviewed-by: Maíra Canal <mairacanal@riseup.net>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230814-gsoc-drm-format-test-v2-v3-3-bd3e9f9bc2fb@riseup.net


# 97eacd05 14-Aug-2023 Arthur Grillo <arthurgrillo@riseup.net>

drm/tests: Add KUnit tests for drm_fb_swab()

Insert parameterized test for the drm_fb_swab() to ensure correctness
and prevent future regressions.

Each expected color has it bytes reversed in order, so xrgb would be
bgrx.

Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net>
Reviewed-by: Maíra Canal <mairacanal@riseup.net>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230814-gsoc-drm-format-test-v2-v3-2-bd3e9f9bc2fb@riseup.net


# ef8e29b1 14-Aug-2023 Arthur Grillo <arthurgrillo@riseup.net>

drm/tests: Test default pitch fallback

Test the default pitch fallback when NULL is passed as the dst_pitch on
the conversion procedures.

Reviewed-by: Maíra Canal <mairacanal@riseup.net>
Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230814-gsoc-drm-format-test-v2-v3-1-bd3e9f9bc2fb@riseup.net


# 705c8701 16-Mar-2023 Javier Martinez Canillas <javierm@redhat.com>

drm/format-helper: Use drm_format_info_min_pitch() in tests helper

There's a nice macro to calculate the destination pitch that already takes
into account sub-byte pixel formats. Use that instead of open coding it.

Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230316223404.102806-1-javierm@redhat.com


# 165d5133 11-Mar-2023 Arthur Grillo <arthurgrillo@riseup.net>

drm/format-helper: Make "destination_pitch" test usable for mono

This test case uses an arbitrary pitch size, different of the default
one, to test if the conversions methods obey.

Change the "destination_pitch" colors to change the monochrome expected
result from being just zeros, as this makes the arbitrary pitch use
unusable.

Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230311125141.564801-3-arthurgrillo@riseup.net


# 00000922 11-Mar-2023 Arthur Grillo <arthurgrillo@riseup.net>

drm/format-helper: Add Kunit tests for drm_fb_xrgb8888_to_mono()

Extend the existing test cases to test the conversion from XRGB8888 to
monochromatic.

Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230311125141.564801-2-arthurgrillo@riseup.net


# 3e853b9f 07-Mar-2023 Javier Martinez Canillas <javierm@redhat.com>

drm/format-helper: Make conversion_buf_size() support sub-byte pixel fmts

There are DRM fourcc formats that have pixels smaller than a byte, but the
conversion_buf_size() function assumes that pixels are a multiple of bytes
and use the struct drm_format_info .cpp field to calculate the dst_pitch.

Instead, calculate it by using the bits per pixel (bpp) and divide it by 8
to account for formats that have sub-byte pixels.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Arthur Grillo <arthurgrillo@riseup.net>
Reviewed-by: Maíra Canal <mcanal@igalia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230307215039.346863-1-javierm@redhat.com


# 4fae160f 30-Jan-2023 Maíra Canal <mairacanal@riseup.net>

drm/format-helper: Use KUNIT_EXPECT_MEMEQ macro

Commit b8a926bea8b1 ("kunit: Introduce KUNIT_EXPECT_MEMEQ and
KUNIT_EXPECT_MEMNEQ macros") introduced a new macro to compare blocks of
memory and, if the test fails, print the result in a human-friendly
format. Therefore, use KUNIT_EXPECT_MEMEQ to compare memory blocks in
replacement of the KUNIT_EXPECT_EQ macro.

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230130125554.363481-1-mairacanal@riseup.net


# 10cd592e 01-Jan-2023 Thomas Zimmermann <tzimmermann@suse.de>

drm/format-helper: Add conversion from XRGB8888 to 15-bit RGB555 formats

Add conversion from XRGB8888 to XRGB1555, ARGB1555 and RGBA5551, which
are the formats currently supported by the simplefb infrastructure. The
new helpers allow the output of XRGB8888 framebuffers to firmware
scanout buffers in one of the 15-bit formats.

v3:
* use __le* for destination buffers (Jose, kernel test robot)
v2:
* test 15-bit results with local endianness (Jose)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: José Expósito <jose.exposito89@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230102112927.26565-10-tzimmermann@suse.de


# 56119bfb 01-Jan-2023 Thomas Zimmermann <tzimmermann@suse.de>

drm/format-helper: Add conversion from XRGB8888 to ARGB2101010

Add dedicated helper to convert from XRGB8888 to ARGB2101010. Sets
all alpha bits to make pixels fully opaque.

v2:
* set correct format in struct drm_framebuffer (Javier)
* use cpubuf_to_le32()
* type fixes

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: José Expósito <jose.exposito89@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230102112927.26565-9-tzimmermann@suse.de


# 175073d6 01-Jan-2023 Thomas Zimmermann <tzimmermann@suse.de>

drm/format-helper: Add conversion from XRGB8888 to ARGB8888

Add dedicated helper to convert from XRGB8888 to ARGB8888. Sets
all alpha bits to make pixels fully opaque.

v3:
* use __le32 for destination buffer (Jose, kernel test robot)
v2:
* use cpubuf_to_le32()
* type fixes

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: José Expósito <jose.exposito89@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230102112927.26565-8-tzimmermann@suse.de


# 4db88a90 01-Jan-2023 Thomas Zimmermann <tzimmermann@suse.de>

drm/format-helper: Type fixes in format-helper tests

Change the source-buffer type of le32buf_to_cpu() to __le32* to
reflect endianness. Result buffers are converted to local endianness,
so instantiate them from regular u8 or u32 types.

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-6-tzimmermann@suse.de


# f21d62c9 01-Jan-2023 Thomas Zimmermann <tzimmermann@suse.de>

drm/format-helper: Store RGB565 in little-endian order

Fix to-RGB565 conversion helpers to store the result in little-
endian byte order. Update test cases as well.

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-5-tzimmermann@suse.de


# 58f5d983 01-Jan-2023 Thomas Zimmermann <tzimmermann@suse.de>

drm/format-helper: Fix test-input format conversion

Convert test input for format helpers from host byte order to
little-endian order. The current code does it the other way around,
but there's no effective difference to the result.

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-4-tzimmermann@suse.de


# a5b1a681 01-Jan-2023 Thomas Zimmermann <tzimmermann@suse.de>

drm/format-helper: Comment on RGB888 byte order

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


# a52a5451 25-Oct-2022 Maíra Canal <mairacanal@riseup.net>

kunit: Use KUNIT_EXPECT_MEMEQ macro

Use KUNIT_EXPECT_MEMEQ to compare memory blocks in replacement of the
KUNIT_EXPECT_EQ macro. Therefor, the statement

KUNIT_EXPECT_EQ(test, memcmp(foo, bar, size), 0);

is replaced by:

KUNIT_EXPECT_MEMEQ(test, foo, bar, size);

Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Acked-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>


# 70890033 19-Oct-2022 David Gow <davidgow@google.com>

drm: tests: Fix a buffer overflow in format_helper_test

The xrgb2101010 format conversion test (unlike for other formats) does
an endianness conversion on the results. However, it always converts
TEST_BUF_SIZE 32-bit integers, which results in reading from (and
writing to) more memory than in present in the result buffer. Instead,
use the buffer size, divided by sizeof(u32).

The issue could be reproduced with KASAN:
./tools/testing/kunit/kunit.py run --kunitconfig drivers/gpu/drm/tests \
--kconfig_add CONFIG_KASAN=y --kconfig_add CONFIG_KASAN_VMALLOC=y \
--kconfig_add CONFIG_KASAN_KUNIT_TEST=y \
drm_format_helper_test.*xrgb2101010

Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Fixes: 453114319699 ("drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_xrgb2101010()")
Signed-off-by: David Gow <davidgow@google.com>
Reviewed-by: Maíra Canal <mairacanal@riseup.net>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221019073239.3779180-1-davidgow@google.com


# 45eb009f 26-Sep-2022 José Expósito <jose.exposito89@gmail.com>

drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_gray8()

Extend the existing test cases to test the conversion from XRGB8888 to
grayscale.

Tested-by: Maíra Canal <mairacanal@riseup.net>
Reviewed-by: David Gow <davidgow@google.com>
Acked-by: Maxime Ripard <maxime@cerno.tech>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220926080837.65734-4-jose.exposito89@gmail.com


# 45311431 26-Sep-2022 José Expósito <jose.exposito89@gmail.com>

drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_xrgb2101010()

Extend the existing test cases to test the conversion from XRGB8888 to
XRGB2101010.

In order to be able to call drm_fb_xrgb8888_to_xrgb2101010() when
compiling CONFIG_DRM_KMS_HELPER as a module export the symbol.

Tested-by: Maíra Canal <mairacanal@riseup.net>
Reviewed-by: David Gow <davidgow@google.com>
Acked-by: Maxime Ripard <maxime@cerno.tech>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220926080837.65734-3-jose.exposito89@gmail.com


# f3f716ae 26-Sep-2022 José Expósito <jose.exposito89@gmail.com>

drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb888()

Extend the existing test cases to test the conversion from XRGB8888 to
RGB888.

Tested-by: Maíra Canal <mairacanal@riseup.net>
Reviewed-by: David Gow <davidgow@google.com>
Acked-by: Maxime Ripard <maxime@cerno.tech>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220926080837.65734-2-jose.exposito89@gmail.com


# 961bcdf9 11-Sep-2022 Maíra Canal <mairacanal@riseup.net>

drm/tests: Change "igt_" prefix to "drm_test_"

With the introduction of KUnit, IGT is no longer the only option to run
the DRM unit tests, as the tests can be run through kunit-tool or on
real hardware with CONFIG_KUNIT.

Therefore, remove the "igt_" prefix from the tests and replace it with
the "drm_test_" prefix, making the tests' names independent from the tool
used.

Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Acked-by: David Gow <davidgow@google.com>
Acked-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20220911191756.203118-2-mairacanal@riseup.net


# ab298c29 08-Aug-2022 Thomas Zimmermann <tzimmermann@suse.de>

drm/format-helper: Rework XRGB8888-to-RGBG565 conversion

Update XRGB8888-to-RGB565 conversion to support struct iosys_map
and convert all users. Although these are single-plane color formats,
the new interface supports multi-plane formats for consistency with
drm_fb_blit().

v2:
* update new Kunit tests
* update documentation (Sam)
* add TODO on vaddr location (Sam)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Tested-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220808125406.20752-7-tzimmermann@suse.de


# e13140a0 08-Aug-2022 Thomas Zimmermann <tzimmermann@suse.de>

drm/format-helper: Rework XRGB8888-to-RGBG332 conversion

Update XRGB8888-to-RGB332 conversion to support struct iosys_map
and convert all users. Although these are single-plane color formats,
the new interface supports multi-plane formats for consistency with
drm_fb_blit().

v2:
* rebase onto refactored Kunit tests
* update documentation (Sam)
* add TODO on vaddr location (Sam)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Tested-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220808125406.20752-6-tzimmermann@suse.de


# 5d2f2e8b 26-Jul-2022 José Expósito <jose.exposito89@gmail.com>

drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb565()

Extend the existing test cases to test the conversion from XRGB8888 to
RGB565.

The documentation and the color picker available on [1] are useful
resources to understand this patch and validate the values returned by
the conversion function.

Tested-by: Tales L. Aparecida <tales.aparecida@gmail.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Link: http://www.barth-dev.de/online/rgb565-color-picker/ # [1]
Link: https://patchwork.freedesktop.org/patch/msgid/20220726230916.390575-5-jose.exposito89@gmail.com


# 4d09017a 26-Jul-2022 José Expósito <jose.exposito89@gmail.com>

drm/format-helper: Support multiple target formats results

In order to support multiple destination format conversions, store the
destination pitch and the expected result in its own structure.

Tested-by: Tales L. Aparecida <tales.aparecida@gmail.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220726230916.390575-4-jose.exposito89@gmail.com


# 696560d4 26-Jul-2022 José Expósito <jose.exposito89@gmail.com>

drm/format-helper: Rename test cases to make them more generic

The tests available at the moment only check the conversion from
XRGB8888 to RGB332. However, more conversions will be tested in the
future.

In order to make the struct and functions present in the tests more
generic, rename xrgb8888_to_rgb332_* to convert_xrgb8888_*.

Tested-by: Tales L. Aparecida <tales.aparecida@gmail.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220726230916.390575-3-jose.exposito89@gmail.com


# 18c84852 26-Jul-2022 José Expósito <jose.exposito89@gmail.com>

drm/format-helper: Fix test on big endian architectures

The tests fail on big endian architectures, like PowerPC:

$ ./tools/testing/kunit/kunit.py run \
--kunitconfig=drivers/gpu/drm/tests \
--arch=powerpc --cross_compile=powerpc64-linux-gnu-

Transform the XRGB8888 buffer from little endian to the CPU endian
before calling the conversion function to avoid this error.

Fixes: 8f456104915f ("drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb332()")
Reported-by: David Gow <davidgow@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220726230916.390575-2-jose.exposito89@gmail.com


# 8f456104 20-Jun-2022 José Expósito <jose.exposito89@gmail.com>

drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb332()

Test the conversion from XRGB8888 to RGB332.

What is tested?

- Different values for the X in XRGB8888 to make sure it is ignored
- Different clip values: Single pixel and full and partial buffer
- Well known colors: White, black, red, green, blue, magenta, yellow
and cyan
- Other colors: Randomly picked
- Destination pitch

How to run the tests?

$ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/gpu/drm/tests \
--kconfig_add CONFIG_VIRTIO_UML=y \
--kconfig_add CONFIG_UML_PCI_OVER_VIRTIO=y

Suggested-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: David Gow <davidgow@google.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220620160640.3790-3-jose.exposito89@gmail.com