package version up to 2.8.0
[platform/core/uifw/libtbm.git] / src / tbm_type.h
1 /**************************************************************************
2
3 libtbm
4
5 Copyright 2014 Samsung Electronics co., Ltd. All Rights Reserved.
6
7 Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
8 Inpyo Kang <mantiger@samsung.com>, Dongyeon Kim <dy5.kim@samsung.com>
9 Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
10
11 Permission is hereby granted, free of charge, to any person obtaining a
12 copy of this software and associated documentation files (the
13 "Software"), to deal in the Software without restriction, including
14 without limitation the rights to use, copy, modify, merge, publish,
15 distribute, sub license, and/or sell copies of the Software, and to
16 permit persons to whom the Software is furnished to do so, subject to
17 the following conditions:
18
19 The above copyright notice and this permission notice (including the
20 next paragraph) shall be included in all copies or substantial portions
21 of the Software.
22
23 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
26 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
27 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
28 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
29 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
31 **************************************************************************/
32
33 #ifndef _TBM_TYPE_H_
34 #define _TBM_TYPE_H_
35
36 /**
37  * @addtogroup CAPI_UI_TBM_SURFACE_MODULE
38  * @{
39  */
40
41 #include <stdint.h>
42
43 /**
44  * @brief Definition for the Tizen buffer surface.
45  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
46  */
47 typedef struct _tbm_surface *tbm_surface_h;
48 /**
49  * @brief Definition for the Tizen buffer surface format.
50  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
51  */
52 typedef uint32_t tbm_format;
53
54 #define __tbm_fourcc_code(a, b, c, d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
55                                 ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
56
57 /* color index */
58 /**
59  * @brief Definition for the TBM surface format C8 ([7:0] C).
60  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
61  */
62 #define TBM_FORMAT_C8       __tbm_fourcc_code('C', '8', ' ', ' ')
63
64 /* 8 bpp RGB */
65 /**
66  * @brief Definition for the TBM surface format RGB322 ([7:0] R:G:B 3:3:2).
67  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
68  */
69 #define TBM_FORMAT_RGB332   __tbm_fourcc_code('R', 'G', 'B', '8')
70 /**
71  * @brief Definition for the TBM surface format RGB233 ([7:0] B:G:R 2:3:3).
72  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
73  */
74 #define TBM_FORMAT_BGR233   __tbm_fourcc_code('B', 'G', 'R', '8')
75
76 /* 16 bpp RGB */
77 /**
78  * @brief Definition for the TBM surface format XRGB4444 ([15:0] x:R:G:B 4:4:4:4 little endian).
79  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
80  */
81 #define TBM_FORMAT_XRGB4444 __tbm_fourcc_code('X', 'R', '1', '2')
82 /**
83  * @brief Definition for the TBM surface format XBRG4444 ([15:0] x:B:G:R 4:4:4:4 little endian).
84  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
85  */
86 #define TBM_FORMAT_XBGR4444 __tbm_fourcc_code('X', 'B', '1', '2')
87 /**
88  * @brief Definition for the TBM surface format RGBX4444 ([15:0] R:G:B:x 4:4:4:4 little endian).
89  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
90  */
91 #define TBM_FORMAT_RGBX4444 __tbm_fourcc_code('R', 'X', '1', '2')
92 /**
93  * @brief Definition for the TBM surface format BGRX4444 ([15:0] B:G:R:x 4:4:4:4 little endian).
94  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
95  */
96 #define TBM_FORMAT_BGRX4444 __tbm_fourcc_code('B', 'X', '1', '2')
97
98 /**
99  * @brief Definition for the TBM surface format ARGB4444 ([15:0] A:R:G:B 4:4:4:4 little endian).
100  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
101  */
102 #define TBM_FORMAT_ARGB4444 __tbm_fourcc_code('A', 'R', '1', '2')
103 /**
104  * @brief Definition for the TBM surface format ABGR4444 ([15:0] A:B:G:R 4:4:4:4 little endian).
105  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
106  */
107 #define TBM_FORMAT_ABGR4444 __tbm_fourcc_code('A', 'B', '1', '2')
108 /**
109  * @brief Definition for the TBM surface format RGBA4444 ([15:0] R:G:B:A 4:4:4:4 little endian).
110  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
111  */
112 #define TBM_FORMAT_RGBA4444 __tbm_fourcc_code('R', 'A', '1', '2')
113 /**
114  * @brief Definition for the TBM surface format BGRA4444 ([15:0] B:G:R:A 4:4:4:4 little endian).
115  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
116  */
117 #define TBM_FORMAT_BGRA4444 __tbm_fourcc_code('B', 'A', '1', '2')
118
119 /**
120  * @brief Definition for the TBM surface format XRGB1555 ([15:0] x:R:G:B 1:5:5:5 little endian).
121  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
122  */
123 #define TBM_FORMAT_XRGB1555 __tbm_fourcc_code('X', 'R', '1', '5')
124 /**
125  * @brief Definition for the TBM surface format XBGR1555 ([15:0] x:B:G:R 1:5:5:5 little endian).
126  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
127  */
128 #define TBM_FORMAT_XBGR1555 __tbm_fourcc_code('X', 'B', '1', '5')
129 /**
130  * @brief Definition for the TBM surface format RGBX5551 ([15:0] R:G:B:x 5:5:5:1 little endian).
131  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
132  */
133 #define TBM_FORMAT_RGBX5551 __tbm_fourcc_code('R', 'X', '1', '5')
134 /**
135  * @brief Definition for the TBM surface format BGRX5551 ([15:0] B:G:R:x 5:5:5:1 little endian).
136  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
137  */
138 #define TBM_FORMAT_BGRX5551 __tbm_fourcc_code('B', 'X', '1', '5')
139
140 /**
141  * @brief Definition for the TBM surface format ARGB1555 ([15:0] A:R:G:B 1:5:5:5 little endian).
142  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
143  */
144 #define TBM_FORMAT_ARGB1555 __tbm_fourcc_code('A', 'R', '1', '5')
145 /**
146  * @brief Definition for the TBM surface format ABGR1555 ([15:0] A:B:G:R 1:5:5:5 little endian).
147  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
148  */
149 #define TBM_FORMAT_ABGR1555 __tbm_fourcc_code('A', 'B', '1', '5')
150 /**
151  * @brief Definition for the TBM surface format RGBA5551 ([15:0] R:G:B:A 5:5:5:1 little endian).
152  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
153  */
154 #define TBM_FORMAT_RGBA5551 __tbm_fourcc_code('R', 'A', '1', '5')
155 /**
156  * @brief Definition for the TBM surface format BGRA5551 ([15:0] B:G:R:A 5:5:5:1 little endian).
157  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
158  */
159 #define TBM_FORMAT_BGRA5551 __tbm_fourcc_code('B', 'A', '1', '5')
160
161 /**
162  * @brief Definition for the TBM surface format RGB565 ([15:0] R:G:B 5:6:5 little endian).
163  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
164  */
165 #define TBM_FORMAT_RGB565   __tbm_fourcc_code('R', 'G', '1', '6')
166 /**
167  * @brief Definition for the TBM surface format BGR565 ([15:0] B:G:R 5:6:5 little endian).
168  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
169  */
170 #define TBM_FORMAT_BGR565   __tbm_fourcc_code('B', 'G', '1', '6')
171
172 /* 24 bpp RGB */
173 /**
174  * @brief Definition for the TBM surface format RGB888 ([23:0] R:G:B little endian).
175  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
176  */
177 #define TBM_FORMAT_RGB888   __tbm_fourcc_code('R', 'G', '2', '4')
178 /**
179  * @brief Definition for the TBM surface format BGR888 ([23:0] B:G:R little endian).
180  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
181  */
182 #define TBM_FORMAT_BGR888   __tbm_fourcc_code('B', 'G', '2', '4')
183
184 /* 32 bpp RGB */
185 /**
186  * @brief Definition for the TBM surface format XRGB8888 ([31:0] x:R:G:B 8:8:8:8 little endian).
187  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
188  */
189 #define TBM_FORMAT_XRGB8888 __tbm_fourcc_code('X', 'R', '2', '4')
190 /**
191  * @brief Definition for the TBM surface format XBGR8888 ([31:0] x:B:G:R 8:8:8:8 little endian).
192  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
193  */
194 #define TBM_FORMAT_XBGR8888 __tbm_fourcc_code('X', 'B', '2', '4')
195 /**
196  * @brief Definition for the TBM surface format RGBX8888 ([31:0] R:G:B:x 8:8:8:8 little endian).
197  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
198  */
199 #define TBM_FORMAT_RGBX8888 __tbm_fourcc_code('R', 'X', '2', '4')
200 /**
201  * @brief Definition for the TBM surface format BGRX8888 ([31:0] B:G:R:x 8:8:8:8 little endian).
202  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
203  */
204 #define TBM_FORMAT_BGRX8888 __tbm_fourcc_code('B', 'X', '2', '4')
205
206 /**
207  * @brief Definition for the TBM surface format ARGB8888 ([31:0] A:R:G:B 8:8:8:8 little endian).
208  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
209  */
210 #define TBM_FORMAT_ARGB8888 __tbm_fourcc_code('A', 'R', '2', '4')
211 /**
212  * @brief Definition for the TBM surface format ABGR8888 ([31:0] [31:0] A:B:G:R 8:8:8:8 little endian).
213  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
214  */
215 #define TBM_FORMAT_ABGR8888 __tbm_fourcc_code('A', 'B', '2', '4')
216 /**
217  * @brief Definition for the TBM surface format RGBA8888 ([31:0] R:G:B:A 8:8:8:8 little endian).
218  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
219  */
220 #define TBM_FORMAT_RGBA8888 __tbm_fourcc_code('R', 'A', '2', '4')
221 /**
222  * @brief Definition for the TBM surface format BGRA8888 ([31:0] B:G:R:A 8:8:8:8 little endian).
223  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
224  */
225 #define TBM_FORMAT_BGRA8888 __tbm_fourcc_code('B', 'A', '2', '4')
226
227 /**
228  * @brief Definition for the TBM surface format XRGB2101010 ([31:0] x:R:G:B 2:10:10:10 little endian).
229  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
230  */
231 #define TBM_FORMAT_XRGB2101010  __tbm_fourcc_code('X', 'R', '3', '0')
232 /**
233  * @brief Definition for the TBM surface format XBGR2101010 ([31:0] x:B:G:R 2:10:10:10 little endian).
234  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
235  */
236 #define TBM_FORMAT_XBGR2101010  __tbm_fourcc_code('X', 'B', '3', '0')
237 /**
238  * @brief Definition for the TBM surface format RGBX1010102 ([31:0] R:G:B:x 10:10:10:2 little endian).
239  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
240  */
241 #define TBM_FORMAT_RGBX1010102  __tbm_fourcc_code('R', 'X', '3', '0')
242 /**
243  * @brief Definition for the TBM surface format BGRX1010102 ([31:0] B:G:R:x 10:10:10:2 little endian).
244  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
245  */
246 #define TBM_FORMAT_BGRX1010102  __tbm_fourcc_code('B', 'X', '3', '0')
247
248 /**
249  * @brief Definition for the TBM surface format ARGB2101010 ([31:0] A:R:G:B 2:10:10:10 little endian).
250  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
251  */
252 #define TBM_FORMAT_ARGB2101010  __tbm_fourcc_code('A', 'R', '3', '0')
253 /**
254  * @brief Definition for the TBM surface format ABGR2101010 ([31:0] A:B:G:R 2:10:10:10 little endian).
255  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
256  */
257 #define TBM_FORMAT_ABGR2101010  __tbm_fourcc_code('A', 'B', '3', '0')
258 /**
259  * @brief Definition for the TBM surface format RGBA1010102 ([31:0] R:G:B:A 10:10:10:2 little endian).
260  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
261  */
262 #define TBM_FORMAT_RGBA1010102  __tbm_fourcc_code('R', 'A', '3', '0')
263 /**
264  * @brief Definition for the TBM surface format BGRA1010102 ([31:0] B:G:R:A 10:10:10:2 little endian).
265  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
266  */
267 #define TBM_FORMAT_BGRA1010102  __tbm_fourcc_code('B', 'A', '3', '0')   /*  */
268
269 /* packed YCbCr */
270 /**
271  * @brief Definition for the TBM surface format YUYV ([31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian).
272  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
273  */
274 #define TBM_FORMAT_YUYV     __tbm_fourcc_code('Y', 'U', 'Y', 'V')
275 /**
276  * @brief Definition for the TBM surface format YVYU ([31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian).
277  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
278  */
279 #define TBM_FORMAT_YVYU     __tbm_fourcc_code('Y', 'V', 'Y', 'U')       /*  */
280 /**
281  * @brief Definition for the TBM surface format UYVY ([31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian).
282  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
283  */
284 #define TBM_FORMAT_UYVY     __tbm_fourcc_code('U', 'Y', 'V', 'Y')
285 /**
286  * @brief Definition for the TBM surface format VYUY ([31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian).
287  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
288  */
289 #define TBM_FORMAT_VYUY     __tbm_fourcc_code('V', 'Y', 'U', 'Y')
290
291 /**
292  * @brief Definition for the TBM surface format AYUV ([31:0] A:Y:Cb:Cr 8:8:8:8 little endian).
293  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
294  */
295 #define TBM_FORMAT_AYUV     __tbm_fourcc_code('A', 'Y', 'U', 'V')
296
297 /*
298  * 2 plane YCbCr
299  * index 0 = Y plane, [7:0] Y
300  * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
301  * or
302  * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
303  */
304 /**
305  * @brief Definition for the TBM surface format NV12 (2x2 subsampled Cr:Cb plane).
306  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
307  */
308 #define TBM_FORMAT_NV12     __tbm_fourcc_code('N', 'V', '1', '2')
309 /**
310  * @brief Definition for the TBM surface format NV21 (2x2 subsampled Cb:Cr plane).
311  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
312  */
313 #define TBM_FORMAT_NV21     __tbm_fourcc_code('N', 'V', '2', '1')       /*  */
314 /**
315  * @brief Definition for the TBM surface format NV16 (2x1 subsampled Cr:Cb plane).
316  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
317  */
318 #define TBM_FORMAT_NV16     __tbm_fourcc_code('N', 'V', '1', '6')
319 /**
320  * @brief Definition for the TBM surface format NV61 (2x1 subsampled Cb:Cr plane).
321  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
322  */
323 #define TBM_FORMAT_NV61     __tbm_fourcc_code('N', 'V', '6', '1')
324
325 /*
326  * 3 plane YCbCr
327  * index 0: Y plane, [7:0] Y
328  * index 1: Cb plane, [7:0] Cb
329  * index 2: Cr plane, [7:0] Cr
330  * or
331  * index 1: Cr plane, [7:0] Cr
332  * index 2: Cb plane, [7:0] Cb
333  */
334 /**
335  * @brief Definition for the TBM surface format YUV410 (4x4 subsampled Cb (1) and Cr (2) planes).
336  */
337 #define TBM_FORMAT_YUV410   __tbm_fourcc_code('Y', 'U', 'V', '9')
338 /**
339  * @brief Definition for the TBM surface format YVU410 (4x4 subsampled Cr (1) and Cb (2) planes).
340  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
341  */
342 #define TBM_FORMAT_YVU410   __tbm_fourcc_code('Y', 'V', 'U', '9')
343 /**
344  * @brief Definition for the TBM surface format YUV411 (4x1 subsampled Cb (1) and Cr (2) planes).
345  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
346  */
347 #define TBM_FORMAT_YUV411   __tbm_fourcc_code('Y', 'U', '1', '1')
348 /**
349  * @brief Definition for the TBM surface format YVU411 (4x1 subsampled Cr (1) and Cb (2) planes).
350  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
351  */
352 #define TBM_FORMAT_YVU411   __tbm_fourcc_code('Y', 'V', '1', '1')
353 /**
354  * @brief Definition for the TBM surface format YUV420 (2x2 subsampled Cb (1) and Cr (2) planes).
355  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
356  */
357 #define TBM_FORMAT_YUV420   __tbm_fourcc_code('Y', 'U', '1', '2')
358 /**
359  * @brief Definition for the TBM surface format YVU420 (2x2 subsampled Cr (1) and Cb (2) planes).
360  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
361  */
362 #define TBM_FORMAT_YVU420   __tbm_fourcc_code('Y', 'V', '1', '2')
363 /**
364  * @brief Definition for the TBM surface format YUV422 (2x1 subsampled Cb (1) and Cr (2) planes).
365  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
366  */
367 #define TBM_FORMAT_YUV422   __tbm_fourcc_code('Y', 'U', '1', '6')
368 /**
369  * @brief Definition for the TBM surface format YVU422 (2x1 subsampled Cr (1) and Cb (2) planes).
370  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
371  */
372 #define TBM_FORMAT_YVU422   __tbm_fourcc_code('Y', 'V', '1', '6')
373 /**
374  * @brief Definition for the TBM surface format YUV444 (non-subsampled Cb (1) and Cr (2) planes).
375  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
376  */
377 #define TBM_FORMAT_YUV444   __tbm_fourcc_code('Y', 'U', '2', '4')
378 /**
379  * @brief Definition for the TBM surface format YVU444 (non-subsampled Cr (1) and Cb (2) planes).
380  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
381  */
382 #define TBM_FORMAT_YVU444   __tbm_fourcc_code('Y', 'V', '2', '4')
383
384 /* 2 plane YCbCr */
385 /**
386  * @brief Definition for the TBM surface format NV12MT (tiled '64x32' & multi-plane version of NV12).
387  * @since_tizen 3.0
388  */
389 #define TBM_FORMAT_NV12MT   __tbm_fourcc_code('T', 'M', '1', '2')
390
391 /**
392 * @}
393 */
394
395 #endif                                                  /* _TBM_TYPE_H_ */