[PATCH v3 04/11] drm/mediatek: gamma: Improve and simplify HW LUT calculation

kernel test robot lkp at intel.com
Sat May 6 15:19:02 UTC 2023


Hi AngeloGioacchino,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-misc/drm-misc-next]
[cannot apply to pza/imx-drm/next mbgg-mediatek/for-next]
[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/AngeloGioacchino-Del-Regno/drm-mediatek-gamma-Adjust-mtk_drm_gamma_set_common-parameters/20230506-203713
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/20230506123549.101727-5-angelogioacchino.delregno%40collabora.com
patch subject: [PATCH v3 04/11] drm/mediatek: gamma: Improve and simplify HW LUT calculation
config: arm-allmodconfig (https://download.01.org/0day-ci/archive/20230506/202305062349.SFNFiiWv-lkp@intel.com/config)
compiler: arm-linux-gnueabi-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/a933258d0ee5c49d54f70fe11d3b1d719d5b6087
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review AngeloGioacchino-Del-Regno/drm-mediatek-gamma-Adjust-mtk_drm_gamma_set_common-parameters/20230506-203713
        git checkout a933258d0ee5c49d54f70fe11d3b1d719d5b6087
        # 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=arm olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/gpu/drm/mediatek/

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

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/mediatek/mtk_disp_gamma.c: In function 'mtk_gamma_set_common':
>> drivers/gpu/drm/mediatek/mtk_disp_gamma.c:106:48: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
     106 |                         word = hwlut.red << 20 +
         |                                             ~~~^
     107 |                                hwlut.green << 10 +
         |                                ~~~~~~~~~~~      
   drivers/gpu/drm/mediatek/mtk_disp_gamma.c:107:50: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
     107 |                                hwlut.green << 10 +
         |                                               ~~~^
     108 |                                hwlut.red;
         |                                ~~~~~~~~~          
   drivers/gpu/drm/mediatek/mtk_disp_gamma.c:119:48: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
     119 |                         word = diff.blue << 20 +
         |                                             ~~~^
     120 |                                diff.green << 10 +
         |                                ~~~~~~~~~~       
   drivers/gpu/drm/mediatek/mtk_disp_gamma.c:120:49: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
     120 |                                diff.green << 10 +
         |                                              ~~~^
     121 |                                diff.red;
         |                                ~~~~~~~~          


vim +106 drivers/gpu/drm/mediatek/mtk_disp_gamma.c

    70	
    71	void mtk_gamma_set_common(struct device *dev, void __iomem *regs, struct drm_crtc_state *state)
    72	{
    73		struct mtk_disp_gamma *gamma = dev_get_drvdata(dev);
    74		unsigned int i, reg;
    75		struct drm_color_lut *lut;
    76		void __iomem *lut_base;
    77		bool lut_diff;
    78		u16 lut_size;
    79		u32 word;
    80	
    81		/* If there's no gamma lut there's nothing to do here. */
    82		if (!state->gamma_lut)
    83			return;
    84	
    85		if (gamma && gamma->data) {
    86			lut_diff = gamma->data->lut_diff;
    87			lut_size = gamma->data->lut_size;
    88		} else {
    89			lut_diff = false;
    90			lut_size = LUT_SIZE_DEFAULT;
    91		}
    92	
    93		reg = readl(regs + DISP_GAMMA_CFG);
    94		reg = reg | GAMMA_LUT_EN;
    95		writel(reg, regs + DISP_GAMMA_CFG);
    96		lut_base = regs + DISP_GAMMA_LUT;
    97		lut = (struct drm_color_lut *)state->gamma_lut->data;
    98		for (i = 0; i < lut_size; i++) {
    99			struct drm_color_lut diff, hwlut;
   100	
   101			hwlut.red = drm_color_lut_extract(lut[i].red, 10);
   102			hwlut.green = drm_color_lut_extract(lut[i].green, 10);
   103			hwlut.blue = drm_color_lut_extract(lut[i].blue, 10);
   104	
   105			if (!lut_diff || (i % 2 == 0)) {
 > 106				word = hwlut.red << 20 +
   107				       hwlut.green << 10 +
   108				       hwlut.red;
   109			} else {
   110				diff.red = lut[i].red - lut[i - 1].red;
   111				diff.red = drm_color_lut_extract(diff.red, 10);
   112	
   113				diff.green = lut[i].green - lut[i - 1].green;
   114				diff.green = drm_color_lut_extract(diff.green, 10);
   115	
   116				diff.blue = lut[i].blue - lut[i - 1].blue;
   117				diff.blue = drm_color_lut_extract(diff.blue, 10);
   118	
   119				word = diff.blue << 20 +
   120				       diff.green << 10 +
   121				       diff.red;
   122			}
   123			writel(word, (lut_base + i * 4));
   124		}
   125	}
   126	

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


More information about the dri-devel mailing list