[PATCH 6/6] drm/format-helper: Add KUnit tests for drm_fb_memcpy()

kernel test robot lkp at intel.com
Tue Jul 25 14:14:37 UTC 2023


Hi Arthur,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on drm/drm-next drm-exynos/exynos-drm-next drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-tip/drm-tip linus/master v6.5-rc3 next-20230725]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Arthur-Grillo/drm-format-helper-Test-default-pitch-fallback/20230722-022649
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/20230721182316.560649-7-arthurgrillo%40riseup.net
patch subject: [PATCH 6/6] drm/format-helper: Add KUnit tests for drm_fb_memcpy()
config: nios2-randconfig-r093-20230723 (https://download.01.org/0day-ci/archive/20230725/202307252148.wr2nafKj-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230725/202307252148.wr2nafKj-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202307252148.wr2nafKj-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
   drivers/gpu/drm/tests/drm_format_helper_test.c:856:36: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected restricted __le32 const [usertype] *buf @@     got unsigned int [usertype] *[assigned] buf @@
   drivers/gpu/drm/tests/drm_format_helper_test.c:856:36: sparse:     expected restricted __le32 const [usertype] *buf
   drivers/gpu/drm/tests/drm_format_helper_test.c:856:36: sparse:     got unsigned int [usertype] *[assigned] buf
   drivers/gpu/drm/tests/drm_format_helper_test.c:1058:34: sparse: sparse: symbol 'fb_build_fourcc_list_cases' was not declared. Should it be static?
>> drivers/gpu/drm/tests/drm_format_helper_test.c:1566:27: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] * @@     got restricted __le32 [usertype] * @@
   drivers/gpu/drm/tests/drm_format_helper_test.c:1566:27: sparse:     expected unsigned int [usertype] *
   drivers/gpu/drm/tests/drm_format_helper_test.c:1566:27: sparse:     got restricted __le32 [usertype] *
   drivers/gpu/drm/tests/drm_format_helper_test.c:1576:29: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] * @@     got restricted __le32 [usertype] * @@
   drivers/gpu/drm/tests/drm_format_helper_test.c:1576:29: sparse:     expected unsigned int [usertype] *
   drivers/gpu/drm/tests/drm_format_helper_test.c:1576:29: sparse:     got restricted __le32 [usertype] *

vim +1566 drivers/gpu/drm/tests/drm_format_helper_test.c

  1539	
  1540	static void drm_test_fb_memcpy(struct kunit *test)
  1541	{
  1542		const struct multi_plane_op_case *params = test->param_value;
  1543		const struct fb_memcpy_result *result = &params->memcpy_result;
  1544		size_t dst_size[DRM_FORMAT_MAX_PLANES] = { 0 };
  1545		u32 *buf[DRM_FORMAT_MAX_PLANES] = { 0 };
  1546		u32 *src_cp[DRM_FORMAT_MAX_PLANES] = { 0 };
  1547		u32 *expected[DRM_FORMAT_MAX_PLANES] = { 0 };
  1548		struct iosys_map dst[DRM_FORMAT_MAX_PLANES];
  1549		struct iosys_map src[DRM_FORMAT_MAX_PLANES];
  1550	
  1551		struct drm_framebuffer fb = {
  1552			.format = drm_format_info(params->format),
  1553		};
  1554	
  1555		memcpy(fb.pitches, params->src_pitches, DRM_FORMAT_MAX_PLANES * sizeof(int));
  1556	
  1557		for (size_t i = 0; i < fb.format->num_planes; i++) {
  1558			dst_size[i] = conversion_buf_size(params->format, result->dst_pitches[i],
  1559							  &params->clip, i);
  1560			KUNIT_ASSERT_GT(test, dst_size[i], 0);
  1561	
  1562			buf[i] = kunit_kzalloc(test, dst_size[i], GFP_KERNEL);
  1563			KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf[i]);
  1564			iosys_map_set_vaddr(&dst[i], buf[i]);
  1565	
> 1566			src_cp[i] = cpubuf_to_le32(test, params->src[i], TEST_BUF_SIZE);
  1567			iosys_map_set_vaddr(&src[i], src_cp[i]);
  1568		}
  1569	
  1570		if (result->dst_pitches[0] == TEST_USE_DEFAULT_PITCH)
  1571			drm_fb_memcpy(dst, NULL, src, &fb, &params->clip);
  1572		else
  1573			drm_fb_memcpy(dst, result->dst_pitches, src, &fb, &params->clip);
  1574	
  1575		for (size_t i = 0; i < fb.format->num_planes; i++) {
  1576			expected[i] = cpubuf_to_le32(test, result->expected[i], TEST_BUF_SIZE);
  1577			KUNIT_EXPECT_MEMEQ_MSG(test, buf[i], expected[i], dst_size[i],
  1578					       "Failed expectation on plane %zu", i);
  1579		}
  1580	}
  1581	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


More information about the dri-devel mailing list