tbm_bufmgr_debug_show: increasing size of title and data to avoid memory overflow
[platform/core/uifw/libtbm.git] / src / tbm_surface.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_SURFACE_H_
34 #define _TBM_SURFACE_H_
35
36 /**
37  * @addtogroup CAPI_UI_TBM_SURFACE_MODULE
38  * @{
39  */
40
41 #include <tbm_type.h>
42 #include <tizen.h>
43
44 /**
45  * \file tbm_surface.h
46  * \brief TBM Surface
47  */
48
49 /**
50  * @brief Enumeration for tbm_surface error type.
51  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
52  */
53 typedef enum {
54         TBM_SURFACE_ERROR_NONE = TIZEN_ERROR_NONE,                                                        /**< Successful */
55         TBM_SURFACE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,  /**< Invalid parameter */
56         TBM_SURFACE_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION,  /**< Invalid Operation */
57 } tbm_surface_error_e;
58
59 /**
60  * @brief Definition for the max number of TBM surface plane.
61  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
62  */
63 #define TBM_SURF_PLANE_MAX 4
64
65 /* option to map the tbm_surface */
66 /**
67  * @brief Definition for the access option to read.
68  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
69  */
70 #define TBM_SURF_OPTION_READ      (1 << 0)
71 /**
72  * @brief Definition for the access option to write.
73  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
74  */
75 #define TBM_SURF_OPTION_WRITE     (1 << 1)
76
77 /**
78  * @brief Definition for the TBM plane struct.
79  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
80  */
81 typedef struct _tbm_surface_plane {
82         unsigned char *ptr;       /**< Plane pointer */
83         uint32_t size;            /**< Plane size */
84         uint32_t offset;          /**< Plane offset */
85         uint32_t stride;          /**< Plane stride */
86
87         void *reserved1;          /**< Reserved pointer1 */
88         void *reserved2;          /**< Reserved pointer2 */
89         void *reserved3;          /**< Reserved pointer3 */
90 } tbm_surface_plane_s;
91
92 /**
93  * @brief Definition for the TBM surface information struct.
94  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
95  */
96 typedef struct _tbm_surface_info {
97         uint32_t width;          /**< TBM surface width */
98         uint32_t height;         /**< TBM surface height */
99         tbm_format format;       /**< TBM surface format*/
100         uint32_t bpp;            /**< TBM surface bbp */
101         uint32_t size;           /**< TBM surface size */
102
103         uint32_t num_planes;                                                    /**< The number of planes */
104         tbm_surface_plane_s planes[TBM_SURF_PLANE_MAX]; /**< Array of planes */
105
106         void *reserved4;   /**< Reserved pointer4 */
107         void *reserved5;   /**< Reserved pointer5 */
108         void *reserved6;   /**< Reserved pointer6 */
109 } tbm_surface_info_s;
110
111 #define __tbm_fourcc_code(a, b, c, d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
112                                 ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
113
114 /* color index */
115 /**
116  * @brief Definition for the TBM surface format C8 ([7:0] C).
117  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
118  */
119 #define TBM_FORMAT_C8       __tbm_fourcc_code('C', '8', ' ', ' ')
120
121 /* 8 bpp RGB */
122 /**
123  * @brief Definition for the TBM surface format RGB322 ([7:0] R:G:B 3:3:2).
124  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
125  */
126 #define TBM_FORMAT_RGB332   __tbm_fourcc_code('R', 'G', 'B', '8')
127 /**
128  * @brief Definition for the TBM surface format RGB233 ([7:0] B:G:R 2:3:3).
129  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
130  */
131 #define TBM_FORMAT_BGR233   __tbm_fourcc_code('B', 'G', 'R', '8')
132
133 /* 16 bpp RGB */
134 /**
135  * @brief Definition for the TBM surface format XRGB4444 ([15:0] x:R:G:B 4:4:4:4 little endian).
136  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
137  */
138 #define TBM_FORMAT_XRGB4444 __tbm_fourcc_code('X', 'R', '1', '2')
139 /**
140  * @brief Definition for the TBM surface format XBRG4444 ([15:0] x:B:G:R 4:4:4:4 little endian).
141  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
142  */
143 #define TBM_FORMAT_XBGR4444 __tbm_fourcc_code('X', 'B', '1', '2')
144 /**
145  * @brief Definition for the TBM surface format RGBX4444 ([15:0] R:G:B:x 4:4:4:4 little endian).
146  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
147  */
148 #define TBM_FORMAT_RGBX4444 __tbm_fourcc_code('R', 'X', '1', '2')
149 /**
150  * @brief Definition for the TBM surface format BGRX4444 ([15:0] B:G:R:x 4:4:4:4 little endian).
151  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
152  */
153 #define TBM_FORMAT_BGRX4444 __tbm_fourcc_code('B', 'X', '1', '2')
154
155 /**
156  * @brief Definition for the TBM surface format ARGB4444 ([15:0] A:R:G:B 4:4:4:4 little endian).
157  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
158  */
159 #define TBM_FORMAT_ARGB4444 __tbm_fourcc_code('A', 'R', '1', '2')
160 /**
161  * @brief Definition for the TBM surface format ABGR4444 ([15:0] A:B:G:R 4:4:4:4 little endian).
162  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
163  */
164 #define TBM_FORMAT_ABGR4444 __tbm_fourcc_code('A', 'B', '1', '2')
165 /**
166  * @brief Definition for the TBM surface format RGBA4444 ([15:0] R:G:B:A 4:4:4:4 little endian).
167  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
168  */
169 #define TBM_FORMAT_RGBA4444 __tbm_fourcc_code('R', 'A', '1', '2')
170 /**
171  * @brief Definition for the TBM surface format BGRA4444 ([15:0] B:G:R:A 4:4:4:4 little endian).
172  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
173  */
174 #define TBM_FORMAT_BGRA4444 __tbm_fourcc_code('B', 'A', '1', '2')
175
176 /**
177  * @brief Definition for the TBM surface format XRGB1555 ([15:0] x:R:G:B 1:5:5:5 little endian).
178  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
179  */
180 #define TBM_FORMAT_XRGB1555 __tbm_fourcc_code('X', 'R', '1', '5')
181 /**
182  * @brief Definition for the TBM surface format XBGR1555 ([15:0] x:B:G:R 1:5:5:5 little endian).
183  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
184  */
185 #define TBM_FORMAT_XBGR1555 __tbm_fourcc_code('X', 'B', '1', '5')
186 /**
187  * @brief Definition for the TBM surface format RGBX5551 ([15:0] R:G:B:x 5:5:5:1 little endian).
188  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
189  */
190 #define TBM_FORMAT_RGBX5551 __tbm_fourcc_code('R', 'X', '1', '5')
191 /**
192  * @brief Definition for the TBM surface format BGRX5551 ([15:0] B:G:R:x 5:5:5:1 little endian).
193  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
194  */
195 #define TBM_FORMAT_BGRX5551 __tbm_fourcc_code('B', 'X', '1', '5')
196
197 /**
198  * @brief Definition for the TBM surface format ARGB1555 ([15:0] A:R:G:B 1:5:5:5 little endian).
199  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
200  */
201 #define TBM_FORMAT_ARGB1555 __tbm_fourcc_code('A', 'R', '1', '5')
202 /**
203  * @brief Definition for the TBM surface format ABGR1555 ([15:0] A:B:G:R 1:5:5:5 little endian).
204  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
205  */
206 #define TBM_FORMAT_ABGR1555 __tbm_fourcc_code('A', 'B', '1', '5')
207 /**
208  * @brief Definition for the TBM surface format RGBA5551 ([15:0] R:G:B:A 5:5:5:1 little endian).
209  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
210  */
211 #define TBM_FORMAT_RGBA5551 __tbm_fourcc_code('R', 'A', '1', '5')
212 /**
213  * @brief Definition for the TBM surface format BGRA5551 ([15:0] B:G:R:A 5:5:5:1 little endian).
214  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
215  */
216 #define TBM_FORMAT_BGRA5551 __tbm_fourcc_code('B', 'A', '1', '5')
217
218 /**
219  * @brief Definition for the TBM surface format RGB565 ([15:0] R:G:B 5:6:5 little endian).
220  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
221  */
222 #define TBM_FORMAT_RGB565   __tbm_fourcc_code('R', 'G', '1', '6')
223 /**
224  * @brief Definition for the TBM surface format BGR565 ([15:0] B:G:R 5:6:5 little endian).
225  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
226  */
227 #define TBM_FORMAT_BGR565   __tbm_fourcc_code('B', 'G', '1', '6')
228
229 /* 24 bpp RGB */
230 /**
231  * @brief Definition for the TBM surface format RGB888 ([23:0] R:G:B little endian).
232  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
233  */
234 #define TBM_FORMAT_RGB888   __tbm_fourcc_code('R', 'G', '2', '4')
235 /**
236  * @brief Definition for the TBM surface format BGR888 ([23:0] B:G:R little endian).
237  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
238  */
239 #define TBM_FORMAT_BGR888   __tbm_fourcc_code('B', 'G', '2', '4')
240
241 /* 32 bpp RGB */
242 /**
243  * @brief Definition for the TBM surface format XRGB8888 ([31:0] x:R:G:B 8:8:8:8 little endian).
244  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
245  */
246 #define TBM_FORMAT_XRGB8888 __tbm_fourcc_code('X', 'R', '2', '4')
247 /**
248  * @brief Definition for the TBM surface format XBGR8888 ([31:0] x:B:G:R 8:8:8:8 little endian).
249  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
250  */
251 #define TBM_FORMAT_XBGR8888 __tbm_fourcc_code('X', 'B', '2', '4')
252 /**
253  * @brief Definition for the TBM surface format RGBX8888 ([31:0] R:G:B:x 8:8:8:8 little endian).
254  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
255  */
256 #define TBM_FORMAT_RGBX8888 __tbm_fourcc_code('R', 'X', '2', '4')
257 /**
258  * @brief Definition for the TBM surface format BGRX8888 ([31:0] B:G:R:x 8:8:8:8 little endian).
259  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
260  */
261 #define TBM_FORMAT_BGRX8888 __tbm_fourcc_code('B', 'X', '2', '4')
262
263 /**
264  * @brief Definition for the TBM surface format ARGB8888 ([31:0] A:R:G:B 8:8:8:8 little endian).
265  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
266  */
267 #define TBM_FORMAT_ARGB8888 __tbm_fourcc_code('A', 'R', '2', '4')
268 /**
269  * @brief Definition for the TBM surface format ABGR8888 ([31:0] [31:0] A:B:G:R 8:8:8:8 little endian).
270  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
271  */
272 #define TBM_FORMAT_ABGR8888 __tbm_fourcc_code('A', 'B', '2', '4')
273 /**
274  * @brief Definition for the TBM surface format RGBA8888 ([31:0] R:G:B:A 8:8:8:8 little endian).
275  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
276  */
277 #define TBM_FORMAT_RGBA8888 __tbm_fourcc_code('R', 'A', '2', '4')
278 /**
279  * @brief Definition for the TBM surface format BGRA8888 ([31:0] B:G:R:A 8:8:8:8 little endian).
280  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
281  */
282 #define TBM_FORMAT_BGRA8888 __tbm_fourcc_code('B', 'A', '2', '4')
283
284 /**
285  * @brief Definition for the TBM surface format XRGB2101010 ([31:0] x:R:G:B 2:10:10:10 little endian).
286  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
287  */
288 #define TBM_FORMAT_XRGB2101010  __tbm_fourcc_code('X', 'R', '3', '0')
289 /**
290  * @brief Definition for the TBM surface format XBGR2101010 ([31:0] x:B:G:R 2:10:10:10 little endian).
291  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
292  */
293 #define TBM_FORMAT_XBGR2101010  __tbm_fourcc_code('X', 'B', '3', '0')
294 /**
295  * @brief Definition for the TBM surface format RGBX1010102 ([31:0] R:G:B:x 10:10:10:2 little endian).
296  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
297  */
298 #define TBM_FORMAT_RGBX1010102  __tbm_fourcc_code('R', 'X', '3', '0')
299 /**
300  * @brief Definition for the TBM surface format BGRX1010102 ([31:0] B:G:R:x 10:10:10:2 little endian).
301  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
302  */
303 #define TBM_FORMAT_BGRX1010102  __tbm_fourcc_code('B', 'X', '3', '0')
304
305 /**
306  * @brief Definition for the TBM surface format ARGB2101010 ([31:0] A:R:G:B 2:10:10:10 little endian).
307  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
308  */
309 #define TBM_FORMAT_ARGB2101010  __tbm_fourcc_code('A', 'R', '3', '0')
310 /**
311  * @brief Definition for the TBM surface format ABGR2101010 ([31:0] A:B:G:R 2:10:10:10 little endian).
312  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
313  */
314 #define TBM_FORMAT_ABGR2101010  __tbm_fourcc_code('A', 'B', '3', '0')
315 /**
316  * @brief Definition for the TBM surface format RGBA1010102 ([31:0] R:G:B:A 10:10:10:2 little endian).
317  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
318  */
319 #define TBM_FORMAT_RGBA1010102  __tbm_fourcc_code('R', 'A', '3', '0')
320 /**
321  * @brief Definition for the TBM surface format BGRA1010102 ([31:0] B:G:R:A 10:10:10:2 little endian).
322  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
323  */
324 #define TBM_FORMAT_BGRA1010102  __tbm_fourcc_code('B', 'A', '3', '0')   /*  */
325
326 /* packed YCbCr */
327 /**
328  * @brief Definition for the TBM surface format YUYV ([31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian).
329  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
330  */
331 #define TBM_FORMAT_YUYV     __tbm_fourcc_code('Y', 'U', 'Y', 'V')
332 /**
333  * @brief Definition for the TBM surface format YVYU ([31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian).
334  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
335  */
336 #define TBM_FORMAT_YVYU     __tbm_fourcc_code('Y', 'V', 'Y', 'U')       /*  */
337 /**
338  * @brief Definition for the TBM surface format UYVY ([31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian).
339  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
340  */
341 #define TBM_FORMAT_UYVY     __tbm_fourcc_code('U', 'Y', 'V', 'Y')
342 /**
343  * @brief Definition for the TBM surface format VYUY ([31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian).
344  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
345  */
346 #define TBM_FORMAT_VYUY     __tbm_fourcc_code('V', 'Y', 'U', 'Y')
347
348 /**
349  * @brief Definition for the TBM surface format AYUV ([31:0] A:Y:Cb:Cr 8:8:8:8 little endian).
350  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
351  */
352 #define TBM_FORMAT_AYUV     __tbm_fourcc_code('A', 'Y', 'U', 'V')
353
354 /*
355  * 2 plane YCbCr
356  * index 0 = Y plane, [7:0] Y
357  * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
358  * or
359  * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
360  */
361 /**
362  * @brief Definition for the TBM surface format NV12 (2x2 subsampled Cr:Cb plane).
363  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
364  */
365 #define TBM_FORMAT_NV12     __tbm_fourcc_code('N', 'V', '1', '2')
366 /**
367  * @brief Definition for the TBM surface format NV21 (2x2 subsampled Cb:Cr plane).
368  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
369  */
370 #define TBM_FORMAT_NV21     __tbm_fourcc_code('N', 'V', '2', '1')       /*  */
371 /**
372  * @brief Definition for the TBM surface format NV16 (2x1 subsampled Cr:Cb plane).
373  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
374  */
375 #define TBM_FORMAT_NV16     __tbm_fourcc_code('N', 'V', '1', '6')
376 /**
377  * @brief Definition for the TBM surface format NV61 (2x1 subsampled Cb:Cr plane).
378  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
379  */
380 #define TBM_FORMAT_NV61     __tbm_fourcc_code('N', 'V', '6', '1')
381
382 /*
383  * 3 plane YCbCr
384  * index 0: Y plane, [7:0] Y
385  * index 1: Cb plane, [7:0] Cb
386  * index 2: Cr plane, [7:0] Cr
387  * or
388  * index 1: Cr plane, [7:0] Cr
389  * index 2: Cb plane, [7:0] Cb
390  */
391 /**
392  * @brief Definition for the TBM surface format YUV410 (4x4 subsampled Cb (1) and Cr (2) planes).
393  */
394 #define TBM_FORMAT_YUV410   __tbm_fourcc_code('Y', 'U', 'V', '9')
395 /**
396  * @brief Definition for the TBM surface format YVU410 (4x4 subsampled Cr (1) and Cb (2) planes).
397  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
398  */
399 #define TBM_FORMAT_YVU410   __tbm_fourcc_code('Y', 'V', 'U', '9')
400 /**
401  * @brief Definition for the TBM surface format YUV411 (4x1 subsampled Cb (1) and Cr (2) planes).
402  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
403  */
404 #define TBM_FORMAT_YUV411   __tbm_fourcc_code('Y', 'U', '1', '1')
405 /**
406  * @brief Definition for the TBM surface format YVU411 (4x1 subsampled Cr (1) and Cb (2) planes).
407  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
408  */
409 #define TBM_FORMAT_YVU411   __tbm_fourcc_code('Y', 'V', '1', '1')
410 /**
411  * @brief Definition for the TBM surface format YUV420 (2x2 subsampled Cb (1) and Cr (2) planes).
412  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
413  */
414 #define TBM_FORMAT_YUV420   __tbm_fourcc_code('Y', 'U', '1', '2')
415 /**
416  * @brief Definition for the TBM surface format YVU420 (2x2 subsampled Cr (1) and Cb (2) planes).
417  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
418  */
419 #define TBM_FORMAT_YVU420   __tbm_fourcc_code('Y', 'V', '1', '2')
420 /**
421  * @brief Definition for the TBM surface format YUV422 (2x1 subsampled Cb (1) and Cr (2) planes).
422  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
423  */
424 #define TBM_FORMAT_YUV422   __tbm_fourcc_code('Y', 'U', '1', '6')
425 /**
426  * @brief Definition for the TBM surface format YVU422 (2x1 subsampled Cr (1) and Cb (2) planes).
427  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
428  */
429 #define TBM_FORMAT_YVU422   __tbm_fourcc_code('Y', 'V', '1', '6')
430 /**
431  * @brief Definition for the TBM surface format YUV444 (non-subsampled Cb (1) and Cr (2) planes).
432  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
433  */
434 #define TBM_FORMAT_YUV444   __tbm_fourcc_code('Y', 'U', '2', '4')
435 /**
436  * @brief Definition for the TBM surface format YVU444 (non-subsampled Cr (1) and Cb (2) planes).
437  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
438  */
439 #define TBM_FORMAT_YVU444   __tbm_fourcc_code('Y', 'V', '2', '4')
440
441 /* 2 plane YCbCr */
442 /**
443  * @brief Definition for the TBM surface format NV12MT (tiled '64x32' & multi-plane version of NV12).
444  * @since_tizen 3.0
445  */
446 #define TBM_FORMAT_NV12MT   __tbm_fourcc_code('T', 'M', '1', '2')
447
448 #ifdef __cplusplus
449 extern "C" {
450 #endif
451
452 /**
453  * @brief Queries surface format list and number of format supported by the system.
454  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
455  *
456  * @remarks You must release the formats using free().
457  *
458  * @param[out] formats  The format array which the system can support \n
459  *                      This pointer has to be freed by user.
460  * @param[out] num      The number of formats
461  *
462  * @return  #TBM_SURFACE_ERROR_NONE if this function succeeds,
463  *          otherwise an error status value
464  *
465  * @retval #TBM_SURFACE_ERROR_NONE               Success
466  * @retval #TBM_SURFACE_ERROR_INVALID_OPERATION  Invalid operation
467  *
468  * @par Example
469    @code
470    #include <tbm_surface.h>
471
472    uint32_t *formats;
473    uint32_t format_num;
474    int ret, i;
475    tbm_surface_error_e tse;
476
477    tse = tbm_surface_query_formats (&formats, &format_num))
478
479    for( i = 0 ; i < format_num ; i++)
480    {
481        if (formats[i] == TBM_FORMAT_RGB332)
482        {
483    ....
484
485    free (formats);
486    @endcode
487  */
488 int tbm_surface_query_formats(uint32_t **formats, uint32_t *num);
489
490 /**
491  * @brief Creates the tbm_surface.
492  * @details This function creates the tbm_surface with the given width, height, and format.
493  *
494  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
495  *
496  * @remark The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
497  *
498  * @param[in] width   The width of surface
499  * @param[in] height  The height of surface
500  * @param[in] format  The format of surface
501  *
502  * @return   #tbm_surface_h on success,
503  *           otherwise @c NULL
504  *
505  * @retval #tbm_surface_h  The TBM surface handle
506  *
507  * @exception #TBM_SURFACE_ERROR_NONE               Success
508  * @exception #TBM_SURFACE_ERROR_INVALID_PARAMETER  Invalid parameter
509  * @exception #TBM_SURFACE_ERROR_INVALID_OPERATION  Invalid operation
510  *
511  * @see tbm_surface_destroy()
512  *
513  * @par Example
514    @code
515    #include <tbm_surface.h>
516
517    tbm_surface_h surface;
518
519    surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
520
521    ...
522
523    tbm_surface_destroy (surface);
524    @endcode
525  */
526 tbm_surface_h tbm_surface_create(int width, int height, tbm_format format);
527
528 /**
529  * @brief Destroys the tbm_surface.
530  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
531  *
532  * @param[in] surface  The #tbm_surface_h
533  *
534  * @return  #TBM_SURFACE_ERROR_NONE on success,
535  *          otherwise an error status value
536  *
537  * @retval #TBM_SURFACE_ERROR_NONE               Success
538  * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER  Invalid parameter
539  *
540  * @see tbm_surface_create()
541  *
542  * @par Example
543    @code
544    #include <tbm_surface.h>
545
546    tbm_surface_h surface;
547
548    surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
549
550    ...
551
552    tbm_surface_destroy (surface);
553    @endcode
554  */
555 int tbm_surface_destroy(tbm_surface_h surface);
556
557 /**
558  * @brief Maps the tbm_surface according to the access option.
559  * @details After mapping tbm_surface, the information of tbm_surface is assigned in #tbm_surface_info_s struct. \n
560  *          The information of tbm_surface has width, height, format, bpp, size, number of planes and information of planes. \n
561  *          The information of planes has stride, offset, size and pointer of plane. \n
562  *          #TBM_SURF_OPTION_READ indicates access option to read. \n
563  *          #TBM_SURF_OPTION_WRITE indicates access option to write.
564  *
565  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
566  *
567  * @param[in]  surface  The #tbm_surface_h
568  * @param[in]  opt      The option to access the tbm_surface
569  * @param[out] info     The information of the tbm_surface
570  *
571  * @return  #TBM_SURFACE_ERROR_NONE on success,
572  *          otherwise an error status value
573  *
574  * @retval #TBM_SURFACE_ERROR_NONE               Success
575  * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER  Invalid parameter
576  * @retval #TBM_SURFACE_ERROR_INVALID_OPERATION  Invalid operation
577  *
578  * @see tbm_surface_unmap();
579  *
580  * @par Example
581    @code
582    #include <tbm_surface.h>
583
584    tbm_surface_h surface;
585    tbm_surface_info_s info;
586    int ret;
587
588    surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
589    ret = tbm_surface_map (surface, TBM_SURF_OPTION_WRITE|TBM_SURF_OPTION_READ, &info);
590
591    ...
592
593    tbm_surface_unmap (surface);
594    tbm_surface_destroy (surface);
595    @endcode
596  */
597 int tbm_surface_map(tbm_surface_h surface, int opt, tbm_surface_info_s *info);
598
599 /**
600  * @brief Unmaps the tbm_surface.
601  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
602  *
603  * @param[in] surface  The #tbm_surface_h
604  *
605  * @return  #TBM_SURFACE_ERROR_NONE on success,
606  *          otherwise an error status value
607  *
608  * @retval #TBM_SURFACE_ERROR_NONE               Success
609  * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER  Invalid parameter
610  *
611  * @see tbm_surface_map()
612  *
613  * @par Example
614    @code
615    #include <tbm_surface.h>
616
617    tbm_surface_h surface;
618    tbm_surface_info_s info;
619    int ret;
620
621    surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
622    ret = tbm_surface_map (surface, TBM_SURF_OPTION_WRITE|TBM_SURF_OPTION_READ, &info);
623
624    ...
625
626    tbm_surface_unmap (surface);
627    tbm_surface_destroy (surface);
628    @endcode
629  */
630 int tbm_surface_unmap(tbm_surface_h surface);
631
632 /**
633  * @brief Gets the information of the tbm_surface.
634  * @details The information of tbm_surface is assigned in #tbm_surface_info_s struct. \n
635  *          The information of tbm_surface has width, height, format, bpp, size, number of planes and information of planes. \n
636  *          The information of planes has stride, offset, size and pointer of plane.
637  *
638  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
639  *
640  * @param[in]   surface  The #tbm_surface_h
641  * @param[out]  info     The information of the tbm_surface
642  *
643  * @return  #TBM_SURFACE_ERROR_NONE on success,
644  *          otherwise an error status value
645  *
646  * @retval #TBM_SURFACE_ERROR_NONE               Success
647  * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER  Invalid parameter
648  * @retval #TBM_SURFACE_ERROR_INVALID_OPERATION  Invalid operation
649  *
650  * @see tbm_surface_map()
651  *
652  * @par Example
653    @code
654    #include <tbm_surface.h>
655
656    tbm_surface_h surface;
657    tbm_surface_info_s info;
658    int ret;
659
660    surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
661    ret = tbm_surface_get_info (surface, &info);
662
663    ...
664
665    tbm_surface_destroy (surface);
666    @endcode
667  */
668 int tbm_surface_get_info(tbm_surface_h surface, tbm_surface_info_s *info);
669
670 /**
671  * @brief Gets the width of the tbm_surface.
672  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
673  *
674  * @param[in] surface  The #tbm_surface_h
675  *
676  * @return  The width of the tbm_surface on success,
677  *          otherwise an error status value
678  *
679  * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER  Invalid parameter
680  *
681  * @par Example
682    @code
683    #include <tbm_surface.h>
684
685    tbm_surface_h surface;
686    int width;
687
688    surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
689
690    ...
691
692    width = tbm_surface_get_width (surface);
693
694    ...
695
696    tbm_surface_destroy (surface);
697    @endcode
698  */
699 int tbm_surface_get_width(tbm_surface_h surface);
700
701 /**
702  * @brief Gets the height of the tbm_surface.
703  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
704  *
705  * @param[in] surface  The #tbm_surface_h
706  *
707  * @return  The height of the tbm_surface if this function succeeds,
708  *          otherwise an error status value
709  *
710  * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER  Invalid parameter
711  *
712  * @par Example
713    @code
714    #include <tbm_surface.h>
715
716    tbm_surface_h surface;
717    int height;
718
719    surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
720
721    ...
722
723    height = tbm_surface_get_height (surface);
724
725    ...
726
727    tbm_surface_destroy (surface);
728    @endcode
729  */
730 int tbm_surface_get_height(tbm_surface_h surface);
731
732 /**
733  * @brief Gets the format of the tbm_surface.
734  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
735  *
736  * @remark The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
737  *
738  * @param[in] surface  The #tbm_surface_h
739  *
740  * @return  The format of the tbm_surface on success,
741  *          otherwise @c 0 on failure
742  *
743  * @retval #tbm_format  The format of surface
744  *
745  * @exception #TBM_SURFACE_ERROR_NONE               Success
746  * @exception #TBM_SURFACE_ERROR_INVALID_PARAMETER  Invalid parameter
747  *
748  * @par Example
749    @code
750    #include <tbm_surface.h>
751
752    tbm_surface_s surface;
753    tbm_format format;
754
755    surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
756
757    ...
758
759    format = tbm_surface_get_format (surface);
760
761    ...
762
763    tbm_surface_destroy (surface);
764    @endcode
765  */
766 tbm_format tbm_surface_get_format(tbm_surface_h surface);
767
768 #ifdef __cplusplus
769 }
770 #endif
771 /**
772 * @}
773 */
774 #endif                                                  /* _TBM_SURFACE_H_ */