Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] drm/vkms: raw 64-bit division in apply_3dlut_to_channel_value() breaks 32-bit build --
commit 069bec6d031e1f99c4351f4a1c421ad40f2e771c Author: Oarora Etimis <[email protected]> drm/vkms: add a 3D LUT colorop This commit adds a 17x17x17 3D LUT colorop with tetrahedral interpolation to the VKMS plane color pipeline. > diff --git a/drivers/gpu/drm/vkms/vkms_composer.c > b/drivers/gpu/drm/vkms/vkms_composer.c > index e00d1d0b2f2d9..51ac2ae75cf0c 100644 > --- a/drivers/gpu/drm/vkms/vkms_composer.c > +++ b/drivers/gpu/drm/vkms/vkms_composer.c > @@ -256,6 +256,115 @@ VISIBLE_IF_KUNIT u16 apply_lut32_to_channel_value(const > struct drm_color_lut32 * > } > EXPORT_SYMBOL_IF_KUNIT(apply_lut32_to_channel_value); > > +/* > + * Tetrahedral interpolation of one channel in a 3D LUT. The input value of > + * each axis selects a cell of the LUT; the fractions pick one of the six > + * tetrahedra the cell is split into, and the four corners of that > + * tetrahedron are weighted. > + */ > +static u16 apply_3dlut_to_channel_value(const struct drm_color_lut32 *lut, > u32 size, > + enum lut_channel channel, u16 r, u16 g, u16 b) > +{ > + u32 max_index = size - 1; > + u32 r_index, g_index, b_index; > + u32 r_fraction, g_fraction, b_fraction; > + const struct drm_color_lut32 *v000; > + u64 position, sum; > + u16 v000_c, v100_c, v010_c, v001_c; > + u16 v110_c, v101_c, v011_c, v111_c; > + > + position = (u64)r * max_index; > + r_index = position / U16_MAX; > + r_fraction = position - (u64)r_index * U16_MAX; > + > + position = (u64)g * max_index; > + g_index = position / U16_MAX; > + g_fraction = position - (u64)g_index * U16_MAX; > + > + position = (u64)b * max_index; > + b_index = position / U16_MAX; > + b_fraction = position - (u64)b_index * U16_MAX; [ ... ] > +VISIBLE_IF_KUNIT void apply_3dlut_to_pixel(struct pixel_argb_s32 *pixel, > + const struct drm_color_lut32 *lut, > + u32 size) > +{ > + u16 r = clamp_val(pixel->r, 0, 0xffff); > + u16 g = clamp_val(pixel->g, 0, 0xffff); > + u16 b = clamp_val(pixel->b, 0, 0xffff); > + > + if (size < 2) > + return; > + > + pixel->r = apply_3dlut_to_channel_value(lut, size, LUT_RED, r, g, b); > + pixel->g = apply_3dlut_to_channel_value(lut, size, LUT_GREEN, r, g, b); > + pixel->b = apply_3dlut_to_channel_value(lut, size, LUT_BLUE, r, g, b); > +} > +EXPORT_SYMBOL_IF_KUNIT(apply_3dlut_to_pixel); [Severity: High] Does dividing the u64 variable position with raw / U16_MAX break 32-bit builds with an undefined reference to __udivdi3? Using div_u64_rem(position, U16_MAX, &r_fraction) avoids the 64-bit division helper, and computing the cell indices and fractions once in apply_3dlut_to_pixel() would also avoid repeating the three divisions for each channel of every pixel. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=5
