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 <boram1288.park@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>
41 #include "tdm_common.h"
49 * @brief The header file which defines Enumerations and Structures for frontend and backend.
51 * Both frontend(@ref tdm.h) and backend(@ref tdm_backend.h) header files
52 * include @ref tdm_types.h
55 * #include <tdm.h> //for a frontend user
58 * #include <tdm_backend.h> //for a vendor to implement a backend module
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 display capability enumeration
73 TDM_DISPLAY_CAPABILITY_PP = (1 << 0), /**< if hardware supports pp operation */
74 TDM_DISPLAY_CAPABILITY_CAPTURE = (1 << 1), /**< if hardware supports capture operation */
75 } tdm_display_capability;
78 * @brief The output mode structure
80 typedef struct _tdm_output_mode {
82 unsigned int hdisplay, hsync_start, hsync_end, htotal, hskew;
83 unsigned int vdisplay, vsync_start, vsync_end, vtotal, vscan;
84 unsigned int vrefresh;
87 char name[TDM_NAME_LEN];
91 * @brief The property structure
93 typedef struct _tdm_prop {
95 char name[TDM_NAME_LEN];
100 * @brief The info config structure
102 typedef struct _tdm_info_config {
109 * @brief The layer info structre
111 typedef struct _tdm_info_layer {
112 tdm_info_config src_config;
114 tdm_transform transform;
118 * @brief The region structure
121 typedef struct _tdm_region {
122 unsigned int num_rects;
123 tdm_pos const *rects;
127 * @brief The hwc window info structure
130 typedef struct _tdm_hwc_window_info {
131 tdm_info_config src_config;
133 tdm_transform transform;
134 } tdm_hwc_window_info;
137 * @brief The pp info structre
139 typedef struct _tdm_info_pp {
140 tdm_info_config src_config;
141 tdm_info_config dst_config;
142 tdm_transform transform;
148 * @brief The capture info structre
150 typedef struct _tdm_info_capture {
151 tdm_info_config dst_config;
152 tdm_transform transform;
153 tdm_capture_type type;
159 * @brief Possible composition types for a given window
164 /** The composition type for an invisible window. The value by default.
166 * The backend ignores windows of this type.
168 TDM_HWC_WIN_COMPOSITION_NONE = 0,
170 /** The compostion type for an window to be compsoited by the client.
172 * When the client sets this composition type,
173 * the backend MUST NOT modify this composition type into other types.
175 * When the backend changes TDM_HWC_WIN_COMPOSITION_DEVICE or TDM_HWC_WIN_COMPOSITION_CURSOR
176 * to this composition type at the time of tdm_hwc_validate and
177 * tdm_hwc_get_changed_composition_types,
178 * the client has to composite this window with gl or other drawing operations.
180 TDM_HWC_WIN_COMPOSITION_CLIENT = 1,
182 /** The compostion type for an window to be set to the hw overlay.
184 * The client sets this composition type to the visible windows before requesting
185 * the tdm_hwc_validate.
186 * Nomally, the backend leave it if the backend sets the window to the hw overlay.
187 * If the backend does not set the window to the hw overlay at the time of
188 * tdm_hwc_validate, the backend changes the composition type of the window into
189 * TDM_HWC_WIN_COMPOSITION_CLIENT.
191 TDM_HWC_WIN_COMPOSITION_DEVICE = 3,
193 /** The compostion type for an window to be set to the cursor hw overlay.
195 * The client sets this composition type to the cursor window before requesting
196 * the tdm_hwc_validate.
197 * If the backend does not support the cursor hw overlay, the backend can change
198 * the comopsition type into the TDM_HWC_WIN_COMPOSITION_CLIENT.
200 TDM_HWC_WIN_COMPOSITION_CURSOR = 4,
202 /** The compostion type for an window to be set to the video hw overlay.
204 * The client sets this composition type to the video window before requesting
205 * the tdm_hwc_validate.
206 * If the backend does not support the video hw overlay, the backend can change
207 * the comopsition type into the TDM_HWC_WIN_COMPOSITION_CLIENT.
208 * Normally, this VIDEO window displays under the primary hw overlayer of the output.
210 TDM_HWC_WIN_COMPOSITION_VIDEO = 5,
211 } tdm_hwc_window_composition;
214 TDM_HWC_WIN_CONSTRAINT_NONE = 0,
215 /** If the client needs to render to a specific buffer for compositing
216 * with TDM_HWC_WIN_COMPOSITION_DEVICE, the backend needs to set
217 * TDM_HWC_WIN_CONSTRAINT_BUFFER_QUEUE to hwc_window until the hwc_window is not
218 * TDM_HWC_WIN_COMPOSITION_DEVICE. The client gets the tbm_surface_queue_h through
219 * the tdm_hwc_window_aquire_buffer_queue. It will render the frames on
220 * the buffers which gets from the tbm_surface_queue_h.
222 TDM_HWC_WIN_CONSTRAINT_BUFFER_QUEUE = (1 << 0),
223 } tdm_hwc_window_constraint;
226 * @brief The tdm display object
228 typedef void tdm_display;
231 * @brief The tdm backend object
233 typedef void tdm_module;
236 * @brief The tdm output object
238 typedef void tdm_output;
241 * @brief The tdm voutput object
243 typedef void tdm_voutput;
246 * @brief The tdm layer object
248 typedef void tdm_layer;
251 * @brief The tdm hwc object
254 typedef void tdm_hwc;
257 * @brief The tdm hwc window object
260 typedef void tdm_hwc_window;
263 * @brief The tdm capture object
265 typedef void tdm_capture;
268 * @brief The tdm pp object
273 * @brief The tdm vblank object
275 typedef void tdm_vblank;
278 * @brief The output create handler
279 * @details This handler will be called when the output object is
280 * createed in runtime.
282 typedef void (*tdm_output_create_handler)(tdm_display *dpy, tdm_output *output, void *user_data);
285 * @brief The output destroy handler
286 * @details This handler will be called when the output object is
287 * destroied in runtime.
289 typedef void (*tdm_output_destroy_handler)(tdm_output *output, void *user_data);
292 * @brief The output change handler
293 * @details This handler will be called when the status of a output object is
294 * changed in runtime.
296 typedef void (*tdm_output_change_handler)(tdm_output *output,
297 tdm_output_change_type type,
302 * @brief The vblank handler
303 * @see output_set_vblank_handler() function of #tdm_func_display
305 typedef void (*tdm_output_vblank_handler)(tdm_output *output, unsigned int sequence,
306 unsigned int tv_sec, unsigned int tv_usec,
310 * @brief The output commit handler
311 * @see output_set_commit_handler() function of #tdm_func_display
313 typedef void (*tdm_output_commit_handler)(tdm_output *output, unsigned int sequence,
314 unsigned int tv_sec, unsigned int tv_usec,
318 * @brief The output mode change request handler
320 typedef void (*tdm_output_mode_change_request_handler)(tdm_output *output,
321 unsigned int index, void *user_data);
324 * @brief The layer commit handler
326 typedef void (*tdm_layer_commit_handler)(tdm_layer *layer, unsigned int sequence,
327 unsigned int tv_sec, unsigned int tv_usec,
331 * @brief The done handler of a pp object
333 typedef void (*tdm_pp_done_handler)(tdm_pp *pp, tbm_surface_h src,
334 tbm_surface_h dst, void *user_data);
337 * @brief The done handler of a capture object
339 typedef void (*tdm_capture_done_handler)(tdm_capture *capture,
340 tbm_surface_h buffer, void *user_data);
343 * @brief The create handler of a vblank object
345 typedef void (*tdm_vblank_create_handler)(tdm_vblank *vblank, void *user_data);
348 * @brief The hwc commit handler
349 * @see hwc_set_commit_handler() function of #tdm_func_hwc
351 typedef void (*tdm_hwc_commit_handler)(tdm_hwc *hwc, unsigned int sequence,
352 unsigned int tv_sec, unsigned int tv_usec,
355 typedef void (*tdm_voutput_commit_handler)(tdm_voutput *voutput, unsigned int sequence,
356 unsigned int tv_sec, unsigned int tv_usec,
359 typedef void (*tdm_voutput_commit_func)(tdm_voutput *voutput, tbm_surface_h buffer);
364 #endif /* _TDM_TYPES_H_ */