Support tbm_surface_queue
[platform/core/uifw/libtdm.git] / include / tdm.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_H_
37 #define _TDM_H_
38
39 #include <stdint.h>
40 #include <tbm_surface.h>
41 #include <tbm_surface_queue.h>
42 #include <tbm_surface_internal.h>
43
44 #include "tdm_types.h"
45
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49
50 /**
51  * @file tdm.h
52  * @brief The header file for a frontend user.
53  * @par Example
54  * @code
55    #include <tdm.h>    //for a frontend user
56  * @endcode
57  */
58
59 /**
60  * @brief The display capability enumeration
61  */
62 typedef enum
63 {
64     TDM_DISPLAY_CAPABILITY_PP       = (1<<0),   /**< if hardware supports pp operation */
65     TDM_DISPLAY_CAPABILITY_CAPTURE  = (1<<1),   /**< if hardware supports capture operation */
66 } tdm_display_capability;
67
68 /**
69  * @brief Initialize a display object
70  * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
71  * @return A display object
72  * @see tdm_display_deinit
73  */
74 tdm_display* tdm_display_init(tdm_error *error);
75
76 /**
77  * @brief Deinitialize a display object
78  * @param[in] dpy A display object
79  * @see tdm_display_init
80  */
81 void         tdm_display_deinit(tdm_display *dpy);
82
83 /**
84  * @brief Update a display object
85  * @details
86  * When new output is connected, a frontend user need to call this function.
87  * And a frontend user can the new output information with tdm_output_get_xxx functions.
88  * @param[in] dpy A display object
89  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
90  */
91 tdm_error    tdm_display_update(tdm_display *dpy);
92
93 /**
94  * @brief Get the file descriptor
95  * @details TDM handles the events of fd with #tdm_display_handle_events.
96  * @param[in] dpy A display object
97  * @param[out] fd The file descriptor
98  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
99  * @see tdm_display_handle_events
100  */
101 tdm_error    tdm_display_get_fd(tdm_display *dpy, int *fd);
102
103 /**
104  * @brief Handle the events
105  * @param[in] dpy A display object
106  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
107  * @see tdm_display_get_fd
108  */
109 tdm_error    tdm_display_handle_events(tdm_display *dpy);
110
111 /**
112  * @brief Get the capabilities of a display object.
113  * @details A frontend user can get whether TDM supports pp/capture functionality with this function.
114  * @param[in] dpy A display object
115  * @param[out] capabilities The capabilities of a display object
116  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
117  */
118 tdm_error    tdm_display_get_capabilities(tdm_display *dpy, tdm_display_capability *capabilities);
119
120 /**
121  * @brief Get the pp capabilities of a display object.
122  * @param[in] dpy A display object
123  * @param[out] capabilities The pp capabilities
124  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
125  */
126 tdm_error    tdm_display_get_pp_capabilities(tdm_display *dpy, tdm_pp_capability *capabilities);
127
128 /**
129  * @brief Get the pp available format array of a display object.
130  * @param[in] dpy A display object
131  * @param[out] formats The pp available format array
132  * @param[out] count The count of formats
133  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
134  */
135 tdm_error    tdm_display_get_pp_available_formats(tdm_display *dpy, const tbm_format **formats, int *count);
136
137 /**
138  * @brief Get the pp available size of a display object.
139  * @details -1 means that a TDM backend module doesn't define the value.
140  * @param[in] dpy A display object
141  * @param[out] min_w The minimum width which TDM can handle
142  * @param[out] min_h The minimum height which TDM can handle
143  * @param[out] max_w The maximum width which TDM can handle
144  * @param[out] max_h The maximum height which TDM can handle
145  * @param[out] preferred_align The preferred align width which TDM can handle
146  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
147  */
148 tdm_error    tdm_display_get_pp_available_size(tdm_display *dpy, int *min_w, int *min_h, int *max_w, int *max_h, int *preferred_align);
149
150 /**
151  * @brief Get the capture capabilities of a display object.
152  * @param[in] dpy A display object
153  * @param[out] capabilities The capture capabilities
154  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
155  */
156 tdm_error    tdm_display_get_capture_capabilities(tdm_display *dpy, tdm_capture_capability *capabilities);
157
158 /**
159  * @brief Get the capture available format array of a display object.
160  * @param[in] dpy A display object
161  * @param[out] formats The capture available format array
162  * @param[out] count The count of formats
163  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
164  */
165 tdm_error    tdm_display_get_catpure_available_formats(tdm_display *dpy, const tbm_format **formats, int *count);
166
167 /**
168  * @brief Get the output counts which a display object has.
169  * @param[in] dpy A display object
170  * @param[out] count The count of outputs
171  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
172  * @see tdm_display_get_output
173  */
174 tdm_error    tdm_display_get_output_count(tdm_display *dpy, int *count);
175
176 /**
177  * @brief Get a output object which has the given index.
178  * @param[in] dpy A display object
179  * @param[in] index The index of a output object
180  * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
181  * @return A output object if success. Otherwise, NULL.
182  * @see tdm_display_get_output_count
183  */
184 tdm_output*  tdm_display_get_output(tdm_display *dpy, int index, tdm_error *error);
185
186 /**
187  * @brief Create a pp object.
188  * @param[in] dpy A display object
189  * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
190  * @return A pp object if success. Otherwise, NULL.
191  * @see tdm_pp_destroy
192  */
193 tdm_pp*      tdm_display_create_pp(tdm_display *dpy, tdm_error *error);
194
195 /**
196  * @brief Get the connection status of a output object.
197  * @param[in] output A output object
198  * @param[out] status The connection status.
199  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
200  */
201 tdm_error    tdm_output_get_conn_status(tdm_output *output, tdm_output_conn_status *status);
202
203 /**
204  * @brief Get the connection type of a output object.
205  * @param[in] output A output object
206  * @param[out] type The connection type.
207  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
208  */
209 tdm_error    tdm_output_get_output_type(tdm_output *output, tdm_output_type *type);
210
211 /**
212  * @brief Get the layer counts which a output object has.
213  * @param[in] output A output object
214  * @param[out] count The count of layers
215  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
216  * @see tdm_output_get_layer
217  */
218 tdm_error    tdm_output_get_layer_count(tdm_output *output, int *count);
219
220 /**
221  * @brief Get a layer object which has the given index.
222  * @param[in] output A output object
223  * @param[in] index The index of a layer object
224  * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
225  * @return A layer object if success. Otherwise, NULL.
226  * @see tdm_output_get_layer_count
227  */
228 tdm_layer*   tdm_output_get_layer(tdm_output *output, int index, tdm_error *error);
229
230 /**
231  * @brief Get the available property array of a output object.
232  * @param[in] output A output object
233  * @param[out] props The available property array
234  * @param[out] count The count of properties
235  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
236  */
237 tdm_error    tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props, int *count);
238
239 /**
240  * @brief Get the available mode array of a output object.
241  * @param[in] output A output object
242  * @param[out] modes The available mode array
243  * @param[out] count The count of modes
244  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
245  */
246 tdm_error    tdm_output_get_available_modes(tdm_output *output, const tdm_output_mode **modes, int *count);
247
248 /**
249  * @brief Get the available size of a output object.
250  * @details -1 means that a TDM backend module doesn't define the value.
251  * @param[in] output A output object
252  * @param[out] min_w The minimum width which TDM can handle
253  * @param[out] min_h The minimum height which TDM can handle
254  * @param[out] max_w The maximum width which TDM can handle
255  * @param[out] max_h The maximum height which TDM can handle
256  * @param[out] preferred_align The preferred align width which TDM can handle
257  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
258  */
259 tdm_error    tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h, int *max_w, int *max_h, int *preferred_align);
260
261 /**
262  * @brief Get the physical size of a output object.
263  * @param[in] output A output object
264  * @param[out] mmWidth The milimeter width
265  * @param[out] mmHeight The milimeter height
266  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
267  */
268 tdm_error    tdm_output_get_physical_size(tdm_output *output, unsigned int *mmWidth, unsigned int *mmHeight);
269
270 /**
271  * @brief Get the subpixel of a output object.
272  * @param[in] output A output object
273  * @param[out] subpixel The subpixel
274  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
275  */
276 tdm_error    tdm_output_get_subpixel(tdm_output *output, unsigned int *subpixel);
277
278 /**
279  * @brief Get the pipe of a output object.
280  * @param[in] output A output object
281  * @param[out] pipe The pipe
282  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
283  */
284 tdm_error    tdm_output_get_pipe(tdm_output *output, unsigned int *pipe);
285
286 /**
287  * @brief Set the property which has a given id.
288  * @param[in] output A output object
289  * @param[in] id The property id
290  * @param[in] value The value
291  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
292  */
293 tdm_error    tdm_output_set_property(tdm_output *output, unsigned int id, tdm_value value);
294
295 /**
296  * @brief Get the property which has a given id
297  * @param[in] output A output object
298  * @param[in] id The property id
299  * @param[out] value The value
300  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
301  */
302 tdm_error    tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value);
303
304 /**
305  * @brief Wait for VBLANK
306  * @details After interval vblanks, a user vblank handler will be called.
307  * @param[in] output A output object
308  * @param[in] interval vblank interval
309  * @param[in] sync 0: asynchronous, 1:synchronous
310  * @param[in] func A user vblank handler
311  * @param[in] user_data The user data
312  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
313  * @see #tdm_output_vblank_handler
314  */
315 tdm_error    tdm_output_wait_vblank(tdm_output *output, int interval, int sync, tdm_output_vblank_handler func, void *user_data);
316
317 /**
318  * @brief Commit changes for a output object
319  * @details After all change of a output object are applied, a user commit handler
320  * will be called.
321  * @param[in] output A output object
322  * @param[in] sync 0: asynchronous, 1:synchronous
323  * @param[in] func A user commit handler
324  * @param[in] user_data The user data
325  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
326  */
327 tdm_error    tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func, void *user_data);
328
329 /**
330  * @brief Set one of available modes of a output object
331  * @param[in] output A output object
332  * @param[in] mode A output mode
333  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
334  */
335 tdm_error    tdm_output_set_mode(tdm_output *output, const tdm_output_mode *mode);
336
337 /**
338  * @brief Get the mode of a output object
339  * @param[in] output A output object
340  * @param[out] mode A output mode
341  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
342  */
343 tdm_error    tdm_output_get_mode(tdm_output *output, const tdm_output_mode **mode);
344
345 /**
346  * @brief Set DPMS of a output object
347  * @param[in] output A output object
348  * @param[in] dpms_value DPMS value
349  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
350  */
351 tdm_error    tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value);
352
353 /**
354  * @brief Get DPMS of a output object
355  * @param[in] output A output object
356  * @param[out] dpms_value DPMS value
357  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
358  */
359 tdm_error    tdm_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value);
360
361 /**
362  * @brief Create a capture object of a output object
363  * @param[in] output A output object
364  * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
365  * @return A capture object
366  * @see tdm_capture_destroy
367  */
368 tdm_capture *tdm_output_create_capture(tdm_output *output, tdm_error *error);
369
370 /**
371  * @brief Get the capabilities of a layer object.
372  * @param[in] layer A layer object
373  * @param[out] capabilities The capabilities of a layer object
374  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
375  */
376 tdm_error    tdm_layer_get_capabilities(tdm_layer *layer, tdm_layer_capability *capabilities);
377
378 /**
379  * @brief Get the available format array of a layer object.
380  * @param[in] layer A layer object
381  * @param[out] formats The available format array
382  * @param[out] count The count of formats
383  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
384  */
385 tdm_error    tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats, int *count);
386
387 /**
388  * @brief Get the available property array of a layer object.
389  * @param[in] layer A layer object
390  * @param[out] props The available property array
391  * @param[out] count The count of properties
392  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
393  */
394 tdm_error    tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props, int *count);
395
396 /**
397  * @brief Get the zpos of a layer object.
398  * @details
399  * - GRAPHIC layers have fixed zpos. It starts from 0. It's @b non-changeable.
400  * - But the zpos of VIDEO layers will be decided by a backend module side.
401  * - A frontend user only can set the relative zpos to VIDEO layers via #tdm_layer_set_video_pos
402  * - The zpos of video layers is less than GRAPHIC layers or more than GRAPHIC
403  * layers. ie, ..., -2, -1, 4, 5, ... (if 0 <= GRAPHIC layer's zpos < 4).
404  * @param[in] layer A layer object
405  * @param[out] zpos The zpos
406  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
407  * @see tdm_layer_set_video_pos, tdm_layer_capability
408  */
409 tdm_error    tdm_layer_get_zpos(tdm_layer *layer, unsigned int *zpos);
410
411 /**
412  * @brief Set the property which has a given id.
413  * @param[in] layer A layer object
414  * @param[in] id The property id
415  * @param[in] value The value
416  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
417  */
418 tdm_error    tdm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
419
420 /**
421  * @brief Get the property which has a given id.
422  * @param[in] layer A layer object
423  * @param[in] id The property id
424  * @param[out] value The value
425  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
426  */
427 tdm_error    tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
428
429 /**
430  * @brief Set the geometry information to a layer object
431  * @details The geometry information will be applied when the output object
432  * of a layer object is committed.
433  * @param[in] layer A layer object
434  * @param[in] info The geometry information
435  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
436  * @see tdm_output_commit
437  */
438 tdm_error    tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info);
439
440 /**
441  * @brief Get the geometry information to a layer object
442  * @param[in] layer A layer object
443  * @param[out] info The geometry information
444  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
445  */
446 tdm_error    tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info);
447
448 /**
449  * @brief Set a TDM buffer to a layer object
450  * @details A TDM buffer will be applied when the output object
451  * of a layer object is committed.
452  * @param[in] layer A layer object
453  * @param[in] buffer A TDM buffer
454  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
455  * @see tdm_output_commit
456  */
457 tdm_error    tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer);
458
459 /**
460  * @brief Unset a TDM buffer from a layer object
461  * @details When this function is called, a current showing buffer will be
462  * disappeared from screen. Then nothing is showing on a layer object.
463  * @param[in] layer A layer object
464  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
465  */
466 tdm_error    tdm_layer_unset_buffer(tdm_layer *layer);
467
468 /**
469  * @brief Set a TBM surface_queue to a layer object
470  * @details A TBM surface_queue will be applied when the output object
471  * of a layer object is committed. and TDM layer will be automatically updated
472  * @param[in] layer A layer object
473  * @param[in] buffer_queue A TBM surface_queue
474  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
475  * @see tdm_output_commit
476  */
477 tdm_error    tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue);
478
479 /**
480  * @brief Unset a TBM surface_queue from a layer object
481  * @details When this function is called, a current surface_queue will be
482  * disappeared from screen. Then nothing is showing on a layer object.
483  * @param[in] layer A layer object
484  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
485  */
486 tdm_error    tdm_layer_unset_buffer_queue(tdm_layer *layer);
487
488 /**
489  * @brief Check wheter a layer object is available for a frontend user to use.
490  * @details A layer object is not usable if a TDM buffer is showing on screen
491  * via this layer object. By calling #tdm_layer_unset_buffer, this layer object
492  * will become usable.
493  * @param[in] layer A layer object
494  * @param[out] usable 1 if usable, 0 if not usable
495  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
496  */
497 tdm_error    tdm_layer_is_usable(tdm_layer *layer, unsigned int *usable);
498
499 /**
500  * @brief Set the relative zpos to a VIDEO layer object
501  * @details The zpos value is less than the minimum zpos of GRAPHIC layers, or
502  * it is more than the maximum zpos of GRAPHIC layers.
503  * @param[in] layer A VIDEO layer object
504  * @param[in] zpos The zpos
505  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
506  * @see tdm_layer_get_zpos, tdm_layer_capability
507  */
508 tdm_error    tdm_layer_set_video_pos(tdm_layer *layer, int zpos);
509
510 /**
511  * @brief Create a capture object of a layer object
512  * @param[in] layer A layer object
513  * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
514  * @return A capture object
515  * @see tdm_capture_destroy
516  */
517 tdm_capture *tdm_layer_create_capture(tdm_layer *layer, tdm_error *error);
518
519 /**
520  * @brief Destroy a pp object
521  * @param[in] pp A pp object
522  * @see tdm_display_create_pp
523  */
524 void         tdm_pp_destroy(tdm_pp *pp);
525
526 /**
527  * @brief Set the geometry information to a pp object
528  * @param[in] pp A pp object
529  * @param[in] info The geometry information
530  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
531  * @see tdm_pp_commit
532  */
533 tdm_error    tdm_pp_set_info(tdm_pp *pp, tdm_info_pp *info);
534
535 /**
536  * @brief Attach a source buffer and a destination buffer to a pp object
537  * @param[in] pp A pp object
538  * @param[in] src A source buffer
539  * @param[in] dst A destination buffer
540  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
541  * @see tdm_pp_commit, tdm_buffer_add_release_handler, tdm_buffer_release_handler
542  */
543 tdm_error    tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
544
545 /**
546  * @brief Commit changes for a pp object
547  * @param[in] pp A pp object
548  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
549  */
550 tdm_error    tdm_pp_commit(tdm_pp *pp);
551
552 /**
553  * @brief Destroy a capture object
554  * @param[in] capture A capture object
555  * @see tdm_output_create_capture, tdm_layer_create_capture
556  */
557 void         tdm_capture_destroy(tdm_capture *capture);
558
559 /**
560  * @brief Set the geometry information to a capture object
561  * @param[in] capture A capture object
562  * @param[in] info The geometry information
563  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
564  * @see tdm_capture_commit
565  */
566 tdm_error    tdm_capture_set_info(tdm_capture *capture, tdm_info_capture *info);
567
568 /**
569  * @brief Attach a TDM buffer to a capture object
570  * @param[in] capture A capture object
571  * @param[in] buffer A TDM buffer
572  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
573  * @see tdm_capture_commit, tdm_buffer_add_release_handler, tdm_buffer_release_handler
574  */
575 tdm_error    tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer);
576
577 /**
578  * @brief Commit changes for a capture object
579  * @param[in] capture A capture object
580  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
581  */
582 tdm_error    tdm_capture_commit(tdm_capture *capture);
583
584 /**
585  * @brief The release handler of a TDM buffer
586  * @param[in] buffer A TDM buffer
587  * @param[in] user_data user data
588  * @see tdm_buffer_add_release_handler, tdm_buffer_remove_release_handler
589  */
590 typedef void (*tdm_buffer_release_handler)(tbm_surface_h buffer, void *user_data);
591
592 /**
593  * @brief Add a release handler to a TDM buffer
594  * @details
595  * TDM has its own buffer release mechanism to let an frontend user know when a TDM buffer
596  * becomes available for a next job. A TDM buffer can be used for TDM to show
597  * it on screen or to capture an output and a layer. After all operations,
598  * TDM will release it immediately when TDM doesn't need it any more.
599  * @param[in] buffer A TDM buffer
600  * @param[in] func A release handler
601  * @param[in] user_data user data
602  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
603  * @see tdm_buffer_remove_release_handler
604  */
605 tdm_error    tdm_buffer_add_release_handler(tbm_surface_h buffer, tdm_buffer_release_handler func, void *user_data);
606
607 /**
608  * @brief Remove a release handler from a TDM buffer
609  * @param[in] buffer A TDM buffer
610  * @param[in] func A release handler
611  * @param[in] user_data user data
612  * @see tdm_buffer_add_release_handler
613  */
614 void         tdm_buffer_remove_release_handler(tbm_surface_h buffer, tdm_buffer_release_handler func, void *user_data);
615
616 #ifdef __cplusplus
617 }
618 #endif
619
620 #endif /* _TDM_H_ */