1 /**************************************************************************
5 * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
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>
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:
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
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.
34 **************************************************************************/
40 #include <tbm_surface.h>
41 #include <tbm_surface_queue.h>
42 #include <tbm_surface_internal.h>
44 #include "tdm_types.h"
52 * @brief The header file for a frontend user.
55 * #include <tdm.h> //for a frontend user
60 * @brief The display capability enumeration
63 TDM_DISPLAY_CAPABILITY_PP = (1 << 0), /**< if hardware supports pp operation */
64 TDM_DISPLAY_CAPABILITY_CAPTURE = (1 << 1), /**< if hardware supports capture operation */
65 } tdm_display_capability;
68 * @brief The output change handler
69 * @details This handler will be called when the status of a output object is
72 typedef void (*tdm_output_change_handler)(tdm_output *output,
73 tdm_output_change_type type,
78 * @brief Initialize a display object
79 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
80 * @return A display object
81 * @see tdm_display_deinit
84 tdm_display_init(tdm_error *error);
87 * @brief Deinitialize a display object
88 * @param[in] dpy A display object
89 * @see tdm_display_init
92 tdm_display_deinit(tdm_display *dpy);
95 * @brief Update a display object
97 * When new output is connected, a frontend user need to call this function.
98 * And a frontend user can the new output information with tdm_output_get_xxx functions.
99 * @param[in] dpy A display object
100 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
103 tdm_display_update(tdm_display *dpy);
106 * @brief Get the file descriptor
107 * @details TDM handles the events of fd with #tdm_display_handle_events.
108 * @param[in] dpy A display object
109 * @param[out] fd The file descriptor
110 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
111 * @see tdm_display_handle_events
114 tdm_display_get_fd(tdm_display *dpy, int *fd);
117 * @brief Handle the events
118 * @param[in] dpy A display object
119 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
120 * @see tdm_display_get_fd
123 tdm_display_handle_events(tdm_display *dpy);
126 * @brief Get the information of the TDM backend module.
127 * @param[in] dpy A display object
128 * @param[out] name The name of the TDM backend module
129 * @param[out] vendor The vendor of the TDM backend module
130 * @param[out] version The version of the TDM backend module
131 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
134 tdm_display_get_backend_info(tdm_display *dpy, const char **name,
135 const char **vendor, int *major, int *minor);
138 * @brief Get the capabilities of a display object.
139 * @details A frontend user can get whether TDM supports pp/capture functionality with this function.
140 * @param[in] dpy A display object
141 * @param[out] capabilities The capabilities of a display object
142 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
145 tdm_display_get_capabilities(tdm_display *dpy,
146 tdm_display_capability *capabilities);
149 * @brief Get the pp capabilities of a display object.
150 * @param[in] dpy A display object
151 * @param[out] capabilities The pp capabilities
152 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
155 tdm_display_get_pp_capabilities(tdm_display *dpy,
156 tdm_pp_capability *capabilities);
159 * @brief Get the pp available format array of a display object.
160 * @param[in] dpy A display object
161 * @param[out] formats The pp available format array
162 * @param[out] count The count of formats
163 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
166 tdm_display_get_pp_available_formats(tdm_display *dpy,
167 const tbm_format **formats, int *count);
170 * @brief Get the pp available size of a display object.
171 * @details -1 means that a TDM backend module doesn't define the value.
172 * @param[in] dpy A display object
173 * @param[out] min_w The minimum width which TDM can handle
174 * @param[out] min_h The minimum height which TDM can handle
175 * @param[out] max_w The maximum width which TDM can handle
176 * @param[out] max_h The maximum height which TDM can handle
177 * @param[out] preferred_align The preferred align width which TDM can handle
178 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
181 tdm_display_get_pp_available_size(tdm_display *dpy, int *min_w, int *min_h,
182 int *max_w, int *max_h, int *preferred_align);
185 * @brief Get the capture capabilities of a display object.
186 * @param[in] dpy A display object
187 * @param[out] capabilities The capture capabilities
188 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
191 tdm_display_get_capture_capabilities(tdm_display *dpy,
192 tdm_capture_capability *capabilities);
195 * @brief Get the capture available format array of a display object.
196 * @param[in] dpy A display object
197 * @param[out] formats The capture available format array
198 * @param[out] count The count of formats
199 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
202 tdm_display_get_catpure_available_formats(tdm_display *dpy,
203 const tbm_format **formats, int *count);
206 * @brief Get the output counts which a display object has.
207 * @param[in] dpy A display object
208 * @param[out] count The count of outputs
209 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
210 * @see tdm_display_get_output
213 tdm_display_get_output_count(tdm_display *dpy, int *count);
216 * @brief Get a output object which has the given index.
217 * @param[in] dpy A display object
218 * @param[in] index The index of a output object
219 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
220 * @return A output object if success. Otherwise, NULL.
221 * @see tdm_display_get_output_count
224 tdm_display_get_output(tdm_display *dpy, int index, tdm_error *error);
227 * @brief Create a pp object.
228 * @param[in] dpy A display object
229 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
230 * @return A pp object if success. Otherwise, NULL.
231 * @see tdm_pp_destroy
234 tdm_display_create_pp(tdm_display *dpy, tdm_error *error);
237 * @brief Get the model information of a output object.
238 * @param[in] output A output object
239 * @param[out] maker The output maker.
240 * @param[out] model The output model.
241 * @param[out] name The output name.
242 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
245 tdm_output_get_model_info(tdm_output *output, const char **maker,
246 const char **model, const char **name);
249 * @brief Get the connection status of a output object.
250 * @param[in] output A output object
251 * @param[out] status The connection status.
252 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
255 tdm_output_get_conn_status(tdm_output *output, tdm_output_conn_status *status);
258 * @brief Add a output change handler
259 * @details The handler will be called when the status of a
260 * output object is changed. connection, DPMS, etc.
261 * @param[in] output A output object
262 * @param[in] func A output change handler
263 * @param[in] user_data The user data
264 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
267 tdm_output_add_change_handler(tdm_output *output,
268 tdm_output_change_handler func,
272 * @brief Remove a output change handler
273 * @param[in] output A output object
274 * @param[in] func A output change handler
275 * @param[in] user_data The user data
276 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
279 tdm_output_remove_change_handler(tdm_output *output,
280 tdm_output_change_handler func,
284 * @brief Get the connection type of a output object.
285 * @param[in] output A output object
286 * @param[out] type The connection type.
287 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
290 tdm_output_get_output_type(tdm_output *output, tdm_output_type *type);
293 * @brief Get the layer counts which a output object has.
294 * @param[in] output A output object
295 * @param[out] count The count of layers
296 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
297 * @see tdm_output_get_layer
300 tdm_output_get_layer_count(tdm_output *output, int *count);
303 * @brief Get a layer object which has the given index.
304 * @param[in] output A output object
305 * @param[in] index The index of a layer object
306 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
307 * @return A layer object if success. Otherwise, NULL.
308 * @see tdm_output_get_layer_count
311 tdm_output_get_layer(tdm_output *output, int index, tdm_error *error);
314 * @brief Get the available property array of a output object.
315 * @param[in] output A output object
316 * @param[out] props The available property array
317 * @param[out] count The count of properties
318 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
321 tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props,
325 * @brief Get the available mode array of a output object.
326 * @param[in] output A output object
327 * @param[out] modes The available mode array
328 * @param[out] count The count of modes
329 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
332 tdm_output_get_available_modes(tdm_output *output,
333 const tdm_output_mode **modes, int *count);
336 * @brief Get the available size of a output object.
337 * @details -1 means that a TDM backend module doesn't define the value.
338 * @param[in] output A output object
339 * @param[out] min_w The minimum width which TDM can handle
340 * @param[out] min_h The minimum height which TDM can handle
341 * @param[out] max_w The maximum width which TDM can handle
342 * @param[out] max_h The maximum height which TDM can handle
343 * @param[out] preferred_align The preferred align width which TDM can handle
344 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
347 tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h,
348 int *max_w, int *max_h, int *preferred_align);
351 * @brief Get the physical size of a output object.
352 * @param[in] output A output object
353 * @param[out] mmWidth The milimeter width
354 * @param[out] mmHeight The milimeter height
355 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
358 tdm_output_get_physical_size(tdm_output *output, unsigned int *mmWidth,
359 unsigned int *mmHeight);
362 * @brief Get the subpixel of a output object.
363 * @param[in] output A output object
364 * @param[out] subpixel The subpixel
365 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
368 tdm_output_get_subpixel(tdm_output *output, unsigned int *subpixel);
371 * @brief Get the pipe of a output object.
372 * @param[in] output A output object
373 * @param[out] pipe The pipe
374 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
377 tdm_output_get_pipe(tdm_output *output, unsigned int *pipe);
380 * @brief Set the property which has a given id.
381 * @param[in] output A output object
382 * @param[in] id The property id
383 * @param[in] value The value
384 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
387 tdm_output_set_property(tdm_output *output, unsigned int id, tdm_value value);
390 * @brief Get the property which has a given id
391 * @param[in] output A output object
392 * @param[in] id The property id
393 * @param[out] value The value
394 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
397 tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value);
400 * @brief Wait for VBLANK
401 * @details After interval vblanks, a user vblank handler will be called.
402 * @param[in] output A output object
403 * @param[in] interval vblank interval
404 * @param[in] sync 0: asynchronous, 1:synchronous
405 * @param[in] func A user vblank handler
406 * @param[in] user_data The user data
407 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
408 * @see #tdm_output_vblank_handler
411 tdm_output_wait_vblank(tdm_output *output, int interval, int sync,
412 tdm_output_vblank_handler func, void *user_data);
415 * @brief Commit changes for a output object
416 * @details After all change of a output object are applied, a user commit handler
418 * @param[in] output A output object
419 * @param[in] sync 0: asynchronous, 1:synchronous
420 * @param[in] func A user commit handler
421 * @param[in] user_data The user data
422 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
425 tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func,
429 * @brief Set one of available modes of a output object
430 * @param[in] output A output object
431 * @param[in] mode A output mode
432 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
435 tdm_output_set_mode(tdm_output *output, const tdm_output_mode *mode);
438 * @brief Get the mode of a output object
439 * @param[in] output A output object
440 * @param[out] mode A output mode
441 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
444 tdm_output_get_mode(tdm_output *output, const tdm_output_mode **mode);
447 * @brief Set DPMS of a output object
448 * @param[in] output A output object
449 * @param[in] dpms_value DPMS value
450 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
453 tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value);
456 * @brief Get DPMS of a output object
457 * @param[in] output A output object
458 * @param[out] dpms_value DPMS value
459 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
462 tdm_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value);
465 * @brief Create a capture object of a output object
466 * @param[in] output A output object
467 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
468 * @return A capture object
469 * @see tdm_capture_destroy
472 tdm_output_create_capture(tdm_output *output, tdm_error *error);
475 * @brief Get the capabilities of a layer object.
476 * @param[in] layer A layer object
477 * @param[out] capabilities The capabilities of a layer object
478 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
481 tdm_layer_get_capabilities(tdm_layer *layer,
482 tdm_layer_capability *capabilities);
485 * @brief Get the available format array of a layer object.
486 * @param[in] layer A layer object
487 * @param[out] formats The available format array
488 * @param[out] count The count of formats
489 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
492 tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats,
496 * @brief Get the available property array of a layer object.
497 * @param[in] layer A layer object
498 * @param[out] props The available property array
499 * @param[out] count The count of properties
500 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
503 tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props,
507 * @brief Get the zpos of a layer object.
509 * - GRAPHIC layers have fixed zpos. It starts from 0. It's @b non-changeable.
510 * - But the zpos of VIDEO layers will be decided by a backend module side.
511 * - A frontend user only can set the relative zpos to VIDEO layers via #tdm_layer_set_video_pos
512 * - The zpos of video layers is less than GRAPHIC layers or more than GRAPHIC
513 * layers. ie, ..., -2, -1, 4, 5, ... (if 0 <= GRAPHIC layer's zpos < 4).
514 * -------------------------------- graphic layer 3 <-- top most layer
515 * -------------------------------- graphic layer 2
516 * -------------------------------- graphic layer 1
517 * -------------------------------- graphic layer 0
518 * -------------------------------- video layer -1
519 * -------------------------------- video layer -2 <-- lowest layer
520 * @param[in] layer A layer object
521 * @param[out] zpos The zpos
522 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
523 * @see tdm_layer_set_video_pos, tdm_layer_capability
526 tdm_layer_get_zpos(tdm_layer *layer, int *zpos);
529 * @brief Set the property which has a given id.
530 * @param[in] layer A layer object
531 * @param[in] id The property id
532 * @param[in] value The value
533 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
536 tdm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
539 * @brief Get the property which has a given id.
540 * @param[in] layer A layer object
541 * @param[in] id The property id
542 * @param[out] value The value
543 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
546 tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
549 * @brief Set the geometry information to a layer object
550 * @details The geometry information will be applied when the output object
551 * of a layer object is committed. If a layer has TDM_LAYER_CAPABILITY_NO_CROP
552 * capability, a layer will ignore the pos(crop) information of #tdm_info_layer's
554 * @param[in] layer A layer object
555 * @param[in] info The geometry information
556 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
557 * @see tdm_output_commit
560 tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info);
563 * @brief Get the geometry information to a layer object
564 * @param[in] layer A layer object
565 * @param[out] info The geometry information
566 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
569 tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info);
572 * @brief Set a TDM buffer to a layer object
573 * @details A TDM buffer will be applied when the output object
574 * of a layer object is committed.
575 * @param[in] layer A layer object
576 * @param[in] buffer A TDM buffer
577 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
578 * @see tdm_output_commit
581 tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer);
584 * @brief Unset a TDM buffer from a layer object
585 * @details When this function is called, a current showing buffer will be
586 * disappeared from screen. Then nothing is showing on a layer object.
587 * @param[in] layer A layer object
588 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
591 tdm_layer_unset_buffer(tdm_layer *layer);
594 * @brief Get a displaying TDM buffer from a layer object
595 * @details A displaying TDM buffer is a current showing buffer on screen
596 * that is set to layer object and applied output object of a layer object.
597 * @param[in] layer A layer object
598 * @return A TDM buffer if success. Otherwise, NULL.
601 tdm_layer_get_displaying_buffer(tdm_layer *layer, tdm_error *error);
604 * @brief Set a TBM surface_queue to a layer object
605 * @details A TBM surface_queue will be applied when the output object
606 * of a layer object is committed. and TDM layer will be automatically updated
607 * @param[in] layer A layer object
608 * @param[in] buffer_queue A TBM surface_queue
609 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
610 * @see tdm_output_commit
613 tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue);
616 * @brief Unset a TBM surface_queue from a layer object
617 * @details When this function is called, a current surface_queue will be
618 * disappeared from screen. Then nothing is showing on a layer object.
619 * @param[in] layer A layer object
620 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
623 tdm_layer_unset_buffer_queue(tdm_layer *layer);
626 * @brief Check wheter a layer object is available for a frontend user to use.
627 * @details A layer object is not usable if a TDM buffer is showing on screen
628 * via this layer object. By calling #tdm_layer_unset_buffer, this layer object
629 * will become usable.
630 * @param[in] layer A layer object
631 * @param[out] usable 1 if usable, 0 if not usable
632 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
635 tdm_layer_is_usable(tdm_layer *layer, unsigned int *usable);
638 * @brief Set the relative zpos to a VIDEO layer object
639 * @details The zpos value is less than the minimum zpos of GRAPHIC layers, or
640 * it is more than the maximum zpos of GRAPHIC layers.
641 * @param[in] layer A VIDEO layer object
642 * @param[in] zpos The zpos
643 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
644 * @see tdm_layer_get_zpos, tdm_layer_capability
647 tdm_layer_set_video_pos(tdm_layer *layer, int zpos);
650 * @brief Create a capture object of a layer object
651 * @param[in] layer A layer object
652 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
653 * @return A capture object
654 * @see tdm_capture_destroy
657 tdm_layer_create_capture(tdm_layer *layer, tdm_error *error);
660 * @brief Get buffer flags from a layer object
661 * @param[in] layer A layer object
662 * @param[out] flags a buffer flags value
663 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
666 tdm_layer_get_buffer_flags(tdm_layer *layer, unsigned int *flags);
669 * @brief Destroy a pp object
670 * @param[in] pp A pp object
671 * @see tdm_display_create_pp
674 tdm_pp_destroy(tdm_pp *pp);
677 * @brief Set the geometry information to a pp object
678 * @param[in] pp A pp object
679 * @param[in] info The geometry information
680 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
684 tdm_pp_set_info(tdm_pp *pp, tdm_info_pp *info);
687 * @brief Attach a source buffer and a destination buffer to a pp object
688 * @param[in] pp A pp object
689 * @param[in] src A source buffer
690 * @param[in] dst A destination buffer
691 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
692 * @see tdm_pp_commit, tdm_buffer_add_release_handler, tdm_buffer_release_handler
695 tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
698 * @brief Commit changes for a pp object
699 * @param[in] pp A pp object
700 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
703 tdm_pp_commit(tdm_pp *pp);
706 * @brief Destroy a capture object
707 * @param[in] capture A capture object
708 * @see tdm_output_create_capture, tdm_layer_create_capture
711 tdm_capture_destroy(tdm_capture *capture);
714 * @brief Set the geometry information to a capture object
715 * @param[in] capture A capture object
716 * @param[in] info The geometry information
717 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
718 * @see tdm_capture_commit
721 tdm_capture_set_info(tdm_capture *capture, tdm_info_capture *info);
724 * @brief Attach a TDM buffer to a capture object
725 * @param[in] capture A capture object
726 * @param[in] buffer A TDM buffer
727 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
728 * @see tdm_capture_commit, tdm_buffer_add_release_handler, tdm_buffer_release_handler
731 tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer);
734 * @brief Commit changes for a capture object
735 * @param[in] capture A capture object
736 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
739 tdm_capture_commit(tdm_capture *capture);
742 * @brief The release handler of a TDM buffer
743 * @param[in] buffer A TDM buffer
744 * @param[in] user_data user data
745 * @see tdm_buffer_add_release_handler, tdm_buffer_remove_release_handler
747 typedef void (*tdm_buffer_release_handler)(tbm_surface_h buffer,
751 * @brief Add a release handler to a TDM buffer
753 * TDM has its own buffer release mechanism to let an frontend user know when a TDM buffer
754 * becomes available for a next job. A TDM buffer can be used for TDM to show
755 * it on screen or to capture an output and a layer. After all operations,
756 * TDM will release it immediately when TDM doesn't need it any more.
757 * @param[in] buffer A TDM buffer
758 * @param[in] func A release handler
759 * @param[in] user_data user data
760 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
761 * @see tdm_buffer_remove_release_handler
764 tdm_buffer_add_release_handler(tbm_surface_h buffer,
765 tdm_buffer_release_handler func, void *user_data);
768 * @brief Remove a release handler from a TDM buffer
769 * @param[in] buffer A TDM buffer
770 * @param[in] func A release handler
771 * @param[in] user_data user data
772 * @see tdm_buffer_add_release_handler
775 tdm_buffer_remove_release_handler(tbm_surface_h buffer,
776 tdm_buffer_release_handler func, void *user_data);