public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Jason-JH Lin (林睿祥)" <Jason-JH.Lin@mediatek.com>
To: "ville.syrjala@linux.intel.com" <ville.syrjala@linux.intel.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] tests/kms_rotation_crc: Add MTK device support
Date: Tue, 14 Apr 2026 03:11:21 +0000	[thread overview]
Message-ID: <7c20c056822e3bb860f48c23f3830a8ae93a67ef.camel@mediatek.com> (raw)
In-Reply-To: <adjQJE8Ok5K_sNuc@intel.com>

On Fri, 2026-04-10 at 13:25 +0300, Ville Syrjälä wrote:
> On Fri, Apr 10, 2026 at 06:07:31PM +0800, Jason-JH Lin wrote:
> > Adapt rotation CRC tests for MTK devices by using Intel-like pipe
> > CRC
> > approach with explicit vblank synchronization.
> > MTK devices require a vblank wait to ensure rotation completes
> > before
> > CRC capture.
> 
> Instead of adding these checks all over igt I think you should
> try to fix you kernel CRC implementation to not hand out garbage
> CRCs.
> 

The issue is fundamental to MTK's HW design where all HW configurations
are applied by GCE (Global Command Engine) triggered by EOF signal.

MTK HW Configuration Flow:

igt_display_commit2(display, COMMIT_ATOMIC)
            │
            ▼
       atomic_commit()
            │
            ▼
       CMDQ submit
            │
            ▼
    Wait for next EOF signal ─────────────────┐
                                              │
                                              ▼
                                  GCE applies HW config
                                  (Rotation parameters, etc.)
                                  during VBlanking period
                                & GCE reads HW CRC from HW register
                                  into DRAM buffer
                                              │
                                              ▼
                                  Next Active Display Period
                                  HW renders with new config
                                              │
                                              ▼
                                  EOF → GCE reads HW CRC from
                                    HW register into DRAM buffer
                                              │
                                              ▼
                                  VBlank+1 → read CRC from DRAM
                                           → drm_crtc_add_crc_entry() ✅
                                  (MTK always reports CRC at VBlank+1
                                   after the EOF capture)


This design is intentional to ensure all HW settings are fully applied
within the VBlanking period, guaranteeing tearing-free display updates.
At the EOF signal, GCE reads the HW CRC from the HW register into a
DRAM buffer. Note that MTK always reports the CRC at VBlank+1 after the
EOF capture, which means there is already an inherent one-frame delay
before the CRC is reported to IGT via drm_crtc_add_crc_entry().

IGT Expected Behavior (Intel/AMD):

  igt_display_commit2(display, COMMIT_ATOMIC)
            │
            ▼
       atomic_commit()
            │
            ▼
        VBlank N ──► HW config takes effect immediately ✅
            │
            ▼
        EOF N ──► CRC captured with new config ✅
            │
            ▼
        VBlank N+1 ──────────────────────► igt_pipe_crc_get_current() ✅



MTK Actual Behavior:

  igt_display_commit2(display, COMMIT_ATOMIC)
            │
            ▼
       atomic_commit()
            │
            ▼
       CMDQ submit
            │
            ▼
        EOF N ──► GCE applies new config
               ──► GCE reads CRC(old) from HW register into DRAM
            │
      VBlanking N ──► HW updated with new config (tearing-free ✅)
            │
        VBlank N+1 ──► CRC(old) reported via drm_crtc_add_crc_entry()
            │
        EOF N+1 ──► GCE reads CRC(new) from HW register into DRAM
            │
        VBlank N+2 ──► CRC(new) reported via drm_crtc_add_crc_entry()
            │
            ▼
    igt_wait_for_vblank() is needed to ensure
    igt_pipe_crc_get_current() captures the correct CRC ✅

As shown above, due to MTK's GCE-based HW architecture, there is an
inherent multi-frame latency between igt_display_commit2() and the
correct CRC being available. Unlike Intel/AMD where the new
configuration takes effect immediately at the next VBlank, MTK requires
at least 2 VBlanks after atomic_commit() before the correct CRC can be
captured. Therefore, igt_wait_for_vblank() is necessary to ensure
igt_pipe_crc_get_current() captures the correct CRC reflecting the new
rotation configuration.

Since this timing behavior is inherent to MTK's GCE-based HW
architecture and cannot be eliminated at the kernel driver level,
adding igt_wait_for_vblank() in IGT is the appropriate solution.

Regards,
Jason-JH Lin


  reply	other threads:[~2026-04-14  3:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 10:07 [PATCH i-g-t] tests/kms_rotation_crc: Add MTK device support Jason-JH Lin
2026-04-10 10:25 ` Ville Syrjälä
2026-04-14  3:11   ` Jason-JH Lin (林睿祥) [this message]
2026-04-14 13:40     ` Ville Syrjälä
2026-04-15  5:11       ` Jason-JH Lin (林睿祥)
2026-04-29 23:31         ` Manasi Navare
2026-04-10 18:27 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-04-10 18:33 ` ✓ i915.CI.BAT: " Patchwork
2026-04-11  6:35 ` ✓ Xe.CI.FULL: " Patchwork
2026-04-11 18:45 ` ✗ i915.CI.Full: failure " 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=7c20c056822e3bb860f48c23f3830a8ae93a67ef.camel@mediatek.com \
    --to=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 \
    --cc=ville.syrjala@linux.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