xref: /aosp_15_r20/external/mesa3d/src/vulkan/overlay-layer/overlay_params.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1*61046927SAndroid Build Coastguard Worker /*
2*61046927SAndroid Build Coastguard Worker  * Copyright © 2019 Intel Corporation
3*61046927SAndroid Build Coastguard Worker  *
4*61046927SAndroid Build Coastguard Worker  * Permission is hereby granted, free of charge, to any person obtaining a
5*61046927SAndroid Build Coastguard Worker  * copy of this software and associated documentation files (the "Software"),
6*61046927SAndroid Build Coastguard Worker  * to deal in the Software without restriction, including without limitation
7*61046927SAndroid Build Coastguard Worker  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*61046927SAndroid Build Coastguard Worker  * and/or sell copies of the Software, and to permit persons to whom the
9*61046927SAndroid Build Coastguard Worker  * Software is 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
18*61046927SAndroid Build Coastguard Worker  * THE 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
20*61046927SAndroid Build Coastguard Worker  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21*61046927SAndroid Build Coastguard Worker  * IN THE SOFTWARE.
22*61046927SAndroid Build Coastguard Worker  */
23*61046927SAndroid Build Coastguard Worker 
24*61046927SAndroid Build Coastguard Worker #ifndef OVERLAY_PARAMS_H
25*61046927SAndroid Build Coastguard Worker #define OVERLAY_PARAMS_H
26*61046927SAndroid Build Coastguard Worker 
27*61046927SAndroid Build Coastguard Worker #ifdef __cplusplus
28*61046927SAndroid Build Coastguard Worker extern "C" {
29*61046927SAndroid Build Coastguard Worker #endif
30*61046927SAndroid Build Coastguard Worker 
31*61046927SAndroid Build Coastguard Worker #include <stdio.h>
32*61046927SAndroid Build Coastguard Worker #include <stdint.h>
33*61046927SAndroid Build Coastguard Worker #include <stdbool.h>
34*61046927SAndroid Build Coastguard Worker 
35*61046927SAndroid Build Coastguard Worker #define OVERLAY_PARAMS                               \
36*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(device)                        \
37*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(format)                        \
38*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(fps)                           \
39*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(frame)                         \
40*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(frame_timing)                  \
41*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(submit)                        \
42*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(draw)                          \
43*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(draw_indexed)                  \
44*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(draw_indirect)                 \
45*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(draw_indexed_indirect)         \
46*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(draw_indirect_count)           \
47*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(draw_indexed_indirect_count)   \
48*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(dispatch)                      \
49*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(dispatch_indirect)             \
50*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(pipeline_graphics)             \
51*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(pipeline_compute)              \
52*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(pipeline_raytracing)           \
53*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(acquire)                       \
54*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(acquire_timing)                \
55*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(present_timing)                \
56*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(vertices)                      \
57*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(primitives)                    \
58*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(vert_invocations)              \
59*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(geom_invocations)              \
60*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(geom_primitives)               \
61*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(clip_invocations)              \
62*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(clip_primitives)               \
63*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(frag_invocations)              \
64*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(tess_ctrl_patches)             \
65*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(tess_eval_invocations)         \
66*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(compute_invocations)           \
67*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_BOOL(gpu_timing)                    \
68*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_CUSTOM(fps_sampling_period)         \
69*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_CUSTOM(output_file)                 \
70*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_CUSTOM(position)                    \
71*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_CUSTOM(width)                       \
72*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_CUSTOM(height)                      \
73*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_CUSTOM(no_display)                  \
74*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_CUSTOM(control)                     \
75*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_CUSTOM(help)
76*61046927SAndroid Build Coastguard Worker 
77*61046927SAndroid Build Coastguard Worker enum overlay_param_position {
78*61046927SAndroid Build Coastguard Worker    LAYER_POSITION_TOP_LEFT,
79*61046927SAndroid Build Coastguard Worker    LAYER_POSITION_TOP_RIGHT,
80*61046927SAndroid Build Coastguard Worker    LAYER_POSITION_BOTTOM_LEFT,
81*61046927SAndroid Build Coastguard Worker    LAYER_POSITION_BOTTOM_RIGHT,
82*61046927SAndroid Build Coastguard Worker };
83*61046927SAndroid Build Coastguard Worker 
84*61046927SAndroid Build Coastguard Worker enum overlay_param_enabled {
85*61046927SAndroid Build Coastguard Worker #define OVERLAY_PARAM_BOOL(name) OVERLAY_PARAM_ENABLED_##name,
86*61046927SAndroid Build Coastguard Worker #define OVERLAY_PARAM_CUSTOM(name)
87*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAMS
88*61046927SAndroid Build Coastguard Worker #undef OVERLAY_PARAM_BOOL
89*61046927SAndroid Build Coastguard Worker #undef OVERLAY_PARAM_CUSTOM
90*61046927SAndroid Build Coastguard Worker    OVERLAY_PARAM_ENABLED_MAX
91*61046927SAndroid Build Coastguard Worker };
92*61046927SAndroid Build Coastguard Worker 
93*61046927SAndroid Build Coastguard Worker struct overlay_params {
94*61046927SAndroid Build Coastguard Worker    bool enabled[OVERLAY_PARAM_ENABLED_MAX];
95*61046927SAndroid Build Coastguard Worker    enum overlay_param_position position;
96*61046927SAndroid Build Coastguard Worker    FILE *output_file;
97*61046927SAndroid Build Coastguard Worker    const char *control;
98*61046927SAndroid Build Coastguard Worker    uint32_t fps_sampling_period; /* us */
99*61046927SAndroid Build Coastguard Worker    bool help;
100*61046927SAndroid Build Coastguard Worker    bool no_display;
101*61046927SAndroid Build Coastguard Worker    unsigned width;
102*61046927SAndroid Build Coastguard Worker    unsigned height;
103*61046927SAndroid Build Coastguard Worker };
104*61046927SAndroid Build Coastguard Worker 
105*61046927SAndroid Build Coastguard Worker const extern char *overlay_param_names[];
106*61046927SAndroid Build Coastguard Worker 
107*61046927SAndroid Build Coastguard Worker void parse_overlay_env(struct overlay_params *params,
108*61046927SAndroid Build Coastguard Worker                        const char *env);
109*61046927SAndroid Build Coastguard Worker 
110*61046927SAndroid Build Coastguard Worker #ifdef __cplusplus
111*61046927SAndroid Build Coastguard Worker }
112*61046927SAndroid Build Coastguard Worker #endif
113*61046927SAndroid Build Coastguard Worker 
114*61046927SAndroid Build Coastguard Worker #endif /* OVERLAY_PARAMS_H */
115