Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5542A606A31C for ; Sat, 28 Nov 2026 17:34:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IPS1LNmA Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7789510E7B7; Sat, 28 Nov 2026 17:34:27 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7DE2F10E7B7 for ; Sat, 28 Nov 2026 17:34:20 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 93D4A602D4; Sat, 28 Nov 2026 17:34:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36DF31F00893; Sat, 28 Nov 2026 17:34:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795887259; bh=vSwuNaVWrDScg1FIwIz3ax0edJhO8Li6ODuAeZHCxZE=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=IPS1LNmAVLROonbGJt0MB1o0eKnyzd0rMcWfYFljiXPMwzshiMjV6zoW7KxuPLPoB oArti/bKOhNJpaCjpzpGmHfTvGIoc8HRSGnNIm43k6BIHCgfx1WbTxOJ1lpKPFB7JM 0xvrcykcTCkbb4DBiD+for3o1P4VeNp/a5vwTaGjeUK6SUWaL+9djKz8YZjVeY4Inf 0CEtBJ3fCExHBxQIqG7fpJWPm0+dI5f5dOiniLFb5EW99dvlfQCkpreEFvXuU6fete 3howT4s8PgNThHQdGV3YiG7SRn25H3IQtmbUKHszqJAXfHAhFrAN0Ub9+xTxzVBQ99 ZngYwiFGJn5xw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 5/7] drm/vkms: add a 3D LUT colorop To: "Oarora Etimis" Cc: dri-devel@lists.freedesktop.org In-Reply-To: <20261128-colorop-v1-5-dd79919f822b@gmail.com> References: <20261128-colorop-v1-0-dd79919f822b@gmail.com> <20261128-colorop-v1-5-dd79919f822b@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 28 Nov 2026 17:34:18 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: 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 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(c= onst struct drm_color_lut32 * > } > EXPORT_SYMBOL_IF_KUNIT(apply_lut32_to_channel_value); > =20 > +/* > + * 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 *lu= t, u32 size, > + enum lut_channel channel, u16 r, u16 g, u16 b) > +{ > + u32 max_index =3D 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 =3D (u64)r * max_index; > + r_index =3D position / U16_MAX; > + r_fraction =3D position - (u64)r_index * U16_MAX; > + > + position =3D (u64)g * max_index; > + g_index =3D position / U16_MAX; > + g_fraction =3D position - (u64)g_index * U16_MAX; > + > + position =3D (u64)b * max_index; > + b_index =3D position / U16_MAX; > + b_fraction =3D 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 =3D clamp_val(pixel->r, 0, 0xffff); > + u16 g =3D clamp_val(pixel->g, 0, 0xffff); > + u16 b =3D clamp_val(pixel->b, 0, 0xffff); > + > + if (size < 2) > + return; > + > + pixel->r =3D apply_3dlut_to_channel_value(lut, size, LUT_RED, r, g, b); > + pixel->g =3D apply_3dlut_to_channel_value(lut, size, LUT_GREEN, r, g, b= ); > + pixel->b =3D 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. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261128-colorop-v1= -0-dd79919f822b@gmail.com?part=3D5