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 Get a output object of a layer object
663 * @param[in] layer A layer object
664 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
665 * @return A TDM output object if success. Otherwise, NULL.
668 tdm_layer_get_output(tdm_layer *layer, tdm_error *error);
671 * @brief Get the index of a layer object.
672 * @param[in] layer A layer object
673 * @param[out] index The index of a layer object
674 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
677 tdm_layer_get_index(tdm_layer *layer, int *index);
680 * @brief Get the capabilities of a layer object.
681 * @param[in] layer A layer object
682 * @param[out] capabilities The capabilities of a layer object
683 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
686 tdm_layer_get_capabilities(tdm_layer *layer,
687 tdm_layer_capability *capabilities);
690 * @brief Get the available format array of a layer object.
691 * @param[in] layer A layer object
692 * @param[out] formats The available format array
693 * @param[out] count The count of formats
694 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
697 tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats,
701 * @brief Get the available property array of a layer object.
702 * @param[in] layer A layer object
703 * @param[out] props The available property array
704 * @param[out] count The count of properties
705 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
708 tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props,
712 * @brief Get the zpos of a layer object.
714 * - GRAPHIC layers have fixed zpos. It starts from 0. It's @b non-changeable.
715 * - But the zpos of VIDEO layers will be decided by a backend module side.
716 * - A frontend user only can set the relative zpos to VIDEO layers via #tdm_layer_set_video_pos
717 * - The zpos of video layers is less than GRAPHIC layers or more than GRAPHIC
718 * layers. ie, ..., -2, -1, 4, 5, ... (if 0 <= GRAPHIC layer's zpos < 4).
719 * -------------------------------- graphic layer 3 <-- top most layer
720 * -------------------------------- graphic layer 2
721 * -------------------------------- graphic layer 1
722 * -------------------------------- graphic layer 0
723 * -------------------------------- video layer -1
724 * -------------------------------- video layer -2 <-- lowest layer
725 * @param[in] layer A layer object
726 * @param[out] zpos The zpos
727 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
728 * @see tdm_layer_set_video_pos, tdm_layer_capability
731 tdm_layer_get_zpos(tdm_layer *layer, int *zpos);
734 * @brief Set the property which has a given id.
735 * @param[in] layer A layer object
736 * @param[in] id The property id
737 * @param[in] value The value
738 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
741 tdm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
744 * @brief Get the property which has a given id.
745 * @param[in] layer A layer object
746 * @param[in] id The property id
747 * @param[out] value The value
748 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
751 tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
754 * @brief Set the geometry information to a layer object
755 * @details The geometry information will be applied when the output object
756 * of a layer object is committed. If a layer has TDM_LAYER_CAPABILITY_NO_CROP
757 * capability, a layer will ignore the pos(crop) information of #tdm_info_layer's
759 * @param[in] layer A layer object
760 * @param[in] info The geometry information
761 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
762 * @see tdm_layer_commit
765 tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info);
768 * @brief Get the geometry information to a layer object
769 * @param[in] layer A layer object
770 * @param[out] info The geometry information
771 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
774 tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info);
777 * @brief Set a TDM buffer to a layer object
778 * @details A TDM buffer will be applied when the output object
779 * of a layer object is committed.
780 * @param[in] layer A layer object
781 * @param[in] buffer A TDM buffer
782 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
783 * @see tdm_layer_commit
786 tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer);
789 * @brief Unset a TDM buffer from a layer object
790 * @details When this function is called, a current showing buffer will be
791 * disappeared from screen. Then nothing is showing on a layer object.
792 * @param[in] layer A layer object
793 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
796 tdm_layer_unset_buffer(tdm_layer *layer);
799 * @brief Commit changes for a layer object
800 * @details After all change of a layer object are applied, a user commit handler
802 * @param[in] layer A layer object
803 * @param[in] func A user commit handler
804 * @param[in] user_data The user data
805 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
808 tdm_layer_commit(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
811 tdm_layer_is_committing(tdm_layer *layer, unsigned int *committing);
814 * @brief Remove the user commit handler
815 * @param[in] layer A layer object
816 * @param[in] func A user commit handler
817 * @param[in] user_data The user data
818 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
821 tdm_layer_remove_commit_handler(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
824 * @brief Get a displaying TDM buffer from a layer object
825 * @details A displaying TDM buffer is a current showing buffer on screen
826 * that is set to layer object and applied output object of a layer object.
827 * @param[in] layer A layer object
828 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
829 * @return A TDM buffer if success. Otherwise, NULL.
832 tdm_layer_get_displaying_buffer(tdm_layer *layer, tdm_error *error);
835 * @brief Set a TBM surface_queue to a layer object
836 * @details A TBM surface_queue will be applied when the output object
837 * of a layer object is committed. and TDM layer will be automatically updated
838 * @param[in] layer A layer object
839 * @param[in] buffer_queue A TBM surface_queue
840 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
841 * @see tdm_layer_commit
844 tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue);
847 * @brief Unset a TBM surface_queue from a layer object
848 * @details When this function is called, a current surface_queue will be
849 * disappeared from screen. Then nothing is showing on a layer object.
850 * @param[in] layer A layer object
851 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
854 tdm_layer_unset_buffer_queue(tdm_layer *layer);
857 * @brief Check wheter a layer object is available for a frontend user to use.
858 * @details A layer object is not usable if a TDM buffer is showing on screen
859 * via this layer object. By calling #tdm_layer_unset_buffer, this layer object
860 * will become usable.
861 * @param[in] layer A layer object
862 * @param[out] usable 1 if usable, 0 if not usable
863 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
866 tdm_layer_is_usable(tdm_layer *layer, unsigned int *usable);
869 * @brief Set the relative zpos to a VIDEO layer object
870 * @details The zpos value is less than the minimum zpos of GRAPHIC layers, or
871 * it is more than the maximum zpos of GRAPHIC layers.
872 * @param[in] layer A VIDEO layer object
873 * @param[in] zpos The zpos
874 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
875 * @see tdm_layer_get_zpos, tdm_layer_capability
878 tdm_layer_set_video_pos(tdm_layer *layer, int zpos);
881 * @brief Create a capture object of a layer object
882 * @param[in] layer A layer object
883 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
884 * @return A capture object
885 * @see tdm_capture_destroy
888 tdm_layer_create_capture(tdm_layer *layer, tdm_error *error);
891 * @brief Get buffer flags from a layer object
892 * @param[in] layer A layer object
893 * @param[out] flags a buffer flags value
894 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
897 tdm_layer_get_buffer_flags(tdm_layer *layer, unsigned int *flags);
900 * @brief Creates a new window on the given hwc.
901 * @param[in] hwc A hwc object
902 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
903 * @return A created window object
907 tdm_hwc_create_window(tdm_hwc *hwc, tdm_error *error);
910 * @brief Get the video supported format array for hwc windows of a output object.
911 * @param[in] hwc A hwc object
912 * @param[out] formats The available format array
913 * @param[out] count The count of formats
914 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
917 tdm_hwc_get_video_supported_formats(tdm_hwc *hwc, const tbm_format **formats,
920 * @brief Get the available video property array of a hwc object.
921 * @param[in] hwc A hwc
922 * @param[out] props The available video property array
923 * @param[out] count The count of video properties
924 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
927 tdm_hwc_get_video_available_properties(tdm_hwc *hwc, const tdm_prop **props, int *count);
930 * @brief Get the hwc capabilites
931 * @param[in] hwc A hwc object
932 * @param[out] capabilities A hwc capability
933 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
936 tdm_hwc_get_capabilities(tdm_hwc *hwc, tdm_hwc_capability *capabilities);
939 * @brief Get the available property array of a hwc object.
940 * @param[in] hwc A hwc
941 * @param[out] props The available property array
942 * @param[out] count The count of properties
943 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
946 tdm_hwc_get_available_properties(tdm_hwc *hwc, const tdm_prop **props, int *count);
949 * @brief Get a target buffer queue
950 * @details The client composites the tdm_hwd_windows which have
951 * TDM_COMPOSITE_CLIENT types on the buffer from this target buffer queue.
952 * Then, the client set the buffer by calling tdm_hwc_set_client_target_buffer.
953 * @param[in] output A output object
954 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
955 * @return A buffer queue
959 tdm_hwc_get_client_target_buffer_queue(tdm_hwc *hwc, tdm_error *error);
962 * @brief Set the client(relative to the TDM) target buffer
963 * @details This function lets the backend know the target buffer.
964 * The target buffer contains the result of the gl composition with the
965 * tdm_hwc_windows which marked as TDM_HWC_WIN_COMPOSITION_CLIENT.
966 * @param[in] hwc A output hwc
967 * @param[in] target_buffer The new target buffer
968 * @param[in] damage The buffer damage region
969 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
973 tdm_hwc_set_client_target_buffer(tdm_hwc *hwc, tbm_surface_h target_buffer, tdm_region damage);
976 * @brief Validate the output
977 * @details Instructs the backend to inspect all of the hw layer state and
978 * determine if there are any composition type changes necessary before
979 * presenting the hwc.
980 * @param[in] hwc A hwc object
981 * @param[in] composited_wnds the hwc window list which is visible.
982 * @param[in] num_wnds the number of the visible windows in the composited_wnds
983 * @param[out] num_types The number of composition type changes
984 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
986 * The backend has to return the num_types when the assgined comopsite types of
987 * the tdm_hwc_windows in the composited_wnds. If the num_types is greater than
988 * 0, the cleint must get the changed composite types of the tdm_hwc_windows
989 * and change the comopsite types
993 tdm_hwc_validate(tdm_hwc *hwc, tdm_hwc_window **composited_wnds, uint32_t num_wnds,
994 uint32_t *num_types);
997 * @brief Get changed composition types
998 * @details Retrieves the windows for which the backend requires a different
999 * composition types that had been set prior to the last call to tdm_hwc_validate().
1000 * The client will either update its state with these types and call
1001 * tdm_hwc_accept_validation, or will set new types and attempt to validate the
1002 * display again. The number of elements returned must be the same as the
1003 * value returned in num_types from the last call to tdm_hwc_validate().
1004 * @param[in] hwc A hwc object
1005 * @param[out] num_elements the number of hwc_windows
1006 * @param[out] windows An array of windows
1007 * @param[out] composition_types An array of composition types, each corresponding
1008 * to an element of windows
1009 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1014 tdm_hwc_get_changed_composition_types(tdm_hwc *hwc, uint32_t *num_elements,
1015 tdm_hwc_window **hwc_window,
1016 tdm_hwc_window_composition *composition_types);
1019 * @brief Accepts the validation required by the backend
1020 * @details Accepts the validation required by the backend from the previous
1021 * tdm_hwc_validate() and tdm_hwc_get_chaged_composition_types().
1022 * @param[in] hwc A hwc object
1023 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1027 tdm_hwc_accept_validation(tdm_hwc *hwc);
1030 * @brief Commit changes for a hwc
1031 * @details After all change of a window object are applied, a user commit handler
1033 * @param[in] hwc A hwc object
1034 * @param[in] sync 0: asynchronous, 1:synchronous
1035 * @param[in] func A user commit handler
1036 * @param[in] user_data The user data
1037 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1040 tdm_hwc_commit(tdm_hwc *hwc, int sync, tdm_hwc_commit_handler func, void *user_data);
1043 * @brief Set the property which has a given id on the hwc object.
1044 * @param[in] hwc A hwc object
1045 * @param[in] id The property id
1046 * @param[in] value The value of the propery id
1047 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1050 tdm_hwc_set_property(tdm_hwc *hwc, uint32_t id, tdm_value value);
1053 * @brief Get the property which has a given id on the hwc object.
1054 * @param[in] hwc A hwc object
1055 * @param[in] id The property id
1056 * @param[in] value The value of the propery id
1057 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1060 tdm_hwc_get_property(tdm_hwc *hwc, uint32_t id, tdm_value *value);
1063 * @brief Destroys the given window.
1064 * @param[in] window the pointer of the window to destroy
1068 tdm_hwc_window_destroy(tdm_hwc_window *hwc_window);
1071 * @brief Acquire a buffer queue for the window object
1072 * @details These buffers are used to composite by hardware a client content in
1074 * @param[in] hwc_window A window object
1075 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1076 * @return A tbm buffer queue
1080 tdm_hwc_window_acquire_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error);
1083 * @brief Release a buffer queue for the window object
1084 * @details Release buffer queue when the client no longer uses buffers of queue.
1085 * @param[in] hwc_window A window object
1086 * @param[in] A tbm buffer queue
1090 tdm_hwc_window_release_buffer_queue(tdm_hwc_window *hwc_window, tbm_surface_queue_h queue);
1093 * @brief Sets the desired composition type of the given window.
1094 * @details During tdm_hwc_validate(), the backend may request changes to
1095 * the composition types of any of the layers as described in the definition
1096 * of tdm_hwc_window_composition_t above.
1097 * @param[in] hwc_window A window object
1098 * @param[in] composition_type The new composition type
1099 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1103 tdm_hwc_window_set_composition_type(tdm_hwc_window *hwc_window,
1104 tdm_hwc_window_composition composition_type);
1107 * @brief Set the buffer damage
1108 * @details Provides the region of the source buffer which has been modified
1109 * since the last frame. This region does not need to be validated before
1110 * calling tdm_output_commit().
1111 * Once set through this function, the damage region remains the same until a
1112 * subsequent call to this function.
1113 * If damage.num_rects > 0, then it may be assumed that any portion of the source
1114 * buffer not covered by one of the rects has not been modified this frame. If
1115 * damage.num_rects == 0, then the whole source buffer must be treated as if it
1116 * has been modified.
1117 * If the layer's contents are not modified relative to the prior frame, damage
1118 * will contain exactly one empty rect([0, 0, 0, 0]).
1119 * The damage rects are relative to the pre-transformed buffer, and their origin
1120 * is the top-left corner. They will not exceed the dimensions of the latched
1122 * @param[in] hwc_window A window object
1123 * @param[in] damage The new buffer damage region
1124 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1128 tdm_hwc_window_set_buffer_damage(tdm_hwc_window *hwc_window, tdm_region damage);
1131 * @brief Set the information to a window object
1132 * @details The information will be applied when the hwc object is committed.
1133 * @param[in] hwc_window A window object
1134 * @param[in] info The information
1135 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1139 tdm_hwc_window_set_info(tdm_hwc_window *hwc_window, tdm_hwc_window_info *info);
1142 * @brief Set a TBM buffer to a window object
1143 * @details A TBM buffer will be applied when the output object of a layer
1144 * object is committed.
1145 * @param[in] hwc_window A window object
1146 * @param[in] buffer A TBM buffer
1147 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1151 tdm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer);
1154 * @brief Set the property which has a given id.
1155 * @param[in] hwc_window A hwc window object
1156 * @param[in] id The property id
1157 * @param[in] value The value of the propery id
1158 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1161 tdm_hwc_window_set_property(tdm_hwc_window *hwc_window, uint32_t id, tdm_value value);
1164 * @brief Get the property which has a given id.
1165 * @param[in] hwc_window A hwc window object
1166 * @param[in] id The property id
1167 * @param[out] value The value of the propery id
1168 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1171 tdm_hwc_window_get_property(tdm_hwc_window *hwc_window, uint32_t id, tdm_value *value);
1174 * @brief Get the constraints of hwc_window
1175 * @param[in] hwc_window A hwc window object
1176 * @param[out] constraints The tdm_hwc_window_constraint types
1177 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1180 tdm_hwc_window_get_constraints(tdm_hwc_window *hwc_window, int *constraints);
1183 * @brief Set the name of hwc_window
1184 * @param[in] hwc_window A hwc window object
1185 * @param[in] name of the hwc_window
1186 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1189 tdm_hwc_window_set_name(tdm_hwc_window *hwc_window, const char *name);
1192 * @brief Get buffer flags of cursor hwc_window
1193 * @param[in] hwc_window A hwc window object
1194 * @param[in] width of the cursor image
1195 * @param[in] height of the cursor image
1196 * @param[in] stride of the cursor image
1197 * @param[in] virtual address of the cursor image
1198 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1201 tdm_hwc_window_set_cursor_image(tdm_hwc_window *hwc_window, int width, int height, int stride, void *ptr);
1204 * @brief Destroy a pp object
1205 * @param[in] pp A pp object
1206 * @see tdm_display_create_pp
1209 tdm_pp_destroy(tdm_pp *pp);
1212 * @brief Set the geometry information to a pp object
1213 * @param[in] pp A pp object
1214 * @param[in] info The geometry information
1215 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1216 * @see tdm_pp_commit
1219 tdm_pp_set_info(tdm_pp *pp, tdm_info_pp *info);
1222 * @brief Set the PP done handler to a pp object
1224 * The user PP done handler will be called after converting a source buffer's image
1225 * to a destination buffer.
1226 * @param[in] pp A pp object
1227 * @param[in] func A user PP done handler
1228 * @param[in] user_data The user data
1229 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1232 tdm_pp_set_done_handler(tdm_pp *pp, tdm_pp_done_handler func, void *user_data);
1235 * @brief Attach a source buffer and a destination buffer to a pp object
1236 * @param[in] pp A pp object
1237 * @param[in] src A source buffer
1238 * @param[in] dst A destination buffer
1239 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1240 * @see tdm_pp_commit, tdm_pp_set_done_handler
1243 tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
1246 * @brief Commit changes for a pp object
1247 * @param[in] pp A pp object
1248 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1251 tdm_pp_commit(tdm_pp *pp);
1254 * @brief Destroy a capture object
1255 * @param[in] capture A capture object
1256 * @see tdm_output_create_capture, tdm_layer_create_capture
1259 tdm_capture_destroy(tdm_capture *capture);
1262 * @brief Set the geometry information to a capture object
1263 * @param[in] capture A capture object
1264 * @param[in] info The geometry information
1265 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1266 * @see tdm_capture_commit
1269 tdm_capture_set_info(tdm_capture *capture, tdm_info_capture *info);
1272 * @brief Set the capture done handler to a capture object
1274 * The user capture done handler will be called after capturing a screen into a
1276 * @param[in] capture A capture object
1277 * @param[in] func A user capture done handler
1278 * @param[in] user_data The user data
1279 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1282 tdm_capture_set_done_handler(tdm_capture *capture, tdm_capture_done_handler func, void *user_data);
1285 * @brief Attach a TDM buffer to a capture object
1286 * @param[in] capture A capture object
1287 * @param[in] buffer A TDM buffer
1288 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1289 * @see tdm_capture_commit, tdm_capture_set_done_handler
1292 tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer);
1295 * @brief Commit changes for a capture object
1296 * @param[in] capture A capture object
1297 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1300 tdm_capture_commit(tdm_capture *capture);
1303 * @brief The release handler of a TDM buffer
1304 * @param[in] buffer A TDM buffer
1305 * @param[in] user_data user data
1306 * @see tdm_buffer_add_release_handler, tdm_buffer_remove_release_handler
1308 typedef void (*tdm_buffer_release_handler)(tbm_surface_h buffer,
1312 * @brief Add a release handler to a TDM buffer
1314 * TDM has its own buffer release mechanism to let an frontend user know when a TDM buffer
1315 * becomes available for a next job. A TDM buffer can be used for TDM to show
1316 * it on screen or to capture an output and a layer. After all operations,
1317 * TDM will release it immediately when TDM doesn't need it any more.
1318 * @param[in] buffer A TDM buffer
1319 * @param[in] func A release handler
1320 * @param[in] user_data user data
1321 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1322 * @see tdm_buffer_remove_release_handler
1325 tdm_buffer_add_release_handler(tbm_surface_h buffer,
1326 tdm_buffer_release_handler func, void *user_data);
1329 * @brief Remove a release handler from a TDM buffer
1330 * @param[in] buffer A TDM buffer
1331 * @param[in] func A release handler
1332 * @param[in] user_data user data
1333 * @see tdm_buffer_add_release_handler
1336 tdm_buffer_remove_release_handler(tbm_surface_h buffer,
1337 tdm_buffer_release_handler func, void *user_data);
1340 * @brief The handler of a vblank object
1341 * @see #tdm_vblank_wait, #tdm_vblank_wait_seq
1343 typedef void (*tdm_vblank_handler)(tdm_vblank *vblank, tdm_error error, unsigned int sequence,
1344 unsigned int tv_sec, unsigned int tv_usec, void *user_data);
1347 * @brief Set the vblank fps for the given PID and name.
1348 * @param[in] pid The process ID
1349 * @param[in] name The client vblank name
1350 * @param[in] fps The client vblank fps
1351 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1354 tdm_vblank_set_client_vblank_fps(unsigned int pid, const char *name, unsigned int fps);
1357 * @brief Set the ignore global fps for the given PID and name.
1358 * @param[in] pid The process ID
1359 * @param[in] name The client vblank name
1360 * @param[in] ignore 1: ignore 0:not ignore(default)
1361 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1364 tdm_vblank_set_client_ignore_global_fps(unsigned int pid, const char *name, unsigned int ignore);
1367 * @brief Set the vblank global fps for the entire system.
1368 * @param[in] enable 1:enable, 0:disable
1369 * @param[in] fps The vblank global fps
1371 * This global fps will be applied to all client's vblanks for all outputs.
1372 * If the client's vblank fps is less than this, the global fps will be ignored
1373 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1374 * the global fps, it will be ignored also.
1375 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1378 tdm_vblank_enable_global_fps(unsigned int enable, unsigned int fps);
1381 * @brief Add the vblank create handler.
1382 * @param[in] dpy A display object
1383 * @param[in] func The user vblank create handler
1384 * @param[in] user_data The user data
1386 * The user vblank create handler will be called when new vblank object created.
1387 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1390 tdm_vblank_add_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1393 * @brief Remove the vblank create handler.
1394 * @param[in] dpy A display object
1395 * @param[in] func The user vblank create handler
1396 * @param[in] user_data The user data
1397 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1400 tdm_vblank_remove_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1403 * @brief Create a vblank object
1404 * @param[in] dpy A display object
1405 * @param[in] output A output object
1406 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1407 * @return A vblank object
1408 * @see #tdm_vblank_destroy
1411 tdm_vblank_create(tdm_display *dpy, tdm_output *output, tdm_error *error);
1414 * @brief Destroy a vblank object
1415 * @param[in] vblank A vblank object
1416 * @see #tdm_vblank_create
1419 tdm_vblank_destroy(tdm_vblank *vblank);
1422 * @brief Get a output object of a vblank object
1423 * @param[in] vblank A vblank object
1424 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1425 * @return A TDM output object if success. Otherwise, NULL.
1426 * @see #tdm_vblank_create
1429 tdm_vblank_get_output(tdm_vblank *vblank, tdm_error *error);
1432 * @brief Get the client PID for a vblank object
1433 * @param[in] vblank A vblank object
1434 * @param[out] pid PID of vblank's client
1435 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1438 tdm_vblank_get_client_pid(tdm_vblank *vblank, pid_t *pid);
1441 * @brief Set the name to a vblank object
1442 * @details The default name is "unknown"
1443 * @param[in] vblank A vblank object
1444 * @param[in] name vblank name
1445 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1448 tdm_vblank_set_name(tdm_vblank *vblank, const char *name);
1451 * @brief Get the name for a vblank object
1452 * @details The default name is "unknown"
1453 * @param[in] vblank A vblank object
1454 * @param[out] name vblank name
1455 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1458 tdm_vblank_get_name(tdm_vblank *vblank, const char **name);
1461 * @brief Set the fps to a vblank object
1462 * @details Default is the @b vertical @b refresh @b rate of the given output.
1463 * It could be ignored when the fixed fps is set by #tdm_vblank_set_fixed_fps
1464 * @param[in] vblank A vblank object
1465 * @param[in] fps over 0
1466 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1469 tdm_vblank_set_fps(tdm_vblank *vblank, unsigned int fps);
1472 * @brief Get the fps for a vblank object
1473 * @param[in] vblank A vblank object
1474 * @param[out] fps over 0
1475 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1478 tdm_vblank_get_fps(tdm_vblank *vblank, unsigned int *fps);
1481 * @brief Set the fixed fps to a vblank object
1483 * It could be ignored when the global fps is set by #tdm_vblank_enable_global_fps
1484 * @param[in] vblank A vblank object
1485 * @param[in] fps over 0
1486 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1489 tdm_vblank_set_fixed_fps(tdm_vblank *vblank, unsigned int fps);
1492 * @brief Ignore the vblank global fps
1494 * The global fps will be applied to all client's vblanks for all outputs.
1495 * If the client's vblank fps is less than this, the global fps will be ignored
1496 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1497 * the global fps, it will be ignored also.
1498 * @param[in] vblank A vblank object
1499 * @param[in] ignore 1: ignore 0:not ignore(default)
1500 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1503 tdm_vblank_ignore_global_fps(tdm_vblank *vblank, unsigned int ignore);
1506 * @brief Set the offset(milli-second) to a vblank object
1507 * @details Default is @b 0.
1508 * @param[in] vblank A vblank object
1509 * @param[in] offset the offset(milli-second)
1510 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1513 tdm_vblank_set_offset(tdm_vblank *vblank, int offset);
1516 * @brief Get the offset(milli-second) for a vblank object
1517 * @param[in] vblank A vblank object
1518 * @param[out] offset the offset(milli-second)
1519 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1522 tdm_vblank_get_offset(tdm_vblank *vblank, int *offset);
1525 * @brief Enable/Disable the fake vblank to a vblank object
1527 * If enable_fake == 0, #tdm_vblank_wait will return TDM_ERROR_DPMS_OFF
1528 * when DPMS off. Otherwise, #tdm_vblank_wait will return TDM_ERROR_NONE
1530 * @param[in] vblank A vblank object
1531 * @param[in] enable_fake 1:enable, 0:disable
1532 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1535 tdm_vblank_set_enable_fake(tdm_vblank *vblank, unsigned int enable_fake);
1538 * @brief Get the fake vblank
1539 * @param[in] vblank A vblank object
1540 * @param[out] enable_fake 1:enable, 0:disable
1541 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1544 tdm_vblank_get_enable_fake(tdm_vblank *vblank, unsigned int *enable_fake);
1547 * @brief Wait for a vblank
1549 * Once #tdm_vblank_wait returns TDM_ERROR_NONE, the user vblank handler(#tdm_vblank_handler)
1550 * SHOULD be called after the given interval. \n
1551 * The sequence value of tdm_vblank_handler is the relative value of fps.
1552 * If fps = 10, this sequence value should be increased by 10 during 1 second.
1553 * @param[in] vblank A vblank object
1554 * @param[in] req_sec The vblank request time(second)
1555 * @param[in] req_usec The vblank request time(micro-second)
1556 * @param[in] interval The vblank interval
1557 * @param[in] func The user vblank handler
1558 * @param[in] user_data The user data
1559 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1562 tdm_vblank_wait(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1563 unsigned int interval, tdm_vblank_handler func, void *user_data);
1566 * @brief Wait for a vblank with the target sequence number
1567 * @param[in] vblank A vblank object
1568 * @param[in] req_sec The vblank request time(second)
1569 * @param[in] req_usec The vblank request time(micro-second)
1570 * @param[in] sequence The target sequence number
1571 * @param[in] func The user client vblank handler
1572 * @param[in] user_data The user data
1573 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1576 tdm_vblank_wait_seq(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1577 unsigned int sequence, tdm_vblank_handler func, void *user_data);
1583 #endif /* _TDM_H_ */