i965: Delete the intel_regions.c code.
[mesa.git] / src / mesa / drivers / dri / i965 / intel_debug.c
1 /*
2 * Copyright 2003 VMware, Inc.
3 * Copyright © 2006 Intel Corporation
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
23 */
24
25 /**
26 * \file intel_debug.c
27 *
28 * Support for the INTEL_DEBUG environment variable, along with other
29 * miscellaneous debugging code.
30 */
31
32 #include "brw_context.h"
33 #include "intel_debug.h"
34 #include "utils.h"
35
36 uint64_t INTEL_DEBUG = 0;
37
38 static const struct dri_debug_control debug_control[] = {
39 { "tex", DEBUG_TEXTURE},
40 { "state", DEBUG_STATE},
41 { "blit", DEBUG_BLIT},
42 { "mip", DEBUG_MIPTREE},
43 { "fall", DEBUG_PERF},
44 { "perf", DEBUG_PERF},
45 { "perfmon", DEBUG_PERFMON},
46 { "bat", DEBUG_BATCH},
47 { "pix", DEBUG_PIXEL},
48 { "buf", DEBUG_BUFMGR},
49 { "fbo", DEBUG_FBO},
50 { "fs", DEBUG_WM },
51 { "gs", DEBUG_GS},
52 { "sync", DEBUG_SYNC},
53 { "prim", DEBUG_PRIMS },
54 { "vert", DEBUG_VERTS },
55 { "dri", DEBUG_DRI },
56 { "sf", DEBUG_SF },
57 { "stats", DEBUG_STATS },
58 { "wm", DEBUG_WM },
59 { "urb", DEBUG_URB },
60 { "vs", DEBUG_VS },
61 { "clip", DEBUG_CLIP },
62 { "aub", DEBUG_AUB },
63 { "shader_time", DEBUG_SHADER_TIME },
64 { "no16", DEBUG_NO16 },
65 { "blorp", DEBUG_BLORP },
66 { "nodualobj", DEBUG_NO_DUAL_OBJECT_GS },
67 { NULL, 0 }
68 };
69
70 void
71 brw_process_intel_debug_variable(struct brw_context *brw)
72 {
73 INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
74 if (INTEL_DEBUG & DEBUG_BUFMGR)
75 dri_bufmgr_set_debug(brw->bufmgr, true);
76
77 if ((INTEL_DEBUG & DEBUG_SHADER_TIME) && brw->gen < 7) {
78 fprintf(stderr,
79 "shader_time debugging requires gen7 (Ivybridge) or better.\n");
80 INTEL_DEBUG &= ~DEBUG_SHADER_TIME;
81 }
82
83 if (INTEL_DEBUG & DEBUG_PERF)
84 brw->perf_debug = true;
85
86 if (INTEL_DEBUG & DEBUG_AUB)
87 drm_intel_bufmgr_gem_set_aub_dump(brw->bufmgr, true);
88 }