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. */
26 /* Vertex processor activity */
29 /* Fragment processor activity */
30 ACTIVITY_FP_0, /* 1 */
39 /* L2 cache counters */
47 /* Vertex processor counters */
48 COUNTER_VP_0_C0, /*15*/
51 /* Fragment processor counters */
67 COUNTER_FP_7_C1, /* 32 */
70 * If more hardware counters are added, the _mali_osk_hw_counter_table
71 * below should also be updated.
74 /* EGL software counters */
75 COUNTER_EGL_BLIT_TIME,
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,
119 /* Framebuffer capture pseudo-counter */
123 } _mali_osk_counter_id;
125 #define FIRST_ACTIVITY_EVENT ACTIVITY_VP_0
126 #define LAST_ACTIVITY_EVENT ACTIVITY_FP_7
128 #define FIRST_HW_COUNTER COUNTER_L2_0_C0
129 #define LAST_HW_COUNTER COUNTER_FP_7_C1
131 #define FIRST_SW_COUNTER COUNTER_EGL_BLIT_TIME
132 #define LAST_SW_COUNTER COUNTER_GLES_LOOP_LINES_COUNT
134 #define FIRST_SPECIAL_COUNTER COUNTER_FILMSTRIP
135 #define LAST_SPECIAL_COUNTER COUNTER_FILMSTRIP
138 * Structure to pass performance counter data of a Mali core
140 struct _mali_profiling_core_counters {
148 * Structure to pass performance counter data of Mali L2 cache cores
150 struct _mali_profiling_l2_counter_values {
151 struct _mali_profiling_core_counters cores[MAX_NUM_L2_CACHE_CORES];
155 * Structure to pass data defining Mali instance in use:
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
164 struct _mali_profiling_mali_version {
166 u32 mali_version_major;
167 u32 mali_version_minor;
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.
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)
183 void _mali_profiling_control(u32 action, u32 value);
185 u32 _mali_profiling_get_l2_counters(struct _mali_profiling_l2_counter_values *values);
187 int _mali_profiling_set_event(u32 counter_id, s32 event_id);
189 u32 _mali_profiling_get_api_version(void);
191 void _mali_profiling_get_mali_version(struct _mali_profiling_mali_version *values);
197 #endif /* __MALI_UTGARD_PROFILING_GATOR_API_H__ */