Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Jason-JH Lin (林睿祥)" <Jason-JH.Lin@mediatek.com>
Cc: "swati2.sharma@intel.com" <swati2.sharma@intel.com>,
	"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"karthik.b.s@intel.com" <karthik.b.s@intel.com>,
	"jani.nikula@intel.com" <jani.nikula@intel.com>,
	"chaitanya.kumar.borah@intel.com"
	<chaitanya.kumar.borah@intel.com>,
	"Nancy Lin (林欣螢)" <Nancy.Lin@mediatek.com>,
	Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@mediatek.com>,
	"bhanuprakash.modem@gmail.com" <bhanuprakash.modem@gmail.com>,
	"Paul-pl Chen (陳柏霖)" <Paul-pl.Chen@mediatek.com>,
	"gildekel@google.com" <gildekel@google.com>,
	"fshao@chromium.org" <fshao@chromium.org>,
	"juhapekka.heikkila@gmail.com" <juhapekka.heikkila@gmail.com>,
	"Singo Chang (張興國)" <Singo.Chang@mediatek.com>,
	"uma.shankar@intel.com" <uma.shankar@intel.com>,
	"markyacoub@chromium.org" <markyacoub@chromium.org>,
	"kamil.konieczny@linux.intel.com"
	<kamil.konieczny@linux.intel.com>
Subject: Re: [PATCH i-g-t v2] tests/kms_color: Always use atomic_commit for setting color properties
Date: Wed, 11 Feb 2026 15:31:23 +0200	[thread overview]
Message-ID: <aYyEq5jX_FnaP4wm@intel.com> (raw)
In-Reply-To: <2c3791e090ff1a074a044a5ac1f555e855c56aee.camel@mediatek.com>

On Wed, Feb 11, 2026 at 11:24:43AM +0000, Jason-JH Lin (林睿祥) wrote:
> On Wed, 2025-11-26 at 22:40 +0800, Jason-JH.Lin wrote:
> > > > > > > > > 
> > 
> > [snip]
> > 
> > > > > > > > > 
> > > > > > Looking into igt_pipe_commit(), it used
> > > > > > drmModeObjectSetProperty()
> > > > > > to
> > > > > > set property to DRM and it used igt_plane_commit() to
> > > > > > synchronize
> > > > > > all
> > > > > > plane states and only primary plane will call
> > > > > > drmModeSetCrtc().
> > > > > > 
> > > > > > It think the reason we didn't get the new gamma_lut in crtc
> > > > > > state
> > > > > > is
> > > > > > taht set_gamma() will only call igt_pipe_obj_prop_changed()
> > > > > > to
> > > > > > update
> > > > > > pipe_obj->changed flag, but not update plane->changed flag.
> > > > > > In igt_primary_plane_commit_legacy(), it'll return if
> > > > > > primary-
> > > > > > > changed
> > > > > > flag is not set.
> > > > > 
> > > > > The LUT properties are supposed to be on the CRTC. So the plane
> > > > > stuff should not matter, unless you driver is doing something
> > > > > completely non-stanadard.
> > > > > 
> > > > 
> > > > You're right. Plane stuff should not matter to CRTC.
> > > > 
> > > > So I means drmModeSetCrtc() won't be called if plane properties
> > > > is
> > > > not
> > > > set in igt_primary_plane_commit_legacy() currently.
> > > > 
> > > > I think this legacy flow logic:
> > > > {
> > > > 
> > > > if (!igt_plane_is_prop_changed(primary, IGT_PLANE_FB_ID)) &&
> > > >     !(primary->changed & IGT_PLANE_COORD_CHANGED_MASK) &&
> > > >     !igt_pipe_obj_is_prop_changed(primary->pipe,
> > > > IGT_CRTC_MODE_ID))
> > > >         return 0;
> > > > ...
> > > > 
> > > > drmModeSetCrtc()
> > > > 
> > > > ...
> > > > 
> > > > }
> > > > may block LUT properties being synchronized into crtc state when
> > > > we
> > > > only called set_gamma() and not updated any plane properties.
> > > 
> > > That doesn't affect CRTC properties apart from the mode.
> > > For all other CRTC properties drmModeObjectSetProperty()
> > > will be called regardless by igt_pipe_commit().
> > > 
> > 
> > Okay, I checked that drm_mode_obj_set_property_ioctl() called from
> > drmModeObjectSetProperty() will synchronize the CRTC properties, such
> > as, gamm_lut into the CRTC state of atomic_state.
> > 
> > Our drm driver has implemented mode_config.funcs->atomic_commit(), 
> > so maybe we have some bug in our drivers that cause the issue I
> > encountered, the original IGT code should work fine.
> > 
> > I'll check out this later and send the wrapper API if needed.
> > Thanks for the correction and guidance.
> > 
> 
> Finally, I found the issue is that color_mgmt_changed is not set when
> updating gamma_lut, causing gamma changes to not be applied to
> hardware.
> 
> Root cause analysis:
> - When updating GAMMA_LUT, color_mgmt_changed is set correctly.
> - But when a subsequent unrelated property (e.g. VRR_ENABLED) is
> committed, __drm_atomic_helper_crtc_duplicate_state() resets
> color_mgmt_changed=0.
> - This results in crtc->state having gamma_lut but
> color_mgmt_changed=0, so gamma is never applied to hardware.
> 
> DRM framework design:
> - color_mgmt_changed is a per-commit flag, reset on each new commit.
> - Only set if color management properties change.
> - In COMMIT_LEGACY mode (used by IGT), each property is committed
> separately.
> - Unrelated property commits overwrite color_mgmt_changed=1 from
> previous gamma_lut update.
> 
> Solution in MTK DRM driver:
> - Retain color_mgmt_changed if the old state has the flag and color
> management blobs have not changed, preventing it from being overwritten
> by unrelated property commits.

That shouldn't be needed because, as you noted, each property
is commited separately. So the commit resulting from the GAMMA_LUT
setproperty should have already updated the hardware before the
next setproperty commit happens.

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2026-02-11 13:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-21  7:53 [PATCH i-g-t v2] tests/kms_color: Always use atomic_commit for setting color properties Jason-JH Lin
2025-11-21  8:56 ` Ville Syrjälä
2025-11-21  9:47   ` Jason-JH Lin (林睿祥)
2025-11-21 10:38     ` Ville Syrjälä
2025-11-24  6:47       ` Jason-JH Lin (林睿祥)
2025-11-24 21:00         ` Ville Syrjälä
2025-11-25  2:19           ` Jason-JH Lin (林睿祥)
2025-11-25 17:06             ` Ville Syrjälä
2025-11-26 14:40               ` Jason-JH Lin (林睿祥)
2026-02-11 11:24                 ` Jason-JH Lin (林睿祥)
2026-02-11 13:31                   ` Ville Syrjälä [this message]
2026-02-12 10:15                     ` Jason-JH Lin (林睿祥)
2026-02-12 11:57                       ` Ville Syrjälä
2026-02-12 15:02                         ` Jason-JH Lin (林睿祥)
2025-11-25  2:50 ` ✓ Xe.CI.BAT: success for " Patchwork
2025-11-25  3:03 ` ✓ i915.CI.BAT: " Patchwork
2025-11-25  4:43 ` ✗ Xe.CI.Full: failure " Patchwork
2025-11-25  8:52 ` ✗ i915.CI.Full: " Patchwork

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=aYyEq5jX_FnaP4wm@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=chaitanya.kumar.borah@intel.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 \
    --cc=uma.shankar@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