dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Robert Mader" <robert.mader@collabora.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v1 4/4] drm/vkms: Add support for DRM_COLOROP_1D_CURVE_GAMMA24
Date: Fri, 04 Dec 2026 14:35:40 +0000	[thread overview]
Message-ID: <sashiko-outbox-249985@kernel.org> (raw)
In-Reply-To: <20261204135131.195561-5-robert.mader@collabora.com>

Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [High] drm/vkms: undeclared DRM_COLOROP_1D_CURVE_GAMMA24 constants
  break build
- [Medium] drm/vkms: u16 sum overflow in vkms_color_test_inv_lut()
- [Low] drm/vkms: commit message references pow22 instead of pow24
- [Low] drm/vkms: unconditional EXPORT_SYMBOL() for test-only Gamma 2.4
  LUTs
--

commit 4fadd67a1786c5a41648858b25f1d109b7e89b77
Author: Robert Mader <robert.mader@collabora.com>

drm/vkms: Add support for DRM_COLOROP_1D_CURVE_GAMMA24

This commit adds Gamma 2.4 and inverse Gamma 2.4 LUTs, wires them into
VKMS 1D curve colorops, updates the LUT generation script, and adds a
KUnit round-trip test.

> And its inverse, using the pow22 function from the script.

[Severity: Low]
Should this say pow24 instead of pow22?  The patch adds pow24 and
pow24_inv to color-curve-lut.py and uses them to generate the Gamma 2.4
LUTs.

[ ... ]

> diff --git a/drivers/gpu/drm/vkms/tests/vkms_color_test.c b/drivers/gpu/drm/vkms/tests/vkms_color_test.c
> index 8a1cc8e3f774e..ee0a5599a1ada 100644
> --- a/drivers/gpu/drm/vkms/tests/vkms_color_test.c
> +++ b/drivers/gpu/drm/vkms/tests/vkms_color_test.c
> @@ -156,6 +156,11 @@ static void vkms_color_gamma22_inv_gamma22(struct kunit *test)
>  	vkms_color_test_inv_lut(test, &gamma22_eotf, &gamma22_inv_eotf, 304, 2);
>  }
>  
> +static void vkms_color_gamma24_inv_gamma24(struct kunit *test)
> +{
> +	vkms_color_test_inv_lut(test, &gamma24_eotf, &gamma24_inv_eotf, 389, 3);
> +}

[Severity: Medium]
Can the u16 sum accumulator in vkms_color_test_inv_lut() overflow here?

drivers/gpu/drm/vkms/tests/vkms_color_test.c:vkms_color_test_inv_lut() {
	u16 sum = 0;
...
	for (u32 i = 0; i <= 4095; i++) {
		...
		sum += abs((int)x - final);
		count++;
	}

	KUNIT_EXPECT_LE(test, sum / count, tolerance_avg);
}

With 4096 samples and tolerance_max set to 389, sum wraps modulo 65536
as soon as the mean error reaches 16.  A regressed LUT with a mean error
between 16 and 19 wraps sum / count back to 0..3 and silently passes the
tolerance_avg check.  Changing sum to u32 avoids the wraparound.

[ ... ]

> diff --git a/drivers/gpu/drm/vkms/vkms_colorop.c b/drivers/gpu/drm/vkms/vkms_colorop.c
> index 625a590c6a2fe..db16d7e2a42fe 100644
> --- a/drivers/gpu/drm/vkms/vkms_colorop.c
> +++ b/drivers/gpu/drm/vkms/vkms_colorop.c
> @@ -12,7 +12,9 @@ static const u64 supported_tfs =
>  	BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF) |
>  	BIT(DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF) |
>  	BIT(DRM_COLOROP_1D_CURVE_GAMMA22) |
> -	BIT(DRM_COLOROP_1D_CURVE_GAMMA22_INV);
> +	BIT(DRM_COLOROP_1D_CURVE_GAMMA22_INV) |
> +	BIT(DRM_COLOROP_1D_CURVE_GAMMA24) |
> +	BIT(DRM_COLOROP_1D_CURVE_GAMMA24_INV);

[Severity: High]
Are DRM_COLOROP_1D_CURVE_GAMMA24 and DRM_COLOROP_1D_CURVE_GAMMA24_INV
declared anywhere in the tree?

enum drm_colorop_curve_1d_type in include/drm/drm_colorop.h and
colorop_curve_1d_type_names[] in drivers/gpu/drm/drm_colorop.c both stop
at DRM_COLOROP_1D_CURVE_GAMMA22_INV, so this and the matching switch
cases in apply_colorop() fail to compile when CONFIG_DRM_VKMS is enabled.

A prerequisite DRM core patch defining both enum values and their
property name strings is needed first.

[ ... ]

> diff --git a/drivers/gpu/drm/vkms/vkms_luts.c b/drivers/gpu/drm/vkms/vkms_luts.c
> index dcdeae68536f4..fb7d56c062187 100644
> --- a/drivers/gpu/drm/vkms/vkms_luts.c
> +++ b/drivers/gpu/drm/vkms/vkms_luts.c
> @@ -5650,3 +5650,857 @@ const struct vkms_color_lut gamma22_inv_eotf = {
[ ... ]
> +const struct vkms_color_lut gamma24_eotf = {
> +	.x = pow24_x,
> +	.y = pow24_y,
> +	.lut_length = ARRAY_SIZE(pow24_y)
> +};
> +EXPORT_SYMBOL(gamma24_eotf);
[ ... ]
> +const struct vkms_color_lut gamma24_inv_eotf = {
> +	.x = pow24_inv_x,
> +	.y = pow24_inv_y,
> +	.lut_length = ARRAY_SIZE(pow24_inv_y)
> +};
> +EXPORT_SYMBOL(gamma24_inv_eotf);

[Severity: Low]
Should gamma24_eotf and gamma24_inv_eotf use EXPORT_SYMBOL_IF_KUNIT()
instead of EXPORT_SYMBOL()?

Their only external user is vkms_color_test.c, which already imports the
EXPORTED_FOR_KUNIT_TESTING namespace.  Unconditionally exporting generic,
unprefixed names into the global kernel symbol table risks symbol
collisions across modules when KUnit is disabled.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204135131.195561-1-robert.mader@collabora.com?part=4

      reply	other threads:[~2026-12-04 14:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 13:50 [PATCH v1 0/4] drm/vkms: Add gamma 2.2 and 2.4 1D curve colorops Robert Mader
2026-12-04 13:50 ` [PATCH v1 1/4] drm/vkms: Fix inverse lut naming scheme in script Robert Mader
2026-12-04 13:50 ` [PATCH v1 2/4] drm/vkms: Make LUT test reusable Robert Mader
2026-12-04 14:02   ` sashiko-bot
2026-12-04 13:50 ` [PATCH v1 3/4] drm/vkms: Add support for DRM_COLOROP_1D_CURVE_GAMMA22 Robert Mader
2026-12-04 14:18   ` sashiko-bot
2026-12-04 13:50 ` [PATCH v1 4/4] drm/vkms: Add support for DRM_COLOROP_1D_CURVE_GAMMA24 Robert Mader
2026-12-04 14:35   ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-249985@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robert.mader@collabora.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox