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 **************************************************************************/
39 #include <tbm_surface.h>
47 * @brief The header file which defines Enumerations and Structures for frontend and backend.
49 * Both frontend(@ref tdm.h) and backend(@ref tdm_backend.h) header files
50 * include @ref tdm_types.h
53 * #include <tdm.h> //for a frontend user
56 * #include <tdm_backend.h> //for a vendor to implement a backend module
60 #include <tdm_common.h>
63 TDM_EVENT_LOOP_READABLE = (1 << 0),
64 TDM_EVENT_LOOP_WRITABLE = (1 << 1),
65 TDM_EVENT_LOOP_HANGUP = (1 << 2),
66 TDM_EVENT_LOOP_ERROR = (1 << 3),
67 } tdm_event_loop_mask;
70 * @brief The output mode structure
72 typedef struct _tdm_output_mode {
74 unsigned int hdisplay, hsync_start, hsync_end, htotal, hskew;
75 unsigned int vdisplay, vsync_start, vsync_end, vtotal, vscan;
76 unsigned int vrefresh;
79 char name[TDM_NAME_LEN];
83 * @brief The property structure
85 typedef struct _tdm_prop {
87 char name[TDM_NAME_LEN];
92 * @brief The info config structure
94 typedef struct _tdm_info_config {
101 * @brief The layer info structre
103 typedef struct _tdm_info_layer {
104 tdm_info_config src_config;
106 tdm_transform transform;
110 * @brief The hwc window info structure
113 typedef struct _tdm_hwc_window_info {
114 tdm_info_config src_config;
116 tdm_transform transform;
117 } tdm_hwc_window_info;
120 * @brief The pp info structre
122 typedef struct _tdm_info_pp {
123 tdm_info_config src_config;
124 tdm_info_config dst_config;
125 tdm_transform transform;
131 * @brief The capture info structre
133 typedef struct _tdm_info_capture {
134 tdm_info_config dst_config;
135 tdm_transform transform;
136 tdm_capture_type type;
142 * @brief Possible composition types for a given window
147 /** Set by the client for an invisible window. The value by default.
149 * The device ignores windows of this type.
151 TDM_COMPOSITION_NONE = 0,
153 /** The client will composite this window into the client target window
155 * User can choose this type for window to avoid a hardware composition for
158 * User has to set this type for the window which has the TDM_COMPOSITION_CLIENT_CANDIDATE
159 * type. (see the TDM_COMPOSITION_CLIENT_CANDIDATE type)
161 * The device must not request any composition type changes for windows of
164 TDM_COMPOSITION_CLIENT = 1,
166 /* Set by the HWC after tdm_output_hwc_validate().
168 * If the HWC decided that it doesn't want/can't to continue the composition for
169 * the window through a hardware overlay or other similar way it'll change
170 * a type to the TDM_COMPOSITION_CLIENT_CANDIDATE type.
172 * This transition can happen only if the window has the TDM_COMPOSITION_DEVICE
173 * or the TDM_COMPOSITION_VIDEO type already.
175 * If an user changed type of a window from the TDM_COMPOSITION_DEVICE or the
176 * TDM_COMPOSITION_VIDEO type to the the TDM_COMPOSITION_CLIENT type, the type
177 * will be rejected to the TDM_COMPOSITION_CLIENT_CANDIDATE type.
179 * The user has to composite this window itself.
181 * The underlying hardware overlay is owned by this window till a type being
182 * changed to the TDM_COMPOSITION_CLIENT type, but it's not possible to set a
183 * buffer for this window after a type's been changed to the
184 * TDM_COMPOSITION_CLIENT_CANDIDATE type.
186 * This transitional state is used to get rid of blinking at a transition from
187 * the TDM_COMPOSITION_DEVICE/TDM_COMPOSITION_VIDEO type to the
188 * TDM_COMPOSITION_CLIENT type where the hw has to wait till a buffer, which was
189 * on a hw overlay, get composited to the fb_target and only after this happens
190 * unset(or set another window on) this hw overlay.
192 * User has to inform the HWC (the HWC got no way to know when it happens) after a buffer,
193 * which was on a hw overlay, get composited to the fb_target by setting a type of this
194 * window to the TDM_COMPOSITION_CLIENT type, it causes a type of this window being changed
195 * to TDM_COMPOSITION_CLIENT.
197 TDM_COMPOSITION_CLIENT_CANDIDATE = 2,
200 /** Set by the client before tdm_output_hwc_validate().
202 * Upon tdm_output_hwc_validate(), the device may request a change from this type to
203 * TDM_COMPOSITION_DEVICE or TDM_COMPOSITION_CLIENT. */
204 TDM_COMPOSITION_DEVICE_CANDIDATE = 3,
206 /** Set by the HWC after tdm_output_hwc_validate().
208 * The device will handle the composition of this window through a hardware
209 * overlay or other similar means.
211 * Upon tdm_output_hwc_validate(), the device may request a change from this type to
212 * TDM_COMPOSITION_CLIENT or TDM_COMPOSITION_DEVICE_CANDIDATE. */
213 TDM_COMPOSITION_DEVICE = 4,
215 /** Similar to DEVICE, but the position of this layer may also be set
216 * asynchronously through layer_set_cursor_position. If this functionality is not
217 * supported on a layer that the client sets to TDM_COMPOSITION_CURSOR, the
218 * device must request that the composition type of that layer is changed to
219 * TDM_COMPOSITION_CLIENT upon the next call to tdm_output_hwc_validate().
221 * Upon tdm_output_hwc_validate(), the device may request a change from this type to
222 * either TDM_COMPOSITION_DEVICE or TDM_COMPOSITION_CLIENT. Changing to
223 * TDM_COMPOSITION_DEVICE will prevent the use of layer_set_cursor_position but
224 * still permit the device to composite the layer. */
225 TDM_COMPOSITION_CURSOR = 5,
227 /** The device will handle the composition of this layer through a hardware
228 * overlay or other similar means.
230 * Upon tdm_output_hwc_validate(), the device may request a change from this type to
231 * either TDM_COMPOSITION_DEVICE or TDM_COMPOSITION_CLIENT, but it is
232 * unlikely that content will display correctly in these cases. */
233 TDM_COMPOSITION_VIDEO = 6,
234 } tdm_hwc_window_composition;
237 * @brief The tdm display object
239 typedef void tdm_display;
242 * @brief The tdm output object
244 typedef void tdm_output;
247 * @brief The tdm layer object
249 typedef void tdm_layer;
252 * @brief The tdm window object
255 typedef void tdm_hwc_window;
258 * @brief The tdm capture object
260 typedef void tdm_capture;
263 * @brief The tdm pp object
268 * @brief The tdm vblank object
270 typedef void tdm_vblank;
273 * @brief The vblank handler
274 * @see output_set_vblank_handler() function of #tdm_func_display
276 typedef void (*tdm_output_vblank_handler)(tdm_output *output, unsigned int sequence,
277 unsigned int tv_sec, unsigned int tv_usec,
281 * @brief The output commit handler
282 * @see output_set_commit_handler() function of #tdm_func_display
284 typedef void (*tdm_output_commit_handler)(tdm_output *output, unsigned int sequence,
285 unsigned int tv_sec, unsigned int tv_usec,
289 * @brief The layer commit handler
291 typedef void (*tdm_layer_commit_handler)(tdm_layer *layer, unsigned int sequence,
292 unsigned int tv_sec, unsigned int tv_usec,
296 * @brief The done handler of a pp object
298 typedef void (*tdm_pp_done_handler)(tdm_pp *pp, tbm_surface_h src,
299 tbm_surface_h dst, void *user_data);
302 * @brief The done handler of a capture object
304 typedef void (*tdm_capture_done_handler)(tdm_capture *capture,
305 tbm_surface_h buffer, void *user_data);
308 * @brief The 'need to validate' handler of an output object
311 typedef void (*tdm_output_need_validate_handler)(tdm_output *output);
317 #endif /* _TDM_TYPES_H_ */