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"
53 * @brief The header file for a frontend user.
56 * #include <tdm.h> //for a frontend user
61 * @brief Initialize a display object
62 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
63 * @return A display object
64 * @see tdm_display_deinit
67 tdm_display_init(tdm_error *error);
70 * @brief Deinitialize a display object
71 * @param[in] dpy A display object
72 * @see tdm_display_init
75 tdm_display_deinit(tdm_display *dpy);
78 * @brief Update a display object
80 * When new output is connected, a frontend user need to call this function.
81 * And a frontend user can the new output information with tdm_output_get_xxx functions.
82 * @param[in] dpy A display object
83 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
86 tdm_display_update(tdm_display *dpy);
89 * @brief Get the file descriptor
90 * @details TDM handles the events of fd with #tdm_display_handle_events.
91 * @param[in] dpy A display object
92 * @param[out] fd The file descriptor
93 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
94 * @see tdm_display_handle_events
97 tdm_display_get_fd(tdm_display *dpy, int *fd);
100 * @brief Handle the events
101 * @param[in] dpy A display object
102 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
103 * @see tdm_display_get_fd
106 tdm_display_handle_events(tdm_display *dpy);
109 * @brief Get the information of the TDM backend module.
110 * @param[in] dpy A display object
111 * @param[out] name The name of the TDM backend module
112 * @param[out] vendor The vendor of the TDM backend module
113 * @param[out] version The version of the TDM backend module
114 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
117 tdm_display_get_backend_info(tdm_display *dpy, const char **name,
118 const char **vendor, int *major, int *minor);
121 * @brief Get the capabilities of a display object.
122 * @details A frontend user can get whether TDM supports pp/capture functionality with this function.
123 * @param[in] dpy A display object
124 * @param[out] capabilities The capabilities of a display object
125 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
128 tdm_display_get_capabilities(tdm_display *dpy,
129 tdm_display_capability *capabilities);
132 * @brief Get the pp capabilities of a display object.
133 * @param[in] dpy A display object
134 * @param[out] capabilities The pp capabilities
135 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
138 tdm_display_get_pp_capabilities(tdm_display *dpy,
139 tdm_pp_capability *capabilities);
142 * @brief Get the pp available format array of a display object.
143 * @param[in] dpy A display object
144 * @param[out] formats The pp available format array
145 * @param[out] count The count of formats
146 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
149 tdm_display_get_pp_available_formats(tdm_display *dpy,
150 const tbm_format **formats, int *count);
153 * @brief Get the pp available size of a display object.
154 * @details -1 means that a TDM backend module doesn't define the value.
155 * @param[in] dpy A display object
156 * @param[out] min_w The minimum width which TDM can handle
157 * @param[out] min_h The minimum height which TDM can handle
158 * @param[out] max_w The maximum width which TDM can handle
159 * @param[out] max_h The maximum height which TDM can handle
160 * @param[out] preferred_align The preferred align width which TDM can handle
161 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
164 tdm_display_get_pp_available_size(tdm_display *dpy, int *min_w, int *min_h,
165 int *max_w, int *max_h, int *preferred_align);
168 * @brief Get the capture capabilities of a display object.
169 * @param[in] dpy A display object
170 * @param[out] capabilities The capture capabilities
171 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
174 tdm_display_get_capture_capabilities(tdm_display *dpy,
175 tdm_capture_capability *capabilities);
178 * @brief Get the capture available format array of a display object.
179 * @param[in] dpy A display object
180 * @param[out] formats The capture available format array
181 * @param[out] count The count of formats
182 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
185 tdm_display_get_capture_available_formats(tdm_display *dpy,
186 const tbm_format **formats, int *count);
189 * @brief Get the capture available size of a display object.
190 * @details -1 means that a TDM backend module doesn't define the value.
191 * @param[in] dpy A display object
192 * @param[out] min_w The minimum width which TDM can handle
193 * @param[out] min_h The minimum height which TDM can handle
194 * @param[out] max_w The maximum width which TDM can handle
195 * @param[out] max_h The maximum height which TDM can handle
196 * @param[out] preferred_align The preferred align width which TDM can handle
197 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
200 tdm_display_get_capture_available_size(tdm_display *dpy, int *min_w, int *min_h,
201 int *max_w, int *max_h, int *preferred_align);
204 * @brief Get the max layer counts which a display object can show on screen.
205 * @details -1 means that a TDM backend module doesn't define the value.
206 * @param[in] dpy A display object
207 * @param[out] count The max count of layers
208 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
211 tdm_display_get_max_layer_count(tdm_display *dpy, int *max_count);
214 * @brief Get the output counts which a display object has.
215 * @param[in] dpy A display object
216 * @param[out] count The count of outputs
217 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
218 * @see tdm_display_get_output
221 tdm_display_get_output_count(tdm_display *dpy, int *count);
224 * @brief Get a output object which has the given index.
225 * @param[in] dpy A display object
226 * @param[in] index The index of a output object
227 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
228 * @return A output object if success. Otherwise, NULL.
229 * @see tdm_display_get_output_count
232 tdm_display_get_output(tdm_display *dpy, int index, tdm_error *error);
235 * @brief Create a pp object.
236 * @param[in] dpy A display object
237 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
238 * @return A pp object if success. Otherwise, NULL.
239 * @see tdm_pp_destroy
242 tdm_display_create_pp(tdm_display *dpy, tdm_error *error);
245 * @brief Get the capabilities of a output object.
246 * @param[in] output A output object
247 * @param[out] capabilities The capabilities of a output object
248 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
251 tdm_output_get_capabilities(tdm_output *output,
252 tdm_output_capability *capabilities);
255 * @brief Get the model information of a output object.
256 * @param[in] output A output object
257 * @param[out] maker The output maker.
258 * @param[out] model The output model.
259 * @param[out] name The output name.
260 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
263 tdm_output_get_model_info(tdm_output *output, const char **maker,
264 const char **model, const char **name);
267 * @brief Get the connection status of a output object.
268 * @param[in] output A output object
269 * @param[out] status The connection status.
270 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
273 tdm_output_get_conn_status(tdm_output *output, tdm_output_conn_status *status);
276 * @brief Add a output change handler
277 * @details The handler will be called when the status of a
278 * output object is changed. connection, DPMS, etc.
279 * @param[in] output A output object
280 * @param[in] func A output change handler
281 * @param[in] user_data The user data
282 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
285 tdm_output_add_change_handler(tdm_output *output,
286 tdm_output_change_handler func,
290 * @brief Remove a output change handler
291 * @param[in] output A output object
292 * @param[in] func A output change handler
293 * @param[in] user_data The user data
294 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
297 tdm_output_remove_change_handler(tdm_output *output,
298 tdm_output_change_handler func,
302 * @brief Get the connection type of a output object.
303 * @param[in] output A output object
304 * @param[out] type The connection type.
305 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
308 tdm_output_get_output_type(tdm_output *output, tdm_output_type *type);
311 * @brief Get the layer counts which a output object has.
312 * @param[in] output A output object
313 * @param[out] count The count of layers
314 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
315 * @see tdm_output_get_layer
318 tdm_output_get_layer_count(tdm_output *output, int *count);
321 * @brief Get a layer object which has the given index.
322 * @param[in] output A output object
323 * @param[in] index The index of a layer object
324 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
325 * @return A layer object if success. Otherwise, NULL.
326 * @see tdm_output_get_layer_count
329 tdm_output_get_layer(tdm_output *output, int index, tdm_error *error);
332 * @brief Get the available property array of a output object.
333 * @param[in] output A output object
334 * @param[out] props The available property array
335 * @param[out] count The count of properties
336 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
339 tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props,
343 * @brief Get the available mode array of a output object.
344 * @param[in] output A output object
345 * @param[out] modes The available mode array
346 * @param[out] count The count of modes
347 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
350 tdm_output_get_available_modes(tdm_output *output,
351 const tdm_output_mode **modes, int *count);
354 * @brief Get the available size of a output object.
355 * @details -1 means that a TDM backend module doesn't define the value.
356 * @param[in] output A output object
357 * @param[out] min_w The minimum width which TDM can handle
358 * @param[out] min_h The minimum height which TDM can handle
359 * @param[out] max_w The maximum width which TDM can handle
360 * @param[out] max_h The maximum height which TDM can handle
361 * @param[out] preferred_align The preferred align width which TDM can handle
362 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
365 tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h,
366 int *max_w, int *max_h, int *preferred_align);
369 * @brief Get the available cursor size of a output object.
370 * @details -1 means that a TDM backend module doesn't define the value.
371 * @param[in] output A output object
372 * @param[out] min_w The minimum width which TDM can handle
373 * @param[out] min_h The minimum height which TDM can handle
374 * @param[out] max_w The maximum width which TDM can handle
375 * @param[out] max_h The maximum height which TDM can handle
376 * @param[out] preferred_align The preferred align width which TDM can handle
377 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
380 tdm_output_get_cursor_available_size(tdm_output *output, int *min_w, int *min_h,
381 int *max_w, int *max_h, int *preferred_align);
384 * @brief Get the physical size of a output object.
385 * @param[in] output A output object
386 * @param[out] mmWidth The milimeter width
387 * @param[out] mmHeight The milimeter height
388 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
391 tdm_output_get_physical_size(tdm_output *output, unsigned int *mmWidth,
392 unsigned int *mmHeight);
395 * @brief Get the subpixel of a output object.
396 * @param[in] output A output object
397 * @param[out] subpixel The subpixel
398 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
401 tdm_output_get_subpixel(tdm_output *output, unsigned int *subpixel);
404 * @brief Get the pipe of a output object.
405 * @param[in] output A output object
406 * @param[out] pipe The pipe
407 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
410 tdm_output_get_pipe(tdm_output *output, unsigned int *pipe);
413 * @brief Get the index of a primary layer.
414 * @param[in] output A output object
415 * @param[out] index The primary layer index
416 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
419 tdm_output_get_primary_index(tdm_output *output, int *index);
422 * @brief Set the property which has a given id.
423 * @param[in] output A output object
424 * @param[in] id The property id
425 * @param[in] value The value
426 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
429 tdm_output_set_property(tdm_output *output, unsigned int id, tdm_value value);
432 * @brief Get the property which has a given id
433 * @param[in] output A output object
434 * @param[in] id The property id
435 * @param[out] value The value
436 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
439 tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value);
442 * @brief Wait for VBLANK
443 * @details After interval vblanks, a user vblank handler will be called.
444 * @param[in] output A output object
445 * @param[in] interval vblank interval
446 * @param[in] sync 0: asynchronous, 1:synchronous
447 * @param[in] func A user vblank handler
448 * @param[in] user_data The user data
449 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
450 * @see #tdm_output_vblank_handler
453 tdm_output_wait_vblank(tdm_output *output, int interval, int sync,
454 tdm_output_vblank_handler func, void *user_data);
457 * @brief Commit changes for a output object
458 * @details After all change of a output object are applied, a user commit handler
460 * @param[in] output A output object
461 * @param[in] sync 0: asynchronous, 1:synchronous
462 * @param[in] func A user commit handler
463 * @param[in] user_data The user data
464 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
465 * @see #tdm_layer_commit
468 tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func,
472 * @brief Remove the user vblank handler
473 * @param[in] output A output object
474 * @param[in] func A user vblank handler
475 * @param[in] user_data The user data
476 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
479 tdm_output_remove_vblank_handler(tdm_output *output, tdm_output_vblank_handler func, void *user_data);
482 * @brief Remove the user commit handler
483 * @param[in] output A output object
484 * @param[in] func A user commit handler
485 * @param[in] user_data The user data
486 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
489 tdm_output_remove_commit_handler(tdm_output *output, tdm_output_commit_handler func, void *user_data);
492 * @brief Set one of available modes of a output object
493 * @param[in] output A output object
494 * @param[in] mode A output mode
495 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
498 tdm_output_set_mode(tdm_output *output, const tdm_output_mode *mode);
501 * @brief Get the mode of a output object
502 * @param[in] output A output object
503 * @param[out] mode A output mode
504 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
507 tdm_output_get_mode(tdm_output *output, const tdm_output_mode **mode);
510 * @brief Set DPMS of a output object synchronously
511 * @param[in] output A output object
512 * @param[in] dpms_value DPMS value
513 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
514 * @see tdm_output_set_dpms_async
517 tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value);
520 * @brief Set DPMS of a output object asynchronously
521 * @details This function can be used when a output supports the asynchronous DPMS
522 * control. The output has #TDM_OUTPUT_CAPABILITY_ASYNC_DPMS flags which
523 * #tdm_output_get_capabilities returns. If an output change handler is added with
524 * #tdm_output_add_change_handler, the output change handler will be called when
525 * the DPMS status is changed indeed.
526 * @param[in] output A output object
527 * @param[in] dpms_value DPMS value
528 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
529 * @see tdm_output_add_change_handler, tdm_output_set_dpms,
530 * tdm_output_get_capabilities, #TDM_OUTPUT_CAPABILITY_ASYNC_DPMS.
533 tdm_output_set_dpms_async(tdm_output *output, tdm_output_dpms dpms_value);
536 * @brief Get DPMS of a output object
537 * @param[in] output A output object
538 * @param[out] dpms_value DPMS value
539 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
542 tdm_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value);
545 * @brief Create a capture object of a output object
546 * @param[in] output A output object
547 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
548 * @return A capture object
549 * @see tdm_capture_destroy
552 tdm_output_create_capture(tdm_output *output, tdm_error *error);
555 * @brief Creates a new window on the given display.
556 * @param[in] output A output object
557 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
558 * @return A created window object
562 tdm_output_hwc_create_window(tdm_output *output, tdm_error *error);
565 * @brief Creates a new video window on the given output.
566 * @param[in] output A output object
567 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
568 * @return A created window object
572 tdm_output_hwc_create_video_window(tdm_output *output, tdm_error *error);
575 * @brief Destroys the given window.
576 * @param[in] output A output object
577 * @param[in] window the pointer of the window to destroy
578 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
582 tdm_output_hwc_destroy_window(tdm_output *output, tdm_hwc_window *hwc_window);
585 * @brief Set the client(relative to the TDM) target buffer
586 * @details Sets the buffer which will receive the output of client composition.
587 * Window marked as TDM_COMPOSITION_CLIENT or TDM_COMPOSITION_DEVICE_CANDIDATE
588 * will be composited into this buffer prior to the call to tdm_output_commit(),
589 * and windows not marked as TDM_COMPOSITION_CLIENT and
590 * TDM_COMPOSITION_DEVICE_CANDIDATE should be composited with this buffer by the
593 * The buffer handle provided may be null if no windows are being composited by
594 * the client. This must not result in an error (unless an invalid display
595 * handle is also provided).
597 * The damage parameter describes a buffer damage region as defined in the
598 * description of tdm_hwc_window_set_buffer_damage().
600 * List of composited hwc_windows (hwc_windows which buffers are presented on #target_buffer)
601 * should be passed along with #target_buffer to allow tdm to make the smooth transition
602 * from a DEVICE type to a CLIENT type.
604 * Should be called before tdm_output_commit() if any of the layers are marked as
605 * TDM_COMPOSITION_CLIENT or TDM_COMPOSITION_DEVICE_CANDIDATE. If no layers are
606 * so marked, then it is not necessary to call this function. It is not necessary
607 * to call tdm_output_hwc_validate() after changing the target through this function.
608 * @param[in] output A output object
609 * @param[in] target_buffer The new target buffer
610 * @param[in] damage The buffer damage region
611 * @param[in] composited_wnds The array of composited hwc_wnds
612 * @param[in] num_wnds The size of #composited_wnds array
613 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
617 tdm_output_hwc_set_client_target_buffer(tdm_output *output, tbm_surface_h target_buffer, tdm_hwc_region damage);
620 * @brief Unset the client(relative to the TDM) target buffer
622 * @param[in] output A output object
623 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
627 tdm_output_hwc_unset_client_target_buffer(tdm_output *output);
630 * @brief Commit changes for a target_window
631 * @details After all change of a window object are applied, a user commit handler
633 * @param[in] hwc_window A window object
634 * @param[in] func A user commit handler
635 * @param[in] user_data The user data
636 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
639 tdm_output_hwc_commit_client_target_buffer(tdm_output *output, tdm_output_hwc_target_buffer_commit_handler func, void *user_data);
642 * @brief Validate the output
643 * @details Instructs the device to inspect all of the layer state and
644 * determine if there are any composition type changes necessary before
645 * presenting the output. Permitted changes are described in the definition
646 * of tdm_hwc_window_composition_t above.
647 * @param[in] output A output object
648 * @param[out] num_types The number of composition type changes required by
649 * the device; if greater than 0, the client must either set and validate new
650 * types, or call tdm_output_hwc_accept_changes() to accept the changes returned by
651 * tdm_output_hwc_get_changed_composition_types(); must be the same as the number of
652 * changes returned by tdm_output_hwc_get_changed_composition_types (see the
653 * declaration of that function for more information); pointer will be non-NULL
654 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
658 tdm_output_hwc_validate(tdm_output *output, tdm_hwc_window **composited_wnds, uint32_t num_wnds,
659 uint32_t *num_types);
662 * @brief Set the 'need to validate' handler for the 'output'
664 * @details During backend's work it may need to ask for the revalidation
665 * (make client (E20) do tdm_output_hwc_validate() again), so a 'hndl' will
666 * be called as such need happen. Only one handler per output is supported.
668 * @param[in] output The output object a hndl is going to be registered for.
669 * @param[in] hndl The handler which will be called on the 'need to validate' event.
671 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
675 tdm_output_hwc_set_need_validate_handler(tdm_output *output,
676 tdm_output_need_validate_handler hndl);
679 * @brief Get changed composition types
680 * @details Retrieves the windows for which the device requires a different
681 * composition type than had been set prior to the last call to tdm_output_hwc_validate().
682 * The client will either update its state with these types and call
683 * tdm_output_hwc_accept_changes, or will set new types and attempt to validate the
685 * windows and types may be NULL to retrieve the number of elements which
686 * will be returned. The number of elements returned must be the same as the
687 * value returned in num_types from the last call to tdm_output_hwc_validate().
688 * @param[in] output A output object
689 * @param[out] num_elements If windows or types were NULL, the number of layers
690 * and types which would have been returned; if both were non-NULL, the
691 * number of elements returned in layers and types, which must not exceed
692 * the value stored in num_elements prior to the call; pointer will be
694 * @param[in] output A output object
695 * @param[out] windows An array of windows
696 * @param[out] composition_types An array of composition types, each corresponding
697 * to an element of windows
698 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
702 tdm_output_hwc_get_changed_composition_types(tdm_output *output,uint32_t *num_elements,
703 tdm_hwc_window **hwc_window,
704 tdm_hwc_window_composition *composition_types);
707 * @brief Accepts the changes required by the device
708 * @details Accepts the changes required by the device from the previous
709 * tdm_output_hwc_validate() call (which may be queried using
710 * tdm_output_get_chaged_composition_types()) and revalidates the display. This
711 * function is equivalent to requesting the changed types from
712 * tdm_output_get_chaged_composition_types(), setting those types on the
713 * corresponding windows, and then calling tdm_output_hwc_validate again.
714 * After this call it must be valid to present this display. Calling this after
715 * tdm_output_hwc_validate() returns 0 changes must succeed with TDM_ERROR_NONE, but
716 * should have no other effect.
717 * @param[in] output A output object
718 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
722 tdm_output_hwc_accept_changes(tdm_output *output);
725 * @brief Get a target buffer queue
726 * @details Buffers from target buffer queue will receive the output of
727 * client composition. Window marked as TDM_COMPOSITION_CLIENT or
728 * TDM_COMPOSITION_DEVICE_CANDIDATE will be composited into this buffers
729 * prior to the call to tdm_output_commit().
730 * @param[in] output A output object
731 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
732 * @return A buffer queue
736 tdm_output_hwc_get_target_buffer_queue(tdm_output *output, tdm_error *error);
739 * @brief Get the supported format array for video hwc windows of a output object.
740 * @param[in] output A output object
741 * @param[out] formats The available format array
742 * @param[out] count The count of formats
743 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
746 tdm_output_hwc_get_video_supported_formats(tdm_layer *layer, const tbm_format **formats,
750 * @brief Get a output object of a layer object
751 * @param[in] layer A layer object
752 * @return A TDM output object if success. Otherwise, NULL.
755 tdm_layer_get_output(tdm_layer *layer, tdm_error *error);
758 * @brief Get the capabilities of a layer object.
759 * @param[in] layer A layer object
760 * @param[out] capabilities The capabilities of a layer object
761 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
764 tdm_layer_get_capabilities(tdm_layer *layer,
765 tdm_layer_capability *capabilities);
768 * @brief Get the available format array of a layer object.
769 * @param[in] layer A layer object
770 * @param[out] formats The available format array
771 * @param[out] count The count of formats
772 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
775 tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats,
779 * @brief Get the available property array of a layer object.
780 * @param[in] layer A layer object
781 * @param[out] props The available property array
782 * @param[out] count The count of properties
783 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
786 tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props,
790 * @brief Get the zpos of a layer object.
792 * - GRAPHIC layers have fixed zpos. It starts from 0. It's @b non-changeable.
793 * - But the zpos of VIDEO layers will be decided by a backend module side.
794 * - A frontend user only can set the relative zpos to VIDEO layers via #tdm_layer_set_video_pos
795 * - The zpos of video layers is less than GRAPHIC layers or more than GRAPHIC
796 * layers. ie, ..., -2, -1, 4, 5, ... (if 0 <= GRAPHIC layer's zpos < 4).
797 * -------------------------------- graphic layer 3 <-- top most layer
798 * -------------------------------- graphic layer 2
799 * -------------------------------- graphic layer 1
800 * -------------------------------- graphic layer 0
801 * -------------------------------- video layer -1
802 * -------------------------------- video layer -2 <-- lowest layer
803 * @param[in] layer A layer object
804 * @param[out] zpos The zpos
805 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
806 * @see tdm_layer_set_video_pos, tdm_layer_capability
809 tdm_layer_get_zpos(tdm_layer *layer, int *zpos);
812 * @brief Set the property which has a given id.
813 * @param[in] layer A layer object
814 * @param[in] id The property id
815 * @param[in] value The value
816 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
819 tdm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
822 * @brief Get the property which has a given id.
823 * @param[in] layer A layer object
824 * @param[in] id The property id
825 * @param[out] value The value
826 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
829 tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
832 * @brief Set the geometry information to a layer object
833 * @details The geometry information will be applied when the output object
834 * of a layer object is committed. If a layer has TDM_LAYER_CAPABILITY_NO_CROP
835 * capability, a layer will ignore the pos(crop) information of #tdm_info_layer's
837 * @param[in] layer A layer object
838 * @param[in] info The geometry information
839 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
840 * @see tdm_layer_commit
843 tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info);
846 * @brief Get the geometry information to a layer object
847 * @param[in] layer A layer object
848 * @param[out] info The geometry information
849 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
852 tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info);
855 * @brief Set a TDM buffer to a layer object
856 * @details A TDM buffer will be applied when the output object
857 * of a layer object is committed.
858 * @param[in] layer A layer object
859 * @param[in] buffer A TDM buffer
860 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
861 * @see tdm_layer_commit
864 tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer);
867 * @brief Unset a TDM buffer from a layer object
868 * @details When this function is called, a current showing buffer will be
869 * disappeared from screen. Then nothing is showing on a layer object.
870 * @param[in] layer A layer object
871 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
874 tdm_layer_unset_buffer(tdm_layer *layer);
877 * @brief Commit changes for a layer object
878 * @details After all change of a layer object are applied, a user commit handler
880 * @param[in] layer A layer object
881 * @param[in] func A user commit handler
882 * @param[in] user_data The user data
883 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
886 tdm_layer_commit(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
889 tdm_layer_is_committing(tdm_layer *layer, unsigned int *committing);
892 * @brief Remove the user commit handler
893 * @param[in] layer A layer object
894 * @param[in] func A user commit handler
895 * @param[in] user_data The user data
896 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
899 tdm_layer_remove_commit_handler(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
902 * @brief Get a displaying TDM buffer from a layer object
903 * @details A displaying TDM buffer is a current showing buffer on screen
904 * that is set to layer object and applied output object of a layer object.
905 * @param[in] layer A layer object
906 * @return A TDM buffer if success. Otherwise, NULL.
909 tdm_layer_get_displaying_buffer(tdm_layer *layer, tdm_error *error);
912 * @brief Set a TBM surface_queue to a layer object
913 * @details A TBM surface_queue will be applied when the output object
914 * of a layer object is committed. and TDM layer will be automatically updated
915 * @param[in] layer A layer object
916 * @param[in] buffer_queue A TBM surface_queue
917 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
918 * @see tdm_layer_commit
921 tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue);
924 * @brief Unset a TBM surface_queue from a layer object
925 * @details When this function is called, a current surface_queue will be
926 * disappeared from screen. Then nothing is showing on a layer object.
927 * @param[in] layer A layer object
928 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
931 tdm_layer_unset_buffer_queue(tdm_layer *layer);
934 * @brief Check wheter a layer object is available for a frontend user to use.
935 * @details A layer object is not usable if a TDM buffer is showing on screen
936 * via this layer object. By calling #tdm_layer_unset_buffer, this layer object
937 * will become usable.
938 * @param[in] layer A layer object
939 * @param[out] usable 1 if usable, 0 if not usable
940 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
943 tdm_layer_is_usable(tdm_layer *layer, unsigned int *usable);
946 * @brief Set the relative zpos to a VIDEO layer object
947 * @details The zpos value is less than the minimum zpos of GRAPHIC layers, or
948 * it is more than the maximum zpos of GRAPHIC layers.
949 * @param[in] layer A VIDEO layer object
950 * @param[in] zpos The zpos
951 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
952 * @see tdm_layer_get_zpos, tdm_layer_capability
955 tdm_layer_set_video_pos(tdm_layer *layer, int zpos);
958 * @brief Create a capture object of a layer object
959 * @param[in] layer A layer object
960 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
961 * @return A capture object
962 * @see tdm_capture_destroy
965 tdm_layer_create_capture(tdm_layer *layer, tdm_error *error);
968 * @brief Get buffer flags from a layer object
969 * @param[in] layer A layer object
970 * @param[out] flags a buffer flags value
971 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
974 tdm_layer_get_buffer_flags(tdm_layer *layer, unsigned int *flags);
977 * @brief Get a buffer queue for the window object
978 * @details These buffers are used to composite by hardware a client content in
980 * @param[in] hwc_window A window object
981 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
982 * @return A tbm buffer queue
986 tdm_hwc_window_get_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error);
989 * @brief Sets the desired composition type of the given window.
990 * @details During tdm_output_hwc_validate(), the device may request changes to
991 * the composition types of any of the layers as described in the definition
992 * of tdm_hwc_window_composition_t above.
993 * @param[in] hwc_window A window object
994 * @param[in] composition_type The new composition type
995 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
999 tdm_hwc_window_set_composition_type(tdm_hwc_window *hwc_window,
1000 tdm_hwc_window_composition composition_type);
1003 * @brief Set the buffer damage
1004 * @details Provides the region of the source buffer which has been modified
1005 * since the last frame. This region does not need to be validated before
1006 * calling tdm_output_commit().
1007 * Once set through this function, the damage region remains the same until a
1008 * subsequent call to this function.
1009 * If damage.num_rects > 0, then it may be assumed that any portion of the source
1010 * buffer not covered by one of the rects has not been modified this frame. If
1011 * damage.num_rects == 0, then the whole source buffer must be treated as if it
1012 * has been modified.
1013 * If the layer's contents are not modified relative to the prior frame, damage
1014 * will contain exactly one empty rect([0, 0, 0, 0]).
1015 * The damage rects are relative to the pre-transformed buffer, and their origin
1016 * is the top-left corner. They will not exceed the dimensions of the latched
1018 * @param[in] hwc_window A window object
1019 * @param[in] damage The new buffer damage region
1020 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1024 tdm_hwc_window_set_buffer_damage(tdm_hwc_window *hwc_window, tdm_hwc_region damage);
1027 * @brief Set the information to a window object
1028 * @details The information will be applied when the output object of a window
1029 * object is committed.
1030 * @param[in] hwc_window A window object
1031 * @param[in] info The information
1032 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1036 tdm_hwc_window_set_info(tdm_hwc_window *hwc_window, tdm_hwc_window_info *info);
1039 * @brief Set a TBM buffer to a window object
1040 * @details A TBM buffer will be applied when the output object of a layer
1041 * object is committed.
1042 * @param[in] hwc_window A window object
1043 * @param[in] buffer A TDM buffer
1044 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1045 * @return #TDM_ERROR_BUSY if #hwc_window can't be updated right now, this
1046 * can happen if #hwc_window is involved in the smooth transition from
1047 * DEVICE to CLIENT, this shouldn't be interpreted like some critical error.
1051 tdm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer);
1054 * @brief Unset a TBM buffer to a window object
1055 * @details A TBM buffer will be applied when the output object of a layer
1056 * object is committed.
1057 * @param[in] hwc_window A window object
1058 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1059 * @return #TDM_ERROR_BUSY if #hwc_window can't be updated right now, this
1060 * can happen if #hwc_window is involved in the smooth transition from
1061 * DEVICE to CLIENT, this shouldn't be interpreted like some critical error.
1065 tdm_hwc_window_unset_buffer(tdm_hwc_window *hwc_window);
1068 * @brief Set a flags to a window object
1069 * @param[in] hwc_window A window object
1070 * @param[in] flags A hwc_window flags
1071 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1075 tdm_hwc_window_set_flags(tdm_hwc_window *hwc_window, tdm_hwc_window_flag flags);
1078 * @brief Unset a flags from a window object
1079 * @param[in] hwc_window A window object
1080 * @param[in] flags A hwc_window flags
1081 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1085 tdm_hwc_window_unset_flags(tdm_hwc_window *hwc_window, tdm_hwc_window_flag flags);
1088 * @brief Commit changes for a window object
1089 * @details After all change of a window object are applied, a user commit handler
1091 * @param[in] hwc_window A window object
1092 * @param[in] func A user commit handler
1093 * @param[in] user_data The user data
1094 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1097 tdm_hwc_window_commit(tdm_hwc_window *hwc_window, tdm_hwc_window_commit_handler func, void *user_data);
1100 * @brief Get the available property array of a video hwc window object.
1101 * @param[in] hwc window A video hwc window object
1102 * @param[out] props The available property array
1103 * @param[out] count The count of properties
1104 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1107 tdm_hwc_window_video_get_available_properties(tdm_hwc_window *hwc_window,
1108 const tdm_prop **props, int *count);
1111 * @brief Get 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[out] value The value
1115 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1118 tdm_hwc_window_video_get_property(tdm_hwc_window *hwc_window, uint32_t id,
1122 * @brief Set the property which has a given id.
1123 * @param[in] hwc window A video hwc window object
1124 * @param[in] id The property id
1125 * @param[in] value The value
1126 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1129 tdm_hwc_window_video_set_property(tdm_hwc_window *hwc_window, uint32_t id,
1133 * @brief Get the window video capability
1134 * @param[in] hwc_window A window object
1135 * @param[out] video_capability A hwc window video capability
1136 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1140 tdm_hwc_window_video_get_capability(tdm_hwc_window *hwc_window,
1141 tdm_hwc_window_video_capability *video_capability);
1144 * @brief Destroy a pp object
1145 * @param[in] pp A pp object
1146 * @see tdm_display_create_pp
1149 tdm_pp_destroy(tdm_pp *pp);
1152 * @brief Set the geometry information to a pp object
1153 * @param[in] pp A pp object
1154 * @param[in] info The geometry information
1155 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1156 * @see tdm_pp_commit
1159 tdm_pp_set_info(tdm_pp *pp, tdm_info_pp *info);
1162 * @brief Set the PP done handler to a pp object
1164 * The user PP done handler will be called after converting a source buffer's image
1165 * to a destination buffer.
1166 * @param[in] pp A pp object
1167 * @param[in] func A user PP done handler
1168 * @param[in] user_data The user data
1169 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1172 tdm_pp_set_done_handler(tdm_pp *pp, tdm_pp_done_handler func, void *user_data);
1175 * @brief Attach a source buffer and a destination buffer to a pp object
1176 * @param[in] pp A pp object
1177 * @param[in] src A source buffer
1178 * @param[in] dst A destination buffer
1179 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1180 * @see tdm_pp_commit, tdm_pp_set_done_handler
1183 tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
1186 * @brief Commit changes for a pp object
1187 * @param[in] pp A pp object
1188 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1191 tdm_pp_commit(tdm_pp *pp);
1194 * @brief Destroy a capture object
1195 * @param[in] capture A capture object
1196 * @see tdm_output_create_capture, tdm_layer_create_capture
1199 tdm_capture_destroy(tdm_capture *capture);
1202 * @brief Set the geometry information to a capture object
1203 * @param[in] capture A capture object
1204 * @param[in] info The geometry information
1205 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1206 * @see tdm_capture_commit
1209 tdm_capture_set_info(tdm_capture *capture, tdm_info_capture *info);
1212 * @brief Set the capture done handler to a capture object
1214 * The user capture done handler will be called after capturing a screen into a
1216 * @param[in] capture A capture object
1217 * @param[in] func A user capture done handler
1218 * @param[in] user_data The user data
1219 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1222 tdm_capture_set_done_handler(tdm_capture *capture, tdm_capture_done_handler func, void *user_data);
1225 * @brief Attach a TDM buffer to a capture object
1226 * @param[in] capture A capture object
1227 * @param[in] buffer A TDM buffer
1228 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1229 * @see tdm_capture_commit, tdm_capture_set_done_handler
1232 tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer);
1235 * @brief Commit changes for a capture object
1236 * @param[in] capture A capture object
1237 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1240 tdm_capture_commit(tdm_capture *capture);
1243 * @brief The release handler of a TDM buffer
1244 * @param[in] buffer A TDM buffer
1245 * @param[in] user_data user data
1246 * @see tdm_buffer_add_release_handler, tdm_buffer_remove_release_handler
1248 typedef void (*tdm_buffer_release_handler)(tbm_surface_h buffer,
1252 * @brief Add a release handler to a TDM buffer
1254 * TDM has its own buffer release mechanism to let an frontend user know when a TDM buffer
1255 * becomes available for a next job. A TDM buffer can be used for TDM to show
1256 * it on screen or to capture an output and a layer. After all operations,
1257 * TDM will release it immediately when TDM doesn't need it any more.
1258 * @param[in] buffer A TDM buffer
1259 * @param[in] func A release handler
1260 * @param[in] user_data user data
1261 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1262 * @see tdm_buffer_remove_release_handler
1265 tdm_buffer_add_release_handler(tbm_surface_h buffer,
1266 tdm_buffer_release_handler func, void *user_data);
1269 * @brief Remove a release handler from a TDM buffer
1270 * @param[in] buffer A TDM buffer
1271 * @param[in] func A release handler
1272 * @param[in] user_data user data
1273 * @see tdm_buffer_add_release_handler
1276 tdm_buffer_remove_release_handler(tbm_surface_h buffer,
1277 tdm_buffer_release_handler func, void *user_data);
1280 * @brief The handler of a vblank object
1281 * @see #tdm_vblank_wait, #tdm_vblank_wait_seq
1283 typedef void (*tdm_vblank_handler)(tdm_vblank *vblank, tdm_error error, unsigned int sequence,
1284 unsigned int tv_sec, unsigned int tv_usec, void *user_data);
1287 * @brief Set the vblank fps for the given PID and name.
1288 * @param[in] pid The process ID
1289 * @param[in] name The client vblank name
1290 * @param[in] fps The client vblank fps
1291 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1294 tdm_vblank_set_client_vblank_fps(unsigned int pid, const char *name, unsigned int fps);
1297 * @brief Set the ignore global fps for the given PID and name.
1298 * @param[in] pid The process ID
1299 * @param[in] name The client vblank name
1300 * @param[in] ignore 1: ignore 0:not ignore(default)
1301 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1304 tdm_vblank_set_client_ignore_global_fps(unsigned int pid, const char *name, unsigned int ignore);
1307 * @brief Set the vblank global fps for the entire system.
1308 * @param[in] enable 1:enable, 0:disable
1309 * @param[in] fps The vblank global fps
1311 * This global fps will be applied to all client's vblanks for all outputs.
1312 * If the client's vblank fps is less than this, the global fps will be ignored
1313 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1314 * the global fps, it will be ignored also.
1315 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1318 tdm_vblank_enable_global_fps(unsigned int enable, unsigned int fps);
1321 * @brief Add the vblank create handler.
1322 * @param[in] dpy A display object
1323 * @param[in] func The user vblank create handler
1324 * @param[in] user_data The user data
1326 * The user vblank create handler will be called when new vblank object created.
1327 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1330 tdm_vblank_add_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1333 * @brief Remove the vblank create handler.
1334 * @param[in] dpy A display object
1335 * @param[in] func The user vblank create handler
1336 * @param[in] user_data The user data
1337 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1340 tdm_vblank_remove_create_handler(tdm_display *dpy, tdm_vblank_create_handler func, void *user_data);
1343 * @brief Create a vblank object
1344 * @param[in] dpy A display object
1345 * @param[in] output A output object
1346 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
1347 * @return A vblank object
1348 * @see #tdm_vblank_destroy
1351 tdm_vblank_create(tdm_display *dpy, tdm_output *output, tdm_error *error);
1354 * @brief Destroy a vblank object
1355 * @param[in] vblank A vblank object
1356 * @see #tdm_vblank_create
1359 tdm_vblank_destroy(tdm_vblank *vblank);
1362 * @brief Get the client PID for a vblank object
1363 * @param[in] vblank A vblank object
1364 * @param[out] pid PID of vblank's client
1365 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1368 tdm_vblank_get_client_pid(tdm_vblank *vblank, pid_t *pid);
1371 * @brief Set the name to a vblank object
1372 * @details The default name is "unknown"
1373 * @param[in] vblank A vblank object
1374 * @param[in] name vblank name
1375 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1378 tdm_vblank_set_name(tdm_vblank *vblank, const char *name);
1381 * @brief Get the name for a vblank object
1382 * @details The default name is "unknown"
1383 * @param[in] vblank A vblank object
1384 * @param[out] name vblank name
1385 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1388 tdm_vblank_get_name(tdm_vblank *vblank, const char **name);
1391 * @brief Set the fps to a vblank object
1392 * @details Default is the @b vertical @b refresh @b rate of the given output.
1393 * It could be ignored when the fixed fps is set by #tdm_vblank_set_fixed_fps
1394 * @param[in] vblank A vblank object
1395 * @param[in] fps over 0
1396 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1399 tdm_vblank_set_fps(tdm_vblank *vblank, unsigned int fps);
1402 * @brief Get the fps for a vblank object
1403 * @param[in] vblank A vblank object
1404 * @param[out] fps over 0
1405 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1408 tdm_vblank_get_fps(tdm_vblank *vblank, unsigned int *fps);
1411 * @brief Set the fixed fps to a vblank object
1413 * It could be ignored when the global fps is set by #tdm_vblank_enable_global_fps
1414 * @param[in] vblank A vblank object
1415 * @param[in] fps over 0
1416 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1419 tdm_vblank_set_fixed_fps(tdm_vblank *vblank, unsigned int fps);
1422 * @brief Ignore the vblank global fps
1424 * The global fps will be applied to all client's vblanks for all outputs.
1425 * If the client's vblank fps is less than this, the global fps will be ignored
1426 * for that client. And if a client calls #tdm_vblank_ignore_global_fps to ignore
1427 * the global fps, it will be ignored also.
1428 * @param[in] vblank A vblank object
1429 * @param[in] ignore 1: ignore 0:not ignore(default)
1430 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1433 tdm_vblank_ignore_global_fps(tdm_vblank *vblank, unsigned int ignore);
1436 * @brief Set the offset(milli-second) to a vblank object
1437 * @details Default is @b 0.
1438 * @param[in] vblank A vblank object
1439 * @param[in] offset the offset(milli-second)
1440 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1443 tdm_vblank_set_offset(tdm_vblank *vblank, int offset);
1446 * @brief Get the offset(milli-second) for a vblank object
1447 * @param[in] vblank A vblank object
1448 * @param[out] offset the offset(milli-second)
1449 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1452 tdm_vblank_get_offset(tdm_vblank *vblank, int *offset);
1455 * @brief Enable/Disable the fake vblank to a vblank object
1457 * If enable_fake == 0, #tdm_vblank_wait will return TDM_ERROR_DPMS_OFF
1458 * when DPMS off. Otherwise, #tdm_vblank_wait will return TDM_ERROR_NONE
1460 * @param[in] vblank A vblank object
1461 * @param[in] enable_fake 1:enable, 0:disable
1462 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1465 tdm_vblank_set_enable_fake(tdm_vblank *vblank, unsigned int enable_fake);
1468 * @brief Get the fake vblank
1469 * @param[in] vblank A vblank object
1470 * @param[out] enable_fake 1:enable, 0:disable
1471 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1474 tdm_vblank_get_enable_fake(tdm_vblank *vblank, unsigned int *enable_fake);
1477 * @brief Wait for a vblank
1479 * Once #tdm_vblank_wait returns TDM_ERROR_NONE, the user vblank handler(#tdm_vblank_handler)
1480 * SHOULD be called after the given interval. \n
1481 * The sequence value of tdm_vblank_handler is the relative value of fps.
1482 * If fps = 10, this sequence value should be increased by 10 during 1 second.
1483 * @param[in] vblank A vblank object
1484 * @param[in] req_sec The vblank request time(second)
1485 * @param[in] req_usec The vblank request time(micro-second)
1486 * @param[in] interval The vblank interval
1487 * @param[in] func The user vblank handler
1488 * @param[in] user_data The user data
1489 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1492 tdm_vblank_wait(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1493 unsigned int interval, tdm_vblank_handler func, void *user_data);
1496 * @brief Wait for a vblank with the target sequence number
1497 * @param[in] vblank A vblank object
1498 * @param[in] req_sec The vblank request time(second)
1499 * @param[in] req_usec The vblank request time(micro-second)
1500 * @param[in] sequence The target sequence number
1501 * @param[in] func The user client vblank handler
1502 * @param[in] user_data The user data
1503 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
1506 tdm_vblank_wait_seq(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
1507 unsigned int sequence, tdm_vblank_handler func, void *user_data);
1513 #endif /* _TDM_H_ */