diff options
author | marha <marha@users.sourceforge.net> | 2012-04-16 09:37:37 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-04-16 09:43:48 +0200 |
commit | 00eae6f01bf11ec6a90dfc68e607b6a1a250a118 (patch) | |
tree | b814d518076840b7433d02bc3b5957c1dd54de25 /xorg-server/hw/dmx/glxProxy | |
parent | a50d2ee664302147942dd5ed6428f9bab9d4e76a (diff) | |
parent | d6d3999ccb2cb72d55820770260172eccbbb68d7 (diff) | |
download | vcxsrv-00eae6f01bf11ec6a90dfc68e607b6a1a250a118.tar.gz vcxsrv-00eae6f01bf11ec6a90dfc68e607b6a1a250a118.tar.bz2 vcxsrv-00eae6f01bf11ec6a90dfc68e607b6a1a250a118.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
xorg-server/Xext/securitysrv.h
xorg-server/glx/glxext.h
xorg-server/glx/indirect_reqsize.c
xorg-server/glx/indirect_size_get.c
xorg-server/hw/xwin/winclip.c
xorg-server/hw/xwin/winfont.c
xorg-server/hw/xwin/winglobals.c
xorg-server/hw/xwin/winglobals.h
xorg-server/hw/xwin/winmonitors.h
xorg-server/include/closestr.h
xorg-server/include/pixmapstr.h
xorg-server/include/servermd.h
xorg-server/include/site.h
xorg-server/include/windowstr.h
xorg-server/include/xkbstr.h
Diffstat (limited to 'xorg-server/hw/dmx/glxProxy')
-rw-r--r-- | xorg-server/hw/dmx/glxProxy/compsize.h | 2 | ||||
-rw-r--r-- | xorg-server/hw/dmx/glxProxy/global.c | 2 | ||||
-rw-r--r-- | xorg-server/hw/dmx/glxProxy/glxcmds.h | 12 | ||||
-rw-r--r-- | xorg-server/hw/dmx/glxProxy/glxcontext.h | 56 | ||||
-rw-r--r-- | xorg-server/hw/dmx/glxProxy/glxdrawable.h | 5 | ||||
-rw-r--r-- | xorg-server/hw/dmx/glxProxy/glxerror.h | 1 | ||||
-rw-r--r-- | xorg-server/hw/dmx/glxProxy/glxscreens.h | 7 | ||||
-rw-r--r-- | xorg-server/hw/dmx/glxProxy/glxsingle.h | 30 | ||||
-rw-r--r-- | xorg-server/hw/dmx/glxProxy/glxswap.h | 12 | ||||
-rw-r--r-- | xorg-server/hw/dmx/glxProxy/unpack.h | 453 |
10 files changed, 284 insertions, 296 deletions
diff --git a/xorg-server/hw/dmx/glxProxy/compsize.h b/xorg-server/hw/dmx/glxProxy/compsize.h index 856c6f5ad..360966233 100644 --- a/xorg-server/hw/dmx/glxProxy/compsize.h +++ b/xorg-server/hw/dmx/glxProxy/compsize.h @@ -48,4 +48,4 @@ extern GLint __glTexGeniv_size(GLenum e); extern GLint __glTexParameterfv_size(GLenum e); extern GLint __glTexParameteriv_size(GLenum e); -#endif /* !__compsize_h__ */ +#endif /* !__compsize_h__ */ diff --git a/xorg-server/hw/dmx/glxProxy/global.c b/xorg-server/hw/dmx/glxProxy/global.c index 9cf8c11c3..6d4612deb 100644 --- a/xorg-server/hw/dmx/glxProxy/global.c +++ b/xorg-server/hw/dmx/glxProxy/global.c @@ -64,7 +64,7 @@ xGLXSingleReply __glXReply; ** A set of state for each client. The 0th one is unused because client ** indices start at 1, not 0. */ -__GLXclientState *__glXClients[MAXCLIENTS+1]; +__GLXclientState *__glXClients[MAXCLIENTS + 1]; int __glXVersionMajor; int __glXVersionMinor; diff --git a/xorg-server/hw/dmx/glxProxy/glxcmds.h b/xorg-server/hw/dmx/glxProxy/glxcmds.h index ae866be29..b0745927e 100644 --- a/xorg-server/hw/dmx/glxProxy/glxcmds.h +++ b/xorg-server/hw/dmx/glxProxy/glxcmds.h @@ -28,10 +28,10 @@ #ifndef __GLX_cmds_h__ #define __GLX_cmds_h__ -extern int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc); -extern int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); -extern int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc); -extern int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc); -extern int __glXQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc); +extern int __glXBindSwapBarrierSGIX(__GLXclientState * cl, GLbyte * pc); +extern int __glXCreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc); +extern int __glXJoinSwapGroupSGIX(__GLXclientState * cl, GLbyte * pc); +extern int __glXMakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc); +extern int __glXQueryMaxSwapBarriersSGIX(__GLXclientState * cl, GLbyte * pc); -#endif /* !__GLX_cmds_h__ */ +#endif /* !__GLX_cmds_h__ */ diff --git a/xorg-server/hw/dmx/glxProxy/glxcontext.h b/xorg-server/hw/dmx/glxProxy/glxcontext.h index f88093bc7..ac8c0573d 100644 --- a/xorg-server/hw/dmx/glxProxy/glxcontext.h +++ b/xorg-server/hw/dmx/glxProxy/glxcontext.h @@ -37,68 +37,68 @@ typedef struct __GLXcontextRec __GLXcontext; struct __GLXcontextRec { /* - ** list of context structs - */ + ** list of context structs + */ struct __GLXcontextRec *last; struct __GLXcontextRec *next; /* - ** Pointer to screen info data for this context. This is set - ** when the context is created. - */ + ** Pointer to screen info data for this context. This is set + ** when the context is created. + */ ScreenPtr pScreen; __GLXscreenInfo *pGlxScreen; /* - ** This context is created with respect to this visual. - */ + ** This context is created with respect to this visual. + */ VisualRec *pVisual; __GLXvisualConfig *pGlxVisual; __GLXFBConfig *pFBConfig; /* - ** The XID of this context. - */ + ** The XID of this context. + */ XID id; XID *real_ids; /* - ** The XID of the shareList context. - */ + ** The XID of the shareList context. + */ XID share_id; /* - ** Visual id. - */ + ** Visual id. + */ VisualID vid; VisualID *real_vids; /* - ** screen number. - */ + ** screen number. + */ GLint screen; /* - ** Whether this context's ID still exists. - */ + ** Whether this context's ID still exists. + */ GLboolean idExists; - + /* - ** Whether this context is current for some client. - */ + ** Whether this context is current for some client. + */ GLboolean isCurrent; - + /* - ** Buffers for feedback and selection. - */ + ** Buffers for feedback and selection. + */ GLfloat *feedbackBuf; - GLint feedbackBufSize; /* number of elements allocated */ + GLint feedbackBufSize; /* number of elements allocated */ GLuint *selectBuf; - GLint selectBufSize; /* number of elements allocated */ + GLint selectBufSize; /* number of elements allocated */ /* - ** Set only if current drawable is a glx pixmap. - */ + ** Set only if current drawable is a glx pixmap. + */ __GLXpixmap *pGlxPixmap; __GLXpixmap *pGlxReadPixmap; __glXWindow *pGlxWindow; @@ -108,4 +108,4 @@ struct __GLXcontextRec { }; -#endif /* !__GLX_context_h__ */ +#endif /* !__GLX_context_h__ */ diff --git a/xorg-server/hw/dmx/glxProxy/glxdrawable.h b/xorg-server/hw/dmx/glxProxy/glxdrawable.h index 8f2d81e26..0340896e5 100644 --- a/xorg-server/hw/dmx/glxProxy/glxdrawable.h +++ b/xorg-server/hw/dmx/glxProxy/glxdrawable.h @@ -48,12 +48,11 @@ typedef struct { DrawablePtr pDraw; int type; Bool idExists; - int refcnt; /* contexts bound */ + int refcnt; /* contexts bound */ __GLXFBConfig *pGlxFBConfig; ScreenPtr pScreen; } __glXWindow; - typedef struct { __GLXscreenInfo *pGlxScreen; __GLXFBConfig *pFBConfig; @@ -63,4 +62,4 @@ typedef struct { XID *be_xids; } __glXPbuffer; -#endif /* !__GLX_drawable_h__ */ +#endif /* !__GLX_drawable_h__ */ diff --git a/xorg-server/hw/dmx/glxProxy/glxerror.h b/xorg-server/hw/dmx/glxProxy/glxerror.h index d84ec4457..26492d2d4 100644 --- a/xorg-server/hw/dmx/glxProxy/glxerror.h +++ b/xorg-server/hw/dmx/glxProxy/glxerror.h @@ -48,5 +48,4 @@ extern int __glXUnsupportedPrivateRequest; extern int __glXBadFBConfig; extern int __glXBadPbuffer; - #endif diff --git a/xorg-server/hw/dmx/glxProxy/glxscreens.h b/xorg-server/hw/dmx/glxProxy/glxscreens.h index da50bdc85..a9fe2a9db 100644 --- a/xorg-server/hw/dmx/glxProxy/glxscreens.h +++ b/xorg-server/hw/dmx/glxProxy/glxscreens.h @@ -33,8 +33,6 @@ #include "GL/internal/glcore.h" - - typedef struct { __GLXvisualConfig *pGlxVisual; @@ -47,10 +45,9 @@ typedef struct { } __GLXscreenInfo; - extern void __glXScreenInit(GLint); extern void __glXScreenReset(void); -extern char *__glXGetServerString( unsigned int name ); +extern char *__glXGetServerString(unsigned int name); -#endif /* !__GLX_screens_h__ */ +#endif /* !__GLX_screens_h__ */ diff --git a/xorg-server/hw/dmx/glxProxy/glxsingle.h b/xorg-server/hw/dmx/glxProxy/glxsingle.h index 7c23537e8..32a9d4921 100644 --- a/xorg-server/hw/dmx/glxProxy/glxsingle.h +++ b/xorg-server/hw/dmx/glxProxy/glxsingle.h @@ -31,24 +31,24 @@ #ifndef __GLXSINGLE_H #define __GLXSINGLE_H -extern int __glXForwardSingleReq( __GLXclientState *cl, GLbyte *pc ); -extern int __glXForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc ); -extern int __glXForwardAllWithReply( __GLXclientState *cl, GLbyte *pc ); +extern int __glXForwardSingleReq(__GLXclientState * cl, GLbyte * pc); +extern int __glXForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc); +extern int __glXForwardAllWithReply(__GLXclientState * cl, GLbyte * pc); -extern int __glXForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc ); +extern int __glXForwardSingleReqSwap(__GLXclientState * cl, GLbyte * pc); -extern int __glXForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc ); -extern int __glXForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc ); -extern int __glXForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc ); -extern int __glXForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc ); +extern int __glXForwardPipe0WithReplySwap(__GLXclientState * cl, GLbyte * pc); +extern int __glXForwardPipe0WithReplySwapsv(__GLXclientState * cl, GLbyte * pc); +extern int __glXForwardPipe0WithReplySwapiv(__GLXclientState * cl, GLbyte * pc); +extern int __glXForwardPipe0WithReplySwapdv(__GLXclientState * cl, GLbyte * pc); -extern int __glXForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc ); -extern int __glXForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc ); -extern int __glXForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc ); -extern int __glXForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc ); +extern int __glXForwardAllWithReplySwap(__GLXclientState * cl, GLbyte * pc); +extern int __glXForwardAllWithReplySwapsv(__GLXclientState * cl, GLbyte * pc); +extern int __glXForwardAllWithReplySwapiv(__GLXclientState * cl, GLbyte * pc); +extern int __glXForwardAllWithReplySwapdv(__GLXclientState * cl, GLbyte * pc); -extern int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc); -extern int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc); -extern int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc); +extern int __glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc); +extern int __glXDispSwap_GetTexImage(__GLXclientState * cl, GLbyte * pc); +extern int __glXDispSwap_GetColorTable(__GLXclientState * cl, GLbyte * pc); #endif diff --git a/xorg-server/hw/dmx/glxProxy/glxswap.h b/xorg-server/hw/dmx/glxProxy/glxswap.h index 08e38df7b..1e1fea14f 100644 --- a/xorg-server/hw/dmx/glxProxy/glxswap.h +++ b/xorg-server/hw/dmx/glxProxy/glxswap.h @@ -34,13 +34,13 @@ #ifndef __GLX_swap_h__ #define __GLX_swap_h__ -extern int JoinSwapGroupSGIX(DrawablePtr pDraw, DrawablePtr pMember); -extern int SGSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag, - DrawablePtr pDraw); +extern int JoinSwapGroupSGIX(DrawablePtr pDraw, DrawablePtr pMember); +extern int SGSwapBuffers(__GLXclientState * cl, XID drawId, GLXContextTag tag, + DrawablePtr pDraw); extern void SwapBarrierInit(void); extern void SwapBarrierReset(void); -extern int QueryMaxSwapBarriersSGIX(int screen); -extern int BindSwapBarrierSGIX(DrawablePtr pDraw, int barrier); +extern int QueryMaxSwapBarriersSGIX(int screen); +extern int BindSwapBarrierSGIX(DrawablePtr pDraw, int barrier); -#endif /* !__GLX_swap_h__ */ +#endif /* !__GLX_swap_h__ */ diff --git a/xorg-server/hw/dmx/glxProxy/unpack.h b/xorg-server/hw/dmx/glxProxy/unpack.h index c592c3d92..b4b73580c 100644 --- a/xorg-server/hw/dmx/glxProxy/unpack.h +++ b/xorg-server/hw/dmx/glxProxy/unpack.h @@ -1,230 +1,223 @@ -#ifndef __GLX_unpack_h__
-#define __GLX_unpack_h__
-
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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
- * SILICON GRAPHICS, INC. 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 of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#define __GLX_PAD(s) (((s)+3) & (GLuint)~3)
-
-/*
-** Fetch the context-id out of a SingleReq request pointed to by pc.
-*/
-#define __GLX_GET_SINGLE_CONTEXT_TAG(pc) (((xGLXSingleReq*)pc)->contextTag)
-#define __GLX_GET_VENDPRIV_CONTEXT_TAG(pc) (((xGLXVendorPrivateReq*)pc)->contextTag)
-
-/*
-** Fetch a double from potentially unaligned memory.
-*/
-#ifdef __GLX_ALIGN64
-#define __GLX_MEM_COPY(dst,src,n) memmove(dst,src,n)
-#define __GLX_GET_DOUBLE(dst,src) __GLX_MEM_COPY(&dst,src,8)
-#else
-#define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src))
-#endif
-
-extern void __glXMemInit(void);
-
-extern xGLXSingleReply __glXReply;
-
-#define __GLX_BEGIN_REPLY(size) \
- __glXReply.length = __GLX_PAD(size) >> 2; \
- __glXReply.type = X_Reply; \
- __glXReply.sequenceNumber = client->sequence;
-
-#define __GLX_SEND_HEADER() \
- WriteToClient( client, sz_xGLXSingleReply, (char *)&__glXReply);
-
-#define __GLX_PUT_RETVAL(a) \
- __glXReply.retval = (a);
-
-#define __GLX_PUT_SIZE(a) \
- __glXReply.size = (a);
-
-#define __GLX_PUT_RENDERMODE(m) \
- __glXReply.pad3 = (m)
-
-/*
-** Get a buffer to hold returned data, with the given alignment. If we have
-** to realloc, allocate size+align, in case the pointer has to be bumped for
-** alignment. The answerBuffer should already be aligned.
-**
-** NOTE: the cast (long)res below assumes a long is large enough to hold a
-** pointer.
-*/
-#define __GLX_GET_ANSWER_BUFFER(res,cl,size,align) \
- if ((size) > sizeof(answerBuffer)) { \
- int bump; \
- if ((cl)->returnBufSize < (size)+(align)) { \
- (cl)->returnBuf = (GLbyte*)realloc((cl)->returnBuf, \
- (size)+(align)); \
- if (!(cl)->returnBuf) { \
- return BadAlloc; \
- } \
- (cl)->returnBufSize = (size)+(align); \
- } \
- res = (char*)cl->returnBuf; \
- bump = (long)(res) % (align); \
- if (bump) res += (align) - (bump); \
- } else { \
- res = (char *)answerBuffer; \
- }
-
-#define __GLX_PUT_BYTE() \
- *(GLbyte *)&__glXReply.pad3 = *(GLbyte *)answer
-
-#define __GLX_PUT_SHORT() \
- *(GLshort *)&__glXReply.pad3 = *(GLshort *)answer
-
-#define __GLX_PUT_INT() \
- *(GLint *)&__glXReply.pad3 = *(GLint *)answer
-
-#define __GLX_PUT_FLOAT() \
- *(GLfloat *)&__glXReply.pad3 = *(GLfloat *)answer
-
-#define __GLX_PUT_DOUBLE() \
- *(GLdouble *)&__glXReply.pad3 = *(GLdouble *)answer
-
-#define __GLX_SEND_BYTE_ARRAY(len) \
- WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), (char *)answer)
-
-#define __GLX_SEND_SHORT_ARRAY(len) \
- WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), (char *)answer)
-
-#define __GLX_SEND_INT_ARRAY(len) \
- WriteToClient(client, (len)*__GLX_SIZE_INT32, (char *)answer)
-
-#define __GLX_SEND_FLOAT_ARRAY(len) \
- WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, (char *)answer)
-
-#define __GLX_SEND_DOUBLE_ARRAY(len) \
- WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, (char *)answer)
-
-
-#define __GLX_SEND_VOID_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len)
-#define __GLX_SEND_UBYTE_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len)
-#define __GLX_SEND_USHORT_ARRAY(len) __GLX_SEND_SHORT_ARRAY(len)
-#define __GLX_SEND_UINT_ARRAY(len) __GLX_SEND_INT_ARRAY(len)
-
-/*
-** PERFORMANCE NOTE:
-** Machine dependent optimizations abound here; these swapping macros can
-** conceivably be replaced with routines that do the job faster.
-*/
-#define __GLX_DECLARE_SWAP_VARIABLES \
- GLbyte sw
-
-#define __GLX_DECLARE_SWAP_ARRAY_VARIABLES \
- GLbyte *swapPC; \
- GLbyte *swapEnd
-
-
-#define __GLX_SWAP_INT(pc) \
- sw = ((GLbyte *)(pc))[0]; \
- ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \
- ((GLbyte *)(pc))[3] = sw; \
- sw = ((GLbyte *)(pc))[1]; \
- ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \
- ((GLbyte *)(pc))[2] = sw;
-
-#define __GLX_SWAP_SHORT(pc) \
- sw = ((GLbyte *)(pc))[0]; \
- ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[1]; \
- ((GLbyte *)(pc))[1] = sw;
-
-#define __GLX_SWAP_DOUBLE(pc) \
- sw = ((GLbyte *)(pc))[0]; \
- ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[7]; \
- ((GLbyte *)(pc))[7] = sw; \
- sw = ((GLbyte *)(pc))[1]; \
- ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[6]; \
- ((GLbyte *)(pc))[6] = sw; \
- sw = ((GLbyte *)(pc))[2]; \
- ((GLbyte *)(pc))[2] = ((GLbyte *)(pc))[5]; \
- ((GLbyte *)(pc))[5] = sw; \
- sw = ((GLbyte *)(pc))[3]; \
- ((GLbyte *)(pc))[3] = ((GLbyte *)(pc))[4]; \
- ((GLbyte *)(pc))[4] = sw;
-
-#define __GLX_SWAP_FLOAT(pc) \
- sw = ((GLbyte *)(pc))[0]; \
- ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \
- ((GLbyte *)(pc))[3] = sw; \
- sw = ((GLbyte *)(pc))[1]; \
- ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \
- ((GLbyte *)(pc))[2] = sw;
-
-#define __GLX_SWAP_INT_ARRAY(pc, count) \
- swapPC = ((GLbyte *)(pc)); \
- swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT32;\
- while (swapPC < swapEnd) { \
- __GLX_SWAP_INT(swapPC); \
- swapPC += __GLX_SIZE_INT32; \
- }
-
-#define __GLX_SWAP_SHORT_ARRAY(pc, count) \
- swapPC = ((GLbyte *)(pc)); \
- swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT16;\
- while (swapPC < swapEnd) { \
- __GLX_SWAP_SHORT(swapPC); \
- swapPC += __GLX_SIZE_INT16; \
- }
-
-#define __GLX_SWAP_DOUBLE_ARRAY(pc, count) \
- swapPC = ((GLbyte *)(pc)); \
- swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT64;\
- while (swapPC < swapEnd) { \
- __GLX_SWAP_DOUBLE(swapPC); \
- swapPC += __GLX_SIZE_FLOAT64; \
- }
-
-#define __GLX_SWAP_FLOAT_ARRAY(pc, count) \
- swapPC = ((GLbyte *)(pc)); \
- swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT32;\
- while (swapPC < swapEnd) { \
- __GLX_SWAP_FLOAT(swapPC); \
- swapPC += __GLX_SIZE_FLOAT32; \
- }
-
-#define __GLX_SWAP_REPLY_HEADER() \
- __GLX_SWAP_SHORT(&__glXReply.sequenceNumber); \
- __GLX_SWAP_INT(&__glXReply.length);
-
-#define __GLX_SWAP_REPLY_RETVAL() \
- __GLX_SWAP_INT(&__glXReply.retval)
-
-#define __GLX_SWAP_REPLY_SIZE() \
- __GLX_SWAP_INT(&__glXReply.size)
-
-#endif /* !__GLX_unpack_h__ */
-
-
-
-
-
+#ifndef __GLX_unpack_h__ +#define __GLX_unpack_h__ + +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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 of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +#define __GLX_PAD(s) (((s)+3) & (GLuint)~3) + +/* +** Fetch the context-id out of a SingleReq request pointed to by pc. +*/ +#define __GLX_GET_SINGLE_CONTEXT_TAG(pc) (((xGLXSingleReq*)pc)->contextTag) +#define __GLX_GET_VENDPRIV_CONTEXT_TAG(pc) (((xGLXVendorPrivateReq*)pc)->contextTag) + +/* +** Fetch a double from potentially unaligned memory. +*/ +#ifdef __GLX_ALIGN64 +#define __GLX_MEM_COPY(dst,src,n) memmove(dst,src,n) +#define __GLX_GET_DOUBLE(dst,src) __GLX_MEM_COPY(&dst,src,8) +#else +#define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src)) +#endif + +extern void __glXMemInit(void); + +extern xGLXSingleReply __glXReply; + +#define __GLX_BEGIN_REPLY(size) \ + __glXReply.length = __GLX_PAD(size) >> 2; \ + __glXReply.type = X_Reply; \ + __glXReply.sequenceNumber = client->sequence; + +#define __GLX_SEND_HEADER() \ + WriteToClient( client, sz_xGLXSingleReply, (char *)&__glXReply); + +#define __GLX_PUT_RETVAL(a) \ + __glXReply.retval = (a); + +#define __GLX_PUT_SIZE(a) \ + __glXReply.size = (a); + +#define __GLX_PUT_RENDERMODE(m) \ + __glXReply.pad3 = (m) + +/* +** Get a buffer to hold returned data, with the given alignment. If we have +** to realloc, allocate size+align, in case the pointer has to be bumped for +** alignment. The answerBuffer should already be aligned. +** +** NOTE: the cast (long)res below assumes a long is large enough to hold a +** pointer. +*/ +#define __GLX_GET_ANSWER_BUFFER(res,cl,size,align) \ + if ((size) > sizeof(answerBuffer)) { \ + int bump; \ + if ((cl)->returnBufSize < (size)+(align)) { \ + (cl)->returnBuf = (GLbyte*)realloc((cl)->returnBuf, \ + (size)+(align)); \ + if (!(cl)->returnBuf) { \ + return BadAlloc; \ + } \ + (cl)->returnBufSize = (size)+(align); \ + } \ + res = (char*)cl->returnBuf; \ + bump = (long)(res) % (align); \ + if (bump) res += (align) - (bump); \ + } else { \ + res = (char *)answerBuffer; \ + } + +#define __GLX_PUT_BYTE() \ + *(GLbyte *)&__glXReply.pad3 = *(GLbyte *)answer + +#define __GLX_PUT_SHORT() \ + *(GLshort *)&__glXReply.pad3 = *(GLshort *)answer + +#define __GLX_PUT_INT() \ + *(GLint *)&__glXReply.pad3 = *(GLint *)answer + +#define __GLX_PUT_FLOAT() \ + *(GLfloat *)&__glXReply.pad3 = *(GLfloat *)answer + +#define __GLX_PUT_DOUBLE() \ + *(GLdouble *)&__glXReply.pad3 = *(GLdouble *)answer + +#define __GLX_SEND_BYTE_ARRAY(len) \ + WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), (char *)answer) + +#define __GLX_SEND_SHORT_ARRAY(len) \ + WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), (char *)answer) + +#define __GLX_SEND_INT_ARRAY(len) \ + WriteToClient(client, (len)*__GLX_SIZE_INT32, (char *)answer) + +#define __GLX_SEND_FLOAT_ARRAY(len) \ + WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, (char *)answer) + +#define __GLX_SEND_DOUBLE_ARRAY(len) \ + WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, (char *)answer) + +#define __GLX_SEND_VOID_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len) +#define __GLX_SEND_UBYTE_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len) +#define __GLX_SEND_USHORT_ARRAY(len) __GLX_SEND_SHORT_ARRAY(len) +#define __GLX_SEND_UINT_ARRAY(len) __GLX_SEND_INT_ARRAY(len) + +/* +** PERFORMANCE NOTE: +** Machine dependent optimizations abound here; these swapping macros can +** conceivably be replaced with routines that do the job faster. +*/ +#define __GLX_DECLARE_SWAP_VARIABLES \ + GLbyte sw + +#define __GLX_DECLARE_SWAP_ARRAY_VARIABLES \ + GLbyte *swapPC; \ + GLbyte *swapEnd + +#define __GLX_SWAP_INT(pc) \ + sw = ((GLbyte *)(pc))[0]; \ + ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \ + ((GLbyte *)(pc))[3] = sw; \ + sw = ((GLbyte *)(pc))[1]; \ + ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \ + ((GLbyte *)(pc))[2] = sw; + +#define __GLX_SWAP_SHORT(pc) \ + sw = ((GLbyte *)(pc))[0]; \ + ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[1]; \ + ((GLbyte *)(pc))[1] = sw; + +#define __GLX_SWAP_DOUBLE(pc) \ + sw = ((GLbyte *)(pc))[0]; \ + ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[7]; \ + ((GLbyte *)(pc))[7] = sw; \ + sw = ((GLbyte *)(pc))[1]; \ + ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[6]; \ + ((GLbyte *)(pc))[6] = sw; \ + sw = ((GLbyte *)(pc))[2]; \ + ((GLbyte *)(pc))[2] = ((GLbyte *)(pc))[5]; \ + ((GLbyte *)(pc))[5] = sw; \ + sw = ((GLbyte *)(pc))[3]; \ + ((GLbyte *)(pc))[3] = ((GLbyte *)(pc))[4]; \ + ((GLbyte *)(pc))[4] = sw; + +#define __GLX_SWAP_FLOAT(pc) \ + sw = ((GLbyte *)(pc))[0]; \ + ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \ + ((GLbyte *)(pc))[3] = sw; \ + sw = ((GLbyte *)(pc))[1]; \ + ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \ + ((GLbyte *)(pc))[2] = sw; + +#define __GLX_SWAP_INT_ARRAY(pc, count) \ + swapPC = ((GLbyte *)(pc)); \ + swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT32;\ + while (swapPC < swapEnd) { \ + __GLX_SWAP_INT(swapPC); \ + swapPC += __GLX_SIZE_INT32; \ + } + +#define __GLX_SWAP_SHORT_ARRAY(pc, count) \ + swapPC = ((GLbyte *)(pc)); \ + swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT16;\ + while (swapPC < swapEnd) { \ + __GLX_SWAP_SHORT(swapPC); \ + swapPC += __GLX_SIZE_INT16; \ + } + +#define __GLX_SWAP_DOUBLE_ARRAY(pc, count) \ + swapPC = ((GLbyte *)(pc)); \ + swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT64;\ + while (swapPC < swapEnd) { \ + __GLX_SWAP_DOUBLE(swapPC); \ + swapPC += __GLX_SIZE_FLOAT64; \ + } + +#define __GLX_SWAP_FLOAT_ARRAY(pc, count) \ + swapPC = ((GLbyte *)(pc)); \ + swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT32;\ + while (swapPC < swapEnd) { \ + __GLX_SWAP_FLOAT(swapPC); \ + swapPC += __GLX_SIZE_FLOAT32; \ + } + +#define __GLX_SWAP_REPLY_HEADER() \ + __GLX_SWAP_SHORT(&__glXReply.sequenceNumber); \ + __GLX_SWAP_INT(&__glXReply.length); + +#define __GLX_SWAP_REPLY_RETVAL() \ + __GLX_SWAP_INT(&__glXReply.retval) + +#define __GLX_SWAP_REPLY_SIZE() \ + __GLX_SWAP_INT(&__glXReply.size) + +#endif /* !__GLX_unpack_h__ */ |