Apply tizen coding rule
[platform/core/uifw/libtbm.git] / src / tbm_surface_queue.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 Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
9
10 Permission is hereby granted, free of charge, to any person obtaining a
11 copy of this software and associated documentation files (the
12 "Software"), to deal in the Software without restriction, including
13 without limitation the rights to use, copy, modify, merge, publish,
14 distribute, sub license, and/or sell copies of the Software, and to
15 permit persons to whom the Software is furnished to do so, subject to
16 the following conditions:
17
18 The above copyright notice and this permission notice (including the
19 next paragraph) shall be included in all copies or substantial portions
20 of the Software.
21
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
25 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 **************************************************************************/
31
32 #ifndef _TBM_SURFACE_QUEUE_H_
33 #define _TBM_SURFACE_QUEUE_H_
34
35 #include <tbm_surface.h>
36
37 typedef enum {
38         TBM_SURFACE_QUEUE_ERROR_NONE = 0,                                         /**< Successful */
39         TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE = -1,
40         TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE = -2,
41         TBM_SURFACE_QUEUE_ERROR_EMPTY = -3,
42         TBM_SURFACE_QUEUE_ERROR_INVALID_PARAMETER = -4,
43         TBM_SURFACE_QUEUE_ERROR_SURFACE_ALLOC_FAILED = -5,
44 } tbm_surface_queue_error_e;
45
46 typedef struct _tbm_surface_queue *tbm_surface_queue_h;
47
48 typedef void (*tbm_surface_queue_notify_cb)(tbm_surface_queue_h surface_queue,
49                 void *data);
50
51 typedef tbm_surface_h (*tbm_surface_alloc_cb)(tbm_surface_queue_h surface_queue,
52                 void *data);
53
54 typedef void (*tbm_surface_free_cb)(tbm_surface_queue_h surface_queue,
55                 void *data, tbm_surface_h surface);
56
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60
61 tbm_surface_queue_error_e tbm_surface_queue_enqueue(
62                 tbm_surface_queue_h surface_queue, tbm_surface_h surface);
63
64 tbm_surface_queue_error_e tbm_surface_queue_dequeue(
65                 tbm_surface_queue_h surface_queue, tbm_surface_h *surface);
66
67 tbm_surface_queue_error_e tbm_surface_queue_release(
68                 tbm_surface_queue_h surface_queue, tbm_surface_h surface);
69
70 tbm_surface_queue_error_e tbm_surface_queue_acquire(
71                 tbm_surface_queue_h surface_queue, tbm_surface_h *surface);
72
73 int tbm_surface_queue_can_dequeue(tbm_surface_queue_h surface_queue, int wait);
74
75 int tbm_surface_queue_can_acquire(tbm_surface_queue_h surface_queue, int wait);
76
77 void tbm_surface_queue_destroy(tbm_surface_queue_h surface_queue);
78
79 int tbm_surface_queue_get_width(tbm_surface_queue_h surface_queue);
80
81 int tbm_surface_queue_get_height(tbm_surface_queue_h surface_queue);
82
83 int tbm_surface_queue_get_format(tbm_surface_queue_h surface_queue);
84
85 int tbm_surface_queue_get_size(tbm_surface_queue_h surface_queue);
86
87 tbm_surface_queue_error_e tbm_surface_queue_reset(
88                 tbm_surface_queue_h surface_queue, int width, int height, int format);
89
90 tbm_surface_queue_error_e tbm_surface_queue_flush(tbm_surface_queue_h surface_queue);
91
92 tbm_surface_queue_error_e tbm_surface_queue_add_reset_cb(
93         tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb reset_cb,
94         void *data);
95
96 tbm_surface_queue_error_e tbm_surface_queue_remove_reset_cb(
97         tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb reset_cb,
98         void *data);
99
100 tbm_surface_queue_error_e tbm_surface_queue_add_destroy_cb(
101         tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb destroy_cb,
102         void *data);
103
104 tbm_surface_queue_error_e tbm_surface_queue_remove_destroy_cb(
105         tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb destroy_cb,
106         void *data);
107
108 tbm_surface_queue_error_e tbm_surface_queue_add_dequeuable_cb(
109         tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeuable_cb,
110         void *data);
111
112 tbm_surface_queue_error_e tbm_surface_queue_remove_dequeuable_cb(
113         tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeuable_cb,
114         void *data);
115
116 tbm_surface_queue_error_e tbm_surface_queue_add_acquirable_cb(
117         tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb acquirable_cb,
118         void *data);
119
120 tbm_surface_queue_error_e tbm_surface_queue_remove_acquirable_cb(
121         tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb acquirable_cb,
122         void *data);
123
124 tbm_surface_queue_error_e tbm_surface_queue_set_alloc_cb(
125         tbm_surface_queue_h surface_queue,
126         tbm_surface_alloc_cb alloc_cb,
127         tbm_surface_free_cb free_cb,
128         void *data);
129
130 tbm_surface_queue_error_e tbm_surface_queue_get_surfaces(
131         tbm_surface_queue_h surface_queue,
132         tbm_surface_h *surfaces, int *num);
133
134 /*The functions of queue factory*/
135 tbm_surface_queue_h tbm_surface_queue_create(int queue_size, int width,
136                 int height, int format, int flags);
137 tbm_surface_queue_h tbm_surface_queue_sequence_create(int queue_size, int width,
138                 int height, int format, int flags);
139
140 #ifdef __cplusplus
141 }
142 #endif
143 #endif                                                  /* _TBM_SURFACE_H_ */