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_internal.h>
43 #include "tdm_types.h"
49 ///////////////////////////////////////////////////////////////////////////////
53 TDM_DISPLAY_CAPABILITY_PP = (1<<0),
54 TDM_DISPLAY_CAPABILITY_CAPTURE = (1<<1),
55 } tdm_display_capability;
57 /* not neccessary for user to know what backend is */
58 tdm_display* tdm_display_init(tdm_error *error);
59 void tdm_display_deinit(tdm_display *dpy);
60 tdm_error tdm_display_update(tdm_display *dpy);
62 ///////////////////////////////////////////////////////////////////////////////
64 tdm_error tdm_display_get_fd(tdm_display *dpy, int *fd);
65 tdm_error tdm_display_handle_events(tdm_display *dpy);
67 tdm_error tdm_display_get_capabilities(tdm_display *dpy, tdm_display_capability *capabilities);
68 tdm_error tdm_display_get_pp_capabilities(tdm_display *dpy, tdm_pp_capability *capabilities);
69 tdm_error tdm_display_get_pp_available_formats(tdm_display *dpy, const tbm_format **formats, int *count);
70 tdm_error tdm_display_get_pp_available_size(tdm_display *dpy, int *min_w, int *min_h, int *max_w, int *max_h, int *preferred_align);
71 tdm_error tdm_display_get_capture_capabilities(tdm_display *dpy, tdm_capture_capability *capabilities);
72 tdm_error tdm_display_get_catpure_available_formats(tdm_display *dpy, const tbm_format **formats, int *count);
73 tdm_error tdm_display_get_output_count(tdm_display *dpy, int *count);
74 const tdm_output* tdm_display_get_output(tdm_display *dpy, int index, tdm_error *error);
76 tdm_pp* tdm_display_create_pp(tdm_display *dpy, tdm_error *error);
78 ///////////////////////////////////////////////////////////////////////////////
80 tdm_error tdm_output_get_conn_status(tdm_output *output, tdm_output_conn_status *status);
81 tdm_error tdm_output_get_output_type(tdm_output *output, tdm_output_type *type);
82 tdm_error tdm_output_get_layer_count(tdm_output *output, int *count);
83 const tdm_layer* tdm_output_get_layer(tdm_output *output, int index, tdm_error *error);
84 tdm_error tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props, int *count);
85 tdm_error tdm_output_get_available_modes(tdm_output *output, const tdm_output_mode **modes, int *count);
86 tdm_error tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h, int *max_w, int *max_h, int *preferred_align);
87 tdm_error tdm_output_get_physical_size(tdm_output *output, unsigned int *mmWidth, unsigned int *mmHeight);
88 tdm_error tdm_output_get_subpixel(tdm_output *output, unsigned int *subpixel);
89 tdm_error tdm_output_get_pipe(tdm_output *output, unsigned int *pipe);
91 tdm_error tdm_output_set_property(tdm_output *output, unsigned int id, tdm_value value);
92 tdm_error tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value);
93 tdm_error tdm_output_wait_vblank(tdm_output *output, int interval, int sync, tdm_output_vblank_handler func, void *user_data);
94 tdm_error tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func, void *user_data);
96 tdm_error tdm_output_set_mode(tdm_output *output, tdm_output_mode *mode);
97 tdm_error tdm_output_get_mode(tdm_output *output, const tdm_output_mode **mode);
99 tdm_error tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value);
100 tdm_error tdm_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value);
102 tdm_capture *tdm_output_create_capture(tdm_output *output, tdm_error *error);
104 ///////////////////////////////////////////////////////////////////////////////
106 tdm_error tdm_layer_get_capabilities(tdm_layer *layer, tdm_layer_capability *capabilities);
107 tdm_error tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats, int *count);
108 tdm_error tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props, int *count);
109 tdm_error tdm_layer_get_zpos(tdm_layer *layer, unsigned int *zpos); /* zpos of layer is fixed */
111 tdm_error tdm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
112 tdm_error tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
113 tdm_error tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info);
114 tdm_error tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info);
115 tdm_error tdm_layer_set_buffer(tdm_layer *layer, tdm_buffer *buffer); // layer has only one buffer
116 tdm_error tdm_layer_unset_buffer(tdm_layer *layer);
117 tdm_error tdm_layer_is_usable(tdm_layer *layer, unsigned int *usable);
119 tdm_capture *tdm_layer_create_capture(tdm_layer *layer, tdm_error *error);
121 ///////////////////////////////////////////////////////////////////////////////
123 void tdm_pp_destroy(tdm_pp *pp);
124 tdm_error tdm_pp_set_info(tdm_pp *pp, tdm_info_pp *info);
125 tdm_error tdm_pp_attach(tdm_pp *pp, tdm_buffer *src, tdm_buffer *dst);
126 tdm_error tdm_pp_commit(tdm_pp *pp);
128 ///////////////////////////////////////////////////////////////////////////////
130 void tdm_capture_destroy(tdm_capture *capture);
131 tdm_error tdm_capture_set_info(tdm_capture *capture, tdm_info_capture *info);
132 tdm_error tdm_capture_attach(tdm_capture *capture, tdm_buffer *buffer);
133 tdm_error tdm_capture_commit(tdm_capture *capture);
135 ///////////////////////////////////////////////////////////////////////////////
137 typedef void (*tdm_buffer_release_handler)(tdm_buffer *buffer, void *user_data);
139 /* not pthread safe */
140 tdm_buffer *tdm_buffer_create(tbm_surface_h buffer, tdm_error *error);
141 tdm_buffer *tdm_buffer_ref(tdm_buffer *buffer, tdm_error *error);
142 void tdm_buffer_unref(tdm_buffer *buffer);
143 tdm_error tdm_buffer_add_release_handler(tdm_buffer *buffer, tdm_buffer_release_handler func, void *user_data);
144 void tdm_buffer_remove_release_handler(tdm_buffer *buffer, tdm_buffer_release_handler func, void *user_data);