Merge in gator version 5.18
[firefly-linux-kernel-4.4.55.git] / drivers / gator / mali / mali_mjollnir_profiling_gator_api.h
1 /**
2  * Copyright (C) ARM Limited 2013-2014. All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  */
9
10 #ifndef __MALI_MJOLLNIR_PROFILING_GATOR_API_H__
11 #define __MALI_MJOLLNIR_PROFILING_GATOR_API_H__
12
13 #ifdef __cplusplus
14 extern "C"
15 {
16 #endif
17
18
19 /*
20  * The number of processor cores.  Update to suit your hardware implementation.
21  */
22 #define MAX_NUM_FP_CORES            (4)
23 #define MAX_NUM_VP_CORES            (1)
24 #define MAX_NUM_L2_CACHE_CORES      (1)
25
26 enum counters
27 {
28     /* Timeline activity */
29     ACTIVITY_VP_0 = 0,
30     ACTIVITY_FP_0,
31     ACTIVITY_FP_1,
32     ACTIVITY_FP_2,
33     ACTIVITY_FP_3,
34
35     /* L2 cache counters */
36     COUNTER_L2_0_C0,
37     COUNTER_L2_0_C1,
38
39     /* Vertex processor counters */
40     COUNTER_VP_0_C0,
41     COUNTER_VP_0_C1,
42
43     /* Fragment processor counters */
44     COUNTER_FP_0_C0,
45     COUNTER_FP_0_C1,
46     COUNTER_FP_1_C0,
47     COUNTER_FP_1_C1,
48     COUNTER_FP_2_C0,
49     COUNTER_FP_2_C1,
50     COUNTER_FP_3_C0,
51     COUNTER_FP_3_C1,
52
53     /* EGL Software Counters */
54     COUNTER_EGL_BLIT_TIME,
55
56     /* GLES Software Counters */
57     COUNTER_GLES_DRAW_ELEMENTS_CALLS,
58     COUNTER_GLES_DRAW_ELEMENTS_NUM_INDICES,
59     COUNTER_GLES_DRAW_ELEMENTS_NUM_TRANSFORMED,
60     COUNTER_GLES_DRAW_ARRAYS_CALLS,
61     COUNTER_GLES_DRAW_ARRAYS_NUM_TRANSFORMED,
62     COUNTER_GLES_DRAW_POINTS,
63     COUNTER_GLES_DRAW_LINES,
64     COUNTER_GLES_DRAW_LINE_LOOP,
65     COUNTER_GLES_DRAW_LINE_STRIP,
66     COUNTER_GLES_DRAW_TRIANGLES,
67     COUNTER_GLES_DRAW_TRIANGLE_STRIP,
68     COUNTER_GLES_DRAW_TRIANGLE_FAN,
69     COUNTER_GLES_NON_VBO_DATA_COPY_TIME,
70     COUNTER_GLES_UNIFORM_BYTES_COPIED_TO_MALI,
71     COUNTER_GLES_UPLOAD_TEXTURE_TIME,
72     COUNTER_GLES_UPLOAD_VBO_TIME,
73     COUNTER_GLES_NUM_FLUSHES,
74     COUNTER_GLES_NUM_VSHADERS_GENERATED,
75     COUNTER_GLES_NUM_FSHADERS_GENERATED,
76     COUNTER_GLES_VSHADER_GEN_TIME,
77     COUNTER_GLES_FSHADER_GEN_TIME,
78     COUNTER_GLES_INPUT_TRIANGLES,
79     COUNTER_GLES_VXCACHE_HIT,
80     COUNTER_GLES_VXCACHE_MISS,
81     COUNTER_GLES_VXCACHE_COLLISION,
82     COUNTER_GLES_CULLED_TRIANGLES,
83     COUNTER_GLES_CULLED_LINES,
84     COUNTER_GLES_BACKFACE_TRIANGLES,
85     COUNTER_GLES_GBCLIP_TRIANGLES,
86     COUNTER_GLES_GBCLIP_LINES,
87     COUNTER_GLES_TRIANGLES_DRAWN,
88     COUNTER_GLES_DRAWCALL_TIME,
89     COUNTER_GLES_TRIANGLES_COUNT,
90     COUNTER_GLES_INDEPENDENT_TRIANGLES_COUNT,
91     COUNTER_GLES_STRIP_TRIANGLES_COUNT,
92     COUNTER_GLES_FAN_TRIANGLES_COUNT,
93     COUNTER_GLES_LINES_COUNT,
94     COUNTER_GLES_INDEPENDENT_LINES_COUNT,
95     COUNTER_GLES_STRIP_LINES_COUNT,
96     COUNTER_GLES_LOOP_LINES_COUNT,
97
98     COUNTER_FILMSTRIP,
99     COUNTER_FREQUENCY,
100     COUNTER_VOLTAGE,
101
102     NUMBER_OF_EVENTS
103 };
104
105 #define FIRST_ACTIVITY_EVENT    ACTIVITY_VP_0
106 #define LAST_ACTIVITY_EVENT     ACTIVITY_FP_3
107
108 #define FIRST_HW_COUNTER        COUNTER_L2_0_C0
109 #define LAST_HW_COUNTER         COUNTER_FP_3_C1
110
111 #define FIRST_SW_COUNTER        COUNTER_EGL_BLIT_TIME
112 #define LAST_SW_COUNTER         COUNTER_GLES_LOOP_LINES_COUNT
113
114 /* Signifies that the system is able to report voltage and frequency numbers. */
115 #define DVFS_REPORTED_BY_DDK 1
116
117 /**
118  * Structure to pass performance counter data of a Mali core
119  */
120 typedef struct _mali_profiling_core_counters
121 {
122     u32 source0;
123     u32 value0;
124     u32 source1;
125     u32 value1;
126 } _mali_profiling_core_counters;
127
128 /*
129  * For compatibility with utgard.
130  */
131 typedef struct _mali_profiling_l2_counter_values
132 {
133     struct _mali_profiling_core_counters cores[MAX_NUM_L2_CACHE_CORES];
134 } _mali_profiling_l2_counter_values;
135
136 typedef struct _mali_profiling_mali_version
137 {
138     u32 mali_product_id;
139     u32 mali_version_major;
140     u32 mali_version_minor;
141     u32 num_of_l2_cores;
142     u32 num_of_fp_cores;
143     u32 num_of_vp_cores;
144 } _mali_profiling_mali_version;
145
146 extern void _mali_profiling_get_mali_version(struct _mali_profiling_mali_version *values);
147 extern u32 _mali_profiling_get_l2_counters(_mali_profiling_l2_counter_values *values);
148
149 /*
150  * List of possible actions allowing DDK to be controlled by Streamline.
151  * The following numbers are used by DDK to control the frame buffer dumping.
152  */
153 #define FBDUMP_CONTROL_ENABLE (1)
154 #define FBDUMP_CONTROL_RATE (2)
155 #define SW_COUNTER_ENABLE      (3)
156 #define FBDUMP_CONTROL_RESIZE_FACTOR (4)
157
158
159 #ifdef __cplusplus
160 }
161 #endif
162
163 #endif /* __MALI_MJOLLNIR_PROFILING_GATOR_API_H__ */