[PATCH] [i-g-t] tests/amdgpu/amd_ilr: Fix eDP PSR not be re-enabled after test
Hersen Wu
hersenxs.wu at amd.com
Mon Mar 25 12:08:06 UTC 2024
From: Hersen Wu <Hersenxs.Wu at amd.com>
At end of test, with disallow_edp_enter_psr = 0, run DPMS off, on
for eDP. This will trigger DRM kernel driver enable eDP PSR.
Signed-off-by: Hersen Wu <Hersenxs.Wu at amd.com>
---
lib/igt_amd.c | 5 ---
tests/amdgpu/amd_ilr.c | 69 ++++++++++++++++++++++++++++++++++--------
2 files changed, 56 insertions(+), 18 deletions(-)
diff --git a/lib/igt_amd.c b/lib/igt_amd.c
index 623883dbc..d10c3c1f2 100644
--- a/lib/igt_amd.c
+++ b/lib/igt_amd.c
@@ -1183,11 +1183,6 @@ void igt_amd_disallow_edp_enter_psr(int drm_fd, char *connector_name, bool enabl
const char *allow_edp_psr = "1";
const char *dis_allow_edp_psr = "0";
- /* if current psr is not enabled, skip this debugfs */
- if (!igt_amd_psr_support_drv(drm_fd, connector_name, PSR_MODE_1) &&
- !igt_amd_psr_support_drv(drm_fd, connector_name, PSR_MODE_2))
- return;
-
fd = igt_debugfs_connector_dir(drm_fd, connector_name, O_RDONLY);
igt_assert(fd >= 0);
ret = openat(fd, DEBUGFS_DISALLOW_EDP_ENTER_PSR, O_WRONLY);
diff --git a/tests/amdgpu/amd_ilr.c b/tests/amdgpu/amd_ilr.c
index 46ad6f60a..77e11aaad 100644
--- a/tests/amdgpu/amd_ilr.c
+++ b/tests/amdgpu/amd_ilr.c
@@ -199,28 +199,32 @@ static void test_flow(data_t *data, enum sub_test option)
igt_enable_connectors(data->drm_fd);
for_each_connected_output(&data->display, output) {
- if (!igt_amd_output_has_ilr_setting(data->drm_fd, output->name) ||
+ if ((output->config.connector->connector_type != DRM_MODE_CONNECTOR_eDP) ||
+ !igt_amd_output_has_ilr_setting(data->drm_fd, output->name) ||
!igt_amd_output_has_link_settings(data->drm_fd, output->name)) {
igt_info("Skipping output: %s\n", output->name);
continue;
}
- /* igt_amd_output_has_ilr_setting only checks if debugfs
- * exist. ilr settings could be all 0s -- not supported.
- * IGT needs to check if ilr settings values are supported.
- */
- igt_amd_read_ilr_setting(data->drm_fd, output->name, data->supported_ilr);
- if (data->supported_ilr[0] == 0)
- continue;
-
igt_info("Testing on output: %s\n", output->name);
+ /* states under /sys/kernel/debug/dri/0/eDP-1:
+ * psr_capability.driver_support (psr_en): yes
+ * ilr_setting (ilr): yes/no
+ * disallow_edp_enter_psr (dis_psr): no
+ */
+
/* Init only if display supports ilr link settings */
test_init(data, output);
+ /* eDP is powered down within test_init
+ * psr_en: yes; ilr: no; dis_psr: no
+ */
+
/* Disable eDP PSR to avoid timeout when reading CRC */
igt_amd_disallow_edp_enter_psr(data->drm_fd, output->name, true);
+ /* psr_en: yes; ilr: no; dis_psr: yes */
mode = igt_output_get_mode(output);
igt_assert(mode);
@@ -229,8 +233,27 @@ static void test_flow(data_t *data, enum sub_test option)
mode->vdisplay, DRM_FORMAT_XRGB8888,
0, &data->fb);
igt_plane_set_fb(data->primary, &data->fb);
+
+ /* psr_en: yes; ilr: no; dis_psr: yes
+ * commit stream. power on eDP
+ */
igt_display_commit_atomic(&data->display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+ /* psr_en: no; ilr: yes; dis_psr: yes.
+ * With dis_psr yes, drm kernel driver
+ * disable psr, psr_en is set to no.
+ */
+
+ /* igt_amd_output_has_ilr_setting only checks if debugfs
+ * exist. ilr settings could be all 0s -- not supported.
+ * IGT needs to check if ilr settings values are supported.
+ * Supported_ilr is read from DPCD registers. Make sure
+ * eDP is powered on before reading supported_ilr.
+ */
+ igt_amd_read_ilr_setting(data->drm_fd, output->name, data->supported_ilr);
+ if (data->supported_ilr[0] == 0)
+ continue;
+
/* Collect info of Reported Lane Count & ILR */
igt_amd_read_link_settings(data->drm_fd, output->name, data->lane_count,
data->link_rate, data->link_spread_spectrum);
@@ -247,18 +270,38 @@ static void test_flow(data_t *data, enum sub_test option)
break;
}
+ /* psr_en: no; ilr: yes; dis_psr: yes */
+ kmstest_set_connector_dpms(data->drm_fd,
+ output->config.connector, DRM_MODE_DPMS_OFF);
+
+ /* Power down eDP.
+ * psr_en: no; ilr: no; dis_psr: yes.
+ */
+
+ /* Enable PSR after reading eDP Rx CRC */
+ igt_amd_disallow_edp_enter_psr(data->drm_fd, output->name, false);
+
+ /* psr_en: no; ilr: yes: dis_psr: no */
+
+ /* Power on eDP and setup psr */
+ kmstest_set_connector_dpms(data->drm_fd,
+ output->config.connector, DRM_MODE_DPMS_ON);
+
+ /* psr_en: yes; ilr: yes: dis_psr: no */
+
/* Reset preferred link settings*/
memset(data->supported_ilr, 0, sizeof(data->supported_ilr));
igt_amd_write_ilr_setting(data->drm_fd, output->name, 0, 0);
+ /* psr_en: yes; ilr: yes; dis_psr: no */
+
+ /* commit 0 stream. power down eDP */
igt_remove_fb(data->drm_fd, &data->fb);
- test_fini(data);
+ /* psr_en: yes; ilr: no; dis_psr: no */
- /* Enable eDP PSR */
- igt_amd_disallow_edp_enter_psr(data->drm_fd, output->name, false);
+ test_fini(data);
}
-
}
igt_main
--
2.25.1
More information about the igt-dev
mailing list