mirror of
https://github.com/torvalds/linux.git
synced 2026-04-24 17:42:27 -04:00
drm/tests: Do not use drm_fb_blit() in format-helper tests
Export additional helpers from the format-helper library and open-code drm_fb_blit() in tests. Prepares for the removal of drm_fb_blit(). Only sysfb drivers use drm_fb_blit(). The function will soon be removed from format helpers and be refactored within sysfb helpers. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: José Expósito <jose.exposito89@gmail.com> Acked-by: Maxime Ripard <mripard@kernel.org> Link: https://lore.kernel.org/r/20250616083846.221396-2-tzimmermann@suse.de
This commit is contained in:
@@ -748,14 +748,9 @@ static void drm_test_fb_xrgb8888_to_rgb565(struct kunit *test)
|
||||
buf = dst.vaddr;
|
||||
memset(buf, 0, dst_size);
|
||||
|
||||
int blit_result = 0;
|
||||
|
||||
blit_result = drm_fb_blit(&dst, dst_pitch, DRM_FORMAT_RGB565, &src, &fb, ¶ms->clip,
|
||||
&fmtcnv_state);
|
||||
|
||||
drm_fb_xrgb8888_to_rgb565(&dst, dst_pitch, &src, &fb, ¶ms->clip,
|
||||
&fmtcnv_state, false);
|
||||
buf = le16buf_to_cpu(test, (__force const __le16 *)buf, dst_size / sizeof(__le16));
|
||||
|
||||
KUNIT_EXPECT_FALSE(test, blit_result);
|
||||
KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
|
||||
}
|
||||
|
||||
@@ -795,14 +790,8 @@ static void drm_test_fb_xrgb8888_to_xrgb1555(struct kunit *test)
|
||||
buf = dst.vaddr; /* restore original value of buf */
|
||||
memset(buf, 0, dst_size);
|
||||
|
||||
int blit_result = 0;
|
||||
|
||||
blit_result = drm_fb_blit(&dst, dst_pitch, DRM_FORMAT_XRGB1555, &src, &fb, ¶ms->clip,
|
||||
&fmtcnv_state);
|
||||
|
||||
drm_fb_xrgb8888_to_xrgb1555(&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state);
|
||||
buf = le16buf_to_cpu(test, (__force const __le16 *)buf, dst_size / sizeof(__le16));
|
||||
|
||||
KUNIT_EXPECT_FALSE(test, blit_result);
|
||||
KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
|
||||
}
|
||||
|
||||
@@ -842,14 +831,8 @@ static void drm_test_fb_xrgb8888_to_argb1555(struct kunit *test)
|
||||
buf = dst.vaddr; /* restore original value of buf */
|
||||
memset(buf, 0, dst_size);
|
||||
|
||||
int blit_result = 0;
|
||||
|
||||
blit_result = drm_fb_blit(&dst, dst_pitch, DRM_FORMAT_ARGB1555, &src, &fb, ¶ms->clip,
|
||||
&fmtcnv_state);
|
||||
|
||||
drm_fb_xrgb8888_to_argb1555(&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state);
|
||||
buf = le16buf_to_cpu(test, (__force const __le16 *)buf, dst_size / sizeof(__le16));
|
||||
|
||||
KUNIT_EXPECT_FALSE(test, blit_result);
|
||||
KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
|
||||
}
|
||||
|
||||
@@ -889,14 +872,8 @@ static void drm_test_fb_xrgb8888_to_rgba5551(struct kunit *test)
|
||||
buf = dst.vaddr; /* restore original value of buf */
|
||||
memset(buf, 0, dst_size);
|
||||
|
||||
int blit_result = 0;
|
||||
|
||||
blit_result = drm_fb_blit(&dst, dst_pitch, DRM_FORMAT_RGBA5551, &src, &fb, ¶ms->clip,
|
||||
&fmtcnv_state);
|
||||
|
||||
drm_fb_xrgb8888_to_rgba5551(&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state);
|
||||
buf = le16buf_to_cpu(test, (__force const __le16 *)buf, dst_size / sizeof(__le16));
|
||||
|
||||
KUNIT_EXPECT_FALSE(test, blit_result);
|
||||
KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
|
||||
}
|
||||
|
||||
@@ -939,12 +916,7 @@ static void drm_test_fb_xrgb8888_to_rgb888(struct kunit *test)
|
||||
buf = dst.vaddr; /* restore original value of buf */
|
||||
memset(buf, 0, dst_size);
|
||||
|
||||
int blit_result = 0;
|
||||
|
||||
blit_result = drm_fb_blit(&dst, dst_pitch, DRM_FORMAT_RGB888, &src, &fb, ¶ms->clip,
|
||||
&fmtcnv_state);
|
||||
|
||||
KUNIT_EXPECT_FALSE(test, blit_result);
|
||||
drm_fb_xrgb8888_to_rgb888(&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state);
|
||||
KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
|
||||
}
|
||||
|
||||
@@ -985,12 +957,8 @@ static void drm_test_fb_xrgb8888_to_bgr888(struct kunit *test)
|
||||
buf = dst.vaddr; /* restore original value of buf */
|
||||
memset(buf, 0, dst_size);
|
||||
|
||||
int blit_result = 0;
|
||||
|
||||
blit_result = drm_fb_blit(&dst, &result->dst_pitch, DRM_FORMAT_BGR888, &src, &fb, ¶ms->clip,
|
||||
drm_fb_xrgb8888_to_bgr888(&dst, &result->dst_pitch, &src, &fb, ¶ms->clip,
|
||||
&fmtcnv_state);
|
||||
|
||||
KUNIT_EXPECT_FALSE(test, blit_result);
|
||||
KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
|
||||
}
|
||||
|
||||
@@ -1030,14 +998,8 @@ static void drm_test_fb_xrgb8888_to_argb8888(struct kunit *test)
|
||||
buf = dst.vaddr; /* restore original value of buf */
|
||||
memset(buf, 0, dst_size);
|
||||
|
||||
int blit_result = 0;
|
||||
|
||||
blit_result = drm_fb_blit(&dst, dst_pitch, DRM_FORMAT_ARGB8888, &src, &fb, ¶ms->clip,
|
||||
&fmtcnv_state);
|
||||
|
||||
drm_fb_xrgb8888_to_argb8888(&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state);
|
||||
buf = le32buf_to_cpu(test, (__force const __le32 *)buf, dst_size / sizeof(u32));
|
||||
|
||||
KUNIT_EXPECT_FALSE(test, blit_result);
|
||||
KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
|
||||
}
|
||||
|
||||
@@ -1077,12 +1039,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test)
|
||||
buf = dst.vaddr; /* restore original value of buf */
|
||||
memset(buf, 0, dst_size);
|
||||
|
||||
int blit_result = 0;
|
||||
|
||||
blit_result = drm_fb_blit(&dst, dst_pitch, DRM_FORMAT_XRGB2101010, &src, &fb,
|
||||
¶ms->clip, &fmtcnv_state);
|
||||
|
||||
KUNIT_EXPECT_FALSE(test, blit_result);
|
||||
drm_fb_xrgb8888_to_xrgb2101010(&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state);
|
||||
KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
|
||||
}
|
||||
|
||||
@@ -1122,14 +1079,8 @@ static void drm_test_fb_xrgb8888_to_argb2101010(struct kunit *test)
|
||||
buf = dst.vaddr; /* restore original value of buf */
|
||||
memset(buf, 0, dst_size);
|
||||
|
||||
int blit_result = 0;
|
||||
|
||||
blit_result = drm_fb_blit(&dst, dst_pitch, DRM_FORMAT_ARGB2101010, &src, &fb,
|
||||
¶ms->clip, &fmtcnv_state);
|
||||
|
||||
drm_fb_xrgb8888_to_argb2101010(&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state);
|
||||
buf = le32buf_to_cpu(test, (__force const __le32 *)buf, dst_size / sizeof(u32));
|
||||
|
||||
KUNIT_EXPECT_FALSE(test, blit_result);
|
||||
KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
|
||||
}
|
||||
|
||||
@@ -1202,23 +1153,15 @@ static void drm_test_fb_swab(struct kunit *test)
|
||||
buf = dst.vaddr; /* restore original value of buf */
|
||||
memset(buf, 0, dst_size);
|
||||
|
||||
int blit_result;
|
||||
|
||||
blit_result = drm_fb_blit(&dst, dst_pitch, DRM_FORMAT_XRGB8888 | DRM_FORMAT_BIG_ENDIAN,
|
||||
&src, &fb, ¶ms->clip, &fmtcnv_state);
|
||||
drm_fb_swab(&dst, dst_pitch, &src, &fb, ¶ms->clip, false, &fmtcnv_state);
|
||||
buf = le32buf_to_cpu(test, (__force const __le32 *)buf, dst_size / sizeof(u32));
|
||||
|
||||
KUNIT_EXPECT_FALSE(test, blit_result);
|
||||
KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
|
||||
|
||||
buf = dst.vaddr;
|
||||
memset(buf, 0, dst_size);
|
||||
|
||||
blit_result = drm_fb_blit(&dst, dst_pitch, DRM_FORMAT_BGRX8888, &src, &fb, ¶ms->clip,
|
||||
&fmtcnv_state);
|
||||
drm_fb_xrgb8888_to_bgrx8888(&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state);
|
||||
buf = le32buf_to_cpu(test, (__force const __le32 *)buf, dst_size / sizeof(u32));
|
||||
|
||||
KUNIT_EXPECT_FALSE(test, blit_result);
|
||||
KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
|
||||
|
||||
buf = dst.vaddr;
|
||||
@@ -1229,11 +1172,8 @@ static void drm_test_fb_swab(struct kunit *test)
|
||||
mock_format.format |= DRM_FORMAT_BIG_ENDIAN;
|
||||
fb.format = &mock_format;
|
||||
|
||||
blit_result = drm_fb_blit(&dst, dst_pitch, DRM_FORMAT_XRGB8888, &src, &fb, ¶ms->clip,
|
||||
&fmtcnv_state);
|
||||
drm_fb_swab(&dst, dst_pitch, &src, &fb, ¶ms->clip, false, &fmtcnv_state);
|
||||
buf = le32buf_to_cpu(test, (__force const __le32 *)buf, dst_size / sizeof(u32));
|
||||
|
||||
KUNIT_EXPECT_FALSE(test, blit_result);
|
||||
KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
|
||||
}
|
||||
|
||||
@@ -1266,14 +1206,8 @@ static void drm_test_fb_xrgb8888_to_abgr8888(struct kunit *test)
|
||||
const unsigned int *dst_pitch = (result->dst_pitch == TEST_USE_DEFAULT_PITCH) ?
|
||||
NULL : &result->dst_pitch;
|
||||
|
||||
int blit_result = 0;
|
||||
|
||||
blit_result = drm_fb_blit(&dst, dst_pitch, DRM_FORMAT_ABGR8888, &src, &fb, ¶ms->clip,
|
||||
&fmtcnv_state);
|
||||
|
||||
drm_fb_xrgb8888_to_abgr8888(&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state);
|
||||
buf = le32buf_to_cpu(test, (__force const __le32 *)buf, dst_size / sizeof(u32));
|
||||
|
||||
KUNIT_EXPECT_FALSE(test, blit_result);
|
||||
KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
|
||||
}
|
||||
|
||||
@@ -1306,14 +1240,8 @@ static void drm_test_fb_xrgb8888_to_xbgr8888(struct kunit *test)
|
||||
const unsigned int *dst_pitch = (result->dst_pitch == TEST_USE_DEFAULT_PITCH) ?
|
||||
NULL : &result->dst_pitch;
|
||||
|
||||
int blit_result = 0;
|
||||
|
||||
blit_result = drm_fb_blit(&dst, dst_pitch, DRM_FORMAT_XBGR8888, &src, &fb, ¶ms->clip,
|
||||
&fmtcnv_state);
|
||||
|
||||
drm_fb_xrgb8888_to_xbgr8888(&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state);
|
||||
buf = le32buf_to_cpu(test, (__force const __le32 *)buf, dst_size / sizeof(u32));
|
||||
|
||||
KUNIT_EXPECT_FALSE(test, blit_result);
|
||||
KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
|
||||
}
|
||||
|
||||
@@ -1910,12 +1838,8 @@ static void drm_test_fb_memcpy(struct kunit *test)
|
||||
memset(buf[i], 0, dst_size[i]);
|
||||
}
|
||||
|
||||
int blit_result;
|
||||
drm_fb_memcpy(dst, dst_pitches, src, &fb, ¶ms->clip);
|
||||
|
||||
blit_result = drm_fb_blit(dst, dst_pitches, params->format, src, &fb, ¶ms->clip,
|
||||
&fmtcnv_state);
|
||||
|
||||
KUNIT_EXPECT_FALSE(test, blit_result);
|
||||
for (size_t i = 0; i < fb.format->num_planes; i++) {
|
||||
expected[i] = cpubuf_to_le32(test, params->expected[i], TEST_BUF_SIZE);
|
||||
KUNIT_EXPECT_MEMEQ_MSG(test, buf[i], expected[i], dst_size[i],
|
||||
|
||||
Reference in New Issue
Block a user