public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Jay Liu (刘博)" <Jay.Liu@mediatek.com>
To: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"jani.nikula@intel.com" <jani.nikula@intel.com>
Cc: "swati2.sharma@intel.com" <swati2.sharma@intel.com>,
	"Singo Chang (張興國)" <Singo.Chang@mediatek.com>,
	"Paul-pl Chen (陳柏霖)" <Paul-pl.Chen@mediatek.com>,
	"Jason-JH Lin (林睿祥)" <Jason-JH.Lin@mediatek.com>,
	"Nancy Lin (林欣螢)" <Nancy.Lin@mediatek.com>,
	Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@mediatek.com>,
	"gildekel@google.com" <gildekel@google.com>,
	"markyacoub@chromium.org" <markyacoub@chromium.org>
Subject: Re: [PATCH i-g-t v2 1/1] tests/kms_color: Add 10-bit color depth support to gamma test for MediaTek
Date: Mon, 13 Apr 2026 07:30:00 +0000	[thread overview]
Message-ID: <85b103a246bcafc773a4d4a81b9ed02e4a913dcd.camel@mediatek.com> (raw)
In-Reply-To: <5f9c70dea73dafeed8005e5a70e66db8fc72bbad@intel.com>

[-- Attachment #1: Type: text/plain, Size: 4178 bytes --]

On Mon, 2026-04-13 at 09:50 +0300, Jani Nikula wrote:
> On Mon, 13 Apr 2026, Jay Liu <jay.liu@mediatek.com> wrote:
> > 1. Add 10-bit color depth flow to gamma test for MediaTek devices,
> > which only
> > support bit-true results with 10-bit data. The test now selects 8-
> > bit or
> > 10-bit color depth and framebuffer format based on device type.
> > 
> > 2. To satisfy the legacy gamma test requirements, the MTK Gamma LUT
> > limit
> > should be set to 4092, in the current 16-bit LUT design, setting
> > the entry
> >  to 0xffd0 ensures the driver maps it correctly to 4092.
> > 
> > Signed-off-by: Jay Liu <jay.liu@mediatek.com>
> > ---
> >  tests/kms_color.c | 35 +++++++++++++++++++++++++++--------
> >  1 file changed, 27 insertions(+), 8 deletions(-)
> > 
> > diff --git a/tests/kms_color.c b/tests/kms_color.c
> > index 565edb2dc..033207368 100644
> > --- a/tests/kms_color.c
> > +++ b/tests/kms_color.c
> > @@ -288,7 +288,7 @@ static bool test_pipe_legacy_gamma(data_t
> > *data,
> >  	fb_id = igt_create_fb(data->drm_fd,
> >  			      mode->hdisplay,
> >  			      mode->vdisplay,
> > -			      DRM_FORMAT_XRGB8888,
> > +			      data->drm_format,
> >  			      DRM_FORMAT_MOD_LINEAR,
> >  			      &fb);
> >  	igt_assert(fb_id);
> > @@ -296,7 +296,7 @@ static bool test_pipe_legacy_gamma(data_t
> > *data,
> >  	fb_modeset_id = igt_create_fb(data->drm_fd,
> >  				      mode->hdisplay,
> >  				      mode->vdisplay,
> > -				      DRM_FORMAT_XRGB8888,
> > +				      data->drm_format,
> >  				      DRM_FORMAT_MOD_LINEAR,
> >  				      &fb_modeset);
> >  	igt_assert(fb_modeset_id);
> > @@ -322,9 +322,20 @@ static bool test_pipe_legacy_gamma(data_t
> > *data,
> >  	igt_plane_set_fb(primary, &fb);
> >  
> >  	red_lut[0] = green_lut[0] = blue_lut[0] = 0;
> > -	for (i = 1; i < legacy_lut_size; i++)
> > -		red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
> > -	igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->crtc-
> > >crtc_id,
> > +	for (i = 1; i < legacy_lut_size; i++) {
> > +		/*
> > +		 * The Medaitek Gamma LUT maps 10bit input data to
> > 12bit output.
> > +		 * In this test case, the maximum input value is 1023.
> > +		 * When the Gamma function is disabled, the data
> > defaults to a 4092 output.
> > +		 * To achieve bit true results, the Gamma LUT maximum
> > must be set to 4092.
> > +		 * Note that 0xFFFD0 represents 16-bit,which maps to
> > 4092 in 12-bit depth.
> > +		 */
> > +		if (is_mtk_device(data->drm_fd))
> > +			red_lut[i] = green_lut[i] = blue_lut[i] =
> > 0xffd0;
> > +		else
> > +			red_lut[i] = green_lut[i] = blue_lut[i] =
> > 0xffff;
> > +	}
> > +	igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe-
> > >crtc_id,
> >  					  legacy_lut_size, red_lut,
> > green_lut, blue_lut), 0);
> 
> This does not compile.
I am very sorry about this. I will fix this issue in the next version
and be extra careful with the verification to ensure no additional bugs
are introduced
> 
> >  	igt_display_commit(&data->display);
> >  	igt_wait_for_vblank(primary->crtc);
> > @@ -752,14 +763,22 @@ static void
> >  run_gamma_degamma_tests_for_crtc(data_t *data, igt_crtc_t *crtc,
> >  				 bool (*test_t)(data_t*, igt_plane_t*))
> >  {
> > +	bool is_mtk = false;
> > +
> >  	test_setup(data, crtc);
> >  
> > +	/* MediaTek requires 10-bit pipeline for accurate (bit true)
> > color processing */
> > +	if (is_mtk_device(data->drm_fd))
> > +		is_mtk = true;
> > +
> >  	/*
> > -	 * We assume an 8bits depth per color for degamma/gamma LUTs
> > +	 * We assume an 8bits or 10bits depth per color for
> > degamma/gamma LUTs
> >  	 * for CRC checks with framebuffer references.
> >  	 */
> > -	data->color_depth = 8;
> > -	data->drm_format = DRM_FORMAT_XRGB8888;
> > +
> > +	/* MediaTek requires 10-bit pipeline for accurate (bit true)
> > color processing */
> > +	data->color_depth = is_mtk ? 10 : 8;
> > +	data->drm_format = is_mtk ? DRM_FORMAT_XRGB2101010 :
> > DRM_FORMAT_XRGB8888;
> >  	data->mode = igt_output_get_mode(data->output);
> >  
> >  	igt_require(crtc_output_combo_valid(data, crtc));
> 
> 

[-- Attachment #2: Type: text/html, Size: 8448 bytes --]

      reply	other threads:[~2026-04-13  7:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13  1:41 [PATCH i-g-t v2 1/1] tests/kms_color: Add 10-bit color depth support to gamma test for MediaTek Jay Liu
2026-04-13  6:50 ` Jani Nikula
2026-04-13  7:30   ` Jay Liu (刘博) [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=85b103a246bcafc773a4d4a81b9ed02e4a913dcd.camel@mediatek.com \
    --to=jay.liu@mediatek.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=gildekel@google.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jani.nikula@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