[PATCH] [i-g-t] tests/amdgpu/amd_bypass: Fix psr edp rx crc read timeout

Hersen Wu hersenxs.wu at amd.com
Fri Feb 2 15:10:25 UTC 2024


With debugfs disallow_edp_enter_psr = true, disable edp psr
before tx reading rx crc.

DPMS off, tx writes dpcd 0x600=2. eDP rx will reset dpcd 0x170=0.
Rx psr and crc check for rx internal logic are disabled.
With disallow_edp_enter_psr = true, when DPMS on, kernel driver
will turn on edp. eDP Rx keep dpcd 0x170=0 (default value).
Then tx reads eDP rx crc successfully.

Signed-off-by: Hersen Wu <hersenxs.wu at amd.com>
---
 tests/amdgpu/amd_bypass.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/tests/amdgpu/amd_bypass.c b/tests/amdgpu/amd_bypass.c
index d192a30ea..01946de24 100644
--- a/tests/amdgpu/amd_bypass.c
+++ b/tests/amdgpu/amd_bypass.c
@@ -72,6 +72,17 @@ static void test_init(data_t *data)
 	data->output = igt_get_single_output_for_pipe(display, data->pipe_id);
 	igt_assert(data->output);
 
+	if (data->output->config.connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
+		kmstest_set_connector_dpms(data->output->display->drm_fd,
+			data->output->config.connector, DRM_MODE_DPMS_OFF);
+
+		/* Disable PSR before reading eDP Rx CRC to avoid timeout */
+		igt_amd_disallow_edp_enter_psr(data->drm_fd, data->output->name, true);
+
+		kmstest_set_connector_dpms(data->output->display->drm_fd,
+			data->output->config.connector, DRM_MODE_DPMS_ON);
+	}
+
 	data->mode = igt_output_get_mode(data->output);
 	igt_assert(data->mode);
 
@@ -367,9 +378,23 @@ static void bypass_8bpc_test(data_t *data)
 		igt_assert_crc_equal(&data->crc_fb, &data->crc_dprx);
 	}
 
+	/* igt_pipe_crc_stop is called within igt_pipe_crc_collect_crc,
+	 * but kernel drm_dp_aux_crc_work is not flushed out. Create
+	 * and commit of new fb let kernel stop dp aux crc work.
+	 */
+	igt_create_pattern_fb(data->drm_fd, data->width, data->height,
+			DRM_FORMAT_XRGB8888, 0, &fb);
+	igt_plane_set_fb(data->primary, &fb);
+	igt_display_commit_atomic(&data->display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+
 	igt_plane_set_fb(data->primary, NULL);
 	test_fini(data);
 	igt_remove_fb(data->drm_fd, &fb);
+
+	if (data->output->config.connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
+		/* Enable eDP PSR within kernel driver */
+		igt_amd_disallow_edp_enter_psr(data->drm_fd, data->output->name, false);
+	}
 }
 
 igt_main
-- 
2.25.1



More information about the igt-dev mailing list