diff options
author | Ian Osgood <iano@quirkster.com> | 2006-04-19 20:45:31 -0700 |
---|---|---|
committer | Ian Osgood <iano@quirkster.com> | 2006-04-19 20:45:31 -0700 |
commit | 6f369fde3c676e2b1a67bd71923b61942991d726 (patch) | |
tree | f002c142673f950fc03ae8c38f86c6e61b743d9f | |
parent | 922cb6137a12982ecd9e1c73ecefdcbc9e193eae (diff) | |
parent | f090da98f367ed869fd9277d2fef22555be0f91d (diff) |
Merge branch 'master' of git+ssh://iano@git.freedesktop.org/git/xcb
-rw-r--r-- | debian/.gitignore | 1 | ||||
-rw-r--r-- | debian/changelog | 56 | ||||
-rw-r--r-- | debian/control | 61 | ||||
-rw-r--r-- | debian/libxcb0-dev.install | 3 | ||||
-rwxr-xr-x | debian/rules | 6 | ||||
-rw-r--r-- | src/Makefile.am | 82 | ||||
-rw-r--r-- | src/xcb.h | 5 | ||||
-rw-r--r-- | src/xcb_conn.c | 6 | ||||
-rw-r--r-- | src/xcb_in.c | 141 | ||||
-rw-r--r-- | src/xcb_util.c | 1 | ||||
-rw-r--r-- | src/xcbext.h | 1 | ||||
-rw-r--r-- | src/xcbxlib.h | 2 |
12 files changed, 237 insertions, 128 deletions
diff --git a/debian/.gitignore b/debian/.gitignore index cad8b05..a6db18d 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -1,6 +1,5 @@ compat copyright -fd.o-* stamp-* tmp files diff --git a/debian/changelog b/debian/changelog index 148dd94..d48a072 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,28 +1,34 @@ -libxcb0 (0.9-1pre2v4) unstable; urgency=low - - pre2v1: - * Split into libxcb0 and libxcb0-dev. - * Change control file for new packages. - * Add install and dirs files for new packages. - * Update Build-Depends for renaming of fd.o-xau, fd.o-xproto, and - fd.o-xcb-proto. - * Remove fd.o prefix from package name. - * Change Maintainer to xcb@lists.freedesktop.org, move myself to - Uploaders, and add Jamey Sharp to Uploaders. Update copyright.debian - accordingly. - * Add Bugs field pointing to xcb@lists.freedesktop.org. - * Update homepage URL in description and copyright.debian to - http://xcb.freedesktop.org, and put it in a Homepage: field in the - description. - - pre2v2: - * Add libxcb0-dbg package. - - pre2v3: - * New upstream snapshot. - - pre2v4: - * New upstream snapshot. +libxcb0 (0.9-3) UNRELEASED; urgency=low + + * Stop running autoreconf in debian/rules, and remove Build-Depends for + autoconf, automake, and libtool. + * Update -dbg package handling to work with debhelper compat level 5. + Increase minimum version on debhelper Build-Depends to 5.0.0. + * Stop installing the libtool .la files. + * Add Build-Depends on libxdmcp-dev. + * Debian X11R7 transition: + * Change Depends and Build-Depends on x-dev to x11proto-core-dev. + * Install headers to /usr/include/X11, not /usr/X11R6/include/X11. + * Pre-Depends: x11-common (>= 1:1.09). + + -- Josh Triplett <josh@freedesktop.org> Sun, 16 Apr 2006 09:25:09 -0700 + +libxcb0 (0.9-2) unstable; urgency=low + + * Split into libxcb0 and libxcb0-dev. + * Change control file for new packages. + * Add install and dirs files for new packages. + * Update Build-Depends for renaming of fd.o-xau, fd.o-xproto, and + fd.o-xcb-proto. + * Remove fd.o prefix from package name. + * Change Maintainer to xcb@lists.freedesktop.org, move myself to + Uploaders, and add Jamey Sharp to Uploaders. Update copyright.debian + accordingly. + * Add Bugs field pointing to xcb@lists.freedesktop.org. + * Update homepage URL in description and copyright.debian to + http://xcb.freedesktop.org, and put it in a Homepage: field in the + description. + * Add libxcb0-dbg package. -- Josh Triplett <josh@freedesktop.org> Tue, 17 May 2005 12:53:53 -0700 diff --git a/debian/control b/debian/control index 33c61c0..d3d80e0 100644 --- a/debian/control +++ b/debian/control @@ -2,8 +2,7 @@ Source: libxcb0 Priority: optional Maintainer: XCB Developers <xcb@lists.freedesktop.org> Uploaders: Jamey Sharp <sharpone@debian.org>, Josh Triplett <josh@freedesktop.org> -Build-Depends: x-dev, libxau-dev, xcb-proto, cdbs, debhelper (>= 4.1.76), pkg-config, autoconf, automake1.9 | automaken, libtool, xsltproc, check, binutils (>= 2.12.90.0.9) -Build-Conflicts: automake1.4, automake1.5, automake1.6 +Build-Depends: x11proto-core-dev, libxau-dev, libxdmcp-dev, xcb-proto, cdbs, debhelper (>= 5.0.0), pkg-config, xsltproc, check, binutils (>= 2.12.90.0.9) Standards-Version: 3.6.1 Bugs: mailto:xcb@lists.freedesktop.org @@ -12,30 +11,41 @@ Section: libs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: X C Binding - Xlib has been the standard C binding for the X Window System protocol for - many years now. It is an excellent piece of work, but there are applications - for which it is not ideal. XCB builds on nearly two decades of experience - with X specifically and software engineering in general in an effort to - replace the aging Xlib code base. + This package contains the library files needed to run software using the X C + Binding (XCB). . - This package contains the library files needed to run software using - XCB. + The XCB library provides an interface to the X Window System protocol, + designed to replace the Xlib interface. XCB provides several advantages over + Xlib: + . + * Size: small library and lower memory footprint + * Latency hiding: batch several requests and wait for the replies later + * Direct protocol access: one-to-one mapping between interface and protocol + * Thread support: access XCB from multiple threads, with no explicit locking + * Easy creation of new extensions: automatically generates interface from + machine-parsable protocol descriptions . Homepage: http://xcb.freedesktop.org Package: libxcb0-dev Section: libdevel Architecture: any -Depends: libxcb0 (= ${Source-Version}), x-dev +Depends: libxcb0 (= ${Source-Version}), x11proto-core-dev +Pre-Depends: x11-common (>= 1:1.09) Description: X C Binding, development files - Xlib has been the standard C binding for the X Window System protocol for - many years now. It is an excellent piece of work, but there are applications - for which it is not ideal. XCB builds on nearly two decades of experience - with X specifically and software engineering in general in an effort to - replace the aging Xlib code base. - . This package contains the header and library files needed to build software - using XCB. + using the X C Binding (XCB) library. + . + The XCB library provides an interface to the X Window System protocol, + designed to replace the Xlib interface. XCB provides several advantages over + Xlib: + . + * Size: small library and lower memory footprint + * Latency hiding: batch several requests and wait for the replies later + * Direct protocol access: one-to-one mapping between interface and protocol + * Thread support: access XCB from multiple threads, with no explicit locking + * Easy creation of new extensions: automatically generates interface from + machine-parsable protocol descriptions . Homepage: http://xcb.freedesktop.org @@ -44,13 +54,18 @@ Section: libdevel Architecture: any Depends: libxcb0 (= ${Source-Version}) Description: X C Binding, debugging symbols - Xlib has been the standard C binding for the X Window System protocol for - many years now. It is an excellent piece of work, but there are applications - for which it is not ideal. XCB builds on nearly two decades of experience - with X specifically and software engineering in general in an effort to - replace the aging Xlib code base. - . This package contains the debugging symbols associated with libxcb0. gdb will automatically use these symbols when debugging libxcb0. . + The XCB library provides an interface to the X Window System protocol, + designed to replace the Xlib interface. XCB provides several advantages over + Xlib: + . + * Size: small library and lower memory footprint + * Latency hiding: batch several requests and wait for the replies later + * Direct protocol access: one-to-one mapping between interface and protocol + * Thread support: access XCB from multiple threads, with no explicit locking + * Easy creation of new extensions: automatically generates interface from + machine-parsable protocol descriptions + . Homepage: http://xcb.freedesktop.org diff --git a/debian/libxcb0-dev.install b/debian/libxcb0-dev.install index 5ab44bc..9cc96e7 100644 --- a/debian/libxcb0-dev.install +++ b/debian/libxcb0-dev.install @@ -1,5 +1,4 @@ -usr/X11R6/include/X11/* +usr/include/X11/* usr/lib/lib*.a usr/lib/lib*.so usr/lib/pkgconfig/* -usr/lib/*.la diff --git a/debian/rules b/debian/rules index e81cbea..f07c082 100755 --- a/debian/rules +++ b/debian/rules @@ -6,12 +6,6 @@ include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/autotools.mk DEB_CONFIGURE_EXTRA_FLAGS = --with-opt -DEB_CONFIGURE_INCLUDEDIR = "\$${prefix}/X11R6/include" -DEB_DH_STRIP_ARGS=--dbg-package=libxcb0 - -debian/stamp-autotools-files: - autoreconf -v --install - touch debian/stamp-autotools-files debian/copyright: debian/copyright.debian COPYING cat $+ > $@ diff --git a/src/Makefile.am b/src/Makefile.am index 41c261e..4a154a1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,17 +1,36 @@ -lib_LTLIBRARIES = libXCB.la +lib_LTLIBRARIES = libXCB.la \ + libXCBcomposite.la \ + libXCBdamage.la \ + libXCBdpms.la \ + libXCBglx.la \ + libXCBrandr.la \ + libXCBrecord.la \ + libXCBrender.la \ + libXCBres.la \ + libXCBscreensaver.la \ + libXCBshape.la \ + libXCBshm.la \ + libXCBsync.la \ + libXCBxevie.la \ + libXCBxf86dri.la \ + libXCBxfixes.la \ + libXCBxprint.la \ + libXCBxv.la \ + libXCBxvmc.la EXTHEADERS = \ extensions/bigreq.h \ extensions/composite.h \ extensions/damage.h \ + extensions/dpms.h \ extensions/glx.h \ - extensions/shm.h \ - extensions/shape.h \ extensions/randr.h \ extensions/record.h \ extensions/render.h \ extensions/res.h \ - extensions/dpms.h \ + extensions/screensaver.h \ + extensions/shape.h \ + extensions/shm.h \ extensions/sync.h \ extensions/xc_misc.h \ extensions/xevie.h \ @@ -24,14 +43,15 @@ EXTSOURCES = \ extensions/bigreq.c \ extensions/composite.c \ extensions/damage.c \ + extensions/dpms.c \ extensions/glx.c \ - extensions/shm.c \ - extensions/shape.c \ extensions/randr.c \ extensions/record.c \ extensions/render.c \ extensions/res.c \ - extensions/dpms.c \ + extensions/screensaver.c \ + extensions/shape.c \ + extensions/shm.c \ extensions/sync.c \ extensions/xc_misc.c \ extensions/xevie.c \ @@ -42,11 +62,18 @@ EXTSOURCES = \ extensions/xvmc.c EXTENSIONS = $(EXTSOURCES) $(EXTHEADERS) +ESSENTIAL_EXTENSIONS = \ + extensions/bigreq.h \ + extensions/bigreq.c \ + extensions/xc_misc.h \ + extensions/xc_misc.c + COREHEADERS = xproto.h xcb_types.h CORESOURCES = xproto.c xcb_types.c COREPROTO = $(CORESOURCES) $(COREHEADERS) xcbinclude_HEADERS = xcb.h xcbext.h xcbxlib.h $(COREHEADERS) $(EXTHEADERS) +noinst_HEADERS = xcbint.h CFLAGS = AM_CFLAGS = $(COPTFLAGS) $(CWARNFLAGS) $(CDEBUGFLAGS) $(XCBPROTO_CFLAGS) $(XPROTO_CFLAGS) $(XAU_CFLAGS) $(XDMCP_CFLAGS) @@ -54,13 +81,52 @@ libXCB_la_LIBADD = $(XCBPROTO_LIBS) $(XPROTO_LIBS) $(XAU_LIBS) $(XDMCP_LIBS) libXCB_la_SOURCES = \ xcb_conn.c xcb_out.c xcb_in.c xcb_ext.c xcb_xid.c \ xcb_list.c xcb_util.c xcb_xlib.c xcb_auth.c \ - $(COREPROTO) $(EXTENSIONS) + $(COREPROTO) $(ESSENTIAL_EXTENSIONS) BUILT_SOURCES = $(COREPROTO) $(EXTENSIONS) CLEANFILES = $(COREPROTO) $(EXTENSIONS) clean-local: rmdir extensions || true +XCB_LIBS = $(top_builddir)/src/libXCB.la + +libXCBcomposite_la_LIBADD = $(XCB_LIBS) +libXCBcomposite_la_SOURCES = extensions/composite.c extensions/composite.h +libXCBdamage_la_LIBADD = $(XCB_LIBS) +libXCBdamage_la_SOURCES = extensions/damage.c extensions/damage.h +libXCBdpms_la_LIBADD = $(XCB_LIBS) +libXCBdpms_la_SOURCES = extensions/dpms.c extensions/dpms.h +libXCBglx_la_LIBADD = $(XCB_LIBS) +libXCBglx_la_SOURCES = extensions/glx.c extensions/glx.h +libXCBrandr_la_LIBADD = $(XCB_LIBS) +libXCBrandr_la_SOURCES = extensions/randr.c extensions/randr.h +libXCBrecord_la_LIBADD = $(XCB_LIBS) +libXCBrecord_la_SOURCES = extensions/record.c extensions/record.h +libXCBrender_la_LIBADD = $(XCB_LIBS) +libXCBrender_la_SOURCES = extensions/render.c extensions/render.h +libXCBres_la_LIBADD = $(XCB_LIBS) +libXCBres_la_SOURCES = extensions/res.c extensions/res.h +libXCBscreensaver_la_LIBADD = $(XCB_LIBS) +libXCBscreensaver_la_SOURCES = extensions/screensaver.c extensions/screensaver.h +libXCBshape_la_LIBADD = $(XCB_LIBS) +libXCBshape_la_SOURCES = extensions/shape.c extensions/shape.h +libXCBshm_la_LIBADD = $(XCB_LIBS) +libXCBshm_la_SOURCES = extensions/shm.c extensions/shm.h +libXCBsync_la_LIBADD = $(XCB_LIBS) +libXCBsync_la_SOURCES = extensions/sync.c extensions/sync.h +libXCBxevie_la_LIBADD = $(XCB_LIBS) +libXCBxevie_la_SOURCES = extensions/xevie.c extensions/xevie.h +libXCBxf86dri_la_LIBADD = $(XCB_LIBS) +libXCBxf86dri_la_SOURCES = extensions/xf86dri.c extensions/xf86dri.h +libXCBxfixes_la_LIBADD = $(XCB_LIBS) +libXCBxfixes_la_SOURCES = extensions/xfixes.c extensions/xfixes.h +libXCBxprint_la_LIBADD = $(XCB_LIBS) +libXCBxprint_la_SOURCES = extensions/xprint.c extensions/xprint.h +libXCBxv_la_LIBADD = $(XCB_LIBS) +libXCBxv_la_SOURCES = extensions/xv.c extensions/xv.h +libXCBxvmc_la_LIBADD = $(XCB_LIBS) +libXCBxvmc_la_SOURCES = extensions/xvmc.c extensions/xvmc.h + vpath %.xml $(XCBPROTO_XCBINCLUDEDIR) $(XCBPROTO_XCBINCLUDEDIR)/extensions %.h: %.xml c-client.xsl @@ -273,9 +273,10 @@ XCBGenericEvent *XCBPollForEvent(XCBConnection *c, int *error); * processed. This function enables applications to determine whether * forcing a cookie is going to block. * - * @todo review that function. + * @deprecated This function is deprecated in favor of XCBPollForReply. + * It must not be used in newly written code. */ -unsigned int XCBGetRequestRead(XCBConnection *c); +unsigned int XCBGetRequestRead(XCBConnection *c) deprecated; /* xcb_ext.c */ diff --git a/src/xcb_conn.c b/src/xcb_conn.c index 1e93137..95b5fa2 100644 --- a/src/xcb_conn.c +++ b/src/xcb_conn.c @@ -253,7 +253,11 @@ int _xcb_conn_wait(XCBConnection *c, pthread_cond_t *cond, struct iovec **vector } pthread_mutex_unlock(&c->iolock); - ret = select(c->fd + 1, &rfds, &wfds, 0, 0) > 0; + do { + ret = select(c->fd + 1, &rfds, &wfds, 0, 0); + } while (ret == -1 && errno == EINTR); + if (ret < 0) + ret = 0; pthread_mutex_lock(&c->iolock); if(ret) diff --git a/src/xcb_in.c b/src/xcb_in.c index fa13e90..db9d1ca 100644 --- a/src/xcb_in.c +++ b/src/xcb_in.c @@ -229,7 +229,9 @@ static int read_block(const int fd, void *buf, const size_t len) fd_set fds; FD_ZERO(&fds); FD_SET(fd, &fds); - ret = select(fd + 1, &fds, 0, 0, 0); + do { + ret = select(fd + 1, &fds, 0, 0, 0); + } while (ret == -1 && errno == EINTR); } if(ret <= 0) return ret; @@ -237,90 +239,113 @@ static int read_block(const int fd, void *buf, const size_t len) return len; } -/* Public interface */ - -void *XCBWaitForReply(XCBConnection *c, unsigned int request, XCBGenericError **e) +static int poll_for_reply(XCBConnection *c, unsigned int request, void **reply, XCBGenericError **error) { - pthread_cond_t cond = PTHREAD_COND_INITIALIZER; - reader_list reader; - reader_list **prev_reader; struct reply_list *head; - void *ret = 0; - if(e) - *e = 0; /* If an error occurred when issuing the request, fail immediately. */ if(!request) - return 0; - - pthread_mutex_lock(&c->iolock); - - /* If this request has not been written yet, write it. */ - if(!_xcb_out_flush_to(c, request)) - goto done; /* error */ - - for(prev_reader = &c->in.readers; *prev_reader && (*prev_reader)->request <= request; prev_reader = &(*prev_reader)->next) - if((*prev_reader)->request == request) - goto done; /* error */ - - reader.request = request; - reader.data = &cond; - reader.next = *prev_reader; - *prev_reader = &reader; - - /* If this request has not completed yet and has no reply waiting, - * wait for one. */ - while(c->in.request_completed < request && - !(c->in.request_read == request && c->in.current_reply)) - if(!_xcb_conn_wait(c, &cond, 0, 0)) - goto done; - - if(c->in.request_read != request) + head = 0; + /* We've read requests past the one we want, so if it has replies we have + * them all and they're in the replies map. */ + else if(request < c->in.request_read) { head = _xcb_map_remove(c->in.replies, request); if(head && head->next) _xcb_map_put(c->in.replies, request, head->next); } - else + /* We're currently processing the responses to the request we want, and we + * have a reply ready to return. So just return it without blocking. */ + else if(request == c->in.request_read && c->in.current_reply) { head = c->in.current_reply; - if(head) - { - c->in.current_reply = head->next; - if(!head->next) - c->in.current_reply_tail = &c->in.current_reply; - } + c->in.current_reply = head->next; + if(!head->next) + c->in.current_reply_tail = &c->in.current_reply; } + /* We know this request can't have any more replies, and we've already + * established it doesn't have a reply now. Don't bother blocking. */ + else if(request == c->in.request_completed) + head = 0; + /* We may have more replies on the way for this request: block until we're + * sure. */ + else + return 0; + + if(error) + *error = 0; + *reply = 0; if(head) { - ret = head->reply; - free(head); - - if(((XCBGenericRep *) ret)->response_type == XCBError) + if(((XCBGenericRep *) head->reply)->response_type == XCBError) { - if(e) - *e = ret; + if(error) + *error = head->reply; else - free(ret); - ret = 0; + free(head->reply); } + else + *reply = head->reply; + + free(head); } -done: - for(prev_reader = &c->in.readers; *prev_reader && (*prev_reader)->request <= request; prev_reader = &(*prev_reader)->next) - if(*prev_reader == &reader) - { - *prev_reader = (*prev_reader)->next; - break; - } - pthread_cond_destroy(&cond); + return 1; +} + +/* Public interface */ + +void *XCBWaitForReply(XCBConnection *c, unsigned int request, XCBGenericError **e) +{ + void *ret = 0; + if(e) + *e = 0; + + pthread_mutex_lock(&c->iolock); + + /* If this request has not been written yet, write it. */ + if(_xcb_out_flush_to(c, request)) + { + pthread_cond_t cond = PTHREAD_COND_INITIALIZER; + reader_list reader; + reader_list **prev_reader; + + for(prev_reader = &c->in.readers; *prev_reader && (*prev_reader)->request <= request; prev_reader = &(*prev_reader)->next) + /* empty */; + reader.request = request; + reader.data = &cond; + reader.next = *prev_reader; + *prev_reader = &reader; + + while(!poll_for_reply(c, request, &ret, e)) + if(!_xcb_conn_wait(c, &cond, 0, 0)) + break; + + for(prev_reader = &c->in.readers; *prev_reader && (*prev_reader)->request <= request; prev_reader = &(*prev_reader)->next) + if(*prev_reader == &reader) + { + *prev_reader = (*prev_reader)->next; + break; + } + pthread_cond_destroy(&cond); + } wake_up_next_reader(c); pthread_mutex_unlock(&c->iolock); return ret; } +int XCBPollForReply(XCBConnection *c, unsigned int request, void **reply, XCBGenericError **error) +{ + int ret; + assert(reply != 0); + pthread_mutex_lock(&c->iolock); + ret = poll_for_reply(c, request, reply, error); + pthread_mutex_unlock(&c->iolock); + return ret; +} + XCBGenericEvent *XCBWaitEvent(XCBConnection *c) { return XCBWaitForEvent(c); diff --git a/src/xcb_util.c b/src/xcb_util.c index 93e180c..343e21f 100644 --- a/src/xcb_util.c +++ b/src/xcb_util.c @@ -27,7 +27,6 @@ #include <assert.h> #include <sys/types.h> -#include <sys/select.h> #include <sys/socket.h> #include <sys/un.h> #include <netinet/in.h> diff --git a/src/xcbext.h b/src/xcbext.h index 0d172e9..508ebf0 100644 --- a/src/xcbext.h +++ b/src/xcbext.h @@ -63,6 +63,7 @@ unsigned int XCBSendRequest(XCBConnection *c, int flags, struct iovec *vector, c /* xcb_in.c */ void *XCBWaitForReply(XCBConnection *c, unsigned int request, XCBGenericError **e); +int XCBPollForReply(XCBConnection *c, unsigned int request, void **reply, XCBGenericError **error); /* xcb_xid.c */ diff --git a/src/xcbxlib.h b/src/xcbxlib.h index 462e2e3..4ceb03e 100644 --- a/src/xcbxlib.h +++ b/src/xcbxlib.h @@ -32,7 +32,7 @@ #include "xcb.h" /* This function must be called with the IOLock held. */ -unsigned int XCBGetQueuedRequestRead(XCBConnection *c); +unsigned int XCBGetQueuedRequestRead(XCBConnection *c) deprecated; /* This function must be called with the IOLock held. */ unsigned int XCBGetRequestSent(XCBConnection *c); |