diff options
author | Jason Ekstrand <[email protected]> | 2017-03-01 11:20:25 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-03-01 16:14:03 -0800 |
commit | d5b355ce5fd6dbff61f1f471c38aa62db9d621c4 (patch) | |
tree | 608ec05d1d64672f9cbc65ce8734d4383ba6254f /src/intel/common/gen_debug.c | |
parent | 8048c1953c97de75ccbe33d719ca81f67a5ba255 (diff) |
i965: Move intel_debug.h to intel/common/gen_debug.h
This is shared between the Vulkan and GL drivers as it's a requirement
of the back-end compiler. However, it doesn't really belong in the
compiler. We rename the file to match the prefix of the other stuff in
common and because libdrm defines an intel_debug.h and this avoids a
pile of possible name conflicts.
Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/intel/common/gen_debug.c')
-rw-r--r-- | src/intel/common/gen_debug.c | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/src/intel/common/gen_debug.c b/src/intel/common/gen_debug.c new file mode 100644 index 00000000000..858f04db432 --- /dev/null +++ b/src/intel/common/gen_debug.c @@ -0,0 +1,109 @@ +/* + * Copyright 2003 VMware, Inc. + * 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. + */ + +/** + * \file gen_debug.c + * + * Support for the INTEL_DEBUG environment variable, along with other + * miscellaneous debugging code. + */ + +#include <stdlib.h> + +#include "common/gen_debug.h" +#include "util/macros.h" +#include "util/u_atomic.h" /* for p_atomic_cmpxchg */ +#include "util/debug.h" + +uint64_t INTEL_DEBUG = 0; + +static const struct debug_control debug_control[] = { + { "tex", DEBUG_TEXTURE}, + { "state", DEBUG_STATE}, + { "blit", DEBUG_BLIT}, + { "mip", DEBUG_MIPTREE}, + { "fall", DEBUG_PERF}, + { "perf", DEBUG_PERF}, + { "perfmon", DEBUG_PERFMON}, + { "bat", DEBUG_BATCH}, + { "pix", DEBUG_PIXEL}, + { "buf", DEBUG_BUFMGR}, + { "fbo", DEBUG_FBO}, + { "fs", DEBUG_WM }, + { "gs", DEBUG_GS}, + { "sync", DEBUG_SYNC}, + { "prim", DEBUG_PRIMS }, + { "vert", DEBUG_VERTS }, + { "dri", DEBUG_DRI }, + { "sf", DEBUG_SF }, + { "stats", DEBUG_STATS }, + { "wm", DEBUG_WM }, + { "urb", DEBUG_URB }, + { "vs", DEBUG_VS }, + { "clip", DEBUG_CLIP }, + { "aub", DEBUG_AUB }, + { "shader_time", DEBUG_SHADER_TIME }, + { "no16", DEBUG_NO16 }, + { "blorp", DEBUG_BLORP }, + { "nodualobj", DEBUG_NO_DUAL_OBJECT_GS }, + { "optimizer", DEBUG_OPTIMIZER }, + { "ann", DEBUG_ANNOTATION }, + { "no8", DEBUG_NO8 }, + { "vec4", DEBUG_VEC4VS }, + { "spill_fs", DEBUG_SPILL_FS }, + { "spill_vec4", DEBUG_SPILL_VEC4 }, + { "cs", DEBUG_CS }, + { "hex", DEBUG_HEX }, + { "nocompact", DEBUG_NO_COMPACTION }, + { "hs", DEBUG_TCS }, + { "tcs", DEBUG_TCS }, + { "ds", DEBUG_TES }, + { "tes", DEBUG_TES }, + { "l3", DEBUG_L3 }, + { "do32", DEBUG_DO32 }, + { "norbc", DEBUG_NO_RBC }, + { NULL, 0 } +}; + +uint64_t +intel_debug_flag_for_shader_stage(gl_shader_stage stage) +{ + uint64_t flags[] = { + [MESA_SHADER_VERTEX] = DEBUG_VS, + [MESA_SHADER_TESS_CTRL] = DEBUG_TCS, + [MESA_SHADER_TESS_EVAL] = DEBUG_TES, + [MESA_SHADER_GEOMETRY] = DEBUG_GS, + [MESA_SHADER_FRAGMENT] = DEBUG_WM, + [MESA_SHADER_COMPUTE] = DEBUG_CS, + }; + STATIC_ASSERT(MESA_SHADER_STAGES == 6); + return flags[stage]; +} + +void +brw_process_intel_debug_variable(void) +{ + uint64_t intel_debug = parse_debug_string(getenv("INTEL_DEBUG"), debug_control); + (void) p_atomic_cmpxchg(&INTEL_DEBUG, 0, intel_debug); +} |