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 <tbm_surface.h>
41 #include <tbm_surface_queue.h>
42 #include <tbm_surface_internal.h>
44 #include "tdm_types.h"
52 * @brief The header file for a frontend user.
55 * #include <tdm.h> //for a frontend user
60 * @brief The display capability enumeration
63 TDM_DISPLAY_CAPABILITY_PP = (1 << 0), /**< if hardware supports pp operation */
64 TDM_DISPLAY_CAPABILITY_CAPTURE = (1 << 1), /**< if hardware supports capture operation */
65 } tdm_display_capability;
68 * @brief The output change handler
69 * @details This handler will be called when the status of a output object is
72 typedef void (*tdm_output_change_handler)(tdm_output *output,
73 tdm_output_change_type type,
78 * @brief Initialize a display object
79 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
80 * @return A display object
81 * @see tdm_display_deinit
84 tdm_display_init(tdm_error *error);
87 * @brief Deinitialize a display object
88 * @param[in] dpy A display object
89 * @see tdm_display_init
92 tdm_display_deinit(tdm_display *dpy);
95 * @brief Update a display object
97 * When new output is connected, a frontend user need to call this function.
98 * And a frontend user can the new output information with tdm_output_get_xxx functions.
99 * @param[in] dpy A display object
100 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
103 tdm_display_update(tdm_display *dpy);
106 * @brief Get the file descriptor
107 * @details TDM handles the events of fd with #tdm_display_handle_events.
108 * @param[in] dpy A display object
109 * @param[out] fd The file descriptor
110 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
111 * @see tdm_display_handle_events
114 tdm_display_get_fd(tdm_display *dpy, int *fd);
117 * @brief Handle the events
118 * @param[in] dpy A display object
119 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
120 * @see tdm_display_get_fd
123 tdm_display_handle_events(tdm_display *dpy);
126 * @brief Get the information of the TDM backend module.
127 * @param[in] dpy A display object
128 * @param[out] name The name of the TDM backend module
129 * @param[out] vendor The vendor of the TDM backend module
130 * @param[out] version The version of the TDM backend module
131 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
134 tdm_display_get_backend_info(tdm_display *dpy, const char **name,
135 const char **vendor, int *major, int *minor);
138 * @brief Get the capabilities of a display object.
139 * @details A frontend user can get whether TDM supports pp/capture functionality with this function.
140 * @param[in] dpy A display object
141 * @param[out] capabilities The capabilities of a display object
142 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
145 tdm_display_get_capabilities(tdm_display *dpy,
146 tdm_display_capability *capabilities);
149 * @brief Get the pp capabilities of a display object.
150 * @param[in] dpy A display object
151 * @param[out] capabilities The pp capabilities
152 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
155 tdm_display_get_pp_capabilities(tdm_display *dpy,
156 tdm_pp_capability *capabilities);
159 * @brief Get the pp available format array of a display object.
160 * @param[in] dpy A display object
161 * @param[out] formats The pp available format array
162 * @param[out] count The count of formats
163 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
166 tdm_display_get_pp_available_formats(tdm_display *dpy,
167 const tbm_format **formats, int *count);
170 * @brief Get the pp available size of a display object.
171 * @details -1 means that a TDM backend module doesn't define the value.
172 * @param[in] dpy A display object
173 * @param[out] min_w The minimum width which TDM can handle
174 * @param[out] min_h The minimum height which TDM can handle
175 * @param[out] max_w The maximum width which TDM can handle
176 * @param[out] max_h The maximum height which TDM can handle
177 * @param[out] preferred_align The preferred align width which TDM can handle
178 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
181 tdm_display_get_pp_available_size(tdm_display *dpy, int *min_w, int *min_h,
182 int *max_w, int *max_h, int *preferred_align);
185 * @brief Get the capture capabilities of a display object.
186 * @param[in] dpy A display object
187 * @param[out] capabilities The capture capabilities
188 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
191 tdm_display_get_capture_capabilities(tdm_display *dpy,
192 tdm_capture_capability *capabilities);
195 * @brief Get the capture available format array of a display object.
196 * @param[in] dpy A display object
197 * @param[out] formats The capture available format array
198 * @param[out] count The count of formats
199 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
202 tdm_display_get_catpure_available_formats(tdm_display *dpy,
203 const tbm_format **formats, int *count);
206 * @brief Get the output counts which a display object has.
207 * @param[in] dpy A display object
208 * @param[out] count The count of outputs
209 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
210 * @see tdm_display_get_output
213 tdm_display_get_output_count(tdm_display *dpy, int *count);
216 * @brief Get a output object which has the given index.
217 * @param[in] dpy A display object
218 * @param[in] index The index of a output object
219 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
220 * @return A output object if success. Otherwise, NULL.
221 * @see tdm_display_get_output_count
224 tdm_display_get_output(tdm_display *dpy, int index, tdm_error *error);
227 * @brief Create a pp object.
228 * @param[in] dpy A display object
229 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
230 * @return A pp object if success. Otherwise, NULL.
231 * @see tdm_pp_destroy
234 tdm_display_create_pp(tdm_display *dpy, tdm_error *error);
237 * @brief Get the capabilities of a output object.
238 * @param[in] output A output object
239 * @param[out] capabilities The capabilities of a output object
240 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
243 tdm_output_get_capabilities(tdm_output *output,
244 tdm_output_capability *capabilities);
247 * @brief Get the model information of a output object.
248 * @param[in] output A output object
249 * @param[out] maker The output maker.
250 * @param[out] model The output model.
251 * @param[out] name The output name.
252 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
255 tdm_output_get_model_info(tdm_output *output, const char **maker,
256 const char **model, const char **name);
259 * @brief Get the connection status of a output object.
260 * @param[in] output A output object
261 * @param[out] status The connection status.
262 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
265 tdm_output_get_conn_status(tdm_output *output, tdm_output_conn_status *status);
268 * @brief Add a output change handler
269 * @details The handler will be called when the status of a
270 * output object is changed. connection, DPMS, etc.
271 * @param[in] output A output object
272 * @param[in] func A output change handler
273 * @param[in] user_data The user data
274 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
277 tdm_output_add_change_handler(tdm_output *output,
278 tdm_output_change_handler func,
282 * @brief Remove a output change handler
283 * @param[in] output A output object
284 * @param[in] func A output change handler
285 * @param[in] user_data The user data
286 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
289 tdm_output_remove_change_handler(tdm_output *output,
290 tdm_output_change_handler func,
294 * @brief Get the connection type of a output object.
295 * @param[in] output A output object
296 * @param[out] type The connection type.
297 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
300 tdm_output_get_output_type(tdm_output *output, tdm_output_type *type);
303 * @brief Get the layer counts which a output object has.
304 * @param[in] output A output object
305 * @param[out] count The count of layers
306 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
307 * @see tdm_output_get_layer
310 tdm_output_get_layer_count(tdm_output *output, int *count);
313 * @brief Get a layer object which has the given index.
314 * @param[in] output A output object
315 * @param[in] index The index of a layer object
316 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
317 * @return A layer object if success. Otherwise, NULL.
318 * @see tdm_output_get_layer_count
321 tdm_output_get_layer(tdm_output *output, int index, tdm_error *error);
324 * @brief Get the available property array of a output object.
325 * @param[in] output A output object
326 * @param[out] props The available property array
327 * @param[out] count The count of properties
328 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
331 tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props,
335 * @brief Get the available mode array of a output object.
336 * @param[in] output A output object
337 * @param[out] modes The available mode array
338 * @param[out] count The count of modes
339 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
342 tdm_output_get_available_modes(tdm_output *output,
343 const tdm_output_mode **modes, int *count);
346 * @brief Get the available size of a output object.
347 * @details -1 means that a TDM backend module doesn't define the value.
348 * @param[in] output A output object
349 * @param[out] min_w The minimum width which TDM can handle
350 * @param[out] min_h The minimum height which TDM can handle
351 * @param[out] max_w The maximum width which TDM can handle
352 * @param[out] max_h The maximum height which TDM can handle
353 * @param[out] preferred_align The preferred align width which TDM can handle
354 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
357 tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h,
358 int *max_w, int *max_h, int *preferred_align);
361 * @brief Get the physical size of a output object.
362 * @param[in] output A output object
363 * @param[out] mmWidth The milimeter width
364 * @param[out] mmHeight The milimeter height
365 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
368 tdm_output_get_physical_size(tdm_output *output, unsigned int *mmWidth,
369 unsigned int *mmHeight);
372 * @brief Get the subpixel of a output object.
373 * @param[in] output A output object
374 * @param[out] subpixel The subpixel
375 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
378 tdm_output_get_subpixel(tdm_output *output, unsigned int *subpixel);
381 * @brief Get the pipe of a output object.
382 * @param[in] output A output object
383 * @param[out] pipe The pipe
384 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
387 tdm_output_get_pipe(tdm_output *output, unsigned int *pipe);
390 * @brief Get the index of a primary layer.
391 * @param[in] output A output object
392 * @param[out] index The primary layer index
393 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
396 tdm_output_get_primary_index(tdm_output *output, int *index);
399 * @brief Set the property which has a given id.
400 * @param[in] output A output object
401 * @param[in] id The property id
402 * @param[in] value The value
403 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
406 tdm_output_set_property(tdm_output *output, unsigned int id, tdm_value value);
409 * @brief Get the property which has a given id
410 * @param[in] output A output object
411 * @param[in] id The property id
412 * @param[out] value The value
413 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
416 tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value);
419 * @brief Wait for VBLANK
420 * @details After interval vblanks, a user vblank handler will be called.
421 * @param[in] output A output object
422 * @param[in] interval vblank interval
423 * @param[in] sync 0: asynchronous, 1:synchronous
424 * @param[in] func A user vblank handler
425 * @param[in] user_data The user data
426 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
427 * @see #tdm_output_vblank_handler
430 tdm_output_wait_vblank(tdm_output *output, int interval, int sync,
431 tdm_output_vblank_handler func, void *user_data);
434 * @brief Commit changes for a output object
435 * @details After all change of a output object are applied, a user commit handler
437 * @param[in] output A output object
438 * @param[in] sync 0: asynchronous, 1:synchronous
439 * @param[in] func A user commit handler
440 * @param[in] user_data The user data
441 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
444 tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func,
448 * @brief Set one of available modes of a output object
449 * @param[in] output A output object
450 * @param[in] mode A output mode
451 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
454 tdm_output_set_mode(tdm_output *output, const tdm_output_mode *mode);
457 * @brief Get the mode of a output object
458 * @param[in] output A output object
459 * @param[out] mode A output mode
460 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
463 tdm_output_get_mode(tdm_output *output, const tdm_output_mode **mode);
466 * @brief Set DPMS of a output object
467 * @param[in] output A output object
468 * @param[in] dpms_value DPMS value
469 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
472 tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value);
475 * @brief Get DPMS of a output object
476 * @param[in] output A output object
477 * @param[out] dpms_value DPMS value
478 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
481 tdm_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value);
484 * @brief Create a capture object of a output object
485 * @param[in] output A output object
486 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
487 * @return A capture object
488 * @see tdm_capture_destroy
491 tdm_output_create_capture(tdm_output *output, tdm_error *error);
494 * @brief Get the capabilities of a layer object.
495 * @param[in] layer A layer object
496 * @param[out] capabilities The capabilities of a layer object
497 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
500 tdm_layer_get_capabilities(tdm_layer *layer,
501 tdm_layer_capability *capabilities);
504 * @brief Get the available format array of a layer object.
505 * @param[in] layer A layer object
506 * @param[out] formats The available format array
507 * @param[out] count The count of formats
508 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
511 tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats,
515 * @brief Get the available property array of a layer object.
516 * @param[in] layer A layer object
517 * @param[out] props The available property array
518 * @param[out] count The count of properties
519 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
522 tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props,
526 * @brief Get the zpos of a layer object.
528 * - GRAPHIC layers have fixed zpos. It starts from 0. It's @b non-changeable.
529 * - But the zpos of VIDEO layers will be decided by a backend module side.
530 * - A frontend user only can set the relative zpos to VIDEO layers via #tdm_layer_set_video_pos
531 * - The zpos of video layers is less than GRAPHIC layers or more than GRAPHIC
532 * layers. ie, ..., -2, -1, 4, 5, ... (if 0 <= GRAPHIC layer's zpos < 4).
533 * -------------------------------- graphic layer 3 <-- top most layer
534 * -------------------------------- graphic layer 2
535 * -------------------------------- graphic layer 1
536 * -------------------------------- graphic layer 0
537 * -------------------------------- video layer -1
538 * -------------------------------- video layer -2 <-- lowest layer
539 * @param[in] layer A layer object
540 * @param[out] zpos The zpos
541 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
542 * @see tdm_layer_set_video_pos, tdm_layer_capability
545 tdm_layer_get_zpos(tdm_layer *layer, int *zpos);
548 * @brief Set the property which has a given id.
549 * @param[in] layer A layer object
550 * @param[in] id The property id
551 * @param[in] value The value
552 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
555 tdm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
558 * @brief Get the property which has a given id.
559 * @param[in] layer A layer object
560 * @param[in] id The property id
561 * @param[out] value The value
562 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
565 tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
568 * @brief Set the geometry information to a layer object
569 * @details The geometry information will be applied when the output object
570 * of a layer object is committed. If a layer has TDM_LAYER_CAPABILITY_NO_CROP
571 * capability, a layer will ignore the pos(crop) information of #tdm_info_layer's
573 * @param[in] layer A layer object
574 * @param[in] info The geometry information
575 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
576 * @see tdm_output_commit
579 tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info);
582 * @brief Get the geometry information to a layer object
583 * @param[in] layer A layer object
584 * @param[out] info The geometry information
585 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
588 tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info);
591 * @brief Set a TDM buffer to a layer object
592 * @details A TDM buffer will be applied when the output object
593 * of a layer object is committed.
594 * @param[in] layer A layer object
595 * @param[in] buffer A TDM buffer
596 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
597 * @see tdm_output_commit
600 tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer);
603 * @brief Unset a TDM buffer from a layer object
604 * @details When this function is called, a current showing buffer will be
605 * disappeared from screen. Then nothing is showing on a layer object.
606 * @param[in] layer A layer object
607 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
610 tdm_layer_unset_buffer(tdm_layer *layer);
613 * @brief Get a displaying TDM buffer from a layer object
614 * @details A displaying TDM buffer is a current showing buffer on screen
615 * that is set to layer object and applied output object of a layer object.
616 * @param[in] layer A layer object
617 * @return A TDM buffer if success. Otherwise, NULL.
620 tdm_layer_get_displaying_buffer(tdm_layer *layer, tdm_error *error);
623 * @brief Set a TBM surface_queue to a layer object
624 * @details A TBM surface_queue will be applied when the output object
625 * of a layer object is committed. and TDM layer will be automatically updated
626 * @param[in] layer A layer object
627 * @param[in] buffer_queue A TBM surface_queue
628 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
629 * @see tdm_output_commit
632 tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue);
635 * @brief Unset a TBM surface_queue from a layer object
636 * @details When this function is called, a current surface_queue will be
637 * disappeared from screen. Then nothing is showing on a layer object.
638 * @param[in] layer A layer object
639 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
642 tdm_layer_unset_buffer_queue(tdm_layer *layer);
645 * @brief Check wheter a layer object is available for a frontend user to use.
646 * @details A layer object is not usable if a TDM buffer is showing on screen
647 * via this layer object. By calling #tdm_layer_unset_buffer, this layer object
648 * will become usable.
649 * @param[in] layer A layer object
650 * @param[out] usable 1 if usable, 0 if not usable
651 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
654 tdm_layer_is_usable(tdm_layer *layer, unsigned int *usable);
657 * @brief Set the relative zpos to a VIDEO layer object
658 * @details The zpos value is less than the minimum zpos of GRAPHIC layers, or
659 * it is more than the maximum zpos of GRAPHIC layers.
660 * @param[in] layer A VIDEO layer object
661 * @param[in] zpos The zpos
662 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
663 * @see tdm_layer_get_zpos, tdm_layer_capability
666 tdm_layer_set_video_pos(tdm_layer *layer, int zpos);
669 * @brief Create a capture object of a layer object
670 * @param[in] layer A layer object
671 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
672 * @return A capture object
673 * @see tdm_capture_destroy
676 tdm_layer_create_capture(tdm_layer *layer, tdm_error *error);
679 * @brief Get buffer flags from a layer object
680 * @param[in] layer A layer object
681 * @param[out] flags a buffer flags value
682 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
685 tdm_layer_get_buffer_flags(tdm_layer *layer, unsigned int *flags);
688 * @brief Destroy a pp object
689 * @param[in] pp A pp object
690 * @see tdm_display_create_pp
693 tdm_pp_destroy(tdm_pp *pp);
696 * @brief Set the geometry information to a pp object
697 * @param[in] pp A pp object
698 * @param[in] info The geometry information
699 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
703 tdm_pp_set_info(tdm_pp *pp, tdm_info_pp *info);
706 * @brief Set the PP done handler to a pp object
708 * The user PP done handler will be called after converting a source buffer's image
709 * to a destination buffer.
710 * @param[in] pp A pp object
711 * @param[in] func A user PP done handler
712 * @param[in] user_data The user data
713 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
716 tdm_pp_set_done_handler(tdm_pp *pp, tdm_pp_done_handler func, void *user_data);
719 * @brief Attach a source buffer and a destination buffer to a pp object
720 * @param[in] pp A pp object
721 * @param[in] src A source buffer
722 * @param[in] dst A destination buffer
723 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
724 * @see tdm_pp_commit, tdm_pp_set_done_handler
727 tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
730 * @brief Commit changes for a pp object
731 * @param[in] pp A pp object
732 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
735 tdm_pp_commit(tdm_pp *pp);
738 * @brief Destroy a capture object
739 * @param[in] capture A capture object
740 * @see tdm_output_create_capture, tdm_layer_create_capture
743 tdm_capture_destroy(tdm_capture *capture);
746 * @brief Set the geometry information to a capture object
747 * @param[in] capture A capture object
748 * @param[in] info The geometry information
749 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
750 * @see tdm_capture_commit
753 tdm_capture_set_info(tdm_capture *capture, tdm_info_capture *info);
756 * @brief Set the capture done handler to a capture object
758 * The user capture done handler will be called after capturing a screen into a
760 * @param[in] capture A capture object
761 * @param[in] func A user capture done handler
762 * @param[in] user_data The user data
763 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
766 tdm_capture_set_done_handler(tdm_capture *capture, tdm_capture_done_handler func, void *user_data);
769 * @brief Attach a TDM buffer to a capture object
770 * @param[in] capture A capture object
771 * @param[in] buffer A TDM buffer
772 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
773 * @see tdm_capture_commit, tdm_capture_set_done_handler
776 tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer);
779 * @brief Commit changes for a capture object
780 * @param[in] capture A capture object
781 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
784 tdm_capture_commit(tdm_capture *capture);
787 * @brief The release handler of a TDM buffer
788 * @param[in] buffer A TDM buffer
789 * @param[in] user_data user data
790 * @see tdm_buffer_add_release_handler, tdm_buffer_remove_release_handler
792 typedef void (*tdm_buffer_release_handler)(tbm_surface_h buffer,
796 * @brief Add a release handler to a TDM buffer
798 * TDM has its own buffer release mechanism to let an frontend user know when a TDM buffer
799 * becomes available for a next job. A TDM buffer can be used for TDM to show
800 * it on screen or to capture an output and a layer. After all operations,
801 * TDM will release it immediately when TDM doesn't need it any more.
802 * @param[in] buffer A TDM buffer
803 * @param[in] func A release handler
804 * @param[in] user_data user data
805 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
806 * @see tdm_buffer_remove_release_handler
809 tdm_buffer_add_release_handler(tbm_surface_h buffer,
810 tdm_buffer_release_handler func, void *user_data);
813 * @brief Remove a release handler from a TDM buffer
814 * @param[in] buffer A TDM buffer
815 * @param[in] func A release handler
816 * @param[in] user_data user data
817 * @see tdm_buffer_add_release_handler
820 tdm_buffer_remove_release_handler(tbm_surface_h buffer,
821 tdm_buffer_release_handler func, void *user_data);
824 * @brief The handler of a vblank object
825 * @see #tdm_vblank_wait, #tdm_vblank_wait_seq
827 typedef void (*tdm_vblank_handler)(tdm_vblank *vblank, tdm_error error, unsigned int sequence,
828 unsigned int tv_sec, unsigned int tv_usec, void *user_data);
831 * @brief Create a vblank object
832 * @param[in] dpy A display object
833 * @param[in] output A output object
834 * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
835 * @return A vblank object
836 * @see #tdm_vblank_destroy
839 tdm_vblank_create(tdm_display *dpy, tdm_output *output, tdm_error *error);
842 * @brief Destroy a vblank object
843 * @param[in] vblank A vblank object
844 * @see #tdm_vblank_create
847 tdm_vblank_destroy(tdm_vblank *vblank);
850 * @brief Set the fps to a vblank object
851 * @details Default is the @b vertical @b refresh @b rate of the given output.
852 * @param[in] vblank A vblank object
853 * @param[in] fps over 0
854 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
857 tdm_vblank_set_fps(tdm_vblank *vblank, unsigned int fps);
860 * @brief Set the offset(milli-second) to a vblank object
861 * @details Default is @b 0.
862 * @param[in] vblank A vblank object
863 * @param[in] offset the offset(milli-second)
864 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
867 tdm_vblank_set_offset(tdm_vblank *vblank, int offset);
870 * @brief Enable/Disable the fake vblank to a vblank object
872 * If enable_fake == 0, #tdm_vblank_wait will return TDM_ERROR_DPMS_OFF
873 * when DPMS off. Otherwise, #tdm_vblank_wait will return TDM_ERROR_NONE
875 * @param[in] vblank A vblank object
876 * @param[in] enable_fake 1:enable, 0:disable
877 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
880 tdm_vblank_set_enable_fake(tdm_vblank *vblank, unsigned int enable_fake);
883 * @brief Get the fake vblank
884 * @param[in] vblank A vblank object
885 * @return 1 if enable. Otherwise, 0.
888 tdm_vblank_get_enable_fake(tdm_vblank *vblank);
891 * @brief Wait for a vblank
893 * Once #tdm_vblank_wait returns TDM_ERROR_NONE, the user vblank handler(#tdm_vblank_handler)
894 * SHOULD be called after the given interval. \n
895 * The sequence value of tdm_vblank_handler is the relative value of fps.
896 * If fps = 10, this sequence value should be increased by 10 during 1 second.
897 * @param[in] vblank A vblank object
898 * @param[in] req_sec The vblank request time(second)
899 * @param[in] req_usec The vblank request time(micro-second)
900 * @param[in] interval The vblank interval
901 * @param[in] func The user vblank handler
902 * @param[in] user_data The user data
903 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
906 tdm_vblank_wait(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
907 unsigned int interval, tdm_vblank_handler func, void *user_data);
910 * @brief Wait for a vblank with the target sequence number
911 * @param[in] vblank A vblank object
912 * @param[in] req_sec The vblank request time(second)
913 * @param[in] req_usec The vblank request time(micro-second)
914 * @param[in] sequence The target sequence number
915 * @param[in] func The user client vblank handler
916 * @param[in] user_data The user data
917 * @return #TDM_ERROR_NONE if success. Otherwise, error value.
920 tdm_vblank_wait_seq(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
921 unsigned int sequence, tdm_vblank_handler func, void *user_data);