2 * Copyright (C) ARM Limited 2013-2014. All rights reserved.
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.
10 #ifndef __MALI_UTGARD_PROFILING_GATOR_API_H__
11 #define __MALI_UTGARD_PROFILING_GATOR_API_H__
18 #define MALI_PROFILING_API_VERSION 4
20 #define MAX_NUM_L2_CACHE_CORES 3
21 #define MAX_NUM_FP_CORES 8
22 #define MAX_NUM_VP_CORES 1
24 /** The list of events supported by the Mali DDK. */
27 /* Vertex processor activity */
30 /* Fragment processor activity */
31 ACTIVITY_FP_0, /* 1 */
40 /* L2 cache counters */
48 /* Vertex processor counters */
49 COUNTER_VP_0_C0, /*15*/
52 /* Fragment processor counters */
68 COUNTER_FP_7_C1, /* 32 */
71 * If more hardware counters are added, the _mali_osk_hw_counter_table
72 * below should also be updated.
75 /* EGL software counters */
76 COUNTER_EGL_BLIT_TIME,
78 /* GLES software counters */
79 COUNTER_GLES_DRAW_ELEMENTS_CALLS,
80 COUNTER_GLES_DRAW_ELEMENTS_NUM_INDICES,
81 COUNTER_GLES_DRAW_ELEMENTS_NUM_TRANSFORMED,
82 COUNTER_GLES_DRAW_ARRAYS_CALLS,
83 COUNTER_GLES_DRAW_ARRAYS_NUM_TRANSFORMED,
84 COUNTER_GLES_DRAW_POINTS,
85 COUNTER_GLES_DRAW_LINES,
86 COUNTER_GLES_DRAW_LINE_LOOP,
87 COUNTER_GLES_DRAW_LINE_STRIP,
88 COUNTER_GLES_DRAW_TRIANGLES,
89 COUNTER_GLES_DRAW_TRIANGLE_STRIP,
90 COUNTER_GLES_DRAW_TRIANGLE_FAN,
91 COUNTER_GLES_NON_VBO_DATA_COPY_TIME,
92 COUNTER_GLES_UNIFORM_BYTES_COPIED_TO_MALI,
93 COUNTER_GLES_UPLOAD_TEXTURE_TIME,
94 COUNTER_GLES_UPLOAD_VBO_TIME,
95 COUNTER_GLES_NUM_FLUSHES,
96 COUNTER_GLES_NUM_VSHADERS_GENERATED,
97 COUNTER_GLES_NUM_FSHADERS_GENERATED,
98 COUNTER_GLES_VSHADER_GEN_TIME,
99 COUNTER_GLES_FSHADER_GEN_TIME,
100 COUNTER_GLES_INPUT_TRIANGLES,
101 COUNTER_GLES_VXCACHE_HIT,
102 COUNTER_GLES_VXCACHE_MISS,
103 COUNTER_GLES_VXCACHE_COLLISION,
104 COUNTER_GLES_CULLED_TRIANGLES,
105 COUNTER_GLES_CULLED_LINES,
106 COUNTER_GLES_BACKFACE_TRIANGLES,
107 COUNTER_GLES_GBCLIP_TRIANGLES,
108 COUNTER_GLES_GBCLIP_LINES,
109 COUNTER_GLES_TRIANGLES_DRAWN,
110 COUNTER_GLES_DRAWCALL_TIME,
111 COUNTER_GLES_TRIANGLES_COUNT,
112 COUNTER_GLES_INDEPENDENT_TRIANGLES_COUNT,
113 COUNTER_GLES_STRIP_TRIANGLES_COUNT,
114 COUNTER_GLES_FAN_TRIANGLES_COUNT,
115 COUNTER_GLES_LINES_COUNT,
116 COUNTER_GLES_INDEPENDENT_LINES_COUNT,
117 COUNTER_GLES_STRIP_LINES_COUNT,
118 COUNTER_GLES_LOOP_LINES_COUNT,
120 /* Framebuffer capture pseudo-counter */
124 } _mali_osk_counter_id;
126 #define FIRST_ACTIVITY_EVENT ACTIVITY_VP_0
127 #define LAST_ACTIVITY_EVENT ACTIVITY_FP_7
129 #define FIRST_HW_COUNTER COUNTER_L2_0_C0
130 #define LAST_HW_COUNTER COUNTER_FP_7_C1
132 #define FIRST_SW_COUNTER COUNTER_EGL_BLIT_TIME
133 #define LAST_SW_COUNTER COUNTER_GLES_LOOP_LINES_COUNT
135 #define FIRST_SPECIAL_COUNTER COUNTER_FILMSTRIP
136 #define LAST_SPECIAL_COUNTER COUNTER_FILMSTRIP
139 * Structure to pass performance counter data of a Mali core
141 typedef struct _mali_profiling_core_counters
147 } _mali_profiling_core_counters;
150 * Structure to pass performance counter data of Mali L2 cache cores
152 typedef struct _mali_profiling_l2_counter_values
154 struct _mali_profiling_core_counters cores[MAX_NUM_L2_CACHE_CORES];
155 } _mali_profiling_l2_counter_values;
158 * Structure to pass data defining Mali instance in use:
160 * mali_product_id - Mali product id
161 * mali_version_major - Mali version major number
162 * mali_version_minor - Mali version minor number
163 * num_of_l2_cores - number of L2 cache cores
164 * num_of_fp_cores - number of fragment processor cores
165 * num_of_vp_cores - number of vertex processor cores
167 typedef struct _mali_profiling_mali_version
170 u32 mali_version_major;
171 u32 mali_version_minor;
175 } _mali_profiling_mali_version;
178 * List of possible actions to be controlled by Streamline.
179 * The following numbers are used by gator to control the frame buffer dumping and s/w counter reporting.
180 * We cannot use the enums in mali_uk_types.h because they are unknown inside gator.
182 #define FBDUMP_CONTROL_ENABLE (1)
183 #define FBDUMP_CONTROL_RATE (2)
184 #define SW_COUNTER_ENABLE (3)
185 #define FBDUMP_CONTROL_RESIZE_FACTOR (4)
187 void _mali_profiling_control(u32 action, u32 value);
189 u32 _mali_profiling_get_l2_counters(_mali_profiling_l2_counter_values *values);
191 int _mali_profiling_set_event(u32 counter_id, s32 event_id);
193 u32 _mali_profiling_get_api_version(void);
195 void _mali_profiling_get_mali_version(struct _mali_profiling_mali_version *values);
201 #endif /* __MALI_UTGARD_PROFILING_GATOR_API_H__ */