[igt-dev] [i-g-t] tests/i915/i915_pm_dc: Fix DC9 subtest

Mastan Katragadda mastanx.katragadda at intel.com
Wed Dec 1 06:27:03 UTC 2021


Reading prev_dc counter is most of the times 0 after reset
comparison with 0 test gets failed. taken prev_dc counter after
enterd into shallow DC state.

changes since V1:
        - Removed new lines and warnings from checkpatch.pl

Signed-off-by: Mastan Katragadda <mastanx.katragadda at intel.com>
---
 tests/i915/i915_pm_dc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/i915/i915_pm_dc.c b/tests/i915/i915_pm_dc.c
index 4ebeb3eb..2c2c5086 100644
--- a/tests/i915/i915_pm_dc.c
+++ b/tests/i915/i915_pm_dc.c
@@ -434,22 +434,22 @@ static void setup_dc9_dpms(data_t *data, int dc_target)
 	dpms_off(data);
 	igt_skip_on_f(!(igt_wait(read_dc_counter(data->debugfs_fd, dc_target) >
 				prev_dc, 3000, 100)), "Unable to enters shallow DC states\n");
+	prev_dc = read_dc_counter(data->debugfs_fd, dc_target);
 	dpms_on(data);
 	cleanup_dc_dpms(data);
+	dpms_off(data);
+	sleep(1); /* wait for counters reset*/
+	check_dc9(data, dc_target, prev_dc);
+	dpms_on(data);
 }
 
 static void test_dc9_dpms(data_t *data)
 {
-	int prev_dc, dc_target;
+	int dc_target;
 
 	require_dc_counter(data->debugfs_fd, CHECK_DC5);
 	dc_target = support_dc6(data->debugfs_fd) ? CHECK_DC6 : CHECK_DC5;
-	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);
 }
 
 static void kms_poll_state_restore(int sig)
-- 
2.25.1



More information about the igt-dev mailing list