surface: added tbm_surface_internal_set/get_damage func
[platform/core/uifw/libtbm.git] / include / 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 #include <tizen.h>
43
44 /**
45  * @brief Definition for the Tizen buffer surface.
46  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
47  */
48 typedef struct _tbm_surface *tbm_surface_h;
49 /**
50  * @brief Definition for the Tizen buffer surface format.
51  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
52  */
53 typedef uint32_t tbm_format;
54
55 #define __tbm_fourcc_code(a, b, c, d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
56                                 ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
57
58 /* color index */
59 /**
60  * @brief Definition for the TBM surface format C8 ([7:0] C).
61  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
62  */
63 #define TBM_FORMAT_C8       __tbm_fourcc_code('C', '8', ' ', ' ')
64
65 /* 8 bpp RGB */
66 /**
67  * @brief Definition for the TBM surface format RGB322 ([7:0] R:G:B 3:3:2).
68  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
69  */
70 #define TBM_FORMAT_RGB332   __tbm_fourcc_code('R', 'G', 'B', '8')
71 /**
72  * @brief Definition for the TBM surface format RGB233 ([7:0] B:G:R 2:3:3).
73  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
74  */
75 #define TBM_FORMAT_BGR233   __tbm_fourcc_code('B', 'G', 'R', '8')
76
77 /* 16 bpp RGB */
78 /**
79  * @brief Definition for the TBM surface format XRGB4444 ([15:0] x:R:G:B 4:4:4:4 little endian).
80  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
81  */
82 #define TBM_FORMAT_XRGB4444 __tbm_fourcc_code('X', 'R', '1', '2')
83 /**
84  * @brief Definition for the TBM surface format XBRG4444 ([15:0] x:B:G:R 4:4:4:4 little endian).
85  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
86  */
87 #define TBM_FORMAT_XBGR4444 __tbm_fourcc_code('X', 'B', '1', '2')
88 /**
89  * @brief Definition for the TBM surface format RGBX4444 ([15:0] R:G:B:x 4:4:4:4 little endian).
90  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
91  */
92 #define TBM_FORMAT_RGBX4444 __tbm_fourcc_code('R', 'X', '1', '2')
93 /**
94  * @brief Definition for the TBM surface format BGRX4444 ([15:0] B:G:R:x 4:4:4:4 little endian).
95  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
96  */
97 #define TBM_FORMAT_BGRX4444 __tbm_fourcc_code('B', 'X', '1', '2')
98
99 /**
100  * @brief Definition for the TBM surface format ARGB4444 ([15:0] A:R:G:B 4:4:4:4 little endian).
101  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
102  */
103 #define TBM_FORMAT_ARGB4444 __tbm_fourcc_code('A', 'R', '1', '2')
104 /**
105  * @brief Definition for the TBM surface format ABGR4444 ([15:0] A:B:G:R 4:4:4:4 little endian).
106  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
107  */
108 #define TBM_FORMAT_ABGR4444 __tbm_fourcc_code('A', 'B', '1', '2')
109 /**
110  * @brief Definition for the TBM surface format RGBA4444 ([15:0] R:G:B:A 4:4:4:4 little endian).
111  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
112  */
113 #define TBM_FORMAT_RGBA4444 __tbm_fourcc_code('R', 'A', '1', '2')
114 /**
115  * @brief Definition for the TBM surface format BGRA4444 ([15:0] B:G:R:A 4:4:4:4 little endian).
116  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
117  */
118 #define TBM_FORMAT_BGRA4444 __tbm_fourcc_code('B', 'A', '1', '2')
119
120 /**
121  * @brief Definition for the TBM surface format XRGB1555 ([15:0] x:R:G:B 1:5:5:5 little endian).
122  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
123  */
124 #define TBM_FORMAT_XRGB1555 __tbm_fourcc_code('X', 'R', '1', '5')
125 /**
126  * @brief Definition for the TBM surface format XBGR1555 ([15:0] x:B:G:R 1:5:5:5 little endian).
127  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
128  */
129 #define TBM_FORMAT_XBGR1555 __tbm_fourcc_code('X', 'B', '1', '5')
130 /**
131  * @brief Definition for the TBM surface format RGBX5551 ([15:0] R:G:B:x 5:5:5:1 little endian).
132  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
133  */
134 #define TBM_FORMAT_RGBX5551 __tbm_fourcc_code('R', 'X', '1', '5')
135 /**
136  * @brief Definition for the TBM surface format BGRX5551 ([15:0] B:G:R:x 5:5:5:1 little endian).
137  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
138  */
139 #define TBM_FORMAT_BGRX5551 __tbm_fourcc_code('B', 'X', '1', '5')
140
141 /**
142  * @brief Definition for the TBM surface format ARGB1555 ([15:0] A:R:G:B 1:5:5:5 little endian).
143  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
144  */
145 #define TBM_FORMAT_ARGB1555 __tbm_fourcc_code('A', 'R', '1', '5')
146 /**
147  * @brief Definition for the TBM surface format ABGR1555 ([15:0] A:B:G:R 1:5:5:5 little endian).
148  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
149  */
150 #define TBM_FORMAT_ABGR1555 __tbm_fourcc_code('A', 'B', '1', '5')
151 /**
152  * @brief Definition for the TBM surface format RGBA5551 ([15:0] R:G:B:A 5:5:5:1 little endian).
153  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
154  */
155 #define TBM_FORMAT_RGBA5551 __tbm_fourcc_code('R', 'A', '1', '5')
156 /**
157  * @brief Definition for the TBM surface format BGRA5551 ([15:0] B:G:R:A 5:5:5:1 little endian).
158  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
159  */
160 #define TBM_FORMAT_BGRA5551 __tbm_fourcc_code('B', 'A', '1', '5')
161
162 /**
163  * @brief Definition for the TBM surface format RGB565 ([15:0] R:G:B 5:6:5 little endian).
164  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
165  */
166 #define TBM_FORMAT_RGB565   __tbm_fourcc_code('R', 'G', '1', '6')
167 /**
168  * @brief Definition for the TBM surface format BGR565 ([15:0] B:G:R 5:6:5 little endian).
169  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
170  */
171 #define TBM_FORMAT_BGR565   __tbm_fourcc_code('B', 'G', '1', '6')
172
173 /* 24 bpp RGB */
174 /**
175  * @brief Definition for the TBM surface format RGB888 ([23:0] R:G:B little endian).
176  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
177  */
178 #define TBM_FORMAT_RGB888   __tbm_fourcc_code('R', 'G', '2', '4')
179 /**
180  * @brief Definition for the TBM surface format BGR888 ([23:0] B:G:R little endian).
181  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
182  */
183 #define TBM_FORMAT_BGR888   __tbm_fourcc_code('B', 'G', '2', '4')
184
185 /* 32 bpp RGB */
186 /**
187  * @brief Definition for the TBM surface format XRGB8888 ([31:0] x:R:G:B 8:8:8:8 little endian).
188  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
189  */
190 #define TBM_FORMAT_XRGB8888 __tbm_fourcc_code('X', 'R', '2', '4')
191 /**
192  * @brief Definition for the TBM surface format XBGR8888 ([31:0] x:B:G:R 8:8:8:8 little endian).
193  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
194  */
195 #define TBM_FORMAT_XBGR8888 __tbm_fourcc_code('X', 'B', '2', '4')
196 /**
197  * @brief Definition for the TBM surface format RGBX8888 ([31:0] R:G:B:x 8:8:8:8 little endian).
198  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
199  */
200 #define TBM_FORMAT_RGBX8888 __tbm_fourcc_code('R', 'X', '2', '4')
201 /**
202  * @brief Definition for the TBM surface format BGRX8888 ([31:0] B:G:R:x 8:8:8:8 little endian).
203  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
204  */
205 #define TBM_FORMAT_BGRX8888 __tbm_fourcc_code('B', 'X', '2', '4')
206
207 /**
208  * @brief Definition for the TBM surface format ARGB8888 ([31:0] A:R:G:B 8:8:8:8 little endian).
209  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
210  */
211 #define TBM_FORMAT_ARGB8888 __tbm_fourcc_code('A', 'R', '2', '4')
212 /**
213  * @brief Definition for the TBM surface format ABGR8888 ([31:0] [31:0] A:B:G:R 8:8:8:8 little endian).
214  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
215  */
216 #define TBM_FORMAT_ABGR8888 __tbm_fourcc_code('A', 'B', '2', '4')
217 /**
218  * @brief Definition for the TBM surface format RGBA8888 ([31:0] R:G:B:A 8:8:8:8 little endian).
219  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
220  */
221 #define TBM_FORMAT_RGBA8888 __tbm_fourcc_code('R', 'A', '2', '4')
222 /**
223  * @brief Definition for the TBM surface format BGRA8888 ([31:0] B:G:R:A 8:8:8:8 little endian).
224  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
225  */
226 #define TBM_FORMAT_BGRA8888 __tbm_fourcc_code('B', 'A', '2', '4')
227
228 /**
229  * @brief Definition for the TBM surface format XRGB2101010 ([31:0] x:R:G:B 2:10:10:10 little endian).
230  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
231  */
232 #define TBM_FORMAT_XRGB2101010  __tbm_fourcc_code('X', 'R', '3', '0')
233 /**
234  * @brief Definition for the TBM surface format XBGR2101010 ([31:0] x:B:G:R 2:10:10:10 little endian).
235  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
236  */
237 #define TBM_FORMAT_XBGR2101010  __tbm_fourcc_code('X', 'B', '3', '0')
238 /**
239  * @brief Definition for the TBM surface format RGBX1010102 ([31:0] R:G:B:x 10:10:10:2 little endian).
240  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
241  */
242 #define TBM_FORMAT_RGBX1010102  __tbm_fourcc_code('R', 'X', '3', '0')
243 /**
244  * @brief Definition for the TBM surface format BGRX1010102 ([31:0] B:G:R:x 10:10:10:2 little endian).
245  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
246  */
247 #define TBM_FORMAT_BGRX1010102  __tbm_fourcc_code('B', 'X', '3', '0')
248
249 /**
250  * @brief Definition for the TBM surface format ARGB2101010 ([31:0] A:R:G:B 2:10:10:10 little endian).
251  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
252  */
253 #define TBM_FORMAT_ARGB2101010  __tbm_fourcc_code('A', 'R', '3', '0')
254 /**
255  * @brief Definition for the TBM surface format ABGR2101010 ([31:0] A:B:G:R 2:10:10:10 little endian).
256  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
257  */
258 #define TBM_FORMAT_ABGR2101010  __tbm_fourcc_code('A', 'B', '3', '0')
259 /**
260  * @brief Definition for the TBM surface format RGBA1010102 ([31:0] R:G:B:A 10:10:10:2 little endian).
261  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
262  */
263 #define TBM_FORMAT_RGBA1010102  __tbm_fourcc_code('R', 'A', '3', '0')
264 /**
265  * @brief Definition for the TBM surface format BGRA1010102 ([31:0] B:G:R:A 10:10:10:2 little endian).
266  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
267  */
268 #define TBM_FORMAT_BGRA1010102  __tbm_fourcc_code('B', 'A', '3', '0')   /*  */
269
270 /* packed YCbCr */
271 /**
272  * @brief Definition for the TBM surface format YUYV ([31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian).
273  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
274  */
275 #define TBM_FORMAT_YUYV     __tbm_fourcc_code('Y', 'U', 'Y', 'V')
276 /**
277  * @brief Definition for the TBM surface format YVYU ([31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian).
278  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
279  */
280 #define TBM_FORMAT_YVYU     __tbm_fourcc_code('Y', 'V', 'Y', 'U')       /*  */
281 /**
282  * @brief Definition for the TBM surface format UYVY ([31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian).
283  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
284  */
285 #define TBM_FORMAT_UYVY     __tbm_fourcc_code('U', 'Y', 'V', 'Y')
286 /**
287  * @brief Definition for the TBM surface format VYUY ([31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian).
288  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
289  */
290 #define TBM_FORMAT_VYUY     __tbm_fourcc_code('V', 'Y', 'U', 'Y')
291
292 /**
293  * @brief Definition for the TBM surface format AYUV ([31:0] A:Y:Cb:Cr 8:8:8:8 little endian).
294  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
295  */
296 #define TBM_FORMAT_AYUV     __tbm_fourcc_code('A', 'Y', 'U', 'V')
297
298 /*
299  * 2 plane YCbCr
300  * index 0 = Y plane, [7:0] Y
301  * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
302  * or
303  * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
304  */
305 /**
306  * @brief Definition for the TBM surface format NV12 (2x2 subsampled Cr:Cb plane).
307  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
308  */
309 #define TBM_FORMAT_NV12     __tbm_fourcc_code('N', 'V', '1', '2')
310 /**
311  * @brief Definition for the TBM surface format NV21 (2x2 subsampled Cb:Cr plane).
312  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
313  */
314 #define TBM_FORMAT_NV21     __tbm_fourcc_code('N', 'V', '2', '1')       /*  */
315 /**
316  * @brief Definition for the TBM surface format NV16 (2x1 subsampled Cr:Cb plane).
317  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
318  */
319 #define TBM_FORMAT_NV16     __tbm_fourcc_code('N', 'V', '1', '6')
320 /**
321  * @brief Definition for the TBM surface format NV61 (2x1 subsampled Cb:Cr plane).
322  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
323  */
324 #define TBM_FORMAT_NV61     __tbm_fourcc_code('N', 'V', '6', '1')
325
326 /*
327  * 3 plane YCbCr
328  * index 0: Y plane, [7:0] Y
329  * index 1: Cb plane, [7:0] Cb
330  * index 2: Cr plane, [7:0] Cr
331  * or
332  * index 1: Cr plane, [7:0] Cr
333  * index 2: Cb plane, [7:0] Cb
334  */
335 /**
336  * @brief Definition for the TBM surface format YUV410 (4x4 subsampled Cb (1) and Cr (2) planes).
337  */
338 #define TBM_FORMAT_YUV410   __tbm_fourcc_code('Y', 'U', 'V', '9')
339 /**
340  * @brief Definition for the TBM surface format YVU410 (4x4 subsampled Cr (1) and Cb (2) planes).
341  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
342  */
343 #define TBM_FORMAT_YVU410   __tbm_fourcc_code('Y', 'V', 'U', '9')
344 /**
345  * @brief Definition for the TBM surface format YUV411 (4x1 subsampled Cb (1) and Cr (2) planes).
346  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
347  */
348 #define TBM_FORMAT_YUV411   __tbm_fourcc_code('Y', 'U', '1', '1')
349 /**
350  * @brief Definition for the TBM surface format YVU411 (4x1 subsampled Cr (1) and Cb (2) planes).
351  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
352  */
353 #define TBM_FORMAT_YVU411   __tbm_fourcc_code('Y', 'V', '1', '1')
354 /**
355  * @brief Definition for the TBM surface format YUV420 (2x2 subsampled Cb (1) and Cr (2) planes).
356  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
357  */
358 #define TBM_FORMAT_YUV420   __tbm_fourcc_code('Y', 'U', '1', '2')
359 /**
360  * @brief Definition for the TBM surface format YVU420 (2x2 subsampled Cr (1) and Cb (2) planes).
361  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
362  */
363 #define TBM_FORMAT_YVU420   __tbm_fourcc_code('Y', 'V', '1', '2')
364 /**
365  * @brief Definition for the TBM surface format YUV422 (2x1 subsampled Cb (1) and Cr (2) planes).
366  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
367  */
368 #define TBM_FORMAT_YUV422   __tbm_fourcc_code('Y', 'U', '1', '6')
369 /**
370  * @brief Definition for the TBM surface format YVU422 (2x1 subsampled Cr (1) and Cb (2) planes).
371  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
372  */
373 #define TBM_FORMAT_YVU422   __tbm_fourcc_code('Y', 'V', '1', '6')
374 /**
375  * @brief Definition for the TBM surface format YUV444 (non-subsampled Cb (1) and Cr (2) planes).
376  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
377  */
378 #define TBM_FORMAT_YUV444   __tbm_fourcc_code('Y', 'U', '2', '4')
379 /**
380  * @brief Definition for the TBM surface format YVU444 (non-subsampled Cr (1) and Cb (2) planes).
381  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
382  */
383 #define TBM_FORMAT_YVU444   __tbm_fourcc_code('Y', 'V', '2', '4')
384
385 /* 2 plane YCbCr */
386 /**
387  * @brief Definition for the TBM surface format NV12MT (tiled '64x32' & multi-plane version of NV12).
388  * @since_tizen 3.0
389  */
390 #define TBM_FORMAT_NV12MT   __tbm_fourcc_code('T', 'M', '1', '2')
391
392 /**
393 * @}
394 */
395
396 #endif                                                  /* _TBM_TYPE_H_ */