Enable and Add new tests for DC3CO
v6 cover Enable and Add new tests for DC3CO
Enable DC3CO tests for PSR/PR for display versions >= 35, add a new test for DC3CO to validate frame drops, and test DC3CO with LOBF.
v3: Adds a test to verify DC3CO continues to function properly
after a DC6 power cycle and rename function name in first patch.
v4: Add a new test to verify DC3CO continues to funct
v5: Addressed review comments, clarified platform support wording.
Simplified PSR mode handling and fixed output-aware PSR checks. Cleaned up and aligned new DC3CO test flows and guards.
v6: Addressed review comments.
Jeevan B (7):
tests: s/check_dc_counter/assert_dc_counter tests/intel/kms_pm_dc: Replace require with proper assertion tests/intel/kms_pm_dc: Enable DC3CO test for PSR2/PR modes tests/kms_vrr: Add new test for DC3CO validation with LOBF tests/intel/kms_pm_dc: Add new test for dc3co framedrop validation tests/intel/kms_pm_dc: Add new test for DC3CO recovery after DC6 tests/intel/kms_pm_dc: Add dc3co-vpb-framegap subtest
tests/intel/kms_pm_dc.c | 292 +++++++++++++++++++++++++++++++++++++--- tests/kms_vrr.c | 34 +++++ 2 files changed, 309 insertions(+), 17 deletions(-)
Signature · 1 line
2.43.0
PATCH v6 1/7 tests: s/check_dc_counter/assert_dc_counter
Rename function name.
--- tests/intel/kms_pm_dc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
tests/intel/kms_pm_dc.c +7 -7
@@ -110,7 +110,7 @@ typedef struct {bool runtime_suspend_disabled; } data_t; -static void check_dc_counter (data_t *data,int dc_flag,uint32_t prev_dc_count); +static void assert_dc_counter (data_t *data,int dc_flag,uint32_t prev_dc_count);static void set_output_on_pipe_b (data_t *data) {
@@ -257,7 +257,7 @@ static void create_color_fb(data_t *data, igt_fb_t *fb, color_t *fb_color)paint_rectangles (data, data->mode, fb_color, fb); } -static void check_dc_counter (data_t *data,int dc_flag,uint32_t prev_dc_count) +static void assert_dc_counter (data_t *data,int dc_flag,uint32_t prev_dc_count) { igt_assert_f(igt_dc_state_wait_entry(data->debugfs_fd, dc_flag, prev_dc_count), "%s state is not achieved\n%s:\n%s\n", igt_dc_state_name(dc_flag),
@@ -265,7 +265,7 @@ static void check_dc_counter(data_t *data, int dc_flag, uint32_t prev_dc_count) PWR_DOMAIN_INFO)); } -static void check_dc_counter_negative (data_t *data,int dc_flag,uint32_t prev_dc_count) +static void assert_dc_counter_negative (data_t *data,int dc_flag,uint32_t prev_dc_count) { igt_assert_f(!igt_dc_state_wait_entry(data->debugfs_fd, dc_flag, prev_dc_count), "%s state is achieved\n%s:\n%s\n", igt_dc_state_name(dc_flag),
@@ -346,7 +346,7 @@ static void test_dc5_retention_flops(data_t *data, int dc_flag)set_output_on_pipe_b (data);setup_primary (data);igt_assert (psr_wait_entry (data->debugfs_fd, data->op_psr_mode, data->output)); -check_dc_counter (data, dc_flag, dc_counter_before_psr); +assert_dc_counter (data, dc_flag, dc_counter_before_psr);cleanup_dc_psr (data); }
@@ -360,7 +360,7 @@ static void test_dc_state_psr(data_t *data, int dc_flag)setup_primary (data);igt_require (!psr_disabled_check (data->debugfs_fd));igt_assert (psr_wait_entry (data->debugfs_fd, data->op_psr_mode, data->output)); -check_dc_counter (data, dc_flag, dc_counter_before_psr); +assert_dc_counter (data, dc_flag, dc_counter_before_psr);psr_sink_error_check (data->debugfs_fd, data->op_psr_mode, data->output);cleanup_dc_psr (data); }
@@ -439,7 +439,7 @@ static void test_dc_state_dpms(data_t *data, int dc_flag)setup_dc_dpms (data); dc_counter =igt_read_dc_counter (data->debugfs_fd, dc_flag);dpms_off (data); -check_dc_counter (data, dc_flag, dc_counter); +assert_dc_counter (data, dc_flag, dc_counter);dpms_on (data);cleanup_dc_dpms (data); }
@@ -452,7 +452,7 @@ static void test_dc_state_dpms_negative(data_t *data, int dc_flag)setup_dc_dpms (data); dc_counter =igt_read_dc_counter (data->debugfs_fd, dc_flag);dpms_on (data); -check_dc_counter_negative (data, dc_flag, dc_counter); +assert_dc_counter_negative (data, dc_flag, dc_counter);cleanup_dc_dpms (data); }
Signature · 1 line
2.43.0
PATCH v6 2/7 tests/intel/kms_pm_dc: Replace require with proper assertion
In reply to Jeevan BThe DC3CO video playback simulation test was incorrectly using require at the end to check if DC3CO state was entered. This causes the test to be marked as SKIP instead of FAIL when DC3CO doesn't work properly, hiding real issues. So changing the call from require to assert.
--- tests/intel/kms_pm_dc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tests/intel/kms_pm_dc.c +1 -2
@@ -316,8 +316,7 @@ static void check_dc3co_with_videoplayback_like_load(data_t *data)usleep (delay); } -igt_require_f (igt_dc_state_wait_entry (data->debugfs_fd,IGT_INTEL_CHECK_DC3CO , - dc3co_prev_cnt),"dc3co-vpb-simulation not enabled\n" ); +assert_dc_counter (data,IGT_INTEL_CHECK_DC3CO , dc3co_prev_cnt); }static void setup_dc3co (data_t *data)
Signature · 1 line
2.43.0
PATCH v6 3/7 tests/intel/kms_pm_dc: Enable DC3CO test for PSR2/PR modes
In reply to Jeevan BEnable DC3CO with PSR2/PR mode on TGL and for platforms with display version greater than 35.
v2: Fix debug, remove trailing dash and merge mode and char to
single strcut array.
v3: Minor cosmetic changes.
v4: Update commit message, use data->op_psr_mode directly, keep
psr_wait_entry, and refresh dc3co description to cover PSR2/PR.
--- tests/intel/kms_pm_dc.c | 45 ++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-)
tests/intel/kms_pm_dc.c +36 -9
@@ -48,8 +48,8 @@/** * SUBTEST: dc3co-vpb-simulation -* Description: Make sure that system enters DC3CO when PSR2 is active and system -* is in SLEEP state +* Description: Make sure that system enters DC3CO when PSR2 or PR is active and +* system is in SLEEP state * * SUBTEST: dc5-dpms * Description: Validate display engine entry to DC5 state while all connectors's
@@ -110,6 +110,11 @@ typedef struct {bool runtime_suspend_disabled; } data_t; +struct dc3co_test_mode { +enum psr_mode mode; +const char *name; +}; +static void assert_dc_counter (data_t *data,int dc_flag,uint32_t prev_dc_count);static void set_output_on_pipe_b (data_t *data)
@@ -323,7 +328,8 @@ static void setup_dc3co(data_t *data) {psr_enable (data->drm_fd, data->debugfs_fd, data->op_psr_mode, data->output);igt_require_f (psr_wait_entry (data->debugfs_fd, data->op_psr_mode, data->output), -"PSR2 is not enabled\n" ); +"%s is not enabled\n" , + data->op_psr_mode ==PSR_MODE_2 ?"PSR2" :"Panel Replay" ); }static void test_dc3co_vpb_simulation (data_t *data)
@@ -658,12 +664,33 @@ int igt_main() }igt_describe ("In this test we make sure that system enters DC3CO " -"when PSR2 is active and system is in SLEEP state" ); - igt_subtest("dc3co-vpb-simulation") { - data.op_psr_mode =PSR_MODE_2 ; -igt_require (psr_sink_support (data.drm_fd, data.debugfs_fd, - data.op_psr_mode,NULL )); -test_dc3co_vpb_simulation (&data); +"when PSR2 or PR is active and system is in SLEEP state" ); + igt_subtest_with_dynamic("dc3co-vpb-simulation") { +static const struct dc3co_test_mode dc3co_modes[] = { + {PSR_MODE_2 ,"psr2" }, + {PR_MODE ,"pr" }, + }; + +for (int i =0 ; i <ARRAY_SIZE (dc3co_modes); i++) { +const char *name = dc3co_modes[i].name; + data.op_psr_mode = dc3co_modes[i].mode; + + igt_dynamic_f("%s", name) { +igt_require (psr_sink_support (data.drm_fd, + data.debugfs_fd, + data.op_psr_mode,NULL )); + +if (data.op_psr_mode ==PSR_MODE_2 ) +igt_require_f (IS_TIGERLAKE (data.devid) || +intel_display_ver (data.devid) >=35 , +"Platform does not support DC3CO with PSR2\n" ); +else +igt_require_f (intel_display_ver (data.devid) >=35 , +"Platform does not support DC3CO with Panel Replay\n" ); + +test_dc3co_vpb_simulation (&data); + } + } } igt_describe("This test validates display engine entry to DC5 state "
Signature · 1 line
2.43.0
PATCH v6 4/7 tests/kms_vrr: Add new test for DC3CO validation with LOBF
In reply to Jeevan BAdd lobf-dc3co subtest to validate DC3CO entry during link-off between frames.
v2: Fix the flow logic.
--- tests/kms_vrr.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
tests/kms_vrr.c +34 -0
@@ -29,6 +29,7 @@*/ #include "igt.h" +#include "igt_pm.h" #include "igt_psr.h" #include "i915/intel_drrs.h" #include "sw_sync.h"
@@ -76,6 +77,9 @@* * SUBTEST: negative-basic * Description: Make sure that VRR should not be enabled on the Non-VRR panel. +* +* SUBTEST: lobf-dc3co +* Description: Test DC3CO entry during LOBF. */ #define NSECS_PER_SEC (1000000000ull)
@@ -873,6 +877,25 @@ test_lobf(data_t *data, igt_crtc_t *crtc, igt_output_t *output,igt_assert_f (lobf_enabled,"LOBF not enabled\n" ); } +static void test_lobf_dc3co (data_t *data,igt_crtc_t *crtc, +igt_output_t *output,uint32_t flags) +{ +unsigned long dc3co_count_before, dc3co_count_after; + + dc3co_count_before =igt_read_dc_counter (data->debugfs_fd, +IGT_INTEL_CHECK_DC3CO ); + +test_lobf (data, crtc, output, flags); + + dc3co_count_after =igt_read_dc_counter (data->debugfs_fd, +IGT_INTEL_CHECK_DC3CO ); + +igt_assert_f (dc3co_count_after > dc3co_count_before, +"DC3CO should be entered during link-off periods. " +"Before: %lu, After: %lu\n" , + dc3co_count_before, dc3co_count_after); +} +static void test_cleanup (data_t *data,igt_crtc_t *crtc,igt_output_t *output) { igt_crtc_set_prop_value(crtc,
@@ -1112,6 +1135,17 @@ int igt_main_args("drs:", long_opts, help_str, opt_handler, &data)run_vrr_test (&data, test_lobf,TEST_LINK_OFF ); } + +igt_describe ("This test validates DC3CO entry during LOBF (Link-Off Between " +"Frames) periods while VRR is active and PSR is disabled." ); + + igt_subtest_with_dynamic("lobf-dc3co") { +igt_require (intel_display_ver (intel_get_drm_devid (data.drm_fd)) >=35 ); + +igt_require_dc_counter (data.debugfs_fd,IGT_INTEL_CHECK_DC3CO ); + +run_vrr_test (&data, test_lobf_dc3co,TEST_LINK_OFF ); + } } igt_fixture() {
Signature · 1 line
2.43.0
PATCH v6 5/7 tests/intel/kms_pm_dc: Add new test for dc3co framedrop validation
In reply to Jeevan BAdd a new subtest to validate that no frame drops occur during DC3CO entry, ensuring that no frame drops are detected and DC3CO is successfully triggered during the test.
v2: update check_dc3co_framedrop for detecting frame drops via
drmWaitVBlank vblank sequence numbers, checks DC3CO counter to confirm entry and cast variable 'delay'.
v3: Rename function name from check_dc3co* to detect_dc3co*.
--- tests/intel/kms_pm_dc.c | 108 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+)
tests/intel/kms_pm_dc.c +108 -0
@@ -51,6 +51,10 @@* Description: Make sure that system enters DC3CO when PSR2 or PR is active and * system is in SLEEP state * +* SUBTEST: dc3co-framedrop-check +* Description: Verify that DC3CO entry does not cause frame drops and successfully +* enters the power state +* * SUBTEST: dc5-dpms * Description: Validate display engine entry to DC5 state while all connectors's * DPMS property set to OFF
@@ -342,6 +346,87 @@ static void test_dc3co_vpb_simulation(data_t *data)cleanup_dc3co_fbs (data); } +static void detect_dc3co_framedrop (data_t *data) +{ +igt_plane_t *primary; +uint32_t dc3co_prev_cnt; +int delay; +int frame_count =0 , frame_drops =0 ; +int max_count =60 ; +bool dc3co_flag = false; +bool front = false; +struct drm_event_vblank ev; +uint64_t last_flip_ns =0 , cur_flip_ns; +uint64_t frame_time_ns; + +igt_require_f (data->mode->vrefresh !=0 ,"Invalid vrefresh rate of 0\n" ); + + frame_time_ns =UINT64_C (1000000000 ) / data->mode->vrefresh; + + primary =igt_output_get_plane_type (data->output,DRM_PLANE_TYPE_PRIMARY ); +igt_plane_set_fb (primary,NULL ); +igt_display_commit (&data->display); + + dc3co_prev_cnt =igt_read_dc_counter (data->debugfs_fd,IGT_INTEL_CHECK_DC3CO ); + + delay = (int )(1.5 * (1000000 / data->mode->vrefresh)); + +igt_plane_set_fb (primary, &data->fb_rgb); +igt_assert_eq (igt_display_try_commit_atomic (&data->display, +DRM_MODE_ATOMIC_NONBLOCK | +DRM_MODE_PAGE_FLIP_EVENT , + data),0 ); +igt_assert_eq (read (data->drm_fd, &ev,sizeof (ev)),sizeof (ev)); + last_flip_ns = (uint64_t )ev.tv_sec *UINT64_C (1000000000 ) + + (uint64_t )ev.tv_usec *1000 ; + +while (frame_count < max_count) { + front = !front; +igt_plane_set_fb (primary, front ? &data->fb_rgr : &data->fb_rgb); +usleep (delay); + +igt_assert_eq (igt_display_try_commit_atomic (&data->display, +DRM_MODE_ATOMIC_NONBLOCK | +DRM_MODE_PAGE_FLIP_EVENT , + data),0 ); + +igt_set_timeout (2 ,"Waiting for flip event\n" ); +igt_assert_eq (read (data->drm_fd, &ev,sizeof (ev)),sizeof (ev)); +igt_reset_timeout (); + + cur_flip_ns = (uint64_t )ev.tv_sec *UINT64_C (1000000000 ) + + (uint64_t )ev.tv_usec *1000 ; + +if (last_flip_ns !=0 && + (cur_flip_ns - last_flip_ns) >2 * frame_time_ns) + frame_drops++; + + last_flip_ns = cur_flip_ns; + +if (!dc3co_flag && +igt_read_dc_counter (data->debugfs_fd, +IGT_INTEL_CHECK_DC3CO ) > dc3co_prev_cnt) + dc3co_flag = true; + + frame_count++; + } + +igt_assert_f (dc3co_flag,"DC3CO was not entered during the test\n" ); +igt_assert_f (frame_drops ==0 , +"Frame drops detected: %d drops out of %d frames\n" , + frame_drops, frame_count); +} + +static void test_dc3co_framedrop (data_t *data) +{ +igt_require_dc_counter (data->debugfs_fd,IGT_INTEL_CHECK_DC3CO ); +setup_output (data); +setup_dc3co (data); +setup_videoplayback (data); +detect_dc3co_framedrop (data); +cleanup_dc3co_fbs (data); +} +static void test_dc5_retention_flops (data_t *data,int dc_flag) {uint32_t dc_counter_before_psr;
@@ -693,6 +778,29 @@ int igt_main() } } +igt_describe ("Validate that no frame drops occur during DC3CO entry " +"while alternating framebuffers with PSR2 or Panel Replay active" ); + igt_subtest_with_dynamic("dc3co-framedrop-check") { + igt_dynamic("psr2") { + data.op_psr_mode =PSR_MODE_2 ; +igt_require (psr_sink_support (data.drm_fd, data.debugfs_fd, + data.op_psr_mode,NULL )); +igt_require_f (IS_TIGERLAKE (data.devid) || +intel_display_ver (data.devid) >=35 , +"Platform does not support DC3CO with PSR2\n" ); +test_dc3co_framedrop (&data); + } + + igt_dynamic("pr") { + data.op_psr_mode =PR_MODE ; +igt_require (psr_sink_support (data.drm_fd, data.debugfs_fd, + data.op_psr_mode,NULL )); +igt_require_f (intel_display_ver (data.devid) >=35 , +"Platform does not support DC3CO with Panel Replay\n" ); +test_dc3co_framedrop (&data); + } + } +igt_describe ("This test validates display engine entry to DC5 state " "while PSR is active" ); igt_subtest("dc5-psr") {
Signature · 1 line
2.43.0