[igt-dev] [PATCH i-g-t v5] tests/i915/i915_pm_dc: Fix condition in dc9-test

Jigar Bhatt jigar.bhatt at intel.com
Wed Oct 13 10:57:44 UTC 2021


1.Inside dc9_wait_entry, we do not have DC9 counter,
so we rely on dc5/dc6 counter reset
to check if display engine was in DC9.
Test is passed if live counter is less
than the previous counter. Correcting condition
igt_wait(read_dc_counter(debugfs_fd, dc_target) <
			prev_dc, seconds, 100);

2.Moving prev_dc = read_dc_counter(data->debugfs_fd,
dc_target); before setup_dc9_dpms avoid 0 reading.

3.Add sleep(1) after dpms_off waiting for reset counters.

Fixes: 2f4e6430a97f04284d1cafb1479e7c1b0b2d596a ("tests/i915/i915_pm_dc: Fix DC9 test")
Signed-off-by: Jigar Bhatt <jigar.bhatt at intel.com>
Reviewed-by: Petri Latvala <petri.latvala at intel.com>
---
 tests/i915/i915_pm_dc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/i915/i915_pm_dc.c b/tests/i915/i915_pm_dc.c
index 3a7ce5bf..4ebeb3eb 100644
--- a/tests/i915/i915_pm_dc.c
+++ b/tests/i915/i915_pm_dc.c
@@ -410,7 +410,7 @@ static bool dc9_wait_entry(uint32_t debugfs_fd, int dc_target, int prev_dc, int
 	 * since we do not have DC9 counter,
 	 * so we rely on dc5/dc6 counter reset to check if display engine was in DC9.
 	 */
-	return igt_wait(read_dc_counter(debugfs_fd, dc_target) >
+	return igt_wait(read_dc_counter(debugfs_fd, dc_target) <
 			prev_dc, seconds, 100);
 }
 
@@ -444,9 +444,10 @@ static void test_dc9_dpms(data_t *data)
 
 	require_dc_counter(data->debugfs_fd, CHECK_DC5);
 	dc_target = support_dc6(data->debugfs_fd) ? CHECK_DC6 : CHECK_DC5;
-	setup_dc9_dpms(data, dc_target);
 	prev_dc = read_dc_counter(data->debugfs_fd, dc_target);
+	setup_dc9_dpms(data, dc_target);
 	dpms_off(data);
+	sleep(1); /* wait for counters reset*/
 	check_dc9(data, dc_target, prev_dc);
 	dpms_on(data);
 }
-- 
2.25.1



More information about the igt-dev mailing list