igt/kms_psr_sink_crc: Add debug for CRC
PATCH 1/5 igt/kms_psr_sink_crc: Add debug for CRC
This 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
PATCH 2/5 lib/igt_core: Introduce a dry run debug option
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.
--- 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 3/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
PATCH 4/5 tests/kms_psr_sink_crc: Removing context tests.
In reply to Rodrigo ViviThis tests are unecessary. Mainly now with the software tracking for PSR.
--- tests/kms_psr_sink_crc.c | 69 +++--------------------------------------------- 1 file changed, 3 insertions(+), 66 deletions(-)
tests/kms_psr_sink_crc.c +3 -66
@@ -47,12 +47,10 @@ enum tests {TEST_SETDOMAIN_WAIT_WRITE_CPU ,TEST_BLT ,TEST_RENDER , -TEST_CONTEXT ,TEST_PAGE_FLIP_AND_MMAP_CPU ,TEST_PAGE_FLIP_AND_MMAP_GTT ,TEST_PAGE_FLIP_AND_BLT ,TEST_PAGE_FLIP_AND_RENDER , -TEST_PAGE_FLIP_AND_CONTEXT ,TEST_CURSOR_MOVE , TEST_SPRITE, };
@@ -62,7 +60,6 @@ typedef struct {enum tests test;drmModeRes *resources;drm_intel_bufmgr *bufmgr; -drm_intel_context *ctx[2 ];uint32_t devid;uint32_t handle[2 ];uint32_t crtc_id;
@@ -87,12 +84,10 @@ static const char *tests_str(enum tests test) [TEST_SETDOMAIN_WAIT_WRITE_CPU] = "setdomain_wait_write_cpu", [TEST_BLT] = "blt", [TEST_RENDER] = "render", - [TEST_CONTEXT] = "context", [TEST_PAGE_FLIP_AND_MMAP_CPU] = "page_flip_and_mmap_cpu", [TEST_PAGE_FLIP_AND_MMAP_GTT] = "page_flip_and_mmap_gtt", [TEST_PAGE_FLIP_AND_BLT] = "page_flip_and_blt", [TEST_PAGE_FLIP_AND_RENDER] = "page_flip_and_render", - [TEST_PAGE_FLIP_AND_CONTEXT] = "page_flip_and_context", [TEST_CURSOR_MOVE] = "cursor_move", [TEST_SPRITE] = "sprite", };
@@ -202,31 +197,7 @@ static void scratch_buf_init(struct igt_buf *buf, drm_intel_bo *bo) buf->size =4096 ; } -static void exec_nop (data_t *data,uint32_t handle,drm_intel_context *context) -{ -drm_intel_bo *dst; -struct intel_batchbuffer *batch; - - dst =gem_handle_to_libdrm_bo (data->bufmgr, data->drm_fd,"" , handle); -igt_assert (dst); - - batch =intel_batchbuffer_alloc (data->bufmgr, data->devid); -igt_assert (batch); - -/* add the reloc to make sure the kernel will think we write to dst */ -BEGIN_BATCH (4 ,1 ); -OUT_BATCH (MI_BATCH_BUFFER_END ); -OUT_BATCH (MI_NOOP ); -OUT_RELOC (dst,I915_GEM_DOMAIN_RENDER ,I915_GEM_DOMAIN_RENDER ,0 ); -OUT_BATCH (MI_NOOP ); -ADVANCE_BATCH (); - -intel_batchbuffer_flush_with_context (batch, context); -intel_batchbuffer_free (batch); -} - -static void fill_render (data_t *data,uint32_t handle, -drm_intel_context *context,unsigned char color) +static void fill_render (data_t *data,uint32_t handle,unsigned char color) {drm_intel_bo *src, *dst;struct intel_batchbuffer *batch;
@@ -250,7 +221,7 @@ static void fill_render(data_t *data, uint32_t handle, batch =intel_batchbuffer_alloc (data->bufmgr, data->devid);igt_assert (batch); -rendercopy (batch, context, +rendercopy (batch,NULL , &src_buf,0 ,0 ,1 ,1 , &dst_buf,0 ,0 );
@@ -437,13 +408,8 @@ static void test_crc(data_t *data)fill_blt (data, handle,0xff );break ;case TEST_RENDER : -case TEST_CONTEXT :case TEST_PAGE_FLIP_AND_RENDER : -case TEST_PAGE_FLIP_AND_CONTEXT : -fill_render (data, handle, - (data->test ==TEST_CONTEXT || - data->test ==TEST_PAGE_FLIP_AND_CONTEXT ) ? - data->ctx[1 ] :NULL ,0xff ); +fill_render (data, handle,0xff );break ;case TEST_CURSOR_MOVE :igt_assert (drmModeMoveCursor (data->drm_fd, data->crtc_id,1 ,2 ) ==0 );
@@ -492,42 +458,15 @@ static bool prepare_crtc(data_t *data, uint32_t connector_id)connector_set_mode (data, &data->config.default_mode, data->fb_id[1 ]); -if (data->test ==TEST_CONTEXT || - data->test ==TEST_PAGE_FLIP_AND_CONTEXT ) { - data->ctx[0 ] =drm_intel_gem_context_create (data->bufmgr); -igt_require (data->ctx[0 ]); - data->ctx[1 ] =drm_intel_gem_context_create (data->bufmgr); -igt_require (data->ctx[1 ]); - -exec_nop (data, data->handle[0 ], data->ctx[1 ]); -exec_nop (data, data->handle[0 ], data->ctx[0 ]); -exec_nop (data, data->handle[0 ], data->ctx[1 ]); -exec_nop (data, data->handle[0 ], data->ctx[0 ]); - } -/* scanout = fb[0] */ connector_set_mode (data, &data->config.default_mode, data->fb_id[0 ]); -if (data->test ==TEST_CONTEXT || - data->test ==TEST_PAGE_FLIP_AND_CONTEXT ) { -exec_nop (data, data->fb[0 ].gem_handle, data->ctx[0 ]); - } -kmstest_free_connector_config (&data->config);return true; } -static void finish_crtc (data_t *data) -{ -if (data->test ==TEST_CONTEXT || - data->test ==TEST_PAGE_FLIP_AND_CONTEXT ) { -drm_intel_gem_context_destroy (data->ctx[0 ]); -drm_intel_gem_context_destroy (data->ctx[1 ]); - } -} -static void test_sprite (data_t *data) {igt_display_t *display = &data->display;
@@ -593,8 +532,6 @@ static void run_test(data_t *data)continue ;test_crc (data); - -finish_crtc (data); } } }
Signature · 1 line
1.9.3
PATCH 5/5 tests/kms_psr_sink_crc: Cleaning up tests a bit
In reply to Rodrigo ViviThis is needed to be able to split tests in a matrix that tests different input/write methods and operations for different type of planes.
--- tests/kms_psr_sink_crc.c | 67 ------------------------------------------------ 1 file changed, 67 deletions(-)
tests/kms_psr_sink_crc.c +0 -67
@@ -41,16 +41,8 @@ enum tests {TEST_PAGE_FLIP ,TEST_MMAP_CPU ,TEST_MMAP_GTT , -TEST_MMAP_GTT_NO_BUSY , -TEST_MMAP_GTT_WAITING_NO_BUSY , -TEST_SETDOMAIN_WAIT_WRITE_GTT , -TEST_SETDOMAIN_WAIT_WRITE_CPU ,TEST_BLT ,TEST_RENDER , -TEST_PAGE_FLIP_AND_MMAP_CPU , -TEST_PAGE_FLIP_AND_MMAP_GTT , -TEST_PAGE_FLIP_AND_BLT , -TEST_PAGE_FLIP_AND_RENDER ,TEST_CURSOR_MOVE , TEST_SPRITE, };
@@ -78,16 +70,8 @@ static const char *tests_str(enum tests test) [TEST_PAGE_FLIP] = "page_flip", [TEST_MMAP_CPU] = "mmap_cpu", [TEST_MMAP_GTT] = "mmap_gtt", - [TEST_MMAP_GTT_NO_BUSY] = "mmap_gtt_no_busy", - [TEST_MMAP_GTT_WAITING_NO_BUSY] = "mmap_gtt_waiting_no_busy", - [TEST_SETDOMAIN_WAIT_WRITE_GTT] = "setdomain_wait_write_gtt", - [TEST_SETDOMAIN_WAIT_WRITE_CPU] = "setdomain_wait_write_cpu", [TEST_BLT] = "blt", [TEST_RENDER] = "render", - [TEST_PAGE_FLIP_AND_MMAP_CPU] = "page_flip_and_mmap_cpu", - [TEST_PAGE_FLIP_AND_MMAP_GTT] = "page_flip_and_mmap_gtt", - [TEST_PAGE_FLIP_AND_BLT] = "page_flip_and_blt", - [TEST_PAGE_FLIP_AND_RENDER] = "page_flip_and_render", [TEST_CURSOR_MOVE] = "cursor_move", [TEST_SPRITE] = "sprite", };
@@ -336,10 +320,6 @@ static void test_crc(data_t *data)igt_assert (drmModePageFlip (data->drm_fd, data->crtc_id, data->fb_id[1 ],0 ,NULL ) ==0 );break ; -case TEST_PAGE_FLIP_AND_MMAP_CPU : - handle = data->handle[1 ]; -igt_assert (drmModePageFlip (data->drm_fd, data->crtc_id, - data->fb_id[1 ],0 ,NULL ) ==0 );case TEST_MMAP_CPU : ptr =gem_mmap__cpu (data->drm_fd, handle,4096 ,PROT_WRITE ); gem_set_domain(data->drm_fd, handle,
@@ -350,10 +330,6 @@ static void test_crc(data_t *data)sleep (1 );gem_sw_finish (data->drm_fd, handle);break ; -case TEST_PAGE_FLIP_AND_MMAP_GTT : - handle = data->handle[1 ]; -igt_assert (drmModePageFlip (data->drm_fd, data->crtc_id, - data->fb_id[1 ],0 ,NULL ) ==0 );case TEST_MMAP_GTT : ptr =gem_mmap__gtt (data->drm_fd, handle,4096 ,PROT_WRITE ); gem_set_domain(data->drm_fd, handle,
@@ -362,53 +338,10 @@ static void test_crc(data_t *data)munmap (ptr,4096 );gem_bo_busy (data->drm_fd, handle);break ; -case TEST_MMAP_GTT_NO_BUSY : - ptr =gem_mmap__gtt (data->drm_fd, handle,4096 ,PROT_WRITE ); -gem_set_domain (data->drm_fd, handle, -I915_GEM_DOMAIN_GTT ,I915_GEM_DOMAIN_GTT ); -memset (ptr,0xff ,4 ); -munmap (ptr,4096 ); -break ; -case TEST_MMAP_GTT_WAITING_NO_BUSY : - ptr =gem_mmap__gtt (data->drm_fd, handle,4096 ,PROT_WRITE ); -gem_set_domain (data->drm_fd, handle, -I915_GEM_DOMAIN_GTT ,I915_GEM_DOMAIN_GTT ); -igt_info ("Sleeping for 10 sec...\n" ); -sleep (10 ); -memset (ptr,0xff ,4 ); -munmap (ptr,4096 ); -break ; -case TEST_SETDOMAIN_WAIT_WRITE_GTT : - ptr =gem_mmap__gtt (data->drm_fd, handle,4096 ,PROT_WRITE ); -fill_blt (data, handle,0xff ); -igt_assert (wait_psr_entry (data,10 )); -get_sink_crc (data, ref_crc); -gem_set_domain (data->drm_fd, handle, -I915_GEM_DOMAIN_GTT ,I915_GEM_DOMAIN_GTT ); -igt_info ("Sleeping for 10 sec...\n" ); -sleep (10 ); -memset (ptr,0xff ,4 ); -munmap (ptr,4096 ); -break ; -case TEST_SETDOMAIN_WAIT_WRITE_CPU : - ptr =gem_mmap__cpu (data->drm_fd, handle,4096 ,PROT_WRITE ); -fill_blt (data, handle,0xff ); -igt_assert (wait_psr_entry (data,10 )); -get_sink_crc (data, ref_crc); -gem_set_domain (data->drm_fd, handle, -I915_GEM_DOMAIN_CPU ,I915_GEM_DOMAIN_CPU ); -igt_info ("Sleeping for 10 sec...\n" ); -sleep (10 ); -memset (ptr,0xff ,4 ); -munmap (ptr,4096 ); -gem_sw_finish (data->drm_fd, handle); -break ;case TEST_BLT : -case TEST_PAGE_FLIP_AND_BLT :fill_blt (data, handle,0xff );break ;case TEST_RENDER : -case TEST_PAGE_FLIP_AND_RENDER :fill_render (data, handle,0xff );break ;case TEST_CURSOR_MOVE :
Signature · 1 line
1.9.3
please ignore these 5 patches...
Quoted 30 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 +2
-1@@ -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 */ --1.9.3
_______________________________________________
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