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 * @brief Get the connection type of a output object.
329 * @param[in] output A output object
330 * @param[out] type The connection type.
331 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
334 tdm_output_get_output_type(tdm_output *output, tdm_output_type *type);
337 * @brief Get the layer counts which a output object has.
338 * @param[in] output A output object
339 * @param[out] count The count of layers
340 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
341 * @see tdm_output_get_layer
344 tdm_output_get_layer_count(tdm_output *output, int *count);
347 * @brief Get a layer object which has the given index.
348 * @param[in] output A output object
349 * @param[in] index The index of a layer object
350 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
351 * @return A layer object if success. Otherwise, NULL.
352 * @see tdm_output_get_layer_count
355 tdm_output_get_layer(tdm_output *output, int index, tdm_error *error);
358 * @brief Get the available property array of a output object.
359 * @param[in] output A output object
360 * @param[out] props The available property array
361 * @param[out] count The count of properties
362 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
365 tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props,
369 * @brief Get the available mode array of a output object.
370 * @param[in] output A output object
371 * @param[out] modes The available mode array
372 * @param[out] count The count of modes
373 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
376 tdm_output_get_available_modes(tdm_output *output,
377 const tdm_output_mode **modes, int *count);
380 * @brief Get the available size of a output object.
381 * @details -1 means that a TDM backend module doesn't define the value.
382 * @param[in] output A output object
383 * @param[out] min_w The minimum width which TDM can handle
384 * @param[out] min_h The minimum height which TDM can handle
385 * @param[out] max_w The maximum width which TDM can handle
386 * @param[out] max_h The maximum height which TDM can handle
387 * @param[out] preferred_align The preferred align width which TDM can handle
388 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
391 tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h,
392 int *max_w, int *max_h, int *preferred_align);
395 * @brief Get the available cursor size of a output object.
396 * @details -1 means that a TDM backend module doesn't define the value.
397 * @param[in] output A output object
398 * @param[out] min_w The minimum width which TDM can handle
399 * @param[out] min_h The minimum height which TDM can handle
400 * @param[out] max_w The maximum width which TDM can handle
401 * @param[out] max_h The maximum height which TDM can handle
402 * @param[out] preferred_align The preferred align width which TDM can handle
403 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
406 tdm_output_get_cursor_available_size(tdm_output *output, int *min_w, int *min_h,
407 int *max_w, int *max_h, int *preferred_align);
410 * @brief Get the physical size of a output object.
411 * @param[in] output A output object
412 * @param[out] mmWidth The milimeter width
413 * @param[out] mmHeight The milimeter height
414 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
417 tdm_output_get_physical_size(tdm_output *output, unsigned int *mmWidth,
418 unsigned int *mmHeight);
421 * @brief Get the subpixel of a output object.
422 * @param[in] output A output object
423 * @param[out] subpixel The subpixel
424 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
427 tdm_output_get_subpixel(tdm_output *output, unsigned int *subpixel);
430 * @brief Get the pipe of a output object.
431 * @param[in] output A output object
432 * @param[out] pipe The pipe
433 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
436 tdm_output_get_pipe(tdm_output *output, unsigned int *pipe);
439 * @brief Get the index of a primary layer.
440 * @param[in] output A output object
441 * @param[out] index The primary layer index
442 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
445 tdm_output_get_primary_index(tdm_output *output, int *index);
448 * @brief Set the property which has a given id.
449 * @param[in] output A output object
450 * @param[in] id The property id
451 * @param[in] value The value
452 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
455 tdm_output_set_property(tdm_output *output, unsigned int id, tdm_value value);
458 * @brief Get the property which has a given id
459 * @param[in] output A output object
460 * @param[in] id The property id
461 * @param[out] value The value
462 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
465 tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value);
468 * @brief Wait for VBLANK
469 * @details After interval vblanks, a user vblank handler will be called.
470 * @param[in] output A output object
471 * @param[in] interval vblank interval
472 * @param[in] sync 0: asynchronous, 1:synchronous
473 * @param[in] func A user vblank handler
474 * @param[in] user_data The user data
475 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
476 * @see #tdm_output_vblank_handler
479 tdm_output_wait_vblank(tdm_output *output, int interval, int sync,
480 tdm_output_vblank_handler func, void *user_data);
483 * @brief Commit changes for a output object
484 * @details After all change of a output object are applied, a user commit handler
486 * @param[in] output A output object
487 * @param[in] sync 0: asynchronous, 1:synchronous
488 * @param[in] func A user commit handler
489 * @param[in] user_data The user data
490 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
491 * @see #tdm_layer_commit
494 tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func,
498 * @brief Remove the user vblank handler
499 * @param[in] output A output object
500 * @param[in] func A user vblank handler
501 * @param[in] user_data The user data
502 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
505 tdm_output_remove_vblank_handler(tdm_output *output, tdm_output_vblank_handler func, void *user_data);
508 * @brief Remove the user commit handler
509 * @param[in] output A output object
510 * @param[in] func A user commit handler
511 * @param[in] user_data The user data
512 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
515 tdm_output_remove_commit_handler(tdm_output *output, tdm_output_commit_handler func, void *user_data);
518 * @brief Set one of available modes of a output object
519 * @param[in] output A output object
520 * @param[in] mode A output mode
521 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
524 tdm_output_set_mode(tdm_output *output, const tdm_output_mode *mode);
527 * @brief Get the mode of a output object
528 * @param[in] output A output object
529 * @param[out] mode A output mode
530 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
533 tdm_output_get_mode(tdm_output *output, const tdm_output_mode **mode);
536 * @brief Set DPMS of a output object synchronously
537 * @param[in] output A output object
538 * @param[in] dpms_value DPMS value
539 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
540 * @see tdm_output_set_dpms_async
543 tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value);
546 * @brief Set DPMS of a output object asynchronously
547 * @details This function can be used when a output supports the asynchronous DPMS
548 * control. The output has #TDM_OUTPUT_CAPABILITY_ASYNC_DPMS flags which
549 * #tdm_output_get_capabilities returns. If an output change handler is added with
550 * #tdm_output_add_change_handler, the output change handler will be called when
551 * the DPMS status is changed indeed.
552 * @param[in] output A output object
553 * @param[in] dpms_value DPMS value
554 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
555 * @see tdm_output_add_change_handler, tdm_output_set_dpms,
556 * tdm_output_get_capabilities, #TDM_OUTPUT_CAPABILITY_ASYNC_DPMS.
559 tdm_output_set_dpms_async(tdm_output *output, tdm_output_dpms dpms_value);
562 * @brief Get DPMS of a output object
563 * @param[in] output A output object
564 * @param[out] dpms_value DPMS value
565 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
568 tdm_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value);
571 * @brief Check if a output object has the capture capability
572 * @param[in] output A output object
573 * @param[out] has_capability 1: has the capability, 0: not has the capability
574 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
577 tdm_output_has_capture_capability(tdm_output *output, unsigned int *has_capability);
580 * @brief Create a capture object of a output object
581 * @param[in] output A output object
582 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
583 * @return A capture object
584 * @see tdm_capture_destroy
587 tdm_output_create_capture(tdm_output *output, tdm_error *error);
590 * @brief Get a hwc associated with 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 hwc object
597 tdm_output_get_hwc(tdm_output *output, tdm_error *error);
600 * @brief Get a output object of a layer object
601 * @param[in] layer A layer object
602 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
603 * @return A TDM output object if success. Otherwise, NULL.
606 tdm_layer_get_output(tdm_layer *layer, tdm_error *error);
609 * @brief Get the index of a layer object.
610 * @param[in] layer A layer object
611 * @param[out] index The index of a layer object
612 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
615 tdm_layer_get_index(tdm_layer *layer, int *index);
618 * @brief Get the capabilities of a layer object.
619 * @param[in] layer A layer object
620 * @param[out] capabilities The capabilities of a layer object
621 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
624 tdm_layer_get_capabilities(tdm_layer *layer,
625 tdm_layer_capability *capabilities);
628 * @brief Get the available format array of a layer object.
629 * @param[in] layer A layer object
630 * @param[out] formats The available format array
631 * @param[out] count The count of formats
632 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
635 tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats,
639 * @brief Get the available property array of a layer object.
640 * @param[in] layer A layer object
641 * @param[out] props The available property array
642 * @param[out] count The count of properties
643 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
646 tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props,
650 * @brief Get the zpos of a layer object.
652 * - GRAPHIC layers have fixed zpos. It starts from 0. It's @b non-changeable.
653 * - But the zpos of VIDEO layers will be decided by a backend module side.
654 * - A frontend user only can set the relative zpos to VIDEO layers via #tdm_layer_set_video_pos
655 * - The zpos of video layers is less than GRAPHIC layers or more than GRAPHIC
656 * layers. ie, ..., -2, -1, 4, 5, ... (if 0 <= GRAPHIC layer's zpos < 4).
657 * -------------------------------- graphic layer 3 <-- top most layer
658 * -------------------------------- graphic layer 2
659 * -------------------------------- graphic layer 1
660 * -------------------------------- graphic layer 0
661 * -------------------------------- video layer -1
662 * -------------------------------- video layer -2 <-- lowest layer
663 * @param[in] layer A layer object
664 * @param[out] zpos The zpos
665 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
666 * @see tdm_layer_set_video_pos, tdm_layer_capability
669 tdm_layer_get_zpos(tdm_layer *layer, int *zpos);
672 * @brief Set the property which has a given id.
673 * @param[in] layer A layer object
674 * @param[in] id The property id
675 * @param[in] value The value
676 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
679 tdm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
682 * @brief Get the property which has a given id.
683 * @param[in] layer A layer object
684 * @param[in] id The property id
685 * @param[out] value The value
686 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
689 tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
692 * @brief Set the geometry information to a layer object
693 * @details The geometry information will be applied when the output object
694 * of a layer object is committed. If a layer has TDM_LAYER_CAPABILITY_NO_CROP
695 * capability, a layer will ignore the pos(crop) information of #tdm_info_layer's
697 * @param[in] layer A layer object
698 * @param[in] info The geometry information
699 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
700 * @see tdm_layer_commit
703 tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info);
706 * @brief Get the geometry information to a layer object
707 * @param[in] layer A layer object
708 * @param[out] info The geometry information
709 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
712 tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info);
715 * @brief Set a TDM buffer to a layer object
716 * @details A TDM buffer will be applied when the output object
717 * of a layer object is committed.
718 * @param[in] layer A layer object
719 * @param[in] buffer A TDM buffer
720 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
721 * @see tdm_layer_commit
724 tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer);
727 * @brief Unset a TDM buffer from a layer object
728 * @details When this function is called, a current showing buffer will be
729 * disappeared from screen. Then nothing is showing on a layer object.
730 * @param[in] layer A layer object
731 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
734 tdm_layer_unset_buffer(tdm_layer *layer);
737 * @brief Commit changes for a layer object
738 * @details After all change of a layer object are applied, a user commit handler
740 * @param[in] layer A layer object
741 * @param[in] func A user commit handler
742 * @param[in] user_data The user data
743 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
746 tdm_layer_commit(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
749 tdm_layer_is_committing(tdm_layer *layer, unsigned int *committing);
752 * @brief Remove the user commit handler
753 * @param[in] layer A layer object
754 * @param[in] func A user commit handler
755 * @param[in] user_data The user data
756 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
759 tdm_layer_remove_commit_handler(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
762 * @brief Get a displaying TDM buffer from a layer object
763 * @details A displaying TDM buffer is a current showing buffer on screen
764 * that is set to layer object and applied output object of a layer object.
765 * @param[in] layer A layer object
766 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
767 * @return A TDM buffer if success. Otherwise, NULL.
770 tdm_layer_get_displaying_buffer(tdm_layer *layer, tdm_error *error);
773 * @brief Set a TBM surface_queue to a layer object
774 * @details A TBM surface_queue will be applied when the output object
775 * of a layer object is committed. and TDM layer will be automatically updated
776 * @param[in] layer A layer object
777 * @param[in] buffer_queue A TBM surface_queue
778 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
779 * @see tdm_layer_commit
782 tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue);
785 tdm_layer_get_own_buffer_queue(tdm_layer *layer, tbm_surface_queue_h *buffer_queue);
788 * @brief Unset a TBM surface_queue from a layer object
789 * @details When this function is called, a current surface_queue will be
790 * disappeared from screen. Then nothing is showing on a layer object.
791 * @param[in] layer A layer object
792 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
795 tdm_layer_unset_buffer_queue(tdm_layer *layer);
798 * @brief Check wheter a layer object is available for a frontend user to use.
799 * @details A layer object is not usable if a TDM buffer is showing on screen
800 * via this layer object. By calling #tdm_layer_unset_buffer, this layer object
801 * will become usable.
802 * @param[in] layer A layer object
803 * @param[out] usable 1 if usable, 0 if not usable
804 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
807 tdm_layer_is_usable(tdm_layer *layer, unsigned int *usable);
810 * @brief Set the relative zpos to a VIDEO layer object
811 * @details The zpos value is less than the minimum zpos of GRAPHIC layers, or
812 * it is more than the maximum zpos of GRAPHIC layers.
813 * @param[in] layer A VIDEO layer object
814 * @param[in] zpos The zpos
815 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
816 * @see tdm_layer_get_zpos, tdm_layer_capability
819 tdm_layer_set_video_pos(tdm_layer *layer, int zpos);
822 * @brief Create a capture object of a layer object
823 * @param[in] layer A layer object
824 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
825 * @return A capture object
826 * @see tdm_capture_destroy
829 tdm_layer_create_capture(tdm_layer *layer, tdm_error *error);
832 * @brief Get buffer flags from a layer object
833 * @param[in] layer A layer object
834 * @param[out] flags a buffer flags value
835 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
838 tdm_layer_get_buffer_flags(tdm_layer *layer, unsigned int *flags);
841 * @brief Creates a new window on the given hwc.
842 * @param[in] hwc A hwc object
843 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
844 * @return A created window object
848 tdm_hwc_create_window(tdm_hwc *hwc, tdm_error *error);
851 * @brief Get the supported format array for hwc windows of a hwc object.
852 * @param[in] hwc A output hwc
853 * @param[out] formats The available format array
854 * @param[out] count The count of formats
855 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
858 tdm_hwc_get_supported_formats(tdm_hwc *hwc, const tbm_format **formats, int *count);
861 * @brief Get the available property array of a hwc object.
862 * @param[in] hwc A hwc
863 * @param[out] props The available property array
864 * @param[out] count The count of properties
865 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
868 tdm_hwc_get_available_properties(tdm_hwc *hwc, const tdm_prop **props, int *count);
871 * @brief Get a target buffer queue
872 * @details Buffers from target buffer queue will receive the output of
873 * client composition. Window marked as TDM_COMPOSITION_CLIENT or
874 * TDM_COMPOSITION_DEVICE_CANDIDATE will be composited into this buffers
875 * prior to the call to tdm_output_commit().
876 * @param[in] output A output object
877 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
878 * @return A buffer queue
882 tdm_hwc_get_client_target_buffer_queue(tdm_hwc *hwc, tdm_error *error);
885 * @brief Set the client(relative to the TDM) target buffer
886 * @details Sets the buffer which will receive the output of client composition.
887 * Window marked as TDM_COMPOSITION_CLIENT or TDM_COMPOSITION_DEVICE_CANDIDATE
888 * will be composited into this buffer prior to the call to tdm_output_commit(),
889 * and windows not marked as TDM_COMPOSITION_CLIENT and
890 * TDM_COMPOSITION_DEVICE_CANDIDATE should be composited with this buffer by the
893 * The buffer handle provided may be null if no windows are being composited by
894 * the client. This must not result in an error (unless an invalid display
895 * handle is also provided).
897 * The damage parameter describes a buffer damage region as defined in the
898 * description of tdm_hwc_window_set_buffer_damage().
900 * List of composited hwc_windows (hwc_windows which buffers are presented on #target_buffer)
901 * should be passed along with #target_buffer to allow tdm to make the smooth transition
902 * from a DEVICE type to a CLIENT type.
904 * Should be called before tdm_output_commit() if any of the layers are marked as
905 * TDM_COMPOSITION_CLIENT or TDM_COMPOSITION_DEVICE_CANDIDATE. If no layers are
906 * so marked, then it is not necessary to call this function. It is not necessary
907 * to call tdm_hwc_validate() after changing the target through this function.
908 * @param[in] hwc A output hwc
909 * @param[in] target_buffer The new target buffer
910 * @param[in] damage The buffer damage region
911 * @param[in] composited_wnds The array of composited hwc_wnds
912 * @param[in] num_wnds The size of #composited_wnds array
913 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
917 tdm_hwc_set_client_target_buffer(tdm_hwc *hwc, tbm_surface_h target_buffer, tdm_region damage);
920 * @brief Validate the output
921 * @details Instructs the device to inspect all of the layer state and
922 * determine if there are any composition type changes necessary before
923 * presenting the output. Permitted changes are described in the definition
924 * of tdm_hwc_window_composition_t above.
925 * @param[in] output A output object
926 * @param[out] num_types The number of composition type changes required by
927 * the device; if greater than 0, the client must either set and validate new
928 * types, or call tdm_hwc_accept_changes() to accept the changes returned by
929 * tdm_hwc_get_changed_composition_types(); must be the same as the number of
930 * changes returned by tdm_hwc_get_changed_composition_types (see the
931 * declaration of that function for more information); pointer will be non-NULL
932 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
936 tdm_hwc_validate(tdm_hwc *hwc, tdm_hwc_window **composited_wnds, uint32_t num_wnds,
937 uint32_t *num_types);
940 * @brief Get changed composition types
941 * @details Retrieves the windows for which the device requires a different
942 * composition type than had been set prior to the last call to tdm_hwc_validate().
943 * The client will either update its state with these types and call
944 * tdm_hwc_accept_changes, or will set new types and attempt to validate the
946 * windows and types may be NULL to retrieve the number of elements which
947 * will be returned. The number of elements returned must be the same as the
948 * value returned in num_types from the last call to tdm_hwc_validate().
949 * @param[in] output A output object
950 * @param[out] num_elements If windows or types were NULL, the number of layers
951 * and types which would have been returned; if both were non-NULL, the
952 * number of elements returned in layers and types, which must not exceed
953 * the value stored in num_elements prior to the call; pointer will be
955 * @param[in] output A output object
956 * @param[out] windows An array of windows
957 * @param[out] composition_types An array of composition types, each corresponding
958 * to an element of windows
959 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
963 tdm_hwc_get_changed_composition_types(tdm_hwc *hwc, uint32_t *num_elements,
964 tdm_hwc_window **hwc_window,
965 tdm_hwc_window_composition *composition_types);
968 * @brief Accepts the changes required by the device
969 * @details Accepts the changes required by the device from the previous
970 * tdm_hwc_validate() call (which may be queried using
971 * tdm_hwc_get_chaged_composition_types()) and revalidates the display. This
972 * function is equivalent to requesting the changed types from
973 * tdm_hwc_get_chaged_composition_types(), setting those types on the
974 * corresponding windows, and then calling tdm_hwc_validate again.
975 * After this call it must be valid to present this display. Calling this after
976 * tdm_hwc_validate() returns 0 changes must succeed with TDM_ERROR_NONE, but
977 * should have no other effect.
978 * @param[in] output A output object
979 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
983 tdm_hwc_accept_changes(tdm_hwc *hwc);
986 * @brief Commit changes for a hwc
987 * @details After all change of a window object are applied, a user commit handler
989 * @param[in] hwc A hwc object
990 * @param[in] sync 0: asynchronous, 1:synchronous
991 * @param[in] func A user commit handler
992 * @param[in] user_data The user data
993 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
996 tdm_hwc_commit(tdm_hwc *hwc, int sync, tdm_hwc_commit_handler func, void *user_data);
999 * @brief Destroys the given window.
1000 * @param[in] output A output object
1001 * @param[in] window the pointer of the window to destroy
1005 tdm_hwc_window_destroy(tdm_hwc_window *hwc_window);
1008 * @brief Get a buffer queue for the window object
1009 * @details These buffers are used to composite by hardware a client content in
1011 * @param[in] hwc_window A window object
1012 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1013 * @return A tbm buffer queue
1017 tdm_hwc_window_get_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error);
1020 * @brief Sets the desired composition type of the given window.
1021 * @details During tdm_hwc_validate(), the device may request changes to
1022 * the composition types of any of the layers as described in the definition
1023 * of tdm_hwc_window_composition_t above.
1024 * @param[in] hwc_window A window object
1025 * @param[in] composition_type The new composition type
1026 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1030 tdm_hwc_window_set_composition_type(tdm_hwc_window *hwc_window,
1031 tdm_hwc_window_composition composition_type);
1034 * @brief Set the buffer damage
1035 * @details Provides the region of the source buffer which has been modified
1036 * since the last frame. This region does not need to be validated before
1037 * calling tdm_output_commit().
1038 * Once set through this function, the damage region remains the same until a
1039 * subsequent call to this function.
1040 * If damage.num_rects > 0, then it may be assumed that any portion of the source
1041 * buffer not covered by one of the rects has not been modified this frame. If
1042 * damage.num_rects == 0, then the whole source buffer must be treated as if it
1043 * has been modified.
1044 * If the layer's contents are not modified relative to the prior frame, damage
1045 * will contain exactly one empty rect([0, 0, 0, 0]).
1046 * The damage rects are relative to the pre-transformed buffer, and their origin
1047 * is the top-left corner. They will not exceed the dimensions of the latched
1049 * @param[in] hwc_window A window object
1050 * @param[in] damage The new buffer damage region
1051 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1055 tdm_hwc_window_set_buffer_damage(tdm_hwc_window *hwc_window, tdm_region damage);
1058 * @brief Set the information to a window object
1059 * @details The information will be applied when the output object of a window
1060 * object is committed.
1061 * @param[in] hwc_window A window object
1062 * @param[in] info The information
1063 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1067 tdm_hwc_window_set_info(tdm_hwc_window *hwc_window, tdm_hwc_window_info *info);
1070 * @brief Set a TBM buffer to a window object
1071 * @details A TBM buffer will be applied when the output object of a layer
1072 * object is committed.
1073 * @param[in] hwc_window A window object
1074 * @param[in] buffer A TDM buffer
1075 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1076 * @return #TDM_ERROR_BUSY if #hwc_window can't be updated right now, this
1077 * can happen if #hwc_window is involved in the smooth transition from
1078 * DEVICE to CLIENT, this shouldn't be interpreted like some critical error.
1082 tdm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer);
1085 * @brief Get the property which has a given id.
1086 * @param[in] hwc window A hwc window object
1087 * @param[in] id The property id
1088 * @param[out] value The value
1089 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1092 tdm_hwc_window_get_property(tdm_hwc_window *hwc_window, uint32_t id, tdm_value *value);
1095 * @brief Set 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[in] value The value
1099 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1102 tdm_hwc_window_set_property(tdm_hwc_window *hwc_window, uint32_t id, tdm_value value);
1105 * @brief Destroy a pp object
1106 * @param[in] pp A pp object
1107 * @see tdm_display_create_pp
1110 tdm_pp_destroy(tdm_pp *pp);
1113 * @brief Set the geometry information to a pp object
1114 * @param[in] pp A pp object
1115 * @param[in] info The geometry information
1116 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1117 * @see tdm_pp_commit
1120 tdm_pp_set_info(tdm_pp *pp, tdm_info_pp *info);
1123 * @brief Set the PP done handler to a pp object
1125 * The user PP done handler will be called after converting a source buffer's image
1126 * to a destination buffer.
1127 * @param[in] pp A pp object
1128 * @param[in] func A user PP done handler
1129 * @param[in] user_data The user data
1130 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1133 tdm_pp_set_done_handler(tdm_pp *pp, tdm_pp_done_handler func, void *user_data);
1136 * @brief Attach a source buffer and a destination buffer to a pp object
1137 * @param[in] pp A pp object
1138 * @param[in] src A source buffer
1139 * @param[in] dst A destination buffer
1140 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1141 * @see tdm_pp_commit, tdm_pp_set_done_handler
1144 tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
1147 * @brief Commit changes for a pp object
1148 * @param[in] pp A pp object
1149 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1152 tdm_pp_commit(tdm_pp *pp);
1155 * @brief Destroy a capture object
1156 * @param[in] capture A capture object
1157 * @see tdm_output_create_capture, tdm_layer_create_capture
1160 tdm_capture_destroy(tdm_capture *capture);
1163 * @brief Set the geometry information to a capture object
1164 * @param[in] capture A capture object
1165 * @param[in] info The geometry information
1166 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1167 * @see tdm_capture_commit
1170 tdm_capture_set_info(tdm_capture *capture, tdm_info_capture *info);
1173 * @brief Set the capture done handler to a capture object
1175 * The user capture done handler will be called after capturing a screen into a
1177 * @param[in] capture A capture object
1178 * @param[in] func A user capture done handler
1179 * @param[in] user_data The user data
1180 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1183 tdm_capture_set_done_handler(tdm_capture *capture, tdm_capture_done_handler func, void *user_data);
1186 * @brief Attach a TDM buffer to a capture object
1187 * @param[in] capture A capture object
1188 * @param[in] buffer A TDM buffer
1189 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1190 * @see tdm_capture_commit, tdm_capture_set_done_handler
1193 tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer);
1196 * @brief Commit changes for a capture object
1197 * @param[in] capture A capture object
1198 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1201 tdm_capture_commit(tdm_capture *capture);
1204 * @brief The release handler of a TDM buffer
1205 * @param[in] buffer A TDM buffer
1206 * @param[in] user_data user data
1207 * @see tdm_buffer_add_release_handler, tdm_buffer_remove_release_handler
1209 typedef void (*tdm_buffer_release_handler)(tbm_surface_h buffer,
1213 * @brief Add a release handler to a TDM buffer
1215 * TDM has its own buffer release mechanism to let an frontend user know when a TDM buffer
1216 * becomes available for a next job. A TDM buffer can be used for TDM to show
1217 * it on screen or to capture an output and a layer. After all operations,
1218 * TDM will release it immediately when TDM doesn't need it any more.
1219 * @param[in] buffer A TDM buffer
1220 * @param[in] func A release handler
1221 * @param[in] user_data user data
1222 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1223 * @see tdm_buffer_remove_release_handler
1226 tdm_buffer_add_release_handler(tbm_surface_h buffer,
1227 tdm_buffer_release_handler func, void *user_data);
1230 * @brief Remove a release handler from a TDM buffer
1231 * @param[in] buffer A TDM buffer
1232 * @param[in] func A release handler
1233 * @param[in] user_data user data
1234 * @see tdm_buffer_add_release_handler
1237 tdm_buffer_remove_release_handler(tbm_surface_h buffer,
1238 tdm_buffer_release_handler func, void *user_data);
1241 * @brief The handler of a vblank object
1242 * @see #tdm_vblank_wait, #tdm_vblank_wait_seq
1244 typedef void (*tdm_vblank_handler)(tdm_vblank *vblank, tdm_error error, unsigned int sequence,
1245 unsigned int tv_sec, unsigned int tv_usec, void *user_data);
1248 * @brief Set the vblank fps for the given PID and name.
1249 * @param[in] pid The process ID
1250 * @param[in] name The client vblank name
1251 * @param[in] fps The client vblank fps
1252 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1255 tdm_vblank_set_client_vblank_fps(unsigned int pid, const char *name, unsigned int fps);
1258 * @brief Set the ignore global 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] ignore 1: ignore 0:not ignore(default)
1262 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1265 tdm_vblank_set_client_ignore_global_fps(unsigned int pid, const char *name, unsigned int ignore);
1268 * @brief Set the vblank global fps for the entire system.
1269 * @param[in] enable 1:enable, 0:disable
1270 * @param[in] fps The vblank global fps
1272 * This global fps will be applied to all client's vblanks for all outputs.
1273 * If the client's vblank fps is less than this, the global fps will be ignored
1274 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1275 * the global fps, it will be ignored also.
1276 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1279 tdm_vblank_enable_global_fps(unsigned int enable, unsigned int fps);
1282 * @brief Add the vblank create handler.
1283 * @param[in] dpy A display object
1284 * @param[in] func The user vblank create handler
1285 * @param[in] user_data The user data
1287 * The user vblank create handler will be called when new vblank object created.
1288 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1291 tdm_vblank_add_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1294 * @brief Remove the vblank create handler.
1295 * @param[in] dpy A display object
1296 * @param[in] func The user vblank create handler
1297 * @param[in] user_data The user data
1298 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1301 tdm_vblank_remove_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1304 * @brief Create a vblank object
1305 * @param[in] dpy A display object
1306 * @param[in] output A output object
1307 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1308 * @return A vblank object
1309 * @see #tdm_vblank_destroy
1312 tdm_vblank_create(tdm_display *dpy, tdm_output *output, tdm_error *error);
1315 * @brief Destroy a vblank object
1316 * @param[in] vblank A vblank object
1317 * @see #tdm_vblank_create
1320 tdm_vblank_destroy(tdm_vblank *vblank);
1323 * @brief Get a output object of a vblank object
1324 * @param[in] vblank A vblank object
1325 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1326 * @return A TDM output object if success. Otherwise, NULL.
1327 * @see #tdm_vblank_create
1330 tdm_vblank_get_output(tdm_vblank *vblank, tdm_error *error);
1333 * @brief Get the client PID for a vblank object
1334 * @param[in] vblank A vblank object
1335 * @param[out] pid PID of vblank's client
1336 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1339 tdm_vblank_get_client_pid(tdm_vblank *vblank, pid_t *pid);
1342 * @brief Set the name to a vblank object
1343 * @details The default name is "unknown"
1344 * @param[in] vblank A vblank object
1345 * @param[in] name vblank name
1346 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1349 tdm_vblank_set_name(tdm_vblank *vblank, const char *name);
1352 * @brief Get the name for a vblank object
1353 * @details The default name is "unknown"
1354 * @param[in] vblank A vblank object
1355 * @param[out] name vblank name
1356 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1359 tdm_vblank_get_name(tdm_vblank *vblank, const char **name);
1362 * @brief Set the fps to a vblank object
1363 * @details Default is the @b vertical @b refresh @b rate of the given output.
1364 * It could be ignored when the fixed fps is set by #tdm_vblank_set_fixed_fps
1365 * @param[in] vblank A vblank object
1366 * @param[in] fps over 0
1367 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1370 tdm_vblank_set_fps(tdm_vblank *vblank, unsigned int fps);
1373 * @brief Get the fps for a vblank object
1374 * @param[in] vblank A vblank object
1375 * @param[out] fps over 0
1376 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1379 tdm_vblank_get_fps(tdm_vblank *vblank, unsigned int *fps);
1382 * @brief Set the fixed fps to a vblank object
1384 * It could be ignored when the global fps is set by #tdm_vblank_enable_global_fps
1385 * @param[in] vblank A vblank object
1386 * @param[in] fps over 0
1387 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1390 tdm_vblank_set_fixed_fps(tdm_vblank *vblank, unsigned int fps);
1393 * @brief Ignore the vblank global fps
1395 * The global fps will be applied to all client's vblanks for all outputs.
1396 * If the client's vblank fps is less than this, the global fps will be ignored
1397 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1398 * the global fps, it will be ignored also.
1399 * @param[in] vblank A vblank object
1400 * @param[in] ignore 1: ignore 0:not ignore(default)
1401 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1404 tdm_vblank_ignore_global_fps(tdm_vblank *vblank, unsigned int ignore);
1407 * @brief Set the offset(milli-second) to a vblank object
1408 * @details Default is @b 0.
1409 * @param[in] vblank A vblank object
1410 * @param[in] offset the offset(milli-second)
1411 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1414 tdm_vblank_set_offset(tdm_vblank *vblank, int offset);
1417 * @brief Get the offset(milli-second) for a vblank object
1418 * @param[in] vblank A vblank object
1419 * @param[out] offset the offset(milli-second)
1420 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1423 tdm_vblank_get_offset(tdm_vblank *vblank, int *offset);
1426 * @brief Enable/Disable the fake vblank to a vblank object
1428 * If enable_fake == 0, #tdm_vblank_wait will return TDM_ERROR_DPMS_OFF
1429 * when DPMS off. Otherwise, #tdm_vblank_wait will return TDM_ERROR_NONE
1431 * @param[in] vblank A vblank object
1432 * @param[in] enable_fake 1:enable, 0:disable
1433 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1436 tdm_vblank_set_enable_fake(tdm_vblank *vblank, unsigned int enable_fake);
1439 * @brief Get the fake vblank
1440 * @param[in] vblank A vblank object
1441 * @param[out] enable_fake 1:enable, 0:disable
1442 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1445 tdm_vblank_get_enable_fake(tdm_vblank *vblank, unsigned int *enable_fake);
1448 * @brief Wait for a vblank
1450 * Once #tdm_vblank_wait returns TDM_ERROR_NONE, the user vblank handler(#tdm_vblank_handler)
1451 * SHOULD be called after the given interval. \n
1452 * The sequence value of tdm_vblank_handler is the relative value of fps.
1453 * If fps = 10, this sequence value should be increased by 10 during 1 second.
1454 * @param[in] vblank A vblank object
1455 * @param[in] req_sec The vblank request time(second)
1456 * @param[in] req_usec The vblank request time(micro-second)
1457 * @param[in] interval The vblank interval
1458 * @param[in] func The user vblank handler
1459 * @param[in] user_data The user data
1460 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1463 tdm_vblank_wait(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1464 unsigned int interval, tdm_vblank_handler func, void *user_data);
1467 * @brief Wait for a vblank with the target sequence number
1468 * @param[in] vblank A vblank object
1469 * @param[in] req_sec The vblank request time(second)
1470 * @param[in] req_usec The vblank request time(micro-second)
1471 * @param[in] sequence The target sequence number
1472 * @param[in] func The user client vblank handler
1473 * @param[in] user_data The user data
1474 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1477 tdm_vblank_wait_seq(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1478 unsigned int sequence, tdm_vblank_handler func, void *user_data);
1484 #endif /* _TDM_H_ */