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>,
"Singo Chang (張興國)" <Singo.Chang@mediatek.com>,
"juhapekka.heikkila@gmail.com" <juhapekka.heikkila@gmail.com>,
"jani.nikula@intel.com" <jani.nikula@intel.com>,
"swati2.sharma@intel.com" <swati2.sharma@intel.com>,
Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@mediatek.com>,
"bhanuprakash.modem@gmail.com" <bhanuprakash.modem@gmail.com>,
"Nancy Lin (林欣螢)" <Nancy.Lin@mediatek.com>,
"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
"kamil.konieczny@linux.intel.com"
<kamil.konieczny@linux.intel.com>,
"Paul-pl Chen (陳柏霖)" <Paul-pl.Chen@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: Tue, 10 Feb 2026 19:28:47 +0200 [thread overview]
Message-ID: <aYtqz9P6GC2_xgoq@intel.com> (raw)
In-Reply-To: <2baaf7f837b254b10688b697c7aaa62056079dce.camel@mediatek.com>
On Sat, Jan 31, 2026 at 11:52:02AM +0000, Jason-JH Lin (林睿祥) wrote:
> On Fri, 2026-01-30 at 17:19 +0200, Ville Syrjälä wrote:
>
> [snip]
>
> > > > > 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.
> >
> For MTK hardware, CTM values between 1.0 and 2.0 result in a gain
> effect, while values between 0 and 1.0 cause attenuation. Values above
> 2.0 are not supported by the hardware.
>
> Therefore, if the reference framebuffer generated by the CPU using CTM
> 2.0 does not match the hardware’s output, the CRC should theoretically
> be different. However, in our current tests, the CRC results for CTM
> 2.0 are actually identical.
>
> This means that CTM values greater than 1.0 may not be equivalent to
> CTM 1.0 in terms of output.
As I said IIRC the max-ctm test should only generate fully saturated
colors for any value >=1.0. So it shouldn't matter what the hardware
max is as long as it's >=1.0.
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2026-02-10 17:28 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ä
2026-01-31 11:52 ` Jason-JH Lin (林睿祥)
2026-02-10 17:28 ` Ville Syrjälä [this message]
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=aYtqz9P6GC2_xgoq@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