Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [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

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