00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __XCBINT_H
00029 #define __XCBINT_H
00030
00031 #include "bigreq.h"
00032
00033 #ifdef HAVE_CONFIG_H
00034 #include "config.h"
00035 #endif
00036
00037 #ifdef GCC_HAS_VISIBILITY
00038 #pragma GCC visibility push(hidden)
00039 #endif
00040
00041 enum workarounds {
00042 WORKAROUND_NONE,
00043 WORKAROUND_GLX_GET_FB_CONFIGS_BUG
00044 };
00045
00046 enum lazy_reply_tag
00047 {
00048 LAZY_NONE = 0,
00049 LAZY_COOKIE,
00050 LAZY_FORCED
00051 };
00052
00053 #define XCB_PAD(i) (-(i) & 3)
00054
00055 #define XCB_SEQUENCE_COMPARE(a,op,b) ((int) ((a) - (b)) op 0)
00056
00057
00058
00059 typedef void (*xcb_list_free_func_t)(void *);
00060
00061 typedef struct _xcb_map _xcb_map;
00062
00063 _xcb_map *_xcb_map_new(void);
00064 void _xcb_map_delete(_xcb_map *q, xcb_list_free_func_t do_free);
00065 int _xcb_map_put(_xcb_map *q, unsigned int key, void *data);
00066 void *_xcb_map_remove(_xcb_map *q, unsigned int key);
00067
00068
00069
00070
00071 typedef struct _xcb_out {
00072 pthread_cond_t cond;
00073 int writing;
00074
00075 char queue[4096];
00076 int queue_len;
00077
00078 unsigned int request;
00079 unsigned int request_written;
00080
00081 pthread_mutex_t reqlenlock;
00082 enum lazy_reply_tag maximum_request_length_tag;
00083 union {
00084 xcb_big_requests_enable_cookie_t cookie;
00085 uint32_t value;
00086 } maximum_request_length;
00087 } _xcb_out;
00088
00089 int _xcb_out_init(_xcb_out *out);
00090 void _xcb_out_destroy(_xcb_out *out);
00091
00092 int _xcb_out_send(xcb_connection_t *c, struct iovec **vector, int *count);
00093 int _xcb_out_flush_to(xcb_connection_t *c, unsigned int request);
00094
00095
00096
00097
00098 typedef struct _xcb_in {
00099 pthread_cond_t event_cond;
00100 int reading;
00101
00102 char queue[4096];
00103 int queue_len;
00104
00105 unsigned int request_expected;
00106 unsigned int request_read;
00107 unsigned int request_completed;
00108 struct reply_list *current_reply;
00109 struct reply_list **current_reply_tail;
00110
00111 _xcb_map *replies;
00112 struct event_list *events;
00113 struct event_list **events_tail;
00114 struct reader_list *readers;
00115
00116 struct pending_reply *pending_replies;
00117 struct pending_reply **pending_replies_tail;
00118 } _xcb_in;
00119
00120 int _xcb_in_init(_xcb_in *in);
00121 void _xcb_in_destroy(_xcb_in *in);
00122
00123 int _xcb_in_expect_reply(xcb_connection_t *c, unsigned int request, enum workarounds workaround, int flags);
00124
00125 int _xcb_in_read(xcb_connection_t *c);
00126 int _xcb_in_read_block(xcb_connection_t *c, void *buf, int nread);
00127
00128
00129
00130
00131 typedef struct _xcb_xlib {
00132 int lock;
00133 int sloppy_lock;
00134 pthread_t thread;
00135 pthread_cond_t cond;
00136 } _xcb_xlib;
00137
00138
00139
00140
00141 typedef struct _xcb_xid {
00142 pthread_mutex_t lock;
00143 uint32_t last;
00144 uint32_t base;
00145 uint32_t max;
00146 uint32_t inc;
00147 } _xcb_xid;
00148
00149 int _xcb_xid_init(xcb_connection_t *c);
00150 void _xcb_xid_destroy(xcb_connection_t *c);
00151
00152
00153
00154
00155 typedef struct _xcb_ext {
00156 pthread_mutex_t lock;
00157 struct lazyreply *extensions;
00158 int extensions_size;
00159 } _xcb_ext;
00160
00161 int _xcb_ext_init(xcb_connection_t *c);
00162 void _xcb_ext_destroy(xcb_connection_t *c);
00163
00164
00165
00166
00167 struct xcb_connection_t {
00168 int has_error;
00169
00170
00171 xcb_setup_t *setup;
00172 int fd;
00173
00174
00175 pthread_mutex_t iolock;
00176 _xcb_xlib xlib;
00177 _xcb_in in;
00178 _xcb_out out;
00179
00180
00181 _xcb_ext ext;
00182 _xcb_xid xid;
00183 };
00184
00185 void _xcb_conn_shutdown(xcb_connection_t *c);
00186 void _xcb_wait_io(xcb_connection_t *c, pthread_cond_t *cond);
00187 int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vector, int *count);
00188
00189
00190
00191
00192 int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display);
00193
00194 #ifdef GCC_HAS_VISIBILITY
00195 #pragma GCC visibility pop
00196 #endif
00197
00198
00199
00200
00201 void _xcb_lock_io(xcb_connection_t *c);
00202 void _xcb_unlock_io(xcb_connection_t *c);
00203
00204 #endif