[PATCH i-g-t v4 3/4] tests/intel/kms_pm_dc: Add polling for deep-pkgc

Naladala Ramanaidu ramanaidu.naladala at intel.com
Sun Aug 11 20:03:58 UTC 2024


It should be enhance the test_deep_pkgc_state function to include
the following changes:
- Added an interval variable to control the delay between checks.
- Added a wait for vblank to sync the frame time before reading
  the package C-state counter.
- Introduced a half-frame delay to ensure the flip occurs when
  the frame is active.
- Modified the loop to use igt_wait for better handling of the
  package C-state counter read.
- Removed redundant usleep call to streamline the delay handling.

v2: Address and correct review comments (Suraj, Jeevan)
v3: Update commit subject/message.  (Kamil)
v4: Update commit subject/message and added comments. (Suraj)

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

diff --git a/tests/intel/kms_pm_dc.c b/tests/intel/kms_pm_dc.c
index 565c3d48d..270912c46 100644
--- a/tests/intel/kms_pm_dc.c
+++ b/tests/intel/kms_pm_dc.c
@@ -596,6 +596,7 @@ static void test_deep_pkgc_state(data_t *data)
 	enum pipe pipe;
 	bool pkgc_flag = false;
 	bool flip = true;
+	unsigned int interval = 5;
 
 	igt_display_t *display = &data->display;
 	igt_plane_t *primary;
@@ -640,22 +641,25 @@ 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);
 
 	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);
+	pre_val = read_pkgc_counter(data->debugfs_root_fd);
+	/* Added a half-frame delay to ensure the flip occurs when the frame is active. */
+	usleep(delay * 0.5);
 
 	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);
+		igt_wait((cur_val = read_pkgc_counter(data->debugfs_root_fd)) > pre_val,
+						      delay * 2, interval);
 		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