Re: [PATCH] drm/format-helper: Make conversion_buf_size() support sub-byte pixel fmts

From: kernel test robot
Date: Tue Mar 07 2023 - 16:04:31 EST


Hi Javier,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on linus/master v6.3-rc1 next-20230307]
[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/Javier-Martinez-Canillas/drm-format-helper-Make-conversion_buf_size-support-sub-byte-pixel-fmts/20230308-033619
base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link: https://lore.kernel.org/r/20230307193457.331360-1-javierm%40redhat.com
patch subject: [PATCH] drm/format-helper: Make conversion_buf_size() support sub-byte pixel fmts
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230308/202303080420.T1VvHVxo-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/5f0f9d30de18661bdabebde361180893b8ddba27
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Javier-Martinez-Canillas/drm-format-helper-Make-conversion_buf_size-support-sub-byte-pixel-fmts/20230308-033619
git checkout 5f0f9d30de18661bdabebde361180893b8ddba27
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/gpu/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202303080420.T1VvHVxo-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/gpu/drm/tests/drm_format_helper_test.c: In function 'conversion_buf_size':
>> drivers/gpu/drm/tests/drm_format_helper_test.c:412:27: warning: variable 'cpp' set but not used [-Wunused-but-set-variable]
412 | unsigned int bpp, cpp;
| ^~~


vim +/cpp +412 drivers/gpu/drm/tests/drm_format_helper_test.c

397
398 /*
399 * conversion_buf_size - Return the destination buffer size required to convert
400 * between formats.
401 * @dst_format: destination buffer pixel format (DRM_FORMAT_*)
402 * @dst_pitch: Number of bytes between two consecutive scanlines within dst
403 * @clip: Clip rectangle area to convert
404 *
405 * Returns:
406 * The size of the destination buffer or negative value on error.
407 */
408 static size_t conversion_buf_size(u32 dst_format, unsigned int dst_pitch,
409 const struct drm_rect *clip)
410 {
411 const struct drm_format_info *dst_fi = drm_format_info(dst_format);
> 412 unsigned int bpp, cpp;
413
414 if (!dst_fi)
415 return -EINVAL;
416
417 if (!dst_pitch) {
418 bpp = drm_format_info_bpp(dst_fi, 0);
419 cpp = DIV_ROUND_UP(bpp, 8);
420 dst_pitch = DIV_ROUND_UP(drm_rect_width(clip) * bpp, 8);
421 }
422
423 return dst_pitch * drm_rect_height(clip);
424 }
425

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