2013-07-07 19:02:56 -07:00
|
|
|
/*
|
s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the
old copyright name is creating unnecessary confusion, hence this change.
This was the sed script I used:
$ cat tg2vmw.sed
# Run as:
#
# git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
#
# Rename copyrights
s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
/Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
s/TUNGSTEN GRAPHICS/VMWARE/g
# Rename emails
s/alanh@tungstengraphics.com/alanh@vmware.com/
s/jens@tungstengraphics.com/jowen@vmware.com/g
s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
s/michel@tungstengraphics.com/daenzer@vmware.com/g
s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
s/zack@tungstengraphics.com/zackr@vmware.com/
# Remove dead links
s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g
# C string src/gallium/state_trackers/vega/api_misc.c
s/"Tungsten Graphics, Inc"/"VMware, Inc"/
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 16:27:50 +00:00
|
|
|
* Copyright 2003 VMware, Inc.
|
2013-07-07 19:02:56 -07:00
|
|
|
* Copyright © 2006 Intel Corporation
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
|
*
|
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
|
* Software.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
|
|
* IN THE SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-05 10:44:41 -07:00
|
|
|
* \file intel_debug.c
|
2013-07-07 19:02:56 -07:00
|
|
|
*
|
|
|
|
|
* Support for the INTEL_DEBUG environment variable, along with other
|
|
|
|
|
* miscellaneous debugging code.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-12-24 02:40:26 +02:00
|
|
|
#include <stdio.h>
|
2017-03-01 11:20:25 -08:00
|
|
|
#include <stdlib.h>
|
2019-12-24 02:40:26 +02:00
|
|
|
#include <string.h>
|
2017-03-01 11:20:25 -08:00
|
|
|
|
2021-04-05 10:44:41 -07:00
|
|
|
#include "dev/intel_debug.h"
|
2019-12-24 02:40:26 +02:00
|
|
|
#include "git_sha1.h"
|
2017-03-01 11:20:25 -08:00
|
|
|
#include "util/macros.h"
|
2022-09-13 12:49:56 +03:00
|
|
|
#include "util/u_debug.h"
|
2023-02-22 19:07:52 -08:00
|
|
|
#include "util/u_math.h"
|
2017-03-05 23:23:25 +02:00
|
|
|
#include "c11/threads.h"
|
2013-07-07 19:02:56 -07:00
|
|
|
|
2020-09-14 18:43:50 +02:00
|
|
|
uint64_t intel_debug = 0;
|
2013-07-07 19:02:56 -07:00
|
|
|
|
2023-01-21 12:49:44 +01:00
|
|
|
#define DEBUG_NO16 (1ull << 16)
|
|
|
|
|
#define DEBUG_NO8 (1ull << 20)
|
|
|
|
|
#define DEBUG_NO32 (1ull << 39)
|
|
|
|
|
|
2015-10-05 14:13:29 -07:00
|
|
|
static const struct debug_control debug_control[] = {
|
2014-09-23 16:15:22 -07:00
|
|
|
{ "tex", DEBUG_TEXTURE},
|
|
|
|
|
{ "blit", DEBUG_BLIT},
|
|
|
|
|
{ "fall", DEBUG_PERF},
|
|
|
|
|
{ "perf", DEBUG_PERF},
|
|
|
|
|
{ "perfmon", DEBUG_PERFMON},
|
|
|
|
|
{ "bat", DEBUG_BATCH},
|
|
|
|
|
{ "buf", DEBUG_BUFMGR},
|
|
|
|
|
{ "fs", DEBUG_WM },
|
|
|
|
|
{ "gs", DEBUG_GS},
|
|
|
|
|
{ "sync", DEBUG_SYNC},
|
|
|
|
|
{ "sf", DEBUG_SF },
|
2017-09-05 15:46:30 -07:00
|
|
|
{ "submit", DEBUG_SUBMIT },
|
2014-09-23 16:15:22 -07:00
|
|
|
{ "wm", DEBUG_WM },
|
|
|
|
|
{ "urb", DEBUG_URB },
|
|
|
|
|
{ "vs", DEBUG_VS },
|
|
|
|
|
{ "clip", DEBUG_CLIP },
|
|
|
|
|
{ "no16", DEBUG_NO16 },
|
|
|
|
|
{ "blorp", DEBUG_BLORP },
|
|
|
|
|
{ "nodualobj", DEBUG_NO_DUAL_OBJECT_GS },
|
|
|
|
|
{ "optimizer", DEBUG_OPTIMIZER },
|
2014-11-13 10:40:01 -08:00
|
|
|
{ "ann", DEBUG_ANNOTATION },
|
2014-09-23 16:15:22 -07:00
|
|
|
{ "no8", DEBUG_NO8 },
|
2017-08-29 10:41:27 +01:00
|
|
|
{ "no-oaconfig", DEBUG_NO_OACONFIG },
|
2015-07-23 11:11:53 +02:00
|
|
|
{ "spill_fs", DEBUG_SPILL_FS },
|
|
|
|
|
{ "spill_vec4", DEBUG_SPILL_VEC4 },
|
2014-01-10 21:39:25 -08:00
|
|
|
{ "cs", DEBUG_CS },
|
2015-10-25 19:05:56 -07:00
|
|
|
{ "hex", DEBUG_HEX },
|
2015-10-29 16:08:45 -07:00
|
|
|
{ "nocompact", DEBUG_NO_COMPACTION },
|
2015-07-25 19:28:59 -07:00
|
|
|
{ "hs", DEBUG_TCS },
|
|
|
|
|
{ "tcs", DEBUG_TCS },
|
|
|
|
|
{ "ds", DEBUG_TES },
|
|
|
|
|
{ "tes", DEBUG_TES },
|
2015-09-05 15:05:48 +03:00
|
|
|
{ "l3", DEBUG_L3 },
|
2016-05-26 21:28:45 -07:00
|
|
|
{ "do32", DEBUG_DO32 },
|
2022-03-18 01:31:39 -07:00
|
|
|
{ "norbc", DEBUG_NO_CCS },
|
|
|
|
|
{ "noccs", DEBUG_NO_CCS },
|
2017-03-13 14:23:34 -07:00
|
|
|
{ "nohiz", DEBUG_NO_HIZ },
|
2017-03-20 01:58:48 -07:00
|
|
|
{ "color", DEBUG_COLOR },
|
2017-09-15 17:47:07 -07:00
|
|
|
{ "reemit", DEBUG_REEMIT },
|
2019-03-03 10:10:46 -06:00
|
|
|
{ "soft64", DEBUG_SOFT64 },
|
2019-05-23 14:17:41 -07:00
|
|
|
{ "bt", DEBUG_BT },
|
2019-06-19 16:04:50 -05:00
|
|
|
{ "pc", DEBUG_PIPE_CONTROL },
|
2019-10-07 17:04:01 -07:00
|
|
|
{ "nofc", DEBUG_NO_FAST_CLEAR },
|
2020-04-22 13:29:34 -07:00
|
|
|
{ "no32", DEBUG_NO32 },
|
2020-09-02 14:25:54 +02:00
|
|
|
{ "shaders", DEBUG_WM | DEBUG_VS | DEBUG_TCS |
|
2020-10-21 14:46:39 -05:00
|
|
|
DEBUG_TES | DEBUG_GS | DEBUG_CS |
|
2021-02-09 20:07:22 -08:00
|
|
|
DEBUG_RT | DEBUG_TASK | DEBUG_MESH },
|
2020-10-21 14:46:39 -05:00
|
|
|
{ "rt", DEBUG_RT },
|
2021-02-09 20:07:22 -08:00
|
|
|
{ "task", DEBUG_TASK },
|
|
|
|
|
{ "mesh", DEBUG_MESH },
|
2022-05-05 02:37:27 +03:00
|
|
|
{ "stall", DEBUG_STALL },
|
2022-10-06 00:34:52 +03:00
|
|
|
{ "capture-all", DEBUG_CAPTURE_ALL },
|
2022-07-21 08:25:39 +00:00
|
|
|
{ "perf-symbol-names", DEBUG_PERF_SYMBOL_NAMES },
|
2023-03-08 12:31:51 -08:00
|
|
|
{ "swsb-stall", DEBUG_SWSB_STALL },
|
2013-07-07 19:02:56 -07:00
|
|
|
{ NULL, 0 }
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-21 12:49:44 +01:00
|
|
|
uint64_t intel_simd = 0;
|
|
|
|
|
|
|
|
|
|
static const struct debug_control simd_control[] = {
|
|
|
|
|
{ "fs8", DEBUG_FS_SIMD8 },
|
|
|
|
|
{ "fs16", DEBUG_FS_SIMD16 },
|
|
|
|
|
{ "fs32", DEBUG_FS_SIMD32 },
|
|
|
|
|
{ "cs8", DEBUG_CS_SIMD8 },
|
|
|
|
|
{ "cs16", DEBUG_CS_SIMD16 },
|
|
|
|
|
{ "cs32", DEBUG_CS_SIMD32 },
|
|
|
|
|
{ "ts8", DEBUG_TS_SIMD8 },
|
|
|
|
|
{ "ts16", DEBUG_TS_SIMD16 },
|
|
|
|
|
{ "ts32", DEBUG_TS_SIMD32 },
|
|
|
|
|
{ "ms8", DEBUG_MS_SIMD8 },
|
|
|
|
|
{ "ms16", DEBUG_MS_SIMD16 },
|
|
|
|
|
{ "ms32", DEBUG_MS_SIMD32 },
|
|
|
|
|
{ "rt8", DEBUG_RT_SIMD8 },
|
|
|
|
|
{ "rt16", DEBUG_RT_SIMD16 },
|
|
|
|
|
{ "rt32", DEBUG_RT_SIMD32 },
|
|
|
|
|
{ NULL, 0 }
|
|
|
|
|
};
|
|
|
|
|
|
2015-02-18 17:31:29 -08:00
|
|
|
uint64_t
|
|
|
|
|
intel_debug_flag_for_shader_stage(gl_shader_stage stage)
|
|
|
|
|
{
|
2014-01-10 21:39:25 -08:00
|
|
|
uint64_t flags[] = {
|
2015-02-18 17:31:29 -08:00
|
|
|
[MESA_SHADER_VERTEX] = DEBUG_VS,
|
2015-07-25 19:28:59 -07:00
|
|
|
[MESA_SHADER_TESS_CTRL] = DEBUG_TCS,
|
|
|
|
|
[MESA_SHADER_TESS_EVAL] = DEBUG_TES,
|
2015-02-18 17:31:29 -08:00
|
|
|
[MESA_SHADER_GEOMETRY] = DEBUG_GS,
|
|
|
|
|
[MESA_SHADER_FRAGMENT] = DEBUG_WM,
|
2014-01-10 21:39:25 -08:00
|
|
|
[MESA_SHADER_COMPUTE] = DEBUG_CS,
|
2020-10-29 09:44:30 -05:00
|
|
|
[MESA_SHADER_KERNEL] = DEBUG_CS,
|
2020-10-21 14:46:39 -05:00
|
|
|
|
2021-02-09 20:07:22 -08:00
|
|
|
[MESA_SHADER_TASK] = DEBUG_TASK,
|
|
|
|
|
[MESA_SHADER_MESH] = DEBUG_MESH,
|
|
|
|
|
|
2020-10-21 14:46:39 -05:00
|
|
|
[MESA_SHADER_RAYGEN] = DEBUG_RT,
|
|
|
|
|
[MESA_SHADER_ANY_HIT] = DEBUG_RT,
|
|
|
|
|
[MESA_SHADER_CLOSEST_HIT] = DEBUG_RT,
|
|
|
|
|
[MESA_SHADER_MISS] = DEBUG_RT,
|
|
|
|
|
[MESA_SHADER_INTERSECTION] = DEBUG_RT,
|
|
|
|
|
[MESA_SHADER_CALLABLE] = DEBUG_RT,
|
2015-02-18 17:31:29 -08:00
|
|
|
};
|
|
|
|
|
return flags[stage];
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-21 12:49:44 +01:00
|
|
|
#define DEBUG_FS_SIMD (DEBUG_FS_SIMD8 | DEBUG_FS_SIMD16 | DEBUG_FS_SIMD32)
|
|
|
|
|
#define DEBUG_CS_SIMD (DEBUG_CS_SIMD8 | DEBUG_CS_SIMD16 | DEBUG_CS_SIMD32)
|
|
|
|
|
#define DEBUG_TS_SIMD (DEBUG_TS_SIMD8 | DEBUG_TS_SIMD16 | DEBUG_TS_SIMD32)
|
|
|
|
|
#define DEBUG_MS_SIMD (DEBUG_MS_SIMD8 | DEBUG_MS_SIMD16 | DEBUG_MS_SIMD32)
|
|
|
|
|
#define DEBUG_RT_SIMD (DEBUG_RT_SIMD8 | DEBUG_RT_SIMD16 | DEBUG_RT_SIMD32)
|
|
|
|
|
|
|
|
|
|
#define DEBUG_SIMD8_ALL \
|
|
|
|
|
(DEBUG_FS_SIMD8 | \
|
|
|
|
|
DEBUG_CS_SIMD8 | \
|
|
|
|
|
DEBUG_TS_SIMD8 | \
|
|
|
|
|
DEBUG_MS_SIMD8 | \
|
|
|
|
|
DEBUG_RT_SIMD8)
|
|
|
|
|
|
|
|
|
|
#define DEBUG_SIMD16_ALL \
|
|
|
|
|
(DEBUG_FS_SIMD16 | \
|
|
|
|
|
DEBUG_CS_SIMD16 | \
|
|
|
|
|
DEBUG_TS_SIMD16 | \
|
|
|
|
|
DEBUG_MS_SIMD16 | \
|
|
|
|
|
DEBUG_RT_SIMD16)
|
|
|
|
|
|
|
|
|
|
#define DEBUG_SIMD32_ALL \
|
|
|
|
|
(DEBUG_FS_SIMD32 | \
|
|
|
|
|
DEBUG_CS_SIMD32 | \
|
|
|
|
|
DEBUG_TS_SIMD32 | \
|
|
|
|
|
DEBUG_MS_SIMD32 | \
|
|
|
|
|
DEBUG_RT_SIMD32)
|
|
|
|
|
|
2023-04-24 20:59:15 +00:00
|
|
|
static uint64_t intel_debug_batch_frame_start = 0;
|
|
|
|
|
static uint64_t intel_debug_batch_frame_stop = -1;
|
|
|
|
|
|
2017-03-05 23:23:25 +02:00
|
|
|
static void
|
|
|
|
|
brw_process_intel_debug_variable_once(void)
|
|
|
|
|
{
|
2020-09-14 18:43:50 +02:00
|
|
|
intel_debug = parse_debug_string(getenv("INTEL_DEBUG"), debug_control);
|
2023-01-21 12:49:44 +01:00
|
|
|
intel_simd = parse_debug_string(getenv("INTEL_SIMD_DEBUG"), simd_control);
|
2023-04-24 20:59:15 +00:00
|
|
|
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);
|
|
|
|
|
|
2023-01-21 12:49:44 +01:00
|
|
|
|
|
|
|
|
if (!(intel_simd & DEBUG_FS_SIMD))
|
|
|
|
|
intel_simd |= DEBUG_FS_SIMD;
|
|
|
|
|
if (!(intel_simd & DEBUG_CS_SIMD))
|
|
|
|
|
intel_simd |= DEBUG_CS_SIMD;
|
|
|
|
|
if (!(intel_simd & DEBUG_TS_SIMD))
|
|
|
|
|
intel_simd |= DEBUG_TS_SIMD;
|
|
|
|
|
if (!(intel_simd & DEBUG_MS_SIMD))
|
|
|
|
|
intel_simd |= DEBUG_MS_SIMD;
|
|
|
|
|
if (!(intel_simd & DEBUG_RT_SIMD))
|
|
|
|
|
intel_simd |= DEBUG_RT_SIMD;
|
|
|
|
|
|
|
|
|
|
if (intel_debug & DEBUG_NO8)
|
|
|
|
|
intel_simd &= ~DEBUG_SIMD8_ALL;
|
|
|
|
|
if (intel_debug & DEBUG_NO16)
|
|
|
|
|
intel_simd &= ~DEBUG_SIMD16_ALL;
|
|
|
|
|
if (intel_debug & DEBUG_NO32)
|
|
|
|
|
intel_simd &= ~DEBUG_SIMD32_ALL;
|
|
|
|
|
intel_debug &= ~(DEBUG_NO8 | DEBUG_NO16 | DEBUG_NO32);
|
2017-03-05 23:23:25 +02:00
|
|
|
}
|
|
|
|
|
|
2013-07-07 19:02:56 -07:00
|
|
|
void
|
2015-10-06 16:19:04 -07:00
|
|
|
brw_process_intel_debug_variable(void)
|
2013-07-07 19:02:56 -07:00
|
|
|
{
|
2017-03-05 23:23:25 +02:00
|
|
|
static once_flag process_intel_debug_variable_flag = ONCE_FLAG_INIT;
|
|
|
|
|
|
|
|
|
|
call_once(&process_intel_debug_variable_flag,
|
|
|
|
|
brw_process_intel_debug_variable_once);
|
2013-07-07 19:02:56 -07:00
|
|
|
}
|
2019-12-24 02:40:26 +02:00
|
|
|
|
|
|
|
|
static uint64_t debug_identifier[4] = {
|
|
|
|
|
0xffeeddccbbaa9988,
|
|
|
|
|
0x7766554433221100,
|
|
|
|
|
0xffeeddccbbaa9988,
|
|
|
|
|
0x7766554433221100,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void *
|
|
|
|
|
intel_debug_identifier(void)
|
|
|
|
|
{
|
|
|
|
|
return debug_identifier;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
|
intel_debug_identifier_size(void)
|
|
|
|
|
{
|
|
|
|
|
return sizeof(debug_identifier);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
|
intel_debug_write_identifiers(void *_output,
|
|
|
|
|
uint32_t output_size,
|
|
|
|
|
const char *driver_name)
|
|
|
|
|
{
|
|
|
|
|
void *output = _output, *output_end = _output + output_size;
|
|
|
|
|
|
|
|
|
|
assert(output_size > intel_debug_identifier_size());
|
|
|
|
|
|
|
|
|
|
memcpy(output, intel_debug_identifier(), intel_debug_identifier_size());
|
|
|
|
|
output += intel_debug_identifier_size();
|
|
|
|
|
|
2021-04-05 11:13:16 -07:00
|
|
|
for (uint32_t id = INTEL_DEBUG_BLOCK_TYPE_DRIVER; id < INTEL_DEBUG_BLOCK_TYPE_MAX; id++) {
|
2019-12-24 02:40:26 +02:00
|
|
|
switch (id) {
|
2021-04-05 11:13:16 -07:00
|
|
|
case INTEL_DEBUG_BLOCK_TYPE_DRIVER: {
|
2021-04-05 11:11:29 -07:00
|
|
|
struct intel_debug_block_driver driver_desc = {
|
2019-12-24 02:40:26 +02:00
|
|
|
.base = {
|
|
|
|
|
.type = id,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
int len = snprintf(output + sizeof(driver_desc),
|
|
|
|
|
output_end - (output + sizeof(driver_desc)),
|
|
|
|
|
"%s " PACKAGE_VERSION " build " MESA_GIT_SHA1,
|
|
|
|
|
driver_name);
|
|
|
|
|
driver_desc.base.length = sizeof(driver_desc) + len + 1;
|
|
|
|
|
memcpy(output, &driver_desc, sizeof(driver_desc));
|
|
|
|
|
output += driver_desc.base.length;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2020-03-05 01:15:57 +02:00
|
|
|
|
2021-04-05 11:13:16 -07:00
|
|
|
case INTEL_DEBUG_BLOCK_TYPE_FRAME: {
|
2021-04-05 11:11:29 -07:00
|
|
|
struct intel_debug_block_frame frame_desc = {
|
2020-03-05 01:15:57 +02:00
|
|
|
.base = {
|
2021-04-05 11:13:16 -07:00
|
|
|
.type = INTEL_DEBUG_BLOCK_TYPE_FRAME,
|
2020-03-05 01:15:57 +02:00
|
|
|
.length = sizeof(frame_desc),
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
memcpy(output, &frame_desc, sizeof(frame_desc));
|
|
|
|
|
output += sizeof(frame_desc);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2019-12-24 02:40:26 +02:00
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
unreachable("Missing identifier write");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assert(output < output_end);
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-05 11:11:29 -07:00
|
|
|
struct intel_debug_block_base end = {
|
2021-04-05 11:13:16 -07:00
|
|
|
.type = INTEL_DEBUG_BLOCK_TYPE_END,
|
2019-12-24 02:40:26 +02:00
|
|
|
.length = sizeof(end),
|
|
|
|
|
};
|
|
|
|
|
memcpy(output, &end, sizeof(end));
|
|
|
|
|
output += sizeof(end);
|
|
|
|
|
|
|
|
|
|
assert(output < output_end);
|
|
|
|
|
|
2023-02-22 19:07:52 -08:00
|
|
|
/* Add at least a full aligned uint64_t of zero padding at the end
|
|
|
|
|
* to make the identifiers easier to spot.
|
|
|
|
|
*/
|
|
|
|
|
const unsigned unpadded_len = output - _output;
|
|
|
|
|
const unsigned padding = ALIGN(unpadded_len + 8, 8) - unpadded_len;
|
|
|
|
|
memset(output, 0, padding);
|
|
|
|
|
output += padding;
|
|
|
|
|
|
|
|
|
|
assert(output < output_end);
|
|
|
|
|
|
2019-12-24 02:40:26 +02:00
|
|
|
/* Return the how many bytes where written, so that the rest of the buffer
|
|
|
|
|
* can be used for other things.
|
|
|
|
|
*/
|
|
|
|
|
return output - _output;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void *
|
|
|
|
|
intel_debug_get_identifier_block(void *_buffer,
|
|
|
|
|
uint32_t buffer_size,
|
2021-04-05 11:11:29 -07:00
|
|
|
enum intel_debug_block_type type)
|
2019-12-24 02:40:26 +02:00
|
|
|
{
|
|
|
|
|
void *buffer = _buffer + intel_debug_identifier_size(),
|
|
|
|
|
*end_buffer = _buffer + buffer_size;
|
|
|
|
|
|
|
|
|
|
while (buffer < end_buffer) {
|
2021-04-05 11:11:29 -07:00
|
|
|
struct intel_debug_block_base *item = buffer;
|
2019-12-24 02:40:26 +02:00
|
|
|
|
|
|
|
|
if (item->type == type)
|
|
|
|
|
return item;
|
2021-04-05 11:13:16 -07:00
|
|
|
if (item->type == INTEL_DEBUG_BLOCK_TYPE_END)
|
2019-12-24 02:40:26 +02:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
buffer += item->length;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2023-04-24 20:59:15 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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;
|
|
|
|
|
}
|