Commit 4db88a90 authored by Thomas Zimmermann's avatar Thomas Zimmermann

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: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarMaíra Canal <mcanal@igalia.com>
Reviewed-by: default avatarJosé Expósito <jose.exposito89@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230102112927.26565-6-tzimmermann@suse.de
parent f21d62c9
...@@ -279,7 +279,7 @@ static u16 *le16buf_to_cpu(struct kunit *test, const __le16 *buf, size_t buf_siz ...@@ -279,7 +279,7 @@ static u16 *le16buf_to_cpu(struct kunit *test, const __le16 *buf, size_t buf_siz
return dst; return dst;
} }
static u32 *le32buf_to_cpu(struct kunit *test, const u32 *buf, size_t buf_size) static u32 *le32buf_to_cpu(struct kunit *test, const __le32 *buf, size_t buf_size)
{ {
u32 *dst = NULL; u32 *dst = NULL;
int n; int n;
...@@ -323,7 +323,7 @@ static void drm_test_fb_xrgb8888_to_gray8(struct kunit *test) ...@@ -323,7 +323,7 @@ static void drm_test_fb_xrgb8888_to_gray8(struct kunit *test)
const struct convert_xrgb8888_case *params = test->param_value; const struct convert_xrgb8888_case *params = test->param_value;
const struct convert_to_gray8_result *result = &params->gray8_result; const struct convert_to_gray8_result *result = &params->gray8_result;
size_t dst_size; size_t dst_size;
__u8 *buf = NULL; u8 *buf = NULL;
__le32 *xrgb8888 = NULL; __le32 *xrgb8888 = NULL;
struct iosys_map dst, src; struct iosys_map dst, src;
...@@ -353,7 +353,7 @@ static void drm_test_fb_xrgb8888_to_rgb332(struct kunit *test) ...@@ -353,7 +353,7 @@ static void drm_test_fb_xrgb8888_to_rgb332(struct kunit *test)
const struct convert_xrgb8888_case *params = test->param_value; const struct convert_xrgb8888_case *params = test->param_value;
const struct convert_to_rgb332_result *result = &params->rgb332_result; const struct convert_to_rgb332_result *result = &params->rgb332_result;
size_t dst_size; size_t dst_size;
__u8 *buf = NULL; u8 *buf = NULL;
__le32 *xrgb8888 = NULL; __le32 *xrgb8888 = NULL;
struct iosys_map dst, src; struct iosys_map dst, src;
...@@ -419,7 +419,7 @@ static void drm_test_fb_xrgb8888_to_rgb888(struct kunit *test) ...@@ -419,7 +419,7 @@ static void drm_test_fb_xrgb8888_to_rgb888(struct kunit *test)
const struct convert_xrgb8888_case *params = test->param_value; const struct convert_xrgb8888_case *params = test->param_value;
const struct convert_to_rgb888_result *result = &params->rgb888_result; const struct convert_to_rgb888_result *result = &params->rgb888_result;
size_t dst_size; size_t dst_size;
__u8 *buf = NULL; u8 *buf = NULL;
__le32 *xrgb8888 = NULL; __le32 *xrgb8888 = NULL;
struct iosys_map dst, src; struct iosys_map dst, src;
...@@ -453,7 +453,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test) ...@@ -453,7 +453,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test)
const struct convert_xrgb8888_case *params = test->param_value; const struct convert_xrgb8888_case *params = test->param_value;
const struct convert_to_xrgb2101010_result *result = &params->xrgb2101010_result; const struct convert_to_xrgb2101010_result *result = &params->xrgb2101010_result;
size_t dst_size; size_t dst_size;
__u32 *buf = NULL; u32 *buf = NULL;
__le32 *xrgb8888 = NULL; __le32 *xrgb8888 = NULL;
struct iosys_map dst, src; struct iosys_map dst, src;
...@@ -475,7 +475,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test) ...@@ -475,7 +475,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test)
iosys_map_set_vaddr(&src, xrgb8888); iosys_map_set_vaddr(&src, xrgb8888);
drm_fb_xrgb8888_to_xrgb2101010(&dst, &result->dst_pitch, &src, &fb, &params->clip); drm_fb_xrgb8888_to_xrgb2101010(&dst, &result->dst_pitch, &src, &fb, &params->clip);
buf = le32buf_to_cpu(test, buf, dst_size / sizeof(u32)); buf = le32buf_to_cpu(test, (__force const __le32 *)buf, dst_size / sizeof(u32));
KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected, dst_size), 0); KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected, dst_size), 0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment