Merge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux...
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / rogue_m / include / img_3dtypes.h
1 /*************************************************************************/ /*!
2 @File
3 @Title          Global 3D types for use by IMG APIs
4 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description    Defines 3D types for use by IMG APIs
6 @License        Dual MIT/GPLv2
7
8 The contents of this file are subject to the MIT license as set out below.
9
10 Permission is hereby granted, free of charge, to any person obtaining a copy
11 of this software and associated documentation files (the "Software"), to deal
12 in the Software without restriction, including without limitation the rights
13 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 copies of the Software, and to permit persons to whom the Software is
15 furnished to do so, subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 Alternatively, the contents of this file may be used under the terms of
21 the GNU General Public License Version 2 ("GPL") in which case the provisions
22 of GPL are applicable instead of those above.
23
24 If you wish to allow use of your version of this file only under the terms of
25 GPL, and not to allow others to use your version of this file under the terms
26 of the MIT license, indicate your decision by deleting the provisions above
27 and replace them with the notice and other provisions required by GPL as set
28 out in the file called "GPL-COPYING" included in this distribution. If you do
29 not delete the provisions above, a recipient may use your version of this file
30 under the terms of either the MIT license or GPL.
31
32 This License is also included in this distribution in the file called
33 "MIT-COPYING".
34
35 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
36 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
37 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
38 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
39 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
40 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
41 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42 */ /**************************************************************************/
43
44 #ifndef __IMG_3DTYPES_H__
45 #define __IMG_3DTYPES_H__
46
47 /**
48  * Comparison functions
49  * This comparison function is defined as:
50  * A {CmpFunc} B
51  * A is a reference value, e.g., incoming depth etc.
52  * B is the sample value, e.g., value in depth buffer. 
53  */
54 typedef enum _IMG_COMPFUNC_
55 {
56         IMG_COMPFUNC_NEVER,                     /**< The comparison never succeeds */
57         IMG_COMPFUNC_LESS,                      /**< The comparison is a less-than operation */
58         IMG_COMPFUNC_EQUAL,                     /**< The comparison is an equal-to operation */
59         IMG_COMPFUNC_LESS_EQUAL,        /**< The comparison is a less-than or equal-to 
60                                                                          operation */
61         IMG_COMPFUNC_GREATER,           /**< The comparison is a greater-than operation 
62                                                                 */
63         IMG_COMPFUNC_NOT_EQUAL,         /**< The comparison is a no-equal-to operation
64                                                                 */
65         IMG_COMPFUNC_GREATER_EQUAL,     /**< The comparison is a greater-than or 
66                                                                          equal-to operation */
67         IMG_COMPFUNC_ALWAYS,            /**< The comparison always succeeds */
68 } IMG_COMPFUNC;
69
70 /**
71  * Stencil op functions
72  */
73 typedef enum _IMG_STENCILOP_
74 {
75         IMG_STENCILOP_KEEP,             /**< Keep original value */
76         IMG_STENCILOP_ZERO,             /**< Set stencil to 0 */
77         IMG_STENCILOP_REPLACE,  /**< Replace stencil entry */
78         IMG_STENCILOP_INCR_SAT, /**< Increment stencil entry, clamping to max */
79         IMG_STENCILOP_DECR_SAT, /**< Decrement stencil entry, clamping to zero */
80         IMG_STENCILOP_INVERT,   /**< Invert bits in stencil entry */
81         IMG_STENCILOP_INCR,             /**< Increment stencil entry, 
82                                                                  wrapping if necessary */
83         IMG_STENCILOP_DECR,             /**< Decrement stencil entry, 
84                                                                  wrapping if necessary */
85 } IMG_STENCILOP;
86
87 /**
88  * Memory layout enumeration.
89  * Defines how pixels are layed out within a surface.
90  */
91 typedef enum _IMG_MEMLAYOUT_
92 {
93         IMG_MEMLAYOUT_STRIDED,                  /**< Resource is strided, one row at a time */
94     IMG_MEMLAYOUT_TWIDDLED,                     /**< Resource is 2D twiddled, classic style */
95     IMG_MEMLAYOUT_3DTWIDDLED,       /**< Resource is 3D twiddled, classic style */
96         IMG_MEMLAYOUT_TILED,                    /**< Resource is tiled, tiling config specified elsewhere. */
97         IMG_MEMLAYOUT_PAGETILED,                /**< Resource is pagetiled */
98 } IMG_MEMLAYOUT;
99
100 /**
101  * Alpha blending allows colours and textures on one surface
102  * to be blended with transparancy onto another surface.
103  * These definitions apply to both source and destination blending
104  * states
105  */
106 typedef enum _IMG_BLEND_
107 {
108         IMG_BLEND_ZERO = 0,        /**< Blend factor is (0,0,0,0) */
109         IMG_BLEND_ONE,             /**< Blend factor is (1,1,1,1) */
110         IMG_BLEND_SRC_COLOUR,      /**< Blend factor is the source colour */
111         IMG_BLEND_INV_SRC_COLOUR,  /**< Blend factor is the inverted source colour
112                                                                         (i.e. 1-src_col) */
113         IMG_BLEND_SRC_ALPHA,       /**< Blend factor is the source alpha */
114         IMG_BLEND_INV_SRC_ALPHA,   /**< Blend factor is the inverted source alpha
115                                                                         (i.e. 1-src_alpha) */
116         IMG_BLEND_DEST_ALPHA,      /**< Blend factor is the destination alpha */
117         IMG_BLEND_INV_DEST_ALPHA,  /**< Blend factor is the inverted destination 
118                                                                         alpha */
119         IMG_BLEND_DEST_COLOUR,     /**< Blend factor is the destination colour */
120         IMG_BLEND_INV_DEST_COLOUR, /**< Blend factor is the inverted destination 
121                                                                         colour */
122         IMG_BLEND_SRC_ALPHASAT,    /**< Blend factor is the alpha saturation (the 
123                                                                         minimum of (Src alpha, 
124                                                                         1 - destination alpha)) */
125         IMG_BLEND_BLEND_FACTOR,    /**< Blend factor is a constant */
126         IMG_BLEND_INVBLEND_FACTOR, /**< Blend factor is a constant (inverted)*/
127         IMG_BLEND_SRC1_COLOUR,     /**< Blend factor is the colour outputted from 
128                                                                         the pixel shader */
129         IMG_BLEND_INV_SRC1_COLOUR, /**< Blend factor is the inverted colour 
130                                                                         outputted from the pixel shader */
131         IMG_BLEND_SRC1_ALPHA,      /**< Blend factor is the alpha outputted from 
132                                                                         the pixel shader */
133         IMG_BLEND_INV_SRC1_ALPHA   /**< Blend factor is the inverted alpha
134                                                                         outputted from the pixel shader */
135 } IMG_BLEND;
136
137 /**
138  * The arithmetic operation to perform when blending
139  */
140 typedef enum _IMG_BLENDOP_
141 {
142         IMG_BLENDOP_ADD = 0,      /**< Result = (Source + Destination) */
143         IMG_BLENDOP_SUBTRACT,     /**< Result = (Source - Destination) */
144         IMG_BLENDOP_REV_SUBTRACT, /**< Result = (Destination - Source) */
145         IMG_BLENDOP_MIN,          /**< Result = min (Source, Destination) */
146         IMG_BLENDOP_MAX           /**< Result = max (Source, Destination) */
147 } IMG_BLENDOP;
148
149 /**
150  * Logical operation to perform when logic ops are enabled
151  */
152 typedef enum _IMG_LOGICOP_
153 {
154         IMG_LOGICOP_CLEAR = 0,     /**< Result = 0 */
155         IMG_LOGICOP_SET,           /**< Result = -1 */
156         IMG_LOGICOP_COPY,          /**< Result = Source */
157         IMG_LOGICOP_COPY_INVERTED, /**< Result = ~Source */
158         IMG_LOGICOP_NOOP,          /**< Result = Destination */
159         IMG_LOGICOP_INVERT,        /**< Result = ~Destination */
160         IMG_LOGICOP_AND,           /**< Result = Source & Destination */
161         IMG_LOGICOP_NAND,          /**< Result = ~(Source & Destination) */
162         IMG_LOGICOP_OR,            /**< Result = Source | Destination */
163         IMG_LOGICOP_NOR,           /**< Result = ~(Source | Destination) */
164         IMG_LOGICOP_XOR,           /**< Result = Source ^ Destination */
165         IMG_LOGICOP_EQUIV,         /**< Result = ~(Source ^ Destination) */
166         IMG_LOGICOP_AND_REVERSE,   /**< Result = Source & ~Destination */
167         IMG_LOGICOP_AND_INVERTED,  /**< Result = ~Source & Destination */
168         IMG_LOGICOP_OR_REVERSE,    /**< Result = Source | ~Destination */
169         IMG_LOGICOP_OR_INVERTED    /**< Result = ~Source | Destination */
170 } IMG_LOGICOP;
171
172 /**
173  * Type of fog blending supported
174  */
175 typedef enum _IMG_FOGMODE_
176 {
177         IMG_FOGMODE_NONE, /**< No fog blending - fog calculations are
178                                            *   based on the value output from the vertex phase */
179         IMG_FOGMODE_LINEAR, /**< Linear interpolation */
180         IMG_FOGMODE_EXP, /**< Exponential */
181         IMG_FOGMODE_EXP2, /**< Exponential squaring */
182 } IMG_FOGMODE;
183
184 /**
185  * Types of filtering
186  */
187 typedef enum _IMG_FILTER_
188 {
189         IMG_FILTER_DONTCARE,    /**< Any filtering mode is acceptable */
190         IMG_FILTER_POINT,               /**< Point filtering */
191         IMG_FILTER_LINEAR,              /**< Bi-linear filtering */
192         IMG_FILTER_BICUBIC,             /**< Bi-cubic filtering */
193 } IMG_FILTER;
194
195 /**
196  * Addressing modes for textures
197  */
198 typedef enum _IMG_ADDRESSMODE_
199 {
200         IMG_ADDRESSMODE_REPEAT, /**< Texture repeats conintuously */
201         IMG_ADDRESSMODE_FLIP, /**< Texture flips on odd integer part */
202         IMG_ADDRESSMODE_CLAMP, /**< Texture clamped at 0 or 1 */
203         IMG_ADDRESSMODE_FLIPCLAMP, /**< Flipped once, then clampe */
204         IMG_ADDRESSMODE_CLAMPBORDER,
205         IMG_ADDRESSMODE_OGL_CLAMP,
206         IMG_ADDRESSMODE_OVG_TILEFILL,
207         IMG_ADDRESSMODE_DONTCARE,
208 } IMG_ADDRESSMODE;
209
210 /**
211  * Culling based on winding order of triangle.
212  */
213 typedef enum _IMG_CULLMODE_
214 {
215         IMG_CULLMODE_NONE,                      /**< Don't cull */
216         IMG_CULLMODE_FRONTFACING,       /**< Front facing triangles */
217         IMG_CULLMODE_BACKFACING,        /**< Back facing triangles */
218 } IMG_CULLMODE;
219
220 /**
221  * Rotation clockwise
222  */
223 typedef enum _IMG_ROTATION_
224 {
225         IMG_ROTATION_0DEG = 0,
226         IMG_ROTATION_90DEG = 1,
227         IMG_ROTATION_180DEG = 2,
228         IMG_ROTATION_270DEG = 3,
229         IMG_ROTATION_FLIP_Y = 4
230 } IMG_ROTATION;
231
232
233 #endif /* __IMG_3DTYPES_H__ */
234 /******************************************************************************
235  End of file (img_3dtypes.h)
236 ******************************************************************************/