1 /*
2  * Copyright � 2014 Intel Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sub license, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the
13  * next paragraph) shall be included in all copies or substantial portions
14  * of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19  * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
20  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  * Authors:
25  *     Wei Lin<wei.w.lin@intel.com>
26  *     Yuting Yang<yuting.yang@intel.com>
27  */
28 #ifndef __GENOS_RESOURCE_DEFS_H__
29 #define __GENOS_RESOURCE_DEFS_H__
30 
31 typedef enum _GENOS_FORMAT {
32 	Format_Invalid = -14,
33 	Format_Source = -13,
34 
35 	Format_420O = -12,
36 	Format_RGB_Swap = -11,
37 	Format_RGB_No_Swap = -10,
38 	Format_RGB = -9,
39 	Format_RGB32 = -8,
40 	Format_PA = -7,
41 	Format_PL2 = -6,
42 	Format_PL2_UnAligned = -5,
43 	Format_PL3 = -4,
44 	Format_PL3_RGB = -3,
45 	Format_PAL = -2,
46 
47 	Format_None = -1,
48 	Format_Any = 0,
49 
50 	Format_A8R8G8B8,
51 	Format_X8R8G8B8,
52 	Format_A8B8G8R8,
53 	Format_X8B8G8R8,
54 	Format_A16B16G16R16,
55 	Format_A16R16G16B16,
56 	Format_R5G6B5,
57 	Format_R32U,
58 	Format_R32F,
59 
60 	Format_RGBP,
61 	Format_BGRP,
62 
63 	Format_YUY2,
64 	Format_YUYV,
65 	Format_YVYU,
66 	Format_UYVY,
67 	Format_VYUY,
68 
69 	Format_Y416,
70 	Format_AYUV,
71 	Format_AUYV,
72 
73 	Format_400P,
74 
75 	Format_NV12,
76 	Format_NV12_UnAligned,
77 	Format_NV21,
78 	Format_NV11,
79 	Format_NV11_UnAligned,
80 	Format_P208,
81 	Format_P208_UnAligned,
82 
83 	Format_IMC1,
84 	Format_IMC2,
85 	Format_IMC3,
86 	Format_IMC4,
87 	Format_422H,
88 	Format_422V,
89 	Format_444P,
90 	Format_411P,
91 	Format_411R,
92 	Format_I420,
93 	Format_IYUV,
94 	Format_YV12,
95 	Format_YVU9,
96 
97 	Format_AI44,
98 	Format_IA44,
99 	Format_P8,
100 	Format_A8P8,
101 
102 	Format_A8,
103 	Format_L8,
104 	Format_A4L4,
105 	Format_A8L8,
106 
107 	Format_IRW0,
108 	Format_IRW1,
109 	Format_IRW2,
110 	Format_IRW3,
111 	Format_IRW4,
112 	Format_IRW5,
113 	Format_IRW6,
114 	Format_IRW7,
115 
116 	Format_STMM,
117 
118 	Format_Buffer,
119 	Format_Buffer_2D,
120 
121 	Format_V8U8,
122 
123 	Format_R32S,
124 	Format_R8U,
125 	Format_R8G8UN,
126 	Format_R8G8SN,
127 	Format_G8R8_G8B8,
128 	Format_R16U,
129 	Format_R16S,
130 	Format_R16UN,
131 	Format_RAW,
132 
133 	Format_Y8,
134 	Format_Y1,
135 	Format_Y16U,
136 	Format_Y16S,
137 
138 	Format_L16,
139 	Format_D16,
140 	Format_R10G10B10A2,
141 
142 	Format_P016,
143 	Format_P010,
144 	Format_YV12_Planar,
145 	Format_Count
146 } GENOS_FORMAT, *PGENOS_FORMAT;
147 C_ASSERT(Format_Count == 80);
148 
149 #define IS_PAL_FORMAT(format)            \
150             ( (format == Format_AI44) || \
151               (format == Format_IA44) || \
152               (format == Format_P8)   || \
153               (format == Format_A8P8))
154 
155 #define IS_PL3_RGB_FORMAT(format)        \
156             ( (format == Format_RGBP) || \
157               (format == Format_BGRP) )
158 
159 #define IS_RGB16_FORMAT(format)              \
160             (format == Format_R5G6B5)
161 
162 #define IS_RGB32_FORMAT(format)              \
163             ( (format == Format_A8R8G8B8) || \
164               (format == Format_X8R8G8B8) || \
165               (format == Format_A8B8G8R8) || \
166               (format == Format_X8B8G8R8) || \
167               (format == Format_RGB32) )
168 
169 #define IS_RGB64_FORMAT(format)                  \
170             ( (format == Format_A16B16G16R16) || \
171               (format == Format_A16R16G16B16))
172 
173 #define IS_RGB_FORMAT(format)              \
174             ( IS_RGB64_FORMAT(format)   || \
175               IS_RGB32_FORMAT(format)   || \
176               IS_RGB16_FORMAT(format)   || \
177               IS_PL3_RGB_FORMAT(format) || \
178               (format == Format_RGB) )
179 
180 #define IS_PA_FORMAT(format)             \
181             ( (format == Format_PA)   || \
182               (format == Format_YUY2) || \
183               (format == Format_YUYV) || \
184               (format == Format_YVYU) || \
185               (format == Format_UYVY) || \
186               (format == Format_VYUY) )
187 
188 #define IS_PL2_FORMAT(format)            \
189             ( (format == Format_PL2)  || \
190               (format == Format_NV12) || \
191               (format == Format_NV21) || \
192               (format == Format_NV11) || \
193               (format == Format_P208) )
194 
195 #define CASE_PL2_FORMAT  \
196             case Format_PL2:     \
197             case Format_NV12:    \
198             case Format_NV21:    \
199             case Format_NV11:    \
200             case Format_P208:    \
201             case Format_P010:    \
202             case Format_P016
203 
204 #define IS_PL3_FORMAT(format)            \
205             ( (format == Format_PL3)  || \
206               (format == Format_IMC1) || \
207               (format == Format_IMC2) || \
208               (format == Format_IMC3) || \
209               (format == Format_IMC4) || \
210               (format == Format_I420) || \
211               (format == Format_IYUV) || \
212               (format == Format_YV12) || \
213               (format == Format_YVU9) || \
214               (format == Format_422H) || \
215               (format == Format_422V) || \
216               (format == Format_411P) || \
217               (format == Format_411R) || \
218               (format == Format_444P) )
219 
220 #define CASE_PL3_FORMAT  \
221             case Format_PL3:     \
222             case Format_IMC1:    \
223             case Format_IMC2:    \
224             case Format_IMC3:    \
225             case Format_IMC4:    \
226             case Format_I420:    \
227             case Format_IYUV:    \
228             case Format_YV12:    \
229             case Format_YVU9:    \
230             case Format_422H:    \
231             case Format_422V:    \
232             case Format_411P:    \
233             case Format_411R:    \
234             case Format_444P
235 
236 #define CASE_PL3_RGB_FORMAT  \
237             case Format_RGBP:        \
238             case Format_BGRP
239 
240 #define IS_YUV_FORMAT(format)              \
241           ( IS_PL2_FORMAT(format)       || \
242             IS_PL3_FORMAT(format)       || \
243             IS_PA_FORMAT(format)        || \
244             (format == Format_400P))
245 
246 #define GENOS_YTILE_H_ALIGNMENT  32
247 #define GENOS_YTILE_W_ALIGNMENT  128
248 #define GENOS_XTILE_H_ALIGNMENT  8
249 #define GENOS_XTILE_W_ALIGNMENT  512
250 
251 typedef enum _GENOS_TILE_TYPE {
252 	GENOS_TILE_X,
253 	GENOS_TILE_Y,
254 	GENOS_TILE_LINEAR,
255 	GENOS_TILE_INVALID
256 } GENOS_TILE_TYPE;
257 C_ASSERT(GENOS_TILE_LINEAR == 2);
258 
259 typedef enum _GENOS_GFXRES_TYPE {
260 	GENOS_GFXRES_INVALID = -1,
261 	GENOS_GFXRES_BUFFER,
262 	GENOS_GFXRES_2D,
263 	GENOS_GFXRES_VOLUME,
264 } GENOS_GFXRES_TYPE;
265 
266 #endif
267