tizen 2.4 release
[kernel/linux-3.0.git] / drivers / gpu / arm / mali400 / mali / include / linux / mali / mali_utgard_profiling_events.h
1 /*
2  * Copyright (C) 2011-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_EVENTS_H_
12 #define _MALI_UTGARD_PROFILING_EVENTS_H_
13
14 /*
15  * The event ID is a 32 bit value consisting of different fields
16  * reserved, 4 bits, for future use
17  * event type, 4 bits, cinstr_profiling_event_type_t
18  * event channel, 8 bits, the source of the event.
19  * event data, 16 bit field, data depending on event type
20  */
21
22 /**
23  * Specifies what kind of event this is
24  */
25 typedef enum
26 {
27         MALI_PROFILING_EVENT_TYPE_SINGLE  = 0 << 24,
28         MALI_PROFILING_EVENT_TYPE_START   = 1 << 24,
29         MALI_PROFILING_EVENT_TYPE_STOP    = 2 << 24,
30         MALI_PROFILING_EVENT_TYPE_SUSPEND = 3 << 24,
31         MALI_PROFILING_EVENT_TYPE_RESUME  = 4 << 24,
32 } cinstr_profiling_event_type_t;
33
34
35 /**
36  * Secifies the channel/source of the event
37  */
38 typedef enum
39 {
40         MALI_PROFILING_EVENT_CHANNEL_SOFTWARE =  0 << 16,
41         MALI_PROFILING_EVENT_CHANNEL_GP0      =  1 << 16,
42         MALI_PROFILING_EVENT_CHANNEL_PP0      =  5 << 16,
43         MALI_PROFILING_EVENT_CHANNEL_PP1      =  6 << 16,
44         MALI_PROFILING_EVENT_CHANNEL_PP2      =  7 << 16,
45         MALI_PROFILING_EVENT_CHANNEL_PP3      =  8 << 16,
46         MALI_PROFILING_EVENT_CHANNEL_PP4      =  9 << 16,
47         MALI_PROFILING_EVENT_CHANNEL_PP5      = 10 << 16,
48         MALI_PROFILING_EVENT_CHANNEL_PP6      = 11 << 16,
49         MALI_PROFILING_EVENT_CHANNEL_PP7      = 12 << 16,
50         MALI_PROFILING_EVENT_CHANNEL_GPU      = 21 << 16,
51 } cinstr_profiling_event_channel_t;
52
53
54 #define MALI_PROFILING_MAKE_EVENT_CHANNEL_GP(num) (((MALI_PROFILING_EVENT_CHANNEL_GP0 >> 16) + (num)) << 16)
55 #define MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(num) (((MALI_PROFILING_EVENT_CHANNEL_PP0 >> 16) + (num)) << 16)
56
57 /**
58  * These events are applicable when the type MALI_PROFILING_EVENT_TYPE_SINGLE is used from software channel
59  */
60 typedef enum
61 {
62         MALI_PROFILING_EVENT_REASON_SINGLE_SW_NONE                  = 0,
63         MALI_PROFILING_EVENT_REASON_SINGLE_SW_EGL_NEW_FRAME         = 1,
64         MALI_PROFILING_EVENT_REASON_SINGLE_SW_FLUSH                 = 2,
65         MALI_PROFILING_EVENT_REASON_SINGLE_SW_EGL_SWAP_BUFFERS      = 3,
66         MALI_PROFILING_EVENT_REASON_SINGLE_SW_FB_EVENT              = 4,
67         MALI_PROFILING_EVENT_REASON_SINGLE_SW_GP_ENQUEUE            = 5,
68         MALI_PROFILING_EVENT_REASON_SINGLE_SW_PP_ENQUEUE            = 6,
69     MALI_PROFILING_EVENT_REASON_SINGLE_SW_ENTER_API_FUNC        = 10,
70     MALI_PROFILING_EVENT_REASON_SINGLE_SW_LEAVE_API_FUNC        = 11,
71     MALI_PROFILING_EVENT_REASON_SINGLE_SW_UMP_TRY_LOCK          = 53,
72         MALI_PROFILING_EVENT_REASON_SINGLE_SW_UMP_LOCK              = 54,
73         MALI_PROFILING_EVENT_REASON_SINGLE_SW_UMP_UNLOCK            = 55,
74         MALI_PROFILING_EVENT_REASON_SINGLE_LOCK_CONTENDED           = 56,
75 } cinstr_profiling_event_reason_single_sw_t;
76
77 /**
78  * These events are applicable when the type MALI_PROFILING_EVENT_TYPE_START/STOP is used from software channel
79  * to inform whether the core is physical or virtual
80  */
81 typedef enum
82 {
83         MALI_PROFILING_EVENT_REASON_START_STOP_HW_PHYSICAL  = 0,
84         MALI_PROFILING_EVENT_REASON_START_STOP_HW_VIRTUAL   = 1,
85 } cinstr_profiling_event_reason_start_stop_hw_t;
86
87 /**
88  * These events are applicable when the type MALI_PROFILING_EVENT_TYPE_START/STOP is used from software channel
89  */
90 typedef enum
91 {
92         /*MALI_PROFILING_EVENT_REASON_START_STOP_SW_NONE            = 0,*/
93         MALI_PROFILING_EVENT_REASON_START_STOP_SW_MALI            = 1,
94         MALI_PROFILING_EVENT_REASON_START_STOP_SW_CALLBACK_THREAD = 2,
95         MALI_PROFILING_EVENT_REASON_START_STOP_SW_WORKER_THREAD   = 3,
96         MALI_PROFILING_EVENT_REASON_START_STOP_SW_BOTTOM_HALF     = 4,
97         MALI_PROFILING_EVENT_REASON_START_STOP_SW_UPPER_HALF      = 5,
98 } cinstr_profiling_event_reason_start_stop_sw_t;
99
100 /**
101  * These events are applicable when the type MALI_PROFILING_EVENT_TYPE_SUSPEND/RESUME is used from software channel
102  */
103 typedef enum
104 {
105         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_NONE                   =  0, /* used */
106         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_PIPELINE_FULL          =  1, /* NOT used */
107         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_VSYNC                  = 26, /* used in some build configurations */
108         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_FB_IFRAME_WAIT         = 27, /* USED */
109         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_FB_IFRAME_SYNC         = 28, /* USED */
110         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_VG_WAIT_FILTER_CLEANUP = 29, /* used */
111         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_VG_WAIT_TEXTURE        = 30, /* used */
112         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_GLES_WAIT_MIPLEVEL     = 31, /* used */
113         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_GLES_WAIT_READPIXELS   = 32, /* used */
114         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_EGL_WAIT_SWAP_IMMEDIATE= 33, /* NOT used */
115         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_ICS_QUEUE_BUFFER       = 34, /* USED */
116         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_ICS_DEQUEUE_BUFFER     = 35, /* USED */
117         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_UMP_LOCK               = 36, /* Not currently used */
118         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_X11_GLOBAL_LOCK        = 37, /* Not currently used */
119         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_X11_SWAP               = 38, /* Not currently used */
120         MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_MALI_EGL_IMAGE_SYNC_WAIT = 39, /* USED */
121 } cinstr_profiling_event_reason_suspend_resume_sw_t;
122
123 /**
124  * These events are applicable when the type MALI_PROFILING_EVENT_TYPE_SINGLE is used from a HW channel (GPx+PPx)
125  */
126 typedef enum
127 {
128         MALI_PROFILING_EVENT_REASON_SINGLE_HW_NONE          = 0,
129         MALI_PROFILING_EVENT_REASON_SINGLE_HW_INTERRUPT     = 1,
130         MALI_PROFILING_EVENT_REASON_SINGLE_HW_FLUSH         = 2,
131 } cinstr_profiling_event_reason_single_hw_t;
132
133 /**
134  * These events are applicable when the type MALI_PROFILING_EVENT_TYPE_SINGLE is used from the GPU channel
135  */
136 typedef enum
137 {
138         MALI_PROFILING_EVENT_REASON_SINGLE_GPU_NONE              = 0,
139         MALI_PROFILING_EVENT_REASON_SINGLE_GPU_FREQ_VOLT_CHANGE  = 1,
140         MALI_PROFILING_EVENT_REASON_SINGLE_GPU_L20_COUNTERS      = 2,
141         MALI_PROFILING_EVENT_REASON_SINGLE_GPU_L21_COUNTERS      = 3,
142         MALI_PROFILING_EVENT_REASON_SINGLE_GPU_L22_COUNTERS      = 4,
143 } cinstr_profiling_event_reason_single_gpu_t;
144
145 /**
146  * These values are applicable for the 3rd data parameter when
147  * the type MALI_PROFILING_EVENT_TYPE_START is used from the software channel
148  * with the MALI_PROFILING_EVENT_REASON_START_STOP_BOTTOM_HALF reason.
149  */
150 typedef enum
151 {
152         MALI_PROFILING_EVENT_DATA_CORE_GP0             =  1,
153         MALI_PROFILING_EVENT_DATA_CORE_PP0             =  5,
154         MALI_PROFILING_EVENT_DATA_CORE_PP1             =  6,
155         MALI_PROFILING_EVENT_DATA_CORE_PP2             =  7,
156         MALI_PROFILING_EVENT_DATA_CORE_PP3             =  8,
157         MALI_PROFILING_EVENT_DATA_CORE_PP4             =  9,
158         MALI_PROFILING_EVENT_DATA_CORE_PP5             = 10,
159         MALI_PROFILING_EVENT_DATA_CORE_PP6             = 11,
160         MALI_PROFILING_EVENT_DATA_CORE_PP7             = 12,
161 } cinstr_profiling_event_data_core_t;
162
163 #define MALI_PROFILING_MAKE_EVENT_DATA_CORE_GP(num) (MALI_PROFILING_EVENT_DATA_CORE_GP0 + (num))
164 #define MALI_PROFILING_MAKE_EVENT_DATA_CORE_PP(num) (MALI_PROFILING_EVENT_DATA_CORE_PP0 + (num))
165
166
167 #endif /*_MALI_UTGARD_PROFILING_EVENTS_H_*/