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 31456606A322 for ; Fri, 4 Dec 2026 14:18:39 +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=HC4W42ZB Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8C87810E10A; Fri, 4 Dec 2026 14:18:33 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id D37D610E10A for ; Fri, 4 Dec 2026 14:18:27 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id E14B761AE1; Fri, 4 Dec 2026 14:18:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BAC21F000C2; Fri, 4 Dec 2026 14:18:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796393906; bh=j01tMgwy5xaJAp/ZRoSRZwZQ2GdwDduXxx8Yr7uMKSk=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=HC4W42ZBLyZBBAffJZwXoJiCmrfyfCFuKg3zq4Pk6lx8hm3rKGLR8LZUE4P/aUt9u zp2w0uovxbKPdzMHwVSzAg3tHYf4UAuQUcViz1PiNXbPBzoZBOd2IQzYIP1Kwmb1DJ nFLOlSwBNwHcrz3wlRKx4Nm0lUAOjkJMzFFZQpzTNsEnKU7cfKuMaEY5cXPs8wYNEf ULvhztJvNewzWTsybQI7ErLev+nwH8xHkhEizu93HI7u9Mayre4zC8smcEYmhfxZhh MQMbQLf0QaKHoTA9jmslzgnfvhiW/yt8IOs0hHBIa4JdkH1ZPzSIVM1ruQDbcSDsxs BR1V/mPmZh1BA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v1 3/4] drm/vkms: Add support for DRM_COLOROP_1D_CURVE_GAMMA22 To: "Robert Mader" , dri-devel@lists.freedesktop.org In-Reply-To: <20261204135131.195561-4-robert.mader@collabora.com> References: <20261204135131.195561-1-robert.mader@collabora.com> <20261204135131.195561-4-robert.mader@collabora.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 14:18:26 +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 3 potential issues to consider: - [Medium] drm/vkms: u16 sum overflow in vkms_color_test_inv_lut() masks test failures - [Medium] drm/vkms: gamma22_inv_eotf uses 4096-entry inv_pow22 LUT instead of 370 - [Low] drm/vkms: globally export KUnit-only gamma22 LUTs via EXPORT_SYMBOL() -- commit 59d26d74c99ba688971258bafc7bd1586364f0e8 Author: Robert Mader drm/vkms: Add support for DRM_COLOROP_1D_CURVE_GAMMA22 This commit adds Gamma 2.2 EOTF and inverse EOTF 1D curve colorop support to VKMS by defining non-uniform LUTs in vkms_luts.c, wiring them into vkms_colorop.c and vkms_composer.c, and adding a KUnit round-trip test. > diff --git a/drivers/gpu/drm/vkms/tests/vkms_color_test.c b/drivers/gpu/d= rm/vkms/tests/vkms_color_test.c > index 409e7a7d6861f..8a1cc8e3f774e 100644 > --- a/drivers/gpu/drm/vkms/tests/vkms_color_test.c > +++ b/drivers/gpu/drm/vkms/tests/vkms_color_test.c > @@ -151,6 +151,11 @@ static void vkms_color_srgb_inv_srgb(struct kunit *t= est) > vkms_color_test_inv_lut(test, &srgb_eotf, &srgb_inv_eotf, 11, 0); > } > =20 > +static void vkms_color_gamma22_inv_gamma22(struct kunit *test) > +{ > + vkms_color_test_inv_lut(test, &gamma22_eotf, &gamma22_inv_eotf, 304, 2); > +} > + [Severity: Medium] Can sum overflow in vkms_color_test_inv_lut() with tolerance_max set to 304? drivers/gpu/drm/vkms/tests/vkms_color_test.c:vkms_color_test_inv_lut() { u16 sum =3D 0; u16 count =3D 0; ... for (u32 i =3D 0; i <=3D 4095; i++) { ... sum +=3D abs((int)x - final); count++; } KUNIT_EXPECT_LE(test, sum / count, tolerance_avg); } Because sum is a u16, it wraps modulo 65536 once the average error over 4096 samples reaches 16. A broken LUT with an average error of 16 to 18 would wrap sum / count back to 0..2 and falsely pass the average tolerance check. Widening sum to u32 or u64 prevents the wraparound. [ ... ] > diff --git a/drivers/gpu/drm/vkms/vkms_luts.c b/drivers/gpu/drm/vkms/vkms= _luts.c > index 4b766ae7c1254..dcdeae68536f4 100644 > --- a/drivers/gpu/drm/vkms/vkms_luts.c > +++ b/drivers/gpu/drm/vkms/vkms_luts.c > @@ -706,3 +706,4947 @@ const struct vkms_color_lut srgb_inv_eotf =3D { > .lut_length =3D ARRAY_SIZE(srgb_inv_y) > }; > EXPORT_SYMBOL(srgb_inv_eotf); [ ... ] > +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); [Severity: Low] Should gamma22_eotf and gamma22_inv_eotf use EXPORT_SYMBOL_IF_KUNIT() instead of EXPORT_SYMBOL()? vkms_luts.o and vkms_composer.o link into vkms.o, so the only external user is vkms_color_test.c, which already imports EXPORTED_FOR_KUNIT_TESTING. Using EXPORT_SYMBOL_IF_KUNIT() avoids exposing these unprefixed internal structs in the global symbol table when CONFIG_KUNIT is disabled. [ ... ] > +static u16 inv_pow22_x[] =3D { [ ... ] > +static_assert(ARRAY_SIZE(inv_pow22_x) =3D=3D ARRAY_SIZE(inv_pow22_y), > + "pow22_inv x and y must have the same number of entries"); > + > +const struct vkms_color_lut gamma22_inv_eotf =3D { > + .x =3D inv_pow22_x, > + .y =3D inv_pow22_y, > + .lut_length =3D ARRAY_SIZE(inv_pow22_y) > +}; [Severity: Medium] Were inv_pow22_x and inv_pow22_y meant to have 370 entries instead of 4096? The commit message says the tables use the suggested sizes from color-curve-lut.py, which recommends 370 entries for inverse pow 2.2. The mismatch between the inv_pow22 names and the "pow22_inv" static_assert message also suggests stale 4096-entry output was pasted here. Embedding 4096 entries adds ~37 KiB of redundant static data to vkms.ko (mostly repeating identical quantized values across 0xf240..0xffff), pushes the table past a 32 KiB L1 data cache, and increases the per-channel binary search in apply_non_uniform_lut() from 9 to 12 iterations. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204135131.1955= 61-1-robert.mader@collabora.com?part=3D3