From 015eecde47d514f82a7049f497009b3fe3c4116a Mon Sep 17 00:00:00 2001 From: Felix DeGrood Date: Mon, 24 Apr 2023 20:59:15 +0000 Subject: [PATCH] intel/debug: Control start/stop frame of batch debug When using INTEL_DEBUG=bat, INTEL_DEBUG_BATCH_FRAME_START and INTEL_DEBUG_BATCH_FRAME_STOP can limit dumping of batches for particular frame ranges. Batch dumps are huge. Smart filtering allows debugging of single frames during game play. Initial commit to debug infrastructure. Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/dev/intel_debug.c | 18 ++++++++++++++++++ src/intel/dev/intel_debug.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/src/intel/dev/intel_debug.c b/src/intel/dev/intel_debug.c index 8aaddfc..709f93c 100644 --- a/src/intel/dev/intel_debug.c +++ b/src/intel/dev/intel_debug.c @@ -177,11 +177,19 @@ intel_debug_flag_for_shader_stage(gl_shader_stage stage) DEBUG_MS_SIMD32 | \ DEBUG_RT_SIMD32) +static uint64_t intel_debug_batch_frame_start = 0; +static uint64_t intel_debug_batch_frame_stop = -1; + static void brw_process_intel_debug_variable_once(void) { intel_debug = parse_debug_string(getenv("INTEL_DEBUG"), debug_control); intel_simd = parse_debug_string(getenv("INTEL_SIMD_DEBUG"), simd_control); + intel_debug_batch_frame_start = + debug_get_num_option("INTEL_DEBUG_BATCH_FRAME_START", 0); + intel_debug_batch_frame_stop = + debug_get_num_option("INTEL_DEBUG_BATCH_FRAME_STOP", -1); + if (!(intel_simd & DEBUG_FS_SIMD)) intel_simd |= DEBUG_FS_SIMD; @@ -326,3 +334,13 @@ intel_debug_get_identifier_block(void *_buffer, return NULL; } + +/** + * Check if in valid frame range for batch dumping + */ +bool +intel_debug_batch_in_range(uint64_t frame_id) +{ + return frame_id >= intel_debug_batch_frame_start && + frame_id < intel_debug_batch_frame_stop; +} diff --git a/src/intel/dev/intel_debug.h b/src/intel/dev/intel_debug.h index 08d50f5..64b38b5 100644 --- a/src/intel/dev/intel_debug.h +++ b/src/intel/dev/intel_debug.h @@ -197,6 +197,8 @@ extern void *intel_debug_get_identifier_block(void *buffer, uint32_t buffer_size, enum intel_debug_block_type type); +bool intel_debug_batch_in_range(uint64_t frame_id); + #ifdef __cplusplus } #endif -- 2.7.4