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 * @return A TDM output object if success. Otherwise, NULL.
744 tdm_layer_get_output(tdm_layer *layer, tdm_error *error);
747 * @brief Get the capabilities of a layer object.
748 * @param[in] layer A layer object
749 * @param[out] capabilities The capabilities of a layer object
750 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
753 tdm_layer_get_capabilities(tdm_layer *layer,
754 tdm_layer_capability *capabilities);
757 * @brief Get the available format array of a layer object.
758 * @param[in] layer A layer object
759 * @param[out] formats The available format array
760 * @param[out] count The count of formats
761 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
764 tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats,
768 * @brief Get the available property array of a layer object.
769 * @param[in] layer A layer object
770 * @param[out] props The available property array
771 * @param[out] count The count of properties
772 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
775 tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props,
779 * @brief Get the zpos of a layer object.
781 * - GRAPHIC layers have fixed zpos. It starts from 0. It's @b non-changeable.
782 * - But the zpos of VIDEO layers will be decided by a backend module side.
783 * - A frontend user only can set the relative zpos to VIDEO layers via #tdm_layer_set_video_pos
784 * - The zpos of video layers is less than GRAPHIC layers or more than GRAPHIC
785 * layers. ie, ..., -2, -1, 4, 5, ... (if 0 <= GRAPHIC layer's zpos < 4).
786 * -------------------------------- graphic layer 3 <-- top most layer
787 * -------------------------------- graphic layer 2
788 * -------------------------------- graphic layer 1
789 * -------------------------------- graphic layer 0
790 * -------------------------------- video layer -1
791 * -------------------------------- video layer -2 <-- lowest layer
792 * @param[in] layer A layer object
793 * @param[out] zpos The zpos
794 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
795 * @see tdm_layer_set_video_pos, tdm_layer_capability
798 tdm_layer_get_zpos(tdm_layer *layer, int *zpos);
801 * @brief Set the property which has a given id.
802 * @param[in] layer A layer object
803 * @param[in] id The property id
804 * @param[in] value The value
805 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
808 tdm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
811 * @brief Get the property which has a given id.
812 * @param[in] layer A layer object
813 * @param[in] id The property id
814 * @param[out] value The value
815 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
818 tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
821 * @brief Set the geometry information to a layer object
822 * @details The geometry information will be applied when the output object
823 * of a layer object is committed. If a layer has TDM_LAYER_CAPABILITY_NO_CROP
824 * capability, a layer will ignore the pos(crop) information of #tdm_info_layer's
826 * @param[in] layer A layer object
827 * @param[in] info The geometry information
828 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
829 * @see tdm_layer_commit
832 tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info);
835 * @brief Get the geometry information to a layer object
836 * @param[in] layer A layer object
837 * @param[out] info The geometry information
838 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
841 tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info);
844 * @brief Set a TDM buffer to a layer object
845 * @details A TDM buffer will be applied when the output object
846 * of a layer object is committed.
847 * @param[in] layer A layer object
848 * @param[in] buffer A TDM buffer
849 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
850 * @see tdm_layer_commit
853 tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer);
856 * @brief Unset a TDM buffer from a layer object
857 * @details When this function is called, a current showing buffer will be
858 * disappeared from screen. Then nothing is showing on a layer object.
859 * @param[in] layer A layer object
860 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
863 tdm_layer_unset_buffer(tdm_layer *layer);
866 * @brief Commit changes for a layer object
867 * @details After all change of a layer object are applied, a user commit handler
869 * @param[in] layer A layer object
870 * @param[in] func A user commit handler
871 * @param[in] user_data The user data
872 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
875 tdm_layer_commit(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
878 tdm_layer_is_committing(tdm_layer *layer, unsigned int *committing);
881 * @brief Remove the user commit handler
882 * @param[in] layer A layer object
883 * @param[in] func A user commit handler
884 * @param[in] user_data The user data
885 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
888 tdm_layer_remove_commit_handler(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
891 * @brief Get a displaying TDM buffer from a layer object
892 * @details A displaying TDM buffer is a current showing buffer on screen
893 * that is set to layer object and applied output object of a layer object.
894 * @param[in] layer A layer object
895 * @return A TDM buffer if success. Otherwise, NULL.
898 tdm_layer_get_displaying_buffer(tdm_layer *layer, tdm_error *error);
901 * @brief Set a TBM surface_queue to a layer object
902 * @details A TBM surface_queue will be applied when the output object
903 * of a layer object is committed. and TDM layer will be automatically updated
904 * @param[in] layer A layer object
905 * @param[in] buffer_queue A TBM surface_queue
906 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
907 * @see tdm_layer_commit
910 tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue);
913 * @brief Unset a TBM surface_queue from a layer object
914 * @details When this function is called, a current surface_queue will be
915 * disappeared from screen. Then nothing is showing on a layer object.
916 * @param[in] layer A layer object
917 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
920 tdm_layer_unset_buffer_queue(tdm_layer *layer);
923 * @brief Check wheter a layer object is available for a frontend user to use.
924 * @details A layer object is not usable if a TDM buffer is showing on screen
925 * via this layer object. By calling #tdm_layer_unset_buffer, this layer object
926 * will become usable.
927 * @param[in] layer A layer object
928 * @param[out] usable 1 if usable, 0 if not usable
929 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
932 tdm_layer_is_usable(tdm_layer *layer, unsigned int *usable);
935 * @brief Set the relative zpos to a VIDEO layer object
936 * @details The zpos value is less than the minimum zpos of GRAPHIC layers, or
937 * it is more than the maximum zpos of GRAPHIC layers.
938 * @param[in] layer A VIDEO layer object
939 * @param[in] zpos The zpos
940 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
941 * @see tdm_layer_get_zpos, tdm_layer_capability
944 tdm_layer_set_video_pos(tdm_layer *layer, int zpos);
947 * @brief Create a capture object of a layer object
948 * @param[in] layer A layer object
949 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
950 * @return A capture object
951 * @see tdm_capture_destroy
954 tdm_layer_create_capture(tdm_layer *layer, tdm_error *error);
957 * @brief Get buffer flags from a layer object
958 * @param[in] layer A layer object
959 * @param[out] flags a buffer flags value
960 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
963 tdm_layer_get_buffer_flags(tdm_layer *layer, unsigned int *flags);
966 * @brief Get a buffer queue for the window object
967 * @details These buffers are used to composite by hardware a client content in
969 * @param[in] hwc_window A window object
970 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
971 * @return A tbm buffer queue
975 tdm_hwc_window_get_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error);
978 * @brief Sets the desired composition type of the given window.
979 * @details During tdm_output_hwc_validate(), the device may request changes to
980 * the composition types of any of the layers as described in the definition
981 * of tdm_hwc_window_composition_t above.
982 * @param[in] hwc_window A window object
983 * @param[in] composition_type The new composition type
984 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
988 tdm_hwc_window_set_composition_type(tdm_hwc_window *hwc_window,
989 tdm_hwc_window_composition composition_type);
992 * @brief Set the buffer damage
993 * @details Provides the region of the source buffer which has been modified
994 * since the last frame. This region does not need to be validated before
995 * calling tdm_output_commit().
996 * Once set through this function, the damage region remains the same until a
997 * subsequent call to this function.
998 * If damage.num_rects > 0, then it may be assumed that any portion of the source
999 * buffer not covered by one of the rects has not been modified this frame. If
1000 * damage.num_rects == 0, then the whole source buffer must be treated as if it
1001 * has been modified.
1002 * If the layer's contents are not modified relative to the prior frame, damage
1003 * will contain exactly one empty rect([0, 0, 0, 0]).
1004 * The damage rects are relative to the pre-transformed buffer, and their origin
1005 * is the top-left corner. They will not exceed the dimensions of the latched
1007 * @param[in] hwc_window A window object
1008 * @param[in] damage The new buffer damage region
1009 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1013 tdm_hwc_window_set_buffer_damage(tdm_hwc_window *hwc_window, tdm_hwc_region damage);
1016 * @brief Set the information to a window object
1017 * @details The information will be applied when the output object of a window
1018 * object is committed.
1019 * @param[in] hwc_window A window object
1020 * @param[in] info The information
1021 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1025 tdm_hwc_window_set_info(tdm_hwc_window *hwc_window, tdm_hwc_window_info *info);
1028 * @brief Set a TBM buffer to a window object
1029 * @details A TBM buffer will be applied when the output object of a layer
1030 * object is committed.
1031 * @param[in] hwc_window A window object
1032 * @param[in] buffer A TDM buffer
1033 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1034 * @return #TDM_ERROR_BUSY if #hwc_window can't be updated right now, this
1035 * can happen if #hwc_window is involved in the smooth transition from
1036 * DEVICE to CLIENT, this shouldn't be interpreted like some critical error.
1040 tdm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer);
1043 * @brief Unset a TBM buffer to a window object
1044 * @details A TBM buffer will be applied when the output object of a layer
1045 * object is committed.
1046 * @param[in] hwc_window A window object
1047 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1048 * @return #TDM_ERROR_BUSY if #hwc_window can't be updated right now, this
1049 * can happen if #hwc_window is involved in the smooth transition from
1050 * DEVICE to CLIENT, this shouldn't be interpreted like some critical error.
1054 tdm_hwc_window_unset_buffer(tdm_hwc_window *hwc_window);
1057 * @brief Set a flags to a window object
1058 * @param[in] hwc_window A window object
1059 * @param[in] flags A hwc_window flags
1060 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1064 tdm_hwc_window_set_flags(tdm_hwc_window *hwc_window, tdm_hwc_window_flag flags);
1067 * @brief Unset a flags from a window object
1068 * @param[in] hwc_window A window object
1069 * @param[in] flags A hwc_window flags
1070 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1074 tdm_hwc_window_unset_flags(tdm_hwc_window *hwc_window, tdm_hwc_window_flag flags);
1077 * @brief Commit changes for a window object
1078 * @details After all change of a window object are applied, a user commit handler
1080 * @param[in] hwc_window A window object
1081 * @param[in] func A user commit handler
1082 * @param[in] user_data The user data
1083 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1086 tdm_hwc_window_commit(tdm_hwc_window *hwc_window, tdm_hwc_window_commit_handler func, void *user_data);
1089 * @brief Get the available property array of a video hwc window object.
1090 * @param[in] hwc window A video hwc window object
1091 * @param[out] props The available property array
1092 * @param[out] count The count of properties
1093 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1096 tdm_hwc_window_video_get_available_properties(tdm_hwc_window *hwc_window,
1097 const tdm_prop **props, int *count);
1100 * @brief Get the property which has a given id.
1101 * @param[in] hwc window A video hwc window object
1102 * @param[in] id The property id
1103 * @param[out] value The value
1104 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1107 tdm_hwc_window_video_get_property(tdm_hwc_window *hwc_window, uint32_t id,
1111 * @brief Set the property which has a given id.
1112 * @param[in] hwc window A video hwc window object
1113 * @param[in] id The property id
1114 * @param[in] value The value
1115 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1118 tdm_hwc_window_video_set_property(tdm_hwc_window *hwc_window, uint32_t id,
1122 * @brief Get the window video capability
1123 * @param[in] hwc_window A window object
1124 * @param[out] video_capability A hwc window video capability
1125 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1129 tdm_hwc_window_video_get_capability(tdm_hwc_window *hwc_window,
1130 tdm_hwc_window_video_capability *video_capability);
1133 * @brief Destroy a pp object
1134 * @param[in] pp A pp object
1135 * @see tdm_display_create_pp
1138 tdm_pp_destroy(tdm_pp *pp);
1141 * @brief Set the geometry information to a pp object
1142 * @param[in] pp A pp object
1143 * @param[in] info The geometry information
1144 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1145 * @see tdm_pp_commit
1148 tdm_pp_set_info(tdm_pp *pp, tdm_info_pp *info);
1151 * @brief Set the PP done handler to a pp object
1153 * The user PP done handler will be called after converting a source buffer's image
1154 * to a destination buffer.
1155 * @param[in] pp A pp object
1156 * @param[in] func A user PP done handler
1157 * @param[in] user_data The user data
1158 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1161 tdm_pp_set_done_handler(tdm_pp *pp, tdm_pp_done_handler func, void *user_data);
1164 * @brief Attach a source buffer and a destination buffer to a pp object
1165 * @param[in] pp A pp object
1166 * @param[in] src A source buffer
1167 * @param[in] dst A destination buffer
1168 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1169 * @see tdm_pp_commit, tdm_pp_set_done_handler
1172 tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
1175 * @brief Commit changes for a pp object
1176 * @param[in] pp A pp object
1177 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1180 tdm_pp_commit(tdm_pp *pp);
1183 * @brief Destroy a capture object
1184 * @param[in] capture A capture object
1185 * @see tdm_output_create_capture, tdm_layer_create_capture
1188 tdm_capture_destroy(tdm_capture *capture);
1191 * @brief Set the geometry information to a capture object
1192 * @param[in] capture A capture object
1193 * @param[in] info The geometry information
1194 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1195 * @see tdm_capture_commit
1198 tdm_capture_set_info(tdm_capture *capture, tdm_info_capture *info);
1201 * @brief Set the capture done handler to a capture object
1203 * The user capture done handler will be called after capturing a screen into a
1205 * @param[in] capture A capture object
1206 * @param[in] func A user capture done handler
1207 * @param[in] user_data The user data
1208 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1211 tdm_capture_set_done_handler(tdm_capture *capture, tdm_capture_done_handler func, void *user_data);
1214 * @brief Attach a TDM buffer to a capture object
1215 * @param[in] capture A capture object
1216 * @param[in] buffer A TDM buffer
1217 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1218 * @see tdm_capture_commit, tdm_capture_set_done_handler
1221 tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer);
1224 * @brief Commit changes for a capture object
1225 * @param[in] capture A capture object
1226 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1229 tdm_capture_commit(tdm_capture *capture);
1232 * @brief The release handler of a TDM buffer
1233 * @param[in] buffer A TDM buffer
1234 * @param[in] user_data user data
1235 * @see tdm_buffer_add_release_handler, tdm_buffer_remove_release_handler
1237 typedef void (*tdm_buffer_release_handler)(tbm_surface_h buffer,
1241 * @brief Add a release handler to a TDM buffer
1243 * TDM has its own buffer release mechanism to let an frontend user know when a TDM buffer
1244 * becomes available for a next job. A TDM buffer can be used for TDM to show
1245 * it on screen or to capture an output and a layer. After all operations,
1246 * TDM will release it immediately when TDM doesn't need it any more.
1247 * @param[in] buffer A TDM buffer
1248 * @param[in] func A release handler
1249 * @param[in] user_data user data
1250 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1251 * @see tdm_buffer_remove_release_handler
1254 tdm_buffer_add_release_handler(tbm_surface_h buffer,
1255 tdm_buffer_release_handler func, void *user_data);
1258 * @brief Remove a release handler from a TDM buffer
1259 * @param[in] buffer A TDM buffer
1260 * @param[in] func A release handler
1261 * @param[in] user_data user data
1262 * @see tdm_buffer_add_release_handler
1265 tdm_buffer_remove_release_handler(tbm_surface_h buffer,
1266 tdm_buffer_release_handler func, void *user_data);
1269 * @brief The handler of a vblank object
1270 * @see #tdm_vblank_wait, #tdm_vblank_wait_seq
1272 typedef void (*tdm_vblank_handler)(tdm_vblank *vblank, tdm_error error, unsigned int sequence,
1273 unsigned int tv_sec, unsigned int tv_usec, void *user_data);
1276 * @brief Set the vblank fps for the given PID and name.
1277 * @param[in] pid The process ID
1278 * @param[in] name The client vblank name
1279 * @param[in] fps The client vblank fps
1280 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1283 tdm_vblank_set_client_vblank_fps(unsigned int pid, const char *name, unsigned int fps);
1286 * @brief Set the ignore global fps for the given PID and name.
1287 * @param[in] pid The process ID
1288 * @param[in] name The client vblank name
1289 * @param[in] ignore 1: ignore 0:not ignore(default)
1290 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1293 tdm_vblank_set_client_ignore_global_fps(unsigned int pid, const char *name, unsigned int ignore);
1296 * @brief Set the vblank global fps for the entire system.
1297 * @param[in] enable 1:enable, 0:disable
1298 * @param[in] fps The vblank global fps
1300 * This global fps will be applied to all client's vblanks for all outputs.
1301 * If the client's vblank fps is less than this, the global fps will be ignored
1302 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1303 * the global fps, it will be ignored also.
1304 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1307 tdm_vblank_enable_global_fps(unsigned int enable, unsigned int fps);
1310 * @brief Add the vblank create handler.
1311 * @param[in] dpy A display object
1312 * @param[in] func The user vblank create handler
1313 * @param[in] user_data The user data
1315 * The user vblank create handler will be called when new vblank object created.
1316 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1319 tdm_vblank_add_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1322 * @brief Remove the vblank create handler.
1323 * @param[in] dpy A display object
1324 * @param[in] func The user vblank create handler
1325 * @param[in] user_data The user data
1326 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1329 tdm_vblank_remove_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1332 * @brief Create a vblank object
1333 * @param[in] dpy A display object
1334 * @param[in] output A output object
1335 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1336 * @return A vblank object
1337 * @see #tdm_vblank_destroy
1340 tdm_vblank_create(tdm_display *dpy, tdm_output *output, tdm_error *error);
1343 * @brief Destroy a vblank object
1344 * @param[in] vblank A vblank object
1345 * @see #tdm_vblank_create
1348 tdm_vblank_destroy(tdm_vblank *vblank);
1351 * @brief Get the client PID for a vblank object
1352 * @param[in] vblank A vblank object
1353 * @param[out] pid PID of vblank's client
1354 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1357 tdm_vblank_get_client_pid(tdm_vblank *vblank, pid_t *pid);
1360 * @brief Set the name to a vblank object
1361 * @details The default name is "unknown"
1362 * @param[in] vblank A vblank object
1363 * @param[in] name vblank name
1364 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1367 tdm_vblank_set_name(tdm_vblank *vblank, const char *name);
1370 * @brief Get the name for a vblank object
1371 * @details The default name is "unknown"
1372 * @param[in] vblank A vblank object
1373 * @param[out] name vblank name
1374 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1377 tdm_vblank_get_name(tdm_vblank *vblank, const char **name);
1380 * @brief Set the fps to a vblank object
1381 * @details Default is the @b vertical @b refresh @b rate of the given output.
1382 * It could be ignored when the fixed fps is set by #tdm_vblank_set_fixed_fps
1383 * @param[in] vblank A vblank object
1384 * @param[in] fps over 0
1385 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1388 tdm_vblank_set_fps(tdm_vblank *vblank, unsigned int fps);
1391 * @brief Get the fps for a vblank object
1392 * @param[in] vblank A vblank object
1393 * @param[out] fps over 0
1394 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1397 tdm_vblank_get_fps(tdm_vblank *vblank, unsigned int *fps);
1400 * @brief Set the fixed fps to a vblank object
1402 * It could be ignored when the global fps is set by #tdm_vblank_enable_global_fps
1403 * @param[in] vblank A vblank object
1404 * @param[in] fps over 0
1405 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1408 tdm_vblank_set_fixed_fps(tdm_vblank *vblank, unsigned int fps);
1411 * @brief Ignore the vblank global fps
1413 * The global fps will be applied to all client's vblanks for all outputs.
1414 * If the client's vblank fps is less than this, the global fps will be ignored
1415 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1416 * the global fps, it will be ignored also.
1417 * @param[in] vblank A vblank object
1418 * @param[in] ignore 1: ignore 0:not ignore(default)
1419 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1422 tdm_vblank_ignore_global_fps(tdm_vblank *vblank, unsigned int ignore);
1425 * @brief Set the offset(milli-second) to a vblank object
1426 * @details Default is @b 0.
1427 * @param[in] vblank A vblank object
1428 * @param[in] offset the offset(milli-second)
1429 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1432 tdm_vblank_set_offset(tdm_vblank *vblank, int offset);
1435 * @brief Get the offset(milli-second) for a vblank object
1436 * @param[in] vblank A vblank object
1437 * @param[out] offset the offset(milli-second)
1438 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1441 tdm_vblank_get_offset(tdm_vblank *vblank, int *offset);
1444 * @brief Enable/Disable the fake vblank to a vblank object
1446 * If enable_fake == 0, #tdm_vblank_wait will return TDM_ERROR_DPMS_OFF
1447 * when DPMS off. Otherwise, #tdm_vblank_wait will return TDM_ERROR_NONE
1449 * @param[in] vblank A vblank object
1450 * @param[in] enable_fake 1:enable, 0:disable
1451 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1454 tdm_vblank_set_enable_fake(tdm_vblank *vblank, unsigned int enable_fake);
1457 * @brief Get the fake vblank
1458 * @param[in] vblank A vblank object
1459 * @param[out] enable_fake 1:enable, 0:disable
1460 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1463 tdm_vblank_get_enable_fake(tdm_vblank *vblank, unsigned int *enable_fake);
1466 * @brief Wait for a vblank
1468 * Once #tdm_vblank_wait returns TDM_ERROR_NONE, the user vblank handler(#tdm_vblank_handler)
1469 * SHOULD be called after the given interval. \n
1470 * The sequence value of tdm_vblank_handler is the relative value of fps.
1471 * If fps = 10, this sequence value should be increased by 10 during 1 second.
1472 * @param[in] vblank A vblank object
1473 * @param[in] req_sec The vblank request time(second)
1474 * @param[in] req_usec The vblank request time(micro-second)
1475 * @param[in] interval The vblank interval
1476 * @param[in] func The user vblank handler
1477 * @param[in] user_data The user data
1478 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1481 tdm_vblank_wait(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1482 unsigned int interval, tdm_vblank_handler func, void *user_data);
1485 * @brief Wait for a vblank with the target sequence number
1486 * @param[in] vblank A vblank object
1487 * @param[in] req_sec The vblank request time(second)
1488 * @param[in] req_usec The vblank request time(micro-second)
1489 * @param[in] sequence The target sequence number
1490 * @param[in] func The user client vblank handler
1491 * @param[in] user_data The user data
1492 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1495 tdm_vblank_wait_seq(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1496 unsigned int sequence, tdm_vblank_handler func, void *user_data);
1502 #endif /* _TDM_H_ */