From mboxrd@z Thu Jan 1 00:00:00 1970 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 6C7FF606A32D for ; Fri, 4 Dec 2026 15:10:13 +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=kHjQqLwG Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D10A4113081; Fri, 4 Dec 2026 15:10:07 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 04244113081 for ; Fri, 4 Dec 2026 15:10:01 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id C939F41567; Fri, 4 Dec 2026 15:10:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9881A1F000CE; Fri, 4 Dec 2026 15:10:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796397000; bh=vF3Z5BfFYgqIiVhp+XnDFo5CSH+3YfwYwwzc35FR+p0=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=kHjQqLwGprlz/ZI1X7mTKupwZBa5w0smsKu2MME2TVVpOlWate/DFNGg8ZewWpxfD VNlhVFoUgRPFsLJfTmQWOY4uUCq+81H7koC+pt7bceOBrbz7zyCKHTVQf8qd2ffbIq z4Zsb1n2E+iKJuXYOgGCiJWITFoy2sMAUlDF4VHec0CZkX7/eQ9tzsb0bgXAI/NcQY AaiWN1ZLNkWzEuLasia+TLuTcdbjLE9JRjgC4j7aGR8yybG/WrhHyC1k2uPnqgJAin U/cNuqjUWFiFQL6OcV7iFtAOZFSVnfJf0Ov+g5SR4551jqOBXtq69cKPz5SvyU8lpg w5UvLbe7SnhyQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 3/4] drm/vkms: Add support for DRM_COLOROP_1D_CURVE_GAMMA22 To: "Robert Mader" , dri-devel@lists.freedesktop.org In-Reply-To: <20261204145427.221618-4-robert.mader@collabora.com> References: <20261204145427.221618-1-robert.mader@collabora.com> <20261204145427.221618-4-robert.mader@collabora.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 15:10:00 +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=-11.2 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 2 potential issues to consider: - [Medium] drm/vkms: unclamped s32-to-u16 wraparound in apply_colorop() 1D curve LUTs - [Low] drm/vkms: globally export KUnit-only gamma22 LUTs via EXPORT_SYMBOL() -- commit b0ad0319d06f1020df30009f35dd9bb1429d38fb Author: Robert Mader drm/vkms: Add support for DRM_COLOROP_1D_CURVE_GAMMA22 This commit adds non-uniform LUTs and colorop handling for the Gamma 2.2 EOTF and its inverse, along with a KUnit round-trip test. > diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/= vkms_composer.c > index 7a6a7875520ca..8eaad80ad4697 100644 > --- a/drivers/gpu/drm/vkms/vkms_composer.c > +++ b/drivers/gpu/drm/vkms/vkms_composer.c > @@ -264,6 +264,19 @@ static void apply_colorop(struct pixel_argb_s32 *pix= el, struct drm_colorop *colo > pixel->g =3D apply_lut_to_channel_value(&srgb_eotf, pixel->g, LUT_GRE= EN); > pixel->b =3D apply_lut_to_channel_value(&srgb_eotf, pixel->b, LUT_BLU= E); > break; > + case DRM_COLOROP_1D_CURVE_GAMMA22: > + pixel->r =3D apply_lut_to_channel_value(&gamma22_eotf, pixel->r, LUT_= RED); > + pixel->g =3D apply_lut_to_channel_value(&gamma22_eotf, pixel->g, LUT_= GREEN); > + pixel->b =3D apply_lut_to_channel_value(&gamma22_eotf, pixel->b, LUT_= BLUE); > + break; > + case DRM_COLOROP_1D_CURVE_GAMMA22_INV: > + pixel->r =3D apply_lut_to_channel_value(&gamma22_inv_eotf, pixel->r, > + LUT_RED); > + pixel->g =3D apply_lut_to_channel_value(&gamma22_inv_eotf, pixel->g, > + LUT_GREEN); > + pixel->b =3D apply_lut_to_channel_value(&gamma22_inv_eotf, pixel->b, > + LUT_BLUE); > + break; [Severity: Medium] Can passing pixel->r, pixel->g, and pixel->b directly to apply_lut_to_channel_value() wrap out-of-range values modulo 65536? pre_blend_color_transform() runs the pipeline in struct pixel_argb_s32 and only clamps channels to [0, 0xffff] after all colorops finish. Because vkms_initialize_color_pipeline() places a 1D curve stage after the 3x4 CTM stages, out-of-range CTM outputs reach this lookup as unclamped s32 values. Since apply_lut_to_channel_value() takes a u16 channel_value, implicit narrowing turns -1 into 0xffff and 0x10000 into 0x0000, corrupting rendered pixels and CRCs. Clamping to [0, 0xffff] before the lookup avoids this. [ ... ] > diff --git a/drivers/gpu/drm/vkms/vkms_luts.c b/drivers/gpu/drm/vkms/vkms= _luts.c > index 4b766ae7c1254..5778226fc290f 100644 > --- a/drivers/gpu/drm/vkms/vkms_luts.c > +++ b/drivers/gpu/drm/vkms/vkms_luts.c [ ... ] > +const struct vkms_color_lut gamma22_eotf =3D { > + .x =3D pow22_x, > + .y =3D pow22_y, > + .lut_length =3D ARRAY_SIZE(pow22_y) > +}; > +EXPORT_SYMBOL(gamma22_eotf); [ ... ] > +const struct vkms_color_lut gamma22_inv_eotf =3D { > + .x =3D pow22_inv_x, > + .y =3D pow22_inv_y, > + .lut_length =3D ARRAY_SIZE(pow22_inv_y) > +}; > +EXPORT_SYMBOL(gamma22_inv_eotf); [Severity: Low] Should gamma22_eotf and gamma22_inv_eotf use EXPORT_SYMBOL_IF_KUNIT() instead of EXPORT_SYMBOL()? vkms_luts.o is linked into vkms.o with vkms_composer.o, so the only external user is vkms_color_test.c, which already imports the EXPORTED_FOR_KUNIT_TESTING namespace. EXPORT_SYMBOL() exports these unprefixed names globally even without KUnit, risking symbol collisions. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204145427.2216= 18-1-robert.mader@collabora.com?part=3D3