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 pp vertical preferred align of a display object.
154 * @details -1 means that a TDM backend module doesn't define the value.
155 * @param[in] dpy A display object
156 * @param[out] preferred_align_vertical The preferred align height which TDM can handle
157 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
160 tdm_display_get_pp_preferred_align_vertical(tdm_display *dpy, int *preferred_align_vertical);
164 * @brief Get the capture capabilities of a display object.
165 * @param[in] dpy A display object
166 * @param[out] capabilities The capture capabilities
167 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
170 tdm_display_get_capture_capabilities(tdm_display *dpy,
171 tdm_capture_capability *capabilities);
174 * @brief Get the capture available format array of a display object.
175 * @param[in] dpy A display object
176 * @param[out] formats The capture available format array
177 * @param[out] count The count of formats
178 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
181 tdm_display_get_capture_available_formats(tdm_display *dpy,
182 const tbm_format **formats, int *count);
185 * @brief Get the capture available size of a display object.
186 * @details -1 means that a TDM backend module doesn't define the value.
187 * @param[in] dpy A display object
188 * @param[out] min_w The minimum width which TDM can handle
189 * @param[out] min_h The minimum height which TDM can handle
190 * @param[out] max_w The maximum width which TDM can handle
191 * @param[out] max_h The maximum height which TDM can handle
192 * @param[out] preferred_align The preferred align width which TDM can handle
193 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
196 tdm_display_get_capture_available_size(tdm_display *dpy, int *min_w, int *min_h,
197 int *max_w, int *max_h, int *preferred_align);
200 * @brief Get the output counts which a display object has.
201 * @param[in] dpy A display object
202 * @param[out] count The count of outputs
203 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
204 * @see tdm_display_get_output
207 tdm_display_get_output_count(tdm_display *dpy, int *count);
210 * @brief Get a output object which has the given index.
211 * @param[in] dpy A display object
212 * @param[in] index The index of a output object
213 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
214 * @return A output object if success. Otherwise, NULL.
215 * @see tdm_display_get_output_count
218 tdm_display_get_output(tdm_display *dpy, int index, tdm_error *error);
221 * @brief Add a output create handler
222 * @param[in] output A output object
223 * @param[in] func A output create handler
224 * @param[in] user_data The user data
225 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
228 tdm_display_add_output_create_handler(tdm_display *dpy,
229 tdm_output_create_handler func,
233 * @brief Remove a output create handler
234 * @param[in] output A output object
235 * @param[in] func A output create handler
236 * @param[in] user_data The user data
237 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
240 tdm_display_remove_output_create_handler(tdm_display *dpy,
241 tdm_output_create_handler func,
245 * @brief Find a output object which has the given name.
246 * @param[in] dpy A display object
247 * @param[in] name The name of a output object
248 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
249 * @return A output object if success. Otherwise, NULL.
252 tdm_display_find_output(tdm_display *dpy, const char *name, tdm_error *error);
255 * @brief Create a pp object.
256 * @param[in] dpy A display object
257 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
258 * @return A pp object if success. Otherwise, NULL.
259 * @see tdm_pp_destroy
262 tdm_display_create_pp(tdm_display *dpy, tdm_error *error);
265 * @brief Get the information of the TDM backend module.
266 * @param[in] module A backend module object
267 * @param[out] name The name of the TDM backend module
268 * @param[out] vendor The vendor of the TDM backend module
269 * @param[out] version The version of the TDM backend module
270 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
273 tdm_module_get_info(tdm_module *module, const char **name,
274 const char **vendor, int *major, int *minor);
277 * @brief Add a output destroy handler
278 * @param[in] output A output object
279 * @param[in] func A output destroy handler
280 * @param[in] user_data The user data
281 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
284 tdm_output_add_destroy_handler(tdm_output *output,
285 tdm_output_destroy_handler func,
289 * @brief Remove a output destroy handler
290 * @param[in] output A output object
291 * @param[in] func A output destroy handler
292 * @param[in] user_data The user data
293 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
296 tdm_output_remove_destroy_handler(tdm_output *output,
297 tdm_output_destroy_handler func,
301 * @brief Get a backend module object of the given output.
302 * @param[in] output A output object
303 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
304 * @return A backend object if success. Otherwise, NULL.
307 tdm_output_get_backend_module(tdm_output *output, tdm_error *error);
310 * @brief Get the capabilities of a output object.
311 * @param[in] output A output object
312 * @param[out] capabilities The capabilities of a output object
313 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
316 tdm_output_get_capabilities(tdm_output *output,
317 tdm_output_capability *capabilities);
320 * @brief Get the model information of a output object.
321 * @param[in] output A output object
322 * @param[out] maker The output maker.
323 * @param[out] model The output model.
324 * @param[out] name The output name.
325 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
328 tdm_output_get_model_info(tdm_output *output, const char **maker,
329 const char **model, const char **name);
332 * @brief Get the connection status of a output object.
333 * @param[in] output A output object
334 * @param[out] status The connection status.
335 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
338 tdm_output_get_conn_status(tdm_output *output, tdm_output_conn_status *status);
341 * @brief Add a output change handler
342 * @details The handler will be called when the status of a
343 * output object is changed. connection, DPMS, etc.
344 * @param[in] output A output object
345 * @param[in] func A output change handler
346 * @param[in] user_data The user data
347 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
350 tdm_output_add_change_handler(tdm_output *output,
351 tdm_output_change_handler func,
355 * @brief Remove a output change handler
356 * @param[in] output A output object
357 * @param[in] func A output change handler
358 * @param[in] user_data The user data
359 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
362 tdm_output_remove_change_handler(tdm_output *output,
363 tdm_output_change_handler func,
367 * @brief Add a output mode change handler
368 * @param[in] output A output object
369 * @param[in] func A output mode change handler
370 * @param[in] user_data The user data
371 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
374 tdm_output_add_mode_change_request_handler(tdm_output *output,
375 tdm_output_mode_change_request_handler func,
379 * @brief Remove a output mode change handler
380 * @param[in] output A output object
381 * @param[in] func A output mode change handler
382 * @param[in] user_data The user data
383 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
386 tdm_output_remove_mode_change_request_handler(tdm_output *output,
387 tdm_output_mode_change_request_handler func,
391 * @brief Get the connection type of a output object.
392 * @param[in] output A output object
393 * @param[out] type The connection type.
394 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
397 tdm_output_get_output_type(tdm_output *output, tdm_output_type *type);
400 * @brief Get the layer counts which a output object has.
401 * @param[in] output A output object
402 * @param[out] count The count of layers
403 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
404 * @see tdm_output_get_layer
407 tdm_output_get_layer_count(tdm_output *output, int *count);
410 * @brief Get a layer object which has the given index.
411 * @param[in] output A output object
412 * @param[in] index The index of a layer object
413 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
414 * @return A layer object if success. Otherwise, NULL.
415 * @see tdm_output_get_layer_count
418 tdm_output_get_layer(tdm_output *output, int index, tdm_error *error);
421 * @brief Get the available property array of a output object.
422 * @param[in] output A output object
423 * @param[out] props The available property array
424 * @param[out] count The count of properties
425 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
428 tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props,
432 * @brief Get the available mode array of a output object.
433 * @param[in] output A output object
434 * @param[out] modes The available mode array
435 * @param[out] count The count of modes
436 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
439 tdm_output_get_available_modes(tdm_output *output,
440 const tdm_output_mode **modes, int *count);
443 * @brief Get the available size of a output object.
444 * @details -1 means that a TDM backend module doesn't define the value.
445 * @param[in] output A output object
446 * @param[out] min_w The minimum width which TDM can handle
447 * @param[out] min_h The minimum height which TDM can handle
448 * @param[out] max_w The maximum width which TDM can handle
449 * @param[out] max_h The maximum height which TDM can handle
450 * @param[out] preferred_align The preferred align width which TDM can handle
451 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
454 tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h,
455 int *max_w, int *max_h, int *preferred_align);
458 * @brief Get the available cursor size of a output object.
459 * @details -1 means that a TDM backend module doesn't define the value.
460 * @param[in] output A output object
461 * @param[out] min_w The minimum width which TDM can handle
462 * @param[out] min_h The minimum height which TDM can handle
463 * @param[out] max_w The maximum width which TDM can handle
464 * @param[out] max_h The maximum height which TDM can handle
465 * @param[out] preferred_align The preferred align width which TDM can handle
466 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
469 tdm_output_get_cursor_available_size(tdm_output *output, int *min_w, int *min_h,
470 int *max_w, int *max_h, int *preferred_align);
473 * @brief Get the physical size of a output object.
474 * @param[in] output A output object
475 * @param[out] mmWidth The milimeter width
476 * @param[out] mmHeight The milimeter height
477 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
480 tdm_output_get_physical_size(tdm_output *output, unsigned int *mmWidth,
481 unsigned int *mmHeight);
484 * @brief Get the subpixel of a output object.
485 * @param[in] output A output object
486 * @param[out] subpixel The subpixel
487 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
490 tdm_output_get_subpixel(tdm_output *output, unsigned int *subpixel);
493 * @brief Get the pipe of a output object.
494 * @param[in] output A output object
495 * @param[out] pipe The pipe
496 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
499 tdm_output_get_pipe(tdm_output *output, unsigned int *pipe);
502 * @brief Get the index of a primary layer.
503 * @param[in] output A output object
504 * @param[out] index The primary layer index
505 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
508 tdm_output_get_primary_index(tdm_output *output, int *index);
511 * @brief Set the property which has a given id.
512 * @param[in] output A output object
513 * @param[in] id The property id
514 * @param[in] value The value
515 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
518 tdm_output_set_property(tdm_output *output, unsigned int id, tdm_value value);
521 * @brief Get the property which has a given id
522 * @param[in] output A output object
523 * @param[in] id The property id
524 * @param[out] value The value
525 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
528 tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value);
531 * @brief Wait for VBLANK
532 * @details After interval vblanks, a user vblank handler will be called.
533 * @param[in] output A output object
534 * @param[in] interval vblank interval
535 * @param[in] sync 0: asynchronous, 1:synchronous
536 * @param[in] func A user vblank handler
537 * @param[in] user_data The user data
538 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
539 * @see #tdm_output_vblank_handler
542 tdm_output_wait_vblank(tdm_output *output, int interval, int sync,
543 tdm_output_vblank_handler func, void *user_data);
546 * @brief Commit changes for a output object
547 * @details After all change of a output object are applied, a user commit handler
549 * @param[in] output A output object
550 * @param[in] sync 0: asynchronous, 1:synchronous
551 * @param[in] func A user commit handler
552 * @param[in] user_data The user data
553 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
554 * @see #tdm_layer_commit
557 tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func,
561 * @brief Remove the user vblank handler
562 * @param[in] output A output object
563 * @param[in] func A user vblank handler
564 * @param[in] user_data The user data
565 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
568 tdm_output_remove_vblank_handler(tdm_output *output, tdm_output_vblank_handler func, void *user_data);
571 * @brief Remove the user commit handler
572 * @param[in] output A output object
573 * @param[in] func A user commit handler
574 * @param[in] user_data The user data
575 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
578 tdm_output_remove_commit_handler(tdm_output *output, tdm_output_commit_handler func, void *user_data);
581 * @brief Set one of available modes of a output object
582 * @param[in] output A output object
583 * @param[in] mode A output mode
584 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
587 tdm_output_set_mode(tdm_output *output, const tdm_output_mode *mode);
590 * @brief Get the mode of a output object
591 * @param[in] output A output object
592 * @param[out] mode A output mode
593 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
596 tdm_output_get_mode(tdm_output *output, const tdm_output_mode **mode);
599 * @brief Set DPMS of a output object synchronously
600 * @param[in] output A output object
601 * @param[in] dpms_value DPMS value
602 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
603 * @see tdm_output_set_dpms_async
606 tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value);
609 * @brief Set DPMS of a output object asynchronously
610 * @details This function can be used when a output supports the asynchronous DPMS
611 * control. The output has #TDM_OUTPUT_CAPABILITY_ASYNC_DPMS flags which
612 * #tdm_output_get_capabilities returns. If an output change handler is added with
613 * #tdm_output_add_change_handler, the output change handler will be called when
614 * the DPMS status is changed indeed.
615 * @param[in] output A output object
616 * @param[in] dpms_value DPMS value
617 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
618 * @see tdm_output_add_change_handler, tdm_output_set_dpms,
619 * tdm_output_get_capabilities, #TDM_OUTPUT_CAPABILITY_ASYNC_DPMS.
622 tdm_output_set_dpms_async(tdm_output *output, tdm_output_dpms dpms_value);
625 * @brief Get DPMS of a output object
626 * @param[in] output A output object
627 * @param[out] dpms_value DPMS value
628 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
631 tdm_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value);
634 * @brief Check if a output object has the capture capability
635 * @param[in] output A output object
636 * @param[out] has_capability 1: has the capability, 0: not has the capability
637 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
640 tdm_output_has_capture_capability(tdm_output *output, unsigned int *has_capability);
643 * @brief Create a capture object of a output object
644 * @param[in] output A output object
645 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
646 * @return A capture object
647 * @see tdm_capture_destroy
650 tdm_output_create_capture(tdm_output *output, tdm_error *error);
653 * @brief Get a hwc associated with a output object.
654 * @param[in] output A output object
655 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
656 * @return A hwc object
660 tdm_output_get_hwc(tdm_output *output, tdm_error *error);
663 * @brief Set the mirror image of the src_output to the output
664 * @param[in] output A output object to display the src_output image
665 * @param[in] src_output A src output object of which image is displayed on the output
666 * @param[in] transform A transform value
667 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
670 tdm_output_set_mirror(tdm_output *output, tdm_output *src_output, tdm_transform transform);
673 * @brief Unset the mirror
674 * @param[in] output A output object
675 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
678 tdm_output_unset_mirror(tdm_output *output);
681 * @brief Get a output object of a layer object
682 * @param[in] layer A layer object
683 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
684 * @return A TDM output object if success. Otherwise, NULL.
687 tdm_layer_get_output(tdm_layer *layer, tdm_error *error);
690 * @brief Get the index of a layer object.
691 * @param[in] layer A layer object
692 * @param[out] index The index of a layer object
693 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
696 tdm_layer_get_index(tdm_layer *layer, int *index);
699 * @brief Get the capabilities of a layer object.
700 * @param[in] layer A layer object
701 * @param[out] capabilities The capabilities of a layer object
702 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
705 tdm_layer_get_capabilities(tdm_layer *layer,
706 tdm_layer_capability *capabilities);
709 * @brief Get the available format array of a layer object.
710 * @param[in] layer A layer object
711 * @param[out] formats The available format array
712 * @param[out] count The count of formats
713 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
716 tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats,
720 * @brief Get the available property array of a layer object.
721 * @param[in] layer A layer object
722 * @param[out] props The available property array
723 * @param[out] count The count of properties
724 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
727 tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props,
731 * @brief Get the zpos of a layer object.
733 * - GRAPHIC layers have fixed zpos. It starts from 0. It's @b non-changeable.
734 * - But the zpos of VIDEO layers will be decided by a backend module side.
735 * - A frontend user only can set the relative zpos to VIDEO layers via #tdm_layer_set_video_pos
736 * - The zpos of video layers is less than GRAPHIC layers or more than GRAPHIC
737 * layers. ie, ..., -2, -1, 4, 5, ... (if 0 <= GRAPHIC layer's zpos < 4).
738 * -------------------------------- graphic layer 3 <-- top most layer
739 * -------------------------------- graphic layer 2
740 * -------------------------------- graphic layer 1
741 * -------------------------------- graphic layer 0
742 * -------------------------------- video layer -1
743 * -------------------------------- video layer -2 <-- lowest layer
744 * @param[in] layer A layer object
745 * @param[out] zpos The zpos
746 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
747 * @see tdm_layer_set_video_pos, tdm_layer_capability
750 tdm_layer_get_zpos(tdm_layer *layer, int *zpos);
753 * @brief Set the property which has a given id.
754 * @param[in] layer A layer object
755 * @param[in] id The property id
756 * @param[in] value The value
757 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
760 tdm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
763 * @brief Get the property which has a given id.
764 * @param[in] layer A layer object
765 * @param[in] id The property id
766 * @param[out] value The value
767 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
770 tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
773 * @brief Set the geometry information to a layer object
774 * @details The geometry information will be applied when the output object
775 * of a layer object is committed. If a layer has TDM_LAYER_CAPABILITY_NO_CROP
776 * capability, a layer will ignore the pos(crop) information of #tdm_info_layer's
778 * @param[in] layer A layer object
779 * @param[in] info The geometry information
780 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
781 * @see tdm_layer_commit
784 tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info);
787 * @brief Get the geometry information to a layer object
788 * @param[in] layer A layer object
789 * @param[out] info The geometry information
790 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
793 tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info);
796 * @brief Set a TDM buffer to a layer object
797 * @details A TDM buffer will be applied when the output object
798 * of a layer object is committed.
799 * @param[in] layer A layer object
800 * @param[in] buffer A TDM buffer
801 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
802 * @see tdm_layer_commit
805 tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer);
808 * @brief Unset a TDM buffer from a layer object
809 * @details When this function is called, a current showing buffer will be
810 * disappeared from screen. Then nothing is showing on a layer object.
811 * @param[in] layer A layer object
812 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
815 tdm_layer_unset_buffer(tdm_layer *layer);
818 * @brief Commit changes for a layer object
819 * @details After all change of a layer object are applied, a user commit handler
821 * @param[in] layer A layer object
822 * @param[in] func A user commit handler
823 * @param[in] user_data The user data
824 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
827 tdm_layer_commit(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
830 tdm_layer_is_committing(tdm_layer *layer, unsigned int *committing);
833 * @brief Remove the user commit handler
834 * @param[in] layer A layer object
835 * @param[in] func A user commit handler
836 * @param[in] user_data The user data
837 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
840 tdm_layer_remove_commit_handler(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
843 * @brief Get a displaying TDM buffer from a layer object
844 * @details A displaying TDM buffer is a current showing buffer on screen
845 * that is set to layer object and applied output object of a layer object.
846 * @param[in] layer A layer object
847 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
848 * @return A TDM buffer if success. Otherwise, NULL.
851 tdm_layer_get_displaying_buffer(tdm_layer *layer, tdm_error *error);
854 * @brief Set a TBM surface_queue to a layer object
855 * @details A TBM surface_queue will be applied when the output object
856 * of a layer object is committed. and TDM layer will be automatically updated
857 * @param[in] layer A layer object
858 * @param[in] buffer_queue A TBM surface_queue
859 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
860 * @see tdm_layer_commit
863 tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue);
866 * @brief Unset a TBM surface_queue from a layer object
867 * @details When this function is called, a current surface_queue will be
868 * disappeared from screen. Then nothing is showing on a layer object.
869 * @param[in] layer A layer object
870 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
873 tdm_layer_unset_buffer_queue(tdm_layer *layer);
876 * @brief Check wheter a layer object is available for a frontend user to use.
877 * @details A layer object is not usable if a TDM buffer is showing on screen
878 * via this layer object. By calling #tdm_layer_unset_buffer, this layer object
879 * will become usable.
880 * @param[in] layer A layer object
881 * @param[out] usable 1 if usable, 0 if not usable
882 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
885 tdm_layer_is_usable(tdm_layer *layer, unsigned int *usable);
888 * @brief Set the relative zpos to a VIDEO layer object
889 * @details The zpos value is less than the minimum zpos of GRAPHIC layers, or
890 * it is more than the maximum zpos of GRAPHIC layers.
891 * @param[in] layer A VIDEO layer object
892 * @param[in] zpos The zpos
893 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
894 * @see tdm_layer_get_zpos, tdm_layer_capability
897 tdm_layer_set_video_pos(tdm_layer *layer, int zpos);
900 * @brief Create a capture object of a layer object
901 * @param[in] layer A layer object
902 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
903 * @return A capture object
904 * @see tdm_capture_destroy
907 tdm_layer_create_capture(tdm_layer *layer, tdm_error *error);
910 * @brief Get buffer flags from a layer object
911 * @param[in] layer A layer object
912 * @param[out] flags a buffer flags value
913 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
916 tdm_layer_get_buffer_flags(tdm_layer *layer, unsigned int *flags);
919 * @brief Creates a new window on the given hwc.
920 * @param[in] hwc A hwc object
921 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
922 * @return A created window object
926 tdm_hwc_create_window(tdm_hwc *hwc, tdm_error *error);
929 * @brief Get the video supported format array for hwc windows of a output object.
930 * @param[in] hwc A hwc object
931 * @param[out] formats The available format array
932 * @param[out] count The count of formats
933 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
936 tdm_hwc_get_video_supported_formats(tdm_hwc *hwc, const tbm_format **formats,
939 * @brief Get the available video property array of a hwc object.
940 * @param[in] hwc A hwc
941 * @param[out] props The available video property array
942 * @param[out] count The count of video properties
943 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
946 tdm_hwc_get_video_available_properties(tdm_hwc *hwc, const tdm_prop **props, int *count);
949 * @brief Get the hwc capabilites
950 * @param[in] hwc A hwc object
951 * @param[out] capabilities A hwc capability
952 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
955 tdm_hwc_get_capabilities(tdm_hwc *hwc, tdm_hwc_capability *capabilities);
958 * @brief Get the available property array of a hwc object.
959 * @param[in] hwc A hwc
960 * @param[out] props The available property array
961 * @param[out] count The count of properties
962 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
965 tdm_hwc_get_available_properties(tdm_hwc *hwc, const tdm_prop **props, int *count);
968 * @brief Get a target buffer queue
969 * @details The client composites the tdm_hwd_windows which have
970 * TDM_COMPOSITE_CLIENT types on the buffer from this target buffer queue.
971 * Then, the client set the buffer by calling tdm_hwc_set_client_target_buffer.
972 * @param[in] output A output object
973 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
974 * @return A buffer queue
978 tdm_hwc_get_client_target_buffer_queue(tdm_hwc *hwc, tdm_error *error);
981 * @brief Set the client(relative to the TDM) target buffer
982 * @details This function lets the backend know the target buffer.
983 * The target buffer contains the result of the gl composition with the
984 * tdm_hwc_windows which marked as TDM_HWC_WIN_COMPOSITION_CLIENT.
985 * @param[in] hwc A output hwc
986 * @param[in] target_buffer The new target buffer
987 * @param[in] damage The buffer damage region
988 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
992 tdm_hwc_set_client_target_buffer(tdm_hwc *hwc, tbm_surface_h target_buffer, tdm_region damage);
995 * @brief Set the acquire fence fd of client(relative to the TDM) target
996 * @param[in] hwc A output hwc
997 * @param[in] acquire_fence The acquire fence fd of target
998 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1001 tdm_hwc_set_client_target_acquire_fence(tdm_hwc *hwc, int acquire_fence);
1004 * @brief Validate the output
1005 * @details Instructs the backend to inspect all of the hw layer state and
1006 * determine if there are any composition type changes necessary before
1007 * presenting the hwc.
1008 * @param[in] hwc A hwc object
1009 * @param[in] composited_wnds the hwc window list which is visible.
1010 * @param[in] num_wnds the number of the visible windows in the composited_wnds
1011 * @param[out] num_types The number of composition type changes
1012 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1014 * The backend has to return the num_types when the assgined comopsite types of
1015 * the tdm_hwc_windows in the composited_wnds. If the num_types is greater than
1016 * 0, the cleint must get the changed composite types of the tdm_hwc_windows
1017 * and change the comopsite types
1021 tdm_hwc_validate(tdm_hwc *hwc, tdm_hwc_window **composited_wnds, uint32_t num_wnds,
1022 uint32_t *num_types);
1025 * @brief Get changed composition types
1026 * @details Retrieves the windows for which the backend requires a different
1027 * composition types that had been set prior to the last call to tdm_hwc_validate().
1028 * The client will either update its state with these types and call
1029 * tdm_hwc_accept_validation, or will set new types and attempt to validate the
1030 * display again. The number of elements returned must be the same as the
1031 * value returned in num_types from the last call to tdm_hwc_validate().
1032 * @param[in] hwc A hwc object
1033 * @param[out] num_elements the number of hwc_windows
1034 * @param[out] windows An array of windows
1035 * @param[out] composition_types An array of composition types, each corresponding
1036 * to an element of windows
1037 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1042 tdm_hwc_get_changed_composition_types(tdm_hwc *hwc, uint32_t *num_elements,
1043 tdm_hwc_window **hwc_window,
1044 tdm_hwc_window_composition *composition_types);
1047 * @brief Accepts the validation required by the backend
1048 * @details Accepts the validation required by the backend from the previous
1049 * tdm_hwc_validate() and tdm_hwc_get_chaged_composition_types().
1050 * @param[in] hwc A hwc object
1051 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1055 tdm_hwc_accept_validation(tdm_hwc *hwc);
1058 * @brief Commit changes for a hwc
1059 * @details After all change of a window object are applied, a user commit handler
1061 * @param[in] hwc A hwc object
1062 * @param[in] sync 0: asynchronous, 1:synchronous
1063 * @param[in] func A user commit handler
1064 * @param[in] user_data The user data
1065 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1068 tdm_hwc_commit(tdm_hwc *hwc, int sync, tdm_hwc_commit_handler func, void *user_data);
1071 * @brief Get commit fence
1072 * @details After all change of a window object are applied to last tdm_hwc_commit,
1073 * the fence is signaled.
1074 * @param[in] hwc A hwc object
1075 * @param[out] commit_fence the commit fence fd of tdm_hwc_commit
1076 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1079 tdm_hwc_get_commit_fence(tdm_hwc *hwc, int *commit_fence);
1082 * @brief Get release fences
1083 * @details Retrieves the windows which the backend requires setting the release fences
1084 * the release fence is signaled when the backend is no longer using previous buffer.
1085 * @param[in] hwc A hwc object
1086 * @param[out] num_elements the number of hwc_windows
1087 * @param[out] hwc_windows An array of windows
1088 * @param[out] release_fences An array of release fences, each corresponding
1089 * to an element of windows
1090 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1093 tdm_hwc_get_release_fences(tdm_hwc *hwc, uint32_t *num_elements,
1094 tdm_hwc_window **hwc_windows, int *fences);
1097 * @brief Set the property which has a given id on the hwc object.
1098 * @param[in] hwc A hwc object
1099 * @param[in] id The property id
1100 * @param[in] value The value of the propery id
1101 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1104 tdm_hwc_set_property(tdm_hwc *hwc, uint32_t id, tdm_value value);
1107 * @brief Get the property which has a given id on the hwc object.
1108 * @param[in] hwc A hwc object
1109 * @param[in] id The property id
1110 * @param[in] value The value of the propery id
1111 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1114 tdm_hwc_get_property(tdm_hwc *hwc, uint32_t id, tdm_value *value);
1117 * @brief Destroys the given window.
1118 * @param[in] window the pointer of the window to destroy
1122 tdm_hwc_window_destroy(tdm_hwc_window *hwc_window);
1125 * @brief Acquire a buffer queue for the window object
1126 * @details These buffers are used to composite by hardware a client content in
1128 * @param[in] hwc_window A window object
1129 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1130 * @return A tbm buffer queue
1134 tdm_hwc_window_acquire_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error);
1137 * @brief Release a buffer queue for the window object
1138 * @details Release buffer queue when the client no longer uses buffers of queue.
1139 * @param[in] hwc_window A window object
1140 * @param[in] A tbm buffer queue
1144 tdm_hwc_window_release_buffer_queue(tdm_hwc_window *hwc_window, tbm_surface_queue_h queue);
1147 * @brief Sets the desired composition type of the given window.
1148 * @details During tdm_hwc_validate(), the backend may request changes to
1149 * the composition types of any of the layers as described in the definition
1150 * of tdm_hwc_window_composition_t above.
1151 * @param[in] hwc_window A window object
1152 * @param[in] composition_type The new composition type
1153 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1157 tdm_hwc_window_set_composition_type(tdm_hwc_window *hwc_window,
1158 tdm_hwc_window_composition composition_type);
1161 * @brief Set the buffer damage
1162 * @details Provides the region of the source buffer which has been modified
1163 * since the last frame. This region does not need to be validated before
1164 * calling tdm_output_commit().
1165 * Once set through this function, the damage region remains the same until a
1166 * subsequent call to this function.
1167 * If damage.num_rects > 0, then it may be assumed that any portion of the source
1168 * buffer not covered by one of the rects has not been modified this frame. If
1169 * damage.num_rects == 0, then the whole source buffer must be treated as if it
1170 * has been modified.
1171 * If the layer's contents are not modified relative to the prior frame, damage
1172 * will contain exactly one empty rect([0, 0, 0, 0]).
1173 * The damage rects are relative to the pre-transformed buffer, and their origin
1174 * is the top-left corner. They will not exceed the dimensions of the latched
1176 * @param[in] hwc_window A window object
1177 * @param[in] damage The new buffer damage region
1178 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1182 tdm_hwc_window_set_buffer_damage(tdm_hwc_window *hwc_window, tdm_region damage);
1185 * @brief Set the information to a window object
1186 * @details The information will be applied when the hwc object is committed.
1187 * @param[in] hwc_window A window object
1188 * @param[in] info The information
1189 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1193 tdm_hwc_window_set_info(tdm_hwc_window *hwc_window, tdm_hwc_window_info *info);
1196 * @brief Set a TBM buffer to a window object
1197 * @details A TBM buffer will be applied when the output object of a layer
1198 * object is committed.
1199 * @param[in] hwc_window A window object
1200 * @param[in] buffer A TBM buffer
1201 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1205 tdm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer);
1208 * @brief Set the property which has a given id.
1209 * @param[in] hwc_window A hwc window object
1210 * @param[in] id The property id
1211 * @param[in] value The value of the propery id
1212 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1215 tdm_hwc_window_set_property(tdm_hwc_window *hwc_window, uint32_t id, tdm_value value);
1218 * @brief Get the property which has a given id.
1219 * @param[in] hwc_window A hwc window object
1220 * @param[in] id The property id
1221 * @param[out] value The value of the propery id
1222 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1225 tdm_hwc_window_get_property(tdm_hwc_window *hwc_window, uint32_t id, tdm_value *value);
1228 * @brief Get the constraints of hwc_window
1229 * @param[in] hwc_window A hwc window object
1230 * @param[out] constraints The tdm_hwc_window_constraint types
1231 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1234 tdm_hwc_window_get_constraints(tdm_hwc_window *hwc_window, int *constraints);
1237 * @brief Set the name of hwc_window
1238 * @param[in] hwc_window A hwc window object
1239 * @param[in] name of the hwc_window
1240 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1243 tdm_hwc_window_set_name(tdm_hwc_window *hwc_window, const char *name);
1246 * @brief Get buffer flags of cursor hwc_window
1247 * @param[in] hwc_window A hwc window object
1248 * @param[in] width of the cursor image
1249 * @param[in] height of the cursor image
1250 * @param[in] stride of the cursor image
1251 * @param[in] virtual address of the cursor image
1252 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1255 tdm_hwc_window_set_cursor_image(tdm_hwc_window *hwc_window, int width, int height, int stride, void *ptr);
1258 * @brief Set the acquire fence of hwc_window
1259 * @param[in] hwc_window A hwc window object
1260 * @param[in] acquire_fence the acquire fence fd of a hwc window object
1261 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1264 tdm_hwc_window_set_acquire_fence(tdm_hwc_window *hwc_window, int acquire_fence);
1267 * @brief Destroy a pp object
1268 * @param[in] pp A pp object
1269 * @see tdm_display_create_pp
1272 tdm_pp_destroy(tdm_pp *pp);
1275 * @brief Set the geometry information to a pp object
1276 * @param[in] pp A pp object
1277 * @param[in] info The geometry information
1278 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1279 * @see tdm_pp_commit
1282 tdm_pp_set_info(tdm_pp *pp, tdm_info_pp *info);
1285 * @brief Set the PP done handler to a pp object
1287 * The user PP done handler will be called after converting a source buffer's image
1288 * to a destination buffer.
1289 * @param[in] pp A pp object
1290 * @param[in] func A user PP done handler
1291 * @param[in] user_data The user data
1292 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1295 tdm_pp_set_done_handler(tdm_pp *pp, tdm_pp_done_handler func, void *user_data);
1298 * @brief Attach a source buffer and a destination buffer to a pp object
1299 * @param[in] pp A pp object
1300 * @param[in] src A source buffer
1301 * @param[in] dst A destination buffer
1302 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1303 * @see tdm_pp_commit, tdm_pp_set_done_handler
1306 tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
1309 * @brief Commit changes for a pp object
1310 * @param[in] pp A pp object
1311 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1314 tdm_pp_commit(tdm_pp *pp);
1317 * @brief Destroy a capture object
1318 * @param[in] capture A capture object
1319 * @see tdm_output_create_capture, tdm_layer_create_capture
1322 tdm_capture_destroy(tdm_capture *capture);
1325 * @brief Set the geometry information to a capture object
1326 * @param[in] capture A capture object
1327 * @param[in] info The geometry information
1328 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1329 * @see tdm_capture_commit
1332 tdm_capture_set_info(tdm_capture *capture, tdm_info_capture *info);
1335 * @brief Set the capture done handler to a capture object
1337 * The user capture done handler will be called after capturing a screen into a
1339 * @param[in] capture A capture object
1340 * @param[in] func A user capture done handler
1341 * @param[in] user_data The user data
1342 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1345 tdm_capture_set_done_handler(tdm_capture *capture, tdm_capture_done_handler func, void *user_data);
1348 * @brief Attach a TDM buffer to a capture object
1349 * @param[in] capture A capture object
1350 * @param[in] buffer A TDM buffer
1351 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1352 * @see tdm_capture_commit, tdm_capture_set_done_handler
1355 tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer);
1358 * @brief Commit changes for a capture object
1359 * @param[in] capture A capture object
1360 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1363 tdm_capture_commit(tdm_capture *capture);
1366 * @brief The release handler of a TDM buffer
1367 * @param[in] buffer A TDM buffer
1368 * @param[in] user_data user data
1369 * @see tdm_buffer_add_release_handler, tdm_buffer_remove_release_handler
1371 typedef void (*tdm_buffer_release_handler)(tbm_surface_h buffer,
1375 * @brief Add a release handler to a TDM buffer
1377 * TDM has its own buffer release mechanism to let an frontend user know when a TDM buffer
1378 * becomes available for a next job. A TDM buffer can be used for TDM to show
1379 * it on screen or to capture an output and a layer. After all operations,
1380 * TDM will release it immediately when TDM doesn't need it any more.
1381 * @param[in] buffer A TDM buffer
1382 * @param[in] func A release handler
1383 * @param[in] user_data user data
1384 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1385 * @see tdm_buffer_remove_release_handler
1388 tdm_buffer_add_release_handler(tbm_surface_h buffer,
1389 tdm_buffer_release_handler func, void *user_data);
1392 * @brief Remove a release handler from a TDM buffer
1393 * @param[in] buffer A TDM buffer
1394 * @param[in] func A release handler
1395 * @param[in] user_data user data
1396 * @see tdm_buffer_add_release_handler
1399 tdm_buffer_remove_release_handler(tbm_surface_h buffer,
1400 tdm_buffer_release_handler func, void *user_data);
1403 * @brief The handler of a vblank object
1404 * @see #tdm_vblank_wait, #tdm_vblank_wait_seq
1406 typedef void (*tdm_vblank_handler)(tdm_vblank *vblank, tdm_error error, unsigned int sequence,
1407 unsigned int tv_sec, unsigned int tv_usec, void *user_data);
1410 * @brief Set the vblank fps for the given PID and name.
1411 * @param[in] pid The process ID
1412 * @param[in] name The client vblank name
1413 * @param[in] fps The client vblank fps
1414 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1417 tdm_vblank_set_client_vblank_fps(unsigned int pid, const char *name, unsigned int fps);
1420 * @brief Set the ignore global fps for the given PID and name.
1421 * @param[in] pid The process ID
1422 * @param[in] name The client vblank name
1423 * @param[in] ignore 1: ignore 0:not ignore(default)
1424 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1427 tdm_vblank_set_client_ignore_global_fps(unsigned int pid, const char *name, unsigned int ignore);
1430 * @brief Set the vblank global fps for the entire system.
1431 * @param[in] enable 1:enable, 0:disable
1432 * @param[in] fps The vblank global fps
1434 * This global fps will be applied to all client's vblanks for all outputs.
1435 * If the client's vblank fps is less than this, the global fps will be ignored
1436 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1437 * the global fps, it will be ignored also.
1438 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1441 tdm_vblank_enable_global_fps(unsigned int enable, unsigned int fps);
1444 * @brief Add the vblank create handler.
1445 * @param[in] dpy A display object
1446 * @param[in] func The user vblank create handler
1447 * @param[in] user_data The user data
1449 * The user vblank create handler will be called when new vblank object created.
1450 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1453 tdm_vblank_add_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1456 * @brief Remove the vblank create handler.
1457 * @param[in] dpy A display object
1458 * @param[in] func The user vblank create handler
1459 * @param[in] user_data The user data
1460 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1463 tdm_vblank_remove_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1466 * @brief Create a vblank object
1467 * @param[in] dpy A display object
1468 * @param[in] output A output object
1469 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1470 * @return A vblank object
1471 * @see #tdm_vblank_destroy
1474 tdm_vblank_create(tdm_display *dpy, tdm_output *output, tdm_error *error);
1477 * @brief Destroy a vblank object
1478 * @param[in] vblank A vblank object
1479 * @see #tdm_vblank_create
1482 tdm_vblank_destroy(tdm_vblank *vblank);
1485 * @brief Get a output object of a vblank object
1486 * @param[in] vblank A vblank object
1487 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1488 * @return A TDM output object if success. Otherwise, NULL.
1489 * @see #tdm_vblank_create
1492 tdm_vblank_get_output(tdm_vblank *vblank, tdm_error *error);
1495 * @brief Get the client PID for a vblank object
1496 * @param[in] vblank A vblank object
1497 * @param[out] pid PID of vblank's client
1498 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1501 tdm_vblank_get_client_pid(tdm_vblank *vblank, pid_t *pid);
1504 * @brief Set the name to a vblank object
1505 * @details The default name is "unknown"
1506 * @param[in] vblank A vblank object
1507 * @param[in] name vblank name
1508 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1511 tdm_vblank_set_name(tdm_vblank *vblank, const char *name);
1514 * @brief Get the name for a vblank object
1515 * @details The default name is "unknown"
1516 * @param[in] vblank A vblank object
1517 * @param[out] name vblank name
1518 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1521 tdm_vblank_get_name(tdm_vblank *vblank, const char **name);
1524 * @brief Set the fps to a vblank object
1525 * @details Default is the @b vertical @b refresh @b rate of the given output.
1526 * It could be ignored when the fixed fps is set by #tdm_vblank_set_fixed_fps
1527 * @param[in] vblank A vblank object
1528 * @param[in] fps over 0
1529 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1532 tdm_vblank_set_fps(tdm_vblank *vblank, unsigned int fps);
1535 * @brief Get the fps for a vblank object
1536 * @param[in] vblank A vblank object
1537 * @param[out] fps over 0
1538 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1541 tdm_vblank_get_fps(tdm_vblank *vblank, unsigned int *fps);
1544 * @brief Set the fixed fps to a vblank object
1546 * It could be ignored when the global fps is set by #tdm_vblank_enable_global_fps
1547 * @param[in] vblank A vblank object
1548 * @param[in] fps over 0
1549 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1552 tdm_vblank_set_fixed_fps(tdm_vblank *vblank, unsigned int fps);
1555 * @brief Ignore the vblank global fps
1557 * The global fps will be applied to all client's vblanks for all outputs.
1558 * If the client's vblank fps is less than this, the global fps will be ignored
1559 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1560 * the global fps, it will be ignored also.
1561 * @param[in] vblank A vblank object
1562 * @param[in] ignore 1: ignore 0:not ignore(default)
1563 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1566 tdm_vblank_ignore_global_fps(tdm_vblank *vblank, unsigned int ignore);
1569 * @brief Set the offset(milli-second) to a vblank object
1570 * @details Default is @b 0.
1571 * @param[in] vblank A vblank object
1572 * @param[in] offset the offset(milli-second)
1573 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1576 tdm_vblank_set_offset(tdm_vblank *vblank, int offset);
1579 * @brief Get the offset(milli-second) for a vblank object
1580 * @param[in] vblank A vblank object
1581 * @param[out] offset the offset(milli-second)
1582 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1585 tdm_vblank_get_offset(tdm_vblank *vblank, int *offset);
1588 * @brief Enable/Disable the fake vblank to a vblank object
1590 * If enable_fake == 0, #tdm_vblank_wait will return TDM_ERROR_DPMS_OFF
1591 * when DPMS off. Otherwise, #tdm_vblank_wait will return TDM_ERROR_NONE
1593 * @param[in] vblank A vblank object
1594 * @param[in] enable_fake 1:enable, 0:disable
1595 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1598 tdm_vblank_set_enable_fake(tdm_vblank *vblank, unsigned int enable_fake);
1601 * @brief Get the fake vblank
1602 * @param[in] vblank A vblank object
1603 * @param[out] enable_fake 1:enable, 0:disable
1604 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1607 tdm_vblank_get_enable_fake(tdm_vblank *vblank, unsigned int *enable_fake);
1610 * @brief Wait for a vblank
1612 * Once #tdm_vblank_wait returns TDM_ERROR_NONE, the user vblank handler(#tdm_vblank_handler)
1613 * SHOULD be called after the given interval. \n
1614 * The sequence value of tdm_vblank_handler is the relative value of fps.
1615 * If fps = 10, this sequence value should be increased by 10 during 1 second.
1616 * @param[in] vblank A vblank object
1617 * @param[in] req_sec The vblank request time(second)
1618 * @param[in] req_usec The vblank request time(micro-second)
1619 * @param[in] interval The vblank interval
1620 * @param[in] func The user vblank handler
1621 * @param[in] user_data The user data
1622 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1625 tdm_vblank_wait(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1626 unsigned int interval, tdm_vblank_handler func, void *user_data);
1629 * @brief Wait for a vblank with the target sequence number
1630 * @param[in] vblank A vblank object
1631 * @param[in] req_sec The vblank request time(second)
1632 * @param[in] req_usec The vblank request time(micro-second)
1633 * @param[in] sequence The target sequence number
1634 * @param[in] func The user client vblank handler
1635 * @param[in] user_data The user data
1636 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1639 tdm_vblank_wait_seq(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1640 unsigned int sequence, tdm_vblank_handler func, void *user_data);
1646 #endif /* _TDM_H_ */