diff options
author | marha <marha@users.sourceforge.net> | 2012-03-26 14:23:28 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-03-26 14:23:28 +0200 |
commit | 76bcc36ed305418a3ddc5752d287ede894243e1b (patch) | |
tree | bacb320c825768471ce56f058f17ce863d592376 /xorg-server/hw/dmx/glxProxy/glxcmdsswap.c | |
parent | 7d894e32566b710952c44cbc71939ad1d9e2fa8d (diff) | |
parent | 0f834b91a4768673833ab4917e87d86c237bb1a6 (diff) | |
download | vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.gz vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.bz2 vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
pixman/pixman/pixman-mmx.c
xorg-server/Xext/shm.c
xorg-server/Xext/syncsrv.h
xorg-server/Xext/xvmain.c
xorg-server/Xi/exevents.c
xorg-server/Xi/opendev.c
xorg-server/composite/compalloc.c
xorg-server/composite/compoverlay.c
xorg-server/dix/colormap.c
xorg-server/dix/devices.c
xorg-server/dix/dispatch.c
xorg-server/dix/dixfonts.c
xorg-server/dix/eventconvert.c
xorg-server/dix/events.c
xorg-server/dix/gc.c
xorg-server/dix/getevents.c
xorg-server/dix/main.c
xorg-server/dix/privates.c
xorg-server/dix/registry.c
xorg-server/dix/resource.c
xorg-server/exa/exa_accel.c
xorg-server/exa/exa_migration_classic.c
xorg-server/exa/exa_unaccel.c
xorg-server/fb/fb.h
xorg-server/fb/fbcopy.c
xorg-server/fb/fbpixmap.c
xorg-server/glx/dispatch.h
xorg-server/glx/glapi.h
xorg-server/glx/glapi_gentable.c
xorg-server/glx/glapitable.h
xorg-server/glx/glprocs.h
xorg-server/glx/glxcmds.c
xorg-server/glx/glxcmdsswap.c
xorg-server/glx/glxdricommon.c
xorg-server/glx/glxdriswrast.c
xorg-server/glx/glxext.c
xorg-server/glx/indirect_dispatch.c
xorg-server/glx/indirect_dispatch.h
xorg-server/glx/indirect_dispatch_swap.c
xorg-server/glx/indirect_size.h
xorg-server/glx/indirect_size_get.h
xorg-server/glx/indirect_table.c
xorg-server/glx/indirect_util.c
xorg-server/glx/rensize.c
xorg-server/glx/single2swap.c
xorg-server/glx/singlepix.c
xorg-server/glx/singlepixswap.c
xorg-server/glx/singlesize.c
xorg-server/hw/dmx/dmxinit.c
xorg-server/hw/kdrive/ephyr/ephyr.c
xorg-server/hw/kdrive/ephyr/hostx.c
xorg-server/hw/kdrive/ephyr/hostx.h
xorg-server/hw/kdrive/src/kinput.c
xorg-server/hw/xfree86/common/compiler.h
xorg-server/hw/xwin/InitInput.c
xorg-server/hw/xwin/InitOutput.c
xorg-server/hw/xwin/ddraw.h
xorg-server/hw/xwin/glx/glwrap.c
xorg-server/hw/xwin/glx/indirect.c
xorg-server/hw/xwin/glx/wgl_ext_api.h
xorg-server/hw/xwin/glx/winpriv.c
xorg-server/hw/xwin/win.h
xorg-server/hw/xwin/winallpriv.c
xorg-server/hw/xwin/winauth.c
xorg-server/hw/xwin/winclipboard.h
xorg-server/hw/xwin/winclipboardinit.c
xorg-server/hw/xwin/winclipboardthread.c
xorg-server/hw/xwin/winclipboardunicode.c
xorg-server/hw/xwin/winclipboardwndproc.c
xorg-server/hw/xwin/winclipboardwrappers.c
xorg-server/hw/xwin/winclipboardxevents.c
xorg-server/hw/xwin/wincmap.c
xorg-server/hw/xwin/winconfig.c
xorg-server/hw/xwin/wincreatewnd.c
xorg-server/hw/xwin/wincursor.c
xorg-server/hw/xwin/windialogs.c
xorg-server/hw/xwin/winengine.c
xorg-server/hw/xwin/winerror.c
xorg-server/hw/xwin/wingc.c
xorg-server/hw/xwin/wingetsp.c
xorg-server/hw/xwin/winkeybd.c
xorg-server/hw/xwin/winkeybd.h
xorg-server/hw/xwin/winlayouts.h
xorg-server/hw/xwin/winmisc.c
xorg-server/hw/xwin/winmonitors.c
xorg-server/hw/xwin/winmouse.c
xorg-server/hw/xwin/winmsg.c
xorg-server/hw/xwin/winmsg.h
xorg-server/hw/xwin/winmultiwindowclass.c
xorg-server/hw/xwin/winmultiwindowicons.c
xorg-server/hw/xwin/winmultiwindowshape.c
xorg-server/hw/xwin/winmultiwindowwindow.c
xorg-server/hw/xwin/winmultiwindowwm.c
xorg-server/hw/xwin/winmultiwindowwndproc.c
xorg-server/hw/xwin/winnativegdi.c
xorg-server/hw/xwin/winpfbdd.c
xorg-server/hw/xwin/winpixmap.c
xorg-server/hw/xwin/winpolyline.c
xorg-server/hw/xwin/winprefs.c
xorg-server/hw/xwin/winprocarg.c
xorg-server/hw/xwin/winregistry.c
xorg-server/hw/xwin/winscrinit.c
xorg-server/hw/xwin/winsetsp.c
xorg-server/hw/xwin/winshaddd.c
xorg-server/hw/xwin/winshadddnl.c
xorg-server/hw/xwin/winshadgdi.c
xorg-server/hw/xwin/wintrayicon.c
xorg-server/hw/xwin/winwin32rootless.c
xorg-server/hw/xwin/winwin32rootlesswindow.c
xorg-server/hw/xwin/winwin32rootlesswndproc.c
xorg-server/hw/xwin/winwindow.c
xorg-server/hw/xwin/winwindow.h
xorg-server/hw/xwin/winwindowswm.c
xorg-server/hw/xwin/winwndproc.c
xorg-server/include/callback.h
xorg-server/include/dixstruct.h
xorg-server/include/misc.h
xorg-server/include/os.h
xorg-server/include/scrnintstr.h
xorg-server/mi/micmap.c
xorg-server/mi/miinitext.c
xorg-server/mi/mioverlay.c
xorg-server/mi/misprite.c
xorg-server/mi/mivaltree.c
xorg-server/mi/miwindow.c
xorg-server/miext/damage/damage.c
xorg-server/miext/rootless/rootlessGC.c
xorg-server/miext/rootless/rootlessWindow.c
xorg-server/os/WaitFor.c
xorg-server/os/access.c
xorg-server/os/connection.c
xorg-server/os/io.c
xorg-server/os/log.c
xorg-server/os/osinit.c
xorg-server/os/utils.c
xorg-server/os/xdmcp.c
xorg-server/os/xprintf.c
xorg-server/os/xstrans.c
xorg-server/render/mipict.c
xorg-server/xkb/xkbActions.c
xorg-server/xkb/xkbInit.c
xorg-server/xkeyboard-config/compat/default.in
Diffstat (limited to 'xorg-server/hw/dmx/glxProxy/glxcmdsswap.c')
-rw-r--r-- | xorg-server/hw/dmx/glxProxy/glxcmdsswap.c | 927 |
1 files changed, 512 insertions, 415 deletions
diff --git a/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c b/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c index f28a79df6..ec0e83d09 100644 --- a/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c +++ b/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c @@ -39,9 +39,9 @@ #include "glxext.h" #include "glxvendor.h" -extern int glxIsExtensionSupported( char *ext ); +extern int glxIsExtensionSupported(char *ext); -int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc); +int __glXSwapGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc); /************************************************************************/ @@ -52,9 +52,11 @@ int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc); ** it is called at the end of the unswapped routine. */ -int __glXSwapCreateContext(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapCreateContext(__GLXclientState * cl, GLbyte * pc) { xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -66,9 +68,11 @@ int __glXSwapCreateContext(__GLXclientState *cl, GLbyte *pc) return __glXCreateContext(cl, pc); } -int __glXSwapCreateNewContext(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapCreateNewContext(__GLXclientState * cl, GLbyte * pc) { xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -80,9 +84,11 @@ int __glXSwapCreateNewContext(__GLXclientState *cl, GLbyte *pc) return __glXCreateNewContext(cl, pc); } -int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapCreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc) { - xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc; + xGLXCreateContextWithConfigSGIXReq *req = + (xGLXCreateContextWithConfigSGIXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -94,10 +100,11 @@ int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) return __glXCreateContextWithConfigSGIX(cl, pc); } -int __glXSwapQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapQueryMaxSwapBarriersSGIX(__GLXclientState * cl, GLbyte * pc) { xGLXQueryMaxSwapBarriersSGIXReq *req = - (xGLXQueryMaxSwapBarriersSGIXReq *)pc; + (xGLXQueryMaxSwapBarriersSGIXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -106,9 +113,11 @@ int __glXSwapQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc) return __glXQueryMaxSwapBarriersSGIX(cl, pc); } -int __glXSwapBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapBindSwapBarrierSGIX(__GLXclientState * cl, GLbyte * pc) { - xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *)pc; + xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -118,9 +127,11 @@ int __glXSwapBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) return __glXBindSwapBarrierSGIX(cl, pc); } -int __glXSwapJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapJoinSwapGroupSGIX(__GLXclientState * cl, GLbyte * pc) { - xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *)pc; + xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -130,9 +141,11 @@ int __glXSwapJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc) return __glXJoinSwapGroupSGIX(cl, pc); } -int __glXSwapDestroyContext(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapDestroyContext(__GLXclientState * cl, GLbyte * pc) { xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -141,9 +154,11 @@ int __glXSwapDestroyContext(__GLXclientState *cl, GLbyte *pc) return __glXDestroyContext(cl, pc); } -int __glXSwapMakeCurrent(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapMakeCurrent(__GLXclientState * cl, GLbyte * pc) { xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -154,9 +169,11 @@ int __glXSwapMakeCurrent(__GLXclientState *cl, GLbyte *pc) return __glXMakeCurrent(cl, pc); } -int __glXSwapMakeContextCurrent(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapMakeContextCurrent(__GLXclientState * cl, GLbyte * pc) { xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -168,9 +185,11 @@ int __glXSwapMakeContextCurrent(__GLXclientState *cl, GLbyte *pc) return __glXMakeContextCurrent(cl, pc); } -int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapMakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc) { xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -182,9 +201,11 @@ int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) return __glXMakeCurrentReadSGI(cl, pc); } -int __glXSwapIsDirect(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapIsDirect(__GLXclientState * cl, GLbyte * pc) { xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -193,9 +214,11 @@ int __glXSwapIsDirect(__GLXclientState *cl, GLbyte *pc) return __glXIsDirect(cl, pc); } -int __glXSwapQueryVersion(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapQueryVersion(__GLXclientState * cl, GLbyte * pc) { xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -205,9 +228,11 @@ int __glXSwapQueryVersion(__GLXclientState *cl, GLbyte *pc) return __glXQueryVersion(cl, pc); } -int __glXSwapWaitGL(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapWaitGL(__GLXclientState * cl, GLbyte * pc) { xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -216,9 +241,11 @@ int __glXSwapWaitGL(__GLXclientState *cl, GLbyte *pc) return __glXWaitGL(cl, pc); } -int __glXSwapWaitX(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapWaitX(__GLXclientState * cl, GLbyte * pc) { xGLXWaitXReq *req = (xGLXWaitXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -227,9 +254,11 @@ int __glXSwapWaitX(__GLXclientState *cl, GLbyte *pc) return __glXWaitX(cl, pc); } -int __glXSwapCopyContext(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapCopyContext(__GLXclientState * cl, GLbyte * pc) { xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -240,9 +269,10 @@ int __glXSwapCopyContext(__GLXclientState *cl, GLbyte *pc) return __glXCopyContext(cl, pc); } -int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapGetVisualConfigs(__GLXclientState * cl, GLbyte * pc) { - ClientPtr client = cl->client; + ClientPtr client = cl->client; xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; xGLXGetVisualConfigsReply reply; __GLXscreenInfo *pGlxScreen; @@ -250,62 +280,63 @@ int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) CARD32 buf[__GLX_TOTAL_CONFIG]; unsigned int screen; int i, p; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&req->screen); screen = req->screen; if (screen >= screenInfo.numScreens) { - /* The client library must send a valid screen number. */ - client->errorValue = screen; - return BadValue; + /* The client library must send a valid screen number. */ + client->errorValue = screen; + return BadValue; } pGlxScreen = &__glXActiveScreens[screen]; reply.numVisuals = pGlxScreen->numGLXVisuals; reply.numProps = __GLX_TOTAL_CONFIG; reply.length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 * - __GLX_TOTAL_CONFIG) >> 2; + __GLX_TOTAL_CONFIG) >> 2; reply.type = X_Reply; reply.sequenceNumber = client->sequence; - + __GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_INT(&reply.length); __GLX_SWAP_INT(&reply.numVisuals); __GLX_SWAP_INT(&reply.numProps); - WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply); - - for (i=0; i < pGlxScreen->numVisuals; i++) { - pGlxVisual = &pGlxScreen->pGlxVisual[i]; - if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) { - /* not a usable visual */ - continue; - } - p = 0; - buf[p++] = pGlxVisual->vid; - buf[p++] = pGlxVisual->class; - buf[p++] = pGlxVisual->rgba; - - buf[p++] = pGlxVisual->redSize; - buf[p++] = pGlxVisual->greenSize; - buf[p++] = pGlxVisual->blueSize; - buf[p++] = pGlxVisual->alphaSize; - buf[p++] = pGlxVisual->accumRedSize; - buf[p++] = pGlxVisual->accumGreenSize; - buf[p++] = pGlxVisual->accumBlueSize; - buf[p++] = pGlxVisual->accumAlphaSize; - - buf[p++] = pGlxVisual->doubleBuffer; - buf[p++] = pGlxVisual->stereo; - - buf[p++] = pGlxVisual->bufferSize; - buf[p++] = pGlxVisual->depthSize; - buf[p++] = pGlxVisual->stencilSize; - buf[p++] = pGlxVisual->auxBuffers; - buf[p++] = pGlxVisual->level; + WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *) &reply); + + for (i = 0; i < pGlxScreen->numVisuals; i++) { + pGlxVisual = &pGlxScreen->pGlxVisual[i]; + if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) { + /* not a usable visual */ + continue; + } + p = 0; + buf[p++] = pGlxVisual->vid; + buf[p++] = pGlxVisual->class; + buf[p++] = pGlxVisual->rgba; + + buf[p++] = pGlxVisual->redSize; + buf[p++] = pGlxVisual->greenSize; + buf[p++] = pGlxVisual->blueSize; + buf[p++] = pGlxVisual->alphaSize; + buf[p++] = pGlxVisual->accumRedSize; + buf[p++] = pGlxVisual->accumGreenSize; + buf[p++] = pGlxVisual->accumBlueSize; + buf[p++] = pGlxVisual->accumAlphaSize; + + buf[p++] = pGlxVisual->doubleBuffer; + buf[p++] = pGlxVisual->stereo; + + buf[p++] = pGlxVisual->bufferSize; + buf[p++] = pGlxVisual->depthSize; + buf[p++] = pGlxVisual->stencilSize; + buf[p++] = pGlxVisual->auxBuffers; + buf[p++] = pGlxVisual->level; /* - ** Add token/value pairs for extensions. - */ + ** Add token/value pairs for extensions. + */ buf[p++] = GLX_VISUAL_CAVEAT_EXT; buf[p++] = pGlxVisual->visualRating; buf[p++] = GLX_TRANSPARENT_TYPE_EXT; @@ -321,16 +352,18 @@ int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT; buf[p++] = pGlxVisual->transparentIndex; - __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG); - WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, - (char *)buf); + __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG); + WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, + (char *) buf); } return Success; } -int __glXSwapCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapCreateGLXPixmap(__GLXclientState * cl, GLbyte * pc) { xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -342,9 +375,11 @@ int __glXSwapCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) return __glXCreateGLXPixmap(cl, pc); } -int __glXSwapCreatePixmap(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapCreatePixmap(__GLXclientState * cl, GLbyte * pc) { xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -357,9 +392,11 @@ int __glXSwapCreatePixmap(__GLXclientState *cl, GLbyte *pc) return __glXCreatePixmap(cl, pc); } -int __glXSwapDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapDestroyGLXPixmap(__GLXclientState * cl, GLbyte * pc) { xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -368,9 +405,11 @@ int __glXSwapDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) return __glXDestroyGLXPixmap(cl, pc); } -int __glXSwapSwapBuffers(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapSwapBuffers(__GLXclientState * cl, GLbyte * pc) { xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -380,9 +419,11 @@ int __glXSwapSwapBuffers(__GLXclientState *cl, GLbyte *pc) return __glXSwapBuffers(cl, pc); } -int __glXSwapUseXFont(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapUseXFont(__GLXclientState * cl, GLbyte * pc) { xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -395,10 +436,11 @@ int __glXSwapUseXFont(__GLXclientState *cl, GLbyte *pc) return __glXUseXFont(cl, pc); } - -int __glXSwapQueryExtensionsString(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapQueryExtensionsString(__GLXclientState * cl, GLbyte * pc) { xGLXQueryExtensionsStringReq *req = NULL; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -407,9 +449,11 @@ int __glXSwapQueryExtensionsString(__GLXclientState *cl, GLbyte *pc) return __glXQueryExtensionsString(cl, pc); } -int __glXSwapQueryServerString(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapQueryServerString(__GLXclientState * cl, GLbyte * pc) { - xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *)pc; + xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -419,9 +463,11 @@ int __glXSwapQueryServerString(__GLXclientState *cl, GLbyte *pc) return __glXQueryServerString(cl, pc); } -int __glXSwapClientInfo(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapClientInfo(__GLXclientState * cl, GLbyte * pc) { - xGLXClientInfoReq *req = (xGLXClientInfoReq *)pc; + xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -432,15 +478,17 @@ int __glXSwapClientInfo(__GLXclientState *cl, GLbyte *pc) return __glXClientInfo(cl, pc); } -int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc) +int +__glXSwapQueryContextInfoEXT(__GLXclientState * cl, char *pc) { xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); - return __glXQueryContextInfoEXT(cl, (GLbyte *)pc); + return __glXQueryContextInfoEXT(cl, (GLbyte *) pc); } /************************************************************************/ @@ -449,7 +497,8 @@ int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc) ** Swap replies. */ -void __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReadSGIReply *reply) +void +__glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReadSGIReply * reply) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply->sequenceNumber); @@ -459,103 +508,120 @@ void __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReadSGIReply *r __GLX_SWAP_INT(&reply->writeType); __GLX_SWAP_INT(&reply->readVid); __GLX_SWAP_INT(&reply->readType); - WriteToClient(client, sz_xGLXMakeCurrentReadSGIReply, (char *)reply); + WriteToClient(client, sz_xGLXMakeCurrentReadSGIReply, (char *) reply); } -void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply *reply) +void +__glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply * reply) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); - WriteToClient(client, sz_xGLXIsDirectReply, (char *)reply); + WriteToClient(client, sz_xGLXIsDirectReply, (char *) reply); } -void __glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply *reply) +void +__glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply * reply) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->majorVersion); __GLX_SWAP_INT(&reply->minorVersion); - WriteToClient(client, sz_xGLXQueryVersionReply, (char *)reply); + WriteToClient(client, sz_xGLXQueryVersionReply, (char *) reply); } -void glxSwapQueryExtensionsStringReply(ClientPtr client, - xGLXQueryExtensionsStringReply *reply, char *buf) +void +glxSwapQueryExtensionsStringReply(ClientPtr client, + xGLXQueryExtensionsStringReply * reply, + char *buf) { int length = reply->length; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->n); - WriteToClient(client, sz_xGLXQueryExtensionsStringReply, (char *)reply); - __GLX_SWAP_INT_ARRAY((int *)buf, length); + WriteToClient(client, sz_xGLXQueryExtensionsStringReply, (char *) reply); + __GLX_SWAP_INT_ARRAY((int *) buf, length); WriteToClient(client, length << 2, buf); } -void glxSwapQueryServerStringReply(ClientPtr client, - xGLXQueryServerStringReply *reply, char *buf) +void +glxSwapQueryServerStringReply(ClientPtr client, + xGLXQueryServerStringReply * reply, char *buf) { int length = reply->length; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->n); - WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)reply); + WriteToClient(client, sz_xGLXQueryServerStringReply, (char *) reply); /** no swap is needed for an array of chars **/ /* __GLX_SWAP_INT_ARRAY((int *)buf, length); */ WriteToClient(client, length << 2, buf); } -void __glXSwapQueryContextInfoEXTReply(ClientPtr client, xGLXQueryContextInfoEXTReply *reply, int *buf) +void +__glXSwapQueryContextInfoEXTReply(ClientPtr client, + xGLXQueryContextInfoEXTReply * reply, + int *buf) { int length = reply->length; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->n); - WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)reply); - __GLX_SWAP_INT_ARRAY((int *)buf, length); - WriteToClient(client, length << 2, (char *)buf); + WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *) reply); + __GLX_SWAP_INT_ARRAY((int *) buf, length); + WriteToClient(client, length << 2, (char *) buf); } - -void __glXSwapQueryContextReply(ClientPtr client, - xGLXQueryContextReply *reply, int *buf) +void +__glXSwapQueryContextReply(ClientPtr client, + xGLXQueryContextReply * reply, int *buf) { int length = reply->length; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->n); - WriteToClient(client, sz_xGLXQueryContextReply, (char *)reply); - __GLX_SWAP_INT_ARRAY((int *)buf, length); - WriteToClient(client, length << 2, (char *)buf); + WriteToClient(client, sz_xGLXQueryContextReply, (char *) reply); + __GLX_SWAP_INT_ARRAY((int *) buf, length); + WriteToClient(client, length << 2, (char *) buf); } -void __glXSwapGetDrawableAttributesReply(ClientPtr client, - xGLXGetDrawableAttributesReply *reply, int *buf) +void +__glXSwapGetDrawableAttributesReply(ClientPtr client, + xGLXGetDrawableAttributesReply * reply, + int *buf) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->numAttribs); - __GLX_SWAP_INT_ARRAY( buf, reply->length ); - WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *)reply); - WriteToClient(client, reply->length << 2, (char *)buf); + __GLX_SWAP_INT_ARRAY(buf, reply->length); + WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *) reply); + WriteToClient(client, reply->length << 2, (char *) buf); } -void __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client, xGLXQueryMaxSwapBarriersSGIXReply *reply) +void +__glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client, + xGLXQueryMaxSwapBarriersSGIXReply * + reply) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->max); - WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply, (char *)reply); + WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply, (char *) reply); } /************************************************************************/ @@ -565,21 +631,23 @@ void __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client, xGLXQueryMaxSwapBa ** client library to send batches of GL rendering commands. */ -int __glXSwapRender(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapRender(__GLXclientState * cl, GLbyte * pc) { xGLXRenderReq *req; int left; __GLXrenderHeader *hdr; ClientPtr client = cl->client; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; /* - ** NOTE: much of this code also appears in the nonswapping version of this - ** routine, __glXRender(). Any changes made here should also be - ** duplicated there. - */ - + ** NOTE: much of this code also appears in the nonswapping version of this + ** routine, __glXRender(). Any changes made here should also be + ** duplicated there. + */ + req = (xGLXRenderReq *) pc; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); @@ -587,74 +655,81 @@ int __glXSwapRender(__GLXclientState *cl, GLbyte *pc) pc += sz_xGLXRenderReq; left = (req->length << 2) - sz_xGLXRenderReq; while (left > 0) { - void (* proc)(GLbyte *); - CARD16 opcode; - - /* - ** Verify that the header length and the overall length agree. - ** Also, each command must be word aligned. - */ - hdr = (__GLXrenderHeader *) pc; - __GLX_SWAP_SHORT(&hdr->length); - __GLX_SWAP_SHORT(&hdr->opcode); - - /* + void (*proc) (GLbyte *); + CARD16 opcode; + + /* + ** Verify that the header length and the overall length agree. + ** Also, each command must be word aligned. + */ + hdr = (__GLXrenderHeader *) pc; + __GLX_SWAP_SHORT(&hdr->length); + __GLX_SWAP_SHORT(&hdr->opcode); + + /* * call the command procedure to swap any arguments - */ - opcode = hdr->opcode; - if ( (opcode >= __GLX_MIN_RENDER_OPCODE) && - (opcode <= __GLX_MAX_RENDER_OPCODE) ) { - proc = __glXSwapRenderTable[opcode]; + */ + opcode = hdr->opcode; + if ((opcode >= __GLX_MIN_RENDER_OPCODE) && + (opcode <= __GLX_MAX_RENDER_OPCODE)) { + proc = __glXSwapRenderTable[opcode]; #if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT - } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) && - (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) { - int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT; - __GLXRenderSwapInfo *info = &__glXSwapRenderTable_EXT[index]; - if (info->swapfunc) { - proc = info->swapfunc; - } - else { - proc = NULL; - if (info->elem_size == 4 && info->nelems > 0) { - __GLX_SWAP_INT_ARRAY( (int *)(pc + __GLX_RENDER_HDR_SIZE), - info->nelems ); - } - else if (info->elem_size == 2 && info->nelems > 0) { - __GLX_SWAP_SHORT_ARRAY( (short *)(pc + __GLX_RENDER_HDR_SIZE), - info->nelems ); - } - else if (info->elem_size == 8 && info->nelems > 0) { - __GLX_SWAP_DOUBLE_ARRAY( (double *)(pc + __GLX_RENDER_HDR_SIZE), - info->nelems ); - } - } -#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ - } else { - client->errorValue = 0; - return __glXBadRenderRequest; - } - - if (proc != NULL) - (*proc)(pc + __GLX_RENDER_HDR_SIZE); - - /* - * proceed to the next command - */ - pc += hdr->length; - left -= hdr->length; + } + else if ((opcode >= __GLX_MIN_RENDER_OPCODE_EXT) && + (opcode <= __GLX_MAX_RENDER_OPCODE_EXT)) { + int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT; + __GLXRenderSwapInfo *info = &__glXSwapRenderTable_EXT[index]; + + if (info->swapfunc) { + proc = info->swapfunc; + } + else { + proc = NULL; + if (info->elem_size == 4 && info->nelems > 0) { + __GLX_SWAP_INT_ARRAY((int *) (pc + __GLX_RENDER_HDR_SIZE), + info->nelems); + } + else if (info->elem_size == 2 && info->nelems > 0) { + __GLX_SWAP_SHORT_ARRAY((short *) (pc + + __GLX_RENDER_HDR_SIZE), + info->nelems); + } + else if (info->elem_size == 8 && info->nelems > 0) { + __GLX_SWAP_DOUBLE_ARRAY((double *) (pc + + __GLX_RENDER_HDR_SIZE), + info->nelems); + } + } +#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ + } + else { + client->errorValue = 0; + return __glXBadRenderRequest; + } + + if (proc != NULL) + (*proc) (pc + __GLX_RENDER_HDR_SIZE); + + /* + * proceed to the next command + */ + pc += hdr->length; + left -= hdr->length; } - return __glXRender( cl, (GLbyte *)req ); + return __glXRender(cl, (GLbyte *) req); } /* ** Execute a large rendering request (one that spans multiple X requests). */ -int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapRenderLarge(__GLXclientState * cl, GLbyte * pc) { - ClientPtr client = cl->client; + ClientPtr client = cl->client; xGLXRenderLargeReq *req; __GLXrenderLargeHeader *hdr; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; @@ -666,134 +741,139 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_SHORT(&req->requestTotal); pc += sz_xGLXRenderLargeReq; - + if (req->requestNumber == 1) { - void (* proc)(GLbyte *) = NULL; - __GLXRenderSwapInfo *info = NULL; - CARD16 opcode; + void (*proc) (GLbyte *) = NULL; + __GLXRenderSwapInfo *info = NULL; + CARD16 opcode; - hdr = (__GLXrenderLargeHeader *) pc; - __GLX_SWAP_INT(&hdr->length); - __GLX_SWAP_INT(&hdr->opcode); + hdr = (__GLXrenderLargeHeader *) pc; + __GLX_SWAP_INT(&hdr->length); + __GLX_SWAP_INT(&hdr->opcode); - /* + /* * call the command procedure to swap any arguments - * Note that we are assuming that all arguments that needs to be - * swaped are on the first req only ! - */ - opcode = hdr->opcode; - if ( (opcode >= __GLX_MIN_RENDER_OPCODE) && - (opcode <= __GLX_MAX_RENDER_OPCODE) ) { - proc = __glXSwapRenderTable[opcode]; + * Note that we are assuming that all arguments that needs to be + * swaped are on the first req only ! + */ + opcode = hdr->opcode; + if ((opcode >= __GLX_MIN_RENDER_OPCODE) && + (opcode <= __GLX_MAX_RENDER_OPCODE)) { + proc = __glXSwapRenderTable[opcode]; #if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT - } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) && - (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) { - int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT; - info = &__glXSwapRenderTable_EXT[index]; - if (info->swapfunc) { - proc = info->swapfunc; - } -#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ - } else { - client->errorValue = 0; - cl->largeCmdRequestsTotal = 0; - return __glXBadLargeRequest; - } - - /* - ** Make enough space in the buffer, then copy the entire request. - */ - if (cl->largeCmdBufSize < hdr->length) { - if (!cl->largeCmdBuf) { - cl->largeCmdBuf = (GLbyte *) malloc(hdr->length); - } else { - cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, hdr->length); - } - if (!cl->largeCmdBuf) { - cl->largeCmdRequestsTotal = 0; - return BadAlloc; - } - cl->largeCmdBufSize = hdr->length; - } - memcpy(cl->largeCmdBuf, pc, req->dataBytes); - - cl->largeCmdBytesSoFar = req->dataBytes; - cl->largeCmdBytesTotal = hdr->length; - cl->largeCmdRequestsSoFar = 1; - cl->largeCmdRequestsTotal = req->requestTotal; - cl->largeCmdRequestsSwapProc = proc; - cl->largeCmdMaxReqDataSize = req->dataBytes; - cl->largeCmdRequestsSwap_info = info; - - return Success; - + } + else if ((opcode >= __GLX_MIN_RENDER_OPCODE_EXT) && + (opcode <= __GLX_MAX_RENDER_OPCODE_EXT)) { + int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT; + + info = &__glXSwapRenderTable_EXT[index]; + if (info->swapfunc) { + proc = info->swapfunc; + } +#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ + } + else { + client->errorValue = 0; + cl->largeCmdRequestsTotal = 0; + return __glXBadLargeRequest; + } + + /* + ** Make enough space in the buffer, then copy the entire request. + */ + if (cl->largeCmdBufSize < hdr->length) { + if (!cl->largeCmdBuf) { + cl->largeCmdBuf = (GLbyte *) malloc(hdr->length); + } + else { + cl->largeCmdBuf = + (GLbyte *) realloc(cl->largeCmdBuf, hdr->length); + } + if (!cl->largeCmdBuf) { + cl->largeCmdRequestsTotal = 0; + return BadAlloc; + } + cl->largeCmdBufSize = hdr->length; + } + memcpy(cl->largeCmdBuf, pc, req->dataBytes); + + cl->largeCmdBytesSoFar = req->dataBytes; + cl->largeCmdBytesTotal = hdr->length; + cl->largeCmdRequestsSoFar = 1; + cl->largeCmdRequestsTotal = req->requestTotal; + cl->largeCmdRequestsSwapProc = proc; + cl->largeCmdMaxReqDataSize = req->dataBytes; + cl->largeCmdRequestsSwap_info = info; + + return Success; } else if (req->requestNumber < cl->largeCmdRequestsTotal) { - /* - * This is not the first nor last request - just copy the data - */ - if ( cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) { - cl->largeCmdRequestsTotal = 0; - return __glXBadLargeRequest; - } + /* + * This is not the first nor last request - just copy the data + */ + if (cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) { + cl->largeCmdRequestsTotal = 0; + return __glXBadLargeRequest; + } - memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, - pc, req->dataBytes); + memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, req->dataBytes); - cl->largeCmdBytesSoFar += req->dataBytes; + cl->largeCmdBytesSoFar += req->dataBytes; - if (req->dataBytes > cl->largeCmdMaxReqDataSize) - cl->largeCmdMaxReqDataSize = req->dataBytes; + if (req->dataBytes > cl->largeCmdMaxReqDataSize) + cl->largeCmdMaxReqDataSize = req->dataBytes; - return Success; + return Success; } else if (req->requestNumber == cl->largeCmdRequestsTotal) { - /* - * this is the last request - * copy the remainder bytes, call the procedure to swap any - * needed data, and then call to transfer the command to all - * back-end servers - */ - if ( cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) { - cl->largeCmdRequestsTotal = 0; - return __glXBadLargeRequest; - } - - memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, - pc, req->dataBytes); - - cl->largeCmdBytesSoFar += req->dataBytes; - - if (req->dataBytes > cl->largeCmdMaxReqDataSize) - cl->largeCmdMaxReqDataSize = req->dataBytes; - - if (cl->largeCmdRequestsSwapProc != NULL) { - (*cl->largeCmdRequestsSwapProc)(cl->largeCmdBuf + __GLX_RENDER_LARGE_HDR_SIZE); - } - else if (cl->largeCmdRequestsSwap_info && - cl->largeCmdRequestsSwap_info->nelems > 0) { - if (cl->largeCmdRequestsSwap_info->elem_size == 4) { - __GLX_SWAP_INT_ARRAY( (int *)(pc + __GLX_RENDER_LARGE_HDR_SIZE), - cl->largeCmdRequestsSwap_info->nelems ); - } - else if (cl->largeCmdRequestsSwap_info->elem_size == 2) { - __GLX_SWAP_SHORT_ARRAY( (short *)(pc + __GLX_RENDER_LARGE_HDR_SIZE), - cl->largeCmdRequestsSwap_info->nelems ); - } - else if (cl->largeCmdRequestsSwap_info->elem_size == 8) { - __GLX_SWAP_DOUBLE_ARRAY( (double *)(pc + __GLX_RENDER_LARGE_HDR_SIZE), - cl->largeCmdRequestsSwap_info->nelems ); - } - } - - cl->largeCmdRequestsTotal = 0; - return( __glXSendLargeCommand(cl, req->contextTag) ); + /* + * this is the last request + * copy the remainder bytes, call the procedure to swap any + * needed data, and then call to transfer the command to all + * back-end servers + */ + if (cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) { + cl->largeCmdRequestsTotal = 0; + return __glXBadLargeRequest; + } + + memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, req->dataBytes); + + cl->largeCmdBytesSoFar += req->dataBytes; + + if (req->dataBytes > cl->largeCmdMaxReqDataSize) + cl->largeCmdMaxReqDataSize = req->dataBytes; + + if (cl->largeCmdRequestsSwapProc != NULL) { + (*cl->largeCmdRequestsSwapProc) (cl->largeCmdBuf + + __GLX_RENDER_LARGE_HDR_SIZE); + } + else if (cl->largeCmdRequestsSwap_info && + cl->largeCmdRequestsSwap_info->nelems > 0) { + if (cl->largeCmdRequestsSwap_info->elem_size == 4) { + __GLX_SWAP_INT_ARRAY((int *) (pc + __GLX_RENDER_LARGE_HDR_SIZE), + cl->largeCmdRequestsSwap_info->nelems); + } + else if (cl->largeCmdRequestsSwap_info->elem_size == 2) { + __GLX_SWAP_SHORT_ARRAY((short *) (pc + + __GLX_RENDER_LARGE_HDR_SIZE), + cl->largeCmdRequestsSwap_info->nelems); + } + else if (cl->largeCmdRequestsSwap_info->elem_size == 8) { + __GLX_SWAP_DOUBLE_ARRAY((double *) (pc + + __GLX_RENDER_LARGE_HDR_SIZE), + cl->largeCmdRequestsSwap_info->nelems); + } + } + + cl->largeCmdRequestsTotal = 0; + return (__glXSendLargeCommand(cl, req->contextTag)); } else { - cl->largeCmdRequestsTotal = 0; - return __glXBadLargeRequest; + cl->largeCmdRequestsTotal = 0; + return __glXBadLargeRequest; } } @@ -805,7 +885,8 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) ** allocating these entry points in the dispatch table. */ -int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapVendorPrivate(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateReq *req; CARD32 vendorCode; @@ -816,58 +897,58 @@ int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc) vendorCode = req->vendorCode; __GLX_SWAP_INT(&vendorCode); - - switch( vendorCode ) { - - case X_GLvop_DeleteTexturesEXT: - return __glXVForwardSingleReqSwap( cl, pc ); - break; - - case X_GLXvop_SwapIntervalSGI: - if (glxIsExtensionSupported("SGI_swap_control")) { - return __glXVForwardSingleReqSwap( cl, pc ); - } - else { - return Success; - } - break; - -#if 0 /* glx 1.3 */ - case X_GLXvop_CreateGLXVideoSourceSGIX: - break; - case X_GLXvop_DestroyGLXVideoSourceSGIX: - break; - case X_GLXvop_CreateGLXPixmapWithConfigSGIX: - break; - case X_GLXvop_DestroyGLXPbufferSGIX: - break; - case X_GLXvop_ChangeDrawableAttributesSGIX: - break; + switch (vendorCode) { + + case X_GLvop_DeleteTexturesEXT: + return __glXVForwardSingleReqSwap(cl, pc); + break; + + case X_GLXvop_SwapIntervalSGI: + if (glxIsExtensionSupported("SGI_swap_control")) { + return __glXVForwardSingleReqSwap(cl, pc); + } + else { + return Success; + } + break; + +#if 0 /* glx 1.3 */ + case X_GLXvop_CreateGLXVideoSourceSGIX: + break; + case X_GLXvop_DestroyGLXVideoSourceSGIX: + break; + case X_GLXvop_CreateGLXPixmapWithConfigSGIX: + break; + case X_GLXvop_DestroyGLXPbufferSGIX: + break; + case X_GLXvop_ChangeDrawableAttributesSGIX: + break; #endif - case X_GLXvop_JoinSwapGroupSGIX: - return __glXSwapJoinSwapGroupSGIX( cl, pc ); - break; + case X_GLXvop_JoinSwapGroupSGIX: + return __glXSwapJoinSwapGroupSGIX(cl, pc); + break; - case X_GLXvop_BindSwapBarrierSGIX: - return __glXSwapBindSwapBarrierSGIX( cl, pc ); - break; + case X_GLXvop_BindSwapBarrierSGIX: + return __glXSwapBindSwapBarrierSGIX(cl, pc); + break; - case X_GLXvop_CreateContextWithConfigSGIX: - return __glXSwapCreateContextWithConfigSGIX( cl, pc ); - break; + case X_GLXvop_CreateContextWithConfigSGIX: + return __glXSwapCreateContextWithConfigSGIX(cl, pc); + break; - default: - /* - ** unsupported private request - */ - cl->client->errorValue = req->vendorCode; - return __glXUnsupportedPrivateRequest; + default: + /* + ** unsupported private request + */ + cl->client->errorValue = req->vendorCode; + return __glXUnsupportedPrivateRequest; } } -int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapVendorPrivateWithReply(__GLXclientState * cl, GLbyte * pc) { xGLXVendorPrivateWithReplyReq *req; CARD32 vendorCode; @@ -878,76 +959,78 @@ int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) vendorCode = req->vendorCode; __GLX_SWAP_INT(&vendorCode); - switch( vendorCode ) { - - case X_GLvop_GetConvolutionFilterEXT: - case X_GLvop_GetSeparableFilterEXT: - case X_GLvop_GetHistogramEXT: - case X_GLvop_GetMinmaxEXT: - return( __glXNoSuchSingleOpcode(cl, pc) ); - break; - - case X_GLvop_GetConvolutionParameterfvEXT: - case X_GLvop_GetConvolutionParameterivEXT: - case X_GLvop_GetHistogramParameterivEXT: - case X_GLvop_GetMinmaxParameterfvEXT: - case X_GLvop_GetMinmaxParameterivEXT: - case X_GLvop_GenTexturesEXT: - return( __glXVForwardAllWithReplySwapiv(cl, pc) ); - break; - - case X_GLvop_AreTexturesResidentEXT: - case X_GLvop_IsTextureEXT: - return( __glXVForwardPipe0WithReplySwap(cl, pc) ); - break; - -#if 0 /* glx1.3 */ - case X_GLvop_GetDetailTexFuncSGIS: - case X_GLvop_GetSharpenTexFuncSGIS: - case X_GLvop_GetColorTableSGI: - case X_GLvop_GetColorTableParameterfvSGI: - case X_GLvop_GetColorTableParameterivSGI: - case X_GLvop_GetTexFilterFuncSGIS: - case X_GLvop_GetInstrumentsSGIX: - case X_GLvop_InstrumentsBufferSGIX: - case X_GLvop_PollInstrumentsSGIX: - case X_GLvop_FlushRasterSGIX: - case X_GLXvop_CreateGLXPbufferSGIX: - case X_GLXvop_GetDrawableAttributesSGIX: - case X_GLXvop_QueryHyperpipeNetworkSGIX: - case X_GLXvop_QueryHyperpipeConfigSGIX: - case X_GLXvop_HyperpipeConfigSGIX: - case X_GLXvop_DestroyHyperpipeConfigSGIX: + switch (vendorCode) { + + case X_GLvop_GetConvolutionFilterEXT: + case X_GLvop_GetSeparableFilterEXT: + case X_GLvop_GetHistogramEXT: + case X_GLvop_GetMinmaxEXT: + return (__glXNoSuchSingleOpcode(cl, pc)); + break; + + case X_GLvop_GetConvolutionParameterfvEXT: + case X_GLvop_GetConvolutionParameterivEXT: + case X_GLvop_GetHistogramParameterivEXT: + case X_GLvop_GetMinmaxParameterfvEXT: + case X_GLvop_GetMinmaxParameterivEXT: + case X_GLvop_GenTexturesEXT: + return (__glXVForwardAllWithReplySwapiv(cl, pc)); + break; + + case X_GLvop_AreTexturesResidentEXT: + case X_GLvop_IsTextureEXT: + return (__glXVForwardPipe0WithReplySwap(cl, pc)); + break; + +#if 0 /* glx1.3 */ + case X_GLvop_GetDetailTexFuncSGIS: + case X_GLvop_GetSharpenTexFuncSGIS: + case X_GLvop_GetColorTableSGI: + case X_GLvop_GetColorTableParameterfvSGI: + case X_GLvop_GetColorTableParameterivSGI: + case X_GLvop_GetTexFilterFuncSGIS: + case X_GLvop_GetInstrumentsSGIX: + case X_GLvop_InstrumentsBufferSGIX: + case X_GLvop_PollInstrumentsSGIX: + case X_GLvop_FlushRasterSGIX: + case X_GLXvop_CreateGLXPbufferSGIX: + case X_GLXvop_GetDrawableAttributesSGIX: + case X_GLXvop_QueryHyperpipeNetworkSGIX: + case X_GLXvop_QueryHyperpipeConfigSGIX: + case X_GLXvop_HyperpipeConfigSGIX: + case X_GLXvop_DestroyHyperpipeConfigSGIX: #endif - case X_GLXvop_QueryMaxSwapBarriersSGIX: - return( __glXSwapQueryMaxSwapBarriersSGIX(cl, pc) ); - break; - - case X_GLXvop_GetFBConfigsSGIX: - return( __glXSwapGetFBConfigsSGIX(cl, pc) ); - break; - - case X_GLXvop_MakeCurrentReadSGI: - return( __glXSwapMakeCurrentReadSGI(cl, pc) ); - break; - - case X_GLXvop_QueryContextInfoEXT: - return( __glXSwapQueryContextInfoEXT(cl,(char *)pc) ); - break; - - default: - /* - ** unsupported private request - */ - cl->client->errorValue = req->vendorCode; - return __glXUnsupportedPrivateRequest; + case X_GLXvop_QueryMaxSwapBarriersSGIX: + return (__glXSwapQueryMaxSwapBarriersSGIX(cl, pc)); + break; + + case X_GLXvop_GetFBConfigsSGIX: + return (__glXSwapGetFBConfigsSGIX(cl, pc)); + break; + + case X_GLXvop_MakeCurrentReadSGI: + return (__glXSwapMakeCurrentReadSGI(cl, pc)); + break; + + case X_GLXvop_QueryContextInfoEXT: + return (__glXSwapQueryContextInfoEXT(cl, (char *) pc)); + break; + + default: + /* + ** unsupported private request + */ + cl->client->errorValue = req->vendorCode; + return __glXUnsupportedPrivateRequest; } } -int __glXSwapGetFBConfigs(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapGetFBConfigs(__GLXclientState * cl, GLbyte * pc) { xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -956,22 +1039,25 @@ int __glXSwapGetFBConfigs(__GLXclientState *cl, GLbyte *pc) return __glXGetFBConfigs(cl, pc); } -int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc) { - xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *)pc; - xGLXGetFBConfigsReq new_req; + xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; + xGLXGetFBConfigsReq new_req; - new_req.reqType = req->reqType; - new_req.glxCode = req->glxCode; - new_req.length = req->length; - new_req.screen = req->screen; + new_req.reqType = req->reqType; + new_req.glxCode = req->glxCode; + new_req.length = req->length; + new_req.screen = req->screen; - return( __glXSwapGetFBConfigs( cl, (GLbyte *)&new_req ) ); + return (__glXSwapGetFBConfigs(cl, (GLbyte *) & new_req)); } -int __glXSwapCreateWindow(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapCreateWindow(__GLXclientState * cl, GLbyte * pc) { xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); @@ -981,37 +1067,42 @@ int __glXSwapCreateWindow(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(&req->glxwindow); __GLX_SWAP_INT(&req->numAttribs); - return( __glXCreateWindow( cl, (GLbyte *)pc ) ); + return (__glXCreateWindow(cl, (GLbyte *) pc)); } -int __glXSwapDestroyWindow(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapDestroyWindow(__GLXclientState * cl, GLbyte * pc) { xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->glxwindow); - return( __glXDestroyWindow( cl, (GLbyte *)pc ) ); + return (__glXDestroyWindow(cl, (GLbyte *) pc)); } -int __glXSwapQueryContext(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapQueryContext(__GLXclientState * cl, GLbyte * pc) { - xGLXQueryContextReq *req = (xGLXQueryContextReq *)pc; + xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); - return( __glXQueryContext(cl, (GLbyte *)pc) ); - + return (__glXQueryContext(cl, (GLbyte *) pc)); + } -int __glXSwapCreatePbuffer(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapCreatePbuffer(__GLXclientState * cl, GLbyte * pc) { - xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *)pc; + xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc; int nattr = req->numAttribs; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; @@ -1020,43 +1111,49 @@ int __glXSwapCreatePbuffer(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(&req->fbconfig); __GLX_SWAP_INT(&req->pbuffer); __GLX_SWAP_INT(&req->numAttribs); - __GLX_SWAP_INT_ARRAY( (int *)(req+1), nattr*2 ); + __GLX_SWAP_INT_ARRAY((int *) (req + 1), nattr * 2); - return( __glXCreatePbuffer( cl, pc ) ); + return (__glXCreatePbuffer(cl, pc)); } -int __glXSwapDestroyPbuffer(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapDestroyPbuffer(__GLXclientState * cl, GLbyte * pc) { xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->pbuffer); - return( __glXDestroyPbuffer( cl, (GLbyte *)pc ) ); + return (__glXDestroyPbuffer(cl, (GLbyte *) pc)); } -int __glXSwapGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc) { - xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc; + xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->drawable); - return( __glXGetDrawableAttributes(cl, pc) ); + return (__glXGetDrawableAttributes(cl, pc)); } -int __glXSwapChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) +int +__glXSwapChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc) { - xGLXChangeDrawableAttributesReq *req = (xGLXChangeDrawableAttributesReq *)pc; + xGLXChangeDrawableAttributesReq *req = + (xGLXChangeDrawableAttributesReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->drawable); __GLX_SWAP_INT(&req->numAttribs); - __GLX_SWAP_INT_ARRAY( (int *)(req+1), req->numAttribs * 2 ); + __GLX_SWAP_INT_ARRAY((int *) (req + 1), req->numAttribs * 2); - return( __glXChangeDrawableAttributes(cl, pc) ); + return (__glXChangeDrawableAttributes(cl, pc)); } |