tests/kms_psr_sink_crc: moving usleep around.
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/5 tests/kms_psr_sink_crc: moving usleep around.
Lets just do this small sleep to allow human eyes to see what is happening, but let's avoid any kind of interference on the actual test.
--- tests/kms_psr_sink_crc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tests/kms_psr_sink_crc.c +5 -1
@@ -327,6 +327,11 @@ static void get_sink_crc(data_t *data, char *crc) {igt_require (ret >0 );fclose (file); + +/* The important value was already taken. +* Now give a time for human eyes +*/ +usleep (300000 ); }static void test_crc (data_t *data)
@@ -342,7 +347,6 @@ static void test_crc(data_t *data) 1, 1) == 0); } -usleep (300000 );igt_assert (wait_psr_entry (data,10 ));get_sink_crc (data, ref_crc);
Signature · 1 line
1.9.3
PATCH 2/5 lib/igt_core: add igt_debug_wait
That allows you to read the debug and look to the screen to make sure what is on the screen is what you are expecting on debug line.
--- lib/igt_core.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
lib/igt_core.h +13 -0
@@ -514,6 +514,19 @@ void igt_vlog(enum igt_log_level level, const char *format, va_list args); #define igt_debug(f...) igt_log(IGT_LOG_DEBUG, f)/** +* igt_debug_wait: +* @wait: seconds to keep waiting +* @...: format string and optional arguments +* +* Wrapper for igt_log() for message at the IGT_LOG_DEBUG level with +* waiting time in seconds. +*/ +#define igt_debug_wait(wait, f...) \ + igt_log(IGT_LOG_DEBUG, f); \ + for (int w = 0; igt_log_level == IGT_LOG_DEBUG && w < (wait); w++) \ + sleep(1); + +/** * igt_info: * @...: format string and optional arguments *
Signature · 1 line
1.9.3
PATCH 3/5 igt/kms_psr_sink_crc: Add debug for CRC
In reply to Rodrigo ViviThis helps to debug and check if the CRC you are reading correspond what you are seeing on the screen
--- tests/kms_psr_sink_crc.c | 2 ++ 1 file changed, 2 insertions(+)
tests/kms_psr_sink_crc.c +2 -0
@@ -328,6 +328,8 @@ static void get_sink_crc(data_t *data, char *crc) {fclose (file); +igt_debug_wait (1 ,"%s\n" , crc); +/* The important value was already taken. * Now give a time for human eyes */
Signature · 1 line
1.9.3
Re: [PATCH 3/5] igt/kms_psr_sink_crc: Add debug for CRC
Quoted 14 lines · Rodrigo Vivi
This helps to debug and check if the CRC you are reading correspond what you are seeing on the screen
Signed-off-by Rodrigo Vivi <[email protected]>--- tests/kms_psr_sink_crc.c | 2 ++ 1 file changed, 2 insertions(+)tests/kms_psr_sink_crc.c +0
-0
tests/kms_psr_sink_crc.c static void get_sink_crc(data_t *data, char *crc) { · line 331
Quoted 4 lines
tests/kms_psr_sink_crc.c +1
-0@@ -328,6 +328,8 @@ static void get_sink_crc(data_t *data, char *crc) {fclose (file); +igt_debug_wait (1 ,"%s\n" , crc);
I think igt_wait_keypress here is the better option. Together with igt_check_boolean_env_var it should be fairly pretty. I'll send out a quick prep patch for this.
-Daniel
Quoted 11 lines
tests/kms_psr_sink_crc.c +1
-0+/* The important value was already taken. * Now give a time for human eyes */ Signature · 6 lines
1.9.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 4/5 lib/igt_core: Introduce a dry run debug option
In reply to Rodrigo ViviIGT_DRY_RUN allows you to run tests independent of any desired condition. For instance you can allow tests to run with the feature in test disabled in order to compare what results you should expect when the feature is actually enabled.
--- lib/igt_core.c | 16 ++++++++++------ lib/igt_core.h | 7 +++++++ 2 files changed, 17 insertions(+), 6 deletions(-)
lib/igt_core.c +10 -6
@@ -346,19 +346,23 @@ static int common_init(int argc, char **argv,int extra_opt_count;int all_opt_count;int ret =0 ; -char *env =getenv ("IGT_LOG_LEVEL" ); +char *log_level =getenv ("IGT_LOG_LEVEL" ); +char *dry_run =getenv ("IGT_DRY_RUN" ); -if (env) { -if (strcmp (env,"debug" ) ==0 ) +if (log_level) { +if (strcmp (log_level,"debug" ) ==0 ) igt_log_level =IGT_LOG_DEBUG ; -else if (strcmp (env,"info" ) ==0 ) +else if (strcmp (log_level,"info" ) ==0 ) igt_log_level =IGT_LOG_INFO ; -else if (strcmp (env,"warn" ) ==0 ) +else if (strcmp (log_level,"warn" ) ==0 ) igt_log_level =IGT_LOG_WARN ; -else if (strcmp (env,"none" ) ==0 ) +else if (strcmp (log_level,"none" ) ==0 ) igt_log_level =IGT_LOG_NONE ; } +if (dry_run) + igt_dry_run = true; + command_str = argv[0 ];if (strrchr (command_str,'/' )) command_str =strrchr (command_str,'/' ) +1 ;
lib/igt_core.h +7 -0
@@ -493,6 +493,13 @@ bool igt_run_in_simulation(void);void igt_skip_on_simulation (void ); +/* IGT_DRY_RUN allows you to run tests independent of any desired condition. +* For instance you can allow tests to run with the feature in test disabled +* in order to compare what results you should expect when the feature is +* actually enabled. +*/ +bool igt_dry_run; +/* structured logging */ enum igt_log_level {IGT_LOG_DEBUG ,
Signature · 1 line
1.9.3
PATCH 5/5 tests/kms_psr_sink_crc: Dry run with PSR disabled.
In reply to Rodrigo ViviThis allows to run tests with psr disabled and know what to expect when PSR is actually enabled.
--- tests/kms_psr_sink_crc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
tests/kms_psr_sink_crc.c +8 -0
@@ -72,6 +72,7 @@ typedef struct {igt_display_t display;struct igt_fb fb[2 ];igt_plane_t *plane[2 ]; +bool running_with_psr_disabled; } data_t;static const char *tests_str (enum tests test)
@@ -264,6 +265,9 @@ static bool psr_enabled(data_t *data)FILE *file;char str[4 ]; +if (data->running_with_psr_disabled) +return true; + file =igt_debugfs_fopen ("i915_edp_psr_status" ,"r" );igt_require (file);
@@ -284,6 +288,9 @@ static bool psr_active(data_t *data)FILE *file;char str[4 ]; +if (data->running_with_psr_disabled) +return true; + file =igt_debugfs_fopen ("i915_edp_psr_status" ,"r" );igt_require (file);
@@ -604,6 +611,7 @@ igt_mainkmstest_set_vt_graphics_mode (); data.devid =intel_get_drm_devid (data.drm_fd); + data.running_with_psr_disabled = igt_dry_run;igt_skip_on (!psr_enabled (&data));
Signature · 1 line
1.9.3
Re: [PATCH 5/5] tests/kms_psr_sink_crc: Dry run with PSR disabled.
Quoted 4 lines · Rodrigo Vivi
This allows to run tests with psr disabled and know what to expect when PSR is actually enabled.
Signed-off-by Rodrigo Vivi <[email protected]>
I don't really follow what this is useful for ... Can you please elaborate how this is used and how it helps debugging?
-Daniel
Quoted 51 lines
--- tests/kms_psr_sink_crc.c | 8 ++++++++ 1 file changed, 8 insertions(+)tests/kms_psr_sink_crc.c +8
-0@@ -72,6 +72,7 @@ typedef struct {igt_display_t display;struct igt_fb fb[2 ];igt_plane_t *plane[2 ]; +bool running_with_psr_disabled; } data_t;static const char *tests_str (enum tests test)@@ -264,6 +265,9 @@ static bool psr_enabled(data_t *data)FILE *file;char str[4 ]; +if (data->running_with_psr_disabled) +return true; + file =igt_debugfs_fopen ("i915_edp_psr_status" ,"r" );igt_require (file);@@ -284,6 +288,9 @@ static bool psr_active(data_t *data)FILE *file;char str[4 ]; +if (data->running_with_psr_disabled) +return true; + file =igt_debugfs_fopen ("i915_edp_psr_status" ,"r" );igt_require (file);@@ -604,6 +611,7 @@ igt_mainkmstest_set_vt_graphics_mode (); data.devid =intel_get_drm_devid (data.drm_fd); + data.running_with_psr_disabled = igt_dry_run;igt_skip_on (!psr_enabled (&data));Signature · 6 lines
1.9.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 5/5] tests/kms_psr_sink_crc: Dry run with PSR disabled.
I really didn't like this implementation because I'm using the global variable in the test case.
So I think also providing a define igt_skip_function_on_dryrun() if (igt_dry_run) return 0 is more igt like.
For psr I need a way to run the testcases even when PSR is disabled to know what to expect. So dryrun on psr test case means runs even with psr disabled.
For any other feature could be something similar, run with feature disabled. Or also it can be used for any other big testcase using a local assert that do this plus igt_assert next so it can avoid fails and execute the test to the end just to check all interactions.
So, what do you think? I could live with my old define on code though...
Quoted 71 lines · Daniel Vetter
Quoted 4 lines · Rodrigo Vivi
This allows to run tests with psr disabled and know what to expect when PSR is actually enabled.
Signed-off-by Rodrigo Vivi <[email protected]>I don't really follow what this is useful for ... Can you please elaborate how this is used and how it helps debugging?
-DanielQuoted 47 lines
--- tests/kms_psr_sink_crc.c | 8 ++++++++ 1 file changed, 8 insertions(+)tests/kms_psr_sink_crc.c +8
-1@@ -72,6 +72,7 @@ typedef struct {igt_display_t display;struct igt_fb fb[2 ];igt_plane_t *plane[2 ]; +bool running_with_psr_disabled; } data_t;static const char *tests_str (enum tests test)@@ -264,6 +265,9 @@ static bool psr_enabled(data_t *data)FILE *file;char str[4 ]; +if (data->running_with_psr_disabled) +return true; + file =igt_debugfs_fopen ("i915_edp_psr_status" ,"r" );igt_require (file);@@ -284,6 +288,9 @@ static bool psr_active(data_t *data)FILE *file;char str[4 ]; +if (data->running_with_psr_disabled) +return true; + file =igt_debugfs_fopen ("i915_edp_psr_status" ,"r" );igt_require (file);@@ -604,6 +611,7 @@ igt_mainkmstest_set_vt_graphics_mode (); data.devid =intel_get_drm_devid (data.drm_fd); + data.running_with_psr_disabled = igt_dry_run;igt_skip_on (!psr_enabled (&data)); --1.9.3
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/5] tests/kms_psr_sink_crc: Dry run with PSR disabled.
Quoted 14 lines · Rodrigo Vivi
I really didn't like this implementation because I'm using the global variable in the test case.
So I think also providing a define
igt_skip_function_on_dryrun()if (igt_dry_run) return 0 is more igt like.For psr I need a way to run the testcases even when PSR is disabled to know what to expect. So dryrun on psr test case means runs even with psr disabled.
For any other feature could be something similar, run with feature disabled. Or also it can be used for any other big testcase using a local assert that do this plusigt_assertnext so it can avoid fails and execute the test to the end just to check all interactions.
Quoted 1 line
So, what do you think? I could live with my old define on code though...
I'd just add a --dry-run option to the psr testcase here. With the recent work to unify option parsing it's fairly simple to add test-specific options. And I don't really see a use-case for a generic dry-run flag outside of this testcase. Or at least not one which means the same thing in all tests - I expect each test will want to have different kinds of dry-run behaviour.
-Daniel
Quoted 84 lines · Daniel Vetter
Quoted 72 lines · Rodrigo Vivi
Quoted 4 lines
This allows to run tests with psr disabled and know what to expect when PSR is actually enabled.
Signed-off-by Rodrigo Vivi <[email protected]>I don't really follow what this is useful for ... Can you please elaborate how this is used and how it helps debugging?
-DanielQuoted 47 lines
--- tests/kms_psr_sink_crc.c | 8 ++++++++ 1 file changed, 8 insertions(+)tests/kms_psr_sink_crc.c +8
-1@@ -72,6 +72,7 @@ typedef struct {igt_display_t display;struct igt_fb fb[2 ];igt_plane_t *plane[2 ]; +bool running_with_psr_disabled; } data_t;static const char *tests_str (enum tests test)@@ -264,6 +265,9 @@ static bool psr_enabled(data_t *data)FILE *file;char str[4 ]; +if (data->running_with_psr_disabled) +return true; + file =igt_debugfs_fopen ("i915_edp_psr_status" ,"r" );igt_require (file);@@ -284,6 +288,9 @@ static bool psr_active(data_t *data)FILE *file;char str[4 ]; +if (data->running_with_psr_disabled) +return true; + file =igt_debugfs_fopen ("i915_edp_psr_status" ,"r" );igt_require (file);@@ -604,6 +611,7 @@ igt_mainkmstest_set_vt_graphics_mode (); data.devid =intel_get_drm_devid (data.drm_fd); + data.running_with_psr_disabled = igt_dry_run;igt_skip_on (!psr_enabled (&data)); --1.9.3
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 13 lines · Rodrigo Vivi
Lets just do this small sleep to allow human eyes to see what is happening, but let's avoid any kind of interference on the actual test.
Signed-off-by Rodrigo Vivi <[email protected]>--- tests/kms_psr_sink_crc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)tests/kms_psr_sink_crc.c +0
-0
tests/kms_psr_sink_crc.c static void get_sink_crc(data_t *data, char *crc) { · line 334
Quoted 8 lines
tests/kms_psr_sink_crc.c +5
-0@@ -327,6 +327,11 @@ static void get_sink_crc(data_t *data, char *crc) {igt_require (ret >0 );fclose (file); + +/* The important value was already taken. +* Now give a time for human eyes +*/ +usleep (300000 );
We have igt_wait_for_keypress already, which is unfortunately not terribly userfriendly (since the env-var is undocumented). Maybe we should apply a bit of polish there. Have you considered using that one? Just fyi really. -Daniel
Quoted 18 lines
tests/kms_psr_sink_crc.c +0
-1}static void test_crc (data_t *data)@@ -342,7 +347,6 @@ static void test_crc(data_t *data) 1, 1) == 0); } -usleep (300000 );igt_assert (wait_psr_entry (data,10 ));get_sink_crc (data, ref_crc);Signature · 6 lines
1.9.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 1/1 tests/kms_psr_sink_crc: Adding test debug options
In reply to a message not in the archiveJust to make life easier and be eable to easily test with PSR disabled to know exactly what to expect when running it for real
v3: Use igt_debug helpers and add env option for running with psr disabled on this test without have to recompile like v1 or changing igt infrastructure like v2. I tried to add --disable-psr or local --dry-run but than it fails to print subtests so this was the safest way.
--- tests/kms_psr_sink_crc.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-)
tests/kms_psr_sink_crc.c +25 -4
@@ -36,6 +36,7 @@#include "intel_chipset.h" #include "igt_debugfs.h" #include "igt_kms.h" +#include "igt_aux.h" enum tests {TEST_PAGE_FLIP ,
@@ -57,6 +58,8 @@ enum tests { TEST_SPRITE, }; +bool running_with_psr_disabled; + typedef struct { int drm_fd; enum tests test;
@@ -264,6 +267,9 @@ static bool psr_enabled(data_t *data)FILE *file;char str[4 ]; +if (running_with_psr_disabled) +return true; + file =igt_debugfs_fopen ("i915_edp_psr_status" ,"r" );igt_require (file);
@@ -284,6 +290,9 @@ static bool psr_active(data_t *data)FILE *file;char str[4 ]; +if (running_with_psr_disabled) +return true; + file =igt_debugfs_fopen ("i915_edp_psr_status" ,"r" );igt_require (file);
@@ -327,6 +336,14 @@ static void get_sink_crc(data_t *data, char *crc) {igt_require (ret >0 );fclose (file); + +igt_debug ("%s\n" , crc); +igt_debug_wait_for_keypress ("crc" ); + +/* The important value was already taken. +* Now give a time for human eyes +*/ +usleep (300000 ); }static void test_crc (data_t *data)
@@ -342,7 +359,6 @@ static void test_crc(data_t *data) 1, 1) == 0); } -usleep (300000 );igt_assert (wait_psr_entry (data,10 ));get_sink_crc (data, ref_crc);
@@ -586,11 +602,16 @@ static void run_test(data_t *data) } } -data_t data = {}; -enum tests test; - igt_main { +data_t data = {}; +enum tests test; +char *env_psr; + + env_psr =getenv ("IGT_PSR_DISABLED" ); + + running_with_psr_disabled = (bool ) env_psr; +igt_skip_on_simulation (); igt_fixture {
Signature · 1 line
1.9.3