1bc0d6feb6d62232e95f020d38df946991a6fc11
[platform/upstream/enlightenment.git] / src / bin / e_output.h
1 #ifdef E_TYPEDEFS
2
3 #include <tbm_surface.h>
4
5 typedef struct _E_Output            E_Output;
6 typedef struct _E_Output_Mode       E_Output_Mode;
7 typedef enum   _E_Output_Dpms       E_OUTPUT_DPMS;
8
9 typedef struct _E_Output_Hook       E_Output_Hook;
10 typedef enum   _E_Output_Hook_Point E_Output_Hook_Point;
11 typedef void (*E_Output_Hook_Cb) (void *data, E_Output *output);
12
13 typedef void (*E_Output_Capture_Cb) (E_Output *output, tbm_surface_h surface, void *user_data);
14
15 #else
16 #ifndef E_OUTPUT_H
17 #define E_OUTPUT_H
18
19 #define E_OUTPUT_TYPE (int)0xE0b11002
20
21 #include "e_comp_screen.h"
22 #include <Ecore_Drm.h>
23
24 enum _E_Output_Dpms
25 {
26    E_OUTPUT_DPMS_ON,
27    E_OUTPUT_DPMS_STANDBY,
28    E_OUTPUT_DPMS_SUSPEND,
29    E_OUTPUT_DPMS_OFF,
30 };
31
32 struct _E_Output_Mode
33 {
34    int    w, h; // resolution width and height
35    double refresh; // refresh in hz
36    Eina_Bool preferred : 1; // is this the preferred mode for the device?
37
38    const tdm_output_mode *tmode;
39 };
40
41 struct _E_Output
42 {
43    int index;
44    char *id; // string id which is "name/edid";
45    struct {
46         char                 *screen; // name of the screen device attached
47         char                 *name; // name of the output itself
48         char                 *edid; // full edid data
49         Eina_Bool             connected : 1; // some screen is plugged in or not
50         Eina_List            *modes; // available screen modes here
51         struct {
52              int                w, h; // physical width and height in mm
53         } size;
54    } info;
55    struct {
56         Eina_Rectangle        geom; // the geometry that is set (as a result)
57         E_Output_Mode         mode; // screen res/refresh to use
58         int                   rotation; // 0, 90, 180, 270
59         int                   priority; // larger num == more important
60         Eina_Bool             enabled : 1; // should this monitor be enabled?
61    } config;
62
63    int                  plane_count;
64    Eina_List           *planes;
65    E_Zone              *zone;
66
67    tdm_output           *toutput;
68
69    E_Comp_Screen        *e_comp_screen;
70    E_OUTPUT_DPMS        dpms;
71
72    struct {
73        int min_w, min_h;
74        int max_w, max_h;
75        int preferred_align;
76    } cursor_available;
77
78    Eina_Bool            zoom_set;
79    struct
80    {
81       double            zoomx;
82       double            zoomy;
83       int               init_cx;
84       int               init_cy;
85       int               adjusted_cx;
86       int               adjusted_cy;
87       int               init_angle;
88       int               current_angle;
89       Eina_Rectangle    rect;
90       Eina_Bool         need_touch_set;
91    } zoom_conf;
92    Ecore_Event_Handler *touch_up_handler;
93
94    struct
95    {
96       tdm_capture      *tcapture;
97       Eina_Bool         start;
98       Eina_List        *data;
99       Eina_Bool         possible_tdm_capture;
100       Ecore_Timer      *timer;
101       Eina_Bool         wait_vblank;
102    } stream_capture;
103 };
104
105 enum _E_Output_Hook_Point
106 {
107    E_OUTPUT_HOOK_DPMS_CHANGE,
108    E_OUTPUT_HOOK_LAST
109 };
110
111 struct _E_Output_Hook
112 {
113    EINA_INLIST;
114    E_Output_Hook_Point hookpoint;
115    E_Output_Hook_Cb func;
116    void *data;
117    unsigned char delete_me : 1;
118 };
119
120 EINTERN Eina_Bool         e_output_init(void);
121 EINTERN void              e_output_shutdown(void);
122 EINTERN E_Output        * e_output_new(E_Comp_Screen *e_comp_screen, int index);
123 EINTERN void              e_output_del(E_Output *output);
124 EINTERN Eina_Bool         e_output_rotate(E_Output *output, int rotate);
125 EINTERN Eina_Bool         e_output_update(E_Output *output);
126 EINTERN Eina_Bool         e_output_mode_apply(E_Output *output, E_Output_Mode *mode);
127 EINTERN Eina_Bool         e_output_commit(E_Output *output);
128 EINTERN Eina_Bool         e_output_render(E_Output *output);
129 EINTERN Eina_Bool         e_output_setup(E_Output *output);
130 EINTERN E_Output_Mode   * e_output_best_mode_find(E_Output *output);
131 EINTERN Eina_Bool         e_output_connected(E_Output *output);
132 EINTERN Eina_Bool         e_output_dpms_set(E_Output *output, E_OUTPUT_DPMS val);
133 E_API E_OUTPUT_DPMS       e_output_dpms_get(E_Output *output);
134 EINTERN void              e_output_size_get(E_Output *output, int *w, int *h);
135 EINTERN E_Plane         * e_output_default_fb_target_get(E_Output *output);
136 EINTERN Eina_Bool         e_output_fake_config_set(E_Output *output, int w, int h);
137 EINTERN Eina_Bool         e_output_zoom_set(E_Output *output, double zoomx, double zoomy, int cx, int cy);
138 EINTERN void              e_output_zoom_unset(E_Output *output);
139 EINTERN Eina_Bool         e_output_capture(E_Output *output, tbm_surface_h surface, Eina_Bool auto_rotate, E_Output_Capture_Cb func, void *data);
140 EINTERN Eina_Bool         e_output_stream_capture_queue(E_Output *output, tbm_surface_h surface, E_Output_Capture_Cb func, void *data);
141 EINTERN Eina_Bool         e_output_stream_capture_dequeue(E_Output *output, tbm_surface_h surface);
142 EINTERN Eina_Bool         e_output_stream_capture_start(E_Output *output);
143 EINTERN void              e_output_stream_capture_stop(E_Output *output);
144 E_API E_Output          * e_output_find(const char *id);
145 E_API E_Output          * e_output_find_by_index(int index);
146 E_API const Eina_List   * e_output_planes_get(E_Output *output);
147 E_API void                e_output_util_planes_print(void);
148 E_API Eina_Bool           e_output_is_fb_composing(E_Output *output);
149 E_API Eina_Bool           e_output_is_fb_full_compositing(E_Output *output);
150 E_API E_Plane           * e_output_fb_target_get(E_Output *output);
151 E_API E_Plane           * e_output_plane_get_by_zpos(E_Output *output, int zpos);
152 E_API E_Output_Hook     * e_output_hook_add(E_Output_Hook_Point hookpoint, E_Output_Hook_Cb func, const void *data);
153 E_API void                e_output_hook_del(E_Output_Hook *ch);
154
155
156 #endif
157 #endif