tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 840126e36e8ff272cb63158646433fa1324533d9 commit: 3675d8a1726337bd1e839a185e0a7ce0bc459b6b [4880/5667] drm: vkms: Adds XRGB_16161616 and ARGB_1616161616 formats config: csky-randconfig-s031-20220906 (https://download.01.org/0day-ci/archive/20220907/202209071624.Tiz3qnm8-lkp@xxxxxxxxx/config) compiler: csky-linux-gcc (GCC) 12.1.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.4-39-gce1a6720-dirty # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=3675d8a1726337bd1e839a185e0a7ce0bc459b6b git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git fetch --no-tags linux-next master git checkout 3675d8a1726337bd1e839a185e0a7ce0bc459b6b # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=csky SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <lkp@xxxxxxxxx> sparse warnings: (new ones prefixed by >>) >> drivers/gpu/drm/vkms/vkms_formats.c:91:35: sparse: sparse: cast to restricted __le16 drivers/gpu/drm/vkms/vkms_formats.c:92:35: sparse: sparse: cast to restricted __le16 drivers/gpu/drm/vkms/vkms_formats.c:93:35: sparse: sparse: cast to restricted __le16 drivers/gpu/drm/vkms/vkms_formats.c:94:35: sparse: sparse: cast to restricted __le16 drivers/gpu/drm/vkms/vkms_formats.c:109:35: sparse: sparse: cast to restricted __le16 drivers/gpu/drm/vkms/vkms_formats.c:110:35: sparse: sparse: cast to restricted __le16 drivers/gpu/drm/vkms/vkms_formats.c:111:35: sparse: sparse: cast to restricted __le16 >> drivers/gpu/drm/vkms/vkms_formats.c:177:31: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] @@ got restricted __le16 [usertype] @@ drivers/gpu/drm/vkms/vkms_formats.c:177:31: sparse: expected unsigned short [usertype] drivers/gpu/drm/vkms/vkms_formats.c:177:31: sparse: got restricted __le16 [usertype] drivers/gpu/drm/vkms/vkms_formats.c:178:31: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] @@ got restricted __le16 [usertype] @@ drivers/gpu/drm/vkms/vkms_formats.c:178:31: sparse: expected unsigned short [usertype] drivers/gpu/drm/vkms/vkms_formats.c:178:31: sparse: got restricted __le16 [usertype] drivers/gpu/drm/vkms/vkms_formats.c:179:31: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] @@ got restricted __le16 [usertype] @@ drivers/gpu/drm/vkms/vkms_formats.c:179:31: sparse: expected unsigned short [usertype] drivers/gpu/drm/vkms/vkms_formats.c:179:31: sparse: got restricted __le16 [usertype] drivers/gpu/drm/vkms/vkms_formats.c:180:31: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] @@ got restricted __le16 [usertype] @@ drivers/gpu/drm/vkms/vkms_formats.c:180:31: sparse: expected unsigned short [usertype] drivers/gpu/drm/vkms/vkms_formats.c:180:31: sparse: got restricted __le16 [usertype] drivers/gpu/drm/vkms/vkms_formats.c:195:31: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] @@ got restricted __le16 [usertype] @@ drivers/gpu/drm/vkms/vkms_formats.c:195:31: sparse: expected unsigned short [usertype] drivers/gpu/drm/vkms/vkms_formats.c:195:31: sparse: got restricted __le16 [usertype] drivers/gpu/drm/vkms/vkms_formats.c:196:31: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] @@ got restricted __le16 [usertype] @@ drivers/gpu/drm/vkms/vkms_formats.c:196:31: sparse: expected unsigned short [usertype] drivers/gpu/drm/vkms/vkms_formats.c:196:31: sparse: got restricted __le16 [usertype] drivers/gpu/drm/vkms/vkms_formats.c:197:31: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] @@ got restricted __le16 [usertype] @@ drivers/gpu/drm/vkms/vkms_formats.c:197:31: sparse: expected unsigned short [usertype] drivers/gpu/drm/vkms/vkms_formats.c:197:31: sparse: got restricted __le16 [usertype] vim +91 drivers/gpu/drm/vkms/vkms_formats.c 80 81 static void ARGB16161616_to_argb_u16(struct line_buffer *stage_buffer, 82 const struct vkms_frame_info *frame_info, 83 int y) 84 { 85 struct pixel_argb_u16 *out_pixels = stage_buffer->pixels; 86 u16 *src_pixels = get_packed_src_addr(frame_info, y); 87 int x_limit = min_t(size_t, drm_rect_width(&frame_info->dst), 88 stage_buffer->n_pixels); 89 90 for (size_t x = 0; x < x_limit; x++, src_pixels += 4) { > 91 out_pixels[x].a = le16_to_cpu(src_pixels[3]); 92 out_pixels[x].r = le16_to_cpu(src_pixels[2]); 93 out_pixels[x].g = le16_to_cpu(src_pixels[1]); 94 out_pixels[x].b = le16_to_cpu(src_pixels[0]); 95 } 96 } 97 98 static void XRGB16161616_to_argb_u16(struct line_buffer *stage_buffer, 99 const struct vkms_frame_info *frame_info, 100 int y) 101 { 102 struct pixel_argb_u16 *out_pixels = stage_buffer->pixels; 103 u16 *src_pixels = get_packed_src_addr(frame_info, y); 104 int x_limit = min_t(size_t, drm_rect_width(&frame_info->dst), 105 stage_buffer->n_pixels); 106 107 for (size_t x = 0; x < x_limit; x++, src_pixels += 4) { 108 out_pixels[x].a = (u16)0xffff; 109 out_pixels[x].r = le16_to_cpu(src_pixels[2]); 110 out_pixels[x].g = le16_to_cpu(src_pixels[1]); 111 out_pixels[x].b = le16_to_cpu(src_pixels[0]); 112 } 113 } 114 115 /* 116 * The following functions take an line of argb_u16 pixels from the 117 * src_buffer, convert them to a specific format, and store them in the 118 * destination. 119 * 120 * They are used in the `compose_active_planes` to convert and store a line 121 * from the src_buffer to the writeback buffer. 122 */ 123 static void argb_u16_to_ARGB8888(struct vkms_frame_info *frame_info, 124 const struct line_buffer *src_buffer, int y) 125 { 126 int x_dst = frame_info->dst.x1; 127 u8 *dst_pixels = packed_pixels_addr(frame_info, x_dst, y); 128 struct pixel_argb_u16 *in_pixels = src_buffer->pixels; 129 int x_limit = min_t(size_t, drm_rect_width(&frame_info->dst), 130 src_buffer->n_pixels); 131 132 for (size_t x = 0; x < x_limit; x++, dst_pixels += 4) { 133 /* 134 * This sequence below is important because the format's byte order is 135 * in little-endian. In the case of the ARGB8888 the memory is 136 * organized this way: 137 * 138 * | Addr | = blue channel 139 * | Addr + 1 | = green channel 140 * | Addr + 2 | = Red channel 141 * | Addr + 3 | = Alpha channel 142 */ 143 dst_pixels[3] = DIV_ROUND_CLOSEST(in_pixels[x].a, 257); 144 dst_pixels[2] = DIV_ROUND_CLOSEST(in_pixels[x].r, 257); 145 dst_pixels[1] = DIV_ROUND_CLOSEST(in_pixels[x].g, 257); 146 dst_pixels[0] = DIV_ROUND_CLOSEST(in_pixels[x].b, 257); 147 } 148 } 149 150 static void argb_u16_to_XRGB8888(struct vkms_frame_info *frame_info, 151 const struct line_buffer *src_buffer, int y) 152 { 153 int x_dst = frame_info->dst.x1; 154 u8 *dst_pixels = packed_pixels_addr(frame_info, x_dst, y); 155 struct pixel_argb_u16 *in_pixels = src_buffer->pixels; 156 int x_limit = min_t(size_t, drm_rect_width(&frame_info->dst), 157 src_buffer->n_pixels); 158 159 for (size_t x = 0; x < x_limit; x++, dst_pixels += 4) { 160 dst_pixels[3] = 0xff; 161 dst_pixels[2] = DIV_ROUND_CLOSEST(in_pixels[x].r, 257); 162 dst_pixels[1] = DIV_ROUND_CLOSEST(in_pixels[x].g, 257); 163 dst_pixels[0] = DIV_ROUND_CLOSEST(in_pixels[x].b, 257); 164 } 165 } 166 167 static void argb_u16_to_ARGB16161616(struct vkms_frame_info *frame_info, 168 const struct line_buffer *src_buffer, int y) 169 { 170 int x_dst = frame_info->dst.x1; 171 u16 *dst_pixels = packed_pixels_addr(frame_info, x_dst, y); 172 struct pixel_argb_u16 *in_pixels = src_buffer->pixels; 173 int x_limit = min_t(size_t, drm_rect_width(&frame_info->dst), 174 src_buffer->n_pixels); 175 176 for (size_t x = 0; x < x_limit; x++, dst_pixels += 4) { > 177 dst_pixels[3] = cpu_to_le16(in_pixels[x].a); 178 dst_pixels[2] = cpu_to_le16(in_pixels[x].r); 179 dst_pixels[1] = cpu_to_le16(in_pixels[x].g); 180 dst_pixels[0] = cpu_to_le16(in_pixels[x].b); 181 } 182 } 183 -- 0-DAY CI Kernel Test Service https://01.org/lkp