Subject: linux-next: manual merge of the drm-misc tree with Linus' tree

From: Stephen Rothwell <[email-masked]>
Date: Fri, 6 Jan 2023 10:50:42 +1100

Hi all,

Today's linux-next merge of the drm-misc tree got a conflict in:

  drivers/gpu/drm/tests/drm_format_helper_test.c

between commit:

  a52a5451f43b ("kunit: Use KUNIT_EXPECT_MEMEQ macro")

from Linus' tree and commits:

  f21d62c9ce3d ("drm/format-helper: Store RGB565 in little-endian order")
  175073d694cd ("drm/format-helper: Add conversion from XRGB8888 to ARGB8888")
  56119bfb3914 ("drm/format-helper: Add conversion from XRGB8888 to ARGB2101010")
  10cd592e639e ("drm/format-helper: Add conversion from XRGB8888 to 15-bit RGB555 formats")

from the drm-misc tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/gpu/drm/tests/drm_format_helper_test.c
index 567c71f95edc,f71dc0fe08a1..000000000000
--- a/drivers/gpu/drm/tests/drm_format_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_format_helper_test.c
@@@ -375,12 -560,108 +560,108 @@@ static void drm_test_fb_xrgb8888_to_rgb
  	iosys_map_set_vaddr(&src, xrgb8888);
  
  	drm_fb_xrgb8888_to_rgb565(&dst, &result->dst_pitch, &src, &fb, &params->clip, false);
+ 	buf = le16buf_to_cpu(test, (__force const __le16 *)buf, dst_size / sizeof(__le16));
 -	KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected, dst_size), 0);
 +	KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
  
+ 	buf = dst.vaddr; /* restore original value of buf */
  	drm_fb_xrgb8888_to_rgb565(&dst, &result->dst_pitch, &src, &fb, &params->clip, true);
+ 	buf = le16buf_to_cpu(test, (__force const __le16 *)buf, dst_size / sizeof(__le16));
 -	KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected_swab, dst_size), 0);
 +	KUNIT_EXPECT_MEMEQ(test, buf, result->expected_swab, dst_size);
  }
  
+ static void drm_test_fb_xrgb8888_to_xrgb1555(struct kunit *test)
+ {
+ 	const struct convert_xrgb8888_case *params = test->param_value;
+ 	const struct convert_to_xrgb1555_result *result = &params->xrgb1555_result;
+ 	size_t dst_size;
+ 	u16 *buf = NULL;
+ 	__le32 *xrgb8888 = NULL;
+ 	struct iosys_map dst, src;
+ 
+ 	struct drm_framebuffer fb = {
+ 		.format = drm_format_info(DRM_FORMAT_XRGB8888),
+ 		.pitches = { params->pitch, 0, 0 },
+ 	};
+ 
+ 	dst_size = conversion_buf_size(DRM_FORMAT_XRGB1555, result->dst_pitch,
+ 				       &params->clip);
+ 	KUNIT_ASSERT_GT(test, dst_size, 0);
+ 
+ 	buf = kunit_kzalloc(test, dst_size, GFP_KERNEL);
+ 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf);
+ 	iosys_map_set_vaddr(&dst, buf);
+ 
+ 	xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE);
+ 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888);
+ 	iosys_map_set_vaddr(&src, xrgb8888);
+ 
+ 	drm_fb_xrgb8888_to_xrgb1555(&dst, &result->dst_pitch, &src, &fb, &params->clip);
+ 	buf = le16buf_to_cpu(test, (__force const __le16 *)buf, dst_size / sizeof(__le16));
 -	KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected, dst_size), 0);
++	KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
+ }
+ 
+ static void drm_test_fb_xrgb8888_to_argb1555(struct kunit *test)
+ {
+ 	const struct convert_xrgb8888_case *params = test->param_value;
+ 	const struct convert_to_argb1555_result *result = &params->argb1555_result;
+ 	size_t dst_size;
+ 	u16 *buf = NULL;
+ 	__le32 *xrgb8888 = NULL;
+ 	struct iosys_map dst, src;
+ 
+ 	struct drm_framebuffer fb = {
+ 		.format = drm_format_info(DRM_FORMAT_XRGB8888),
+ 		.pitches = { params->pitch, 0, 0 },
+ 	};
+ 
+ 	dst_size = conversion_buf_size(DRM_FORMAT_ARGB1555, result->dst_pitch,
+ 				       &params->clip);
+ 	KUNIT_ASSERT_GT(test, dst_size, 0);
+ 
+ 	buf = kunit_kzalloc(test, dst_size, GFP_KERNEL);
+ 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf);
+ 	iosys_map_set_vaddr(&dst, buf);
+ 
+ 	xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE);
+ 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888);
+ 	iosys_map_set_vaddr(&src, xrgb8888);
+ 
+ 	drm_fb_xrgb8888_to_argb1555(&dst, &result->dst_pitch, &src, &fb, &params->clip);
+ 	buf = le16buf_to_cpu(test, (__force const __le16 *)buf, dst_size / sizeof(__le16));
 -	KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected, dst_size), 0);
++	KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
+ }
+ 
+ static void drm_test_fb_xrgb8888_to_rgba5551(struct kunit *test)
+ {
+ 	const struct convert_xrgb8888_case *params = test->param_value;
+ 	const struct convert_to_rgba5551_result *result = &params->rgba5551_result;
+ 	size_t dst_size;
+ 	u16 *buf = NULL;
+ 	__le32 *xrgb8888 = NULL;
+ 	struct iosys_map dst, src;
+ 
+ 	struct drm_framebuffer fb = {
+ 		.format = drm_format_info(DRM_FORMAT_XRGB8888),
+ 		.pitches = { params->pitch, 0, 0 },
+ 	};
+ 
+ 	dst_size = conversion_buf_size(DRM_FORMAT_RGBA5551, result->dst_pitch,
+ 				       &params->clip);
+ 	KUNIT_ASSERT_GT(test, dst_size, 0);
+ 
+ 	buf = kunit_kzalloc(test, dst_size, GFP_KERNEL);
+ 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf);
+ 	iosys_map_set_vaddr(&dst, buf);
+ 
+ 	xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE);
+ 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888);
+ 	iosys_map_set_vaddr(&src, xrgb8888);
+ 
+ 	drm_fb_xrgb8888_to_rgba5551(&dst, &result->dst_pitch, &src, &fb, &params->clip);
+ 	buf = le16buf_to_cpu(test, (__force const __le16 *)buf, dst_size / sizeof(__le16));
 -	KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected, dst_size), 0);
++	KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
+ }
+ 
  static void drm_test_fb_xrgb8888_to_rgb888(struct kunit *test)
  {
  	const struct convert_xrgb8888_case *params = test->param_value;
@@@ -407,10 -688,45 +688,45 @@@
  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888);
  	iosys_map_set_vaddr(&src, xrgb8888);
  
+ 	/*
+ 	 * RGB888 expected results are already in little-endian
+ 	 * order, so there's no need to convert the test output.
+ 	 */
  	drm_fb_xrgb8888_to_rgb888(&dst, &result->dst_pitch, &src, &fb, &params->clip);
 -	KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected, dst_size), 0);
 +	KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
  }
  
+ static void drm_test_fb_xrgb8888_to_argb8888(struct kunit *test)
+ {
+ 	const struct convert_xrgb8888_case *params = test->param_value;
+ 	const struct convert_to_argb8888_result *result = &params->argb8888_result;
+ 	size_t dst_size;
+ 	u32 *buf = NULL;
+ 	__le32 *xrgb8888 = NULL;
+ 	struct iosys_map dst, src;
+ 
+ 	struct drm_framebuffer fb = {
+ 		.format = drm_format_info(DRM_FORMAT_XRGB8888),
+ 		.pitches = { params->pitch, 0, 0 },
+ 	};
+ 
+ 	dst_size = conversion_buf_size(DRM_FORMAT_ARGB8888,
+ 				       result->dst_pitch, &params->clip);
+ 	KUNIT_ASSERT_GT(test, dst_size, 0);
+ 
+ 	buf = kunit_kzalloc(test, dst_size, GFP_KERNEL);
+ 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf);
+ 	iosys_map_set_vaddr(&dst, buf);
+ 
+ 	xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE);
+ 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888);
+ 	iosys_map_set_vaddr(&src, xrgb8888);
+ 
+ 	drm_fb_xrgb8888_to_argb8888(&dst, &result->dst_pitch, &src, &fb, &params->clip);
+ 	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_MEMEQ(test, buf, result->expected, dst_size);
+ }
+ 
  static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test)
  {
  	const struct convert_xrgb8888_case *params = test->param_value;
@@@ -438,8 -754,39 +754,39 @@@
  	iosys_map_set_vaddr(&src, xrgb8888);
  
  	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_MEMEQ(test, buf, result->expected, dst_size);
+ }
+ 
+ static void drm_test_fb_xrgb8888_to_argb2101010(struct kunit *test)
+ {
+ 	const struct convert_xrgb8888_case *params = test->param_value;
+ 	const struct convert_to_argb2101010_result *result = &params->argb2101010_result;
+ 	size_t dst_size;
+ 	u32 *buf = NULL;
+ 	__le32 *xrgb8888 = NULL;
+ 	struct iosys_map dst, src;
+ 
+ 	struct drm_framebuffer fb = {
+ 		.format = drm_format_info(DRM_FORMAT_XRGB8888),
+ 		.pitches = { params->pitch, 0, 0 },
+ 	};
+ 
+ 	dst_size = conversion_buf_size(DRM_FORMAT_ARGB2101010,
+ 				       result->dst_pitch, &params->clip);
+ 	KUNIT_ASSERT_GT(test, dst_size, 0);
+ 
+ 	buf = kunit_kzalloc(test, dst_size, GFP_KERNEL);
+ 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf);
+ 	iosys_map_set_vaddr(&dst, buf);
+ 
+ 	xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE);
+ 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888);
+ 	iosys_map_set_vaddr(&src, xrgb8888);
+ 
+ 	drm_fb_xrgb8888_to_argb2101010(&dst, &result->dst_pitch, &src, &fb, &params->clip);
+ 	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_MEMEQ(test, buf, result->expected, dst_size);
  }
  
  static struct kunit_case drm_format_helper_test_cases[] = {