tizen 2.4 release
[kernel/linux-3.0.git] / drivers / gpu / arm / mali400 / r4p0_rel0 / include / linux / mali / mali_utgard_profiling_gator_api.h
1 /*
2  * Copyright (C) 2010-2012 ARM Limited. All rights reserved.
3  * 
4  * This program is free software and is provided to you under the terms of the GNU General Public License version 2
5  * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
6  * 
7  * A copy of the licence is included with the program, and can also be obtained from Free Software
8  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
9  */
10
11 #ifndef __MALI_UTGARD_PROFILING_GATOR_API_H__
12 #define __MALI_UTGARD_PROFILING_GATOR_API_H__
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 #define MALI_PROFILING_API_VERSION 4
19
20 #define MAX_NUM_L2_CACHE_CORES 3
21 #define MAX_NUM_FP_CORES 8
22 #define MAX_NUM_VP_CORES 1
23
24 /** The list of events supported by the Mali DDK. */
25 typedef enum {
26         /* Vertex processor activity */
27         ACTIVITY_VP_0 = 0,
28
29         /* Fragment processor activity */
30         ACTIVITY_FP_0,
31         ACTIVITY_FP_1,
32         ACTIVITY_FP_2,
33         ACTIVITY_FP_3,
34         ACTIVITY_FP_4,
35         ACTIVITY_FP_5,
36         ACTIVITY_FP_6,
37         ACTIVITY_FP_7,
38
39         /* L2 cache counters */
40         COUNTER_L2_0_C0,
41         COUNTER_L2_0_C1,
42         COUNTER_L2_1_C0,
43         COUNTER_L2_1_C1,
44         COUNTER_L2_2_C0,
45         COUNTER_L2_2_C1,
46
47         /* Vertex processor counters */
48         COUNTER_VP_0_C0,
49         COUNTER_VP_0_C1,
50
51         /* Fragment processor counters */
52         COUNTER_FP_0_C0,
53         COUNTER_FP_0_C1,
54         COUNTER_FP_1_C0,
55         COUNTER_FP_1_C1,
56         COUNTER_FP_2_C0,
57         COUNTER_FP_2_C1,
58         COUNTER_FP_3_C0,
59         COUNTER_FP_3_C1,
60         COUNTER_FP_4_C0,
61         COUNTER_FP_4_C1,
62         COUNTER_FP_5_C0,
63         COUNTER_FP_5_C1,
64         COUNTER_FP_6_C0,
65         COUNTER_FP_6_C1,
66         COUNTER_FP_7_C0,
67         COUNTER_FP_7_C1,
68
69         /*
70          * If more hardware counters are added, the _mali_osk_hw_counter_table
71          * below should also be updated.
72          */
73
74         /* EGL software counters */
75         COUNTER_EGL_BLIT_TIME,
76
77         /* GLES software counters */
78         COUNTER_GLES_DRAW_ELEMENTS_CALLS,
79         COUNTER_GLES_DRAW_ELEMENTS_NUM_INDICES,
80         COUNTER_GLES_DRAW_ELEMENTS_NUM_TRANSFORMED,
81         COUNTER_GLES_DRAW_ARRAYS_CALLS,
82         COUNTER_GLES_DRAW_ARRAYS_NUM_TRANSFORMED,
83         COUNTER_GLES_DRAW_POINTS,
84         COUNTER_GLES_DRAW_LINES,
85         COUNTER_GLES_DRAW_LINE_LOOP,
86         COUNTER_GLES_DRAW_LINE_STRIP,
87         COUNTER_GLES_DRAW_TRIANGLES,
88         COUNTER_GLES_DRAW_TRIANGLE_STRIP,
89         COUNTER_GLES_DRAW_TRIANGLE_FAN,
90         COUNTER_GLES_NON_VBO_DATA_COPY_TIME,
91         COUNTER_GLES_UNIFORM_BYTES_COPIED_TO_MALI,
92         COUNTER_GLES_UPLOAD_TEXTURE_TIME,
93         COUNTER_GLES_UPLOAD_VBO_TIME,
94         COUNTER_GLES_NUM_FLUSHES,
95         COUNTER_GLES_NUM_VSHADERS_GENERATED,
96         COUNTER_GLES_NUM_FSHADERS_GENERATED,
97         COUNTER_GLES_VSHADER_GEN_TIME,
98         COUNTER_GLES_FSHADER_GEN_TIME,
99         COUNTER_GLES_INPUT_TRIANGLES,
100         COUNTER_GLES_VXCACHE_HIT,
101         COUNTER_GLES_VXCACHE_MISS,
102         COUNTER_GLES_VXCACHE_COLLISION,
103         COUNTER_GLES_CULLED_TRIANGLES,
104         COUNTER_GLES_CULLED_LINES,
105         COUNTER_GLES_BACKFACE_TRIANGLES,
106         COUNTER_GLES_GBCLIP_TRIANGLES,
107         COUNTER_GLES_GBCLIP_LINES,
108         COUNTER_GLES_TRIANGLES_DRAWN,
109         COUNTER_GLES_DRAWCALL_TIME,
110         COUNTER_GLES_TRIANGLES_COUNT,
111         COUNTER_GLES_INDEPENDENT_TRIANGLES_COUNT,
112         COUNTER_GLES_STRIP_TRIANGLES_COUNT,
113         COUNTER_GLES_FAN_TRIANGLES_COUNT,
114         COUNTER_GLES_LINES_COUNT,
115         COUNTER_GLES_INDEPENDENT_LINES_COUNT,
116         COUNTER_GLES_STRIP_LINES_COUNT,
117         COUNTER_GLES_LOOP_LINES_COUNT,
118
119         /* Framebuffer capture pseudo-counter */
120         COUNTER_FILMSTRIP,
121
122         NUMBER_OF_EVENTS
123 } _mali_osk_counter_id;
124
125 #define FIRST_ACTIVITY_EVENT    ACTIVITY_VP_0
126 #define LAST_ACTIVITY_EVENT     ACTIVITY_FP_7
127
128 #define FIRST_HW_COUNTER        COUNTER_L2_0_C0
129 #define LAST_HW_COUNTER         COUNTER_FP_7_C1
130
131 #define FIRST_SW_COUNTER        COUNTER_EGL_BLIT_TIME
132 #define LAST_SW_COUNTER         COUNTER_GLES_LOOP_LINES_COUNT
133
134 #define FIRST_SPECIAL_COUNTER   COUNTER_FILMSTRIP
135 #define LAST_SPECIAL_COUNTER    COUNTER_FILMSTRIP
136
137 /**
138  * Structure to pass performance counter data of a Mali core
139  */
140 typedef struct _mali_profiling_core_counters {
141         u32 source0;
142         u32 value0;
143         u32 source1;
144         u32 value1;
145 } _mali_profiling_core_counters;
146
147 /**
148  * Structure to pass performance counter data of Mali L2 cache cores
149  */
150 typedef struct _mali_profiling_l2_counter_values {
151         struct _mali_profiling_core_counters cores[MAX_NUM_L2_CACHE_CORES];
152 } _mali_profiling_l2_counter_values;
153
154 /**
155  * Structure to pass data defining Mali instance in use:
156  *
157  * mali_product_id - Mali product id
158  * mali_version_major - Mali version major number
159  * mali_version_minor - Mali version minor number
160  * num_of_l2_cores - number of L2 cache cores
161  * num_of_fp_cores - number of fragment processor cores
162  * num_of_vp_cores - number of vertex processor cores
163  */
164 typedef struct _mali_profiling_mali_version {
165         u32 mali_product_id;
166         u32 mali_version_major;
167         u32 mali_version_minor;
168         u32 num_of_l2_cores;
169         u32 num_of_fp_cores;
170         u32 num_of_vp_cores;
171 } _mali_profiling_mali_version;
172
173 /*
174  * List of possible actions to be controlled by Streamline.
175  * The following numbers are used by gator to control the frame buffer dumping and s/w counter reporting.
176  * We cannot use the enums in mali_uk_types.h because they are unknown inside gator.
177  */
178 #define FBDUMP_CONTROL_ENABLE (1)
179 #define FBDUMP_CONTROL_RATE (2)
180 #define SW_COUNTER_ENABLE (3)
181 #define FBDUMP_CONTROL_RESIZE_FACTOR (4)
182
183 void _mali_profiling_control(u32 action, u32 value);
184
185 u32 _mali_profiling_get_l2_counters(_mali_profiling_l2_counter_values *values);
186
187 int _mali_profiling_set_event(u32 counter_id, s32 event_id);
188
189 u32 _mali_profiling_get_api_version(void);
190
191 void _mali_profiling_get_mali_version(struct _mali_profiling_mali_version *values);
192
193 #ifdef __cplusplus
194 }
195 #endif
196
197 #endif /* __MALI_UTGARD_PROFILING_GATOR_API_H__ */