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