* [PATCH i-g-t] tests/kms_plane: Add vblank waits for MediaTek CRC timing
@ 2026-02-25 16:04 Jason-JH Lin
2026-03-06 6:03 ` Fei Shao
0 siblings, 1 reply; 3+ messages in thread
From: Jason-JH Lin @ 2026-02-25 16:04 UTC (permalink / raw)
To: igt-dev, Karthik B S, Swati Sharma, Kamil Konieczny,
Juha-Pekka Heikkila, Bhanuprakash Modem, Fei Shao
Cc: Jani, Jason-JH Lin, Paul-PL Chen, Nancy Lin, Singo Chang,
Gil Dekel, Yacoub, Project_Global_Chrome_Upstream_Group
On MediaTek hardware, CRC generation requires additional time to
stabilize after certain operations. This patch adds targeted vblank
waits for two specific scenarios:
1. Pixel format changes: After a format change in
capture_format_crcs_single(), the CRC hardware needs at least one
vblank to generate valid CRC values for the new format. Without
this wait, tests may read stale or transitional CRC values.
2. Cursor plane updates: In test_plane_position_with_output(), cursor
plane updates are non-blocking on MediaTek hardware. A vblank wait
ensures the CRC reflects the updated plane configuration.
These waits are guarded by is_mtk_device() checks to avoid affecting
other platforms.
Fixes failures in:
- pixel-format: CRC mismatch due to reading before format stabilization
- plane-position-hole: pipe-A-plane-3 failures with cursor plane
Signed-off-by: Jason-JH Lin <jason-jh.lin@mediatek.com>
---
tests/kms_plane.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index 8cef94a1f37e..e4539078c98e 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -351,6 +351,15 @@ test_plane_position_with_output(data_t *data, igt_crtc_t *crtc,
igt_display_commit(&data->display);
+ /*
+ * On MediaTek hardware, cursor plane updates are non-blocking and
+ * CRC needs time to reflect the new plane configuration. Wait for
+ * a vblank to ensure the update has taken effect.
+ */
+ if (is_mtk_device(data->drm_fd) && sprite->type == DRM_PLANE_TYPE_CURSOR)
+ igt_wait_for_vblank(data->drm_fd,
+ data->display.pipes[pipe].crtc_offset);
+
igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
igt_assert_crc_equal(reference_crc, &crc);
@@ -760,6 +769,15 @@ static void capture_format_crcs_single(data_t *data, igt_crtc_t *crtc,
igt_remove_fb(data->drm_fd, &old_fb);
+ /*
+ * On MediaTek hardware, CRC generation needs time to stabilize after
+ * a pixel format change. Wait for at least one vblank to ensure the
+ * CRC hardware has updated for the new format.
+ */
+ if (is_mtk_device(data->drm_fd))
+ igt_wait_for_vblank(data->drm_fd,
+ data->display.pipes[pipe].crtc_offset);
+
igt_pipe_crc_get_current(data->drm_fd, data->pipe_crc, &crc[0]);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH i-g-t] tests/kms_plane: Add vblank waits for MediaTek CRC timing
2026-02-25 16:04 [PATCH i-g-t] tests/kms_plane: Add vblank waits for MediaTek CRC timing Jason-JH Lin
@ 2026-03-06 6:03 ` Fei Shao
2026-03-09 3:22 ` Jason-JH Lin (林睿祥)
0 siblings, 1 reply; 3+ messages in thread
From: Fei Shao @ 2026-03-06 6:03 UTC (permalink / raw)
To: Jason-JH Lin
Cc: igt-dev, Karthik B S, Swati Sharma, Kamil Konieczny,
Juha-Pekka Heikkila, Bhanuprakash Modem, Jani, Paul-PL Chen,
Nancy Lin, Singo Chang, Gil Dekel, Yacoub,
Project_Global_Chrome_Upstream_Group
On Thu, Feb 26, 2026 at 12:04 AM Jason-JH Lin <jason-jh.lin@mediatek.com> wrote:
>
> On MediaTek hardware, CRC generation requires additional time to
> stabilize after certain operations. This patch adds targeted vblank
> waits for two specific scenarios:
>
> 1. Pixel format changes: After a format change in
> capture_format_crcs_single(), the CRC hardware needs at least one
> vblank to generate valid CRC values for the new format. Without
> this wait, tests may read stale or transitional CRC values.
>
> 2. Cursor plane updates: In test_plane_position_with_output(), cursor
> plane updates are non-blocking on MediaTek hardware. A vblank wait
> ensures the CRC reflects the updated plane configuration.
>
> These waits are guarded by is_mtk_device() checks to avoid affecting
> other platforms.
>
> Fixes failures in:
> - pixel-format: CRC mismatch due to reading before format stabilization
> - plane-position-hole: pipe-A-plane-3 failures with cursor plane
>
> Signed-off-by: Jason-JH Lin <jason-jh.lin@mediatek.com>
> ---
> tests/kms_plane.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/tests/kms_plane.c b/tests/kms_plane.c
> index 8cef94a1f37e..e4539078c98e 100644
> --- a/tests/kms_plane.c
> +++ b/tests/kms_plane.c
> @@ -351,6 +351,15 @@ test_plane_position_with_output(data_t *data, igt_crtc_t *crtc,
>
> igt_display_commit(&data->display);
>
> + /*
> + * On MediaTek hardware, cursor plane updates are non-blocking and
> + * CRC needs time to reflect the new plane configuration. Wait for
> + * a vblank to ensure the update has taken effect.
> + */
> + if (is_mtk_device(data->drm_fd) && sprite->type == DRM_PLANE_TYPE_CURSOR)
> + igt_wait_for_vblank(data->drm_fd,
> + data->display.pipes[pipe].crtc_offset);
Hmm, I suppose your codebase is a bit outdated?
Commit 18349d8bc1b2 ("lib/kms: Pass the entire igt_pipe_t to
igt_wait_for_vblank*()") [1] changed the function signature, so this
patch doesn't apply to the latest tree.
[1]: https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/commit/18349d8bc1b25bcf953e1868666214829f75c442
But I get the concept, and I think that looks okay.
Regards,
Fei
> +
> igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
> igt_assert_crc_equal(reference_crc, &crc);
>
> @@ -760,6 +769,15 @@ static void capture_format_crcs_single(data_t *data, igt_crtc_t *crtc,
>
> igt_remove_fb(data->drm_fd, &old_fb);
>
> + /*
> + * On MediaTek hardware, CRC generation needs time to stabilize after
> + * a pixel format change. Wait for at least one vblank to ensure the
> + * CRC hardware has updated for the new format.
> + */
> + if (is_mtk_device(data->drm_fd))
> + igt_wait_for_vblank(data->drm_fd,
> + data->display.pipes[pipe].crtc_offset);
> +
> igt_pipe_crc_get_current(data->drm_fd, data->pipe_crc, &crc[0]);
> }
>
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH i-g-t] tests/kms_plane: Add vblank waits for MediaTek CRC timing
2026-03-06 6:03 ` Fei Shao
@ 2026-03-09 3:22 ` Jason-JH Lin (林睿祥)
0 siblings, 0 replies; 3+ messages in thread
From: Jason-JH Lin (林睿祥) @ 2026-03-09 3:22 UTC (permalink / raw)
To: fshao@chromium.org
Cc: karthik.b.s@intel.com, swati2.sharma@intel.com,
juhapekka.heikkila@gmail.com, jani.nikula@intel.com,
Singo Chang (張興國), gildekel@google.com,
bhanuprakash.modem@gmail.com, igt-dev@lists.freedesktop.org,
Paul-pl Chen (陳柏霖),
kamil.konieczny@linux.intel.com,
Project_Global_Chrome_Upstream_Group,
Nancy Lin (林欣螢), markyacoub@chromium.org
>
[snip]
> > diff --git a/tests/kms_plane.c b/tests/kms_plane.c
> > index 8cef94a1f37e..e4539078c98e 100644
> > --- a/tests/kms_plane.c
> > +++ b/tests/kms_plane.c
> > @@ -351,6 +351,15 @@ test_plane_position_with_output(data_t *data,
> > igt_crtc_t *crtc,
> >
> > igt_display_commit(&data->display);
> >
> > + /*
> > + * On MediaTek hardware, cursor plane updates are non-
> > blocking and
> > + * CRC needs time to reflect the new plane configuration.
> > Wait for
> > + * a vblank to ensure the update has taken effect.
> > + */
> > + if (is_mtk_device(data->drm_fd) && sprite->type ==
> > DRM_PLANE_TYPE_CURSOR)
> > + igt_wait_for_vblank(data->drm_fd,
> > + data-
> > >display.pipes[pipe].crtc_offset);
>
> Hmm, I suppose your codebase is a bit outdated?
> Commit 18349d8bc1b2 ("lib/kms: Pass the entire igt_pipe_t to
> igt_wait_for_vblank*()") [1] changed the function signature, so this
> patch doesn't apply to the latest tree.
>
> [1]:
> https://urldefense.com/v3/__https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/commit/18349d8bc1b25bcf953e1868666214829f75c442
>
>
> But I get the concept, and I think that looks okay.
>
Hi Fei,
Thanks! I'll check why I don't get a build error in my codebase and
send the correct one.
Regards,
Jason-JH Lin
> Regards,
> Fei
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-09 3:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-25 16:04 [PATCH i-g-t] tests/kms_plane: Add vblank waits for MediaTek CRC timing Jason-JH Lin
2026-03-06 6:03 ` Fei Shao
2026-03-09 3:22 ` Jason-JH Lin (林睿祥)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox