48ca3e2e8d49343aaa82061e1f509e5d3becc3b9
[platform/hal/api/tdm.git] / include / hal-tdm-types.h
1 /**************************************************************************
2  *
3  * hal-api-tdm
4  *
5  * Copyright 2021 Samsung Electronics co., Ltd. All Rights Reserved.
6  *
7  * Contact: SooChan Lim <sc1.lim@samsung.com>,
8  *          Junkyeong Kim <jk0430.kim@samsung.com>,
9  *          Shawn Lee <shiin.lee@samsung.com>,
10  *          Changyeon Lee <cyeon.lee@samsung.com>,
11  *          Joonbum Ko <joonbum.ko@samsung.com>
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the
15  * "Software"), to deal in the Software without restriction, including
16  * without limitation the rights to use, copy, modify, merge, publish,
17  * distribute, sub license, and/or sell copies of the Software, and to
18  * permit persons to whom the Software is furnished to do so, subject to
19  * the following conditions:
20  *
21  * The above copyright notice and this permission notice (including the
22  * next paragraph) shall be included in all copies or substantial portions
23  * of the Software.
24  *
25  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
28  * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
29  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
30  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
31  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32  *
33 **************************************************************************/
34
35 #ifndef __HAL_TDM_TYPES_H__
36 #define __HAL_TDM_TYPES_H__
37
38 #include <stdint.h>
39 #include <tbm_surface.h>
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 /**
46  * @file hal-tdm-types.h
47  * @brief The header file which defines Enumerations and Structures for frontend and backend.
48  * @details
49  * Both frontend(@ref hal-tdm.h) and backend(@ref hal-tdm-interface.h) header files
50  * include @ref hal-tdm-types.h
51  * @par Example
52  * @code
53  * #include <hal-tdm.h>    //for a frontend user
54  * @endcode
55  * @code
56  * #include <hal-tdm_interface.h>  //for a vendor to implement a backend module
57  * @endcode
58  */
59
60 #define HAL_TDM_NAME_LEN        64
61 #define HAL_TDM_PATH_LEN        1024
62 #define HAL_TDM_VBLANK_DEFAULT_NAME   "Unknown"
63 #define HAL_TDM_EVENT_SOURCE_MAX 3
64
65 /**
66  * @brief The error enumeration
67  */
68 typedef enum {
69         HAL_TDM_ERROR_NONE                  = 0,  /**< none */
70         HAL_TDM_ERROR_BAD_REQUEST           = -1, /**< bad request */
71         HAL_TDM_ERROR_OPERATION_FAILED      = -2, /**< operaion failed */
72         HAL_TDM_ERROR_INVALID_PARAMETER     = -3, /**< wrong input parameter */
73         HAL_TDM_ERROR_PERMISSION_DENIED     = -4, /**< access denied */
74         HAL_TDM_ERROR_BUSY                  = -5, /**< hardware resource busy */
75         HAL_TDM_ERROR_OUT_OF_MEMORY         = -6, /**< no free memory */
76         HAL_TDM_ERROR_BAD_MODULE            = -7, /**< bad backend module */
77         HAL_TDM_ERROR_NOT_IMPLEMENTED       = -8, /**< not implemented */
78         HAL_TDM_ERROR_NO_CAPABILITY         = -9, /**< no capability */
79         HAL_TDM_ERROR_DPMS_OFF              = -10, /**< dpms off */
80         HAL_TDM_ERROR_OUTPUT_DISCONNECTED   = -11, /**< output disconnected */
81         HAL_TDM_ERROR_PROTOCOL_ERROR        = -12, /**< protocol error */
82         HAL_TDM_ERROR_TIMEOUT               = -13, /**< timeout */
83         HAL_TDM_ERROR_NO_MODULE             = -14, /**< no backend module */
84 } hal_tdm_error;
85
86 /**
87  * @brief The transform enumeration(rotate, flip)
88  */
89 typedef enum {
90         HAL_TDM_TRANSFORM_NORMAL            = 0, /**< no transform */
91         HAL_TDM_TRANSFORM_90                = 1, /**< rotate 90 degrees clockwise */
92         HAL_TDM_TRANSFORM_180               = 2, /**< rotate 180 degrees clockwise */
93         HAL_TDM_TRANSFORM_270               = 3, /**< rotate 270 degrees clockwise */
94         HAL_TDM_TRANSFORM_FLIPPED           = 4, /**< no rotate and horizontal flip */
95         HAL_TDM_TRANSFORM_FLIPPED_90        = 5, /**< rotate 90 degrees clockwise and horizontal flip */
96         HAL_TDM_TRANSFORM_FLIPPED_180       = 6, /**< rotate 180 degrees clockwise and horizontal flip */
97         HAL_TDM_TRANSFORM_FLIPPED_270       = 7, /**< rotate 270 degrees clockwise and horizontal flip */
98 } hal_tdm_transform;
99
100 /**
101  * @brief The output capability enumeration
102  * @details
103  * If a backend module provides #HAL_TDM_OUTPUT_CAPABILITY_EXTENDED_DPMS, we can set
104  * an extended DPMS mode to an output which a backend module supports.
105  * Don't use the low-4bit for an extended DPMS mode value. It's used for default
106  * DPMS modes.
107  */
108 typedef enum {
109         HAL_TDM_OUTPUT_CAPABILITY_ASYNC_DPMS         = (1 << 0), /**< if a outupt supports asynchronous DPMS operation */
110         HAL_TDM_OUTPUT_CAPABILITY_HWC                = (1 << 1), /**< if a outupt supports hwc operation @since 2.0.0*/
111         HAL_TDM_OUTPUT_CAPABILITY_EXTENDED_DPMS      = (1 << 2), /**< if a outupt supports extended DPMS operation @since 2.0.0 */
112         HAL_TDM_OUTPUT_CAPABILITY_MIRROR             = (1 << 3), /**< if a outupt supports the displying mirror image of the src_output @since 2.9.0 */
113 } hal_tdm_output_capability;
114
115 /**
116  * @brief The pp capability enumeration
117  * @details The scale, transform and CSC functionalities seem the default functions of PP.
118  * If hardware device doesn't support one of them, we'd better let a developer know
119  * what a backend doesn't support like TDM_PP_CAPABILITY_NO_CSC.
120  */
121 typedef enum {
122         HAL_TDM_PP_CAPABILITY_SYNC                  = (1 << 0), /**< The pp device supports synchronous operation */
123         HAL_TDM_PP_CAPABILITY_ASYNC                 = (1 << 1), /**< The pp device supports asynchronous operation */
124         HAL_TDM_PP_CAPABILITY_SCANOUT               = (1 << 4), /**< The pp device supports only scanout buffer */
125         HAL_TDM_PP_CAPABILITY_NO_CSC                = (1 << 5), /**< The pp device doesn't support Color Space Conversion */
126         HAL_TDM_PP_CAPABILITY_NO_TRANSFORM_ROTATION = (1 << 6), /**< The pp device doesn't support rotation transform */
127 } hal_tdm_pp_capability;
128
129 /**
130  * @brief The capture capability enumeration
131  * @details The scale, transform and CSC functionalities seem the default functions of capture.
132  * If hardware device doesn't support one of them, we'd better let a developer know
133  * what a backend doesn't support like TDM_PP_CAPABILITY_NO_CSC.
134  */
135 typedef enum {
136         HAL_TDM_CAPTURE_CAPABILITY_OUTPUT    = (1 << 0), /**< The capture device supports to dump a output */
137         HAL_TDM_CAPTURE_CAPABILITY_LAYER     = (1 << 1), /**< The capture device supports to dump a layer */
138         HAL_TDM_CAPTURE_CAPABILITY_ONESHOT   = (1 << 4), /**< The capture device supports oneshot dump */
139         HAL_TDM_CAPTURE_CAPABILITY_STREAM    = (1 << 5), /**< The capture device supports streamp sump */
140 } hal_tdm_capture_capability;
141
142 /**
143  * @brief The capture type enumeration
144  */
145 typedef enum {
146         HAL_TDM_CAPTURE_TYPE_ONESHOT    = (1 << 0), /**< The oneshot capture */
147         HAL_TDM_CAPTURE_TYPE_STREAM     = (1 << 1), /**< The stream capture */
148 } hal_tdm_capture_type;
149
150 /**
151  * @brief The output change enumeration of #tdm_output_change_handler
152  */
153 typedef enum {
154         HAL_TDM_OUTPUT_CHANGE_CONNECTION    = (1 << 0), /**< connection chagne */
155         HAL_TDM_OUTPUT_CHANGE_DPMS          = (1 << 1), /**< dpms change */
156 } hal_tdm_output_change_type;
157
158 /**
159  * @brief The output connection status enumeration
160  */
161 typedef enum {
162         HAL_TDM_OUTPUT_CONN_STATUS_DISCONNECTED, /**< output disconnected */
163         HAL_TDM_OUTPUT_CONN_STATUS_CONNECTED,    /**< output connected */
164         HAL_TDM_OUTPUT_CONN_STATUS_MODE_SETTED,  /**< output connected and setted a mode */
165 } hal_tdm_output_conn_status;
166
167 /**
168  * @brief The output connection status enumeration
169  * @details bit compatible with the libdrm definitions.
170  */
171 typedef enum {
172         HAL_TDM_OUTPUT_TYPE_Unknown,        /**< unknown */
173         HAL_TDM_OUTPUT_TYPE_VGA,            /**< VGA connection */
174         HAL_TDM_OUTPUT_TYPE_DVII,           /**< DVII connection */
175         HAL_TDM_OUTPUT_TYPE_DVID,           /**< DVID connection */
176         HAL_TDM_OUTPUT_TYPE_DVIA,           /**< DVIA connection */
177         HAL_TDM_OUTPUT_TYPE_Composite,      /**< Composite connection */
178         HAL_TDM_OUTPUT_TYPE_SVIDEO,         /**< SVIDEO connection */
179         HAL_TDM_OUTPUT_TYPE_LVDS,           /**< LVDS connection */
180         HAL_TDM_OUTPUT_TYPE_Component,      /**< Component connection */
181         HAL_TDM_OUTPUT_TYPE_9PinDIN,        /**< 9PinDIN connection */
182         HAL_TDM_OUTPUT_TYPE_DisplayPort,    /**< DisplayPort connection */
183         HAL_TDM_OUTPUT_TYPE_HDMIA,          /**< HDMIA connection */
184         HAL_TDM_OUTPUT_TYPE_HDMIB,          /**< HDMIB connection */
185         HAL_TDM_OUTPUT_TYPE_TV,             /**< TV connection */
186         HAL_TDM_OUTPUT_TYPE_eDP,            /**< eDP connection */
187         HAL_TDM_OUTPUT_TYPE_VIRTUAL,        /**< Virtual connection for WiFi Display */
188         HAL_TDM_OUTPUT_TYPE_DSI,            /**< DSI connection */
189 } hal_tdm_output_type;
190
191 /**
192  * @brief The DPMS enumeration
193  * @details bit compatible with the libdrm definitions.
194  */
195 typedef enum {
196         HAL_TDM_OUTPUT_DPMS_ON,         /**< On, Vsync On */
197         HAL_TDM_OUTPUT_DPMS_STANDBY,    /**< StandBy, Vsync On */
198         HAL_TDM_OUTPUT_DPMS_SUSPEND,    /**< Suspend, Vsync Off */
199         HAL_TDM_OUTPUT_DPMS_OFF,        /**< Off, Vsync Off */
200         HAL_TDM_OUTPUT_DPMS_AOD = 0x10, /**< AOD, Vsync On, extended DPMS mode */
201 } hal_tdm_output_dpms;
202
203 /**
204  * @brief The output mode type enumeration
205  * @details bit compatible with the libdrm definitions.
206  */
207 typedef enum {
208         HAL_TDM_OUTPUT_MODE_TYPE_BUILTIN    = (1 << 0),
209         HAL_TDM_OUTPUT_MODE_TYPE_CLOCK_C    = ((1 << 1) | HAL_TDM_OUTPUT_MODE_TYPE_BUILTIN),
210         HAL_TDM_OUTPUT_MODE_TYPE_CRTC_C     = ((1 << 2) | HAL_TDM_OUTPUT_MODE_TYPE_BUILTIN),
211         HAL_TDM_OUTPUT_MODE_TYPE_PREFERRED  = (1 << 3),
212         HAL_TDM_OUTPUT_MODE_TYPE_DEFAULT    = (1 << 4),
213         HAL_TDM_OUTPUT_MODE_TYPE_USERDEF    = (1 << 5),
214         HAL_TDM_OUTPUT_MODE_TYPE_DRIVER     = (1 << 6),
215 } hal_tdm_output_mode_type;
216
217 /**
218  * @brief The output mode flag enumeration
219  * @details bit compatible with the libdrm definitions.
220  */
221 typedef enum {
222         HAL_TDM_OUTPUT_MODE_FLAG_PHSYNC     = (1 << 0),
223         HAL_TDM_OUTPUT_MODE_FLAG_NHSYNC     = (1 << 1),
224         HAL_TDM_OUTPUT_MODE_FLAG_PVSYNC     = (1 << 2),
225         HAL_TDM_OUTPUT_MODE_FLAG_NVSYNC     = (1 << 3),
226         HAL_TDM_OUTPUT_MODE_FLAG_INTERLACE  = (1 << 4),
227         HAL_TDM_OUTPUT_MODE_FLAG_DBLSCAN    = (1 << 5),
228         HAL_TDM_OUTPUT_MODE_FLAG_CSYNC      = (1 << 6),
229         HAL_TDM_OUTPUT_MODE_FLAG_PCSYNC     = (1 << 7),
230         HAL_TDM_OUTPUT_MODE_FLAG_NCSYNC     = (1 << 8),
231         HAL_TDM_OUTPUT_MODE_FLAG_HSKEW      = (1 << 9), /* hskew provided */
232         HAL_TDM_OUTPUT_MODE_FLAG_BCAST      = (1 << 10),
233         HAL_TDM_OUTPUT_MODE_FLAG_PIXMUX     = (1 << 11),
234         HAL_TDM_OUTPUT_MODE_FLAG_DBLCLK     = (1 << 12),
235         HAL_TDM_OUTPUT_MODE_FLAG_CLKDIV2    = (1 << 13),
236 } hal_tdm_output_mode_flag;
237
238 /*
239  * @brief The hwc video capability enumeration
240  * @since 2.7.0
241  */
242 typedef enum {
243         HAL_TDM_HWC_CAPABILITY_VIDEO_STREAM         = (1 << 1), /**< if a hwc has video stream capability  */
244         HAL_TDM_HWC_CAPABILITY_VIDEO_SCALE          = (1 << 2), /**< if a hwc allows to scale the video buffer  */
245         HAL_TDM_HWC_CAPABILITY_VIDEO_TRANSFORM      = (1 << 3), /**< if a hwc allows video to transform the video buffer  */
246         HAL_TDM_HWC_CAPABILITY_VIDEO_SCANOUT        = (1 << 4), /**< if a hwc allows video to accept the scanout buffer only */
247         HAL_TDM_HWC_CAPABILITY_FENCE                = (1 << 5), /**< if a hwc allows fence */
248 } hal_tdm_hwc_capability;
249
250 /**
251  * @brief The size structure
252  */
253 typedef struct _hal_tdm_size {
254         unsigned int h;     /**< width */
255         unsigned int v;     /**< height */
256 } hal_tdm_size;
257
258 /**
259  * @brief The pos structure
260  */
261 typedef struct _hal_tdm_pos {
262         unsigned int x;
263         unsigned int y;
264         unsigned int w;
265         unsigned int h;
266 } hal_tdm_pos;
267
268 /**
269  * @brief The tdm value type enumeration
270  */
271 typedef enum {
272         HAL_TDM_VALUE_TYPE_UNKNOWN,
273         HAL_TDM_VALUE_TYPE_PTR,
274         HAL_TDM_VALUE_TYPE_INT32,
275         HAL_TDM_VALUE_TYPE_UINT32,
276         HAL_TDM_VALUE_TYPE_INT64,
277         HAL_TDM_VALUE_TYPE_UINT64,
278 } hal_tdm_value_type;
279
280 /**
281  * @brief The value union
282  */
283 typedef union {
284         void     *ptr;
285         int32_t  s32;
286         uint32_t u32;
287         int64_t  s64;
288         uint64_t u64;
289 } hal_tdm_value;
290
291 typedef enum {
292         HAL_TDM_EVENT_LOOP_READABLE = (1 << 0),
293         HAL_TDM_EVENT_LOOP_WRITABLE = (1 << 1),
294         HAL_TDM_EVENT_LOOP_HANGUP   = (1 << 2),
295         HAL_TDM_EVENT_LOOP_ERROR    = (1 << 3),
296 } hal_tdm_event_loop_mask;
297
298 /**
299  * @brief The display capability enumeration
300  */
301 typedef enum {
302         HAL_TDM_DISPLAY_CAPABILITY_PP       = (1 << 0), /**< if hardware supports pp operation */
303         HAL_TDM_DISPLAY_CAPABILITY_CAPTURE  = (1 << 1), /**< if hardware supports capture operation */
304 } hal_tdm_display_capability;
305
306 /**
307  * @brief The display capability enumeration
308  */
309 typedef struct _hal_tdm_caps_display {
310         int max_layer_count;    /**< The maximum layer count */
311 } hal_tdm_caps_display;
312
313 /**
314  * @brief The output mode structure
315  */
316 typedef struct _hal_tdm_output_mode {
317         unsigned int clock;
318         unsigned int hdisplay, hsync_start, hsync_end, htotal, hskew;
319         unsigned int vdisplay, vsync_start, vsync_end, vtotal, vscan;
320         unsigned int vrefresh;
321         unsigned int flags;
322         unsigned int type;
323         char name[HAL_TDM_NAME_LEN];
324 } hal_tdm_output_mode;
325
326 /**
327  * @brief The property structure
328  */
329 typedef struct _hal_tdm_prop {
330         unsigned int id;
331         char name[HAL_TDM_NAME_LEN];
332         hal_tdm_value_type type;
333 } hal_tdm_prop;
334
335 /**
336  * @brief The info config structure
337  */
338 typedef struct _hal_tdm_info_config {
339         hal_tdm_size size;
340         hal_tdm_pos pos;
341         tbm_format format;
342 } hal_tdm_info_config;
343
344 /**
345  * @brief The region structure
346  */
347 typedef struct _hal_tdm_region {
348         unsigned int num_rects;
349         hal_tdm_pos const *rects;
350 } hal_tdm_region;
351
352 /**
353  * @brief The hwc window info structure
354  */
355 typedef struct _hal_tdm_hwc_window_info {
356         hal_tdm_info_config src_config;
357         hal_tdm_pos dst_pos;
358         hal_tdm_transform transform;
359 } hal_tdm_hwc_window_info;
360
361 /**
362  * @brief The pp info structre
363  */
364 typedef struct _hal_tdm_info_pp {
365         hal_tdm_info_config src_config;
366         hal_tdm_info_config dst_config;
367         hal_tdm_transform transform;
368         int sync;
369         int flags;
370 } hal_tdm_info_pp;
371
372 /**
373  * @brief The capture info structre
374  */
375 typedef struct _hal_tdm_info_capture {
376         hal_tdm_info_config dst_config;
377         hal_tdm_transform transform;
378         hal_tdm_capture_type type;
379         int frequency;
380         int flags;
381 } hal_tdm_info_capture;
382
383 /**
384  * @brief Possible composition types for a given window
385  */
386 typedef enum {
387
388         /** The composition type for an invisible window. The value by default.
389          *
390          * The backend ignores windows of this type.
391          */
392         HAL_TDM_HWC_WIN_COMPOSITION_NONE = 0,
393
394         /** The compostion type for an window to be compsoited by the client.
395          *
396          * When the client sets this composition type,
397          * the backend MUST NOT modify this composition type into other types.
398          *
399          * When the backend changes TDM_HWC_WIN_COMPOSITION_DEVICE or TDM_HWC_WIN_COMPOSITION_CURSOR
400          * to this composition type at the time of tdm_hwc_validate and
401          * tdm_hwc_get_changed_composition_types,
402          * the client has to composite this window with gl or other drawing operations.
403          */
404         HAL_TDM_HWC_WIN_COMPOSITION_CLIENT = 1,
405
406         /** The compostion type for an window to be set to the hw overlay.
407          *
408          * The client sets this composition type to the visible windows before requesting
409          * the tdm_hwc_validate.
410          * Nomally, the backend leave it if the backend sets the window to the hw overlay.
411          * If the backend does not set the window to the hw overlay at the time of
412          * tdm_hwc_validate, the backend changes the composition type of the window into
413          * TDM_HWC_WIN_COMPOSITION_CLIENT.
414          */
415         HAL_TDM_HWC_WIN_COMPOSITION_DEVICE = 3,
416
417         /** The compostion type for an window to be set to the cursor hw overlay.
418          *
419          * The client sets this composition type to the cursor window before requesting
420          * the tdm_hwc_validate.
421          * If the backend does not support the cursor hw overlay, the backend can change
422          * the comopsition type into the TDM_HWC_WIN_COMPOSITION_CLIENT.
423          */
424         HAL_TDM_HWC_WIN_COMPOSITION_CURSOR = 4,
425
426         /** The compostion type for an window to be set to the video hw overlay.
427          *
428          * The client sets this composition type to the video window before requesting
429          * the tdm_hwc_validate.
430          * If the backend does not support the video hw overlay, the backend can change
431          * the comopsition type into the TDM_HWC_WIN_COMPOSITION_CLIENT.
432          * Normally, this VIDEO window displays under the primary hw overlayer of the output.
433          */
434         HAL_TDM_HWC_WIN_COMPOSITION_VIDEO = 5,
435 } hal_tdm_hwc_window_composition;
436
437 typedef enum {
438         HAL_TDM_HWC_WIN_CONSTRAINT_NONE = 0,
439         /** If the client needs to render to a specific buffer for compositing
440          *  with TDM_HWC_WIN_COMPOSITION_DEVICE, the backend needs to set
441          *  TDM_HWC_WIN_CONSTRAINT_BUFFER_QUEUE to hwc_window until the hwc_window is not
442          *  TDM_HWC_WIN_COMPOSITION_DEVICE. The client gets the tbm_surface_queue_h through
443          *  the tdm_hwc_window_aquire_buffer_queue. It will render the frames on
444          *  the buffers which gets from the tbm_surface_queue_h.
445          */
446         HAL_TDM_HWC_WIN_CONSTRAINT_BUFFER_QUEUE = (1 << 0),
447 } hal_tdm_hwc_window_constraint;
448
449 typedef enum {
450         HAL_TDM_HWC_COMMIT_INTERVAL_NONE = 0,
451         /** If this interval is set by tdm backend, the compositor call commit per vblank
452          *  even if the handler of commit isn't called.
453          */
454         HAL_TDM_HWC_COMMIT_INTERVAL_VBLANK = 1,
455 } hal_tdm_hwc_commit_interval;
456
457 /**
458  * @brief The tdm fd
459  */
460 typedef int hal_tdm_fd;
461
462 /**
463  * @brief The tdm display object
464  */
465 typedef void hal_tdm_display;
466
467 /**
468  * @brief The tdm backend object
469  */
470 typedef void hal_tdm_module;
471
472 /**
473  * @brief The tdm output object
474  */
475 typedef void hal_tdm_output;
476
477 /**
478  * @brief The tdm voutput object
479  */
480 typedef void hal_tdm_voutput;
481
482 /**
483  * @brief The tdm hwc object
484  */
485 typedef void hal_tdm_hwc;
486
487 /**
488  * @brief The tdm hwc window object
489  */
490 typedef void hal_tdm_hwc_window;
491
492 /**
493  * @brief The tdm capture object
494  */
495 typedef void hal_tdm_capture;
496
497 /**
498  * @brief The tdm pp object
499  */
500 typedef void hal_tdm_pp;
501
502 /**
503  * @brief The tdm vblank object
504  */
505 typedef void hal_tdm_vblank;
506
507 /**
508  * @brief The tdm backend object
509  */
510 typedef void hal_tdm_backend;
511
512 /**
513  * @brief The event_loop_fd handler
514  * @details This handler will be called when the output object is
515  * createed in runtime.
516  */
517 typedef hal_tdm_error (*hal_tdm_event_loop_fd_handler)(int event_fd, hal_tdm_event_loop_mask mask, void *user_data);
518
519 /**
520  * @brief The output create handler
521  * @details This handler will be called when the output object is
522  * createed in runtime.
523  */
524 typedef void (*hal_tdm_output_create_handler)(hal_tdm_display *dpy, hal_tdm_output *output, void *user_data);
525
526 /**
527  * @brief The output destroy handler
528  * @details This handler will be called when the output object is
529  * destroied in runtime.
530  */
531 typedef void (*hal_tdm_output_destroy_handler)(hal_tdm_output *output, void *user_data);
532
533 /**
534  * @brief The output change handler
535  * @details This handler will be called when the status of a output object is
536  * changed in runtime.
537  */
538 typedef void (*hal_tdm_output_change_handler)(hal_tdm_output *output,
539                                                                                           hal_tdm_output_change_type type,
540                                                                                           hal_tdm_value value,
541                                                                                           void *user_data);
542
543 /**
544  * @brief The vblank handler
545  * @see output_set_vblank_handler() function of #hal_tdm_display_funcs
546  */
547 typedef void (*hal_tdm_output_vblank_handler)(hal_tdm_output *output, unsigned int sequence,
548                                                                                           unsigned int tv_sec, unsigned int tv_usec,
549                                                                                           void *user_data);
550
551 /**
552  * @brief The output commit handler
553  * @see output_set_commit_handler() function of #hal_tdm_display_funcs
554  */
555 typedef void (*hal_tdm_output_commit_handler)(hal_tdm_output *output, unsigned int sequence,
556                                                                                           unsigned int tv_sec, unsigned int tv_usec,
557                                                                                           void *user_data);
558
559 /**
560  * @brief The output mode change request handler
561  */
562 typedef void (*hal_tdm_output_mode_change_request_handler)(hal_tdm_output *output,
563                                                                                                                    unsigned int index, void *user_data);
564
565 /**
566  * @brief The output status handler
567  */
568 typedef void (*hal_tdm_output_status_handler)(hal_tdm_output *output,
569                                                                                           hal_tdm_output_conn_status status, void *user_data);
570
571 /**
572  * @brief The output dpms handler
573  */
574 typedef void (*hal_tdm_output_dpms_handler)(hal_tdm_output *output,
575                                                                                         hal_tdm_output_dpms dpms, void *user_data);
576
577 /**
578  * @brief The done handler of a pp object
579  */
580 typedef void (*hal_tdm_pp_done_handler)(hal_tdm_pp *pp, tbm_surface_h src,
581                                                                                 tbm_surface_h dst, void *user_data);
582
583 /**
584  * @brief The done handler of a capture object
585  */
586 typedef void (*hal_tdm_capture_done_handler)(hal_tdm_capture *capture,
587                                                                                          tbm_surface_h buffer, void *user_data);
588
589 /**
590  * @brief The create handler of a vblank object
591  */
592 typedef void (*hal_tdm_vblank_create_handler)(hal_tdm_vblank *vblank, void *user_data);
593
594 /**
595  * @brief The hwc commit handler
596  * @see hwc_set_commit_handler() function of #hal_tdm_hwc_funcs
597  */
598 typedef void (*hal_tdm_hwc_commit_handler)(hal_tdm_hwc *hwc, unsigned int sequence,
599                                                                                   unsigned int tv_sec, unsigned int tv_usec,
600                                                                                   void *user_data);
601
602 /**
603  * @brief The voutput commit handler
604  */
605 typedef void (*hal_tdm_voutput_commit_handler)(hal_tdm_voutput *voutput, unsigned int sequence,
606                                                                                            unsigned int tv_sec, unsigned int tv_usec,
607                                                                                            void *user_data);
608
609 /**
610  * @brief The voutput commit function
611  */
612 typedef void (*hal_tdm_voutput_commit_func)(hal_tdm_voutput *voutput, tbm_surface_h buffer);
613
614 /**
615  * @brief The event source information
616  */
617 typedef struct _hal_tdm_event_source {
618         int event_fd;
619         hal_tdm_event_loop_fd_handler func;
620         void *user_data;
621 } hal_tdm_event_source;
622
623 typedef struct _hal_tdm_caps_output {
624         char maker[HAL_TDM_NAME_LEN];       /**< The output maker */
625         char model[HAL_TDM_NAME_LEN];       /**< The output model */
626         char name[HAL_TDM_NAME_LEN];        /**< The output name */
627
628         hal_tdm_output_conn_status status;  /**< The connection status */
629         hal_tdm_output_type type;           /**< The connection type */
630         unsigned int type_id;               /**< The connection type id */
631
632         unsigned int mode_count;            /**< The count of available modes */
633         hal_tdm_output_mode *modes;         /**< The @b newly-allocated array of modes. will be freed in frontend. */
634
635         unsigned int prop_count;            /**< The count of available properties */
636         hal_tdm_prop *props;                /**< The @b newly-allocated array of properties. will be freed in frontend. */
637
638         unsigned int mmWidth;           /**< The physical width (milimeter) */
639         unsigned int mmHeight;          /**< The physical height (milimeter) */
640         unsigned int subpixel;          /**< The subpixel */
641
642         int min_w;              /**< The minimun width */
643         int min_h;              /**< The minimun height */
644         int max_w;              /**< The maximum width */
645         int max_h;              /**< The maximum height */
646         int preferred_align;    /**< The prefered align */
647
648         hal_tdm_output_capability capabilities;  /**< The capabilities of output. @since 1.4.1 */
649
650         int cursor_min_w;              /**< The minimun width.  @since 1.5.0 */
651         int cursor_min_h;              /**< The minimun height. @since 1.5.0 */
652         int cursor_max_w;              /**< The maximum width. @since 1.5.0 */
653         int cursor_max_h;              /**< The maximum height. @since 1.5.0 */
654         int cursor_preferred_align;    /**< The prefered align. @since 1.5.0 */
655 } hal_tdm_caps_output;
656
657 typedef struct _hal_tdm_caps_pp {
658         hal_tdm_pp_capability capabilities; /**< The capabilities of pp */
659         unsigned int format_count;      /**< The count of available formats */
660         tbm_format *formats;            /**< The @b newly-allocated array. will be freed in frontend. */
661         int min_w;                      /**< The minimun width */
662         int min_h;                      /**< The minimun height */
663         int max_w;                      /**< The maximum width */
664         int max_h;                      /**< The maximum height */
665         int preferred_align;            /**< The prefered align */
666         int preferred_align_vertical;   /**< The prefered align vertical */
667         int max_attach_count;           /**< The attach count which a PP object can handle. */
668 } hal_tdm_caps_pp;
669
670 typedef struct _hal_tdm_caps_capture {
671         hal_tdm_capture_capability capabilities; /**< The capabilities of capture */
672         unsigned int format_count;               /**< The count of available formats */
673         tbm_format *formats;                     /**< The @b newly-allocated array of formats. will be freed in frontend. */
674         int min_w;              /**< The minimun width */
675         int min_h;              /**< The minimun height */
676         int max_w;              /**< The maximum width */
677         int max_h;              /**< The maximum height */
678         int preferred_align;    /**< The prefered align */
679         int max_attach_count;   /**< The attach count which a capture object can handle. */
680 } hal_tdm_caps_capture;
681
682 #ifdef __cplusplus
683 }
684 #endif
685
686 #endif /* _HAL_TDM_TYPES_H_ */