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