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 * @brief Add a output create handler
211 * @param[in] output A output object
212 * @param[in] func A output create handler
213 * @param[in] user_data The user data
214 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
217 tdm_display_add_output_create_handler(tdm_display *dpy,
218 tdm_output_create_handler func,
222 * @brief Remove a output create handler
223 * @param[in] output A output object
224 * @param[in] func A output create handler
225 * @param[in] user_data The user data
226 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
229 tdm_display_remove_output_create_handler(tdm_display *dpy,
230 tdm_output_create_handler func,
234 * @brief Find a output object which has the given name.
235 * @param[in] dpy A display object
236 * @param[in] name The name of a output object
237 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
238 * @return A output object if success. Otherwise, NULL.
241 tdm_display_find_output(tdm_display *dpy, const char *name, tdm_error *error);
244 * @brief Create a pp object.
245 * @param[in] dpy A display object
246 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
247 * @return A pp object if success. Otherwise, NULL.
248 * @see tdm_pp_destroy
251 tdm_display_create_pp(tdm_display *dpy, tdm_error *error);
254 * @brief Get the information of the TDM backend module.
255 * @param[in] module A backend module object
256 * @param[out] name The name of the TDM backend module
257 * @param[out] vendor The vendor of the TDM backend module
258 * @param[out] version The version of the TDM backend module
259 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
262 tdm_module_get_info(tdm_module *module, const char **name,
263 const char **vendor, int *major, int *minor);
266 * @brief Add a output destroy handler
267 * @param[in] output A output object
268 * @param[in] func A output destroy handler
269 * @param[in] user_data The user data
270 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
273 tdm_output_add_destroy_handler(tdm_output *output,
274 tdm_output_destroy_handler func,
278 * @brief Remove a output destroy handler
279 * @param[in] output A output object
280 * @param[in] func A output destroy handler
281 * @param[in] user_data The user data
282 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
285 tdm_output_remove_destroy_handler(tdm_output *output,
286 tdm_output_destroy_handler func,
290 * @brief Get a backend module object of the given output.
291 * @param[in] output A output object
292 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
293 * @return A backend object if success. Otherwise, NULL.
296 tdm_output_get_backend_module(tdm_output *output, tdm_error *error);
299 * @brief Get the capabilities of a output object.
300 * @param[in] output A output object
301 * @param[out] capabilities The capabilities of a output object
302 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
305 tdm_output_get_capabilities(tdm_output *output,
306 tdm_output_capability *capabilities);
309 * @brief Get the model information of a output object.
310 * @param[in] output A output object
311 * @param[out] maker The output maker.
312 * @param[out] model The output model.
313 * @param[out] name The output name.
314 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
317 tdm_output_get_model_info(tdm_output *output, const char **maker,
318 const char **model, const char **name);
321 * @brief Get the connection status of a output object.
322 * @param[in] output A output object
323 * @param[out] status The connection status.
324 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
327 tdm_output_get_conn_status(tdm_output *output, tdm_output_conn_status *status);
330 * @brief Add a output change handler
331 * @details The handler will be called when the status of a
332 * output object is changed. connection, DPMS, etc.
333 * @param[in] output A output object
334 * @param[in] func A output change handler
335 * @param[in] user_data The user data
336 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
339 tdm_output_add_change_handler(tdm_output *output,
340 tdm_output_change_handler func,
344 * @brief Remove a output change handler
345 * @param[in] output A output object
346 * @param[in] func A output change handler
347 * @param[in] user_data The user data
348 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
351 tdm_output_remove_change_handler(tdm_output *output,
352 tdm_output_change_handler func,
356 * @brief Add a output mode change handler
357 * @param[in] output A output object
358 * @param[in] func A output mode change handler
359 * @param[in] user_data The user data
360 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
363 tdm_output_add_mode_change_request_handler(tdm_output *output,
364 tdm_output_mode_change_request_handler func,
368 * @brief Remove a output mode change handler
369 * @param[in] output A output object
370 * @param[in] func A output mode change handler
371 * @param[in] user_data The user data
372 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
375 tdm_output_remove_mode_change_request_handler(tdm_output *output,
376 tdm_output_mode_change_request_handler func,
380 * @brief Get the connection type of a output object.
381 * @param[in] output A output object
382 * @param[out] type The connection type.
383 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
386 tdm_output_get_output_type(tdm_output *output, tdm_output_type *type);
389 * @brief Get the layer counts which a output object has.
390 * @param[in] output A output object
391 * @param[out] count The count of layers
392 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
393 * @see tdm_output_get_layer
396 tdm_output_get_layer_count(tdm_output *output, int *count);
399 * @brief Get a layer object which has the given index.
400 * @param[in] output A output object
401 * @param[in] index The index of a layer object
402 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
403 * @return A layer object if success. Otherwise, NULL.
404 * @see tdm_output_get_layer_count
407 tdm_output_get_layer(tdm_output *output, int index, tdm_error *error);
410 * @brief Get the available property array of a output object.
411 * @param[in] output A output object
412 * @param[out] props The available property array
413 * @param[out] count The count of properties
414 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
417 tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props,
421 * @brief Get the available mode array of a output object.
422 * @param[in] output A output object
423 * @param[out] modes The available mode array
424 * @param[out] count The count of modes
425 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
428 tdm_output_get_available_modes(tdm_output *output,
429 const tdm_output_mode **modes, int *count);
432 * @brief Get the available size of a output object.
433 * @details -1 means that a TDM backend module doesn't define the value.
434 * @param[in] output A output object
435 * @param[out] min_w The minimum width which TDM can handle
436 * @param[out] min_h The minimum height which TDM can handle
437 * @param[out] max_w The maximum width which TDM can handle
438 * @param[out] max_h The maximum height which TDM can handle
439 * @param[out] preferred_align The preferred align width which TDM can handle
440 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
443 tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h,
444 int *max_w, int *max_h, int *preferred_align);
447 * @brief Get the available cursor size of a output object.
448 * @details -1 means that a TDM backend module doesn't define the value.
449 * @param[in] output A output object
450 * @param[out] min_w The minimum width which TDM can handle
451 * @param[out] min_h The minimum height which TDM can handle
452 * @param[out] max_w The maximum width which TDM can handle
453 * @param[out] max_h The maximum height which TDM can handle
454 * @param[out] preferred_align The preferred align width which TDM can handle
455 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
458 tdm_output_get_cursor_available_size(tdm_output *output, int *min_w, int *min_h,
459 int *max_w, int *max_h, int *preferred_align);
462 * @brief Get the physical size of a output object.
463 * @param[in] output A output object
464 * @param[out] mmWidth The milimeter width
465 * @param[out] mmHeight The milimeter height
466 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
469 tdm_output_get_physical_size(tdm_output *output, unsigned int *mmWidth,
470 unsigned int *mmHeight);
473 * @brief Get the subpixel of a output object.
474 * @param[in] output A output object
475 * @param[out] subpixel The subpixel
476 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
479 tdm_output_get_subpixel(tdm_output *output, unsigned int *subpixel);
482 * @brief Get the pipe of a output object.
483 * @param[in] output A output object
484 * @param[out] pipe The pipe
485 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
488 tdm_output_get_pipe(tdm_output *output, unsigned int *pipe);
491 * @brief Get the index of a primary layer.
492 * @param[in] output A output object
493 * @param[out] index The primary layer index
494 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
497 tdm_output_get_primary_index(tdm_output *output, int *index);
500 * @brief Set the property which has a given id.
501 * @param[in] output A output object
502 * @param[in] id The property id
503 * @param[in] value The value
504 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
507 tdm_output_set_property(tdm_output *output, unsigned int id, tdm_value value);
510 * @brief Get the property which has a given id
511 * @param[in] output A output object
512 * @param[in] id The property id
513 * @param[out] value The value
514 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
517 tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value);
520 * @brief Wait for VBLANK
521 * @details After interval vblanks, a user vblank handler will be called.
522 * @param[in] output A output object
523 * @param[in] interval vblank interval
524 * @param[in] sync 0: asynchronous, 1:synchronous
525 * @param[in] func A user vblank handler
526 * @param[in] user_data The user data
527 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
528 * @see #tdm_output_vblank_handler
531 tdm_output_wait_vblank(tdm_output *output, int interval, int sync,
532 tdm_output_vblank_handler func, void *user_data);
535 * @brief Commit changes for a output object
536 * @details After all change of a output object are applied, a user commit handler
538 * @param[in] output A output object
539 * @param[in] sync 0: asynchronous, 1:synchronous
540 * @param[in] func A user commit handler
541 * @param[in] user_data The user data
542 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
543 * @see #tdm_layer_commit
546 tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func,
550 * @brief Remove the user vblank handler
551 * @param[in] output A output object
552 * @param[in] func A user vblank handler
553 * @param[in] user_data The user data
554 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
557 tdm_output_remove_vblank_handler(tdm_output *output, tdm_output_vblank_handler func, void *user_data);
560 * @brief Remove the user commit handler
561 * @param[in] output A output object
562 * @param[in] func A user commit handler
563 * @param[in] user_data The user data
564 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
567 tdm_output_remove_commit_handler(tdm_output *output, tdm_output_commit_handler func, void *user_data);
570 * @brief Set one of available modes of a output object
571 * @param[in] output A output object
572 * @param[in] mode A output mode
573 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
576 tdm_output_set_mode(tdm_output *output, const tdm_output_mode *mode);
579 * @brief Get the mode of a output object
580 * @param[in] output A output object
581 * @param[out] mode A output mode
582 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
585 tdm_output_get_mode(tdm_output *output, const tdm_output_mode **mode);
588 * @brief Set DPMS of a output object synchronously
589 * @param[in] output A output object
590 * @param[in] dpms_value DPMS value
591 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
592 * @see tdm_output_set_dpms_async
595 tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value);
598 * @brief Set DPMS of a output object asynchronously
599 * @details This function can be used when a output supports the asynchronous DPMS
600 * control. The output has #TDM_OUTPUT_CAPABILITY_ASYNC_DPMS flags which
601 * #tdm_output_get_capabilities returns. If an output change handler is added with
602 * #tdm_output_add_change_handler, the output change handler will be called when
603 * the DPMS status is changed indeed.
604 * @param[in] output A output object
605 * @param[in] dpms_value DPMS value
606 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
607 * @see tdm_output_add_change_handler, tdm_output_set_dpms,
608 * tdm_output_get_capabilities, #TDM_OUTPUT_CAPABILITY_ASYNC_DPMS.
611 tdm_output_set_dpms_async(tdm_output *output, tdm_output_dpms dpms_value);
614 * @brief Get DPMS of a output object
615 * @param[in] output A output object
616 * @param[out] dpms_value DPMS value
617 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
620 tdm_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value);
623 * @brief Check if a output object has the capture capability
624 * @param[in] output A output object
625 * @param[out] has_capability 1: has the capability, 0: not has the capability
626 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
629 tdm_output_has_capture_capability(tdm_output *output, unsigned int *has_capability);
632 * @brief Create a capture object of a output object
633 * @param[in] output A output object
634 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
635 * @return A capture object
636 * @see tdm_capture_destroy
639 tdm_output_create_capture(tdm_output *output, tdm_error *error);
642 * @brief Get a hwc associated with a output object.
643 * @param[in] output A output object
644 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
645 * @return A hwc object
649 tdm_output_get_hwc(tdm_output *output, tdm_error *error);
652 * @brief Set the mirror image of the src_output to the output
653 * @param[in] output A output object to display the src_output image
654 * @param[in] src_output A src output object of which image is displayed on the output
655 * @param[in] transform A transform value
656 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
659 tdm_output_set_mirror(tdm_output *output, tdm_output *src_output, tdm_transform transform);
662 * @brief Unset the mirror
663 * @param[in] output A output object
664 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
667 tdm_output_unset_mirror(tdm_output *output);
670 * @brief Get a output object of a layer object
671 * @param[in] layer A layer object
672 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
673 * @return A TDM output object if success. Otherwise, NULL.
676 tdm_layer_get_output(tdm_layer *layer, tdm_error *error);
679 * @brief Get the index of a layer object.
680 * @param[in] layer A layer object
681 * @param[out] index The index of a layer object
682 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
685 tdm_layer_get_index(tdm_layer *layer, int *index);
688 * @brief Get the capabilities of a layer object.
689 * @param[in] layer A layer object
690 * @param[out] capabilities The capabilities of a layer object
691 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
694 tdm_layer_get_capabilities(tdm_layer *layer,
695 tdm_layer_capability *capabilities);
698 * @brief Get the available format array of a layer object.
699 * @param[in] layer A layer object
700 * @param[out] formats The available format array
701 * @param[out] count The count of formats
702 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
705 tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats,
709 * @brief Get the available property array of a layer object.
710 * @param[in] layer A layer object
711 * @param[out] props The available property array
712 * @param[out] count The count of properties
713 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
716 tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props,
720 * @brief Get the zpos of a layer object.
722 * - GRAPHIC layers have fixed zpos. It starts from 0. It's @b non-changeable.
723 * - But the zpos of VIDEO layers will be decided by a backend module side.
724 * - A frontend user only can set the relative zpos to VIDEO layers via #tdm_layer_set_video_pos
725 * - The zpos of video layers is less than GRAPHIC layers or more than GRAPHIC
726 * layers. ie, ..., -2, -1, 4, 5, ... (if 0 <= GRAPHIC layer's zpos < 4).
727 * -------------------------------- graphic layer 3 <-- top most layer
728 * -------------------------------- graphic layer 2
729 * -------------------------------- graphic layer 1
730 * -------------------------------- graphic layer 0
731 * -------------------------------- video layer -1
732 * -------------------------------- video layer -2 <-- lowest layer
733 * @param[in] layer A layer object
734 * @param[out] zpos The zpos
735 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
736 * @see tdm_layer_set_video_pos, tdm_layer_capability
739 tdm_layer_get_zpos(tdm_layer *layer, int *zpos);
742 * @brief Set the property which has a given id.
743 * @param[in] layer A layer object
744 * @param[in] id The property id
745 * @param[in] value The value
746 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
749 tdm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
752 * @brief Get the property which has a given id.
753 * @param[in] layer A layer object
754 * @param[in] id The property id
755 * @param[out] value The value
756 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
759 tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
762 * @brief Set the geometry information to a layer object
763 * @details The geometry information will be applied when the output object
764 * of a layer object is committed. If a layer has TDM_LAYER_CAPABILITY_NO_CROP
765 * capability, a layer will ignore the pos(crop) information of #tdm_info_layer's
767 * @param[in] layer A layer object
768 * @param[in] info The geometry information
769 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
770 * @see tdm_layer_commit
773 tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info);
776 * @brief Get the geometry information to a layer object
777 * @param[in] layer A layer object
778 * @param[out] info The geometry information
779 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
782 tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info);
785 * @brief Set a TDM buffer to a layer object
786 * @details A TDM buffer will be applied when the output object
787 * of a layer object is committed.
788 * @param[in] layer A layer object
789 * @param[in] buffer A TDM buffer
790 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
791 * @see tdm_layer_commit
794 tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer);
797 * @brief Unset a TDM buffer from a layer object
798 * @details When this function is called, a current showing buffer will be
799 * disappeared from screen. Then nothing is showing on a layer object.
800 * @param[in] layer A layer object
801 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
804 tdm_layer_unset_buffer(tdm_layer *layer);
807 * @brief Commit changes for a layer object
808 * @details After all change of a layer object are applied, a user commit handler
810 * @param[in] layer A layer object
811 * @param[in] func A user commit handler
812 * @param[in] user_data The user data
813 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
816 tdm_layer_commit(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
819 tdm_layer_is_committing(tdm_layer *layer, unsigned int *committing);
822 * @brief Remove the user commit handler
823 * @param[in] layer A layer object
824 * @param[in] func A user commit handler
825 * @param[in] user_data The user data
826 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
829 tdm_layer_remove_commit_handler(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
832 * @brief Get a displaying TDM buffer from a layer object
833 * @details A displaying TDM buffer is a current showing buffer on screen
834 * that is set to layer object and applied output object of a layer object.
835 * @param[in] layer A layer object
836 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
837 * @return A TDM buffer if success. Otherwise, NULL.
840 tdm_layer_get_displaying_buffer(tdm_layer *layer, tdm_error *error);
843 * @brief Set a TBM surface_queue to a layer object
844 * @details A TBM surface_queue will be applied when the output object
845 * of a layer object is committed. and TDM layer will be automatically updated
846 * @param[in] layer A layer object
847 * @param[in] buffer_queue A TBM surface_queue
848 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
849 * @see tdm_layer_commit
852 tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue);
855 * @brief Unset a TBM surface_queue from a layer object
856 * @details When this function is called, a current surface_queue will be
857 * disappeared from screen. Then nothing is showing on a layer object.
858 * @param[in] layer A layer object
859 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
862 tdm_layer_unset_buffer_queue(tdm_layer *layer);
865 * @brief Check wheter a layer object is available for a frontend user to use.
866 * @details A layer object is not usable if a TDM buffer is showing on screen
867 * via this layer object. By calling #tdm_layer_unset_buffer, this layer object
868 * will become usable.
869 * @param[in] layer A layer object
870 * @param[out] usable 1 if usable, 0 if not usable
871 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
874 tdm_layer_is_usable(tdm_layer *layer, unsigned int *usable);
877 * @brief Set the relative zpos to a VIDEO layer object
878 * @details The zpos value is less than the minimum zpos of GRAPHIC layers, or
879 * it is more than the maximum zpos of GRAPHIC layers.
880 * @param[in] layer A VIDEO layer object
881 * @param[in] zpos The zpos
882 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
883 * @see tdm_layer_get_zpos, tdm_layer_capability
886 tdm_layer_set_video_pos(tdm_layer *layer, int zpos);
889 * @brief Create a capture object of a layer object
890 * @param[in] layer A layer object
891 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
892 * @return A capture object
893 * @see tdm_capture_destroy
896 tdm_layer_create_capture(tdm_layer *layer, tdm_error *error);
899 * @brief Get buffer flags from a layer object
900 * @param[in] layer A layer object
901 * @param[out] flags a buffer flags value
902 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
905 tdm_layer_get_buffer_flags(tdm_layer *layer, unsigned int *flags);
908 * @brief Creates a new window on the given hwc.
909 * @param[in] hwc A hwc object
910 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
911 * @return A created window object
915 tdm_hwc_create_window(tdm_hwc *hwc, tdm_error *error);
918 * @brief Get the video supported format array for hwc windows of a output object.
919 * @param[in] hwc A hwc object
920 * @param[out] formats The available format array
921 * @param[out] count The count of formats
922 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
925 tdm_hwc_get_video_supported_formats(tdm_hwc *hwc, const tbm_format **formats,
928 * @brief Get the available video property array of a hwc object.
929 * @param[in] hwc A hwc
930 * @param[out] props The available video property array
931 * @param[out] count The count of video properties
932 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
935 tdm_hwc_get_video_available_properties(tdm_hwc *hwc, const tdm_prop **props, int *count);
938 * @brief Get the hwc capabilites
939 * @param[in] hwc A hwc object
940 * @param[out] capabilities A hwc capability
941 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
944 tdm_hwc_get_capabilities(tdm_hwc *hwc, tdm_hwc_capability *capabilities);
947 * @brief Get the available property array of a hwc object.
948 * @param[in] hwc A hwc
949 * @param[out] props The available property array
950 * @param[out] count The count of properties
951 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
954 tdm_hwc_get_available_properties(tdm_hwc *hwc, const tdm_prop **props, int *count);
957 * @brief Get a target buffer queue
958 * @details The client composites the tdm_hwd_windows which have
959 * TDM_COMPOSITE_CLIENT types on the buffer from this target buffer queue.
960 * Then, the client set the buffer by calling tdm_hwc_set_client_target_buffer.
961 * @param[in] output A output object
962 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
963 * @return A buffer queue
967 tdm_hwc_get_client_target_buffer_queue(tdm_hwc *hwc, tdm_error *error);
970 * @brief Set the client(relative to the TDM) target buffer
971 * @details This function lets the backend know the target buffer.
972 * The target buffer contains the result of the gl composition with the
973 * tdm_hwc_windows which marked as TDM_HWC_WIN_COMPOSITION_CLIENT.
974 * @param[in] hwc A output hwc
975 * @param[in] target_buffer The new target buffer
976 * @param[in] damage The buffer damage region
977 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
981 tdm_hwc_set_client_target_buffer(tdm_hwc *hwc, tbm_surface_h target_buffer, tdm_region damage);
984 * @brief Validate the output
985 * @details Instructs the backend to inspect all of the hw layer state and
986 * determine if there are any composition type changes necessary before
987 * presenting the hwc.
988 * @param[in] hwc A hwc object
989 * @param[in] composited_wnds the hwc window list which is visible.
990 * @param[in] num_wnds the number of the visible windows in the composited_wnds
991 * @param[out] num_types The number of composition type changes
992 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
994 * The backend has to return the num_types when the assgined comopsite types of
995 * the tdm_hwc_windows in the composited_wnds. If the num_types is greater than
996 * 0, the cleint must get the changed composite types of the tdm_hwc_windows
997 * and change the comopsite types
1001 tdm_hwc_validate(tdm_hwc *hwc, tdm_hwc_window **composited_wnds, uint32_t num_wnds,
1002 uint32_t *num_types);
1005 * @brief Get changed composition types
1006 * @details Retrieves the windows for which the backend requires a different
1007 * composition types that had been set prior to the last call to tdm_hwc_validate().
1008 * The client will either update its state with these types and call
1009 * tdm_hwc_accept_validation, or will set new types and attempt to validate the
1010 * display again. The number of elements returned must be the same as the
1011 * value returned in num_types from the last call to tdm_hwc_validate().
1012 * @param[in] hwc A hwc object
1013 * @param[out] num_elements the number of hwc_windows
1014 * @param[out] windows An array of windows
1015 * @param[out] composition_types An array of composition types, each corresponding
1016 * to an element of windows
1017 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1022 tdm_hwc_get_changed_composition_types(tdm_hwc *hwc, uint32_t *num_elements,
1023 tdm_hwc_window **hwc_window,
1024 tdm_hwc_window_composition *composition_types);
1027 * @brief Accepts the validation required by the backend
1028 * @details Accepts the validation required by the backend from the previous
1029 * tdm_hwc_validate() and tdm_hwc_get_chaged_composition_types().
1030 * @param[in] hwc A hwc object
1031 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1035 tdm_hwc_accept_validation(tdm_hwc *hwc);
1038 * @brief Commit changes for a hwc
1039 * @details After all change of a window object are applied, a user commit handler
1041 * @param[in] hwc A hwc object
1042 * @param[in] sync 0: asynchronous, 1:synchronous
1043 * @param[in] func A user commit handler
1044 * @param[in] user_data The user data
1045 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1048 tdm_hwc_commit(tdm_hwc *hwc, int sync, tdm_hwc_commit_handler func, void *user_data);
1051 * @brief Set the property which has a given id on the hwc object.
1052 * @param[in] hwc A hwc object
1053 * @param[in] id The property id
1054 * @param[in] value The value of the propery id
1055 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1058 tdm_hwc_set_property(tdm_hwc *hwc, uint32_t id, tdm_value value);
1061 * @brief Get the property which has a given id on the hwc object.
1062 * @param[in] hwc A hwc object
1063 * @param[in] id The property id
1064 * @param[in] value The value of the propery id
1065 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1068 tdm_hwc_get_property(tdm_hwc *hwc, uint32_t id, tdm_value *value);
1071 * @brief Destroys the given window.
1072 * @param[in] window the pointer of the window to destroy
1076 tdm_hwc_window_destroy(tdm_hwc_window *hwc_window);
1079 * @brief Acquire a buffer queue for the window object
1080 * @details These buffers are used to composite by hardware a client content in
1082 * @param[in] hwc_window A window object
1083 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1084 * @return A tbm buffer queue
1088 tdm_hwc_window_acquire_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error);
1091 * @brief Release a buffer queue for the window object
1092 * @details Release buffer queue when the client no longer uses buffers of queue.
1093 * @param[in] hwc_window A window object
1094 * @param[in] A tbm buffer queue
1098 tdm_hwc_window_release_buffer_queue(tdm_hwc_window *hwc_window, tbm_surface_queue_h queue);
1101 * @brief Sets the desired composition type of the given window.
1102 * @details During tdm_hwc_validate(), the backend may request changes to
1103 * the composition types of any of the layers as described in the definition
1104 * of tdm_hwc_window_composition_t above.
1105 * @param[in] hwc_window A window object
1106 * @param[in] composition_type The new composition type
1107 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1111 tdm_hwc_window_set_composition_type(tdm_hwc_window *hwc_window,
1112 tdm_hwc_window_composition composition_type);
1115 * @brief Set the buffer damage
1116 * @details Provides the region of the source buffer which has been modified
1117 * since the last frame. This region does not need to be validated before
1118 * calling tdm_output_commit().
1119 * Once set through this function, the damage region remains the same until a
1120 * subsequent call to this function.
1121 * If damage.num_rects > 0, then it may be assumed that any portion of the source
1122 * buffer not covered by one of the rects has not been modified this frame. If
1123 * damage.num_rects == 0, then the whole source buffer must be treated as if it
1124 * has been modified.
1125 * If the layer's contents are not modified relative to the prior frame, damage
1126 * will contain exactly one empty rect([0, 0, 0, 0]).
1127 * The damage rects are relative to the pre-transformed buffer, and their origin
1128 * is the top-left corner. They will not exceed the dimensions of the latched
1130 * @param[in] hwc_window A window object
1131 * @param[in] damage The new buffer damage region
1132 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1136 tdm_hwc_window_set_buffer_damage(tdm_hwc_window *hwc_window, tdm_region damage);
1139 * @brief Set the information to a window object
1140 * @details The information will be applied when the hwc object is committed.
1141 * @param[in] hwc_window A window object
1142 * @param[in] info The information
1143 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1147 tdm_hwc_window_set_info(tdm_hwc_window *hwc_window, tdm_hwc_window_info *info);
1150 * @brief Set a TBM buffer to a window object
1151 * @details A TBM buffer will be applied when the output object of a layer
1152 * object is committed.
1153 * @param[in] hwc_window A window object
1154 * @param[in] buffer A TBM buffer
1155 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1159 tdm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer);
1162 * @brief Set the property which has a given id.
1163 * @param[in] hwc_window A hwc window object
1164 * @param[in] id The property id
1165 * @param[in] value The value of the propery id
1166 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1169 tdm_hwc_window_set_property(tdm_hwc_window *hwc_window, uint32_t id, tdm_value value);
1172 * @brief Get the property which has a given id.
1173 * @param[in] hwc_window A hwc window object
1174 * @param[in] id The property id
1175 * @param[out] value The value of the propery id
1176 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1179 tdm_hwc_window_get_property(tdm_hwc_window *hwc_window, uint32_t id, tdm_value *value);
1182 * @brief Get the constraints of hwc_window
1183 * @param[in] hwc_window A hwc window object
1184 * @param[out] constraints The tdm_hwc_window_constraint types
1185 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1188 tdm_hwc_window_get_constraints(tdm_hwc_window *hwc_window, int *constraints);
1191 * @brief Set the name of hwc_window
1192 * @param[in] hwc_window A hwc window object
1193 * @param[in] name of the hwc_window
1194 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1197 tdm_hwc_window_set_name(tdm_hwc_window *hwc_window, const char *name);
1200 * @brief Get buffer flags of cursor hwc_window
1201 * @param[in] hwc_window A hwc window object
1202 * @param[in] width of the cursor image
1203 * @param[in] height of the cursor image
1204 * @param[in] stride of the cursor image
1205 * @param[in] virtual address of the cursor image
1206 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1209 tdm_hwc_window_set_cursor_image(tdm_hwc_window *hwc_window, int width, int height, int stride, void *ptr);
1212 * @brief Destroy a pp object
1213 * @param[in] pp A pp object
1214 * @see tdm_display_create_pp
1217 tdm_pp_destroy(tdm_pp *pp);
1220 * @brief Set the geometry information to a pp object
1221 * @param[in] pp A pp object
1222 * @param[in] info The geometry information
1223 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1224 * @see tdm_pp_commit
1227 tdm_pp_set_info(tdm_pp *pp, tdm_info_pp *info);
1230 * @brief Set the PP done handler to a pp object
1232 * The user PP done handler will be called after converting a source buffer's image
1233 * to a destination buffer.
1234 * @param[in] pp A pp object
1235 * @param[in] func A user PP done handler
1236 * @param[in] user_data The user data
1237 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1240 tdm_pp_set_done_handler(tdm_pp *pp, tdm_pp_done_handler func, void *user_data);
1243 * @brief Attach a source buffer and a destination buffer to a pp object
1244 * @param[in] pp A pp object
1245 * @param[in] src A source buffer
1246 * @param[in] dst A destination buffer
1247 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1248 * @see tdm_pp_commit, tdm_pp_set_done_handler
1251 tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
1254 * @brief Commit changes for a pp object
1255 * @param[in] pp A pp object
1256 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1259 tdm_pp_commit(tdm_pp *pp);
1262 * @brief Destroy a capture object
1263 * @param[in] capture A capture object
1264 * @see tdm_output_create_capture, tdm_layer_create_capture
1267 tdm_capture_destroy(tdm_capture *capture);
1270 * @brief Set the geometry information to a capture object
1271 * @param[in] capture A capture object
1272 * @param[in] info The geometry information
1273 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1274 * @see tdm_capture_commit
1277 tdm_capture_set_info(tdm_capture *capture, tdm_info_capture *info);
1280 * @brief Set the capture done handler to a capture object
1282 * The user capture done handler will be called after capturing a screen into a
1284 * @param[in] capture A capture object
1285 * @param[in] func A user capture done handler
1286 * @param[in] user_data The user data
1287 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1290 tdm_capture_set_done_handler(tdm_capture *capture, tdm_capture_done_handler func, void *user_data);
1293 * @brief Attach a TDM buffer to a capture object
1294 * @param[in] capture A capture object
1295 * @param[in] buffer A TDM buffer
1296 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1297 * @see tdm_capture_commit, tdm_capture_set_done_handler
1300 tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer);
1303 * @brief Commit changes for a capture object
1304 * @param[in] capture A capture object
1305 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1308 tdm_capture_commit(tdm_capture *capture);
1311 * @brief The release handler of a TDM buffer
1312 * @param[in] buffer A TDM buffer
1313 * @param[in] user_data user data
1314 * @see tdm_buffer_add_release_handler, tdm_buffer_remove_release_handler
1316 typedef void (*tdm_buffer_release_handler)(tbm_surface_h buffer,
1320 * @brief Add a release handler to a TDM buffer
1322 * TDM has its own buffer release mechanism to let an frontend user know when a TDM buffer
1323 * becomes available for a next job. A TDM buffer can be used for TDM to show
1324 * it on screen or to capture an output and a layer. After all operations,
1325 * TDM will release it immediately when TDM doesn't need it any more.
1326 * @param[in] buffer A TDM buffer
1327 * @param[in] func A release handler
1328 * @param[in] user_data user data
1329 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1330 * @see tdm_buffer_remove_release_handler
1333 tdm_buffer_add_release_handler(tbm_surface_h buffer,
1334 tdm_buffer_release_handler func, void *user_data);
1337 * @brief Remove a release handler from a TDM buffer
1338 * @param[in] buffer A TDM buffer
1339 * @param[in] func A release handler
1340 * @param[in] user_data user data
1341 * @see tdm_buffer_add_release_handler
1344 tdm_buffer_remove_release_handler(tbm_surface_h buffer,
1345 tdm_buffer_release_handler func, void *user_data);
1348 * @brief The handler of a vblank object
1349 * @see #tdm_vblank_wait, #tdm_vblank_wait_seq
1351 typedef void (*tdm_vblank_handler)(tdm_vblank *vblank, tdm_error error, unsigned int sequence,
1352 unsigned int tv_sec, unsigned int tv_usec, void *user_data);
1355 * @brief Set the vblank fps for the given PID and name.
1356 * @param[in] pid The process ID
1357 * @param[in] name The client vblank name
1358 * @param[in] fps The client vblank fps
1359 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1362 tdm_vblank_set_client_vblank_fps(unsigned int pid, const char *name, unsigned int fps);
1365 * @brief Set the ignore global fps for the given PID and name.
1366 * @param[in] pid The process ID
1367 * @param[in] name The client vblank name
1368 * @param[in] ignore 1: ignore 0:not ignore(default)
1369 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1372 tdm_vblank_set_client_ignore_global_fps(unsigned int pid, const char *name, unsigned int ignore);
1375 * @brief Set the vblank global fps for the entire system.
1376 * @param[in] enable 1:enable, 0:disable
1377 * @param[in] fps The vblank global fps
1379 * This global fps will be applied to all client's vblanks for all outputs.
1380 * If the client's vblank fps is less than this, the global fps will be ignored
1381 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1382 * the global fps, it will be ignored also.
1383 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1386 tdm_vblank_enable_global_fps(unsigned int enable, unsigned int fps);
1389 * @brief Add the vblank create handler.
1390 * @param[in] dpy A display object
1391 * @param[in] func The user vblank create handler
1392 * @param[in] user_data The user data
1394 * The user vblank create handler will be called when new vblank object created.
1395 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1398 tdm_vblank_add_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1401 * @brief Remove the vblank create handler.
1402 * @param[in] dpy A display object
1403 * @param[in] func The user vblank create handler
1404 * @param[in] user_data The user data
1405 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1408 tdm_vblank_remove_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1411 * @brief Create a vblank object
1412 * @param[in] dpy A display object
1413 * @param[in] output A output object
1414 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1415 * @return A vblank object
1416 * @see #tdm_vblank_destroy
1419 tdm_vblank_create(tdm_display *dpy, tdm_output *output, tdm_error *error);
1422 * @brief Destroy a vblank object
1423 * @param[in] vblank A vblank object
1424 * @see #tdm_vblank_create
1427 tdm_vblank_destroy(tdm_vblank *vblank);
1430 * @brief Get a output object of a vblank object
1431 * @param[in] vblank A vblank object
1432 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1433 * @return A TDM output object if success. Otherwise, NULL.
1434 * @see #tdm_vblank_create
1437 tdm_vblank_get_output(tdm_vblank *vblank, tdm_error *error);
1440 * @brief Get the client PID for a vblank object
1441 * @param[in] vblank A vblank object
1442 * @param[out] pid PID of vblank's client
1443 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1446 tdm_vblank_get_client_pid(tdm_vblank *vblank, pid_t *pid);
1449 * @brief Set the name to a vblank object
1450 * @details The default name is "unknown"
1451 * @param[in] vblank A vblank object
1452 * @param[in] name vblank name
1453 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1456 tdm_vblank_set_name(tdm_vblank *vblank, const char *name);
1459 * @brief Get the name for a vblank object
1460 * @details The default name is "unknown"
1461 * @param[in] vblank A vblank object
1462 * @param[out] name vblank name
1463 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1466 tdm_vblank_get_name(tdm_vblank *vblank, const char **name);
1469 * @brief Set the fps to a vblank object
1470 * @details Default is the @b vertical @b refresh @b rate of the given output.
1471 * It could be ignored when the fixed fps is set by #tdm_vblank_set_fixed_fps
1472 * @param[in] vblank A vblank object
1473 * @param[in] fps over 0
1474 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1477 tdm_vblank_set_fps(tdm_vblank *vblank, unsigned int fps);
1480 * @brief Get the fps for a vblank object
1481 * @param[in] vblank A vblank object
1482 * @param[out] fps over 0
1483 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1486 tdm_vblank_get_fps(tdm_vblank *vblank, unsigned int *fps);
1489 * @brief Set the fixed fps to a vblank object
1491 * It could be ignored when the global fps is set by #tdm_vblank_enable_global_fps
1492 * @param[in] vblank A vblank object
1493 * @param[in] fps over 0
1494 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1497 tdm_vblank_set_fixed_fps(tdm_vblank *vblank, unsigned int fps);
1500 * @brief Ignore the vblank global fps
1502 * The global fps will be applied to all client's vblanks for all outputs.
1503 * If the client's vblank fps is less than this, the global fps will be ignored
1504 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1505 * the global fps, it will be ignored also.
1506 * @param[in] vblank A vblank object
1507 * @param[in] ignore 1: ignore 0:not ignore(default)
1508 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1511 tdm_vblank_ignore_global_fps(tdm_vblank *vblank, unsigned int ignore);
1514 * @brief Set the offset(milli-second) to a vblank object
1515 * @details Default is @b 0.
1516 * @param[in] vblank A vblank object
1517 * @param[in] offset the offset(milli-second)
1518 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1521 tdm_vblank_set_offset(tdm_vblank *vblank, int offset);
1524 * @brief Get the offset(milli-second) for a vblank object
1525 * @param[in] vblank A vblank object
1526 * @param[out] offset the offset(milli-second)
1527 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1530 tdm_vblank_get_offset(tdm_vblank *vblank, int *offset);
1533 * @brief Enable/Disable the fake vblank to a vblank object
1535 * If enable_fake == 0, #tdm_vblank_wait will return TDM_ERROR_DPMS_OFF
1536 * when DPMS off. Otherwise, #tdm_vblank_wait will return TDM_ERROR_NONE
1538 * @param[in] vblank A vblank object
1539 * @param[in] enable_fake 1:enable, 0:disable
1540 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1543 tdm_vblank_set_enable_fake(tdm_vblank *vblank, unsigned int enable_fake);
1546 * @brief Get the fake vblank
1547 * @param[in] vblank A vblank object
1548 * @param[out] enable_fake 1:enable, 0:disable
1549 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1552 tdm_vblank_get_enable_fake(tdm_vblank *vblank, unsigned int *enable_fake);
1555 * @brief Wait for a vblank
1557 * Once #tdm_vblank_wait returns TDM_ERROR_NONE, the user vblank handler(#tdm_vblank_handler)
1558 * SHOULD be called after the given interval. \n
1559 * The sequence value of tdm_vblank_handler is the relative value of fps.
1560 * If fps = 10, this sequence value should be increased by 10 during 1 second.
1561 * @param[in] vblank A vblank object
1562 * @param[in] req_sec The vblank request time(second)
1563 * @param[in] req_usec The vblank request time(micro-second)
1564 * @param[in] interval The vblank interval
1565 * @param[in] func The user vblank handler
1566 * @param[in] user_data The user data
1567 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1570 tdm_vblank_wait(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1571 unsigned int interval, tdm_vblank_handler func, void *user_data);
1574 * @brief Wait for a vblank with the target sequence number
1575 * @param[in] vblank A vblank object
1576 * @param[in] req_sec The vblank request time(second)
1577 * @param[in] req_usec The vblank request time(micro-second)
1578 * @param[in] sequence The target sequence number
1579 * @param[in] func The user client vblank handler
1580 * @param[in] user_data The user data
1581 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1584 tdm_vblank_wait_seq(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1585 unsigned int sequence, tdm_vblank_handler func, void *user_data);
1591 #endif /* _TDM_H_ */