diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2022-08-08 15:53:57 +0300 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2022-08-10 10:18:36 +0300 |
commit | e13140a06283141318319aaae7dfa348b06bdd6c (patch) | |
tree | 935c851835d778c13738a671af5b6b5a2810c501 /drivers/gpu/drm/tests | |
parent | ce582859ca7b33e5c0d9432da9f7b54ced802100 (diff) | |
download | linux-e13140a06283141318319aaae7dfa348b06bdd6c.tar.xz |
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
Diffstat (limited to 'drivers/gpu/drm/tests')
-rw-r--r-- | drivers/gpu/drm/tests/drm_format_helper_test.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/gpu/drm/tests/drm_format_helper_test.c b/drivers/gpu/drm/tests/drm_format_helper_test.c index 26ecf3b4b137..7b14694ead59 100644 --- a/drivers/gpu/drm/tests/drm_format_helper_test.c +++ b/drivers/gpu/drm/tests/drm_format_helper_test.c @@ -197,8 +197,9 @@ static void xrgb8888_to_rgb332_test(struct kunit *test) const struct convert_xrgb8888_case *params = test->param_value; const struct convert_to_rgb332_result *result = ¶ms->rgb332_result; size_t dst_size; - __u8 *dst = NULL; - __u32 *src = NULL; + __u8 *buf = NULL; + __u32 *xrgb8888 = NULL; + struct iosys_map dst, src; struct drm_framebuffer fb = { .format = drm_format_info(DRM_FORMAT_XRGB8888), @@ -209,15 +210,16 @@ static void xrgb8888_to_rgb332_test(struct kunit *test) ¶ms->clip); KUNIT_ASSERT_GT(test, dst_size, 0); - dst = kunit_kzalloc(test, dst_size, GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dst); + buf = kunit_kzalloc(test, dst_size, GFP_KERNEL); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf); + iosys_map_set_vaddr(&dst, buf); - src = le32buf_to_cpu(test, params->xrgb8888, TEST_BUF_SIZE); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, src); + xrgb8888 = le32buf_to_cpu(test, params->xrgb8888, TEST_BUF_SIZE); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888); + iosys_map_set_vaddr(&src, xrgb8888); - drm_fb_xrgb8888_to_rgb332(dst, result->dst_pitch, src, &fb, - ¶ms->clip); - KUNIT_EXPECT_EQ(test, memcmp(dst, result->expected, dst_size), 0); + drm_fb_xrgb8888_to_rgb332(&dst, &result->dst_pitch, &src, &fb, ¶ms->clip); + KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected, dst_size), 0); } static void xrgb8888_to_rgb565_test(struct kunit *test) |