MALI: utgard: upgrade DDK to r7p0-00rel0
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / mali400 / mali / include / linux / mali / mali_utgard_profiling_events.h
1 /*
2  * Copyright (C) 2010-2016 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  * Class Path Exception
11  * Linking this library statically or dynamically with other modules is making a combined work based on this library. 
12  * Thus, the terms and conditions of the GNU General Public License cover the whole combination.
13  * As a special exception, the copyright holders of this library give you permission to link this library with independent modules 
14  * to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting 
15  * executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions 
16  * of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify 
17  * this library, you may extend this exception to your version of the library, but you are not obligated to do so. 
18  * If you do not wish to do so, delete this exception statement from your version.
19  */
20
21 #ifndef _MALI_UTGARD_PROFILING_EVENTS_H_
22 #define _MALI_UTGARD_PROFILING_EVENTS_H_
23
24 /*
25  * The event ID is a 32 bit value consisting of different fields
26  * reserved, 4 bits, for future use
27  * event type, 4 bits, cinstr_profiling_event_type_t
28  * event channel, 8 bits, the source of the event.
29  * event data, 16 bit field, data depending on event type
30  */
31
32 /**
33  * Specifies what kind of event this is
34  */
35 typedef enum {
36         MALI_PROFILING_EVENT_TYPE_SINGLE  = 0 << 24,
37         MALI_PROFILING_EVENT_TYPE_START   = 1 << 24,
38         MALI_PROFILING_EVENT_TYPE_STOP    = 2 << 24,
39         MALI_PROFILING_EVENT_TYPE_SUSPEND = 3 << 24,
40         MALI_PROFILING_EVENT_TYPE_RESUME  = 4 << 24,
41 } cinstr_profiling_event_type_t;
42
43
44 /**
45  * Secifies the channel/source of the event
46  */
47 typedef enum {
48         MALI_PROFILING_EVENT_CHANNEL_SOFTWARE =  0 << 16,
49         MALI_PROFILING_EVENT_CHANNEL_GP0      =  1 << 16,
50         MALI_PROFILING_EVENT_CHANNEL_PP0      =  5 << 16,
51         MALI_PROFILING_EVENT_CHANNEL_PP1      =  6 << 16,
52         MALI_PROFILING_EVENT_CHANNEL_PP2      =  7 << 16,
53         MALI_PROFILING_EVENT_CHANNEL_PP3      =  8 << 16,
54         MALI_PROFILING_EVENT_CHANNEL_PP4      =  9 << 16,
55         MALI_PROFILING_EVENT_CHANNEL_PP5      = 10 << 16,
56         MALI_PROFILING_EVENT_CHANNEL_PP6      = 11 << 16,
57         MALI_PROFILING_EVENT_CHANNEL_PP7      = 12 << 16,
58         MALI_PROFILING_EVENT_CHANNEL_GPU      = 21 << 16,
59 } cinstr_profiling_event_channel_t;
60
61
62 #define MALI_PROFILING_MAKE_EVENT_CHANNEL_GP(num) (((MALI_PROFILING_EVENT_CHANNEL_GP0 >> 16) + (num)) << 16)
63 #define MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(num) (((MALI_PROFILING_EVENT_CHANNEL_PP0 >> 16) + (num)) << 16)
64
65 /**
66  * These events are applicable when the type MALI_PROFILING_EVENT_TYPE_SINGLE is used from software channel
67  */
68 typedef enum {
69         MALI_PROFILING_EVENT_REASON_SINGLE_SW_NONE                  = 0,
70         MALI_PROFILING_EVENT_REASON_SINGLE_SW_EGL_NEW_FRAME         = 1,
71         MALI_PROFILING_EVENT_REASON_SINGLE_SW_FLUSH                 = 2,
72         MALI_PROFILING_EVENT_REASON_SINGLE_SW_EGL_SWAP_BUFFERS      = 3,
73         MALI_PROFILING_EVENT_REASON_SINGLE_SW_FB_EVENT              = 4,
74         MALI_PROFILING_EVENT_REASON_SINGLE_SW_GP_ENQUEUE            = 5,
75         MALI_PROFILING_EVENT_REASON_SINGLE_SW_PP_ENQUEUE            = 6,
76         MALI_PROFILING_EVENT_REASON_SINGLE_SW_READBACK              = 7,
77         MALI_PROFILING_EVENT_REASON_SINGLE_SW_WRITEBACK             = 8,
78         MALI_PROFILING_EVENT_REASON_SINGLE_SW_ENTER_API_FUNC        = 10,
79         MALI_PROFILING_EVENT_REASON_SINGLE_SW_LEAVE_API_FUNC        = 11,
80         MALI_PROFILING_EVENT_REASON_SINGLE_SW_DISCARD_ATTACHMENTS   = 13,
81         MALI_PROFILING_EVENT_REASON_SINGLE_SW_UMP_TRY_LOCK          = 53,
82         MALI_PROFILING_EVENT_REASON_SINGLE_SW_UMP_LOCK              = 54,
83         MALI_PROFILING_EVENT_REASON_SINGLE_SW_UMP_UNLOCK            = 55,
84         MALI_PROFILING_EVENT_REASON_SINGLE_LOCK_CONTENDED           = 56,
85         MALI_PROFILING_EVENT_REASON_SINGLE_SW_EGL_MALI_FENCE_DUP    = 57,
86         MALI_PROFILING_EVENT_REASON_SINGLE_SW_EGL_SET_PP_JOB_FENCE  = 58,
87         MALI_PROFILING_EVENT_REASON_SINGLE_SW_EGL_WAIT_SYNC         = 59,
88         MALI_PROFILING_EVENT_REASON_SINGLE_SW_EGL_CREATE_FENCE_SYNC = 60,
89         MALI_PROFILING_EVENT_REASON_SINGLE_SW_EGL_CREATE_NATIVE_FENCE_SYNC = 61,
90         MALI_PROFILING_EVENT_REASON_SINGLE_SW_EGL_FENCE_FLUSH       = 62,
91         MALI_PROFILING_EVENT_REASON_SINGLE_SW_EGL_FLUSH_SERVER_WAITS = 63,
92 } cinstr_profiling_event_reason_single_sw_t;
93
94 /**
95  * These events are applicable when the type MALI_PROFILING_EVENT_TYPE_START/STOP is used from software channel
96  * to inform whether the core is physical or virtual
97  */
98 typedef enum {
99         MALI_PROFILING_EVENT_REASON_START_STOP_HW_PHYSICAL  = 0,
100         MALI_PROFILING_EVENT_REASON_START_STOP_HW_VIRTUAL   = 1,
101 } cinstr_profiling_event_reason_start_stop_hw_t;
102
103 /**
104  * These events are applicable when the type MALI_PROFILING_EVENT_TYPE_START/STOP is used from software channel
105  */
106 typedef enum {
107         /*MALI_PROFILING_EVENT_REASON_START_STOP_SW_NONE            = 0,*/
108         MALI_PROFILING_EVENT_REASON_START_STOP_SW_MALI            = 1,
109         MALI_PROFILING_EVENT_REASON_START_STOP_SW_CALLBACK_THREAD = 2,
110         MALI_PROFILING_EVENT_REASON_START_STOP_SW_WORKER_THREAD   = 3,
111         MALI_PROFILING_EVENT_REASON_START_STOP_SW_BOTTOM_HALF     = 4,
112         MALI_PROFILING_EVENT_REASON_START_STOP_SW_UPPER_HALF      = 5,
113 } cinstr_profiling_event_reason_start_stop_sw_t;
114
115 /**
116  * These events are applicable when the type MALI_PROFILING_EVENT_TYPE_SUSPEND/RESUME is used from software channel
117  */
118 typedef enum {
119         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_NONE                     =  0, /* used */
120         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_PIPELINE_FULL            =  1, /* NOT used */
121         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_VSYNC                    = 26, /* used in some build configurations */
122         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_FB_IFRAME_WAIT           = 27, /* USED */
123         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_FB_IFRAME_SYNC           = 28, /* USED */
124         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_VG_WAIT_FILTER_CLEANUP   = 29, /* used */
125         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_VG_WAIT_TEXTURE          = 30, /* used */
126         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_GLES_WAIT_MIPLEVEL       = 31, /* used */
127         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_GLES_WAIT_READPIXELS     = 32, /* used */
128         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_EGL_WAIT_SWAP_IMMEDIATE  = 33, /* NOT used */
129         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_ICS_QUEUE_BUFFER         = 34, /* USED */
130         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_ICS_DEQUEUE_BUFFER       = 35, /* USED */
131         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_UMP_LOCK                 = 36, /* Not currently used */
132         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_X11_GLOBAL_LOCK          = 37, /* Not currently used */
133         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_X11_SWAP                 = 38, /* Not currently used */
134         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_MALI_EGL_IMAGE_SYNC_WAIT = 39, /* USED */
135         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_GP_JOB_HANDLING          = 40, /* USED */
136         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_PP_JOB_HANDLING          = 41, /* USED */
137         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_EGL_MALI_FENCE_MERGE     = 42, /* USED */
138         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_EGL_MALI_FENCE_DUP       = 43,
139         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_EGL_FLUSH_SERVER_WAITS   = 44,
140         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_EGL_WAIT_SYNC            = 45, /* USED */
141         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_FB_JOBS_WAIT             = 46, /* USED */
142         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_FB_NOFRAMES_WAIT         = 47, /* USED */
143         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_FB_NOJOBS_WAIT           = 48, /* USED */
144         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_SUBMIT_LIMITER_WAIT      = 49, /* USED */
145 } cinstr_profiling_event_reason_suspend_resume_sw_t;
146
147 /**
148  * These events are applicable when the type MALI_PROFILING_EVENT_TYPE_SINGLE is used from a HW channel (GPx+PPx)
149  */
150 typedef enum {
151         MALI_PROFILING_EVENT_REASON_SINGLE_HW_NONE          = 0,
152         MALI_PROFILING_EVENT_REASON_SINGLE_HW_INTERRUPT     = 1,
153         MALI_PROFILING_EVENT_REASON_SINGLE_HW_FLUSH         = 2,
154 } cinstr_profiling_event_reason_single_hw_t;
155
156 /**
157  * These events are applicable when the type MALI_PROFILING_EVENT_TYPE_SINGLE is used from the GPU channel
158  */
159 typedef enum {
160         MALI_PROFILING_EVENT_REASON_SINGLE_GPU_NONE              = 0,
161         MALI_PROFILING_EVENT_REASON_SINGLE_GPU_FREQ_VOLT_CHANGE  = 1,
162         MALI_PROFILING_EVENT_REASON_SINGLE_GPU_L20_COUNTERS      = 2,
163         MALI_PROFILING_EVENT_REASON_SINGLE_GPU_L21_COUNTERS      = 3,
164         MALI_PROFILING_EVENT_REASON_SINGLE_GPU_L22_COUNTERS      = 4,
165 } cinstr_profiling_event_reason_single_gpu_t;
166
167 /**
168  * These values are applicable for the 3rd data parameter when
169  * the type MALI_PROFILING_EVENT_TYPE_START is used from the software channel
170  * with the MALI_PROFILING_EVENT_REASON_START_STOP_BOTTOM_HALF reason.
171  */
172 typedef enum {
173         MALI_PROFILING_EVENT_DATA_CORE_GP0             =  1,
174         MALI_PROFILING_EVENT_DATA_CORE_PP0             =  5,
175         MALI_PROFILING_EVENT_DATA_CORE_PP1             =  6,
176         MALI_PROFILING_EVENT_DATA_CORE_PP2             =  7,
177         MALI_PROFILING_EVENT_DATA_CORE_PP3             =  8,
178         MALI_PROFILING_EVENT_DATA_CORE_PP4             =  9,
179         MALI_PROFILING_EVENT_DATA_CORE_PP5             = 10,
180         MALI_PROFILING_EVENT_DATA_CORE_PP6             = 11,
181         MALI_PROFILING_EVENT_DATA_CORE_PP7             = 12,
182         MALI_PROFILING_EVENT_DATA_CORE_GP0_MMU         = 22, /* GP0 + 21 */
183         MALI_PROFILING_EVENT_DATA_CORE_PP0_MMU         = 26, /* PP0 + 21 */
184         MALI_PROFILING_EVENT_DATA_CORE_PP1_MMU         = 27, /* PP1 + 21 */
185         MALI_PROFILING_EVENT_DATA_CORE_PP2_MMU         = 28, /* PP2 + 21 */
186         MALI_PROFILING_EVENT_DATA_CORE_PP3_MMU         = 29, /* PP3 + 21 */
187         MALI_PROFILING_EVENT_DATA_CORE_PP4_MMU         = 30, /* PP4 + 21 */
188         MALI_PROFILING_EVENT_DATA_CORE_PP5_MMU         = 31, /* PP5 + 21 */
189         MALI_PROFILING_EVENT_DATA_CORE_PP6_MMU         = 32, /* PP6 + 21 */
190         MALI_PROFILING_EVENT_DATA_CORE_PP7_MMU         = 33, /* PP7 + 21 */
191
192 } cinstr_profiling_event_data_core_t;
193
194 #define MALI_PROFILING_MAKE_EVENT_DATA_CORE_GP(num) (MALI_PROFILING_EVENT_DATA_CORE_GP0 + (num))
195 #define MALI_PROFILING_MAKE_EVENT_DATA_CORE_GP_MMU(num) (MALI_PROFILING_EVENT_DATA_CORE_GP0_MMU + (num))
196 #define MALI_PROFILING_MAKE_EVENT_DATA_CORE_PP(num) (MALI_PROFILING_EVENT_DATA_CORE_PP0 + (num))
197 #define MALI_PROFILING_MAKE_EVENT_DATA_CORE_PP_MMU(num) (MALI_PROFILING_EVENT_DATA_CORE_PP0_MMU + (num))
198
199
200 #endif /*_MALI_UTGARD_PROFILING_EVENTS_H_*/