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 Get the capabilities of a display object.
100 * @details A frontend user can get whether TDM supports pp/capture functionality with this function.
101 * @param[in] dpy A display object
102 * @param[out] capabilities The capabilities of a display object
103 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
106 tdm_display_get_capabilities(tdm_display *dpy,
107 tdm_display_capability *capabilities);
110 * @brief Get the pp capabilities of a display object.
111 * @param[in] dpy A display object
112 * @param[out] capabilities The pp capabilities
113 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
116 tdm_display_get_pp_capabilities(tdm_display *dpy,
117 tdm_pp_capability *capabilities);
120 * @brief Get the pp available format array of a display object.
121 * @param[in] dpy A display object
122 * @param[out] formats The pp available format array
123 * @param[out] count The count of formats
124 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
127 tdm_display_get_pp_available_formats(tdm_display *dpy,
128 const tbm_format **formats, int *count);
131 * @brief Get the pp available size of a display object.
132 * @details -1 means that a TDM backend module doesn't define the value.
133 * @param[in] dpy A display object
134 * @param[out] min_w The minimum width which TDM can handle
135 * @param[out] min_h The minimum height which TDM can handle
136 * @param[out] max_w The maximum width which TDM can handle
137 * @param[out] max_h The maximum height which TDM can handle
138 * @param[out] preferred_align The preferred align width which TDM can handle
139 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
142 tdm_display_get_pp_available_size(tdm_display *dpy, int *min_w, int *min_h,
143 int *max_w, int *max_h, int *preferred_align);
146 * @brief Get the capture capabilities of a display object.
147 * @param[in] dpy A display object
148 * @param[out] capabilities The capture capabilities
149 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
152 tdm_display_get_capture_capabilities(tdm_display *dpy,
153 tdm_capture_capability *capabilities);
156 * @brief Get the capture available format array of a display object.
157 * @param[in] dpy A display object
158 * @param[out] formats The capture available format array
159 * @param[out] count The count of formats
160 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
163 tdm_display_get_capture_available_formats(tdm_display *dpy,
164 const tbm_format **formats, int *count);
167 * @brief Get the capture available size of a display object.
168 * @details -1 means that a TDM backend module doesn't define the value.
169 * @param[in] dpy A display object
170 * @param[out] min_w The minimum width which TDM can handle
171 * @param[out] min_h The minimum height which TDM can handle
172 * @param[out] max_w The maximum width which TDM can handle
173 * @param[out] max_h The maximum height which TDM can handle
174 * @param[out] preferred_align The preferred align width which TDM can handle
175 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
178 tdm_display_get_capture_available_size(tdm_display *dpy, int *min_w, int *min_h,
179 int *max_w, int *max_h, int *preferred_align);
182 * @brief Get the output counts which a display object has.
183 * @param[in] dpy A display object
184 * @param[out] count The count of outputs
185 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
186 * @see tdm_display_get_output
189 tdm_display_get_output_count(tdm_display *dpy, int *count);
192 * @brief Get a output object which has the given index.
193 * @param[in] dpy A display object
194 * @param[in] index The index of a output object
195 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
196 * @return A output object if success. Otherwise, NULL.
197 * @see tdm_display_get_output_count
200 tdm_display_get_output(tdm_display *dpy, int index, tdm_error *error);
203 * @brief Create a pp object.
204 * @param[in] dpy A display object
205 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
206 * @return A pp object if success. Otherwise, NULL.
207 * @see tdm_pp_destroy
210 tdm_display_create_pp(tdm_display *dpy, tdm_error *error);
213 * @brief Get the information of the TDM backend module.
214 * @param[in] backend A backend object
215 * @param[out] name The name of the TDM backend module
216 * @param[out] vendor The vendor of the TDM backend module
217 * @param[out] version The version of the TDM backend module
218 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
221 tdm_backend_get_info(tdm_backend *backend, const char **name,
222 const char **vendor, int *major, int *minor);
225 * @brief Get a backend object of the given output.
226 * @param[in] output A output object
227 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
228 * @return A backend object if success. Otherwise, NULL.
231 tdm_output_get_backend(tdm_output *output, tdm_error *error);
234 * @brief Get the capabilities of a output object.
235 * @param[in] output A output object
236 * @param[out] capabilities The capabilities of a output object
237 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
240 tdm_output_get_capabilities(tdm_output *output,
241 tdm_output_capability *capabilities);
244 * @brief Get the model information of a output object.
245 * @param[in] output A output object
246 * @param[out] maker The output maker.
247 * @param[out] model The output model.
248 * @param[out] name The output name.
249 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
252 tdm_output_get_model_info(tdm_output *output, const char **maker,
253 const char **model, const char **name);
256 * @brief Get the connection status of a output object.
257 * @param[in] output A output object
258 * @param[out] status The connection status.
259 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
262 tdm_output_get_conn_status(tdm_output *output, tdm_output_conn_status *status);
265 * @brief Add a output change handler
266 * @details The handler will be called when the status of a
267 * output object is changed. connection, DPMS, etc.
268 * @param[in] output A output object
269 * @param[in] func A output change handler
270 * @param[in] user_data The user data
271 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
274 tdm_output_add_change_handler(tdm_output *output,
275 tdm_output_change_handler func,
279 * @brief Remove a output change handler
280 * @param[in] output A output object
281 * @param[in] func A output change handler
282 * @param[in] user_data The user data
283 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
286 tdm_output_remove_change_handler(tdm_output *output,
287 tdm_output_change_handler func,
291 * @brief Get the connection type of a output object.
292 * @param[in] output A output object
293 * @param[out] type The connection type.
294 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
297 tdm_output_get_output_type(tdm_output *output, tdm_output_type *type);
300 * @brief Get the layer counts which a output object has.
301 * @param[in] output A output object
302 * @param[out] count The count of layers
303 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
304 * @see tdm_output_get_layer
307 tdm_output_get_layer_count(tdm_output *output, int *count);
310 * @brief Get a layer object which has the given index.
311 * @param[in] output A output object
312 * @param[in] index The index of a layer object
313 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
314 * @return A layer object if success. Otherwise, NULL.
315 * @see tdm_output_get_layer_count
318 tdm_output_get_layer(tdm_output *output, int index, tdm_error *error);
321 * @brief Get the available property array of a output object.
322 * @param[in] output A output object
323 * @param[out] props The available property array
324 * @param[out] count The count of properties
325 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
328 tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props,
332 * @brief Get the available mode array of a output object.
333 * @param[in] output A output object
334 * @param[out] modes The available mode array
335 * @param[out] count The count of modes
336 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
339 tdm_output_get_available_modes(tdm_output *output,
340 const tdm_output_mode **modes, int *count);
343 * @brief Get the available size of a output object.
344 * @details -1 means that a TDM backend module doesn't define the value.
345 * @param[in] output A output object
346 * @param[out] min_w The minimum width which TDM can handle
347 * @param[out] min_h The minimum height which TDM can handle
348 * @param[out] max_w The maximum width which TDM can handle
349 * @param[out] max_h The maximum height which TDM can handle
350 * @param[out] preferred_align The preferred align width which TDM can handle
351 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
354 tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h,
355 int *max_w, int *max_h, int *preferred_align);
358 * @brief Get the available cursor size of a output object.
359 * @details -1 means that a TDM backend module doesn't define the value.
360 * @param[in] output A output object
361 * @param[out] min_w The minimum width which TDM can handle
362 * @param[out] min_h The minimum height which TDM can handle
363 * @param[out] max_w The maximum width which TDM can handle
364 * @param[out] max_h The maximum height which TDM can handle
365 * @param[out] preferred_align The preferred align width which TDM can handle
366 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
369 tdm_output_get_cursor_available_size(tdm_output *output, int *min_w, int *min_h,
370 int *max_w, int *max_h, int *preferred_align);
373 * @brief Get the physical size of a output object.
374 * @param[in] output A output object
375 * @param[out] mmWidth The milimeter width
376 * @param[out] mmHeight The milimeter height
377 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
380 tdm_output_get_physical_size(tdm_output *output, unsigned int *mmWidth,
381 unsigned int *mmHeight);
384 * @brief Get the subpixel of a output object.
385 * @param[in] output A output object
386 * @param[out] subpixel The subpixel
387 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
390 tdm_output_get_subpixel(tdm_output *output, unsigned int *subpixel);
393 * @brief Get the pipe of a output object.
394 * @param[in] output A output object
395 * @param[out] pipe The pipe
396 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
399 tdm_output_get_pipe(tdm_output *output, unsigned int *pipe);
402 * @brief Get the index of a primary layer.
403 * @param[in] output A output object
404 * @param[out] index The primary layer index
405 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
408 tdm_output_get_primary_index(tdm_output *output, int *index);
411 * @brief Set the property which has a given id.
412 * @param[in] output A output object
413 * @param[in] id The property id
414 * @param[in] value The value
415 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
418 tdm_output_set_property(tdm_output *output, unsigned int id, tdm_value value);
421 * @brief Get the property which has a given id
422 * @param[in] output A output object
423 * @param[in] id The property id
424 * @param[out] value The value
425 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
428 tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value);
431 * @brief Wait for VBLANK
432 * @details After interval vblanks, a user vblank handler will be called.
433 * @param[in] output A output object
434 * @param[in] interval vblank interval
435 * @param[in] sync 0: asynchronous, 1:synchronous
436 * @param[in] func A user vblank handler
437 * @param[in] user_data The user data
438 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
439 * @see #tdm_output_vblank_handler
442 tdm_output_wait_vblank(tdm_output *output, int interval, int sync,
443 tdm_output_vblank_handler func, void *user_data);
446 * @brief Commit changes for a output object
447 * @details After all change of a output object are applied, a user commit handler
449 * @param[in] output A output object
450 * @param[in] sync 0: asynchronous, 1:synchronous
451 * @param[in] func A user commit handler
452 * @param[in] user_data The user data
453 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
454 * @see #tdm_layer_commit
457 tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func,
461 * @brief Remove the user vblank handler
462 * @param[in] output A output object
463 * @param[in] func A user vblank handler
464 * @param[in] user_data The user data
465 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
468 tdm_output_remove_vblank_handler(tdm_output *output, tdm_output_vblank_handler func, void *user_data);
471 * @brief Remove the user commit handler
472 * @param[in] output A output object
473 * @param[in] func A user commit handler
474 * @param[in] user_data The user data
475 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
478 tdm_output_remove_commit_handler(tdm_output *output, tdm_output_commit_handler func, void *user_data);
481 * @brief Set one of available modes of a output object
482 * @param[in] output A output object
483 * @param[in] mode A output mode
484 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
487 tdm_output_set_mode(tdm_output *output, const tdm_output_mode *mode);
490 * @brief Get the mode of a output object
491 * @param[in] output A output object
492 * @param[out] mode A output mode
493 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
496 tdm_output_get_mode(tdm_output *output, const tdm_output_mode **mode);
499 * @brief Set DPMS of a output object synchronously
500 * @param[in] output A output object
501 * @param[in] dpms_value DPMS value
502 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
503 * @see tdm_output_set_dpms_async
506 tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value);
509 * @brief Set DPMS of a output object asynchronously
510 * @details This function can be used when a output supports the asynchronous DPMS
511 * control. The output has #TDM_OUTPUT_CAPABILITY_ASYNC_DPMS flags which
512 * #tdm_output_get_capabilities returns. If an output change handler is added with
513 * #tdm_output_add_change_handler, the output change handler will be called when
514 * the DPMS status is changed indeed.
515 * @param[in] output A output object
516 * @param[in] dpms_value DPMS value
517 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
518 * @see tdm_output_add_change_handler, tdm_output_set_dpms,
519 * tdm_output_get_capabilities, #TDM_OUTPUT_CAPABILITY_ASYNC_DPMS.
522 tdm_output_set_dpms_async(tdm_output *output, tdm_output_dpms dpms_value);
525 * @brief Get DPMS of a output object
526 * @param[in] output A output object
527 * @param[out] dpms_value DPMS value
528 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
531 tdm_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value);
534 * @brief Create a capture object of a output object
535 * @param[in] output A output object
536 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
537 * @return A capture object
538 * @see tdm_capture_destroy
541 tdm_output_create_capture(tdm_output *output, tdm_error *error);
544 * @brief Creates a new window on the given display.
545 * @param[in] output A output object
546 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
547 * @return A created window object
551 tdm_output_hwc_create_window(tdm_output *output, tdm_error *error);
554 * @brief Creates a new video window on the given output.
555 * @param[in] output A output object
556 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
557 * @return A created window object
561 tdm_output_hwc_create_video_window(tdm_output *output, tdm_error *error);
564 * @brief Destroys the given window.
565 * @param[in] output A output object
566 * @param[in] window the pointer of the window to destroy
567 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
571 tdm_output_hwc_destroy_window(tdm_output *output, tdm_hwc_window *hwc_window);
574 * @brief Set the client(relative to the TDM) target buffer
575 * @details Sets the buffer which will receive the output of client composition.
576 * Window marked as TDM_COMPOSITION_CLIENT or TDM_COMPOSITION_DEVICE_CANDIDATE
577 * will be composited into this buffer prior to the call to tdm_output_commit(),
578 * and windows not marked as TDM_COMPOSITION_CLIENT and
579 * TDM_COMPOSITION_DEVICE_CANDIDATE should be composited with this buffer by the
582 * The buffer handle provided may be null if no windows are being composited by
583 * the client. This must not result in an error (unless an invalid display
584 * handle is also provided).
586 * The damage parameter describes a buffer damage region as defined in the
587 * description of tdm_hwc_window_set_buffer_damage().
589 * List of composited hwc_windows (hwc_windows which buffers are presented on #target_buffer)
590 * should be passed along with #target_buffer to allow tdm to make the smooth transition
591 * from a DEVICE type to a CLIENT type.
593 * Should be called before tdm_output_commit() if any of the layers are marked as
594 * TDM_COMPOSITION_CLIENT or TDM_COMPOSITION_DEVICE_CANDIDATE. If no layers are
595 * so marked, then it is not necessary to call this function. It is not necessary
596 * to call tdm_output_hwc_validate() after changing the target through this function.
597 * @param[in] output A output object
598 * @param[in] target_buffer The new target buffer
599 * @param[in] damage The buffer damage region
600 * @param[in] composited_wnds The array of composited hwc_wnds
601 * @param[in] num_wnds The size of #composited_wnds array
602 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
606 tdm_output_hwc_set_client_target_buffer(tdm_output *output, tbm_surface_h target_buffer, tdm_hwc_region damage);
609 * @brief Unset the client(relative to the TDM) target buffer
611 * @param[in] output A output object
612 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
616 tdm_output_hwc_unset_client_target_buffer(tdm_output *output);
619 * @brief Commit changes for a target_window
620 * @details After all change of a window object are applied, a user commit handler
622 * @param[in] hwc_window A window object
623 * @param[in] func A user commit handler
624 * @param[in] user_data The user data
625 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
628 tdm_output_hwc_commit_client_target_buffer(tdm_output *output, tdm_output_hwc_target_buffer_commit_handler func, void *user_data);
631 * @brief Validate the output
632 * @details Instructs the device to inspect all of the layer state and
633 * determine if there are any composition type changes necessary before
634 * presenting the output. Permitted changes are described in the definition
635 * of tdm_hwc_window_composition_t above.
636 * @param[in] output A output object
637 * @param[out] num_types The number of composition type changes required by
638 * the device; if greater than 0, the client must either set and validate new
639 * types, or call tdm_output_hwc_accept_changes() to accept the changes returned by
640 * tdm_output_hwc_get_changed_composition_types(); must be the same as the number of
641 * changes returned by tdm_output_hwc_get_changed_composition_types (see the
642 * declaration of that function for more information); pointer will be non-NULL
643 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
647 tdm_output_hwc_validate(tdm_output *output, tdm_hwc_window **composited_wnds, uint32_t num_wnds,
648 uint32_t *num_types);
651 * @brief Set the 'need to validate' handler for the 'output'
653 * @details During backend's work it may need to ask for the revalidation
654 * (make client (E20) do tdm_output_hwc_validate() again), so a 'hndl' will
655 * be called as such need happen. Only one handler per output is supported.
657 * @param[in] output The output object a hndl is going to be registered for.
658 * @param[in] hndl The handler which will be called on the 'need to validate' event.
660 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
664 tdm_output_hwc_set_need_validate_handler(tdm_output *output,
665 tdm_output_need_validate_handler hndl);
668 * @brief Get changed composition types
669 * @details Retrieves the windows for which the device requires a different
670 * composition type than had been set prior to the last call to tdm_output_hwc_validate().
671 * The client will either update its state with these types and call
672 * tdm_output_hwc_accept_changes, or will set new types and attempt to validate the
674 * windows and types may be NULL to retrieve the number of elements which
675 * will be returned. The number of elements returned must be the same as the
676 * value returned in num_types from the last call to tdm_output_hwc_validate().
677 * @param[in] output A output object
678 * @param[out] num_elements If windows or types were NULL, the number of layers
679 * and types which would have been returned; if both were non-NULL, the
680 * number of elements returned in layers and types, which must not exceed
681 * the value stored in num_elements prior to the call; pointer will be
683 * @param[in] output A output object
684 * @param[out] windows An array of windows
685 * @param[out] composition_types An array of composition types, each corresponding
686 * to an element of windows
687 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
691 tdm_output_hwc_get_changed_composition_types(tdm_output *output,uint32_t *num_elements,
692 tdm_hwc_window **hwc_window,
693 tdm_hwc_window_composition *composition_types);
696 * @brief Accepts the changes required by the device
697 * @details Accepts the changes required by the device from the previous
698 * tdm_output_hwc_validate() call (which may be queried using
699 * tdm_output_get_chaged_composition_types()) and revalidates the display. This
700 * function is equivalent to requesting the changed types from
701 * tdm_output_get_chaged_composition_types(), setting those types on the
702 * corresponding windows, and then calling tdm_output_hwc_validate again.
703 * After this call it must be valid to present this display. Calling this after
704 * tdm_output_hwc_validate() returns 0 changes must succeed with TDM_ERROR_NONE, but
705 * should have no other effect.
706 * @param[in] output A output object
707 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
711 tdm_output_hwc_accept_changes(tdm_output *output);
714 * @brief Get a target buffer queue
715 * @details Buffers from target buffer queue will receive the output of
716 * client composition. Window marked as TDM_COMPOSITION_CLIENT or
717 * TDM_COMPOSITION_DEVICE_CANDIDATE will be composited into this buffers
718 * prior to the call to tdm_output_commit().
719 * @param[in] output A output object
720 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
721 * @return A buffer queue
725 tdm_output_hwc_get_target_buffer_queue(tdm_output *output, tdm_error *error);
728 * @brief Get the supported format array for video hwc windows of a output object.
729 * @param[in] output A output object
730 * @param[out] formats The available format array
731 * @param[out] count The count of formats
732 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
735 tdm_output_hwc_get_video_supported_formats(tdm_layer *layer, const tbm_format **formats,
739 * @brief Get a output object of a layer object
740 * @param[in] layer A layer object
741 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
742 * @return A TDM output object if success. Otherwise, NULL.
745 tdm_layer_get_output(tdm_layer *layer, tdm_error *error);
748 * @brief Get the capabilities of a layer object.
749 * @param[in] layer A layer object
750 * @param[out] capabilities The capabilities of a layer object
751 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
754 tdm_layer_get_capabilities(tdm_layer *layer,
755 tdm_layer_capability *capabilities);
758 * @brief Get the available format array of a layer object.
759 * @param[in] layer A layer object
760 * @param[out] formats The available format array
761 * @param[out] count The count of formats
762 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
765 tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats,
769 * @brief Get the available property array of a layer object.
770 * @param[in] layer A layer object
771 * @param[out] props The available property array
772 * @param[out] count The count of properties
773 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
776 tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props,
780 * @brief Get the zpos of a layer object.
782 * - GRAPHIC layers have fixed zpos. It starts from 0. It's @b non-changeable.
783 * - But the zpos of VIDEO layers will be decided by a backend module side.
784 * - A frontend user only can set the relative zpos to VIDEO layers via #tdm_layer_set_video_pos
785 * - The zpos of video layers is less than GRAPHIC layers or more than GRAPHIC
786 * layers. ie, ..., -2, -1, 4, 5, ... (if 0 <= GRAPHIC layer's zpos < 4).
787 * -------------------------------- graphic layer 3 <-- top most layer
788 * -------------------------------- graphic layer 2
789 * -------------------------------- graphic layer 1
790 * -------------------------------- graphic layer 0
791 * -------------------------------- video layer -1
792 * -------------------------------- video layer -2 <-- lowest layer
793 * @param[in] layer A layer object
794 * @param[out] zpos The zpos
795 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
796 * @see tdm_layer_set_video_pos, tdm_layer_capability
799 tdm_layer_get_zpos(tdm_layer *layer, int *zpos);
802 * @brief Set the property which has a given id.
803 * @param[in] layer A layer object
804 * @param[in] id The property id
805 * @param[in] value The value
806 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
809 tdm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
812 * @brief Get the property which has a given id.
813 * @param[in] layer A layer object
814 * @param[in] id The property id
815 * @param[out] value The value
816 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
819 tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
822 * @brief Set the geometry information to a layer object
823 * @details The geometry information will be applied when the output object
824 * of a layer object is committed. If a layer has TDM_LAYER_CAPABILITY_NO_CROP
825 * capability, a layer will ignore the pos(crop) information of #tdm_info_layer's
827 * @param[in] layer A layer object
828 * @param[in] info The geometry information
829 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
830 * @see tdm_layer_commit
833 tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info);
836 * @brief Get the geometry information to a layer object
837 * @param[in] layer A layer object
838 * @param[out] info The geometry information
839 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
842 tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info);
845 * @brief Set a TDM buffer to a layer object
846 * @details A TDM buffer will be applied when the output object
847 * of a layer object is committed.
848 * @param[in] layer A layer object
849 * @param[in] buffer A TDM buffer
850 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
851 * @see tdm_layer_commit
854 tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer);
857 * @brief Unset a TDM buffer from a layer object
858 * @details When this function is called, a current showing buffer will be
859 * disappeared from screen. Then nothing is showing on a layer object.
860 * @param[in] layer A layer object
861 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
864 tdm_layer_unset_buffer(tdm_layer *layer);
867 * @brief Commit changes for a layer object
868 * @details After all change of a layer object are applied, a user commit handler
870 * @param[in] layer A layer object
871 * @param[in] func A user commit handler
872 * @param[in] user_data The user data
873 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
876 tdm_layer_commit(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
879 tdm_layer_is_committing(tdm_layer *layer, unsigned int *committing);
882 * @brief Remove the user commit handler
883 * @param[in] layer A layer object
884 * @param[in] func A user commit handler
885 * @param[in] user_data The user data
886 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
889 tdm_layer_remove_commit_handler(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
892 * @brief Get a displaying TDM buffer from a layer object
893 * @details A displaying TDM buffer is a current showing buffer on screen
894 * that is set to layer object and applied output object of a layer object.
895 * @param[in] layer A layer object
896 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
897 * @return A TDM buffer if success. Otherwise, NULL.
900 tdm_layer_get_displaying_buffer(tdm_layer *layer, tdm_error *error);
903 * @brief Set a TBM surface_queue to a layer object
904 * @details A TBM surface_queue will be applied when the output object
905 * of a layer object is committed. and TDM layer will be automatically updated
906 * @param[in] layer A layer object
907 * @param[in] buffer_queue A TBM surface_queue
908 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
909 * @see tdm_layer_commit
912 tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue);
915 * @brief Unset a TBM surface_queue from a layer object
916 * @details When this function is called, a current surface_queue will be
917 * disappeared from screen. Then nothing is showing on a layer object.
918 * @param[in] layer A layer object
919 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
922 tdm_layer_unset_buffer_queue(tdm_layer *layer);
925 * @brief Check wheter a layer object is available for a frontend user to use.
926 * @details A layer object is not usable if a TDM buffer is showing on screen
927 * via this layer object. By calling #tdm_layer_unset_buffer, this layer object
928 * will become usable.
929 * @param[in] layer A layer object
930 * @param[out] usable 1 if usable, 0 if not usable
931 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
934 tdm_layer_is_usable(tdm_layer *layer, unsigned int *usable);
937 * @brief Set the relative zpos to a VIDEO layer object
938 * @details The zpos value is less than the minimum zpos of GRAPHIC layers, or
939 * it is more than the maximum zpos of GRAPHIC layers.
940 * @param[in] layer A VIDEO layer object
941 * @param[in] zpos The zpos
942 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
943 * @see tdm_layer_get_zpos, tdm_layer_capability
946 tdm_layer_set_video_pos(tdm_layer *layer, int zpos);
949 * @brief Create a capture object of a layer object
950 * @param[in] layer A layer object
951 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
952 * @return A capture object
953 * @see tdm_capture_destroy
956 tdm_layer_create_capture(tdm_layer *layer, tdm_error *error);
959 * @brief Get buffer flags from a layer object
960 * @param[in] layer A layer object
961 * @param[out] flags a buffer flags value
962 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
965 tdm_layer_get_buffer_flags(tdm_layer *layer, unsigned int *flags);
968 * @brief Get a buffer queue for the window object
969 * @details These buffers are used to composite by hardware a client content in
971 * @param[in] hwc_window A window object
972 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
973 * @return A tbm buffer queue
977 tdm_hwc_window_get_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error);
980 * @brief Sets the desired composition type of the given window.
981 * @details During tdm_output_hwc_validate(), the device may request changes to
982 * the composition types of any of the layers as described in the definition
983 * of tdm_hwc_window_composition_t above.
984 * @param[in] hwc_window A window object
985 * @param[in] composition_type The new composition type
986 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
990 tdm_hwc_window_set_composition_type(tdm_hwc_window *hwc_window,
991 tdm_hwc_window_composition composition_type);
994 * @brief Set the buffer damage
995 * @details Provides the region of the source buffer which has been modified
996 * since the last frame. This region does not need to be validated before
997 * calling tdm_output_commit().
998 * Once set through this function, the damage region remains the same until a
999 * subsequent call to this function.
1000 * If damage.num_rects > 0, then it may be assumed that any portion of the source
1001 * buffer not covered by one of the rects has not been modified this frame. If
1002 * damage.num_rects == 0, then the whole source buffer must be treated as if it
1003 * has been modified.
1004 * If the layer's contents are not modified relative to the prior frame, damage
1005 * will contain exactly one empty rect([0, 0, 0, 0]).
1006 * The damage rects are relative to the pre-transformed buffer, and their origin
1007 * is the top-left corner. They will not exceed the dimensions of the latched
1009 * @param[in] hwc_window A window object
1010 * @param[in] damage The new buffer damage region
1011 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1015 tdm_hwc_window_set_buffer_damage(tdm_hwc_window *hwc_window, tdm_hwc_region damage);
1018 * @brief Set the information to a window object
1019 * @details The information will be applied when the output object of a window
1020 * object is committed.
1021 * @param[in] hwc_window A window object
1022 * @param[in] info The information
1023 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1027 tdm_hwc_window_set_info(tdm_hwc_window *hwc_window, tdm_hwc_window_info *info);
1030 * @brief Set a TBM buffer to a window object
1031 * @details A TBM buffer will be applied when the output object of a layer
1032 * object is committed.
1033 * @param[in] hwc_window A window object
1034 * @param[in] buffer A TDM buffer
1035 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1036 * @return #TDM_ERROR_BUSY if #hwc_window can't be updated right now, this
1037 * can happen if #hwc_window is involved in the smooth transition from
1038 * DEVICE to CLIENT, this shouldn't be interpreted like some critical error.
1042 tdm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer);
1045 * @brief Unset a TBM buffer to a window object
1046 * @details A TBM buffer will be applied when the output object of a layer
1047 * object is committed.
1048 * @param[in] hwc_window A window object
1049 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1050 * @return #TDM_ERROR_BUSY if #hwc_window can't be updated right now, this
1051 * can happen if #hwc_window is involved in the smooth transition from
1052 * DEVICE to CLIENT, this shouldn't be interpreted like some critical error.
1056 tdm_hwc_window_unset_buffer(tdm_hwc_window *hwc_window);
1059 * @brief Set a flags to a window object
1060 * @param[in] hwc_window A window object
1061 * @param[in] flags A hwc_window flags
1062 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1066 tdm_hwc_window_set_flags(tdm_hwc_window *hwc_window, tdm_hwc_window_flag flags);
1069 * @brief Unset a flags from a window object
1070 * @param[in] hwc_window A window object
1071 * @param[in] flags A hwc_window flags
1072 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1076 tdm_hwc_window_unset_flags(tdm_hwc_window *hwc_window, tdm_hwc_window_flag flags);
1079 * @brief Commit changes for a window object
1080 * @details After all change of a window object are applied, a user commit handler
1082 * @param[in] hwc_window A window object
1083 * @param[in] func A user commit handler
1084 * @param[in] user_data The user data
1085 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1088 tdm_hwc_window_commit(tdm_hwc_window *hwc_window, tdm_hwc_window_commit_handler func, void *user_data);
1091 * @brief Get the available property array of a video hwc window object.
1092 * @param[in] hwc window A video hwc window object
1093 * @param[out] props The available property array
1094 * @param[out] count The count of properties
1095 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1098 tdm_hwc_window_video_get_available_properties(tdm_hwc_window *hwc_window,
1099 const tdm_prop **props, int *count);
1102 * @brief Get the property which has a given id.
1103 * @param[in] hwc window A video hwc window object
1104 * @param[in] id The property id
1105 * @param[out] value The value
1106 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1109 tdm_hwc_window_video_get_property(tdm_hwc_window *hwc_window, uint32_t id,
1113 * @brief Set the property which has a given id.
1114 * @param[in] hwc window A video hwc window object
1115 * @param[in] id The property id
1116 * @param[in] value The value
1117 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1120 tdm_hwc_window_video_set_property(tdm_hwc_window *hwc_window, uint32_t id,
1124 * @brief Get the window video capability
1125 * @param[in] hwc_window A window object
1126 * @param[out] video_capability A hwc window video capability
1127 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1131 tdm_hwc_window_video_get_capability(tdm_hwc_window *hwc_window,
1132 tdm_hwc_window_video_capability *video_capability);
1135 * @brief Destroy a pp object
1136 * @param[in] pp A pp object
1137 * @see tdm_display_create_pp
1140 tdm_pp_destroy(tdm_pp *pp);
1143 * @brief Set the geometry information to a pp object
1144 * @param[in] pp A pp object
1145 * @param[in] info The geometry information
1146 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1147 * @see tdm_pp_commit
1150 tdm_pp_set_info(tdm_pp *pp, tdm_info_pp *info);
1153 * @brief Set the PP done handler to a pp object
1155 * The user PP done handler will be called after converting a source buffer's image
1156 * to a destination buffer.
1157 * @param[in] pp A pp object
1158 * @param[in] func A user PP done handler
1159 * @param[in] user_data The user data
1160 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1163 tdm_pp_set_done_handler(tdm_pp *pp, tdm_pp_done_handler func, void *user_data);
1166 * @brief Attach a source buffer and a destination buffer to a pp object
1167 * @param[in] pp A pp object
1168 * @param[in] src A source buffer
1169 * @param[in] dst A destination buffer
1170 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1171 * @see tdm_pp_commit, tdm_pp_set_done_handler
1174 tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
1177 * @brief Commit changes for a pp object
1178 * @param[in] pp A pp object
1179 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1182 tdm_pp_commit(tdm_pp *pp);
1185 * @brief Destroy a capture object
1186 * @param[in] capture A capture object
1187 * @see tdm_output_create_capture, tdm_layer_create_capture
1190 tdm_capture_destroy(tdm_capture *capture);
1193 * @brief Set the geometry information to a capture object
1194 * @param[in] capture A capture object
1195 * @param[in] info The geometry information
1196 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1197 * @see tdm_capture_commit
1200 tdm_capture_set_info(tdm_capture *capture, tdm_info_capture *info);
1203 * @brief Set the capture done handler to a capture object
1205 * The user capture done handler will be called after capturing a screen into a
1207 * @param[in] capture A capture object
1208 * @param[in] func A user capture done handler
1209 * @param[in] user_data The user data
1210 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1213 tdm_capture_set_done_handler(tdm_capture *capture, tdm_capture_done_handler func, void *user_data);
1216 * @brief Attach a TDM buffer to a capture object
1217 * @param[in] capture A capture object
1218 * @param[in] buffer A TDM buffer
1219 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1220 * @see tdm_capture_commit, tdm_capture_set_done_handler
1223 tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer);
1226 * @brief Commit changes for a capture object
1227 * @param[in] capture A capture object
1228 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1231 tdm_capture_commit(tdm_capture *capture);
1234 * @brief The release handler of a TDM buffer
1235 * @param[in] buffer A TDM buffer
1236 * @param[in] user_data user data
1237 * @see tdm_buffer_add_release_handler, tdm_buffer_remove_release_handler
1239 typedef void (*tdm_buffer_release_handler)(tbm_surface_h buffer,
1243 * @brief Add a release handler to a TDM buffer
1245 * TDM has its own buffer release mechanism to let an frontend user know when a TDM buffer
1246 * becomes available for a next job. A TDM buffer can be used for TDM to show
1247 * it on screen or to capture an output and a layer. After all operations,
1248 * TDM will release it immediately when TDM doesn't need it any more.
1249 * @param[in] buffer A TDM buffer
1250 * @param[in] func A release handler
1251 * @param[in] user_data user data
1252 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1253 * @see tdm_buffer_remove_release_handler
1256 tdm_buffer_add_release_handler(tbm_surface_h buffer,
1257 tdm_buffer_release_handler func, void *user_data);
1260 * @brief Remove a release handler from a TDM buffer
1261 * @param[in] buffer A TDM buffer
1262 * @param[in] func A release handler
1263 * @param[in] user_data user data
1264 * @see tdm_buffer_add_release_handler
1267 tdm_buffer_remove_release_handler(tbm_surface_h buffer,
1268 tdm_buffer_release_handler func, void *user_data);
1271 * @brief The handler of a vblank object
1272 * @see #tdm_vblank_wait, #tdm_vblank_wait_seq
1274 typedef void (*tdm_vblank_handler)(tdm_vblank *vblank, tdm_error error, unsigned int sequence,
1275 unsigned int tv_sec, unsigned int tv_usec, void *user_data);
1278 * @brief Set the vblank fps for the given PID and name.
1279 * @param[in] pid The process ID
1280 * @param[in] name The client vblank name
1281 * @param[in] fps The client vblank fps
1282 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1285 tdm_vblank_set_client_vblank_fps(unsigned int pid, const char *name, unsigned int fps);
1288 * @brief Set the ignore global fps for the given PID and name.
1289 * @param[in] pid The process ID
1290 * @param[in] name The client vblank name
1291 * @param[in] ignore 1: ignore 0:not ignore(default)
1292 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1295 tdm_vblank_set_client_ignore_global_fps(unsigned int pid, const char *name, unsigned int ignore);
1298 * @brief Set the vblank global fps for the entire system.
1299 * @param[in] enable 1:enable, 0:disable
1300 * @param[in] fps The vblank global fps
1302 * This global fps will be applied to all client's vblanks for all outputs.
1303 * If the client's vblank fps is less than this, the global fps will be ignored
1304 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1305 * the global fps, it will be ignored also.
1306 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1309 tdm_vblank_enable_global_fps(unsigned int enable, unsigned int fps);
1312 * @brief Add the vblank create handler.
1313 * @param[in] dpy A display object
1314 * @param[in] func The user vblank create handler
1315 * @param[in] user_data The user data
1317 * The user vblank create handler will be called when new vblank object created.
1318 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1321 tdm_vblank_add_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1324 * @brief Remove the vblank create handler.
1325 * @param[in] dpy A display object
1326 * @param[in] func The user vblank create handler
1327 * @param[in] user_data The user data
1328 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1331 tdm_vblank_remove_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1334 * @brief Create a vblank object
1335 * @param[in] dpy A display object
1336 * @param[in] output A output object
1337 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1338 * @return A vblank object
1339 * @see #tdm_vblank_destroy
1342 tdm_vblank_create(tdm_display *dpy, tdm_output *output, tdm_error *error);
1345 * @brief Destroy a vblank object
1346 * @param[in] vblank A vblank object
1347 * @see #tdm_vblank_create
1350 tdm_vblank_destroy(tdm_vblank *vblank);
1353 * @brief Get a output object of a vblank object
1354 * @param[in] vblank A vblank object
1355 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1356 * @return A TDM output object if success. Otherwise, NULL.
1357 * @see #tdm_vblank_create
1360 tdm_vblank_get_output(tdm_vblank *vblank, tdm_error *error);
1363 * @brief Get the client PID for a vblank object
1364 * @param[in] vblank A vblank object
1365 * @param[out] pid PID of vblank's client
1366 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1369 tdm_vblank_get_client_pid(tdm_vblank *vblank, pid_t *pid);
1372 * @brief Set the name to a vblank object
1373 * @details The default name is "unknown"
1374 * @param[in] vblank A vblank object
1375 * @param[in] name vblank name
1376 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1379 tdm_vblank_set_name(tdm_vblank *vblank, const char *name);
1382 * @brief Get the name for a vblank object
1383 * @details The default name is "unknown"
1384 * @param[in] vblank A vblank object
1385 * @param[out] name vblank name
1386 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1389 tdm_vblank_get_name(tdm_vblank *vblank, const char **name);
1392 * @brief Set the fps to a vblank object
1393 * @details Default is the @b vertical @b refresh @b rate of the given output.
1394 * It could be ignored when the fixed fps is set by #tdm_vblank_set_fixed_fps
1395 * @param[in] vblank A vblank object
1396 * @param[in] fps over 0
1397 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1400 tdm_vblank_set_fps(tdm_vblank *vblank, unsigned int fps);
1403 * @brief Get the fps for a vblank object
1404 * @param[in] vblank A vblank object
1405 * @param[out] fps over 0
1406 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1409 tdm_vblank_get_fps(tdm_vblank *vblank, unsigned int *fps);
1412 * @brief Set the fixed fps to a vblank object
1414 * It could be ignored when the global fps is set by #tdm_vblank_enable_global_fps
1415 * @param[in] vblank A vblank object
1416 * @param[in] fps over 0
1417 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1420 tdm_vblank_set_fixed_fps(tdm_vblank *vblank, unsigned int fps);
1423 * @brief Ignore the vblank global fps
1425 * The global fps will be applied to all client's vblanks for all outputs.
1426 * If the client's vblank fps is less than this, the global fps will be ignored
1427 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1428 * the global fps, it will be ignored also.
1429 * @param[in] vblank A vblank object
1430 * @param[in] ignore 1: ignore 0:not ignore(default)
1431 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1434 tdm_vblank_ignore_global_fps(tdm_vblank *vblank, unsigned int ignore);
1437 * @brief Set the offset(milli-second) to a vblank object
1438 * @details Default is @b 0.
1439 * @param[in] vblank A vblank object
1440 * @param[in] offset the offset(milli-second)
1441 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1444 tdm_vblank_set_offset(tdm_vblank *vblank, int offset);
1447 * @brief Get the offset(milli-second) for a vblank object
1448 * @param[in] vblank A vblank object
1449 * @param[out] offset the offset(milli-second)
1450 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1453 tdm_vblank_get_offset(tdm_vblank *vblank, int *offset);
1456 * @brief Enable/Disable the fake vblank to a vblank object
1458 * If enable_fake == 0, #tdm_vblank_wait will return TDM_ERROR_DPMS_OFF
1459 * when DPMS off. Otherwise, #tdm_vblank_wait will return TDM_ERROR_NONE
1461 * @param[in] vblank A vblank object
1462 * @param[in] enable_fake 1:enable, 0:disable
1463 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1466 tdm_vblank_set_enable_fake(tdm_vblank *vblank, unsigned int enable_fake);
1469 * @brief Get the fake vblank
1470 * @param[in] vblank A vblank object
1471 * @param[out] enable_fake 1:enable, 0:disable
1472 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1475 tdm_vblank_get_enable_fake(tdm_vblank *vblank, unsigned int *enable_fake);
1478 * @brief Wait for a vblank
1480 * Once #tdm_vblank_wait returns TDM_ERROR_NONE, the user vblank handler(#tdm_vblank_handler)
1481 * SHOULD be called after the given interval. \n
1482 * The sequence value of tdm_vblank_handler is the relative value of fps.
1483 * If fps = 10, this sequence value should be increased by 10 during 1 second.
1484 * @param[in] vblank A vblank object
1485 * @param[in] req_sec The vblank request time(second)
1486 * @param[in] req_usec The vblank request time(micro-second)
1487 * @param[in] interval The vblank interval
1488 * @param[in] func The user vblank handler
1489 * @param[in] user_data The user data
1490 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1493 tdm_vblank_wait(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1494 unsigned int interval, tdm_vblank_handler func, void *user_data);
1497 * @brief Wait for a vblank with the target sequence number
1498 * @param[in] vblank A vblank object
1499 * @param[in] req_sec The vblank request time(second)
1500 * @param[in] req_usec The vblank request time(micro-second)
1501 * @param[in] sequence The target sequence number
1502 * @param[in] func The user client vblank handler
1503 * @param[in] user_data The user data
1504 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1507 tdm_vblank_wait_seq(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1508 unsigned int sequence, tdm_vblank_handler func, void *user_data);
1514 #endif /* _TDM_H_ */