From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Jason-JH Lin (林睿祥)" <Jason-JH.Lin@mediatek.com>
Cc: "karthik.b.s@intel.com" <karthik.b.s@intel.com>,
"swati2.sharma@intel.com" <swati2.sharma@intel.com>,
"juhapekka.heikkila@gmail.com" <juhapekka.heikkila@gmail.com>,
"jani.nikula@intel.com" <jani.nikula@intel.com>,
"Singo Chang (張興國)" <Singo.Chang@mediatek.com>,
"Nancy Lin (林欣螢)" <Nancy.Lin@mediatek.com>,
"bhanuprakash.modem@gmail.com" <bhanuprakash.modem@gmail.com>,
"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
"Paul-pl Chen (陳柏霖)" <Paul-pl.Chen@mediatek.com>,
"kamil.konieczny@linux.intel.com"
<kamil.konieczny@linux.intel.com>,
Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@mediatek.com>,
"gildekel@google.com" <gildekel@google.com>,
"fshao@chromium.org" <fshao@chromium.org>,
"markyacoub@chromium.org" <markyacoub@chromium.org>
Subject: Re: [PATCH i-g-t 1/2] test/kms_color: Clamp CTM values to -2.0~2.0 for MediaTek devices
Date: Fri, 30 Jan 2026 17:19:28 +0200 [thread overview]
Message-ID: <aXzMAJT6ffwgpqZW@intel.com> (raw)
In-Reply-To: <46faee5462bfcdc4e40fabaa6d9bc830fb2c51df.camel@mediatek.com>
On Fri, Jan 30, 2026 at 01:32:05PM +0000, Jason-JH Lin (林睿祥) wrote:
> On Thu, 2026-01-29 at 13:15 +0200, Ville Syrjälä wrote:
> > On Wed, Jan 28, 2026 at 04:24:42PM +0800, Jason-JH Lin wrote:
> > > Use clamp to restrict CTM matrix values to the -2.0 to 2.0 range
> > > for
> > > MediaTek devices, ensuring tests do not exceed hardware limits.
> > >
> > > Signed-off-by: Jason-JH Lin <jason-jh.lin@mediatek.com>
> > > ---
> > > tests/kms_color.c | 19 +++++++++++++++++--
> > > 1 file changed, 17 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/tests/kms_color.c b/tests/kms_color.c
> > > index b2ca6975d6a5..c6cd35d74a2f 100644
> > > --- a/tests/kms_color.c
> > > +++ b/tests/kms_color.c
> > > @@ -76,6 +76,8 @@
> > > * @gamma-lut: Gamma LUT
> > > */
> > >
> > > +#define CTM_SIZE (9)
> > > +
> > > IGT_TEST_DESCRIPTION("Test Color Features at Pipe level");
> > >
> > > static bool test_pipe_degamma(data_t *data,
> > > @@ -1025,7 +1027,7 @@ run_tests_for_pipe(data_t *data)
> > > const char *name;
> > > int iter;
> > > const color_t *fb_colors;
> > > - double ctm[9];
> > > + double ctm[CTM_SIZE];
> > > const char *desc;
> > > } ctm_tests[] = {
> > > { .name = "ctm-red-to-blue",
> > > @@ -1128,6 +1130,19 @@ run_tests_for_pipe(data_t *data)
> > > }
> > >
> > > for (i = 0; i < ARRAY_SIZE(ctm_tests); i++) {
> > > + double fixed_ctm[CTM_SIZE];
> > > + const double *ctm_ptr = ctm_tests[i].ctm;
> > > +
> > > + /* The valid value of MediaTek color matrix range
> > > is -2.0 ~ 2.0 */
> > > + if (is_mtk_device(data->drm_fd)) {
> > > + int j;
> > > +
> > > + for (j = 0; j < CTM_SIZE; j++)
> > > + fixed_ctm[j] =
> > > clamp(ctm_tests[i].ctm[j], -2.0, 2.0);
> > > +
> > > + ctm_ptr = fixed_ctm;
> > > + }
> >
> > The kernel is supposed to clamp this.
>
> Thanks for the reviews!
>
> The reason I added the clamp in here is that, without it, IGT will
> generate a reference framebuffer using CTM=100.0 on the CPU side, then
> send CTM1.0 to kernel.
> IGT will generate another framebuffer using CTM=1.0, then send
> CTM=100.0 to the kernel.
>
> The kernel will clamp the CTM from 100.0 to 2.0 due to hardware limits,
> so the hardware output will not match the CPU-generated reference,
> resulting in a CRC mismatch and a test failure.
>
> Therefore, I think I need to clamp CTM from 100.0 to 2.0 before IGT
> generating a reference framebuffer on CPU side.
IIRC the way the test does things is that with the 100.0 (or
whatever >1.0) the colors should end up fully saturated anyway.
So whether it used 2.0 or 100.0 shouldn't matter.
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2026-01-30 15:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 8:24 [PATCH i-g-t 0/2] Add MediaTek CTM color test support Jason-JH Lin
2026-01-28 8:24 ` [PATCH i-g-t 1/2] test/kms_color: Clamp CTM values to -2.0~2.0 for MediaTek devices Jason-JH Lin
2026-01-29 11:00 ` Kamil Konieczny
2026-01-29 11:15 ` Ville Syrjälä
2026-01-29 11:42 ` Kamil Konieczny
2026-01-30 13:32 ` Jason-JH Lin (林睿祥)
2026-01-30 15:19 ` Ville Syrjälä [this message]
2026-01-31 11:52 ` Jason-JH Lin (林睿祥)
2026-02-10 17:28 ` Ville Syrjälä
2026-02-11 10:51 ` Jason-JH Lin (林睿祥)
2026-02-11 12:44 ` Kamil Konieczny
2026-01-28 8:24 ` [PATCH i-g-t 2/2] tests/kms_color: Add 10-bit color depth support to CTM test for MediaTek Jason-JH Lin
2026-01-29 11:07 ` Kamil Konieczny
2026-01-28 9:50 ` ✓ Xe.CI.BAT: success for Add MediaTek CTM color test support Patchwork
2026-01-28 10:57 ` ✓ i915.CI.BAT: " Patchwork
2026-01-28 16:12 ` ✗ i915.CI.Full: failure " Patchwork
2026-01-29 11:09 ` Kamil Konieczny
2026-02-10 10:15 ` [PATCH i-g-t 0/2] " Jason-JH Lin (林睿祥)
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=aXzMAJT6ffwgpqZW@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=Jason-JH.Lin@mediatek.com \
--cc=Nancy.Lin@mediatek.com \
--cc=Paul-pl.Chen@mediatek.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=Singo.Chang@mediatek.com \
--cc=bhanuprakash.modem@gmail.com \
--cc=fshao@chromium.org \
--cc=gildekel@google.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=juhapekka.heikkila@gmail.com \
--cc=kamil.konieczny@linux.intel.com \
--cc=karthik.b.s@intel.com \
--cc=markyacoub@chromium.org \
--cc=swati2.sharma@intel.com \
/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