[PATCH i-g-t 2/2] tests/intel/kms_pm_dc: Improvise the deep-pkgc

Naladala Ramanaidu ramanaidu.naladala at intel.com
Sat Jul 13 07:26:46 UTC 2024


Add tuned delays to check deep-pkgc pkgc10 counters

Signed-off-by: Naladala Ramanaidu <ramanaidu.naladala at intel.com>
---
 tests/intel/kms_pm_dc.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/tests/intel/kms_pm_dc.c b/tests/intel/kms_pm_dc.c
index bca5bfa58..2155b4625 100644
--- a/tests/intel/kms_pm_dc.c
+++ b/tests/intel/kms_pm_dc.c
@@ -592,7 +592,7 @@ static unsigned int read_pkgc_counter(int debugfs_root_fd)
 static void test_deep_pkgc_state(data_t *data)
 {
 	unsigned int pre_val = 0, cur_val = 0;
-	time_t start = time(NULL), duration = 2, vb_delay, delay;
+	time_t start = time(NULL), duration = 4, vb_delay, delay;
 	enum pipe pipe;
 	bool pkgc_flag = false;
 	bool flip = true;
@@ -618,6 +618,7 @@ static void test_deep_pkgc_state(data_t *data)
 			igt_assert(igt_display_try_commit_atomic(display,
 						DRM_MODE_ATOMIC_ALLOW_MODESET,
 						NULL) == 0);
+			break;
 		}
 	}
 
@@ -638,23 +639,26 @@ static void test_deep_pkgc_state(data_t *data)
 	setup_videoplayback(data);
 
 	primary = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
-	pre_val = read_pkgc_counter(data->debugfs_root_fd);
-	delay = 1 * (MSECS / (data->mode->vrefresh - 10));
-
 	igt_plane_set_fb(primary, &data->fb_rgb);
 	igt_display_commit(&data->display);
+	/* Waiting for the vblank to sync the frame time */
+	igt_wait_for_vblank_count(data->drm_fd, data->display.pipes[pipe].crtc_offset, 1);
+	/* measure delay for half frame */
+	delay = vb_delay*0.5;
+	usleep(delay);
+	pre_val = read_pkgc_counter(data->debugfs_root_fd);
 
 	while (time(NULL) - start < duration) {
 		flip = !flip;
 		igt_plane_set_fb(primary, flip ? &data->fb_rgb : &data->fb_rgr);
 		igt_display_commit(&data->display);
-
-		cur_val = read_pkgc_counter(data->debugfs_root_fd);
+		/* For every 1ms polling for pkgc10 counter change till 1 frame time */
+		igt_wait((cur_val = read_pkgc_counter(data->debugfs_root_fd)) > pre_val,
+				vb_delay*2, 5);
 		if (cur_val > pre_val) {
 			pkgc_flag = true;
 			break;
 		}
-		usleep(delay);
 	}
 
 	cleanup_dc3co_fbs(data);
-- 
2.43.0



More information about the igt-dev mailing list