Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Naladala Ramanaidu <ramanaidu.naladala@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: suraj.kandpal@intel.com, jeevan.b@intel.com,
	Naladala Ramanaidu <ramanaidu.naladala@intel.com>
Subject: [PATCH i-g-t v5 4/4] tests/intel/kms_pm_dc: Add polling for deep-pkgc
Date: Tue, 27 Aug 2024 18:10:18 +0530	[thread overview]
Message-ID: <20240827124018.1373304-5-ramanaidu.naladala@intel.com> (raw)
In-Reply-To: <20240827124018.1373304-1-ramanaidu.naladala@intel.com>

It should be enhance the test_deep_pkgc_state function to include
the following changes:
- Add an interval variable to control the delay between checks.
- Add a wait for vblank to sync the frame time before reading
  the package C-state counter.
- Introduce a half-frame delay to ensure the flip occurs when
  the frame is active.
- Modify the loop to use igt_wait for better handling of the
  package C-state counter read.
- Remove 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)
v5: Update commit subject/message. (Suraj)

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

diff --git a/tests/intel/kms_pm_dc.c b/tests/intel/kms_pm_dc.c
index a69876fc7..b378cacbc 100644
--- a/tests/intel/kms_pm_dc.c
+++ b/tests/intel/kms_pm_dc.c
@@ -641,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);
+	/* Wait 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);
+	/* Add 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), (5 * MSEC));
 		if (cur_val > pre_val) {
 			pkgc_flag = true;
 			break;
 		}
-		usleep(delay);
 	}
 
 	cleanup_dc3co_fbs(data);
-- 
2.43.0


  parent reply	other threads:[~2024-08-27 12:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27 12:40 [PATCH i-g-t v5 0/4] Improvise-the-deep-pkgc Naladala Ramanaidu
2024-08-27 12:40 ` [PATCH i-g-t v5 1/4] tests/intel/kms_pm_dc: Add time unit macros and update delay calculation Naladala Ramanaidu
2024-08-28  5:53   ` Kandpal, Suraj
2024-08-27 12:40 ` [PATCH i-g-t v5 2/4] tests/intel/kms_pm_dc: Update VRR handling and eDP output check Naladala Ramanaidu
2024-08-28  5:56   ` Kandpal, Suraj
2024-08-27 12:40 ` [PATCH i-g-t v5 3/4] tests/intel/kms_pm_dc: Update test duration to 4 seconds Naladala Ramanaidu
2024-08-27 12:40 ` Naladala Ramanaidu [this message]
2024-08-28  5:51   ` [PATCH i-g-t v5 4/4] tests/intel/kms_pm_dc: Add polling for deep-pkgc Kandpal, Suraj
2024-08-27 17:23 ` ✓ CI.xeBAT: success for Improvise-the-deep-pkgc (rev5) Patchwork
2024-08-27 17:35 ` ✓ Fi.CI.BAT: " Patchwork
2024-08-28  2:04 ` ✓ CI.xeFULL: " Patchwork
2024-08-28  5:48 ` [PATCH i-g-t v5 0/4] Improvise-the-deep-pkgc Kandpal, Suraj
2024-08-28  6:32   ` Naladala, Ramanaidu
2024-08-29  5:07 ` ✓ Fi.CI.IGT: success for Improvise-the-deep-pkgc (rev5) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240827124018.1373304-5-ramanaidu.naladala@intel.com \
    --to=ramanaidu.naladala@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jeevan.b@intel.com \
    --cc=suraj.kandpal@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox