aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libxcb/src/xcb_conn.c792
-rw-r--r--xorg-server/exa/exa.c23
-rw-r--r--xorg-server/exa/exa_classic.c4
-rw-r--r--xorg-server/exa/exa_driver.c450
-rw-r--r--xorg-server/exa/exa_mixed.c4
-rw-r--r--xorg-server/exa/exa_priv.h3
-rw-r--r--xorg-server/glx/glxdri.c17
-rw-r--r--xorg-server/glx/glxdri2.c17
-rw-r--r--xorg-server/glx/makefile6
-rw-r--r--xorg-server/hw/xfree86/common/xf86VGAarbiter.c10
-rw-r--r--xorg-server/hw/xfree86/common/xf86cmap.c8
-rw-r--r--xorg-server/hw/xfree86/common/xf86xv.c8
-rw-r--r--xorg-server/hw/xfree86/shadowfb/shadow.c11
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaInit.c12
-rw-r--r--xorg-server/hw/xquartz/bundle/Info.plist.cpp94
-rw-r--r--xorg-server/hw/xquartz/quartz.c4
-rw-r--r--xorg-server/hw/xquartz/quartzCocoa.m153
-rw-r--r--xorg-server/hw/xquartz/quartzCommon.h15
-rw-r--r--xorg-server/hw/xquartz/xpr/xprCursor.c6
19 files changed, 850 insertions, 787 deletions
diff --git a/libxcb/src/xcb_conn.c b/libxcb/src/xcb_conn.c
index 1e58060ba..cb0e4ff67 100644
--- a/libxcb/src/xcb_conn.c
+++ b/libxcb/src/xcb_conn.c
@@ -1,396 +1,396 @@
-/* Copyright (C) 2001-2004 Bart Massey and Jamey Sharp.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the names of the authors or their
- * institutions shall not be used in advertising or otherwise to promote the
- * sale, use or other dealings in this Software without prior written
- * authorization from the authors.
- */
-
-/* Connection management: the core of XCB. */
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#ifdef _MSC_VER
-#include <X11/Xwinsock.h>
-#define STDERR_FILENO stderr
-#else
-#include <netinet/in.h>
-#endif
-#include <fcntl.h>
-#include <errno.h>
-
-#include "xcb.h"
-#include "xcbint.h"
-#if USE_POLL
-#include <poll.h>
-#else
-#include <sys/select.h>
-#endif
-
-#include <X11/Xtrans/Xtrans.h>
-
-typedef struct {
- uint8_t status;
- uint8_t pad0[5];
- uint16_t length;
-} xcb_setup_generic_t;
-
-static const int error_connection = 1;
-
-#ifdef _MSC_VER
-#undef close
-#define close(fd) closesocket(fd)
-
-size_t writev(int fildes, const struct iovec *iov, int iovcnt)
-{
- int i, r;
- char *p;
- size_t l, sum;
-
- /* We should buffer */
- sum= 0;
- for (i= 0; i<iovcnt; i++)
- {
- p= iov[i].iov_base;
- l= iov[i].iov_len;
- while (l > 0)
- {
- r= send(fildes, p, l, 0);
- if (r <= 0)
- {
- errno =WSAGetLastError();
- if(errno == WSAEWOULDBLOCK)
- errno = EAGAIN;
- if (sum)
- return sum;
- else
- return r;
- }
- p += r;
- l -= r;
- sum += r;
- }
- }
- return sum;
-}
-#endif
-
-static int set_fd_flags(const int fd)
-{
-#ifdef _MSC_VER
- unsigned long arg = 1;
- int ret = ioctlsocket (fd, FIONBIO, &arg);
-#else
- int flags = fcntl(fd, F_GETFL, 0);
- if(flags == -1)
- return 0;
- flags |= O_NONBLOCK;
- if(fcntl(fd, F_SETFL, flags) == -1)
- return 0;
- if(fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
- return 0;
-#endif
- return 1;
-}
-
-static int write_setup(xcb_connection_t *c, xcb_auth_info_t *auth_info)
-{
- static const char pad[3];
- xcb_setup_request_t out;
- struct iovec parts[6];
- int count = 0;
- static const uint32_t endian = 0x01020304;
- int ret;
-
- memset(&out, 0, sizeof(out));
-
- /* B = 0x42 = MSB first, l = 0x6c = LSB first */
- if(htonl(endian) == endian)
- out.byte_order = 0x42;
- else
- out.byte_order = 0x6c;
- out.protocol_major_version = X_PROTOCOL;
- out.protocol_minor_version = X_PROTOCOL_REVISION;
- out.authorization_protocol_name_len = 0;
- out.authorization_protocol_data_len = 0;
- parts[count].iov_len = sizeof(xcb_setup_request_t);
- parts[count++].iov_base = (caddr_t) &out;
- parts[count].iov_len = XCB_PAD(sizeof(xcb_setup_request_t));
- parts[count++].iov_base = (char *) pad;
-
- if(auth_info)
- {
- parts[count].iov_len = out.authorization_protocol_name_len = auth_info->namelen;
- parts[count++].iov_base = auth_info->name;
- parts[count].iov_len = XCB_PAD(out.authorization_protocol_name_len);
- parts[count++].iov_base = (char *) pad;
- parts[count].iov_len = out.authorization_protocol_data_len = auth_info->datalen;
- parts[count++].iov_base = auth_info->data;
- parts[count].iov_len = XCB_PAD(out.authorization_protocol_data_len);
- parts[count++].iov_base = (char *) pad;
- }
- assert(count <= (int) (sizeof(parts) / sizeof(*parts)));
-
- pthread_mutex_lock(&c->iolock);
- ret = _xcb_out_send(c, parts, count);
- pthread_mutex_unlock(&c->iolock);
- return ret;
-}
-
-static int read_setup(xcb_connection_t *c)
-{
- /* Read the server response */
- c->setup = malloc(sizeof(xcb_setup_generic_t));
- if(!c->setup)
- return 0;
-
- if(_xcb_in_read_block(c, c->setup, sizeof(xcb_setup_generic_t)) != sizeof(xcb_setup_generic_t))
- return 0;
-
- {
- void *tmp = realloc(c->setup, c->setup->length * 4 + sizeof(xcb_setup_generic_t));
- if(!tmp)
- return 0;
- c->setup = tmp;
- }
-
- if(_xcb_in_read_block(c, (char *) c->setup + sizeof(xcb_setup_generic_t), c->setup->length * 4) <= 0)
- return 0;
-
- /* 0 = failed, 2 = authenticate, 1 = success */
- switch(c->setup->status)
- {
- case 0: /* failed */
- {
- xcb_setup_failed_t *setup = (xcb_setup_failed_t *) c->setup;
- write(STDERR_FILENO, xcb_setup_failed_reason(setup), xcb_setup_failed_reason_length(setup));
- return 0;
- }
-
- case 2: /* authenticate */
- {
- xcb_setup_authenticate_t *setup = (xcb_setup_authenticate_t *) c->setup;
- write(STDERR_FILENO, xcb_setup_authenticate_reason(setup), xcb_setup_authenticate_reason_length(setup));
- return 0;
- }
- }
-
- return 1;
-}
-
-/* precondition: there must be something for us to write. */
-static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count)
-{
- int n;
- assert(!c->out.queue_len);
- n = writev(c->fd, *vector, *count);
- if(n < 0 && errno == EAGAIN)
- return 1;
- if(n <= 0)
- {
- _xcb_conn_shutdown(c);
- return 0;
- }
-
- for(; *count; --*count, ++*vector)
- {
- int cur = (*vector)->iov_len;
- if(cur > n)
- cur = n;
- (*vector)->iov_len -= cur;
- (*vector)->iov_base = (char *) (*vector)->iov_base + cur;
- n -= cur;
- if((*vector)->iov_len)
- break;
- }
- if(!*count)
- *vector = 0;
- assert(n == 0);
- return 1;
-}
-
-/* Public interface */
-
-const xcb_setup_t *xcb_get_setup(xcb_connection_t *c)
-{
- if(c->has_error)
- return 0;
- /* doesn't need locking because it's never written to. */
- return c->setup;
-}
-
-int xcb_get_file_descriptor(xcb_connection_t *c)
-{
- if(c->has_error)
- return -1;
- /* doesn't need locking because it's never written to. */
- return c->fd;
-}
-
-int xcb_connection_has_error(xcb_connection_t *c)
-{
- /* doesn't need locking because it's read and written atomically. */
- return c->has_error;
-}
-
-xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info)
-{
- xcb_connection_t* c;
-
- c = calloc(1, sizeof(xcb_connection_t));
- if(!c) {
- close(fd);
- return (xcb_connection_t *) &error_connection;
- }
-
- c->fd = fd;
-
- if(!(
- set_fd_flags(fd) &&
- pthread_mutex_init(&c->iolock, 0) == 0 &&
- _xcb_in_init(&c->in) &&
- _xcb_out_init(&c->out) &&
- write_setup(c, auth_info) &&
- read_setup(c) &&
- _xcb_ext_init(c) &&
- _xcb_xid_init(c)
- ))
- {
- xcb_disconnect(c);
- return (xcb_connection_t *) &error_connection;
- }
-
- return c;
-}
-
-void xcb_disconnect(xcb_connection_t *c)
-{
- if(c->has_error)
- return;
-
- free(c->setup);
- close(c->fd);
-
- pthread_mutex_destroy(&c->iolock);
- _xcb_in_destroy(&c->in);
- _xcb_out_destroy(&c->out);
-
- _xcb_ext_destroy(c);
- _xcb_xid_destroy(c);
-
- free(c);
-}
-
-/* Private interface */
-
-void _xcb_conn_shutdown(xcb_connection_t *c)
-{
- c->has_error = 1;
-}
-
-int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vector, int *count)
-{
- int ret;
-#if USE_POLL
- struct pollfd fd;
-#else
- fd_set rfds, wfds;
-#endif
-
- /* If the thing I should be doing is already being done, wait for it. */
- if(count ? c->out.writing : c->in.reading)
- {
- pthread_cond_wait(cond, &c->iolock);
- return 1;
- }
-
-#if USE_POLL
- memset(&fd, 0, sizeof(fd));
- fd.fd = c->fd;
- fd.events = POLLIN;
-#else
- FD_ZERO(&rfds);
- FD_SET(c->fd, &rfds);
-#endif
- ++c->in.reading;
-
-#if USE_POLL
- if(count)
- {
- fd.events |= POLLOUT;
- ++c->out.writing;
- }
-#else
- FD_ZERO(&wfds);
- if(count)
- {
- FD_SET(c->fd, &wfds);
- ++c->out.writing;
- }
-#endif
-
- pthread_mutex_unlock(&c->iolock);
- do {
-#if USE_POLL
- ret = poll(&fd, 1, -1);
-#else
- ret = select(c->fd + 1, &rfds, &wfds, 0, 0);
- if (ret==SOCKET_ERROR)
- {
- ret=-1;
- errno = WSAGetLastError();
- if (errno == WSAEINTR)
- errno=EINTR;
- }
-#endif
- } while (ret == -1 && errno == EINTR);
- if (ret < 0)
- {
- _xcb_conn_shutdown(c);
- ret = 0;
- }
- pthread_mutex_lock(&c->iolock);
-
- if(ret)
- {
-#if USE_POLL
- if((fd.revents & POLLIN) == POLLIN)
-#else
- if(FD_ISSET(c->fd, &rfds))
-#endif
- ret = ret && _xcb_in_read(c);
-
-#if USE_POLL
- if((fd.revents & POLLOUT) == POLLOUT)
-#else
- if(FD_ISSET(c->fd, &wfds))
-#endif
- ret = ret && write_vec(c, vector, count);
- }
-
- if(count)
- --c->out.writing;
- --c->in.reading;
-
- return ret;
-}
+/* Copyright (C) 2001-2004 Bart Massey and Jamey Sharp.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the authors or their
+ * institutions shall not be used in advertising or otherwise to promote the
+ * sale, use or other dealings in this Software without prior written
+ * authorization from the authors.
+ */
+
+/* Connection management: the core of XCB. */
+
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#ifdef _MSC_VER
+#include <X11/Xwinsock.h>
+#define STDERR_FILENO stderr
+#else
+#include <netinet/in.h>
+#endif
+#include <fcntl.h>
+#include <errno.h>
+
+#include "xcb.h"
+#include "xcbint.h"
+#if USE_POLL
+#include <poll.h>
+#else
+#include <sys/select.h>
+#endif
+
+#include <X11/Xtrans/Xtrans.h>
+
+typedef struct {
+ uint8_t status;
+ uint8_t pad0[5];
+ uint16_t length;
+} xcb_setup_generic_t;
+
+static const int error_connection = 1;
+
+#ifdef _MSC_VER
+#undef close
+#define close(fd) closesocket(fd)
+
+size_t writev(int fildes, const struct iovec *iov, int iovcnt)
+{
+ int i, r;
+ char *p;
+ size_t l, sum;
+
+ /* We should buffer */
+ sum= 0;
+ for (i= 0; i<iovcnt; i++)
+ {
+ p= iov[i].iov_base;
+ l= iov[i].iov_len;
+ while (l > 0)
+ {
+ r= send(fildes, p, l, 0);
+ if (r <= 0)
+ {
+ errno =WSAGetLastError();
+ if(errno == WSAEWOULDBLOCK)
+ errno = EAGAIN;
+ if (sum)
+ return sum;
+ else
+ return r;
+ }
+ p += r;
+ l -= r;
+ sum += r;
+ }
+ }
+ return sum;
+}
+#endif
+
+static int set_fd_flags(const int fd)
+{
+#ifdef _MSC_VER
+ unsigned long arg = 1;
+ int ret = ioctlsocket (fd, FIONBIO, &arg);
+#else
+ int flags = fcntl(fd, F_GETFL, 0);
+ if(flags == -1)
+ return 0;
+ flags |= O_NONBLOCK;
+ if(fcntl(fd, F_SETFL, flags) == -1)
+ return 0;
+ if(fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
+ return 0;
+#endif
+ return 1;
+}
+
+static int write_setup(xcb_connection_t *c, xcb_auth_info_t *auth_info)
+{
+ static const char pad[3];
+ xcb_setup_request_t out;
+ struct iovec parts[6];
+ int count = 0;
+ static const uint32_t endian = 0x01020304;
+ int ret;
+
+ memset(&out, 0, sizeof(out));
+
+ /* B = 0x42 = MSB first, l = 0x6c = LSB first */
+ if(htonl(endian) == endian)
+ out.byte_order = 0x42;
+ else
+ out.byte_order = 0x6c;
+ out.protocol_major_version = X_PROTOCOL;
+ out.protocol_minor_version = X_PROTOCOL_REVISION;
+ out.authorization_protocol_name_len = 0;
+ out.authorization_protocol_data_len = 0;
+ parts[count].iov_len = sizeof(xcb_setup_request_t);
+ parts[count++].iov_base = (caddr_t) &out;
+ parts[count].iov_len = XCB_PAD(sizeof(xcb_setup_request_t));
+ parts[count++].iov_base = (char *) pad;
+
+ if(auth_info)
+ {
+ parts[count].iov_len = out.authorization_protocol_name_len = auth_info->namelen;
+ parts[count++].iov_base = auth_info->name;
+ parts[count].iov_len = XCB_PAD(out.authorization_protocol_name_len);
+ parts[count++].iov_base = (char *) pad;
+ parts[count].iov_len = out.authorization_protocol_data_len = auth_info->datalen;
+ parts[count++].iov_base = auth_info->data;
+ parts[count].iov_len = XCB_PAD(out.authorization_protocol_data_len);
+ parts[count++].iov_base = (char *) pad;
+ }
+ assert(count <= (int) (sizeof(parts) / sizeof(*parts)));
+
+ pthread_mutex_lock(&c->iolock);
+ ret = _xcb_out_send(c, parts, count);
+ pthread_mutex_unlock(&c->iolock);
+ return ret;
+}
+
+static int read_setup(xcb_connection_t *c)
+{
+ /* Read the server response */
+ c->setup = malloc(sizeof(xcb_setup_generic_t));
+ if(!c->setup)
+ return 0;
+
+ if(_xcb_in_read_block(c, c->setup, sizeof(xcb_setup_generic_t)) != sizeof(xcb_setup_generic_t))
+ return 0;
+
+ {
+ void *tmp = realloc(c->setup, c->setup->length * 4 + sizeof(xcb_setup_generic_t));
+ if(!tmp)
+ return 0;
+ c->setup = tmp;
+ }
+
+ if(_xcb_in_read_block(c, (char *) c->setup + sizeof(xcb_setup_generic_t), c->setup->length * 4) <= 0)
+ return 0;
+
+ /* 0 = failed, 2 = authenticate, 1 = success */
+ switch(c->setup->status)
+ {
+ case 0: /* failed */
+ {
+ xcb_setup_failed_t *setup = (xcb_setup_failed_t *) c->setup;
+ write(STDERR_FILENO, xcb_setup_failed_reason(setup), xcb_setup_failed_reason_length(setup));
+ return 0;
+ }
+
+ case 2: /* authenticate */
+ {
+ xcb_setup_authenticate_t *setup = (xcb_setup_authenticate_t *) c->setup;
+ write(STDERR_FILENO, xcb_setup_authenticate_reason(setup), xcb_setup_authenticate_reason_length(setup));
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+/* precondition: there must be something for us to write. */
+static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count)
+{
+ int n;
+ assert(!c->out.queue_len);
+ n = writev(c->fd, *vector, *count);
+ if(n < 0 && errno == EAGAIN)
+ return 1;
+ if(n <= 0)
+ {
+ _xcb_conn_shutdown(c);
+ return 0;
+ }
+
+ for(; *count; --*count, ++*vector)
+ {
+ int cur = (*vector)->iov_len;
+ if(cur > n)
+ cur = n;
+ (*vector)->iov_len -= cur;
+ (*vector)->iov_base = (char *) (*vector)->iov_base + cur;
+ n -= cur;
+ if((*vector)->iov_len)
+ break;
+ }
+ if(!*count)
+ *vector = 0;
+ assert(n == 0);
+ return 1;
+}
+
+/* Public interface */
+
+const xcb_setup_t *xcb_get_setup(xcb_connection_t *c)
+{
+ if(c->has_error)
+ return 0;
+ /* doesn't need locking because it's never written to. */
+ return c->setup;
+}
+
+int xcb_get_file_descriptor(xcb_connection_t *c)
+{
+ if(c->has_error)
+ return -1;
+ /* doesn't need locking because it's never written to. */
+ return c->fd;
+}
+
+int xcb_connection_has_error(xcb_connection_t *c)
+{
+ /* doesn't need locking because it's read and written atomically. */
+ return c->has_error;
+}
+
+xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info)
+{
+ xcb_connection_t* c;
+
+ c = calloc(1, sizeof(xcb_connection_t));
+ if(!c) {
+ close(fd);
+ return (xcb_connection_t *) &error_connection;
+ }
+
+ c->fd = fd;
+
+ if(!(
+ set_fd_flags(fd) &&
+ pthread_mutex_init(&c->iolock, 0) == 0 &&
+ _xcb_in_init(&c->in) &&
+ _xcb_out_init(&c->out) &&
+ write_setup(c, auth_info) &&
+ read_setup(c) &&
+ _xcb_ext_init(c) &&
+ _xcb_xid_init(c)
+ ))
+ {
+ xcb_disconnect(c);
+ return (xcb_connection_t *) &error_connection;
+ }
+
+ return c;
+}
+
+void xcb_disconnect(xcb_connection_t *c)
+{
+ if(c->has_error)
+ return;
+
+ free(c->setup);
+ close(c->fd);
+
+ pthread_mutex_destroy(&c->iolock);
+ _xcb_in_destroy(&c->in);
+ _xcb_out_destroy(&c->out);
+
+ _xcb_ext_destroy(c);
+ _xcb_xid_destroy(c);
+
+ free(c);
+}
+
+/* Private interface */
+
+void _xcb_conn_shutdown(xcb_connection_t *c)
+{
+ c->has_error = 1;
+}
+
+int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vector, int *count)
+{
+ int ret;
+#if USE_POLL
+ struct pollfd fd;
+#else
+ fd_set rfds, wfds;
+#endif
+
+ /* If the thing I should be doing is already being done, wait for it. */
+ if(count ? c->out.writing : c->in.reading)
+ {
+ pthread_cond_wait(cond, &c->iolock);
+ return 1;
+ }
+
+#if USE_POLL
+ memset(&fd, 0, sizeof(fd));
+ fd.fd = c->fd;
+ fd.events = POLLIN;
+#else
+ FD_ZERO(&rfds);
+ FD_SET(c->fd, &rfds);
+#endif
+ ++c->in.reading;
+
+#if USE_POLL
+ if(count)
+ {
+ fd.events |= POLLOUT;
+ ++c->out.writing;
+ }
+#else
+ FD_ZERO(&wfds);
+ if(count)
+ {
+ FD_SET(c->fd, &wfds);
+ ++c->out.writing;
+ }
+#endif
+
+ pthread_mutex_unlock(&c->iolock);
+ do {
+#if USE_POLL
+ ret = poll(&fd, 1, -1);
+#else
+ ret = select(c->fd + 1, &rfds, &wfds, 0, 0);
+ if (ret==SOCKET_ERROR)
+ {
+ ret=-1;
+ errno = WSAGetLastError();
+ if (errno == WSAEINTR)
+ errno=EINTR;
+ }
+#endif
+ } while (ret == -1 && errno == EINTR);
+ if(ret < 0)
+ {
+ _xcb_conn_shutdown(c);
+ ret = 0;
+ }
+ pthread_mutex_lock(&c->iolock);
+
+ if(ret)
+ {
+#if USE_POLL
+ if((fd.revents & POLLIN) == POLLIN)
+#else
+ if(FD_ISSET(c->fd, &rfds))
+#endif
+ ret = ret && _xcb_in_read(c);
+
+#if USE_POLL
+ if((fd.revents & POLLOUT) == POLLOUT)
+#else
+ if(FD_ISSET(c->fd, &wfds))
+#endif
+ ret = ret && write_vec(c, vector, count);
+ }
+
+ if(count)
+ --c->out.writing;
+ --c->in.reading;
+
+ return ret;
+}
diff --git a/xorg-server/exa/exa.c b/xorg-server/exa/exa.c
index 823c9a23f..eda9ad7a7 100644
--- a/xorg-server/exa/exa.c
+++ b/xorg-server/exa/exa.c
@@ -435,6 +435,29 @@ exaFinishAccess(DrawablePtr pDrawable, int index)
(*pExaScr->info->FinishAccess) (pPixmap, i);
}
+
+/**
+ * Helper for things common to all schemes when a pixmap is destroyed
+ */
+void
+exaDestroyPixmap(PixmapPtr pPixmap)
+{
+ ExaScreenPriv(pPixmap->drawable.pScreen);
+ int i;
+
+ /* Finish access if it was prepared (e.g. pixmap created during
+ * software fallback)
+ */
+ for (i = 0; i < EXA_NUM_PREPARE_INDICES; i++) {
+ if (pExaScr->access[i].pixmap == pPixmap) {
+ exaFinishAccess(&pPixmap->drawable, i);
+ pExaScr->access[i].pixmap = NULL;
+ break;
+ }
+ }
+}
+
+
/**
* Here begins EXA's GC code.
* Do not ever access the fb/mi layer directly.
diff --git a/xorg-server/exa/exa_classic.c b/xorg-server/exa/exa_classic.c
index 8f24daeeb..1a1467848 100644
--- a/xorg-server/exa/exa_classic.c
+++ b/xorg-server/exa/exa_classic.c
@@ -221,9 +221,7 @@ exaDestroyPixmap_classic (PixmapPtr pPixmap)
{
ExaPixmapPriv (pPixmap);
- /* During a fallback we must finish access, but we don't know the index. */
- if (pExaScr->fallback_counter)
- exaFinishAccess(&pPixmap->drawable, -1);
+ exaDestroyPixmap(pPixmap);
if (pExaPixmap->area)
{
diff --git a/xorg-server/exa/exa_driver.c b/xorg-server/exa/exa_driver.c
index abe79baad..3849a7c01 100644
--- a/xorg-server/exa/exa_driver.c
+++ b/xorg-server/exa/exa_driver.c
@@ -1,226 +1,224 @@
-/*
- * Copyright © 2009 Maarten Maathuis
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <string.h>
-
-#include "exa_priv.h"
-#include "exa.h"
-
-/* This file holds the driver allocated pixmaps specific implementation. */
-
-static _X_INLINE void*
-ExaGetPixmapAddress(PixmapPtr p)
-{
- ExaPixmapPriv(p);
-
- return pExaPixmap->sys_ptr;
-}
-
-/**
- * exaCreatePixmap() creates a new pixmap.
- *
- * Pixmaps are always marked as pinned, because exa has no control over them.
- */
-PixmapPtr
-exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint)
-{
- PixmapPtr pPixmap;
- ExaPixmapPrivPtr pExaPixmap;
- int bpp;
- size_t paddedWidth, datasize;
- ExaScreenPriv(pScreen);
-
- if (w > 32767 || h > 32767)
- return NullPixmap;
-
- swap(pExaScr, pScreen, CreatePixmap);
- pPixmap = pScreen->CreatePixmap(pScreen, 0, 0, depth, usage_hint);
- swap(pExaScr, pScreen, CreatePixmap);
-
- if (!pPixmap)
- return NULL;
-
- pExaPixmap = ExaGetPixmapPriv(pPixmap);
- pExaPixmap->driverPriv = NULL;
-
- bpp = pPixmap->drawable.bitsPerPixel;
-
- /* Set this before driver hooks, to allow for driver pixmaps without gpu
- * memory to back it. These pixmaps have a valid pointer at all times.
- */
- pPixmap->devPrivate.ptr = NULL;
-
- if (pExaScr->info->CreatePixmap2) {
- int new_pitch = 0;
- pExaPixmap->driverPriv = pExaScr->info->CreatePixmap2(pScreen, w, h, depth, usage_hint, bpp, &new_pitch);
- paddedWidth = pExaPixmap->fb_pitch = new_pitch;
- }
- else {
- paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
- if (paddedWidth / 4 > 32767 || h > 32767)
- return NullPixmap;
-
- exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
-
- if (paddedWidth < pExaPixmap->fb_pitch)
- paddedWidth = pExaPixmap->fb_pitch;
- datasize = h * paddedWidth;
- pExaPixmap->driverPriv = pExaScr->info->CreatePixmap(pScreen, datasize, 0);
- }
-
- if (!pExaPixmap->driverPriv) {
- swap(pExaScr, pScreen, DestroyPixmap);
- pScreen->DestroyPixmap (pPixmap);
- swap(pExaScr, pScreen, DestroyPixmap);
- return NULL;
- }
-
- /* Allow ModifyPixmapHeader to set sys_ptr appropriately. */
- pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
- pExaPixmap->fb_ptr = NULL;
- pExaPixmap->pDamage = NULL;
- pExaPixmap->sys_ptr = NULL;
-
- (*pScreen->ModifyPixmapHeader)(pPixmap, w, h, 0, 0,
- paddedWidth, NULL);
-
- pExaPixmap->area = NULL;
-
- exaSetAccelBlock(pExaScr, pExaPixmap,
- w, h, bpp);
-
- /* During a fallback we must prepare access. */
- if (pExaScr->fallback_counter)
- exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_AUX_DEST);
-
- return pPixmap;
-}
-
-Bool
-exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth,
- int bitsPerPixel, int devKind, pointer pPixData)
-{
- ScreenPtr pScreen;
- ExaScreenPrivPtr pExaScr;
- ExaPixmapPrivPtr pExaPixmap;
- Bool ret;
-
- if (!pPixmap)
- return FALSE;
-
- pScreen = pPixmap->drawable.pScreen;
- pExaScr = ExaGetScreenPriv(pScreen);
- pExaPixmap = ExaGetPixmapPriv(pPixmap);
-
- if (pExaPixmap) {
- if (pPixData)
- pExaPixmap->sys_ptr = pPixData;
-
- if (devKind > 0)
- pExaPixmap->sys_pitch = devKind;
-
- if (width > 0 && height > 0 && bitsPerPixel > 0) {
- exaSetFbPitch(pExaScr, pExaPixmap,
- width, height, bitsPerPixel);
-
- exaSetAccelBlock(pExaScr, pExaPixmap,
- width, height, bitsPerPixel);
- }
- }
-
- if (pExaScr->info->ModifyPixmapHeader) {
- ret = pExaScr->info->ModifyPixmapHeader(pPixmap, width, height, depth,
- bitsPerPixel, devKind, pPixData);
- /* For EXA_HANDLES_PIXMAPS, we set pPixData to NULL.
- * If pPixmap->devPrivate.ptr is non-NULL, then we've got a
- * !has_gpu_copy pixmap. We need to store the pointer,
- * because PrepareAccess won't be called.
- */
- if (!pPixData && pPixmap->devPrivate.ptr && pPixmap->devKind) {
- pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr;
- pExaPixmap->sys_pitch = pPixmap->devKind;
- }
- if (ret == TRUE)
- goto out;
- }
-
- swap(pExaScr, pScreen, ModifyPixmapHeader);
- ret = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth,
- bitsPerPixel, devKind, pPixData);
- swap(pExaScr, pScreen, ModifyPixmapHeader);
-
-out:
- /* Always NULL this, we don't want lingering pointers. */
- pPixmap->devPrivate.ptr = NULL;
-
- return ret;
-}
-
-Bool
-exaDestroyPixmap_driver (PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- ExaScreenPriv(pScreen);
- Bool ret;
-
- if (pPixmap->refcnt == 1)
- {
- ExaPixmapPriv (pPixmap);
-
- /* During a fallback we must finish access, but we don't know the index. */
- if (pExaScr->fallback_counter)
- exaFinishAccess(&pPixmap->drawable, -1);
-
- if (pExaPixmap->driverPriv)
- pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
- pExaPixmap->driverPriv = NULL;
- }
-
- swap(pExaScr, pScreen, DestroyPixmap);
- ret = pScreen->DestroyPixmap (pPixmap);
- swap(pExaScr, pScreen, DestroyPixmap);
-
- return ret;
-}
-
-Bool
-exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- ExaScreenPriv(pScreen);
- pointer saved_ptr;
- Bool ret;
-
- saved_ptr = pPixmap->devPrivate.ptr;
- pPixmap->devPrivate.ptr = ExaGetPixmapAddress(pPixmap);
- ret = pExaScr->info->PixmapIsOffscreen(pPixmap);
- pPixmap->devPrivate.ptr = saved_ptr;
-
- return ret;
-}
+/*
+ * Copyright © 2009 Maarten Maathuis
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <string.h>
+
+#include "exa_priv.h"
+#include "exa.h"
+
+/* This file holds the driver allocated pixmaps specific implementation. */
+
+static _X_INLINE void*
+ExaGetPixmapAddress(PixmapPtr p)
+{
+ ExaPixmapPriv(p);
+
+ return pExaPixmap->sys_ptr;
+}
+
+/**
+ * exaCreatePixmap() creates a new pixmap.
+ *
+ * Pixmaps are always marked as pinned, because exa has no control over them.
+ */
+PixmapPtr
+exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
+ unsigned usage_hint)
+{
+ PixmapPtr pPixmap;
+ ExaPixmapPrivPtr pExaPixmap;
+ int bpp;
+ size_t paddedWidth, datasize;
+ ExaScreenPriv(pScreen);
+
+ if (w > 32767 || h > 32767)
+ return NullPixmap;
+
+ swap(pExaScr, pScreen, CreatePixmap);
+ pPixmap = pScreen->CreatePixmap(pScreen, 0, 0, depth, usage_hint);
+ swap(pExaScr, pScreen, CreatePixmap);
+
+ if (!pPixmap)
+ return NULL;
+
+ pExaPixmap = ExaGetPixmapPriv(pPixmap);
+ pExaPixmap->driverPriv = NULL;
+
+ bpp = pPixmap->drawable.bitsPerPixel;
+
+ /* Set this before driver hooks, to allow for driver pixmaps without gpu
+ * memory to back it. These pixmaps have a valid pointer at all times.
+ */
+ pPixmap->devPrivate.ptr = NULL;
+
+ if (pExaScr->info->CreatePixmap2) {
+ int new_pitch = 0;
+ pExaPixmap->driverPriv = pExaScr->info->CreatePixmap2(pScreen, w, h, depth, usage_hint, bpp, &new_pitch);
+ paddedWidth = pExaPixmap->fb_pitch = new_pitch;
+ }
+ else {
+ paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
+ if (paddedWidth / 4 > 32767 || h > 32767)
+ return NullPixmap;
+
+ exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
+
+ if (paddedWidth < pExaPixmap->fb_pitch)
+ paddedWidth = pExaPixmap->fb_pitch;
+ datasize = h * paddedWidth;
+ pExaPixmap->driverPriv = pExaScr->info->CreatePixmap(pScreen, datasize, 0);
+ }
+
+ if (!pExaPixmap->driverPriv) {
+ swap(pExaScr, pScreen, DestroyPixmap);
+ pScreen->DestroyPixmap (pPixmap);
+ swap(pExaScr, pScreen, DestroyPixmap);
+ return NULL;
+ }
+
+ /* Allow ModifyPixmapHeader to set sys_ptr appropriately. */
+ pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
+ pExaPixmap->fb_ptr = NULL;
+ pExaPixmap->pDamage = NULL;
+ pExaPixmap->sys_ptr = NULL;
+
+ (*pScreen->ModifyPixmapHeader)(pPixmap, w, h, 0, 0,
+ paddedWidth, NULL);
+
+ pExaPixmap->area = NULL;
+
+ exaSetAccelBlock(pExaScr, pExaPixmap,
+ w, h, bpp);
+
+ /* During a fallback we must prepare access. */
+ if (pExaScr->fallback_counter)
+ exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_AUX_DEST);
+
+ return pPixmap;
+}
+
+Bool
+exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth,
+ int bitsPerPixel, int devKind, pointer pPixData)
+{
+ ScreenPtr pScreen;
+ ExaScreenPrivPtr pExaScr;
+ ExaPixmapPrivPtr pExaPixmap;
+ Bool ret;
+
+ if (!pPixmap)
+ return FALSE;
+
+ pScreen = pPixmap->drawable.pScreen;
+ pExaScr = ExaGetScreenPriv(pScreen);
+ pExaPixmap = ExaGetPixmapPriv(pPixmap);
+
+ if (pExaPixmap) {
+ if (pPixData)
+ pExaPixmap->sys_ptr = pPixData;
+
+ if (devKind > 0)
+ pExaPixmap->sys_pitch = devKind;
+
+ if (width > 0 && height > 0 && bitsPerPixel > 0) {
+ exaSetFbPitch(pExaScr, pExaPixmap,
+ width, height, bitsPerPixel);
+
+ exaSetAccelBlock(pExaScr, pExaPixmap,
+ width, height, bitsPerPixel);
+ }
+ }
+
+ if (pExaScr->info->ModifyPixmapHeader) {
+ ret = pExaScr->info->ModifyPixmapHeader(pPixmap, width, height, depth,
+ bitsPerPixel, devKind, pPixData);
+ /* For EXA_HANDLES_PIXMAPS, we set pPixData to NULL.
+ * If pPixmap->devPrivate.ptr is non-NULL, then we've got a
+ * !has_gpu_copy pixmap. We need to store the pointer,
+ * because PrepareAccess won't be called.
+ */
+ if (!pPixData && pPixmap->devPrivate.ptr && pPixmap->devKind) {
+ pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr;
+ pExaPixmap->sys_pitch = pPixmap->devKind;
+ }
+ if (ret == TRUE)
+ goto out;
+ }
+
+ swap(pExaScr, pScreen, ModifyPixmapHeader);
+ ret = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth,
+ bitsPerPixel, devKind, pPixData);
+ swap(pExaScr, pScreen, ModifyPixmapHeader);
+
+out:
+ /* Always NULL this, we don't want lingering pointers. */
+ pPixmap->devPrivate.ptr = NULL;
+
+ return ret;
+}
+
+Bool
+exaDestroyPixmap_driver (PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ ExaScreenPriv(pScreen);
+ Bool ret;
+
+ if (pPixmap->refcnt == 1)
+ {
+ ExaPixmapPriv (pPixmap);
+
+ exaDestroyPixmap(pPixmap);
+
+ if (pExaPixmap->driverPriv)
+ pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
+ pExaPixmap->driverPriv = NULL;
+ }
+
+ swap(pExaScr, pScreen, DestroyPixmap);
+ ret = pScreen->DestroyPixmap (pPixmap);
+ swap(pExaScr, pScreen, DestroyPixmap);
+
+ return ret;
+}
+
+Bool
+exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ ExaScreenPriv(pScreen);
+ pointer saved_ptr;
+ Bool ret;
+
+ saved_ptr = pPixmap->devPrivate.ptr;
+ pPixmap->devPrivate.ptr = ExaGetPixmapAddress(pPixmap);
+ ret = pExaScr->info->PixmapIsOffscreen(pPixmap);
+ pPixmap->devPrivate.ptr = saved_ptr;
+
+ return ret;
+}
diff --git a/xorg-server/exa/exa_mixed.c b/xorg-server/exa/exa_mixed.c
index 4425cede4..52144c9ad 100644
--- a/xorg-server/exa/exa_mixed.c
+++ b/xorg-server/exa/exa_mixed.c
@@ -245,9 +245,7 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap)
{
ExaPixmapPriv (pPixmap);
- /* During a fallback we must finish access, but we don't know the index. */
- if (pExaScr->fallback_counter)
- exaFinishAccess(&pPixmap->drawable, -1);
+ exaDestroyPixmap(pPixmap);
if (pExaScr->deferred_mixed_pixmap == pPixmap)
pExaScr->deferred_mixed_pixmap = NULL;
diff --git a/xorg-server/exa/exa_priv.h b/xorg-server/exa/exa_priv.h
index baf49590a..1b8cf294a 100644
--- a/xorg-server/exa/exa_priv.h
+++ b/xorg-server/exa/exa_priv.h
@@ -551,6 +551,9 @@ void
exaFinishAccess(DrawablePtr pDrawable, int index);
void
+exaDestroyPixmap(PixmapPtr pPixmap);
+
+void
exaPixmapDirty(PixmapPtr pPix, int x1, int y1, int x2, int y2);
void
diff --git a/xorg-server/glx/glxdri.c b/xorg-server/glx/glxdri.c
index 73f6051f6..2733cb856 100644
--- a/xorg-server/glx/glxdri.c
+++ b/xorg-server/glx/glxdri.c
@@ -869,12 +869,21 @@ static const char dri_driver_path[] = DRI_DRIVER_PATH;
static Bool
glxDRIEnterVT (int index, int flags)
{
+ ScrnInfoPtr scrn = xf86Screens[index];
+ Bool ret;
__GLXDRIscreen *screen = (__GLXDRIscreen *)
glxGetScreen(screenInfo.screens[index]);
LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
- if (!(*screen->enterVT) (index, flags))
+ scrn->EnterVT = screen->enterVT;
+
+ ret = scrn->EnterVT (index, flags);
+
+ screen->enterVT = scrn->EnterVT;
+ scrn->EnterVT = glxDRIEnterVT;
+
+ if (!ret)
return FALSE;
glxResumeClients();
@@ -885,6 +894,7 @@ glxDRIEnterVT (int index, int flags)
static void
glxDRILeaveVT (int index, int flags)
{
+ ScrnInfoPtr scrn = xf86Screens[index];
__GLXDRIscreen *screen = (__GLXDRIscreen *)
glxGetScreen(screenInfo.screens[index]);
@@ -892,7 +902,10 @@ glxDRILeaveVT (int index, int flags)
glxSuspendClients();
- return (*screen->leaveVT) (index, flags);
+ scrn->LeaveVT = screen->leaveVT;
+ (*screen->leaveVT) (index, flags);
+ screen->leaveVT = scrn->LeaveVT;
+ scrn->LeaveVT = glxDRILeaveVT;
}
static void
diff --git a/xorg-server/glx/glxdri2.c b/xorg-server/glx/glxdri2.c
index 4419972b3..45a1903e4 100644
--- a/xorg-server/glx/glxdri2.c
+++ b/xorg-server/glx/glxdri2.c
@@ -605,12 +605,21 @@ static const char dri_driver_path[] = DRI_DRIVER_PATH;
static Bool
glxDRIEnterVT (int index, int flags)
{
+ ScrnInfoPtr scrn = xf86Screens[index];
+ Bool ret;
__GLXDRIscreen *screen = (__GLXDRIscreen *)
glxGetScreen(screenInfo.screens[index]);
LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
- if (!(*screen->enterVT) (index, flags))
+ scrn->EnterVT = screen->enterVT;
+
+ ret = scrn->EnterVT (index, flags);
+
+ screen->enterVT = scrn->EnterVT;
+ scrn->EnterVT = glxDRIEnterVT;
+
+ if (!ret)
return FALSE;
glxResumeClients();
@@ -621,6 +630,7 @@ glxDRIEnterVT (int index, int flags)
static void
glxDRILeaveVT (int index, int flags)
{
+ ScrnInfoPtr scrn = xf86Screens[index];
__GLXDRIscreen *screen = (__GLXDRIscreen *)
glxGetScreen(screenInfo.screens[index]);
@@ -628,7 +638,10 @@ glxDRILeaveVT (int index, int flags)
glxSuspendClients();
- return (*screen->leaveVT) (index, flags);
+ scrn->LeaveVT = screen->leaveVT;
+ (*screen->leaveVT) (index, flags);
+ screen->leaveVT = scrn->LeaveVT;
+ scrn->LeaveVT = glxDRILeaveVT;
}
static void
diff --git a/xorg-server/glx/makefile b/xorg-server/glx/makefile
index 65eac87fb..6146b991c 100644
--- a/xorg-server/glx/makefile
+++ b/xorg-server/glx/makefile
@@ -10,9 +10,11 @@ glapi_sources = \
indirect_size_get.c \
indirect_table.c \
glapi.c \
- glthread.c
+ glthread.c \
+
libglxdri_la_SOURCES = \
- extension_string.c
+ extension_string.c \
+
CSRCS = \
$(indirect_sources) \
diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
index e5fd0fb85..d75b86502 100644
--- a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
+++ b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
@@ -523,12 +523,16 @@ static Bool
VGAarbiterEnterVT(int index, int flags)
{
Bool val;
+ ScrnInfoPtr pScrn = xf86Screens[index];
ScreenPtr pScreen = screenInfo.screens[index];
VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
&pScreen->devPrivates, VGAarbiterScreenKey);
VGAGet();
- val = (*pScreenPriv->EnterVT)(index, flags);
+ pScrn->EnterVT = pScreenPriv->EnterVT;
+ val = (*pScrn->EnterVT)(index, flags);
+ pScreenPriv->EnterVT = pScrn->EnterVT;
+ pScrn->EnterVT = VGAarbiterEnterVT;
VGAPut();
return val;
}
@@ -536,12 +540,16 @@ VGAarbiterEnterVT(int index, int flags)
static void
VGAarbiterLeaveVT(int index, int flags)
{
+ ScrnInfoPtr pScrn = xf86Screens[index];
ScreenPtr pScreen = screenInfo.screens[index];
VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
&pScreen->devPrivates, VGAarbiterScreenKey);
VGAGet();
+ pScrn->LeaveVT = pScreenPriv->LeaveVT;
(*pScreenPriv->LeaveVT)(index, flags);
+ pScreenPriv->LeaveVT = pScrn->LeaveVT;
+ pScrn->LeaveVT = VGAarbiterLeaveVT;
VGAPut();
}
diff --git a/xorg-server/hw/xfree86/common/xf86cmap.c b/xorg-server/hw/xfree86/common/xf86cmap.c
index 851843faa..191ae6132 100644
--- a/xorg-server/hw/xfree86/common/xf86cmap.c
+++ b/xorg-server/hw/xfree86/common/xf86cmap.c
@@ -466,11 +466,17 @@ CMapInstallColormap(ColormapPtr pmap)
static Bool
CMapEnterVT(int index, int flags)
{
+ ScrnInfoPtr pScrn = xf86Screens[index];
ScreenPtr pScreen = screenInfo.screens[index];
+ Bool ret;
CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
&pScreen->devPrivates, CMapScreenKey);
- if((*pScreenPriv->EnterVT)(index, flags)) {
+ pScrn->EnterVT = pScreenPriv->EnterVT;
+ ret = (*pScreenPriv->EnterVT)(index, flags);
+ pScreenPriv->EnterVT = pScrn->EnterVT;
+ pScrn->EnterVT = CMapEnterVT;
+ if(ret) {
if(GetInstalledmiColormap(pScreen))
CMapReinstallMap(GetInstalledmiColormap(pScreen));
return TRUE;
diff --git a/xorg-server/hw/xfree86/common/xf86xv.c b/xorg-server/hw/xfree86/common/xf86xv.c
index 6dae62717..29c74f66e 100644
--- a/xorg-server/hw/xfree86/common/xf86xv.c
+++ b/xorg-server/hw/xfree86/common/xf86xv.c
@@ -1229,11 +1229,15 @@ xf86XVQueryAdaptors(
static Bool
xf86XVEnterVT(int index, int flags)
{
+ ScrnInfoPtr pScrn = xf86Screens[index];
ScreenPtr pScreen = screenInfo.screens[index];
XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
Bool ret;
+ pScrn->EnterVT = ScreenPriv->EnterVT;
ret = (*ScreenPriv->EnterVT)(index, flags);
+ ScreenPriv->EnterVT = pScrn->EnterVT;
+ pScrn->EnterVT = xf86XVEnterVT;
if(ret) WalkTree(pScreen, xf86XVReputAllVideo, 0);
@@ -1243,6 +1247,7 @@ xf86XVEnterVT(int index, int flags)
static void
xf86XVLeaveVT(int index, int flags)
{
+ ScrnInfoPtr pScrn = xf86Screens[index];
ScreenPtr pScreen = screenInfo.screens[index];
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
@@ -1274,7 +1279,10 @@ xf86XVLeaveVT(int index, int flags)
}
}
+ pScrn->LeaveVT = ScreenPriv->LeaveVT;
(*ScreenPriv->LeaveVT)(index, flags);
+ ScreenPriv->LeaveVT = pScrn->LeaveVT;
+ pScrn->LeaveVT = xf86XVLeaveVT;
}
static void
diff --git a/xorg-server/hw/xfree86/shadowfb/shadow.c b/xorg-server/hw/xfree86/shadowfb/shadow.c
index 4c7551de9..20e70d6ce 100644
--- a/xorg-server/hw/xfree86/shadowfb/shadow.c
+++ b/xorg-server/hw/xfree86/shadowfb/shadow.c
@@ -216,9 +216,14 @@ static Bool
ShadowEnterVT(int index, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[index];
+ Bool ret;
ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScrn->pScreen);
- if((*pPriv->EnterVT)(index, flags)) {
+ pScrn->EnterVT = pPriv->EnterVT;
+ ret = (*pPriv->EnterVT)(index, flags);
+ pPriv->EnterVT = pScrn->EnterVT;
+ pScrn->EnterVT = ShadowEnterVT;
+ if(ret) {
pPriv->vtSema = TRUE;
return TRUE;
}
@@ -229,11 +234,15 @@ ShadowEnterVT(int index, int flags)
static void
ShadowLeaveVT(int index, int flags)
{
+ ScrnInfoPtr pScrn = xf86Screens[index];
ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(xf86Screens[index]->pScreen);
pPriv->vtSema = FALSE;
+ pScrn->LeaveVT = pPriv->LeaveVT;
(*pPriv->LeaveVT)(index, flags);
+ pPriv->LeaveVT = pScrn->LeaveVT;
+ pScrn->LeaveVT = ShadowLeaveVT;
}
/**********************************************************/
diff --git a/xorg-server/hw/xfree86/xaa/xaaInit.c b/xorg-server/hw/xfree86/xaa/xaaInit.c
index a4b235acf..ff1dd3d8b 100644
--- a/xorg-server/hw/xfree86/xaa/xaaInit.c
+++ b/xorg-server/hw/xfree86/xaa/xaaInit.c
@@ -508,16 +508,23 @@ XAAChangeWindowAttributes (WindowPtr pWin, unsigned long mask)
static Bool
XAAEnterVT(int index, int flags)
{
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ Bool ret;
ScreenPtr pScreen = screenInfo.screens[index];
XAAScreenPtr pScreenPriv =
(XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
- return((*pScreenPriv->EnterVT)(index, flags));
+ pScrn->EnterVT = pScreenPriv->EnterVT;
+ ret = ((*pScreenPriv->EnterVT)(index, flags));
+ pScreenPriv->EnterVT = pScrn->EnterVT;
+ pScrn->EnterVT = XAAEnterVT;
+ return ret;
}
static void
XAALeaveVT(int index, int flags)
{
+ ScrnInfoPtr pScrn = xf86Screens[index];
ScreenPtr pScreen = screenInfo.screens[index];
XAAScreenPtr pScreenPriv =
(XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
@@ -528,7 +535,10 @@ XAALeaveVT(int index, int flags)
infoRec->NeedToSync = FALSE;
}
+ pScrn->LeaveVT = pScreenPriv->LeaveVT;
(*pScreenPriv->LeaveVT)(index, flags);
+ pScreenPriv->LeaveVT = pScrn->LeaveVT;
+ pScrn->LeaveVT = XAALeaveVT;
}
typedef struct {
diff --git a/xorg-server/hw/xquartz/bundle/Info.plist.cpp b/xorg-server/hw/xquartz/bundle/Info.plist.cpp
index 91c8c0393..892eb5c19 100644
--- a/xorg-server/hw/xquartz/bundle/Info.plist.cpp
+++ b/xorg-server/hw/xquartz/bundle/Info.plist.cpp
@@ -1,47 +1,47 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleExecutable</key>
- <string>X11</string>
- <key>CFBundleGetInfoString</key>
- <string>LAUNCHD_ID_PREFIX.X11</string>
- <key>CFBundleIconFile</key>
- <string>X11.icns</string>
- <key>CFBundleIdentifier</key>
- <string>LAUNCHD_ID_PREFIX.X11</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleName</key>
- <string>APPLE_APPLICATION_NAME</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleShortVersionString</key>
- <string>2.5.1</string>
- <key>CFBundleVersion</key>
- <string>2.5.1</string>
- <key>CFBundleSignature</key>
- <string>x11a</string>
- <key>CSResourcesFileMapped</key>
- <true/>
-#ifdef XQUARTZ_SPARKLE
- <key>SUEnableAutomaticChecks</key>
- <true/>
- <key>SUPublicDSAKeyFile</key>
- <string>sparkle.pem</string>
- <key>SUFeedURL</key>
- <string>http://xquartz.macosforge.org/downloads/sparkle/release.xml</string>
-#endif
- <key>NSHumanReadableCopyright</key>
- <string>© 2003-2010 Apple Inc.
-© 2003 XFree86 Project, Inc.
-© 2003-2010 X.org Foundation, Inc.
-</string>
- <key>NSMainNibFile</key>
- <string>main</string>
- <key>NSPrincipalClass</key>
- <string>X11Application</string>
-</dict>
-</plist>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>X11</string>
+ <key>CFBundleGetInfoString</key>
+ <string>LAUNCHD_ID_PREFIX.X11</string>
+ <key>CFBundleIconFile</key>
+ <string>X11.icns</string>
+ <key>CFBundleIdentifier</key>
+ <string>LAUNCHD_ID_PREFIX.X11</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>APPLE_APPLICATION_NAME</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>2.6.0</string>
+ <key>CFBundleVersion</key>
+ <string>2.6.0</string>
+ <key>CFBundleSignature</key>
+ <string>x11a</string>
+ <key>CSResourcesFileMapped</key>
+ <true/>
+#ifdef XQUARTZ_SPARKLE
+ <key>SUEnableAutomaticChecks</key>
+ <true/>
+ <key>SUPublicDSAKeyFile</key>
+ <string>sparkle.pem</string>
+ <key>SUFeedURL</key>
+ <string>http://xquartz.macosforge.org/downloads/sparkle/release.xml</string>
+#endif
+ <key>NSHumanReadableCopyright</key>
+ <string>© 2003-2010 Apple Inc.
+© 2003 XFree86 Project, Inc.
+© 2003-2010 X.org Foundation, Inc.
+</string>
+ <key>NSMainNibFile</key>
+ <string>main</string>
+ <key>NSPrincipalClass</key>
+ <string>X11Application</string>
+</dict>
+</plist>
diff --git a/xorg-server/hw/xquartz/quartz.c b/xorg-server/hw/xquartz/quartz.c
index c7a4d018a..de54290ab 100644
--- a/xorg-server/hw/xquartz/quartz.c
+++ b/xorg-server/hw/xquartz/quartz.c
@@ -67,12 +67,8 @@
#define FAKE_RANDR 1
// Shared global variables for Quartz modes
-int quartzEventWriteFD = -1;
int quartzUseSysBeep = 0;
-int quartzUseAGL = 1;
-int quartzEnableKeyEquivalents = 1;
int quartzServerVisible = FALSE;
-int quartzServerQuitting = FALSE;
DevPrivateKeyRec quartzScreenKeyRec;
int aquaMenuBarHeight = 0;
QuartzModeProcsPtr quartzProcs = NULL;
diff --git a/xorg-server/hw/xquartz/quartzCocoa.m b/xorg-server/hw/xquartz/quartzCocoa.m
index 450147207..d1087015b 100644
--- a/xorg-server/hw/xquartz/quartzCocoa.m
+++ b/xorg-server/hw/xquartz/quartzCocoa.m
@@ -1,82 +1,71 @@
-/**************************************************************
- *
- * Quartz-specific support for the Darwin X Server
- * that requires Cocoa and Objective-C.
- *
- * This file is separate from the parts of Quartz support
- * that use X include files to avoid symbol collisions.
- *
- * Copyright (c) 2001-2004 Torrey T. Lyons and Greg Parker.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-
-#include "sanitizedCocoa.h"
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "quartzCommon.h"
-#include "inputstr.h"
-
-#include "darwin.h"
-
-/*
- * QuartzFSUseQDCursor
- * Return whether the screen should use a QuickDraw cursor.
- */
-int QuartzFSUseQDCursor(
- int depth) // screen depth
-{
- return TRUE;
-}
-
-
-/*
- * QuartzBlockHandler
- * Clean out any autoreleased objects.
- */
-void QuartzBlockHandler(
- pointer blockData,
- OSTimePtr pTimeout,
- pointer pReadmask)
-{
- static NSAutoreleasePool *aPool = nil;
-
- [aPool release];
- aPool = [[NSAutoreleasePool alloc] init];
-}
-
-
-/*
- * QuartzWakeupHandler
- */
-void QuartzWakeupHandler(
- pointer blockData,
- int result,
- pointer pReadmask)
-{
- // nothing here
-}
+/**************************************************************
+ *
+ * Quartz-specific support for the Darwin X Server
+ * that requires Cocoa and Objective-C.
+ *
+ * This file is separate from the parts of Quartz support
+ * that use X include files to avoid symbol collisions.
+ *
+ * Copyright (c) 2001-2004 Torrey T. Lyons and Greg Parker.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#include "sanitizedCocoa.h"
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "quartzCommon.h"
+#include "inputstr.h"
+
+#include "darwin.h"
+
+/*
+ * QuartzBlockHandler
+ * Clean out any autoreleased objects.
+ */
+void QuartzBlockHandler(
+ pointer blockData,
+ OSTimePtr pTimeout,
+ pointer pReadmask)
+{
+ static NSAutoreleasePool *aPool = nil;
+
+ [aPool release];
+ aPool = [[NSAutoreleasePool alloc] init];
+}
+
+
+/*
+ * QuartzWakeupHandler
+ */
+void QuartzWakeupHandler(
+ pointer blockData,
+ int result,
+ pointer pReadmask)
+{
+ // nothing here
+}
diff --git a/xorg-server/hw/xquartz/quartzCommon.h b/xorg-server/hw/xquartz/quartzCommon.h
index 12ed4057e..8c7b14faa 100644
--- a/xorg-server/hw/xquartz/quartzCommon.h
+++ b/xorg-server/hw/xquartz/quartzCommon.h
@@ -51,20 +51,13 @@ typedef struct {
#define QUARTZ_PRIV(pScreen) \
((QuartzScreenPtr)dixLookupPrivate(&pScreen->devPrivates, quartzScreenKey))
-// Data stored at startup for Cocoa front end
-extern int quartzEventWriteFD;
-
// User preferences used by Quartz modes
extern int quartzUseSysBeep;
-extern int focusOnNewWindow;
-extern int quartzUseAGL;
-extern int quartzEnableKeyEquivalents;
extern int quartzFullscreenDisableHotkeys;
extern int quartzOptionSendsAlt;
// Other shared data
extern int quartzServerVisible;
-extern int quartzServerQuitting;
extern DevPrivateKeyRec quartzScreenKeyRec;
#define quartzScreenKey (&quartzScreenKeyRec)
extern int aquaMenuBarHeight;
@@ -72,14 +65,6 @@ extern int aquaMenuBarHeight;
// Name of GLX bundle for native OpenGL
extern const char *quartzOpenGLBundle;
-void QuartzReadPreferences(void);
-void QuartzMessageMainThread(unsigned msg, void *data, unsigned length);
-void QuartzMessageServerThread(int type, int argc, ...);
-void QuartzSetWindowMenu(int nitems, const char **items,
- const char *shortcuts);
-void QuartzFSCapture(void);
-void QuartzFSRelease(void);
-int QuartzFSUseQDCursor(int depth);
void QuartzBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask);
void QuartzWakeupHandler(pointer blockData, int result, pointer pReadmask);
diff --git a/xorg-server/hw/xquartz/xpr/xprCursor.c b/xorg-server/hw/xquartz/xpr/xprCursor.c
index 9c7890647..07dd5c8fb 100644
--- a/xorg-server/hw/xquartz/xpr/xprCursor.c
+++ b/xorg-server/hw/xquartz/xpr/xprCursor.c
@@ -67,6 +67,7 @@ static Bool
load_cursor(CursorPtr src, int screen)
{
uint32_t *data;
+ Bool free_data = FALSE;
uint32_t rowbytes;
int width, height;
int hot_x, hot_y;
@@ -95,6 +96,7 @@ load_cursor(CursorPtr src, int screen)
unsigned i;
rowbytes = src->bits->width * sizeof (CARD32);
data = malloc(rowbytes * src->bits->height);
+ free_data = TRUE;
if(!data) {
FatalError("Failed to allocate memory in %s\n", __func__);
}
@@ -121,6 +123,7 @@ load_cursor(CursorPtr src, int screen)
/* round up to 8 pixel boundary so we can convert whole bytes */
rowbytes = ((src->bits->width * 4) + 31) & ~31;
data = malloc(rowbytes * src->bits->height);
+ free_data = TRUE;
if(!data) {
FatalError("Failed to allocate memory in %s\n", __func__);
}
@@ -173,7 +176,8 @@ load_cursor(CursorPtr src, int screen)
}
err = xp_set_cursor(width, height, hot_x, hot_y, data, rowbytes);
- free(data);
+ if(free_data)
+ free(data);
return err == Success;
}