Module: Mesa Branch: main Commit: 015eecde47d514f82a7049f497009b3fe3c4116a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=015eecde47d514f82a7049f497009b3fe3c4116a
Author: Felix DeGrood <[email protected]> Date: Mon Apr 24 20:59:15 2023 +0000 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 <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22564> --- 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 8aaddfc5185..709f93c3ea8 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 08d50f57b65..64b38b5951d 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
