mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 23:03:57 -04:00
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
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user