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 v4 3/4] tests/intel/kms_pm_dc: Add polling for deep-pkgc
Date: Mon, 12 Aug 2024 01:33:58 +0530	[thread overview]
Message-ID: <20240811200359.1086166-4-ramanaidu.naladala@intel.com> (raw)
In-Reply-To: <20240811200359.1086166-1-ramanaidu.naladala@intel.com>

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@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


  parent reply	other threads:[~2024-08-11 20:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-11 20:03 [PATCH i-g-t v4 0/4] Improvise-the-deep-pkgc Naladala Ramanaidu
2024-08-11 20:03 ` [PATCH i-g-t v4 1/4] tests/intel/kms_pm_dc: Update VRR handling and eDP output check Naladala Ramanaidu
2024-08-13  9:21   ` Kandpal, Suraj
2024-08-11 20:03 ` [PATCH i-g-t v4 2/4] tests/intel/kms_pm_dc: Update test duration to 4 seconds Naladala Ramanaidu
2024-08-13  9:23   ` Kandpal, Suraj
2024-08-22  9:31     ` Naladala, Ramanaidu
2024-08-11 20:03 ` Naladala Ramanaidu [this message]
2024-08-13  9:26   ` [PATCH i-g-t v4 3/4] tests/intel/kms_pm_dc: Add polling for deep-pkgc Kandpal, Suraj
2024-08-11 20:03 ` [PATCH i-g-t v4 4/4] HAX patch do not merge Naladala Ramanaidu
2024-08-11 20:24 ` ✗ CI.xeBAT: failure for Improvise-the-deep-pkgc (rev4) Patchwork
2024-08-11 20:40 ` ✗ Fi.CI.BAT: " Patchwork
2024-08-11 21:22 ` ✗ CI.xeFULL: " Patchwork
2024-08-12  4:03 ` [PATCH i-g-t v4 0/4] Improvise-the-deep-pkgc Kandpal, Suraj

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=20240811200359.1086166-4-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