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 <boram1288.park@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 <sys/types.h>
41 #include <tbm_surface.h>
42 #include <tbm_surface_queue.h>
43 #include <tbm_surface_internal.h>
45 #include "tdm_types.h"
46 #include "tdm_deprecated.h"
54 * @brief The header file for a frontend user.
57 * #include <tdm.h> //for a frontend user
62 * @brief Initialize a display object
63 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
64 * @return A display object
65 * @see tdm_display_deinit
68 tdm_display_init(tdm_error *error);
71 * @brief Deinitialize a display object
72 * @param[in] dpy A display object
73 * @see tdm_display_init
76 tdm_display_deinit(tdm_display *dpy);
79 * @brief Get the file descriptor
80 * @details TDM handles the events of fd with #tdm_display_handle_events.
81 * @param[in] dpy A display object
82 * @param[out] fd The file descriptor
83 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
84 * @see tdm_display_handle_events
87 tdm_display_get_fd(tdm_display *dpy, int *fd);
90 * @brief Handle the events
91 * @param[in] dpy A display object
92 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
93 * @see tdm_display_get_fd
96 tdm_display_handle_events(tdm_display *dpy);
99 * @brief Flush the all events to clients
100 * @param[in] dpy A display object
103 tdm_display_flush(tdm_display *dpy);
106 * @brief Get the capabilities of a display object.
107 * @details A frontend user can get whether TDM supports pp/capture functionality with this function.
108 * @param[in] dpy A display object
109 * @param[out] capabilities The capabilities of a display object
110 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
113 tdm_display_get_capabilities(tdm_display *dpy,
114 tdm_display_capability *capabilities);
117 * @brief Get the pp capabilities of a display object.
118 * @param[in] dpy A display object
119 * @param[out] capabilities The pp capabilities
120 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
123 tdm_display_get_pp_capabilities(tdm_display *dpy,
124 tdm_pp_capability *capabilities);
127 * @brief Get the pp available format array of a display object.
128 * @param[in] dpy A display object
129 * @param[out] formats The pp available format array
130 * @param[out] count The count of formats
131 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
134 tdm_display_get_pp_available_formats(tdm_display *dpy,
135 const tbm_format **formats, int *count);
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.
149 tdm_display_get_pp_available_size(tdm_display *dpy, int *min_w, int *min_h,
150 int *max_w, int *max_h, int *preferred_align);
153 * @brief Get the capture capabilities of a display object.
154 * @param[in] dpy A display object
155 * @param[out] capabilities The capture capabilities
156 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
159 tdm_display_get_capture_capabilities(tdm_display *dpy,
160 tdm_capture_capability *capabilities);
163 * @brief Get the capture available format array of a display object.
164 * @param[in] dpy A display object
165 * @param[out] formats The capture available format array
166 * @param[out] count The count of formats
167 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
170 tdm_display_get_capture_available_formats(tdm_display *dpy,
171 const tbm_format **formats, int *count);
174 * @brief Get the capture available size of a display object.
175 * @details -1 means that a TDM backend module doesn't define the value.
176 * @param[in] dpy A display object
177 * @param[out] min_w The minimum width which TDM can handle
178 * @param[out] min_h The minimum height which TDM can handle
179 * @param[out] max_w The maximum width which TDM can handle
180 * @param[out] max_h The maximum height which TDM can handle
181 * @param[out] preferred_align The preferred align width which TDM can handle
182 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
185 tdm_display_get_capture_available_size(tdm_display *dpy, int *min_w, int *min_h,
186 int *max_w, int *max_h, int *preferred_align);
189 * @brief Get the output counts which a display object has.
190 * @param[in] dpy A display object
191 * @param[out] count The count of outputs
192 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
193 * @see tdm_display_get_output
196 tdm_display_get_output_count(tdm_display *dpy, int *count);
199 * @brief Get a output object which has the given index.
200 * @param[in] dpy A display object
201 * @param[in] index The index of a output object
202 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
203 * @return A output object if success. Otherwise, NULL.
204 * @see tdm_display_get_output_count
207 tdm_display_get_output(tdm_display *dpy, int index, tdm_error *error);
210 tdm_display_add_output_create_handler(tdm_display *dpy,
211 tdm_output_create_handler func,
215 tdm_display_remove_output_create_handler(tdm_display *dpy,
216 tdm_output_create_handler func,
220 * @brief Find a output object which has the given name.
221 * @param[in] dpy A display object
222 * @param[in] name The name of a output object
223 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
224 * @return A output object if success. Otherwise, NULL.
227 tdm_display_find_output(tdm_display *dpy, const char *name, tdm_error *error);
230 * @brief Create a pp object.
231 * @param[in] dpy A display object
232 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
233 * @return A pp object if success. Otherwise, NULL.
234 * @see tdm_pp_destroy
237 tdm_display_create_pp(tdm_display *dpy, tdm_error *error);
240 * @brief Get the information of the TDM backend module.
241 * @param[in] module A backend module object
242 * @param[out] name The name of the TDM backend module
243 * @param[out] vendor The vendor of the TDM backend module
244 * @param[out] version The version of the TDM backend module
245 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
248 tdm_module_get_info(tdm_module *module, const char **name,
249 const char **vendor, int *major, int *minor);
252 tdm_output_add_destroy_handler(tdm_output *output,
253 tdm_output_destroy_handler func,
257 tdm_output_remove_destroy_handler(tdm_output *output,
258 tdm_output_destroy_handler func,
262 * @brief Get a backend module object of the given output.
263 * @param[in] output A output object
264 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
265 * @return A backend object if success. Otherwise, NULL.
268 tdm_output_get_backend_module(tdm_output *output, tdm_error *error);
271 * @brief Get the capabilities of a output object.
272 * @param[in] output A output object
273 * @param[out] capabilities The capabilities of a output object
274 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
277 tdm_output_get_capabilities(tdm_output *output,
278 tdm_output_capability *capabilities);
281 * @brief Get the model information of a output object.
282 * @param[in] output A output object
283 * @param[out] maker The output maker.
284 * @param[out] model The output model.
285 * @param[out] name The output name.
286 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
289 tdm_output_get_model_info(tdm_output *output, const char **maker,
290 const char **model, const char **name);
293 * @brief Get the connection status of a output object.
294 * @param[in] output A output object
295 * @param[out] status The connection status.
296 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
299 tdm_output_get_conn_status(tdm_output *output, tdm_output_conn_status *status);
302 * @brief Add a output change handler
303 * @details The handler will be called when the status of a
304 * output object is changed. connection, DPMS, etc.
305 * @param[in] output A output object
306 * @param[in] func A output change handler
307 * @param[in] user_data The user data
308 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
311 tdm_output_add_change_handler(tdm_output *output,
312 tdm_output_change_handler func,
316 * @brief Remove a output change handler
317 * @param[in] output A output object
318 * @param[in] func A output change handler
319 * @param[in] user_data The user data
320 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
323 tdm_output_remove_change_handler(tdm_output *output,
324 tdm_output_change_handler func,
328 tdm_output_add_mode_change_request_handler(tdm_output *output,
329 tdm_output_mode_change_request_handler func,
333 tdm_output_remove_mode_change_request_handler(tdm_output *output,
334 tdm_output_mode_change_request_handler func,
338 * @brief Get the connection type of a output object.
339 * @param[in] output A output object
340 * @param[out] type The connection type.
341 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
344 tdm_output_get_output_type(tdm_output *output, tdm_output_type *type);
347 * @brief Get the layer counts which a output object has.
348 * @param[in] output A output object
349 * @param[out] count The count of layers
350 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
351 * @see tdm_output_get_layer
354 tdm_output_get_layer_count(tdm_output *output, int *count);
357 * @brief Get a layer object which has the given index.
358 * @param[in] output A output object
359 * @param[in] index The index of a layer object
360 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
361 * @return A layer object if success. Otherwise, NULL.
362 * @see tdm_output_get_layer_count
365 tdm_output_get_layer(tdm_output *output, int index, tdm_error *error);
368 * @brief Get the available property array of a output object.
369 * @param[in] output A output object
370 * @param[out] props The available property array
371 * @param[out] count The count of properties
372 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
375 tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props,
379 * @brief Get the available mode array of a output object.
380 * @param[in] output A output object
381 * @param[out] modes The available mode array
382 * @param[out] count The count of modes
383 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
386 tdm_output_get_available_modes(tdm_output *output,
387 const tdm_output_mode **modes, int *count);
390 * @brief Get the available size of a output object.
391 * @details -1 means that a TDM backend module doesn't define the value.
392 * @param[in] output A output object
393 * @param[out] min_w The minimum width which TDM can handle
394 * @param[out] min_h The minimum height which TDM can handle
395 * @param[out] max_w The maximum width which TDM can handle
396 * @param[out] max_h The maximum height which TDM can handle
397 * @param[out] preferred_align The preferred align width which TDM can handle
398 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
401 tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h,
402 int *max_w, int *max_h, int *preferred_align);
405 * @brief Get the available cursor size of a output object.
406 * @details -1 means that a TDM backend module doesn't define the value.
407 * @param[in] output A output object
408 * @param[out] min_w The minimum width which TDM can handle
409 * @param[out] min_h The minimum height which TDM can handle
410 * @param[out] max_w The maximum width which TDM can handle
411 * @param[out] max_h The maximum height which TDM can handle
412 * @param[out] preferred_align The preferred align width which TDM can handle
413 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
416 tdm_output_get_cursor_available_size(tdm_output *output, int *min_w, int *min_h,
417 int *max_w, int *max_h, int *preferred_align);
420 * @brief Get the physical size of a output object.
421 * @param[in] output A output object
422 * @param[out] mmWidth The milimeter width
423 * @param[out] mmHeight The milimeter height
424 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
427 tdm_output_get_physical_size(tdm_output *output, unsigned int *mmWidth,
428 unsigned int *mmHeight);
431 * @brief Get the subpixel of a output object.
432 * @param[in] output A output object
433 * @param[out] subpixel The subpixel
434 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
437 tdm_output_get_subpixel(tdm_output *output, unsigned int *subpixel);
440 * @brief Get the pipe of a output object.
441 * @param[in] output A output object
442 * @param[out] pipe The pipe
443 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
446 tdm_output_get_pipe(tdm_output *output, unsigned int *pipe);
449 * @brief Get the index of a primary layer.
450 * @param[in] output A output object
451 * @param[out] index The primary layer index
452 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
455 tdm_output_get_primary_index(tdm_output *output, int *index);
458 * @brief Set the property which has a given id.
459 * @param[in] output A output object
460 * @param[in] id The property id
461 * @param[in] value The value
462 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
465 tdm_output_set_property(tdm_output *output, unsigned int id, tdm_value value);
468 * @brief Get the property which has a given id
469 * @param[in] output A output object
470 * @param[in] id The property id
471 * @param[out] value The value
472 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
475 tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value);
478 * @brief Wait for VBLANK
479 * @details After interval vblanks, a user vblank handler will be called.
480 * @param[in] output A output object
481 * @param[in] interval vblank interval
482 * @param[in] sync 0: asynchronous, 1:synchronous
483 * @param[in] func A user vblank handler
484 * @param[in] user_data The user data
485 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
486 * @see #tdm_output_vblank_handler
489 tdm_output_wait_vblank(tdm_output *output, int interval, int sync,
490 tdm_output_vblank_handler func, void *user_data);
493 * @brief Commit changes for a output object
494 * @details After all change of a output object are applied, a user commit handler
496 * @param[in] output A output object
497 * @param[in] sync 0: asynchronous, 1:synchronous
498 * @param[in] func A user commit handler
499 * @param[in] user_data The user data
500 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
501 * @see #tdm_layer_commit
504 tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func,
508 * @brief Remove the user vblank handler
509 * @param[in] output A output object
510 * @param[in] func A user vblank handler
511 * @param[in] user_data The user data
512 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
515 tdm_output_remove_vblank_handler(tdm_output *output, tdm_output_vblank_handler func, void *user_data);
518 * @brief Remove the user commit handler
519 * @param[in] output A output object
520 * @param[in] func A user commit handler
521 * @param[in] user_data The user data
522 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
525 tdm_output_remove_commit_handler(tdm_output *output, tdm_output_commit_handler func, void *user_data);
528 * @brief Set one of available modes of a output object
529 * @param[in] output A output object
530 * @param[in] mode A output mode
531 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
534 tdm_output_set_mode(tdm_output *output, const tdm_output_mode *mode);
537 * @brief Get the mode of a output object
538 * @param[in] output A output object
539 * @param[out] mode A output mode
540 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
543 tdm_output_get_mode(tdm_output *output, const tdm_output_mode **mode);
546 * @brief Set DPMS of a output object synchronously
547 * @param[in] output A output object
548 * @param[in] dpms_value DPMS value
549 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
550 * @see tdm_output_set_dpms_async
553 tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value);
556 * @brief Set DPMS of a output object asynchronously
557 * @details This function can be used when a output supports the asynchronous DPMS
558 * control. The output has #TDM_OUTPUT_CAPABILITY_ASYNC_DPMS flags which
559 * #tdm_output_get_capabilities returns. If an output change handler is added with
560 * #tdm_output_add_change_handler, the output change handler will be called when
561 * the DPMS status is changed indeed.
562 * @param[in] output A output object
563 * @param[in] dpms_value DPMS value
564 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
565 * @see tdm_output_add_change_handler, tdm_output_set_dpms,
566 * tdm_output_get_capabilities, #TDM_OUTPUT_CAPABILITY_ASYNC_DPMS.
569 tdm_output_set_dpms_async(tdm_output *output, tdm_output_dpms dpms_value);
572 * @brief Get DPMS of a output object
573 * @param[in] output A output object
574 * @param[out] dpms_value DPMS value
575 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
578 tdm_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value);
581 * @brief Check if a output object has the capture capability
582 * @param[in] output A output object
583 * @param[out] has_capability 1: has the capability, 0: not has the capability
584 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
587 tdm_output_has_capture_capability(tdm_output *output, unsigned int *has_capability);
590 * @brief Create a capture object of a output object
591 * @param[in] output A output object
592 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
593 * @return A capture object
594 * @see tdm_capture_destroy
597 tdm_output_create_capture(tdm_output *output, tdm_error *error);
600 * @brief Get a hwc associated with a output object.
601 * @param[in] output A output object
602 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
603 * @return A hwc object
607 tdm_output_get_hwc(tdm_output *output, tdm_error *error);
610 * @brief Get a output object of a layer object
611 * @param[in] layer A layer object
612 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
613 * @return A TDM output object if success. Otherwise, NULL.
616 tdm_layer_get_output(tdm_layer *layer, tdm_error *error);
619 * @brief Get the index of a layer object.
620 * @param[in] layer A layer object
621 * @param[out] index The index of a layer object
622 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
625 tdm_layer_get_index(tdm_layer *layer, int *index);
628 * @brief Get the capabilities of a layer object.
629 * @param[in] layer A layer object
630 * @param[out] capabilities The capabilities of a layer object
631 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
634 tdm_layer_get_capabilities(tdm_layer *layer,
635 tdm_layer_capability *capabilities);
638 * @brief Get the available format array of a layer object.
639 * @param[in] layer A layer object
640 * @param[out] formats The available format array
641 * @param[out] count The count of formats
642 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
645 tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats,
649 * @brief Get the available property array of a layer object.
650 * @param[in] layer A layer object
651 * @param[out] props The available property array
652 * @param[out] count The count of properties
653 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
656 tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props,
660 * @brief Get the zpos of a layer object.
662 * - GRAPHIC layers have fixed zpos. It starts from 0. It's @b non-changeable.
663 * - But the zpos of VIDEO layers will be decided by a backend module side.
664 * - A frontend user only can set the relative zpos to VIDEO layers via #tdm_layer_set_video_pos
665 * - The zpos of video layers is less than GRAPHIC layers or more than GRAPHIC
666 * layers. ie, ..., -2, -1, 4, 5, ... (if 0 <= GRAPHIC layer's zpos < 4).
667 * -------------------------------- graphic layer 3 <-- top most layer
668 * -------------------------------- graphic layer 2
669 * -------------------------------- graphic layer 1
670 * -------------------------------- graphic layer 0
671 * -------------------------------- video layer -1
672 * -------------------------------- video layer -2 <-- lowest layer
673 * @param[in] layer A layer object
674 * @param[out] zpos The zpos
675 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
676 * @see tdm_layer_set_video_pos, tdm_layer_capability
679 tdm_layer_get_zpos(tdm_layer *layer, int *zpos);
682 * @brief Set the property which has a given id.
683 * @param[in] layer A layer object
684 * @param[in] id The property id
685 * @param[in] value The value
686 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
689 tdm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
692 * @brief Get the property which has a given id.
693 * @param[in] layer A layer object
694 * @param[in] id The property id
695 * @param[out] value The value
696 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
699 tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
702 * @brief Set the geometry information to a layer object
703 * @details The geometry information will be applied when the output object
704 * of a layer object is committed. If a layer has TDM_LAYER_CAPABILITY_NO_CROP
705 * capability, a layer will ignore the pos(crop) information of #tdm_info_layer's
707 * @param[in] layer A layer object
708 * @param[in] info The geometry information
709 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
710 * @see tdm_layer_commit
713 tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info);
716 * @brief Get the geometry information to a layer object
717 * @param[in] layer A layer object
718 * @param[out] info The geometry information
719 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
722 tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info);
725 * @brief Set a TDM buffer to a layer object
726 * @details A TDM buffer will be applied when the output object
727 * of a layer object is committed.
728 * @param[in] layer A layer object
729 * @param[in] buffer A TDM buffer
730 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
731 * @see tdm_layer_commit
734 tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer);
737 * @brief Unset a TDM buffer from a layer object
738 * @details When this function is called, a current showing buffer will be
739 * disappeared from screen. Then nothing is showing on a layer object.
740 * @param[in] layer A layer object
741 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
744 tdm_layer_unset_buffer(tdm_layer *layer);
747 * @brief Commit changes for a layer object
748 * @details After all change of a layer object are applied, a user commit handler
750 * @param[in] layer A layer object
751 * @param[in] func A user commit handler
752 * @param[in] user_data The user data
753 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
756 tdm_layer_commit(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
759 tdm_layer_is_committing(tdm_layer *layer, unsigned int *committing);
762 * @brief Remove the user commit handler
763 * @param[in] layer A layer object
764 * @param[in] func A user commit handler
765 * @param[in] user_data The user data
766 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
769 tdm_layer_remove_commit_handler(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
772 * @brief Get a displaying TDM buffer from a layer object
773 * @details A displaying TDM buffer is a current showing buffer on screen
774 * that is set to layer object and applied output object of a layer object.
775 * @param[in] layer A layer object
776 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
777 * @return A TDM buffer if success. Otherwise, NULL.
780 tdm_layer_get_displaying_buffer(tdm_layer *layer, tdm_error *error);
783 * @brief Set a TBM surface_queue to a layer object
784 * @details A TBM surface_queue will be applied when the output object
785 * of a layer object is committed. and TDM layer will be automatically updated
786 * @param[in] layer A layer object
787 * @param[in] buffer_queue A TBM surface_queue
788 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
789 * @see tdm_layer_commit
792 tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue);
795 tdm_layer_get_own_buffer_queue(tdm_layer *layer, tbm_surface_queue_h *buffer_queue);
798 * @brief Unset a TBM surface_queue from a layer object
799 * @details When this function is called, a current surface_queue will be
800 * disappeared from screen. Then nothing is showing on a layer object.
801 * @param[in] layer A layer object
802 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
805 tdm_layer_unset_buffer_queue(tdm_layer *layer);
808 * @brief Check wheter a layer object is available for a frontend user to use.
809 * @details A layer object is not usable if a TDM buffer is showing on screen
810 * via this layer object. By calling #tdm_layer_unset_buffer, this layer object
811 * will become usable.
812 * @param[in] layer A layer object
813 * @param[out] usable 1 if usable, 0 if not usable
814 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
817 tdm_layer_is_usable(tdm_layer *layer, unsigned int *usable);
820 * @brief Set the relative zpos to a VIDEO layer object
821 * @details The zpos value is less than the minimum zpos of GRAPHIC layers, or
822 * it is more than the maximum zpos of GRAPHIC layers.
823 * @param[in] layer A VIDEO layer object
824 * @param[in] zpos The zpos
825 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
826 * @see tdm_layer_get_zpos, tdm_layer_capability
829 tdm_layer_set_video_pos(tdm_layer *layer, int zpos);
832 * @brief Create a capture object of a layer object
833 * @param[in] layer A layer object
834 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
835 * @return A capture object
836 * @see tdm_capture_destroy
839 tdm_layer_create_capture(tdm_layer *layer, tdm_error *error);
842 * @brief Get buffer flags from a layer object
843 * @param[in] layer A layer object
844 * @param[out] flags a buffer flags value
845 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
848 tdm_layer_get_buffer_flags(tdm_layer *layer, unsigned int *flags);
851 * @brief Creates a new window on the given hwc.
852 * @param[in] hwc A hwc object
853 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
854 * @return A created window object
858 tdm_hwc_create_window(tdm_hwc *hwc, tdm_error *error);
861 * @brief Get the supported format array for hwc windows of a hwc object.
862 * @param[in] hwc A output hwc
863 * @param[out] formats The available format array
864 * @param[out] count The count of formats
865 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
868 tdm_hwc_get_supported_formats(tdm_hwc *hwc, const tbm_format **formats, int *count);
871 * @brief Get the available property array of a hwc object.
872 * @param[in] hwc A hwc
873 * @param[out] props The available property array
874 * @param[out] count The count of properties
875 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
878 tdm_hwc_get_available_properties(tdm_hwc *hwc, const tdm_prop **props, int *count);
881 * @brief Get a target buffer queue
882 * @details Buffers from target buffer queue will receive the output of
883 * client composition. Window marked as TDM_COMPOSITION_CLIENT or
884 * TDM_COMPOSITION_DEVICE_CANDIDATE will be composited into this buffers
885 * prior to the call to tdm_output_commit().
886 * @param[in] output A output object
887 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
888 * @return A buffer queue
892 tdm_hwc_get_client_target_buffer_queue(tdm_hwc *hwc, tdm_error *error);
895 * @brief Set the client(relative to the TDM) target buffer
896 * @details Sets the buffer which will receive the output of client composition.
897 * Window marked as TDM_COMPOSITION_CLIENT or TDM_COMPOSITION_DEVICE_CANDIDATE
898 * will be composited into this buffer prior to the call to tdm_output_commit(),
899 * and windows not marked as TDM_COMPOSITION_CLIENT and
900 * TDM_COMPOSITION_DEVICE_CANDIDATE should be composited with this buffer by the
903 * The buffer handle provided may be null if no windows are being composited by
904 * the client. This must not result in an error (unless an invalid display
905 * handle is also provided).
907 * The damage parameter describes a buffer damage region as defined in the
908 * description of tdm_hwc_window_set_buffer_damage().
910 * List of composited hwc_windows (hwc_windows which buffers are presented on #target_buffer)
911 * should be passed along with #target_buffer to allow tdm to make the smooth transition
912 * from a DEVICE type to a CLIENT type.
914 * Should be called before tdm_output_commit() if any of the layers are marked as
915 * TDM_COMPOSITION_CLIENT or TDM_COMPOSITION_DEVICE_CANDIDATE. If no layers are
916 * so marked, then it is not necessary to call this function. It is not necessary
917 * to call tdm_hwc_validate() after changing the target through this function.
918 * @param[in] hwc A output hwc
919 * @param[in] target_buffer The new target buffer
920 * @param[in] damage The buffer damage region
921 * @param[in] composited_wnds The array of composited hwc_wnds
922 * @param[in] num_wnds The size of #composited_wnds array
923 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
927 tdm_hwc_set_client_target_buffer(tdm_hwc *hwc, tbm_surface_h target_buffer, tdm_region damage);
930 * @brief Validate the output
931 * @details Instructs the device to inspect all of the layer state and
932 * determine if there are any composition type changes necessary before
933 * presenting the output. Permitted changes are described in the definition
934 * of tdm_hwc_window_composition_t above.
935 * @param[in] output A output object
936 * @param[out] num_types The number of composition type changes required by
937 * the device; if greater than 0, the client must either set and validate new
938 * types, or call tdm_hwc_accept_changes() to accept the changes returned by
939 * tdm_hwc_get_changed_composition_types(); must be the same as the number of
940 * changes returned by tdm_hwc_get_changed_composition_types (see the
941 * declaration of that function for more information); pointer will be non-NULL
942 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
946 tdm_hwc_validate(tdm_hwc *hwc, tdm_hwc_window **composited_wnds, uint32_t num_wnds,
947 uint32_t *num_types);
950 * @brief Get changed composition types
951 * @details Retrieves the windows for which the device requires a different
952 * composition type than had been set prior to the last call to tdm_hwc_validate().
953 * The client will either update its state with these types and call
954 * tdm_hwc_accept_changes, or will set new types and attempt to validate the
956 * windows and types may be NULL to retrieve the number of elements which
957 * will be returned. The number of elements returned must be the same as the
958 * value returned in num_types from the last call to tdm_hwc_validate().
959 * @param[in] output A output object
960 * @param[out] num_elements If windows or types were NULL, the number of layers
961 * and types which would have been returned; if both were non-NULL, the
962 * number of elements returned in layers and types, which must not exceed
963 * the value stored in num_elements prior to the call; pointer will be
965 * @param[in] output A output object
966 * @param[out] windows An array of windows
967 * @param[out] composition_types An array of composition types, each corresponding
968 * to an element of windows
969 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
973 tdm_hwc_get_changed_composition_types(tdm_hwc *hwc, uint32_t *num_elements,
974 tdm_hwc_window **hwc_window,
975 tdm_hwc_window_composition *composition_types);
978 * @brief Accepts the changes required by the device
979 * @details Accepts the changes required by the device from the previous
980 * tdm_hwc_validate() call (which may be queried using
981 * tdm_hwc_get_chaged_composition_types()) and revalidates the display. This
982 * function is equivalent to requesting the changed types from
983 * tdm_hwc_get_chaged_composition_types(), setting those types on the
984 * corresponding windows, and then calling tdm_hwc_validate again.
985 * After this call it must be valid to present this display. Calling this after
986 * tdm_hwc_validate() returns 0 changes must succeed with TDM_ERROR_NONE, but
987 * should have no other effect.
988 * @param[in] output A output object
989 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
993 tdm_hwc_accept_changes(tdm_hwc *hwc);
996 * @brief Commit changes for a hwc
997 * @details After all change of a window object are applied, a user commit handler
999 * @param[in] hwc A hwc object
1000 * @param[in] sync 0: asynchronous, 1:synchronous
1001 * @param[in] func A user commit handler
1002 * @param[in] user_data The user data
1003 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1006 tdm_hwc_commit(tdm_hwc *hwc, int sync, tdm_hwc_commit_handler func, void *user_data);
1009 * @brief Destroys the given window.
1010 * @param[in] output A output object
1011 * @param[in] window the pointer of the window to destroy
1015 tdm_hwc_window_destroy(tdm_hwc_window *hwc_window);
1018 * @brief Get a buffer queue for the window object
1019 * @details These buffers are used to composite by hardware a client content in
1021 * @param[in] hwc_window A window object
1022 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1023 * @return A tbm buffer queue
1027 tdm_hwc_window_get_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error);
1030 * @brief Sets the desired composition type of the given window.
1031 * @details During tdm_hwc_validate(), the device may request changes to
1032 * the composition types of any of the layers as described in the definition
1033 * of tdm_hwc_window_composition_t above.
1034 * @param[in] hwc_window A window object
1035 * @param[in] composition_type The new composition type
1036 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1040 tdm_hwc_window_set_composition_type(tdm_hwc_window *hwc_window,
1041 tdm_hwc_window_composition composition_type);
1044 * @brief Set the buffer damage
1045 * @details Provides the region of the source buffer which has been modified
1046 * since the last frame. This region does not need to be validated before
1047 * calling tdm_output_commit().
1048 * Once set through this function, the damage region remains the same until a
1049 * subsequent call to this function.
1050 * If damage.num_rects > 0, then it may be assumed that any portion of the source
1051 * buffer not covered by one of the rects has not been modified this frame. If
1052 * damage.num_rects == 0, then the whole source buffer must be treated as if it
1053 * has been modified.
1054 * If the layer's contents are not modified relative to the prior frame, damage
1055 * will contain exactly one empty rect([0, 0, 0, 0]).
1056 * The damage rects are relative to the pre-transformed buffer, and their origin
1057 * is the top-left corner. They will not exceed the dimensions of the latched
1059 * @param[in] hwc_window A window object
1060 * @param[in] damage The new buffer damage region
1061 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1065 tdm_hwc_window_set_buffer_damage(tdm_hwc_window *hwc_window, tdm_region damage);
1068 * @brief Set the information to a window object
1069 * @details The information will be applied when the output object of a window
1070 * object is committed.
1071 * @param[in] hwc_window A window object
1072 * @param[in] info The information
1073 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1077 tdm_hwc_window_set_info(tdm_hwc_window *hwc_window, tdm_hwc_window_info *info);
1080 * @brief Set a TBM buffer to a window object
1081 * @details A TBM buffer will be applied when the output object of a layer
1082 * object is committed.
1083 * @param[in] hwc_window A window object
1084 * @param[in] buffer A TDM buffer
1085 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1086 * @return #TDM_ERROR_BUSY if #hwc_window can't be updated right now, this
1087 * can happen if #hwc_window is involved in the smooth transition from
1088 * DEVICE to CLIENT, this shouldn't be interpreted like some critical error.
1092 tdm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer);
1095 * @brief Get the property which has a given id.
1096 * @param[in] hwc window A hwc window object
1097 * @param[in] id The property id
1098 * @param[out] value The value
1099 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1102 tdm_hwc_window_get_property(tdm_hwc_window *hwc_window, uint32_t id, tdm_value *value);
1105 * @brief Set the property which has a given id.
1106 * @param[in] hwc window A hwc window object
1107 * @param[in] id The property id
1108 * @param[in] value The value
1109 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1112 tdm_hwc_window_set_property(tdm_hwc_window *hwc_window, uint32_t id, tdm_value value);
1115 * @brief Destroy a pp object
1116 * @param[in] pp A pp object
1117 * @see tdm_display_create_pp
1120 tdm_pp_destroy(tdm_pp *pp);
1123 * @brief Set the geometry information to a pp object
1124 * @param[in] pp A pp object
1125 * @param[in] info The geometry information
1126 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1127 * @see tdm_pp_commit
1130 tdm_pp_set_info(tdm_pp *pp, tdm_info_pp *info);
1133 * @brief Set the PP done handler to a pp object
1135 * The user PP done handler will be called after converting a source buffer's image
1136 * to a destination buffer.
1137 * @param[in] pp A pp object
1138 * @param[in] func A user PP done handler
1139 * @param[in] user_data The user data
1140 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1143 tdm_pp_set_done_handler(tdm_pp *pp, tdm_pp_done_handler func, void *user_data);
1146 * @brief Attach a source buffer and a destination buffer to a pp object
1147 * @param[in] pp A pp object
1148 * @param[in] src A source buffer
1149 * @param[in] dst A destination buffer
1150 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1151 * @see tdm_pp_commit, tdm_pp_set_done_handler
1154 tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
1157 * @brief Commit changes for a pp object
1158 * @param[in] pp A pp object
1159 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1162 tdm_pp_commit(tdm_pp *pp);
1165 * @brief Destroy a capture object
1166 * @param[in] capture A capture object
1167 * @see tdm_output_create_capture, tdm_layer_create_capture
1170 tdm_capture_destroy(tdm_capture *capture);
1173 * @brief Set the geometry information to a capture object
1174 * @param[in] capture A capture object
1175 * @param[in] info The geometry information
1176 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1177 * @see tdm_capture_commit
1180 tdm_capture_set_info(tdm_capture *capture, tdm_info_capture *info);
1183 * @brief Set the capture done handler to a capture object
1185 * The user capture done handler will be called after capturing a screen into a
1187 * @param[in] capture A capture object
1188 * @param[in] func A user capture done handler
1189 * @param[in] user_data The user data
1190 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1193 tdm_capture_set_done_handler(tdm_capture *capture, tdm_capture_done_handler func, void *user_data);
1196 * @brief Attach a TDM buffer to a capture object
1197 * @param[in] capture A capture object
1198 * @param[in] buffer A TDM buffer
1199 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1200 * @see tdm_capture_commit, tdm_capture_set_done_handler
1203 tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer);
1206 * @brief Commit changes for a capture object
1207 * @param[in] capture A capture object
1208 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1211 tdm_capture_commit(tdm_capture *capture);
1214 * @brief The release handler of a TDM buffer
1215 * @param[in] buffer A TDM buffer
1216 * @param[in] user_data user data
1217 * @see tdm_buffer_add_release_handler, tdm_buffer_remove_release_handler
1219 typedef void (*tdm_buffer_release_handler)(tbm_surface_h buffer,
1223 * @brief Add a release handler to a TDM buffer
1225 * TDM has its own buffer release mechanism to let an frontend user know when a TDM buffer
1226 * becomes available for a next job. A TDM buffer can be used for TDM to show
1227 * it on screen or to capture an output and a layer. After all operations,
1228 * TDM will release it immediately when TDM doesn't need it any more.
1229 * @param[in] buffer A TDM buffer
1230 * @param[in] func A release handler
1231 * @param[in] user_data user data
1232 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1233 * @see tdm_buffer_remove_release_handler
1236 tdm_buffer_add_release_handler(tbm_surface_h buffer,
1237 tdm_buffer_release_handler func, void *user_data);
1240 * @brief Remove a release handler from a TDM buffer
1241 * @param[in] buffer A TDM buffer
1242 * @param[in] func A release handler
1243 * @param[in] user_data user data
1244 * @see tdm_buffer_add_release_handler
1247 tdm_buffer_remove_release_handler(tbm_surface_h buffer,
1248 tdm_buffer_release_handler func, void *user_data);
1251 * @brief The handler of a vblank object
1252 * @see #tdm_vblank_wait, #tdm_vblank_wait_seq
1254 typedef void (*tdm_vblank_handler)(tdm_vblank *vblank, tdm_error error, unsigned int sequence,
1255 unsigned int tv_sec, unsigned int tv_usec, void *user_data);
1258 * @brief Set the vblank fps for the given PID and name.
1259 * @param[in] pid The process ID
1260 * @param[in] name The client vblank name
1261 * @param[in] fps The client vblank fps
1262 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1265 tdm_vblank_set_client_vblank_fps(unsigned int pid, const char *name, unsigned int fps);
1268 * @brief Set the ignore global fps for the given PID and name.
1269 * @param[in] pid The process ID
1270 * @param[in] name The client vblank name
1271 * @param[in] ignore 1: ignore 0:not ignore(default)
1272 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1275 tdm_vblank_set_client_ignore_global_fps(unsigned int pid, const char *name, unsigned int ignore);
1278 * @brief Set the vblank global fps for the entire system.
1279 * @param[in] enable 1:enable, 0:disable
1280 * @param[in] fps The vblank global fps
1282 * This global fps will be applied to all client's vblanks for all outputs.
1283 * If the client's vblank fps is less than this, the global fps will be ignored
1284 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1285 * the global fps, it will be ignored also.
1286 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1289 tdm_vblank_enable_global_fps(unsigned int enable, unsigned int fps);
1292 * @brief Add the vblank create handler.
1293 * @param[in] dpy A display object
1294 * @param[in] func The user vblank create handler
1295 * @param[in] user_data The user data
1297 * The user vblank create handler will be called when new vblank object created.
1298 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1301 tdm_vblank_add_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1304 * @brief Remove the vblank create handler.
1305 * @param[in] dpy A display object
1306 * @param[in] func The user vblank create handler
1307 * @param[in] user_data The user data
1308 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1311 tdm_vblank_remove_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1314 * @brief Create a vblank object
1315 * @param[in] dpy A display object
1316 * @param[in] output A output object
1317 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1318 * @return A vblank object
1319 * @see #tdm_vblank_destroy
1322 tdm_vblank_create(tdm_display *dpy, tdm_output *output, tdm_error *error);
1325 * @brief Destroy a vblank object
1326 * @param[in] vblank A vblank object
1327 * @see #tdm_vblank_create
1330 tdm_vblank_destroy(tdm_vblank *vblank);
1333 * @brief Get a output object of a vblank object
1334 * @param[in] vblank A vblank object
1335 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1336 * @return A TDM output object if success. Otherwise, NULL.
1337 * @see #tdm_vblank_create
1340 tdm_vblank_get_output(tdm_vblank *vblank, tdm_error *error);
1343 * @brief Get the client PID for a vblank object
1344 * @param[in] vblank A vblank object
1345 * @param[out] pid PID of vblank's client
1346 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1349 tdm_vblank_get_client_pid(tdm_vblank *vblank, pid_t *pid);
1352 * @brief Set the name to a vblank object
1353 * @details The default name is "unknown"
1354 * @param[in] vblank A vblank object
1355 * @param[in] name vblank name
1356 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1359 tdm_vblank_set_name(tdm_vblank *vblank, const char *name);
1362 * @brief Get the name for a vblank object
1363 * @details The default name is "unknown"
1364 * @param[in] vblank A vblank object
1365 * @param[out] name vblank name
1366 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1369 tdm_vblank_get_name(tdm_vblank *vblank, const char **name);
1372 * @brief Set the fps to a vblank object
1373 * @details Default is the @b vertical @b refresh @b rate of the given output.
1374 * It could be ignored when the fixed fps is set by #tdm_vblank_set_fixed_fps
1375 * @param[in] vblank A vblank object
1376 * @param[in] fps over 0
1377 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1380 tdm_vblank_set_fps(tdm_vblank *vblank, unsigned int fps);
1383 * @brief Get the fps for a vblank object
1384 * @param[in] vblank A vblank object
1385 * @param[out] fps over 0
1386 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1389 tdm_vblank_get_fps(tdm_vblank *vblank, unsigned int *fps);
1392 * @brief Set the fixed fps to a vblank object
1394 * It could be ignored when the global fps is set by #tdm_vblank_enable_global_fps
1395 * @param[in] vblank A vblank object
1396 * @param[in] fps over 0
1397 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1400 tdm_vblank_set_fixed_fps(tdm_vblank *vblank, unsigned int fps);
1403 * @brief Ignore the vblank global fps
1405 * The global fps will be applied to all client's vblanks for all outputs.
1406 * If the client's vblank fps is less than this, the global fps will be ignored
1407 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1408 * the global fps, it will be ignored also.
1409 * @param[in] vblank A vblank object
1410 * @param[in] ignore 1: ignore 0:not ignore(default)
1411 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1414 tdm_vblank_ignore_global_fps(tdm_vblank *vblank, unsigned int ignore);
1417 * @brief Set the offset(milli-second) to a vblank object
1418 * @details Default is @b 0.
1419 * @param[in] vblank A vblank object
1420 * @param[in] offset the offset(milli-second)
1421 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1424 tdm_vblank_set_offset(tdm_vblank *vblank, int offset);
1427 * @brief Get the offset(milli-second) for a vblank object
1428 * @param[in] vblank A vblank object
1429 * @param[out] offset the offset(milli-second)
1430 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1433 tdm_vblank_get_offset(tdm_vblank *vblank, int *offset);
1436 * @brief Enable/Disable the fake vblank to a vblank object
1438 * If enable_fake == 0, #tdm_vblank_wait will return TDM_ERROR_DPMS_OFF
1439 * when DPMS off. Otherwise, #tdm_vblank_wait will return TDM_ERROR_NONE
1441 * @param[in] vblank A vblank object
1442 * @param[in] enable_fake 1:enable, 0:disable
1443 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1446 tdm_vblank_set_enable_fake(tdm_vblank *vblank, unsigned int enable_fake);
1449 * @brief Get the fake vblank
1450 * @param[in] vblank A vblank object
1451 * @param[out] enable_fake 1:enable, 0:disable
1452 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1455 tdm_vblank_get_enable_fake(tdm_vblank *vblank, unsigned int *enable_fake);
1458 * @brief Wait for a vblank
1460 * Once #tdm_vblank_wait returns TDM_ERROR_NONE, the user vblank handler(#tdm_vblank_handler)
1461 * SHOULD be called after the given interval. \n
1462 * The sequence value of tdm_vblank_handler is the relative value of fps.
1463 * If fps = 10, this sequence value should be increased by 10 during 1 second.
1464 * @param[in] vblank A vblank object
1465 * @param[in] req_sec The vblank request time(second)
1466 * @param[in] req_usec The vblank request time(micro-second)
1467 * @param[in] interval The vblank interval
1468 * @param[in] func The user vblank handler
1469 * @param[in] user_data The user data
1470 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1473 tdm_vblank_wait(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1474 unsigned int interval, tdm_vblank_handler func, void *user_data);
1477 * @brief Wait for a vblank with the target sequence number
1478 * @param[in] vblank A vblank object
1479 * @param[in] req_sec The vblank request time(second)
1480 * @param[in] req_usec The vblank request time(micro-second)
1481 * @param[in] sequence The target sequence number
1482 * @param[in] func The user client vblank handler
1483 * @param[in] user_data The user data
1484 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1487 tdm_vblank_wait_seq(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1488 unsigned int sequence, tdm_vblank_handler func, void *user_data);
1494 #endif /* _TDM_H_ */