1*61046927SAndroid Build Coastguard Worker /*
2*61046927SAndroid Build Coastguard Worker * Copyright © 2022 Imagination Technologies Ltd.
3*61046927SAndroid Build Coastguard Worker *
4*61046927SAndroid Build Coastguard Worker * Permission is hereby granted, free of charge, to any person obtaining a copy
5*61046927SAndroid Build Coastguard Worker * of this software and associated documentation files (the "Software"), to deal
6*61046927SAndroid Build Coastguard Worker * in the Software without restriction, including without limitation the rights
7*61046927SAndroid Build Coastguard Worker * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8*61046927SAndroid Build Coastguard Worker * copies of the Software, and to permit persons to whom the Software is
9*61046927SAndroid Build Coastguard Worker * furnished to do so, subject to the following conditions:
10*61046927SAndroid Build Coastguard Worker *
11*61046927SAndroid Build Coastguard Worker * The above copyright notice and this permission notice (including the next
12*61046927SAndroid Build Coastguard Worker * paragraph) shall be included in all copies or substantial portions of the
13*61046927SAndroid Build Coastguard Worker * Software.
14*61046927SAndroid Build Coastguard Worker *
15*61046927SAndroid Build Coastguard Worker * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16*61046927SAndroid Build Coastguard Worker * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17*61046927SAndroid Build Coastguard Worker * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18*61046927SAndroid Build Coastguard Worker * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19*61046927SAndroid Build Coastguard Worker * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20*61046927SAndroid Build Coastguard Worker * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21*61046927SAndroid Build Coastguard Worker * SOFTWARE.
22*61046927SAndroid Build Coastguard Worker */
23*61046927SAndroid Build Coastguard Worker
24*61046927SAndroid Build Coastguard Worker #include <stdint.h>
25*61046927SAndroid Build Coastguard Worker
26*61046927SAndroid Build Coastguard Worker #include "util/u_debug.h"
27*61046927SAndroid Build Coastguard Worker #include "pvr_debug.h"
28*61046927SAndroid Build Coastguard Worker
29*61046927SAndroid Build Coastguard Worker uint32_t PVR_DEBUG = 0;
30*61046927SAndroid Build Coastguard Worker
31*61046927SAndroid Build Coastguard Worker /* clang-format off */
32*61046927SAndroid Build Coastguard Worker static const struct debug_named_value debug_control[] = {
33*61046927SAndroid Build Coastguard Worker { "cs", PVR_DEBUG_DUMP_CONTROL_STREAM,
34*61046927SAndroid Build Coastguard Worker "Dump the contents of the control stream buffer on every job submit." },
35*61046927SAndroid Build Coastguard Worker { "bo_track", PVR_DEBUG_TRACK_BOS,
36*61046927SAndroid Build Coastguard Worker "Track all buffer objects with at least one reference." },
37*61046927SAndroid Build Coastguard Worker { "vk_desc", PVR_DEBUG_VK_DUMP_DESCRIPTOR_SET_LAYOUT,
38*61046927SAndroid Build Coastguard Worker "Dump descriptor set and pipeline layouts." },
39*61046927SAndroid Build Coastguard Worker { "info", PVR_DEBUG_INFO,
40*61046927SAndroid Build Coastguard Worker "Display information about the driver and device." },
41*61046927SAndroid Build Coastguard Worker DEBUG_NAMED_VALUE_END
42*61046927SAndroid Build Coastguard Worker };
43*61046927SAndroid Build Coastguard Worker /* clang-format on */
44*61046927SAndroid Build Coastguard Worker
45*61046927SAndroid Build Coastguard Worker DEBUG_GET_ONCE_FLAGS_OPTION(pvr_debug, "PVR_DEBUG", debug_control, 0)
46*61046927SAndroid Build Coastguard Worker
47*61046927SAndroid Build Coastguard Worker #define PVR_DEBUG_SET(x) PVR_DEBUG |= (PVR_DEBUG_##x)
48*61046927SAndroid Build Coastguard Worker
pvr_process_debug_variable(void)49*61046927SAndroid Build Coastguard Worker void pvr_process_debug_variable(void)
50*61046927SAndroid Build Coastguard Worker {
51*61046927SAndroid Build Coastguard Worker PVR_DEBUG = debug_get_option_pvr_debug();
52*61046927SAndroid Build Coastguard Worker
53*61046927SAndroid Build Coastguard Worker /* Perform any automatic selections. For example, if one debug option
54*61046927SAndroid Build Coastguard Worker * implies another it should be set here.
55*61046927SAndroid Build Coastguard Worker */
56*61046927SAndroid Build Coastguard Worker
57*61046927SAndroid Build Coastguard Worker if (PVR_IS_DEBUG_SET(DUMP_CONTROL_STREAM))
58*61046927SAndroid Build Coastguard Worker PVR_DEBUG_SET(TRACK_BOS);
59*61046927SAndroid Build Coastguard Worker }
60