tizen 2.4 release
[kernel/linux-3.0.git] / drivers / gpu / arm / mali400 / mali / linux / mali_osk_specific.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 /**
12  * @file mali_osk_specific.h
13  * Defines per-OS Kernel level specifics, such as unusual workarounds for
14  * certain OSs.
15  */
16
17 #ifndef __MALI_OSK_SPECIFIC_H__
18 #define __MALI_OSK_SPECIFIC_H__
19
20 #include <asm/uaccess.h>
21
22 #include "mali_sync.h"
23
24 #define MALI_STATIC_INLINE static inline
25 #define MALI_NON_STATIC_INLINE inline
26
27 #ifdef CONFIG_SYNC
28 /* MALI_SEC */
29 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)
30 typedef struct sync_timeline mali_sync_tl;
31 typedef struct sync_pt mali_sync_pt;
32
33 MALI_STATIC_INLINE mali_sync_pt *_mali_osk_sync_pt_create(mali_sync_tl *parent)
34 {
35         return (mali_sync_pt*)mali_sync_pt_alloc(parent);
36 }
37
38 MALI_STATIC_INLINE void _mali_osk_sync_pt_signal(mali_sync_pt *pt)
39 {
40         mali_sync_signal_pt(pt, 0);
41 }
42 #endif
43 #endif /* CONFIG_SYNC */
44
45 MALI_STATIC_INLINE u32 _mali_osk_copy_from_user(void *to, void *from, u32 n)
46 {
47         return (u32)copy_from_user(to, from, (unsigned long)n);
48 }
49
50 /** The list of events supported by the Mali DDK. */
51 typedef enum
52 {
53     /* Vertex processor activity */
54     ACTIVITY_VP = 0,
55
56     /* Fragment processor activity */
57     ACTIVITY_FP0,
58     ACTIVITY_FP1,
59     ACTIVITY_FP2,
60     ACTIVITY_FP3,
61
62     /* L2 cache counters */
63     COUNTER_L2_C0,
64     COUNTER_L2_C1,
65
66     /* Vertex processor counters */
67     COUNTER_VP_C0,
68     COUNTER_VP_C1,
69
70     /* Fragment processor counters */
71     COUNTER_FP0_C0,
72     COUNTER_FP0_C1,
73     COUNTER_FP1_C0,
74     COUNTER_FP1_C1,
75     COUNTER_FP2_C0,
76     COUNTER_FP2_C1,
77     COUNTER_FP3_C0,
78     COUNTER_FP3_C1,
79
80     /*
81      * If more hardware counters are added, the _mali_osk_hw_counter_table
82      * below should also be updated.
83      */
84
85     /* EGL software counters */
86     COUNTER_EGL_BLIT_TIME,
87
88     /* GLES software counters */
89     COUNTER_GLES_DRAW_ELEMENTS_CALLS,
90     COUNTER_GLES_DRAW_ELEMENTS_NUM_INDICES,
91     COUNTER_GLES_DRAW_ELEMENTS_NUM_TRANSFORMED,
92     COUNTER_GLES_DRAW_ARRAYS_CALLS,
93     COUNTER_GLES_DRAW_ARRAYS_NUM_TRANSFORMED,
94     COUNTER_GLES_DRAW_POINTS,
95     COUNTER_GLES_DRAW_LINES,
96     COUNTER_GLES_DRAW_LINE_LOOP,
97     COUNTER_GLES_DRAW_LINE_STRIP,
98     COUNTER_GLES_DRAW_TRIANGLES,
99     COUNTER_GLES_DRAW_TRIANGLE_STRIP,
100     COUNTER_GLES_DRAW_TRIANGLE_FAN,
101     COUNTER_GLES_NON_VBO_DATA_COPY_TIME,
102     COUNTER_GLES_UNIFORM_BYTES_COPIED_TO_MALI,
103     COUNTER_GLES_UPLOAD_TEXTURE_TIME,
104     COUNTER_GLES_UPLOAD_VBO_TIME,
105     COUNTER_GLES_NUM_FLUSHES,
106     COUNTER_GLES_NUM_VSHADERS_GENERATED,
107     COUNTER_GLES_NUM_FSHADERS_GENERATED,
108     COUNTER_GLES_VSHADER_GEN_TIME,
109     COUNTER_GLES_FSHADER_GEN_TIME,
110     COUNTER_GLES_INPUT_TRIANGLES,
111     COUNTER_GLES_VXCACHE_HIT,
112     COUNTER_GLES_VXCACHE_MISS,
113     COUNTER_GLES_VXCACHE_COLLISION,
114     COUNTER_GLES_CULLED_TRIANGLES,
115     COUNTER_GLES_CULLED_LINES,
116     COUNTER_GLES_BACKFACE_TRIANGLES,
117     COUNTER_GLES_GBCLIP_TRIANGLES,
118     COUNTER_GLES_GBCLIP_LINES,
119     COUNTER_GLES_TRIANGLES_DRAWN,
120     COUNTER_GLES_DRAWCALL_TIME,
121     COUNTER_GLES_TRIANGLES_COUNT,
122     COUNTER_GLES_INDEPENDENT_TRIANGLES_COUNT,
123     COUNTER_GLES_STRIP_TRIANGLES_COUNT,
124     COUNTER_GLES_FAN_TRIANGLES_COUNT,
125     COUNTER_GLES_LINES_COUNT,
126     COUNTER_GLES_INDEPENDENT_LINES_COUNT,
127     COUNTER_GLES_STRIP_LINES_COUNT,
128     COUNTER_GLES_LOOP_LINES_COUNT,
129
130     /* Framebuffer capture pseudo-counter */
131     COUNTER_FILMSTRIP,
132
133     NUMBER_OF_EVENTS
134 } _mali_osk_counter_id;
135
136 #define FIRST_ACTIVITY_EVENT    ACTIVITY_VP
137 #define LAST_ACTIVITY_EVENT     ACTIVITY_FP3
138
139 #define FIRST_HW_COUNTER        COUNTER_L2_C0
140 #define LAST_HW_COUNTER         COUNTER_FP3_C1
141
142 #define FIRST_SW_COUNTER        COUNTER_EGL_BLIT_TIME
143 #define LAST_SW_COUNTER         COUNTER_GLES_LOOP_LINES_COUNT
144
145 #define FIRST_SPECIAL_COUNTER   COUNTER_FILMSTRIP
146 #define LAST_SPECIAL_COUNTER    COUNTER_FILMSTRIP
147
148 #endif /* __MALI_OSK_SPECIFIC_H__ */