Date: Sun, 20 Apr 2014 20:05:34 +0300 From: Ivan Klymenko <fidaj@ukr.net> To: x11@FreeBSD.org, ports@FreeBSD.org Subject: [CFT] x11-servers/xorg-server with initial (GCD) Grand Central Dispatch support Message-ID: <20140420200534.72226779@nonamehost.local>
next in thread | raw e-mail | index | archive | help
--MP_/9CxVygXMUZGi/OK9TuNNwf8 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi all. You are tired of frequent friezes xorg server? Are you bored messages in /var/log/Xorg.0.log: " ... [mi] EQ overflowing. Additional events will be discarded until existing events are processed. ... " ? :) Then you here! :) Patch attached :) If you like, we can continue to develop this area. Thanks --MP_/9CxVygXMUZGi/OK9TuNNwf8 Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=patch-xorg-server-GCD.txt diff --git a/xorg-server.orig/Makefile b/xorg-server/Makefile index 6d72766..54d3dc4 100644 --- a/xorg-server.orig/Makefile +++ b/xorg-server/Makefile @@ -20,11 +20,12 @@ RUN_DEPENDS= xkeyboard-config>=2.5:${PORTSDIR}/x11/xkeyboard-config \ XORG_CAT= xserver SLAVE_PORT?= no -OPTIONS_DEFINE= AIGLX SUID +OPTIONS_DEFINE= AIGLX SUID GCD OPTIONS_RADIO= CONF OPTIONS_RADIO_CONF= HAL DEVD AIGLX_DESC= Compile with Accelerated Indirect GLX support SUID_DESC= Install the Xorg server with setuid bit set +GCD_DESC= Grand Central Dispatch support HAL_DESC= Compile with HAL config support DEVD_DESC= Use devd for autoconfiguration of input devices (experimental) OPTIONS_DEFAULT=AIGLX SUID HAL @@ -113,6 +114,21 @@ CONFIGURE_ARGS+=--enable-install-setuid=no PLIST_SUB+= SUID="@comment " .endif +.if ${PORT_OPTIONS:MGCD} +EXTRA_PATCHES+= ${FILESDIR}/extra-GCD-dbe-dbe.c \ + ${FILESDIR}/extra-GCD-glx-glapi_gentable.c \ + ${FILESDIR}/extra-GCD-glx-glxdricommon.c \ + ${FILESDIR}/extra-GCD-glx-glxext.c \ + ${FILESDIR}/extra-GCD-glx-indirect_dispatch_swap.c \ + ${FILESDIR}/extra-GCD-hw-xfree86-dri-dri.c \ + ${FILESDIR}/extra-GCD-mi-mieq.c \ + ${FILESDIR}/extra-GCD-mi-mipointer.c + +LIB_DEPENDS+= libdispatch.so:${PORTSDIR}/devel/libdispatch +CONFIGURE_ENV+= CFLAGS="-Wall -fblocks" XORG_SYS_LIBS="-ldispatch" +.else +.endif + .if ${ARCH} == i386 .if defined(WITH_NEW_XORG) EXTRA_PATCHES+= ${FILESDIR}/extra-new-arch-i386 diff --git a/xorg-server/files/extra-GCD-dbe-dbe.c b/xorg-server/files/extra-GCD-dbe-dbe.c new file mode 100644 index 0000000..c1c546f --- /dev/null +++ b/xorg-server/files/extra-GCD-dbe-dbe.c @@ -0,0 +1,41 @@ +--- dbe/dbe.c.orig 2012-05-17 20:09:01.000000000 +0300 ++++ dbe/dbe.c 2014-04-20 19:33:43.000000000 +0300 +@@ -40,6 +40,7 @@ + #include <stdint.h> + #include <X11/X.h> + #include <X11/Xproto.h> ++#include <dispatch/dispatch.h> + #include "scrnintstr.h" + #include "extnsionst.h" + #include "gcstruct.h" +@@ -681,7 +682,8 @@ + /* Send off reply. */ + WriteToClient(client, sizeof(xDbeGetVisualInfoReply), (char *) &rep); + +- for (i = 0; i < count; i++) { ++ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ ++ for (int i = 0; i < count; i++) { + CARD32 data32; + + /* For each screen in the reply, send off the visual info */ +@@ -695,8 +697,9 @@ + + WriteToClient(client, sizeof(CARD32), (char *) &data32); + ++ dispatch_async(dispatch_get_main_queue(), ^{ + /* Now send off visual info items. */ +- for (j = 0; j < pScrVisInfo[i].count; j++) { ++ for (int j = 0; j < pScrVisInfo[i].count; j++) { + xDbeVisInfo visInfo; + + /* Copy the data in the client data structure to a protocol +@@ -720,7 +723,9 @@ + WriteToClient(client, 2 * sizeof(CARD32), + (char *) &visInfo.visualID); + } ++ }); + } ++ }); + + rc = Success; + diff --git a/xorg-server/files/extra-GCD-glx-glapi_gentable.c b/xorg-server/files/extra-GCD-glx-glapi_gentable.c new file mode 100644 index 0000000..8080a4c --- /dev/null +++ b/xorg-server/files/extra-GCD-glx-glapi_gentable.c @@ -0,0 +1,22 @@ +--- glx/glapi_gentable.c.orig 2012-05-17 20:09:02.000000000 +0300 ++++ glx/glapi_gentable.c 2014-04-20 19:00:24.000000000 +0300 +@@ -49,6 +49,7 @@ + #include <stdio.h> + + #include <GL/gl.h> ++#include <dispatch/dispatch.h> + + #include "glapi.h" + #include "glapitable.h" +@@ -105,9 +106,10 @@ + + p.p = __glapi_gentable_NoOp; + +- for (i = 0; i < entries; i++) ++ dispatch_apply(entries, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i){ + if (dispatch[i] == NULL) + dispatch[i] = p.v; ++ }); + } + + struct _glapi_table * diff --git a/xorg-server/files/extra-GCD-glx-glxdricommon.c b/xorg-server/files/extra-GCD-glx-glxdricommon.c new file mode 100644 index 0000000..0369cb3 --- /dev/null +++ b/xorg-server/files/extra-GCD-glx-glxdricommon.c @@ -0,0 +1,24 @@ +--- glx/glxdricommon.c.orig 2012-05-17 20:09:02.000000000 +0300 ++++ glx/glxdricommon.c 2014-04-20 19:03:18.000000000 +0300 +@@ -34,6 +34,7 @@ + #include <GL/gl.h> + #include <GL/glxtokens.h> + #include <GL/internal/dri_interface.h> ++#include <dispatch/dispatch.h> + #include <os.h> + #include "glxserver.h" + #include "glxcontext.h" +@@ -114,11 +115,12 @@ + { + int i; + +- for (i = 0; i < ARRAY_SIZE(attribMap); i++) ++ dispatch_apply(ARRAY_SIZE(attribMap), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i){ + if (attribMap[i].attrib == attrib) { + *(unsigned int *) ((char *) config + attribMap[i].offset) = value; + return; + } ++ }); + } + + static __GLXconfig * diff --git a/xorg-server/files/extra-GCD-glx-glxext.c b/xorg-server/files/extra-GCD-glx-glxext.c new file mode 100644 index 0000000..3cbcfbd --- /dev/null +++ b/xorg-server/files/extra-GCD-glx-glxext.c @@ -0,0 +1,40 @@ +--- glx/glxext.c.orig 2012-05-17 20:09:02.000000000 +0300 ++++ glx/glxext.c 2014-04-20 19:05:58.000000000 +0300 +@@ -39,6 +39,7 @@ + #include <registry.h> + #include "privates.h" + #include <os.h> ++#include <dispatch/dispatch.h> + #include "unpack.h" + #include "glxutil.h" + #include "glxext.h" +@@ -451,10 +452,10 @@ + { + int i; + +- for (i = 1; i < currentMaxClients; i++) { +- if (clients[i] && glxGetClient(clients[i])->inUse) +- IgnoreClient(clients[i]); +- } ++ dispatch_apply(currentMaxClients+1, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i){ ++ if (clients[i+1] && glxGetClient(clients[i+1])->inUse) ++ IgnoreClient(clients[i+1]); ++ }); + + glxBlockClients = TRUE; + } +@@ -467,10 +468,10 @@ + + glxBlockClients = FALSE; + +- for (i = 1; i < currentMaxClients; i++) { +- if (clients[i] && glxGetClient(clients[i])->inUse) +- AttendClient(clients[i]); +- } ++ dispatch_apply(currentMaxClients+1, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i){ ++ if (clients[i+1] && glxGetClient(clients[i+1])->inUse) ++ AttendClient(clients[i+1]); ++ }); + + __glXleaveServer(GL_FALSE); + for (cx = glxPendingDestroyContexts; cx != NULL; cx = next) { diff --git a/xorg-server/files/extra-GCD-glx-indirect_dispatch_swap.c b/xorg-server/files/extra-GCD-glx-indirect_dispatch_swap.c new file mode 100644 index 0000000..0166861 --- /dev/null +++ b/xorg-server/files/extra-GCD-glx-indirect_dispatch_swap.c @@ -0,0 +1,52 @@ +--- glx/indirect_dispatch_swap.c.orig 2012-05-17 20:09:02.000000000 +0300 ++++ glx/indirect_dispatch_swap.c 2014-04-20 19:10:59.000000000 +0300 +@@ -28,6 +28,7 @@ + #include <X11/Xmd.h> + #include <GL/gl.h> + #include <GL/glxproto.h> ++#include <dispatch/dispatch.h> + #include <inttypes.h> + #include "indirect_size.h" + #include "indirect_size_get.h" +@@ -129,11 +130,11 @@ + { + unsigned i; + +- for (i = 0; i < count; i++) { ++ dispatch_apply(count, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i){ + uint16_t temp = bswap_16(src[i]); + + src[i] = temp; +- } ++ }); + + return src; + } +@@ -143,11 +144,11 @@ + { + unsigned i; + +- for (i = 0; i < count; i++) { ++ dispatch_apply(count, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i){ + uint32_t temp = bswap_32(src[i]); + + src[i] = temp; +- } ++ }); + + return src; + } +@@ -157,11 +158,11 @@ + { + unsigned i; + +- for (i = 0; i < count; i++) { ++ dispatch_apply(count, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i){ + uint64_t temp = bswap_64(src[i]); + + src[i] = temp; +- } ++ }); + + return src; + } diff --git a/xorg-server/files/extra-GCD-hw-xfree86-dri-dri.c b/xorg-server/files/extra-GCD-hw-xfree86-dri-dri.c new file mode 100644 index 0000000..2bcf9c2 --- /dev/null +++ b/xorg-server/files/extra-GCD-hw-xfree86-dri-dri.c @@ -0,0 +1,41 @@ +--- hw/xfree86/dri/dri.c.orig 2012-05-17 20:09:03.000000000 +0300 ++++ hw/xfree86/dri/dri.c 2014-04-20 19:41:51.000000000 +0300 +@@ -47,6 +47,7 @@ + + #include <X11/X.h> + #include <X11/Xproto.h> ++#include <dispatch/dispatch.h> + #include "xf86drm.h" + #include "misc.h" + #include "dixstruct.h" +@@ -449,14 +450,13 @@ + if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD, + &reserved_count))) { + int i; +- void *tag; + +- for (i = 0; i < reserved_count; i++) { +- tag = DRICreateContextPrivFromHandle(pScreen, ++ dispatch_apply(reserved_count, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i){ ++ void *tag = DRICreateContextPrivFromHandle(pScreen, + reserved[i], + DRI_CONTEXT_RESERVED); + drmAddContextTag(pDRIPriv->drmFD, reserved[i], tag); +- } ++ }); + drmFreeReservedContextList(reserved); + DRIDrvMsg(pScreen->myNum, X_INFO, + "[drm] added %d reserved context%s for kernel\n", +@@ -705,10 +705,10 @@ + &reserved_count))) { + int i; + +- for (i = 0; i < reserved_count; i++) { ++ dispatch_apply(reserved_count, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i){ + DRIDestroyContextPriv(drmGetContextTag(pDRIPriv->drmFD, + reserved[i])); +- } ++ }); + drmFreeReservedContextList(reserved); + DRIDrvMsg(pScreen->myNum, X_INFO, + "[drm] removed %d reserved context%s for kernel\n", diff --git a/xorg-server/files/extra-GCD-mi-mieq.c b/xorg-server/files/extra-GCD-mi-mieq.c new file mode 100644 index 0000000..347a861 --- /dev/null +++ b/xorg-server/files/extra-GCD-mi-mieq.c @@ -0,0 +1,25 @@ +--- mi/mieq.c.orig 2012-05-17 20:09:04.000000000 +0300 ++++ mi/mieq.c 2014-04-20 18:50:49.000000000 +0300 +@@ -39,6 +39,7 @@ + #include <X11/X.h> + #include <X11/Xmd.h> + #include <X11/Xproto.h> ++#include <dispatch/dispatch.h> + #include "misc.h" + #include "windowstr.h" + #include "pixmapstr.h" +@@ -203,12 +204,12 @@ + { + int i; + +- for (i = 0; i < miEventQueue.nevents; i++) { ++ dispatch_apply(miEventQueue.nevents, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^(size_t i){ + if (miEventQueue.events[i].events != NULL) { + FreeEventList(miEventQueue.events[i].events, 1); + miEventQueue.events[i].events = NULL; + } +- } ++ }); + free(miEventQueue.events); + } + diff --git a/xorg-server/files/extra-GCD-mi-mipointer.c b/xorg-server/files/extra-GCD-mi-mipointer.c new file mode 100644 index 0000000..85040b9 --- /dev/null +++ b/xorg-server/files/extra-GCD-mi-mipointer.c @@ -0,0 +1,21 @@ +--- mi/mipointer.c.orig 2014-04-20 17:48:53.000000000 +0300 ++++ mi/mipointer.c 2014-04-20 17:52:58.000000000 +0300 +@@ -53,6 +53,7 @@ + #include <X11/X.h> + #include <X11/Xmd.h> + #include <X11/Xproto.h> ++#include <dispatch/dispatch.h> + #include "misc.h" + #include "windowstr.h" + #include "pixmapstr.h" +@@ -699,8 +700,9 @@ + #ifdef XQUARTZ + darwinEvents_lock(); + #endif +- for (i = 0; i < nevents; i++) ++ dispatch_apply(nevents, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^(size_t i){ + mieqEnqueue(pDev, &events[i]); ++ }); + #ifdef XQUARTZ + darwinEvents_unlock(); + #endif --MP_/9CxVygXMUZGi/OK9TuNNwf8--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140420200534.72226779>