Revert "Upstream merge"
[framework/uifw/evas.git] / src / modules / engines / software_x11 / evas_engine.h
1 #ifndef EVAS_ENGINE_H
2 # define EVAS_ENGINE_H
3
4 # include <sys/ipc.h>
5 # include <sys/shm.h>
6
7 # ifdef BUILD_ENGINE_SOFTWARE_XLIB
8 #  include <X11/Xlib.h>
9 #  include <X11/Xutil.h>
10 #  include <X11/Xatom.h>
11 #  include <X11/extensions/XShm.h>
12 #  include <X11/Xresource.h> // xres - dpi
13 # endif
14
15 # ifdef BUILD_ENGINE_SOFTWARE_XCB
16 #  include <xcb/xcb.h>
17 #  include <xcb/shm.h>
18 #  include <xcb/xcb_image.h>
19 # endif
20
21 extern int _evas_engine_soft_x11_log_dom;
22
23 # ifdef ERR
24 #  undef ERR
25 # endif
26 # define ERR(...) EINA_LOG_DOM_ERR(_evas_engine_soft_x11_log_dom, __VA_ARGS__)
27
28 # ifdef DBG
29 #  undef DBG
30 # endif
31 # define DBG(...) EINA_LOG_DOM_DBG(_evas_engine_soft_x11_log_dom, __VA_ARGS__)
32
33 # ifdef INF
34 #  undef INF
35 # endif
36 # define INF(...) EINA_LOG_DOM_INFO(_evas_engine_soft_x11_log_dom, __VA_ARGS__)
37
38 # ifdef WRN
39 #  undef WRN
40 # endif
41 # define WRN(...) EINA_LOG_DOM_WARN(_evas_engine_soft_x11_log_dom, __VA_ARGS__)
42
43 # ifdef CRIT
44 #  undef CRIT
45 # endif
46 # define CRIT(...) \
47    EINA_LOG_DOM_CRIT(_evas_engine_soft_x11_log_dom, __VA_ARGS__)
48
49 typedef enum _Outbuf_Depth Outbuf_Depth;
50
51 enum _Outbuf_Depth
52 {
53    OUTBUF_DEPTH_NONE,
54    OUTBUF_DEPTH_INHERIT,
55    OUTBUF_DEPTH_RGB_16BPP_565_565_DITHERED,
56    OUTBUF_DEPTH_RGB_16BPP_555_555_DITHERED,
57    OUTBUF_DEPTH_RGB_16BPP_444_444_DITHERED,
58    OUTBUF_DEPTH_RGB_16BPP_565_444_DITHERED,
59    OUTBUF_DEPTH_RGB_32BPP_888_8888,
60    OUTBUF_DEPTH_LAST
61 };
62
63 typedef struct _Outbuf Outbuf;
64
65 struct _Outbuf
66 {
67    Outbuf_Depth depth;
68    int w, h;
69    int rot;
70    int onebuf;
71
72    struct 
73      {
74         Convert_Pal *pal;
75         union 
76           {
77 # ifdef BUILD_ENGINE_SOFTWARE_XLIB
78              struct 
79                {
80                   Display *disp;
81                   Window win;
82                   Pixmap mask;
83                   Visual *vis;
84                   Colormap cmap;
85                   int depth, shm;
86                   GC gc, gcm;
87                   unsigned char swap : 1;
88                   unsigned char bit_swap : 1;
89                } xlib;
90 # endif
91 # ifdef BUILD_ENGINE_SOFTWARE_XCB
92              struct 
93                {
94                   xcb_connection_t *conn;
95                   xcb_screen_t *screen;
96                   xcb_window_t win;
97                   xcb_pixmap_t mask;
98                   xcb_visualtype_t *visual;
99                   xcb_colormap_t cmap;
100                   int depth, shm;
101                   xcb_gcontext_t gc, gcm;
102                   unsigned char swap : 1;
103                   unsigned char bit_swap : 1;
104                } xcb;
105 # endif
106           } x11;
107         struct 
108           {
109              DATA32 r, g, b;
110           } mask;
111
112         /* 1 big buffer for updates - flush on idle_flush */
113         RGBA_Image *onebuf;
114         Eina_List *onebuf_regions;
115
116         /* a list of pending regions to write to the target */
117         Eina_List *pending_writes;
118
119         /* a list of previous frame pending regions to write to the target */
120         Eina_List *prev_pending_writes;
121
122 # ifdef EVAS_FRAME_QUEUING
123         /* protecting prev_pending_writes */
124         LK(lock);
125 # endif
126
127         unsigned char mask_dither : 1;
128         unsigned char destination_alpha : 1;
129         unsigned char debug : 1;
130         unsigned char synced : 1;
131      } priv;
132 };
133
134 void evas_software_xlib_x_init(void);
135 void evas_software_xcb_init(void);
136
137 #endif