Merge branch 'master' of git+ssh://iano@git.freedesktop.org/git/xcb

This commit is contained in:
Ian Osgood 2006-04-19 20:45:31 -07:00
commit 6f369fde3c
12 changed files with 234 additions and 125 deletions

1
debian/.gitignore vendored
View File

@ -1,6 +1,5 @@
compat compat
copyright copyright
fd.o-*
stamp-* stamp-*
tmp tmp
files files

26
debian/changelog vendored
View File

@ -1,6 +1,20 @@
libxcb0 (0.9-1pre2v4) unstable; urgency=low 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
pre2v1:
* Split into libxcb0 and libxcb0-dev. * Split into libxcb0 and libxcb0-dev.
* Change control file for new packages. * Change control file for new packages.
* Add install and dirs files for new packages. * Add install and dirs files for new packages.
@ -14,16 +28,8 @@ libxcb0 (0.9-1pre2v4) unstable; urgency=low
* Update homepage URL in description and copyright.debian to * Update homepage URL in description and copyright.debian to
http://xcb.freedesktop.org, and put it in a Homepage: field in the http://xcb.freedesktop.org, and put it in a Homepage: field in the
description. description.
pre2v2:
* Add libxcb0-dbg package. * Add libxcb0-dbg package.
pre2v3:
* New upstream snapshot.
pre2v4:
* New upstream snapshot.
-- Josh Triplett <josh@freedesktop.org> Tue, 17 May 2005 12:53:53 -0700 -- Josh Triplett <josh@freedesktop.org> Tue, 17 May 2005 12:53:53 -0700
fd.o-xcb (0.9-1) unstable; urgency=low fd.o-xcb (0.9-1) unstable; urgency=low

61
debian/control vendored
View File

@ -2,8 +2,7 @@ Source: libxcb0
Priority: optional Priority: optional
Maintainer: XCB Developers <xcb@lists.freedesktop.org> Maintainer: XCB Developers <xcb@lists.freedesktop.org>
Uploaders: Jamey Sharp <sharpone@debian.org>, Josh Triplett <josh@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-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)
Build-Conflicts: automake1.4, automake1.5, automake1.6
Standards-Version: 3.6.1 Standards-Version: 3.6.1
Bugs: mailto:xcb@lists.freedesktop.org Bugs: mailto:xcb@lists.freedesktop.org
@ -12,30 +11,41 @@ Section: libs
Architecture: any Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends} Depends: ${shlibs:Depends}, ${misc:Depends}
Description: X C Binding Description: X C Binding
Xlib has been the standard C binding for the X Window System protocol for This package contains the library files needed to run software using the X C
many years now. It is an excellent piece of work, but there are applications Binding (XCB).
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 XCB library provides an interface to the X Window System protocol,
XCB. 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 Homepage: http://xcb.freedesktop.org
Package: libxcb0-dev Package: libxcb0-dev
Section: libdevel Section: libdevel
Architecture: any 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 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 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 Homepage: http://xcb.freedesktop.org
@ -44,13 +54,18 @@ Section: libdevel
Architecture: any Architecture: any
Depends: libxcb0 (= ${Source-Version}) Depends: libxcb0 (= ${Source-Version})
Description: X C Binding, debugging symbols 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 This package contains the debugging symbols associated with libxcb0. gdb will
automatically use these symbols when debugging libxcb0. 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 Homepage: http://xcb.freedesktop.org

View File

@ -1,5 +1,4 @@
usr/X11R6/include/X11/* usr/include/X11/*
usr/lib/lib*.a usr/lib/lib*.a
usr/lib/lib*.so usr/lib/lib*.so
usr/lib/pkgconfig/* usr/lib/pkgconfig/*
usr/lib/*.la

6
debian/rules vendored
View File

@ -6,12 +6,6 @@ include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk include /usr/share/cdbs/1/class/autotools.mk
DEB_CONFIGURE_EXTRA_FLAGS = --with-opt 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 debian/copyright: debian/copyright.debian COPYING
cat $+ > $@ cat $+ > $@

View File

@ -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 = \ EXTHEADERS = \
extensions/bigreq.h \ extensions/bigreq.h \
extensions/composite.h \ extensions/composite.h \
extensions/damage.h \ extensions/damage.h \
extensions/dpms.h \
extensions/glx.h \ extensions/glx.h \
extensions/shm.h \
extensions/shape.h \
extensions/randr.h \ extensions/randr.h \
extensions/record.h \ extensions/record.h \
extensions/render.h \ extensions/render.h \
extensions/res.h \ extensions/res.h \
extensions/dpms.h \ extensions/screensaver.h \
extensions/shape.h \
extensions/shm.h \
extensions/sync.h \ extensions/sync.h \
extensions/xc_misc.h \ extensions/xc_misc.h \
extensions/xevie.h \ extensions/xevie.h \
@ -24,14 +43,15 @@ EXTSOURCES = \
extensions/bigreq.c \ extensions/bigreq.c \
extensions/composite.c \ extensions/composite.c \
extensions/damage.c \ extensions/damage.c \
extensions/dpms.c \
extensions/glx.c \ extensions/glx.c \
extensions/shm.c \
extensions/shape.c \
extensions/randr.c \ extensions/randr.c \
extensions/record.c \ extensions/record.c \
extensions/render.c \ extensions/render.c \
extensions/res.c \ extensions/res.c \
extensions/dpms.c \ extensions/screensaver.c \
extensions/shape.c \
extensions/shm.c \
extensions/sync.c \ extensions/sync.c \
extensions/xc_misc.c \ extensions/xc_misc.c \
extensions/xevie.c \ extensions/xevie.c \
@ -42,11 +62,18 @@ EXTSOURCES = \
extensions/xvmc.c extensions/xvmc.c
EXTENSIONS = $(EXTSOURCES) $(EXTHEADERS) 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 COREHEADERS = xproto.h xcb_types.h
CORESOURCES = xproto.c xcb_types.c CORESOURCES = xproto.c xcb_types.c
COREPROTO = $(CORESOURCES) $(COREHEADERS) COREPROTO = $(CORESOURCES) $(COREHEADERS)
xcbinclude_HEADERS = xcb.h xcbext.h xcbxlib.h $(COREHEADERS) $(EXTHEADERS) xcbinclude_HEADERS = xcb.h xcbext.h xcbxlib.h $(COREHEADERS) $(EXTHEADERS)
noinst_HEADERS = xcbint.h
CFLAGS = CFLAGS =
AM_CFLAGS = $(COPTFLAGS) $(CWARNFLAGS) $(CDEBUGFLAGS) $(XCBPROTO_CFLAGS) $(XPROTO_CFLAGS) $(XAU_CFLAGS) $(XDMCP_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 = \ libXCB_la_SOURCES = \
xcb_conn.c xcb_out.c xcb_in.c xcb_ext.c xcb_xid.c \ 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 \ xcb_list.c xcb_util.c xcb_xlib.c xcb_auth.c \
$(COREPROTO) $(EXTENSIONS) $(COREPROTO) $(ESSENTIAL_EXTENSIONS)
BUILT_SOURCES = $(COREPROTO) $(EXTENSIONS) BUILT_SOURCES = $(COREPROTO) $(EXTENSIONS)
CLEANFILES = $(COREPROTO) $(EXTENSIONS) CLEANFILES = $(COREPROTO) $(EXTENSIONS)
clean-local: clean-local:
rmdir extensions || true 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 vpath %.xml $(XCBPROTO_XCBINCLUDEDIR) $(XCBPROTO_XCBINCLUDEDIR)/extensions
%.h: %.xml c-client.xsl %.h: %.xml c-client.xsl

View File

@ -273,9 +273,10 @@ XCBGenericEvent *XCBPollForEvent(XCBConnection *c, int *error);
* processed. This function enables applications to determine whether * processed. This function enables applications to determine whether
* forcing a cookie is going to block. * 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 */ /* xcb_ext.c */

View File

@ -253,7 +253,11 @@ int _xcb_conn_wait(XCBConnection *c, pthread_cond_t *cond, struct iovec **vector
} }
pthread_mutex_unlock(&c->iolock); 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); pthread_mutex_lock(&c->iolock);
if(ret) if(ret)

View File

@ -229,7 +229,9 @@ static int read_block(const int fd, void *buf, const size_t len)
fd_set fds; fd_set fds;
FD_ZERO(&fds); FD_ZERO(&fds);
FD_SET(fd, &fds); FD_SET(fd, &fds);
do {
ret = select(fd + 1, &fds, 0, 0, 0); ret = select(fd + 1, &fds, 0, 0, 0);
} while (ret == -1 && errno == EINTR);
} }
if(ret <= 0) if(ret <= 0)
return ret; return ret;
@ -237,77 +239,89 @@ static int read_block(const int fd, void *buf, const size_t len)
return len; return len;
} }
/* Public interface */ static int poll_for_reply(XCBConnection *c, unsigned int request, void **reply, XCBGenericError **error)
void *XCBWaitForReply(XCBConnection *c, unsigned int request, XCBGenericError **e)
{ {
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
reader_list reader;
reader_list **prev_reader;
struct reply_list *head; struct reply_list *head;
void *ret = 0;
if(e)
*e = 0;
/* If an error occurred when issuing the request, fail immediately. */ /* If an error occurred when issuing the request, fail immediately. */
if(!request) if(!request)
return 0; head = 0;
/* We've read requests past the one we want, so if it has replies we have
pthread_mutex_lock(&c->iolock); * them all and they're in the replies map. */
else if(request < c->in.request_read)
/* 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 = _xcb_map_remove(c->in.replies, request); head = _xcb_map_remove(c->in.replies, request);
if(head && head->next) if(head && head->next)
_xcb_map_put(c->in.replies, request, 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; head = c->in.current_reply;
if(head)
{
c->in.current_reply = head->next; c->in.current_reply = head->next;
if(!head->next) if(!head->next)
c->in.current_reply_tail = &c->in.current_reply; 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) if(head)
{ {
ret = head->reply; if(((XCBGenericRep *) head->reply)->response_type == XCBError)
free(head);
if(((XCBGenericRep *) ret)->response_type == XCBError)
{ {
if(e) if(error)
*e = ret; *error = head->reply;
else else
free(ret); free(head->reply);
ret = 0;
} }
else
*reply = head->reply;
free(head);
} }
done: 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) for(prev_reader = &c->in.readers; *prev_reader && (*prev_reader)->request <= request; prev_reader = &(*prev_reader)->next)
if(*prev_reader == &reader) if(*prev_reader == &reader)
{ {
@ -315,12 +329,23 @@ done:
break; break;
} }
pthread_cond_destroy(&cond); pthread_cond_destroy(&cond);
}
wake_up_next_reader(c); wake_up_next_reader(c);
pthread_mutex_unlock(&c->iolock); pthread_mutex_unlock(&c->iolock);
return ret; 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) XCBGenericEvent *XCBWaitEvent(XCBConnection *c)
{ {
return XCBWaitForEvent(c); return XCBWaitForEvent(c);

View File

@ -27,7 +27,6 @@
#include <assert.h> #include <assert.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/select.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>
#include <netinet/in.h> #include <netinet/in.h>

View File

@ -63,6 +63,7 @@ unsigned int XCBSendRequest(XCBConnection *c, int flags, struct iovec *vector, c
/* xcb_in.c */ /* xcb_in.c */
void *XCBWaitForReply(XCBConnection *c, unsigned int request, XCBGenericError **e); void *XCBWaitForReply(XCBConnection *c, unsigned int request, XCBGenericError **e);
int XCBPollForReply(XCBConnection *c, unsigned int request, void **reply, XCBGenericError **error);
/* xcb_xid.c */ /* xcb_xid.c */

View File

@ -32,7 +32,7 @@
#include "xcb.h" #include "xcb.h"
/* This function must be called with the IOLock held. */ /* 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. */ /* This function must be called with the IOLock held. */
unsigned int XCBGetRequestSent(XCBConnection *c); unsigned int XCBGetRequestSent(XCBConnection *c);