Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/panfrost/perf/pan_perf.h
4560 views
1
/*
2
* Copyright © 2021 Collabora, Ltd.
3
* Author: Antonio Caggiano <[email protected]>
4
*
5
* Permission is hereby granted, free of charge, to any person obtaining a copy
6
* of this software and associated documentation files (the "Software"), to deal
7
* in the Software without restriction, including without limitation the rights
8
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
* copies of the Software, and to permit persons to whom the Software is
10
* furnished to do so, subject to the following conditions:
11
*
12
* The above copyright notice and this permission notice shall be included in
13
* all copies or substantial portions of the Software.
14
*
15
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
* THE SOFTWARE.
22
*/
23
24
#ifndef PAN_PERF_H
25
#define PAN_PERF_H
26
27
#include <stdint.h>
28
29
#if defined(__cplusplus)
30
extern "C" {
31
#endif
32
33
#define PAN_PERF_MAX_CATEGORIES 4
34
#define PAN_PERF_MAX_COUNTERS 64
35
36
struct panfrost_device;
37
struct panfrost_perf_category;
38
struct panfrost_perf;
39
40
enum panfrost_perf_counter_units {
41
PAN_PERF_COUNTER_UNITS_CYCLES,
42
PAN_PERF_COUNTER_UNITS_JOBS,
43
PAN_PERF_COUNTER_UNITS_TASKS,
44
PAN_PERF_COUNTER_UNITS_PRIMITIVES,
45
PAN_PERF_COUNTER_UNITS_BEATS,
46
PAN_PERF_COUNTER_UNITS_REQUESTS,
47
PAN_PERF_COUNTER_UNITS_WARPS,
48
PAN_PERF_COUNTER_UNITS_QUADS,
49
PAN_PERF_COUNTER_UNITS_TILES,
50
PAN_PERF_COUNTER_UNITS_INSTRUCTIONS,
51
PAN_PERF_COUNTER_UNITS_TRANSACTIONS,
52
PAN_PERF_COUNTER_UNITS_THREADS,
53
PAN_PERF_COUNTER_UNITS_BYTES,
54
PAN_PERF_COUNTER_UNITS_PIXELS,
55
PAN_PERF_COUNTER_UNITS_ISSUES,
56
};
57
58
struct panfrost_perf_counter {
59
const char *name;
60
const char *desc;
61
const char *symbol_name;
62
enum panfrost_perf_counter_units units;
63
// Offset of this counter's value within the counters memory block
64
uint32_t offset;
65
66
const struct panfrost_perf_category *category;
67
};
68
69
struct panfrost_perf_category {
70
const char *name;
71
72
struct panfrost_perf_counter counters[PAN_PERF_MAX_COUNTERS];
73
uint32_t n_counters;
74
};
75
76
struct panfrost_perf_config {
77
struct panfrost_perf_category categories[PAN_PERF_MAX_CATEGORIES];
78
uint32_t n_categories;
79
};
80
81
struct panfrost_perf {
82
struct panfrost_device *dev;
83
84
const struct panfrost_perf_config* cfg;
85
86
// Memory where to dump counter values
87
uint32_t *counter_values;
88
uint32_t n_counter_values;
89
};
90
91
uint32_t
92
panfrost_perf_counter_read(const struct panfrost_perf_counter *counter,
93
const struct panfrost_perf *perf);
94
95
void
96
panfrost_perf_init(struct panfrost_perf *perf, struct panfrost_device *dev);
97
98
int
99
panfrost_perf_enable(struct panfrost_perf *perf);
100
101
int
102
panfrost_perf_disable(struct panfrost_perf *perf);
103
104
int
105
panfrost_perf_dump(struct panfrost_perf *perf);
106
107
#if defined(__cplusplus)
108
} // extern "C"
109
#endif
110
111
#endif // PAN_PERF_H
112
113