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 <sc1.lim@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 Create a pp object.
211 * @param[in] dpy A display object
212 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
213 * @return A pp object if success. Otherwise, NULL.
214 * @see tdm_pp_destroy
217 tdm_display_create_pp(tdm_display *dpy, tdm_error *error);
220 * @brief Get the information of the TDM backend module.
221 * @param[in] backend A backend object
222 * @param[out] name The name of the TDM backend module
223 * @param[out] vendor The vendor of the TDM backend module
224 * @param[out] version The version of the TDM backend module
225 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
228 tdm_backend_get_info(tdm_backend *backend, const char **name,
229 const char **vendor, int *major, int *minor);
232 * @brief Get a backend object of the given output.
233 * @param[in] output A output object
234 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
235 * @return A backend object if success. Otherwise, NULL.
238 tdm_output_get_backend(tdm_output *output, tdm_error *error);
241 * @brief Get the capabilities of a output object.
242 * @param[in] output A output object
243 * @param[out] capabilities The capabilities of a output object
244 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
247 tdm_output_get_capabilities(tdm_output *output,
248 tdm_output_capability *capabilities);
251 * @brief Get the model information of a output object.
252 * @param[in] output A output object
253 * @param[out] maker The output maker.
254 * @param[out] model The output model.
255 * @param[out] name The output name.
256 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
259 tdm_output_get_model_info(tdm_output *output, const char **maker,
260 const char **model, const char **name);
263 * @brief Get the connection status of a output object.
264 * @param[in] output A output object
265 * @param[out] status The connection status.
266 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
269 tdm_output_get_conn_status(tdm_output *output, tdm_output_conn_status *status);
272 * @brief Add a output change handler
273 * @details The handler will be called when the status of a
274 * output object is changed. connection, DPMS, etc.
275 * @param[in] output A output object
276 * @param[in] func A output change handler
277 * @param[in] user_data The user data
278 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
281 tdm_output_add_change_handler(tdm_output *output,
282 tdm_output_change_handler func,
286 * @brief Remove a output change handler
287 * @param[in] output A output object
288 * @param[in] func A output change handler
289 * @param[in] user_data The user data
290 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
293 tdm_output_remove_change_handler(tdm_output *output,
294 tdm_output_change_handler func,
298 * @brief Get the connection type of a output object.
299 * @param[in] output A output object
300 * @param[out] type The connection type.
301 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
304 tdm_output_get_output_type(tdm_output *output, tdm_output_type *type);
307 * @brief Get the layer counts which a output object has.
308 * @param[in] output A output object
309 * @param[out] count The count of layers
310 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
311 * @see tdm_output_get_layer
314 tdm_output_get_layer_count(tdm_output *output, int *count);
317 * @brief Get a layer object which has the given index.
318 * @param[in] output A output object
319 * @param[in] index The index of a layer object
320 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
321 * @return A layer object if success. Otherwise, NULL.
322 * @see tdm_output_get_layer_count
325 tdm_output_get_layer(tdm_output *output, int index, tdm_error *error);
328 * @brief Get the available property array of a output object.
329 * @param[in] output A output object
330 * @param[out] props The available property array
331 * @param[out] count The count of properties
332 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
335 tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props,
339 * @brief Get the available mode array of a output object.
340 * @param[in] output A output object
341 * @param[out] modes The available mode array
342 * @param[out] count The count of modes
343 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
346 tdm_output_get_available_modes(tdm_output *output,
347 const tdm_output_mode **modes, int *count);
350 * @brief Get the available size of a output object.
351 * @details -1 means that a TDM backend module doesn't define the value.
352 * @param[in] output A output object
353 * @param[out] min_w The minimum width which TDM can handle
354 * @param[out] min_h The minimum height which TDM can handle
355 * @param[out] max_w The maximum width which TDM can handle
356 * @param[out] max_h The maximum height which TDM can handle
357 * @param[out] preferred_align The preferred align width which TDM can handle
358 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
361 tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h,
362 int *max_w, int *max_h, int *preferred_align);
365 * @brief Get the available cursor size of a output object.
366 * @details -1 means that a TDM backend module doesn't define the value.
367 * @param[in] output A output object
368 * @param[out] min_w The minimum width which TDM can handle
369 * @param[out] min_h The minimum height which TDM can handle
370 * @param[out] max_w The maximum width which TDM can handle
371 * @param[out] max_h The maximum height which TDM can handle
372 * @param[out] preferred_align The preferred align width which TDM can handle
373 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
376 tdm_output_get_cursor_available_size(tdm_output *output, int *min_w, int *min_h,
377 int *max_w, int *max_h, int *preferred_align);
380 * @brief Get the physical size of a output object.
381 * @param[in] output A output object
382 * @param[out] mmWidth The milimeter width
383 * @param[out] mmHeight The milimeter height
384 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
387 tdm_output_get_physical_size(tdm_output *output, unsigned int *mmWidth,
388 unsigned int *mmHeight);
391 * @brief Get the subpixel of a output object.
392 * @param[in] output A output object
393 * @param[out] subpixel The subpixel
394 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
397 tdm_output_get_subpixel(tdm_output *output, unsigned int *subpixel);
400 * @brief Get the pipe of a output object.
401 * @param[in] output A output object
402 * @param[out] pipe The pipe
403 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
406 tdm_output_get_pipe(tdm_output *output, unsigned int *pipe);
409 * @brief Get the index of a primary layer.
410 * @param[in] output A output object
411 * @param[out] index The primary layer index
412 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
415 tdm_output_get_primary_index(tdm_output *output, int *index);
418 * @brief Set the property which has a given id.
419 * @param[in] output A output object
420 * @param[in] id The property id
421 * @param[in] value The value
422 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
425 tdm_output_set_property(tdm_output *output, unsigned int id, tdm_value value);
428 * @brief Get the property which has a given id
429 * @param[in] output A output object
430 * @param[in] id The property id
431 * @param[out] value The value
432 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
435 tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value);
438 * @brief Wait for VBLANK
439 * @details After interval vblanks, a user vblank handler will be called.
440 * @param[in] output A output object
441 * @param[in] interval vblank interval
442 * @param[in] sync 0: asynchronous, 1:synchronous
443 * @param[in] func A user vblank handler
444 * @param[in] user_data The user data
445 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
446 * @see #tdm_output_vblank_handler
449 tdm_output_wait_vblank(tdm_output *output, int interval, int sync,
450 tdm_output_vblank_handler func, void *user_data);
453 * @brief Commit changes for a output object
454 * @details After all change of a output object are applied, a user commit handler
456 * @param[in] output A output object
457 * @param[in] sync 0: asynchronous, 1:synchronous
458 * @param[in] func A user commit handler
459 * @param[in] user_data The user data
460 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
461 * @see #tdm_layer_commit
464 tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func,
468 * @brief Remove the user vblank handler
469 * @param[in] output A output object
470 * @param[in] func A user vblank handler
471 * @param[in] user_data The user data
472 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
475 tdm_output_remove_vblank_handler(tdm_output *output, tdm_output_vblank_handler func, void *user_data);
478 * @brief Remove the user commit handler
479 * @param[in] output A output object
480 * @param[in] func A user commit handler
481 * @param[in] user_data The user data
482 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
485 tdm_output_remove_commit_handler(tdm_output *output, tdm_output_commit_handler func, void *user_data);
488 * @brief Set one of available modes of a output object
489 * @param[in] output A output object
490 * @param[in] mode A output mode
491 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
494 tdm_output_set_mode(tdm_output *output, const tdm_output_mode *mode);
497 * @brief Get the mode of a output object
498 * @param[in] output A output object
499 * @param[out] mode A output mode
500 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
503 tdm_output_get_mode(tdm_output *output, const tdm_output_mode **mode);
506 * @brief Set DPMS of a output object synchronously
507 * @param[in] output A output object
508 * @param[in] dpms_value DPMS value
509 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
510 * @see tdm_output_set_dpms_async
513 tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value);
516 * @brief Set DPMS of a output object asynchronously
517 * @details This function can be used when a output supports the asynchronous DPMS
518 * control. The output has #TDM_OUTPUT_CAPABILITY_ASYNC_DPMS flags which
519 * #tdm_output_get_capabilities returns. If an output change handler is added with
520 * #tdm_output_add_change_handler, the output change handler will be called when
521 * the DPMS status is changed indeed.
522 * @param[in] output A output object
523 * @param[in] dpms_value DPMS value
524 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
525 * @see tdm_output_add_change_handler, tdm_output_set_dpms,
526 * tdm_output_get_capabilities, #TDM_OUTPUT_CAPABILITY_ASYNC_DPMS.
529 tdm_output_set_dpms_async(tdm_output *output, tdm_output_dpms dpms_value);
532 * @brief Get DPMS of a output object
533 * @param[in] output A output object
534 * @param[out] dpms_value DPMS value
535 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
538 tdm_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value);
541 * @brief Create a capture object of a output object
542 * @param[in] output A output object
543 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
544 * @return A capture object
545 * @see tdm_capture_destroy
548 tdm_output_create_capture(tdm_output *output, tdm_error *error);
551 * @brief Creates a new window on the given display.
552 * @param[in] output A output object
553 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
554 * @return A created window object
558 tdm_output_hwc_create_window(tdm_output *output, tdm_error *error);
561 * @brief Creates a new video window on the given output.
562 * @param[in] output A output object
563 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
564 * @return A created window object
568 tdm_output_hwc_create_video_window(tdm_output *output, tdm_error *error);
571 * @brief Destroys the given window.
572 * @param[in] output A output object
573 * @param[in] window the pointer of the window to destroy
574 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
578 tdm_output_hwc_destroy_window(tdm_output *output, tdm_hwc_window *hwc_window);
581 * @brief Set the client(relative to the TDM) target buffer
582 * @details Sets the buffer which will receive the output of client composition.
583 * Window marked as TDM_COMPOSITION_CLIENT or TDM_COMPOSITION_DEVICE_CANDIDATE
584 * will be composited into this buffer prior to the call to tdm_output_commit(),
585 * and windows not marked as TDM_COMPOSITION_CLIENT and
586 * TDM_COMPOSITION_DEVICE_CANDIDATE should be composited with this buffer by the
589 * The buffer handle provided may be null if no windows are being composited by
590 * the client. This must not result in an error (unless an invalid display
591 * handle is also provided).
593 * The damage parameter describes a buffer damage region as defined in the
594 * description of tdm_hwc_window_set_buffer_damage().
596 * List of composited hwc_windows (hwc_windows which buffers are presented on #target_buffer)
597 * should be passed along with #target_buffer to allow tdm to make the smooth transition
598 * from a DEVICE type to a CLIENT type.
600 * Should be called before tdm_output_commit() if any of the layers are marked as
601 * TDM_COMPOSITION_CLIENT or TDM_COMPOSITION_DEVICE_CANDIDATE. If no layers are
602 * so marked, then it is not necessary to call this function. It is not necessary
603 * to call tdm_output_hwc_validate() after changing the target through this function.
604 * @param[in] output A output object
605 * @param[in] target_buffer The new target buffer
606 * @param[in] damage The buffer damage region
607 * @param[in] composited_wnds The array of composited hwc_wnds
608 * @param[in] num_wnds The size of #composited_wnds array
609 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
613 tdm_output_hwc_set_client_target_buffer(tdm_output *output, tbm_surface_h target_buffer, tdm_hwc_region damage);
616 * @brief Unset the client(relative to the TDM) target buffer
618 * @param[in] output A output object
619 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
623 tdm_output_hwc_unset_client_target_buffer(tdm_output *output);
626 * @brief Commit changes for a target_window
627 * @details After all change of a window object are applied, a user commit handler
629 * @param[in] hwc_window A window object
630 * @param[in] func A user commit handler
631 * @param[in] user_data The user data
632 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
635 tdm_output_hwc_commit_client_target_buffer(tdm_output *output, tdm_output_hwc_target_buffer_commit_handler func, void *user_data);
638 * @brief Validate the output
639 * @details Instructs the device to inspect all of the layer state and
640 * determine if there are any composition type changes necessary before
641 * presenting the output. Permitted changes are described in the definition
642 * of tdm_hwc_window_composition_t above.
643 * @param[in] output A output object
644 * @param[out] num_types The number of composition type changes required by
645 * the device; if greater than 0, the client must either set and validate new
646 * types, or call tdm_output_hwc_accept_changes() to accept the changes returned by
647 * tdm_output_hwc_get_changed_composition_types(); must be the same as the number of
648 * changes returned by tdm_output_hwc_get_changed_composition_types (see the
649 * declaration of that function for more information); pointer will be non-NULL
650 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
654 tdm_output_hwc_validate(tdm_output *output, tdm_hwc_window **composited_wnds, uint32_t num_wnds,
655 uint32_t *num_types);
658 * @brief Set the 'need to validate' handler for the 'output'
660 * @details During backend's work it may need to ask for the revalidation
661 * (make client (E20) do tdm_output_hwc_validate() again), so a 'hndl' will
662 * be called as such need happen. Only one handler per output is supported.
664 * @param[in] output The output object a hndl is going to be registered for.
665 * @param[in] hndl The handler which will be called on the 'need to validate' event.
667 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
671 tdm_output_hwc_set_need_validate_handler(tdm_output *output,
672 tdm_output_need_validate_handler hndl);
675 * @brief Get changed composition types
676 * @details Retrieves the windows for which the device requires a different
677 * composition type than had been set prior to the last call to tdm_output_hwc_validate().
678 * The client will either update its state with these types and call
679 * tdm_output_hwc_accept_changes, or will set new types and attempt to validate the
681 * windows and types may be NULL to retrieve the number of elements which
682 * will be returned. The number of elements returned must be the same as the
683 * value returned in num_types from the last call to tdm_output_hwc_validate().
684 * @param[in] output A output object
685 * @param[out] num_elements If windows or types were NULL, the number of layers
686 * and types which would have been returned; if both were non-NULL, the
687 * number of elements returned in layers and types, which must not exceed
688 * the value stored in num_elements prior to the call; pointer will be
690 * @param[in] output A output object
691 * @param[out] windows An array of windows
692 * @param[out] composition_types An array of composition types, each corresponding
693 * to an element of windows
694 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
698 tdm_output_hwc_get_changed_composition_types(tdm_output *output,uint32_t *num_elements,
699 tdm_hwc_window **hwc_window,
700 tdm_hwc_window_composition *composition_types);
703 * @brief Accepts the changes required by the device
704 * @details Accepts the changes required by the device from the previous
705 * tdm_output_hwc_validate() call (which may be queried using
706 * tdm_output_get_chaged_composition_types()) and revalidates the display. This
707 * function is equivalent to requesting the changed types from
708 * tdm_output_get_chaged_composition_types(), setting those types on the
709 * corresponding windows, and then calling tdm_output_hwc_validate again.
710 * After this call it must be valid to present this display. Calling this after
711 * tdm_output_hwc_validate() returns 0 changes must succeed with TDM_ERROR_NONE, but
712 * should have no other effect.
713 * @param[in] output A output object
714 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
718 tdm_output_hwc_accept_changes(tdm_output *output);
721 * @brief Get a target buffer queue
722 * @details Buffers from target buffer queue will receive the output of
723 * client composition. Window marked as TDM_COMPOSITION_CLIENT or
724 * TDM_COMPOSITION_DEVICE_CANDIDATE will be composited into this buffers
725 * prior to the call to tdm_output_commit().
726 * @param[in] output A output object
727 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
728 * @return A buffer queue
732 tdm_output_hwc_get_target_buffer_queue(tdm_output *output, tdm_error *error);
735 * @brief Get the supported format array for video hwc windows of a output object.
736 * @param[in] output A output object
737 * @param[out] formats The available format array
738 * @param[out] count The count of formats
739 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
742 tdm_output_hwc_get_video_supported_formats(tdm_layer *layer, const tbm_format **formats,
746 * @brief Get a output object of a layer object
747 * @param[in] layer A layer object
748 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
749 * @return A TDM output object if success. Otherwise, NULL.
752 tdm_layer_get_output(tdm_layer *layer, tdm_error *error);
755 * @brief Get the capabilities of a layer object.
756 * @param[in] layer A layer object
757 * @param[out] capabilities The capabilities of a layer object
758 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
761 tdm_layer_get_capabilities(tdm_layer *layer,
762 tdm_layer_capability *capabilities);
765 * @brief Get the available format array of a layer object.
766 * @param[in] layer A layer object
767 * @param[out] formats The available format array
768 * @param[out] count The count of formats
769 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
772 tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats,
776 * @brief Get the available property array of a layer object.
777 * @param[in] layer A layer object
778 * @param[out] props The available property array
779 * @param[out] count The count of properties
780 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
783 tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props,
787 * @brief Get the zpos of a layer object.
789 * - GRAPHIC layers have fixed zpos. It starts from 0. It's @b non-changeable.
790 * - But the zpos of VIDEO layers will be decided by a backend module side.
791 * - A frontend user only can set the relative zpos to VIDEO layers via #tdm_layer_set_video_pos
792 * - The zpos of video layers is less than GRAPHIC layers or more than GRAPHIC
793 * layers. ie, ..., -2, -1, 4, 5, ... (if 0 <= GRAPHIC layer's zpos < 4).
794 * -------------------------------- graphic layer 3 <-- top most layer
795 * -------------------------------- graphic layer 2
796 * -------------------------------- graphic layer 1
797 * -------------------------------- graphic layer 0
798 * -------------------------------- video layer -1
799 * -------------------------------- video layer -2 <-- lowest layer
800 * @param[in] layer A layer object
801 * @param[out] zpos The zpos
802 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
803 * @see tdm_layer_set_video_pos, tdm_layer_capability
806 tdm_layer_get_zpos(tdm_layer *layer, int *zpos);
809 * @brief Set the property which has a given id.
810 * @param[in] layer A layer object
811 * @param[in] id The property id
812 * @param[in] value The value
813 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
816 tdm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
819 * @brief Get the property which has a given id.
820 * @param[in] layer A layer object
821 * @param[in] id The property id
822 * @param[out] value The value
823 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
826 tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
829 * @brief Set the geometry information to a layer object
830 * @details The geometry information will be applied when the output object
831 * of a layer object is committed. If a layer has TDM_LAYER_CAPABILITY_NO_CROP
832 * capability, a layer will ignore the pos(crop) information of #tdm_info_layer's
834 * @param[in] layer A layer object
835 * @param[in] info The geometry information
836 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
837 * @see tdm_layer_commit
840 tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info);
843 * @brief Get the geometry information to a layer object
844 * @param[in] layer A layer object
845 * @param[out] info The geometry information
846 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
849 tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info);
852 * @brief Set a TDM buffer to a layer object
853 * @details A TDM buffer will be applied when the output object
854 * of a layer object is committed.
855 * @param[in] layer A layer object
856 * @param[in] buffer A TDM buffer
857 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
858 * @see tdm_layer_commit
861 tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer);
864 * @brief Unset a TDM buffer from a layer object
865 * @details When this function is called, a current showing buffer will be
866 * disappeared from screen. Then nothing is showing on a layer object.
867 * @param[in] layer A layer object
868 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
871 tdm_layer_unset_buffer(tdm_layer *layer);
874 * @brief Commit changes for a layer object
875 * @details After all change of a layer object are applied, a user commit handler
877 * @param[in] layer A layer object
878 * @param[in] func A user commit handler
879 * @param[in] user_data The user data
880 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
883 tdm_layer_commit(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
886 tdm_layer_is_committing(tdm_layer *layer, unsigned int *committing);
889 * @brief Remove the user commit handler
890 * @param[in] layer A layer object
891 * @param[in] func A user commit handler
892 * @param[in] user_data The user data
893 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
896 tdm_layer_remove_commit_handler(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
899 * @brief Get a displaying TDM buffer from a layer object
900 * @details A displaying TDM buffer is a current showing buffer on screen
901 * that is set to layer object and applied output object of a layer object.
902 * @param[in] layer A layer object
903 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
904 * @return A TDM buffer if success. Otherwise, NULL.
907 tdm_layer_get_displaying_buffer(tdm_layer *layer, tdm_error *error);
910 * @brief Set a TBM surface_queue to a layer object
911 * @details A TBM surface_queue will be applied when the output object
912 * of a layer object is committed. and TDM layer will be automatically updated
913 * @param[in] layer A layer object
914 * @param[in] buffer_queue A TBM surface_queue
915 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
916 * @see tdm_layer_commit
919 tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue);
922 * @brief Unset a TBM surface_queue from a layer object
923 * @details When this function is called, a current surface_queue will be
924 * disappeared from screen. Then nothing is showing on a layer object.
925 * @param[in] layer A layer object
926 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
929 tdm_layer_unset_buffer_queue(tdm_layer *layer);
932 * @brief Check wheter a layer object is available for a frontend user to use.
933 * @details A layer object is not usable if a TDM buffer is showing on screen
934 * via this layer object. By calling #tdm_layer_unset_buffer, this layer object
935 * will become usable.
936 * @param[in] layer A layer object
937 * @param[out] usable 1 if usable, 0 if not usable
938 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
941 tdm_layer_is_usable(tdm_layer *layer, unsigned int *usable);
944 * @brief Set the relative zpos to a VIDEO layer object
945 * @details The zpos value is less than the minimum zpos of GRAPHIC layers, or
946 * it is more than the maximum zpos of GRAPHIC layers.
947 * @param[in] layer A VIDEO layer object
948 * @param[in] zpos The zpos
949 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
950 * @see tdm_layer_get_zpos, tdm_layer_capability
953 tdm_layer_set_video_pos(tdm_layer *layer, int zpos);
956 * @brief Create a capture object of a layer object
957 * @param[in] layer A layer object
958 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
959 * @return A capture object
960 * @see tdm_capture_destroy
963 tdm_layer_create_capture(tdm_layer *layer, tdm_error *error);
966 * @brief Get buffer flags from a layer object
967 * @param[in] layer A layer object
968 * @param[out] flags a buffer flags value
969 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
972 tdm_layer_get_buffer_flags(tdm_layer *layer, unsigned int *flags);
975 * @brief Get a buffer queue for the window object
976 * @details These buffers are used to composite by hardware a client content in
978 * @param[in] hwc_window A window object
979 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
980 * @return A tbm buffer queue
984 tdm_hwc_window_get_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error);
987 * @brief Sets the desired composition type of the given window.
988 * @details During tdm_output_hwc_validate(), the device may request changes to
989 * the composition types of any of the layers as described in the definition
990 * of tdm_hwc_window_composition_t above.
991 * @param[in] hwc_window A window object
992 * @param[in] composition_type The new composition type
993 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
997 tdm_hwc_window_set_composition_type(tdm_hwc_window *hwc_window,
998 tdm_hwc_window_composition composition_type);
1001 * @brief Set the buffer damage
1002 * @details Provides the region of the source buffer which has been modified
1003 * since the last frame. This region does not need to be validated before
1004 * calling tdm_output_commit().
1005 * Once set through this function, the damage region remains the same until a
1006 * subsequent call to this function.
1007 * If damage.num_rects > 0, then it may be assumed that any portion of the source
1008 * buffer not covered by one of the rects has not been modified this frame. If
1009 * damage.num_rects == 0, then the whole source buffer must be treated as if it
1010 * has been modified.
1011 * If the layer's contents are not modified relative to the prior frame, damage
1012 * will contain exactly one empty rect([0, 0, 0, 0]).
1013 * The damage rects are relative to the pre-transformed buffer, and their origin
1014 * is the top-left corner. They will not exceed the dimensions of the latched
1016 * @param[in] hwc_window A window object
1017 * @param[in] damage The new buffer damage region
1018 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1022 tdm_hwc_window_set_buffer_damage(tdm_hwc_window *hwc_window, tdm_hwc_region damage);
1025 * @brief Set the information to a window object
1026 * @details The information will be applied when the output object of a window
1027 * object is committed.
1028 * @param[in] hwc_window A window object
1029 * @param[in] info The information
1030 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1034 tdm_hwc_window_set_info(tdm_hwc_window *hwc_window, tdm_hwc_window_info *info);
1037 * @brief Set a TBM buffer to a window object
1038 * @details A TBM buffer will be applied when the output object of a layer
1039 * object is committed.
1040 * @param[in] hwc_window A window object
1041 * @param[in] buffer A TDM buffer
1042 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1043 * @return #TDM_ERROR_BUSY if #hwc_window can't be updated right now, this
1044 * can happen if #hwc_window is involved in the smooth transition from
1045 * DEVICE to CLIENT, this shouldn't be interpreted like some critical error.
1049 tdm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer);
1052 * @brief Unset a TBM buffer to a window object
1053 * @details A TBM buffer will be applied when the output object of a layer
1054 * object is committed.
1055 * @param[in] hwc_window A window object
1056 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1057 * @return #TDM_ERROR_BUSY if #hwc_window can't be updated right now, this
1058 * can happen if #hwc_window is involved in the smooth transition from
1059 * DEVICE to CLIENT, this shouldn't be interpreted like some critical error.
1063 tdm_hwc_window_unset_buffer(tdm_hwc_window *hwc_window);
1066 * @brief Set a flags to a window object
1067 * @param[in] hwc_window A window object
1068 * @param[in] flags A hwc_window flags
1069 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1073 tdm_hwc_window_set_flags(tdm_hwc_window *hwc_window, tdm_hwc_window_flag flags);
1076 * @brief Unset a flags from a window object
1077 * @param[in] hwc_window A window object
1078 * @param[in] flags A hwc_window flags
1079 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1083 tdm_hwc_window_unset_flags(tdm_hwc_window *hwc_window, tdm_hwc_window_flag flags);
1086 * @brief Commit changes for a window object
1087 * @details After all change of a window object are applied, a user commit handler
1089 * @param[in] hwc_window A window object
1090 * @param[in] func A user commit handler
1091 * @param[in] user_data The user data
1092 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1095 tdm_hwc_window_commit(tdm_hwc_window *hwc_window, tdm_hwc_window_commit_handler func, void *user_data);
1098 * @brief Get the available property array of a video hwc window object.
1099 * @param[in] hwc window A video hwc window object
1100 * @param[out] props The available property array
1101 * @param[out] count The count of properties
1102 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1105 tdm_hwc_window_video_get_available_properties(tdm_hwc_window *hwc_window,
1106 const tdm_prop **props, int *count);
1109 * @brief Get the property which has a given id.
1110 * @param[in] hwc window A video hwc window object
1111 * @param[in] id The property id
1112 * @param[out] value The value
1113 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1116 tdm_hwc_window_video_get_property(tdm_hwc_window *hwc_window, uint32_t id,
1120 * @brief Set the property which has a given id.
1121 * @param[in] hwc window A video hwc window object
1122 * @param[in] id The property id
1123 * @param[in] value The value
1124 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1127 tdm_hwc_window_video_set_property(tdm_hwc_window *hwc_window, uint32_t id,
1131 * @brief Get the window video capability
1132 * @param[in] hwc_window A window object
1133 * @param[out] video_capability A hwc window video capability
1134 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1138 tdm_hwc_window_video_get_capability(tdm_hwc_window *hwc_window,
1139 tdm_hwc_window_video_capability *video_capability);
1142 * @brief Destroy a pp object
1143 * @param[in] pp A pp object
1144 * @see tdm_display_create_pp
1147 tdm_pp_destroy(tdm_pp *pp);
1150 * @brief Set the geometry information to a pp object
1151 * @param[in] pp A pp object
1152 * @param[in] info The geometry information
1153 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1154 * @see tdm_pp_commit
1157 tdm_pp_set_info(tdm_pp *pp, tdm_info_pp *info);
1160 * @brief Set the PP done handler to a pp object
1162 * The user PP done handler will be called after converting a source buffer's image
1163 * to a destination buffer.
1164 * @param[in] pp A pp object
1165 * @param[in] func A user PP done handler
1166 * @param[in] user_data The user data
1167 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1170 tdm_pp_set_done_handler(tdm_pp *pp, tdm_pp_done_handler func, void *user_data);
1173 * @brief Attach a source buffer and a destination buffer to a pp object
1174 * @param[in] pp A pp object
1175 * @param[in] src A source buffer
1176 * @param[in] dst A destination buffer
1177 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1178 * @see tdm_pp_commit, tdm_pp_set_done_handler
1181 tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
1184 * @brief Commit changes for a pp object
1185 * @param[in] pp A pp object
1186 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1189 tdm_pp_commit(tdm_pp *pp);
1192 * @brief Destroy a capture object
1193 * @param[in] capture A capture object
1194 * @see tdm_output_create_capture, tdm_layer_create_capture
1197 tdm_capture_destroy(tdm_capture *capture);
1200 * @brief Set the geometry information to a capture object
1201 * @param[in] capture A capture object
1202 * @param[in] info The geometry information
1203 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1204 * @see tdm_capture_commit
1207 tdm_capture_set_info(tdm_capture *capture, tdm_info_capture *info);
1210 * @brief Set the capture done handler to a capture object
1212 * The user capture done handler will be called after capturing a screen into a
1214 * @param[in] capture A capture object
1215 * @param[in] func A user capture done handler
1216 * @param[in] user_data The user data
1217 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1220 tdm_capture_set_done_handler(tdm_capture *capture, tdm_capture_done_handler func, void *user_data);
1223 * @brief Attach a TDM buffer to a capture object
1224 * @param[in] capture A capture object
1225 * @param[in] buffer A TDM buffer
1226 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1227 * @see tdm_capture_commit, tdm_capture_set_done_handler
1230 tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer);
1233 * @brief Commit changes for a capture object
1234 * @param[in] capture A capture object
1235 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1238 tdm_capture_commit(tdm_capture *capture);
1241 * @brief The release handler of a TDM buffer
1242 * @param[in] buffer A TDM buffer
1243 * @param[in] user_data user data
1244 * @see tdm_buffer_add_release_handler, tdm_buffer_remove_release_handler
1246 typedef void (*tdm_buffer_release_handler)(tbm_surface_h buffer,
1250 * @brief Add a release handler to a TDM buffer
1252 * TDM has its own buffer release mechanism to let an frontend user know when a TDM buffer
1253 * becomes available for a next job. A TDM buffer can be used for TDM to show
1254 * it on screen or to capture an output and a layer. After all operations,
1255 * TDM will release it immediately when TDM doesn't need it any more.
1256 * @param[in] buffer A TDM buffer
1257 * @param[in] func A release handler
1258 * @param[in] user_data user data
1259 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1260 * @see tdm_buffer_remove_release_handler
1263 tdm_buffer_add_release_handler(tbm_surface_h buffer,
1264 tdm_buffer_release_handler func, void *user_data);
1267 * @brief Remove a release handler from a TDM buffer
1268 * @param[in] buffer A TDM buffer
1269 * @param[in] func A release handler
1270 * @param[in] user_data user data
1271 * @see tdm_buffer_add_release_handler
1274 tdm_buffer_remove_release_handler(tbm_surface_h buffer,
1275 tdm_buffer_release_handler func, void *user_data);
1278 * @brief The handler of a vblank object
1279 * @see #tdm_vblank_wait, #tdm_vblank_wait_seq
1281 typedef void (*tdm_vblank_handler)(tdm_vblank *vblank, tdm_error error, unsigned int sequence,
1282 unsigned int tv_sec, unsigned int tv_usec, void *user_data);
1285 * @brief Set the vblank fps for the given PID and name.
1286 * @param[in] pid The process ID
1287 * @param[in] name The client vblank name
1288 * @param[in] fps The client vblank fps
1289 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1292 tdm_vblank_set_client_vblank_fps(unsigned int pid, const char *name, unsigned int fps);
1295 * @brief Set the ignore global fps for the given PID and name.
1296 * @param[in] pid The process ID
1297 * @param[in] name The client vblank name
1298 * @param[in] ignore 1: ignore 0:not ignore(default)
1299 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1302 tdm_vblank_set_client_ignore_global_fps(unsigned int pid, const char *name, unsigned int ignore);
1305 * @brief Set the vblank global fps for the entire system.
1306 * @param[in] enable 1:enable, 0:disable
1307 * @param[in] fps The vblank global fps
1309 * This global fps will be applied to all client's vblanks for all outputs.
1310 * If the client's vblank fps is less than this, the global fps will be ignored
1311 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1312 * the global fps, it will be ignored also.
1313 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1316 tdm_vblank_enable_global_fps(unsigned int enable, unsigned int fps);
1319 * @brief Add the vblank create handler.
1320 * @param[in] dpy A display object
1321 * @param[in] func The user vblank create handler
1322 * @param[in] user_data The user data
1324 * The user vblank create handler will be called when new vblank object created.
1325 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1328 tdm_vblank_add_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1331 * @brief Remove the vblank create handler.
1332 * @param[in] dpy A display object
1333 * @param[in] func The user vblank create handler
1334 * @param[in] user_data The user data
1335 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1338 tdm_vblank_remove_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1341 * @brief Create a vblank object
1342 * @param[in] dpy A display object
1343 * @param[in] output A output object
1344 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1345 * @return A vblank object
1346 * @see #tdm_vblank_destroy
1349 tdm_vblank_create(tdm_display *dpy, tdm_output *output, tdm_error *error);
1352 * @brief Destroy a vblank object
1353 * @param[in] vblank A vblank object
1354 * @see #tdm_vblank_create
1357 tdm_vblank_destroy(tdm_vblank *vblank);
1360 * @brief Get a output object of a vblank object
1361 * @param[in] vblank A vblank object
1362 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1363 * @return A TDM output object if success. Otherwise, NULL.
1364 * @see #tdm_vblank_create
1367 tdm_vblank_get_output(tdm_vblank *vblank, tdm_error *error);
1370 * @brief Get the client PID for a vblank object
1371 * @param[in] vblank A vblank object
1372 * @param[out] pid PID of vblank's client
1373 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1376 tdm_vblank_get_client_pid(tdm_vblank *vblank, pid_t *pid);
1379 * @brief Set the name to a vblank object
1380 * @details The default name is "unknown"
1381 * @param[in] vblank A vblank object
1382 * @param[in] name vblank name
1383 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1386 tdm_vblank_set_name(tdm_vblank *vblank, const char *name);
1389 * @brief Get the name for a vblank object
1390 * @details The default name is "unknown"
1391 * @param[in] vblank A vblank object
1392 * @param[out] name vblank name
1393 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1396 tdm_vblank_get_name(tdm_vblank *vblank, const char **name);
1399 * @brief Set the fps to a vblank object
1400 * @details Default is the @b vertical @b refresh @b rate of the given output.
1401 * It could be ignored when the fixed fps is set by #tdm_vblank_set_fixed_fps
1402 * @param[in] vblank A vblank object
1403 * @param[in] fps over 0
1404 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1407 tdm_vblank_set_fps(tdm_vblank *vblank, unsigned int fps);
1410 * @brief Get the fps for a vblank object
1411 * @param[in] vblank A vblank object
1412 * @param[out] fps over 0
1413 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1416 tdm_vblank_get_fps(tdm_vblank *vblank, unsigned int *fps);
1419 * @brief Set the fixed fps to a vblank object
1421 * It could be ignored when the global fps is set by #tdm_vblank_enable_global_fps
1422 * @param[in] vblank A vblank object
1423 * @param[in] fps over 0
1424 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1427 tdm_vblank_set_fixed_fps(tdm_vblank *vblank, unsigned int fps);
1430 * @brief Ignore the vblank global fps
1432 * The global fps will be applied to all client's vblanks for all outputs.
1433 * If the client's vblank fps is less than this, the global fps will be ignored
1434 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1435 * the global fps, it will be ignored also.
1436 * @param[in] vblank A vblank object
1437 * @param[in] ignore 1: ignore 0:not ignore(default)
1438 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1441 tdm_vblank_ignore_global_fps(tdm_vblank *vblank, unsigned int ignore);
1444 * @brief Set the offset(milli-second) to a vblank object
1445 * @details Default is @b 0.
1446 * @param[in] vblank A vblank object
1447 * @param[in] offset the offset(milli-second)
1448 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1451 tdm_vblank_set_offset(tdm_vblank *vblank, int offset);
1454 * @brief Get the offset(milli-second) for a vblank object
1455 * @param[in] vblank A vblank object
1456 * @param[out] offset the offset(milli-second)
1457 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1460 tdm_vblank_get_offset(tdm_vblank *vblank, int *offset);
1463 * @brief Enable/Disable the fake vblank to a vblank object
1465 * If enable_fake == 0, #tdm_vblank_wait will return TDM_ERROR_DPMS_OFF
1466 * when DPMS off. Otherwise, #tdm_vblank_wait will return TDM_ERROR_NONE
1468 * @param[in] vblank A vblank object
1469 * @param[in] enable_fake 1:enable, 0:disable
1470 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1473 tdm_vblank_set_enable_fake(tdm_vblank *vblank, unsigned int enable_fake);
1476 * @brief Get the fake vblank
1477 * @param[in] vblank A vblank object
1478 * @param[out] enable_fake 1:enable, 0:disable
1479 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1482 tdm_vblank_get_enable_fake(tdm_vblank *vblank, unsigned int *enable_fake);
1485 * @brief Wait for a vblank
1487 * Once #tdm_vblank_wait returns TDM_ERROR_NONE, the user vblank handler(#tdm_vblank_handler)
1488 * SHOULD be called after the given interval. \n
1489 * The sequence value of tdm_vblank_handler is the relative value of fps.
1490 * If fps = 10, this sequence value should be increased by 10 during 1 second.
1491 * @param[in] vblank A vblank object
1492 * @param[in] req_sec The vblank request time(second)
1493 * @param[in] req_usec The vblank request time(micro-second)
1494 * @param[in] interval The vblank interval
1495 * @param[in] func The user vblank handler
1496 * @param[in] user_data The user data
1497 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1500 tdm_vblank_wait(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1501 unsigned int interval, tdm_vblank_handler func, void *user_data);
1504 * @brief Wait for a vblank with the target sequence number
1505 * @param[in] vblank A vblank object
1506 * @param[in] req_sec The vblank request time(second)
1507 * @param[in] req_usec The vblank request time(micro-second)
1508 * @param[in] sequence The target sequence number
1509 * @param[in] func The user client vblank handler
1510 * @param[in] user_data The user data
1511 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1514 tdm_vblank_wait_seq(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1515 unsigned int sequence, tdm_vblank_handler func, void *user_data);
1521 #endif /* _TDM_H_ */