public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] tests/kms_rotation_crc: Add MTK device support
@ 2026-04-10 10:07 Jason-JH Lin
  2026-04-10 10:25 ` Ville Syrjälä
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jason-JH Lin @ 2026-04-10 10:07 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

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.

Signed-off-by: Jason-JH Lin <jason-jh.lin@mediatek.com>
---
 tests/kms_rotation_crc.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 4420053f1c6d..972fe9f56839 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -310,12 +310,12 @@ static void prepare_crtc(data_t *data, igt_output_t *output, igt_crtc_t *crtc,
 	/* defer crtc cleanup + crtc active for later on amd - not valid
 	 * to enable CRTC without a plane active
 	 */
-	if (!is_amdgpu_device(data->gfx_fd))
+	if (is_intel_device(data->gfx_fd) || is_mtk_device(data->gfx_fd))
 		igt_display_commit2(display, COMMIT_ATOMIC);
 	data->pipe_crc = igt_crtc_crc_new(crtc,
 				          IGT_PIPE_CRC_SOURCE_AUTO);
 
-	if (!is_amdgpu_device(data->gfx_fd) && start_crc)
+	if ((is_intel_device(data->gfx_fd) || is_mtk_device(data->gfx_fd)) && start_crc)
 		igt_pipe_crc_start(data->pipe_crc);
 }
 
@@ -324,7 +324,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output, igt_crtc_t *crtc,
 #define TEST_HEIGHT(km) \
 	 min_t((km)->vdisplay, (km)->vdisplay, TEST_MAX_HEIGHT)
 
-static void prepare_fbs(data_t *data, igt_output_t *output,
+static void prepare_fbs(data_t *data, igt_output_t *output, igt_crtc_t *crtc,
 			igt_plane_t *plane, enum rectangle_type rect, uint32_t format)
 {
 	drmModeModeInfo *mode;
@@ -410,6 +410,8 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 				data->pipe_crc,
 				&data->crc_rect[data->output_crc_in_use][rect].flip_crc);
 		} else {
+			if (is_mtk_device(data->gfx_fd))
+				igt_wait_for_vblank(crtc);
 			igt_pipe_crc_get_current(
 				display->drm_fd, data->pipe_crc,
 				&data->crc_rect[data->output_crc_in_use][rect].flip_crc);
@@ -434,6 +436,8 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 				&data->crc_rect[data->output_crc_in_use][rect].ref_crc);
 			igt_remove_fb(data->gfx_fd, &data->fb_flip);
 		} else {
+			if (is_mtk_device(data->gfx_fd))
+				igt_wait_for_vblank(crtc);
 			igt_pipe_crc_get_current(
 				display->drm_fd, data->pipe_crc,
 				&data->crc_rect[data->output_crc_in_use][rect].ref_crc);
@@ -472,7 +476,7 @@ static void test_single_case(data_t *data, igt_crtc_t *crtc,
 
 	igt_debug("Testing case %i on pipe %s, format %s\n", rect,
 		  igt_crtc_name(crtc), igt_format_str(format));
-	prepare_fbs(data, output, plane, rect, format);
+	prepare_fbs(data, output, crtc, plane, rect, format);
 
 	igt_plane_set_rotation(plane, data->rotation);
 	if (igt_rotation_90_or_270(data->rotation))
@@ -499,6 +503,8 @@ static void test_single_case(data_t *data, igt_crtc_t *crtc,
 	if (is_amdgpu_device(data->gfx_fd)) {
 		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output);
 	} else {
+		if (is_mtk_device(data->gfx_fd))
+			igt_wait_for_vblank(crtc);
 		igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc,
 								 &crc_output);
 	}
@@ -530,6 +536,8 @@ static void test_single_case(data_t *data, igt_crtc_t *crtc,
 		if (is_amdgpu_device(data->gfx_fd)) {
 			igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output);
 		} else {
+			if (is_mtk_device(data->gfx_fd))
+				igt_wait_for_vblank(crtc);
 			igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc,
 									 &crc_output);
 		}
@@ -701,7 +709,7 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
 						 data->override_fmt, test_bad_format);
 			}
 		}
-		if (is_intel_device(data->gfx_fd)) {
+		if (is_intel_device(data->gfx_fd) || is_mtk_device(data->gfx_fd)) {
 			igt_pipe_crc_stop(data->pipe_crc);
 		}
 	}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-04-11  6:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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-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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox