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 Find a output object which has the given name.
211 * @param[in] dpy A display object
212 * @param[in] name The name 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.
217 tdm_display_find_output(tdm_display *dpy, const char *name, tdm_error *error);
220 * @brief Create a pp object.
221 * @param[in] dpy A display object
222 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
223 * @return A pp object if success. Otherwise, NULL.
224 * @see tdm_pp_destroy
227 tdm_display_create_pp(tdm_display *dpy, tdm_error *error);
230 * @brief Get the information of the TDM backend module.
231 * @param[in] module A backend module object
232 * @param[out] name The name of the TDM backend module
233 * @param[out] vendor The vendor of the TDM backend module
234 * @param[out] version The version of the TDM backend module
235 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
238 tdm_module_get_info(tdm_module *module, const char **name,
239 const char **vendor, int *major, int *minor);
242 * @brief Get a backend module object of the given output.
243 * @param[in] output A output object
244 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
245 * @return A backend object if success. Otherwise, NULL.
248 tdm_output_get_backend_module(tdm_output *output, tdm_error *error);
251 * @brief Get the capabilities of a output object.
252 * @param[in] output A output object
253 * @param[out] capabilities The capabilities of a output object
254 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
257 tdm_output_get_capabilities(tdm_output *output,
258 tdm_output_capability *capabilities);
261 * @brief Get the model information of a output object.
262 * @param[in] output A output object
263 * @param[out] maker The output maker.
264 * @param[out] model The output model.
265 * @param[out] name The output name.
266 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
269 tdm_output_get_model_info(tdm_output *output, const char **maker,
270 const char **model, const char **name);
273 * @brief Get the connection status of a output object.
274 * @param[in] output A output object
275 * @param[out] status The connection status.
276 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
279 tdm_output_get_conn_status(tdm_output *output, tdm_output_conn_status *status);
282 * @brief Add a output change handler
283 * @details The handler will be called when the status of a
284 * output object is changed. connection, DPMS, etc.
285 * @param[in] output A output object
286 * @param[in] func A output change handler
287 * @param[in] user_data The user data
288 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
291 tdm_output_add_change_handler(tdm_output *output,
292 tdm_output_change_handler func,
296 * @brief Remove a output change handler
297 * @param[in] output A output object
298 * @param[in] func A output change handler
299 * @param[in] user_data The user data
300 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
303 tdm_output_remove_change_handler(tdm_output *output,
304 tdm_output_change_handler func,
308 * @brief Get the connection type of a output object.
309 * @param[in] output A output object
310 * @param[out] type The connection type.
311 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
314 tdm_output_get_output_type(tdm_output *output, tdm_output_type *type);
317 * @brief Get the layer counts which a output object has.
318 * @param[in] output A output object
319 * @param[out] count The count of layers
320 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
321 * @see tdm_output_get_layer
324 tdm_output_get_layer_count(tdm_output *output, int *count);
327 * @brief Get a layer object which has the given index.
328 * @param[in] output A output object
329 * @param[in] index The index of a layer object
330 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
331 * @return A layer object if success. Otherwise, NULL.
332 * @see tdm_output_get_layer_count
335 tdm_output_get_layer(tdm_output *output, int index, tdm_error *error);
338 * @brief Get the available property array of a output object.
339 * @param[in] output A output object
340 * @param[out] props The available property array
341 * @param[out] count The count of properties
342 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
345 tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props,
349 * @brief Get the available mode array of a output object.
350 * @param[in] output A output object
351 * @param[out] modes The available mode array
352 * @param[out] count The count of modes
353 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
356 tdm_output_get_available_modes(tdm_output *output,
357 const tdm_output_mode **modes, int *count);
360 * @brief Get the available size of a output object.
361 * @details -1 means that a TDM backend module doesn't define the value.
362 * @param[in] output A output object
363 * @param[out] min_w The minimum width which TDM can handle
364 * @param[out] min_h The minimum height which TDM can handle
365 * @param[out] max_w The maximum width which TDM can handle
366 * @param[out] max_h The maximum height which TDM can handle
367 * @param[out] preferred_align The preferred align width which TDM can handle
368 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
371 tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h,
372 int *max_w, int *max_h, int *preferred_align);
375 * @brief Get the available cursor size of a output object.
376 * @details -1 means that a TDM backend module doesn't define the value.
377 * @param[in] output A output object
378 * @param[out] min_w The minimum width which TDM can handle
379 * @param[out] min_h The minimum height which TDM can handle
380 * @param[out] max_w The maximum width which TDM can handle
381 * @param[out] max_h The maximum height which TDM can handle
382 * @param[out] preferred_align The preferred align width which TDM can handle
383 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
386 tdm_output_get_cursor_available_size(tdm_output *output, int *min_w, int *min_h,
387 int *max_w, int *max_h, int *preferred_align);
390 * @brief Get the physical size of a output object.
391 * @param[in] output A output object
392 * @param[out] mmWidth The milimeter width
393 * @param[out] mmHeight The milimeter height
394 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
397 tdm_output_get_physical_size(tdm_output *output, unsigned int *mmWidth,
398 unsigned int *mmHeight);
401 * @brief Get the subpixel of a output object.
402 * @param[in] output A output object
403 * @param[out] subpixel The subpixel
404 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
407 tdm_output_get_subpixel(tdm_output *output, unsigned int *subpixel);
410 * @brief Get the pipe of a output object.
411 * @param[in] output A output object
412 * @param[out] pipe The pipe
413 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
416 tdm_output_get_pipe(tdm_output *output, unsigned int *pipe);
419 * @brief Get the index of a primary layer.
420 * @param[in] output A output object
421 * @param[out] index The primary layer index
422 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
425 tdm_output_get_primary_index(tdm_output *output, int *index);
428 * @brief Set the property which has a given id.
429 * @param[in] output A output object
430 * @param[in] id The property id
431 * @param[in] value The value
432 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
435 tdm_output_set_property(tdm_output *output, unsigned int id, tdm_value value);
438 * @brief Get the property which has a given id
439 * @param[in] output A output object
440 * @param[in] id The property id
441 * @param[out] value The value
442 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
445 tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value);
448 * @brief Wait for VBLANK
449 * @details After interval vblanks, a user vblank handler will be called.
450 * @param[in] output A output object
451 * @param[in] interval vblank interval
452 * @param[in] sync 0: asynchronous, 1:synchronous
453 * @param[in] func A user vblank handler
454 * @param[in] user_data The user data
455 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
456 * @see #tdm_output_vblank_handler
459 tdm_output_wait_vblank(tdm_output *output, int interval, int sync,
460 tdm_output_vblank_handler func, void *user_data);
463 * @brief Commit changes for a output object
464 * @details After all change of a output object are applied, a user commit handler
466 * @param[in] output A output object
467 * @param[in] sync 0: asynchronous, 1:synchronous
468 * @param[in] func A user commit handler
469 * @param[in] user_data The user data
470 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
471 * @see #tdm_layer_commit
474 tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func,
478 * @brief Remove the user vblank handler
479 * @param[in] output A output object
480 * @param[in] func A user vblank handler
481 * @param[in] user_data The user data
482 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
485 tdm_output_remove_vblank_handler(tdm_output *output, tdm_output_vblank_handler func, void *user_data);
488 * @brief Remove the user commit handler
489 * @param[in] output A output object
490 * @param[in] func A user commit handler
491 * @param[in] user_data The user data
492 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
495 tdm_output_remove_commit_handler(tdm_output *output, tdm_output_commit_handler func, void *user_data);
498 * @brief Set one of available modes of a output object
499 * @param[in] output A output object
500 * @param[in] mode A output mode
501 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
504 tdm_output_set_mode(tdm_output *output, const tdm_output_mode *mode);
507 * @brief Get the mode of a output object
508 * @param[in] output A output object
509 * @param[out] mode A output mode
510 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
513 tdm_output_get_mode(tdm_output *output, const tdm_output_mode **mode);
516 * @brief Set DPMS of a output object synchronously
517 * @param[in] output A output object
518 * @param[in] dpms_value DPMS value
519 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
520 * @see tdm_output_set_dpms_async
523 tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value);
526 * @brief Set DPMS of a output object asynchronously
527 * @details This function can be used when a output supports the asynchronous DPMS
528 * control. The output has #TDM_OUTPUT_CAPABILITY_ASYNC_DPMS flags which
529 * #tdm_output_get_capabilities returns. If an output change handler is added with
530 * #tdm_output_add_change_handler, the output change handler will be called when
531 * the DPMS status is changed indeed.
532 * @param[in] output A output object
533 * @param[in] dpms_value DPMS value
534 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
535 * @see tdm_output_add_change_handler, tdm_output_set_dpms,
536 * tdm_output_get_capabilities, #TDM_OUTPUT_CAPABILITY_ASYNC_DPMS.
539 tdm_output_set_dpms_async(tdm_output *output, tdm_output_dpms dpms_value);
542 * @brief Get DPMS of a output object
543 * @param[in] output A output object
544 * @param[out] dpms_value DPMS value
545 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
548 tdm_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value);
551 * @brief Create a capture object of a output object
552 * @param[in] output A output object
553 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
554 * @return A capture object
555 * @see tdm_capture_destroy
558 tdm_output_create_capture(tdm_output *output, tdm_error *error);
561 * @brief Creates a new window on the given display.
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_window(tdm_output *output, tdm_error *error);
571 * @brief Creates a new video window on the given output.
572 * @param[in] output A output object
573 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
574 * @return A created window object
578 tdm_output_hwc_create_video_window(tdm_output *output, tdm_error *error);
581 * @brief Destroys the given window.
582 * @param[in] output A output object
583 * @param[in] window the pointer of the window to destroy
584 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
588 tdm_output_hwc_destroy_window(tdm_output *output, tdm_hwc_window *hwc_window);
591 * @brief Set the client(relative to the TDM) target buffer
592 * @details Sets the buffer which will receive the output of client composition.
593 * Window marked as TDM_COMPOSITION_CLIENT or TDM_COMPOSITION_DEVICE_CANDIDATE
594 * will be composited into this buffer prior to the call to tdm_output_commit(),
595 * and windows not marked as TDM_COMPOSITION_CLIENT and
596 * TDM_COMPOSITION_DEVICE_CANDIDATE should be composited with this buffer by the
599 * The buffer handle provided may be null if no windows are being composited by
600 * the client. This must not result in an error (unless an invalid display
601 * handle is also provided).
603 * The damage parameter describes a buffer damage region as defined in the
604 * description of tdm_hwc_window_set_buffer_damage().
606 * List of composited hwc_windows (hwc_windows which buffers are presented on #target_buffer)
607 * should be passed along with #target_buffer to allow tdm to make the smooth transition
608 * from a DEVICE type to a CLIENT type.
610 * Should be called before tdm_output_commit() if any of the layers are marked as
611 * TDM_COMPOSITION_CLIENT or TDM_COMPOSITION_DEVICE_CANDIDATE. If no layers are
612 * so marked, then it is not necessary to call this function. It is not necessary
613 * to call tdm_output_hwc_validate() after changing the target through this function.
614 * @param[in] output A output object
615 * @param[in] target_buffer The new target buffer
616 * @param[in] damage The buffer damage region
617 * @param[in] composited_wnds The array of composited hwc_wnds
618 * @param[in] num_wnds The size of #composited_wnds array
619 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
623 tdm_output_hwc_set_client_target_buffer(tdm_output *output, tbm_surface_h target_buffer, tdm_hwc_region damage);
626 * @brief Unset the client(relative to the TDM) target buffer
628 * @param[in] output A output object
629 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
633 tdm_output_hwc_unset_client_target_buffer(tdm_output *output);
636 * @brief Commit changes for a target_window
637 * @details After all change of a window object are applied, a user commit handler
639 * @param[in] hwc_window A window object
640 * @param[in] func A user commit handler
641 * @param[in] user_data The user data
642 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
645 tdm_output_hwc_commit_client_target_buffer(tdm_output *output, tdm_output_hwc_target_buffer_commit_handler func, void *user_data);
648 * @brief Validate the output
649 * @details Instructs the device to inspect all of the layer state and
650 * determine if there are any composition type changes necessary before
651 * presenting the output. Permitted changes are described in the definition
652 * of tdm_hwc_window_composition_t above.
653 * @param[in] output A output object
654 * @param[out] num_types The number of composition type changes required by
655 * the device; if greater than 0, the client must either set and validate new
656 * types, or call tdm_output_hwc_accept_changes() to accept the changes returned by
657 * tdm_output_hwc_get_changed_composition_types(); must be the same as the number of
658 * changes returned by tdm_output_hwc_get_changed_composition_types (see the
659 * declaration of that function for more information); pointer will be non-NULL
660 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
664 tdm_output_hwc_validate(tdm_output *output, tdm_hwc_window **composited_wnds, uint32_t num_wnds,
665 uint32_t *num_types);
668 * @brief Set the 'need to validate' handler for the 'output'
670 * @details During backend's work it may need to ask for the revalidation
671 * (make client (E20) do tdm_output_hwc_validate() again), so a 'hndl' will
672 * be called as such need happen. Only one handler per output is supported.
674 * @param[in] output The output object a hndl is going to be registered for.
675 * @param[in] hndl The handler which will be called on the 'need to validate' event.
677 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
681 tdm_output_hwc_set_need_validate_handler(tdm_output *output,
682 tdm_output_need_validate_handler hndl);
685 * @brief Get changed composition types
686 * @details Retrieves the windows for which the device requires a different
687 * composition type than had been set prior to the last call to tdm_output_hwc_validate().
688 * The client will either update its state with these types and call
689 * tdm_output_hwc_accept_changes, or will set new types and attempt to validate the
691 * windows and types may be NULL to retrieve the number of elements which
692 * will be returned. The number of elements returned must be the same as the
693 * value returned in num_types from the last call to tdm_output_hwc_validate().
694 * @param[in] output A output object
695 * @param[out] num_elements If windows or types were NULL, the number of layers
696 * and types which would have been returned; if both were non-NULL, the
697 * number of elements returned in layers and types, which must not exceed
698 * the value stored in num_elements prior to the call; pointer will be
700 * @param[in] output A output object
701 * @param[out] windows An array of windows
702 * @param[out] composition_types An array of composition types, each corresponding
703 * to an element of windows
704 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
708 tdm_output_hwc_get_changed_composition_types(tdm_output *output,uint32_t *num_elements,
709 tdm_hwc_window **hwc_window,
710 tdm_hwc_window_composition *composition_types);
713 * @brief Accepts the changes required by the device
714 * @details Accepts the changes required by the device from the previous
715 * tdm_output_hwc_validate() call (which may be queried using
716 * tdm_output_get_chaged_composition_types()) and revalidates the display. This
717 * function is equivalent to requesting the changed types from
718 * tdm_output_get_chaged_composition_types(), setting those types on the
719 * corresponding windows, and then calling tdm_output_hwc_validate again.
720 * After this call it must be valid to present this display. Calling this after
721 * tdm_output_hwc_validate() returns 0 changes must succeed with TDM_ERROR_NONE, but
722 * should have no other effect.
723 * @param[in] output A output object
724 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
728 tdm_output_hwc_accept_changes(tdm_output *output);
731 * @brief Get a target buffer queue
732 * @details Buffers from target buffer queue will receive the output of
733 * client composition. Window marked as TDM_COMPOSITION_CLIENT or
734 * TDM_COMPOSITION_DEVICE_CANDIDATE will be composited into this buffers
735 * prior to the call to tdm_output_commit().
736 * @param[in] output A output object
737 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
738 * @return A buffer queue
742 tdm_output_hwc_get_target_buffer_queue(tdm_output *output, tdm_error *error);
745 * @brief Get the supported format array for video hwc windows of a output object.
746 * @param[in] output A output object
747 * @param[out] formats The available format array
748 * @param[out] count The count of formats
749 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
752 tdm_output_hwc_get_video_supported_formats(tdm_layer *layer, const tbm_format **formats,
756 * @brief Get a output object of a layer object
757 * @param[in] layer A layer object
758 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
759 * @return A TDM output object if success. Otherwise, NULL.
762 tdm_layer_get_output(tdm_layer *layer, tdm_error *error);
765 * @brief Get the capabilities of a layer object.
766 * @param[in] layer A layer object
767 * @param[out] capabilities The capabilities of a layer object
768 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
771 tdm_layer_get_capabilities(tdm_layer *layer,
772 tdm_layer_capability *capabilities);
775 * @brief Get the available format array of a layer object.
776 * @param[in] layer A layer object
777 * @param[out] formats The available format array
778 * @param[out] count The count of formats
779 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
782 tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats,
786 * @brief Get the available property array of a layer object.
787 * @param[in] layer A layer object
788 * @param[out] props The available property array
789 * @param[out] count The count of properties
790 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
793 tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props,
797 * @brief Get the zpos of a layer object.
799 * - GRAPHIC layers have fixed zpos. It starts from 0. It's @b non-changeable.
800 * - But the zpos of VIDEO layers will be decided by a backend module side.
801 * - A frontend user only can set the relative zpos to VIDEO layers via #tdm_layer_set_video_pos
802 * - The zpos of video layers is less than GRAPHIC layers or more than GRAPHIC
803 * layers. ie, ..., -2, -1, 4, 5, ... (if 0 <= GRAPHIC layer's zpos < 4).
804 * -------------------------------- graphic layer 3 <-- top most layer
805 * -------------------------------- graphic layer 2
806 * -------------------------------- graphic layer 1
807 * -------------------------------- graphic layer 0
808 * -------------------------------- video layer -1
809 * -------------------------------- video layer -2 <-- lowest layer
810 * @param[in] layer A layer object
811 * @param[out] zpos The zpos
812 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
813 * @see tdm_layer_set_video_pos, tdm_layer_capability
816 tdm_layer_get_zpos(tdm_layer *layer, int *zpos);
819 * @brief Set the property which has a given id.
820 * @param[in] layer A layer object
821 * @param[in] id The property id
822 * @param[in] value The value
823 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
826 tdm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
829 * @brief Get the property which has a given id.
830 * @param[in] layer A layer object
831 * @param[in] id The property id
832 * @param[out] value The value
833 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
836 tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
839 * @brief Set the geometry information to a layer object
840 * @details The geometry information will be applied when the output object
841 * of a layer object is committed. If a layer has TDM_LAYER_CAPABILITY_NO_CROP
842 * capability, a layer will ignore the pos(crop) information of #tdm_info_layer's
844 * @param[in] layer A layer object
845 * @param[in] info The geometry information
846 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
847 * @see tdm_layer_commit
850 tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info);
853 * @brief Get the geometry information to a layer object
854 * @param[in] layer A layer object
855 * @param[out] info The geometry information
856 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
859 tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info);
862 * @brief Set a TDM buffer to a layer object
863 * @details A TDM buffer will be applied when the output object
864 * of a layer object is committed.
865 * @param[in] layer A layer object
866 * @param[in] buffer A TDM buffer
867 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
868 * @see tdm_layer_commit
871 tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer);
874 * @brief Unset a TDM buffer from a layer object
875 * @details When this function is called, a current showing buffer will be
876 * disappeared from screen. Then nothing is showing on a layer object.
877 * @param[in] layer A layer object
878 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
881 tdm_layer_unset_buffer(tdm_layer *layer);
884 * @brief Commit changes for a layer object
885 * @details After all change of a layer object are applied, a user commit handler
887 * @param[in] layer A layer object
888 * @param[in] func A user commit handler
889 * @param[in] user_data The user data
890 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
893 tdm_layer_commit(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
896 tdm_layer_is_committing(tdm_layer *layer, unsigned int *committing);
899 * @brief Remove the user commit handler
900 * @param[in] layer A layer object
901 * @param[in] func A user commit handler
902 * @param[in] user_data The user data
903 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
906 tdm_layer_remove_commit_handler(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
909 * @brief Get a displaying TDM buffer from a layer object
910 * @details A displaying TDM buffer is a current showing buffer on screen
911 * that is set to layer object and applied output object of a layer object.
912 * @param[in] layer A layer object
913 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
914 * @return A TDM buffer if success. Otherwise, NULL.
917 tdm_layer_get_displaying_buffer(tdm_layer *layer, tdm_error *error);
920 * @brief Set a TBM surface_queue to a layer object
921 * @details A TBM surface_queue will be applied when the output object
922 * of a layer object is committed. and TDM layer will be automatically updated
923 * @param[in] layer A layer object
924 * @param[in] buffer_queue A TBM surface_queue
925 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
926 * @see tdm_layer_commit
929 tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue);
932 * @brief Unset a TBM surface_queue from a layer object
933 * @details When this function is called, a current surface_queue will be
934 * disappeared from screen. Then nothing is showing on a layer object.
935 * @param[in] layer A layer object
936 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
939 tdm_layer_unset_buffer_queue(tdm_layer *layer);
942 * @brief Check wheter a layer object is available for a frontend user to use.
943 * @details A layer object is not usable if a TDM buffer is showing on screen
944 * via this layer object. By calling #tdm_layer_unset_buffer, this layer object
945 * will become usable.
946 * @param[in] layer A layer object
947 * @param[out] usable 1 if usable, 0 if not usable
948 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
951 tdm_layer_is_usable(tdm_layer *layer, unsigned int *usable);
954 * @brief Set the relative zpos to a VIDEO layer object
955 * @details The zpos value is less than the minimum zpos of GRAPHIC layers, or
956 * it is more than the maximum zpos of GRAPHIC layers.
957 * @param[in] layer A VIDEO layer object
958 * @param[in] zpos The zpos
959 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
960 * @see tdm_layer_get_zpos, tdm_layer_capability
963 tdm_layer_set_video_pos(tdm_layer *layer, int zpos);
966 * @brief Create a capture object of a layer object
967 * @param[in] layer A layer object
968 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
969 * @return A capture object
970 * @see tdm_capture_destroy
973 tdm_layer_create_capture(tdm_layer *layer, tdm_error *error);
976 * @brief Get buffer flags from a layer object
977 * @param[in] layer A layer object
978 * @param[out] flags a buffer flags value
979 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
982 tdm_layer_get_buffer_flags(tdm_layer *layer, unsigned int *flags);
985 * @brief Get a buffer queue for the window object
986 * @details These buffers are used to composite by hardware a client content in
988 * @param[in] hwc_window A window object
989 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
990 * @return A tbm buffer queue
994 tdm_hwc_window_get_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error);
997 * @brief Sets the desired composition type of the given window.
998 * @details During tdm_output_hwc_validate(), the device may request changes to
999 * the composition types of any of the layers as described in the definition
1000 * of tdm_hwc_window_composition_t above.
1001 * @param[in] hwc_window A window object
1002 * @param[in] composition_type The new composition type
1003 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1007 tdm_hwc_window_set_composition_type(tdm_hwc_window *hwc_window,
1008 tdm_hwc_window_composition composition_type);
1011 * @brief Set the buffer damage
1012 * @details Provides the region of the source buffer which has been modified
1013 * since the last frame. This region does not need to be validated before
1014 * calling tdm_output_commit().
1015 * Once set through this function, the damage region remains the same until a
1016 * subsequent call to this function.
1017 * If damage.num_rects > 0, then it may be assumed that any portion of the source
1018 * buffer not covered by one of the rects has not been modified this frame. If
1019 * damage.num_rects == 0, then the whole source buffer must be treated as if it
1020 * has been modified.
1021 * If the layer's contents are not modified relative to the prior frame, damage
1022 * will contain exactly one empty rect([0, 0, 0, 0]).
1023 * The damage rects are relative to the pre-transformed buffer, and their origin
1024 * is the top-left corner. They will not exceed the dimensions of the latched
1026 * @param[in] hwc_window A window object
1027 * @param[in] damage The new buffer damage region
1028 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1032 tdm_hwc_window_set_buffer_damage(tdm_hwc_window *hwc_window, tdm_hwc_region damage);
1035 * @brief Set the information to a window object
1036 * @details The information will be applied when the output object of a window
1037 * object is committed.
1038 * @param[in] hwc_window A window object
1039 * @param[in] info The information
1040 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1044 tdm_hwc_window_set_info(tdm_hwc_window *hwc_window, tdm_hwc_window_info *info);
1047 * @brief Set a TBM buffer to a window object
1048 * @details A TBM buffer will be applied when the output object of a layer
1049 * object is committed.
1050 * @param[in] hwc_window A window object
1051 * @param[in] buffer A TDM buffer
1052 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1053 * @return #TDM_ERROR_BUSY if #hwc_window can't be updated right now, this
1054 * can happen if #hwc_window is involved in the smooth transition from
1055 * DEVICE to CLIENT, this shouldn't be interpreted like some critical error.
1059 tdm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer);
1062 * @brief Unset a TBM buffer to a window object
1063 * @details A TBM buffer will be applied when the output object of a layer
1064 * object is committed.
1065 * @param[in] hwc_window A window object
1066 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1067 * @return #TDM_ERROR_BUSY if #hwc_window can't be updated right now, this
1068 * can happen if #hwc_window is involved in the smooth transition from
1069 * DEVICE to CLIENT, this shouldn't be interpreted like some critical error.
1073 tdm_hwc_window_unset_buffer(tdm_hwc_window *hwc_window);
1076 * @brief Set a flags to 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_set_flags(tdm_hwc_window *hwc_window, tdm_hwc_window_flag flags);
1086 * @brief Unset a flags from a window object
1087 * @param[in] hwc_window A window object
1088 * @param[in] flags A hwc_window flags
1089 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1093 tdm_hwc_window_unset_flags(tdm_hwc_window *hwc_window, tdm_hwc_window_flag flags);
1096 * @brief Commit changes for a window object
1097 * @details After all change of a window object are applied, a user commit handler
1099 * @param[in] hwc_window A window object
1100 * @param[in] func A user commit handler
1101 * @param[in] user_data The user data
1102 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1105 tdm_hwc_window_commit(tdm_hwc_window *hwc_window, tdm_hwc_window_commit_handler func, void *user_data);
1108 * @brief Get the available property array of a video hwc window object.
1109 * @param[in] hwc window A video hwc window object
1110 * @param[out] props The available property array
1111 * @param[out] count The count of properties
1112 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1115 tdm_hwc_window_video_get_available_properties(tdm_hwc_window *hwc_window,
1116 const tdm_prop **props, int *count);
1119 * @brief Get the property which has a given id.
1120 * @param[in] hwc window A video hwc window object
1121 * @param[in] id The property id
1122 * @param[out] value The value
1123 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1126 tdm_hwc_window_video_get_property(tdm_hwc_window *hwc_window, uint32_t id,
1130 * @brief Set the property which has a given id.
1131 * @param[in] hwc window A video hwc window object
1132 * @param[in] id The property id
1133 * @param[in] value The value
1134 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1137 tdm_hwc_window_video_set_property(tdm_hwc_window *hwc_window, uint32_t id,
1141 * @brief Get the window video capability
1142 * @param[in] hwc_window A window object
1143 * @param[out] video_capability A hwc window video capability
1144 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1148 tdm_hwc_window_video_get_capability(tdm_hwc_window *hwc_window,
1149 tdm_hwc_window_video_capability *video_capability);
1152 * @brief Destroy a pp object
1153 * @param[in] pp A pp object
1154 * @see tdm_display_create_pp
1157 tdm_pp_destroy(tdm_pp *pp);
1160 * @brief Set the geometry information to a pp object
1161 * @param[in] pp A pp object
1162 * @param[in] info The geometry information
1163 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1164 * @see tdm_pp_commit
1167 tdm_pp_set_info(tdm_pp *pp, tdm_info_pp *info);
1170 * @brief Set the PP done handler to a pp object
1172 * The user PP done handler will be called after converting a source buffer's image
1173 * to a destination buffer.
1174 * @param[in] pp A pp object
1175 * @param[in] func A user PP done handler
1176 * @param[in] user_data The user data
1177 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1180 tdm_pp_set_done_handler(tdm_pp *pp, tdm_pp_done_handler func, void *user_data);
1183 * @brief Attach a source buffer and a destination buffer to a pp object
1184 * @param[in] pp A pp object
1185 * @param[in] src A source buffer
1186 * @param[in] dst A destination buffer
1187 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1188 * @see tdm_pp_commit, tdm_pp_set_done_handler
1191 tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
1194 * @brief Commit changes for a pp object
1195 * @param[in] pp A pp object
1196 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1199 tdm_pp_commit(tdm_pp *pp);
1202 * @brief Destroy a capture object
1203 * @param[in] capture A capture object
1204 * @see tdm_output_create_capture, tdm_layer_create_capture
1207 tdm_capture_destroy(tdm_capture *capture);
1210 * @brief Set the geometry information to a capture object
1211 * @param[in] capture A capture object
1212 * @param[in] info The geometry information
1213 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1214 * @see tdm_capture_commit
1217 tdm_capture_set_info(tdm_capture *capture, tdm_info_capture *info);
1220 * @brief Set the capture done handler to a capture object
1222 * The user capture done handler will be called after capturing a screen into a
1224 * @param[in] capture A capture object
1225 * @param[in] func A user capture done handler
1226 * @param[in] user_data The user data
1227 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1230 tdm_capture_set_done_handler(tdm_capture *capture, tdm_capture_done_handler func, void *user_data);
1233 * @brief Attach a TDM buffer to a capture object
1234 * @param[in] capture A capture object
1235 * @param[in] buffer A TDM buffer
1236 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1237 * @see tdm_capture_commit, tdm_capture_set_done_handler
1240 tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer);
1243 * @brief Commit changes for a capture object
1244 * @param[in] capture A capture object
1245 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1248 tdm_capture_commit(tdm_capture *capture);
1251 * @brief The release handler of a TDM buffer
1252 * @param[in] buffer A TDM buffer
1253 * @param[in] user_data user data
1254 * @see tdm_buffer_add_release_handler, tdm_buffer_remove_release_handler
1256 typedef void (*tdm_buffer_release_handler)(tbm_surface_h buffer,
1260 * @brief Add a release handler to a TDM buffer
1262 * TDM has its own buffer release mechanism to let an frontend user know when a TDM buffer
1263 * becomes available for a next job. A TDM buffer can be used for TDM to show
1264 * it on screen or to capture an output and a layer. After all operations,
1265 * TDM will release it immediately when TDM doesn't need it any more.
1266 * @param[in] buffer A TDM buffer
1267 * @param[in] func A release handler
1268 * @param[in] user_data user data
1269 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1270 * @see tdm_buffer_remove_release_handler
1273 tdm_buffer_add_release_handler(tbm_surface_h buffer,
1274 tdm_buffer_release_handler func, void *user_data);
1277 * @brief Remove a release handler from a TDM buffer
1278 * @param[in] buffer A TDM buffer
1279 * @param[in] func A release handler
1280 * @param[in] user_data user data
1281 * @see tdm_buffer_add_release_handler
1284 tdm_buffer_remove_release_handler(tbm_surface_h buffer,
1285 tdm_buffer_release_handler func, void *user_data);
1288 * @brief The handler of a vblank object
1289 * @see #tdm_vblank_wait, #tdm_vblank_wait_seq
1291 typedef void (*tdm_vblank_handler)(tdm_vblank *vblank, tdm_error error, unsigned int sequence,
1292 unsigned int tv_sec, unsigned int tv_usec, void *user_data);
1295 * @brief Set the vblank 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] fps The client vblank fps
1299 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1302 tdm_vblank_set_client_vblank_fps(unsigned int pid, const char *name, unsigned int fps);
1305 * @brief Set the ignore global fps for the given PID and name.
1306 * @param[in] pid The process ID
1307 * @param[in] name The client vblank name
1308 * @param[in] ignore 1: ignore 0:not ignore(default)
1309 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1312 tdm_vblank_set_client_ignore_global_fps(unsigned int pid, const char *name, unsigned int ignore);
1315 * @brief Set the vblank global fps for the entire system.
1316 * @param[in] enable 1:enable, 0:disable
1317 * @param[in] fps The vblank global fps
1319 * This global fps will be applied to all client's vblanks for all outputs.
1320 * If the client's vblank fps is less than this, the global fps will be ignored
1321 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1322 * the global fps, it will be ignored also.
1323 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1326 tdm_vblank_enable_global_fps(unsigned int enable, unsigned int fps);
1329 * @brief Add the vblank create handler.
1330 * @param[in] dpy A display object
1331 * @param[in] func The user vblank create handler
1332 * @param[in] user_data The user data
1334 * The user vblank create handler will be called when new vblank object created.
1335 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1338 tdm_vblank_add_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1341 * @brief Remove the vblank create handler.
1342 * @param[in] dpy A display object
1343 * @param[in] func The user vblank create handler
1344 * @param[in] user_data The user data
1345 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1348 tdm_vblank_remove_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1351 * @brief Create a vblank object
1352 * @param[in] dpy A display object
1353 * @param[in] output A output object
1354 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1355 * @return A vblank object
1356 * @see #tdm_vblank_destroy
1359 tdm_vblank_create(tdm_display *dpy, tdm_output *output, tdm_error *error);
1362 * @brief Destroy a vblank object
1363 * @param[in] vblank A vblank object
1364 * @see #tdm_vblank_create
1367 tdm_vblank_destroy(tdm_vblank *vblank);
1370 * @brief Get a output object of a vblank object
1371 * @param[in] vblank A vblank object
1372 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1373 * @return A TDM output object if success. Otherwise, NULL.
1374 * @see #tdm_vblank_create
1377 tdm_vblank_get_output(tdm_vblank *vblank, tdm_error *error);
1380 * @brief Get the client PID for a vblank object
1381 * @param[in] vblank A vblank object
1382 * @param[out] pid PID of vblank's client
1383 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1386 tdm_vblank_get_client_pid(tdm_vblank *vblank, pid_t *pid);
1389 * @brief Set the name to a vblank object
1390 * @details The default name is "unknown"
1391 * @param[in] vblank A vblank object
1392 * @param[in] name vblank name
1393 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1396 tdm_vblank_set_name(tdm_vblank *vblank, const char *name);
1399 * @brief Get the name for a vblank object
1400 * @details The default name is "unknown"
1401 * @param[in] vblank A vblank object
1402 * @param[out] name vblank name
1403 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1406 tdm_vblank_get_name(tdm_vblank *vblank, const char **name);
1409 * @brief Set the fps to a vblank object
1410 * @details Default is the @b vertical @b refresh @b rate of the given output.
1411 * It could be ignored when the fixed fps is set by #tdm_vblank_set_fixed_fps
1412 * @param[in] vblank A vblank object
1413 * @param[in] fps over 0
1414 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1417 tdm_vblank_set_fps(tdm_vblank *vblank, unsigned int fps);
1420 * @brief Get the fps for a vblank object
1421 * @param[in] vblank A vblank object
1422 * @param[out] fps over 0
1423 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1426 tdm_vblank_get_fps(tdm_vblank *vblank, unsigned int *fps);
1429 * @brief Set the fixed fps to a vblank object
1431 * It could be ignored when the global fps is set by #tdm_vblank_enable_global_fps
1432 * @param[in] vblank A vblank object
1433 * @param[in] fps over 0
1434 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1437 tdm_vblank_set_fixed_fps(tdm_vblank *vblank, unsigned int fps);
1440 * @brief Ignore the vblank global fps
1442 * The global fps will be applied to all client's vblanks for all outputs.
1443 * If the client's vblank fps is less than this, the global fps will be ignored
1444 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1445 * the global fps, it will be ignored also.
1446 * @param[in] vblank A vblank object
1447 * @param[in] ignore 1: ignore 0:not ignore(default)
1448 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1451 tdm_vblank_ignore_global_fps(tdm_vblank *vblank, unsigned int ignore);
1454 * @brief Set the offset(milli-second) to a vblank object
1455 * @details Default is @b 0.
1456 * @param[in] vblank A vblank object
1457 * @param[in] offset the offset(milli-second)
1458 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1461 tdm_vblank_set_offset(tdm_vblank *vblank, int offset);
1464 * @brief Get the offset(milli-second) for a vblank object
1465 * @param[in] vblank A vblank object
1466 * @param[out] offset the offset(milli-second)
1467 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1470 tdm_vblank_get_offset(tdm_vblank *vblank, int *offset);
1473 * @brief Enable/Disable the fake vblank to a vblank object
1475 * If enable_fake == 0, #tdm_vblank_wait will return TDM_ERROR_DPMS_OFF
1476 * when DPMS off. Otherwise, #tdm_vblank_wait will return TDM_ERROR_NONE
1478 * @param[in] vblank A vblank object
1479 * @param[in] enable_fake 1:enable, 0:disable
1480 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1483 tdm_vblank_set_enable_fake(tdm_vblank *vblank, unsigned int enable_fake);
1486 * @brief Get the fake vblank
1487 * @param[in] vblank A vblank object
1488 * @param[out] enable_fake 1:enable, 0:disable
1489 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1492 tdm_vblank_get_enable_fake(tdm_vblank *vblank, unsigned int *enable_fake);
1495 * @brief Wait for a vblank
1497 * Once #tdm_vblank_wait returns TDM_ERROR_NONE, the user vblank handler(#tdm_vblank_handler)
1498 * SHOULD be called after the given interval. \n
1499 * The sequence value of tdm_vblank_handler is the relative value of fps.
1500 * If fps = 10, this sequence value should be increased by 10 during 1 second.
1501 * @param[in] vblank A vblank object
1502 * @param[in] req_sec The vblank request time(second)
1503 * @param[in] req_usec The vblank request time(micro-second)
1504 * @param[in] interval The vblank interval
1505 * @param[in] func The user vblank handler
1506 * @param[in] user_data The user data
1507 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1510 tdm_vblank_wait(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1511 unsigned int interval, tdm_vblank_handler func, void *user_data);
1514 * @brief Wait for a vblank with the target sequence number
1515 * @param[in] vblank A vblank object
1516 * @param[in] req_sec The vblank request time(second)
1517 * @param[in] req_usec The vblank request time(micro-second)
1518 * @param[in] sequence The target sequence number
1519 * @param[in] func The user client vblank handler
1520 * @param[in] user_data The user data
1521 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1524 tdm_vblank_wait_seq(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1525 unsigned int sequence, tdm_vblank_handler func, void *user_data);
1531 #endif /* _TDM_H_ */