hwc: add tdm_output_hwc_commit_client_target_buffer
[platform/core/uifw/libtdm.git] / include / tdm_types.h
1 /**************************************************************************
2  *
3  * libtdm
4  *
5  * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
6  *
7  * Contact: Eunchul Kim <chulspro.kim@samsung.com>,
8  *          JinYoung Jeon <jy0.jeon@samsung.com>,
9  *          Taeheon Kim <th908.kim@samsung.com>,
10  *          YoungJun Cho <yj44.cho@samsung.com>,
11  *          SooChan Lim <sc1.lim@samsung.com>,
12  *          Boram Park <sc1.lim@samsung.com>
13  *
14  * Permission is hereby granted, free of charge, to any person obtaining a
15  * copy of this software and associated documentation files (the
16  * "Software"), to deal in the Software without restriction, including
17  * without limitation the rights to use, copy, modify, merge, publish,
18  * distribute, sub license, and/or sell copies of the Software, and to
19  * permit persons to whom the Software is furnished to do so, subject to
20  * the following conditions:
21  *
22  * The above copyright notice and this permission notice (including the
23  * next paragraph) shall be included in all copies or substantial portions
24  * of the Software.
25  *
26  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
27  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
29  * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
30  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
31  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
32  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33  *
34 **************************************************************************/
35
36 #ifndef _TDM_TYPES_H_
37 #define _TDM_TYPES_H_
38
39 #include <tbm_surface.h>
40
41 #include "tdm_common.h"
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46
47 /**
48  * @file tdm_types.h
49  * @brief The header file which defines Enumerations and Structures for frontend and backend.
50  * @details
51  * Both frontend(@ref tdm.h) and backend(@ref tdm_backend.h) header files
52  * include @ref tdm_types.h
53  * @par Example
54  * @code
55  * #include <tdm.h>    //for a frontend user
56  * @endcode
57  * @code
58  * #include <tdm_backend.h>  //for a vendor to implement a backend module
59  * @endcode
60  */
61
62 typedef enum {
63         TDM_EVENT_LOOP_READABLE = (1 << 0),
64         TDM_EVENT_LOOP_WRITABLE = (1 << 1),
65         TDM_EVENT_LOOP_HANGUP   = (1 << 2),
66         TDM_EVENT_LOOP_ERROR    = (1 << 3),
67 } tdm_event_loop_mask;
68
69 /**
70  * @brief The output mode structure
71  */
72 typedef struct _tdm_output_mode {
73         unsigned int clock;
74         unsigned int hdisplay, hsync_start, hsync_end, htotal, hskew;
75         unsigned int vdisplay, vsync_start, vsync_end, vtotal, vscan;
76         unsigned int vrefresh;
77         unsigned int flags;
78         unsigned int type;
79         char name[TDM_NAME_LEN];
80 } tdm_output_mode;
81
82 /**
83  * @brief The property structure
84  */
85 typedef struct _tdm_prop {
86         unsigned int id;
87         char name[TDM_NAME_LEN];
88         tdm_value_type type;
89 } tdm_prop;
90
91 /**
92  * @brief The info config structure
93  */
94 typedef struct _tdm_info_config {
95         tdm_size size;
96         tdm_pos pos;
97         tbm_format format;
98 } tdm_info_config;
99
100 /**
101  * @brief The layer info structre
102  */
103 typedef struct _tdm_info_layer {
104         tdm_info_config src_config;
105         tdm_pos dst_pos;
106         tdm_transform transform;
107 } tdm_info_layer;
108
109 /**
110  * @brief The hwc window info structure
111  * @since 2.0.0
112  */
113 typedef struct _tdm_hwc_window_info {
114         tdm_info_config src_config;
115         tdm_pos dst_pos;
116         tdm_transform transform;
117 } tdm_hwc_window_info;
118
119 typedef struct _tdm_hwc_region {
120         unsigned int num_rects;
121         tdm_pos const *rects;
122 } tdm_hwc_region;
123
124 /**
125  * @brief The pp info structre
126  */
127 typedef struct _tdm_info_pp {
128         tdm_info_config src_config;
129         tdm_info_config dst_config;
130         tdm_transform transform;
131         int sync;
132         int flags;
133 } tdm_info_pp;
134
135 /**
136  * @brief The capture info structre
137  */
138 typedef struct _tdm_info_capture {
139         tdm_info_config dst_config;
140         tdm_transform transform;
141         tdm_capture_type type;
142         int frequency;
143         int flags;
144 } tdm_info_capture;
145
146 /**
147  * @brief Possible composition types for a given window
148  * @since 2.0.0
149  */
150 typedef enum {
151
152         /** Set by the client for an invisible window. The value by default.
153          *
154          * The device ignores windows of this type.
155          */
156         TDM_COMPOSITION_NONE = 0,
157
158         /** The client will composite this window into the client target window
159          *
160          * User can choose this type for window to avoid a hardware composition for
161          * this window.
162          *
163          * The device must not request any composition type changes for windows of
164          * this type.
165          */
166         TDM_COMPOSITION_CLIENT = 1,
167
168         /** Set by the client before tdm_output_hwc_validate().
169          *
170          * Upon tdm_output_hwc_validate(), the device may request a change from this type to
171          * TDM_COMPOSITION_DEVICE or TDM_COMPOSITION_CLIENT. */
172         TDM_COMPOSITION_DEVICE_CANDIDATE = 2,
173
174         /** Set by the HWC after tdm_output_hwc_validate().
175          *
176          * The device will handle the composition of this window through a hardware
177          * overlay or other similar means.
178          *
179          * Upon tdm_output_hwc_validate(), the device may request a change from this type to
180          * TDM_COMPOSITION_CLIENT or TDM_COMPOSITION_DEVICE_CANDIDATE. */
181         TDM_COMPOSITION_DEVICE = 3,
182
183         /** Similar to DEVICE, but the position of this layer may also be set
184          * asynchronously through layer_set_cursor_position. If this functionality is not
185          * supported on a layer that the client sets to TDM_COMPOSITION_CURSOR, the
186          * device must request that the composition type of that layer is changed to
187          * TDM_COMPOSITION_CLIENT upon the next call to tdm_output_hwc_validate().
188          *
189          * Upon tdm_output_hwc_validate(), the device may request a change from this type to
190          * either TDM_COMPOSITION_DEVICE or TDM_COMPOSITION_CLIENT. Changing to
191          * TDM_COMPOSITION_DEVICE will prevent the use of layer_set_cursor_position but
192          * still permit the device to composite the layer. */
193         TDM_COMPOSITION_CURSOR = 4,
194
195         /** This type is for the VIDEO window which can be set to the reserved hw overlay
196          *  which is assigned by the device.
197          *
198          * Normally, this VIDEO window displays under the primary hw overlayer of the output. */
199         TDM_COMPOSITION_VIDEO = 5,
200 } tdm_hwc_window_composition;
201
202 /**
203  * @brief The hwc window flag enumeration
204  * @since 2.0.0
205  */
206 typedef enum {
207         TDM_HWC_WINDOW_FLAG_NONE     = 0,
208 } tdm_hwc_window_flag;
209
210 /**
211  * @brief The tdm display object
212  */
213 typedef void tdm_display;
214
215 /**
216  * @brief The tdm output object
217  */
218 typedef void tdm_output;
219
220 /**
221  * @brief The tdm layer object
222  */
223 typedef void tdm_layer;
224
225 /**
226  * @brief The tdm window object
227  * @since 2.0.0
228  */
229 typedef void tdm_hwc_window;
230
231 /**
232  * @brief The tdm capture object
233  */
234 typedef void tdm_capture;
235
236 /**
237  * @brief The tdm pp object
238  */
239 typedef void tdm_pp;
240
241 /**
242  * @brief The tdm vblank object
243  */
244 typedef void tdm_vblank;
245
246 /**
247  * @brief The vblank handler
248  * @see output_set_vblank_handler() function of #tdm_func_display
249  */
250 typedef void (*tdm_output_vblank_handler)(tdm_output *output, unsigned int sequence,
251                                                                                   unsigned int tv_sec, unsigned int tv_usec,
252                                                                                   void *user_data);
253
254 /**
255  * @brief The output commit handler
256  * @see output_set_commit_handler() function of #tdm_func_display
257  */
258 typedef void (*tdm_output_commit_handler)(tdm_output *output, unsigned int sequence,
259                                                                                   unsigned int tv_sec, unsigned int tv_usec,
260                                                                                   void *user_data);
261
262 /**
263  * @brief The layer commit handler
264  */
265 typedef void (*tdm_layer_commit_handler)(tdm_layer *layer, unsigned int sequence,
266                                                                                  unsigned int tv_sec, unsigned int tv_usec,
267                                                                                  void *user_data);
268
269 /**
270  * @brief The hwc_window commit handler
271  */
272 typedef void (*tdm_hwc_window_commit_handler)(tdm_hwc_window *hwc_window, unsigned int sequence,
273                                                                                  unsigned int tv_sec, unsigned int tv_usec,
274                                                                                  void *user_data);
275
276 /**
277  * @brief The output target_buffer commit handler
278  */
279 typedef void (*tdm_output_hwc_target_buffer_commit_handler)(tdm_output *output, unsigned int sequence,
280                                                                                  unsigned int tv_sec, unsigned int tv_usec,
281                                                                                  void *user_data);
282
283 /**
284  * @brief The done handler of a pp object
285  */
286 typedef void (*tdm_pp_done_handler)(tdm_pp *pp, tbm_surface_h src,
287                                                                         tbm_surface_h dst, void *user_data);
288
289 /**
290  * @brief The done handler of a capture object
291  */
292 typedef void (*tdm_capture_done_handler)(tdm_capture *capture,
293                                                                                  tbm_surface_h buffer, void *user_data);
294
295 /**
296  * @brief The create handler of a vblank object
297  */
298 typedef void (*tdm_vblank_create_handler)(tdm_vblank *vblank, void *user_data);
299
300 /**
301  * @brief The 'need to validate' handler of an output object
302  * @since 2.0.0
303  */
304 typedef void (*tdm_output_need_validate_handler)(tdm_output *output);
305
306 #ifdef __cplusplus
307 }
308 #endif
309
310 #endif /* _TDM_TYPES_H_ */