From 4c61bf84b11e26e6f22648668c95ea760a379163 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 11 Jun 2010 12:14:52 +0000 Subject: xserver git update 11/6/2010 --- xorg-server/hw/dmx/glxProxy/compsize.c | 1116 +++++++-------- xorg-server/hw/dmx/glxProxy/g_renderswap.c | 112 ++ xorg-server/hw/dmx/glxProxy/glxcmds.c | 5 +- xorg-server/hw/dmx/glxProxy/glxcmdsswap.c | 2109 ++++++++++++++-------------- xorg-server/hw/dmx/glxProxy/glxfbconfig.c | 212 +-- xorg-server/hw/dmx/glxProxy/glxscreens.c | 14 +- xorg-server/hw/dmx/glxProxy/glxsingle.c | 19 +- xorg-server/hw/dmx/glxProxy/glxutil.c | 4 +- xorg-server/hw/dmx/glxProxy/glxvendor.c | 8 + xorg-server/hw/dmx/glxProxy/glxvisuals.c | 25 +- xorg-server/hw/dmx/glxProxy/render2swap.c | 5 + xorg-server/hw/dmx/glxProxy/unpack.h | 4 +- 12 files changed, 1888 insertions(+), 1745 deletions(-) (limited to 'xorg-server/hw/dmx/glxProxy') diff --git a/xorg-server/hw/dmx/glxProxy/compsize.c b/xorg-server/hw/dmx/glxProxy/compsize.c index cae8fea3c..3bb562e05 100644 --- a/xorg-server/hw/dmx/glxProxy/compsize.c +++ b/xorg-server/hw/dmx/glxProxy/compsize.c @@ -1,558 +1,558 @@ -/* - * 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. - */ - -#include - -GLint __glFogiv_size(GLenum pname) -{ - switch (pname) { - case GL_FOG_COLOR: return 4; - case GL_FOG_DENSITY: return 1; - case GL_FOG_END: return 1; - case GL_FOG_MODE: return 1; - case GL_FOG_INDEX: return 1; - case GL_FOG_START: return 1; - default: - return 0; - } -} - -GLint __glFogfv_size(GLenum pname) -{ - return __glFogiv_size(pname); -} - -GLint __glCallLists_size(GLsizei n, GLenum type) -{ - GLint size; - - if (n < 0) return 0; - switch (type) { - case GL_BYTE: size = 1; break; - case GL_UNSIGNED_BYTE: size = 1; break; - case GL_SHORT: size = 2; break; - case GL_UNSIGNED_SHORT: size = 2; break; - case GL_INT: size = 4; break; - case GL_UNSIGNED_INT: size = 4; break; - case GL_FLOAT: size = 4; break; - case GL_2_BYTES: size = 2; break; - case GL_3_BYTES: size = 3; break; - case GL_4_BYTES: size = 4; break; - default: - return 0; - } - return n * size; -} - -GLint __glDrawPixels_size(GLenum format, GLenum type, GLsizei w, GLsizei h) -{ - GLint elements, esize; - - switch (format) { - case GL_COLOR_INDEX: - case GL_STENCIL_INDEX: - case GL_DEPTH_COMPONENT: - elements = 1; - break; - case GL_RED: - case GL_GREEN: - case GL_BLUE: - case GL_ALPHA: - case GL_LUMINANCE: - elements = 1; - break; - case GL_LUMINANCE_ALPHA: - elements = 2; - break; - case GL_RGB: - elements = 3; - break; - case GL_RGBA: - case GL_ABGR_EXT: - elements = 4; - break; - default: - return 0; - } - switch (type) { - case GL_BITMAP: - if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) { - return (h * ((w+7)/8)); - } else { - return 0; - } - case GL_BYTE: - case GL_UNSIGNED_BYTE: - esize = 1; - break; - case GL_UNSIGNED_BYTE_3_3_2: - case GL_UNSIGNED_BYTE_2_3_3_REV: - esize = 1; - elements = 1; - break; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - esize = 2; - break; - case GL_UNSIGNED_SHORT_5_6_5: - case GL_UNSIGNED_SHORT_5_6_5_REV: - case GL_UNSIGNED_SHORT_4_4_4_4: - case GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL_UNSIGNED_SHORT_5_5_5_1: - case GL_UNSIGNED_SHORT_1_5_5_5_REV: - esize = 2; - elements = 1; - break; - case GL_INT: - case GL_UNSIGNED_INT: - case GL_FLOAT: - esize = 4; - break; - case GL_UNSIGNED_INT_8_8_8_8: - case GL_UNSIGNED_INT_8_8_8_8_REV: - case GL_UNSIGNED_INT_10_10_10_2: - case GL_UNSIGNED_INT_2_10_10_10_REV: - esize = 4; - elements = 1; - break; - default: - return 0; - } - return (elements * esize * w * h); -} - -GLint __glBitmap_size(GLsizei w, GLsizei h) -{ - return __glDrawPixels_size(GL_COLOR_INDEX, GL_BITMAP, w, h); -} - -GLint __glTexGendv_size(GLenum e) -{ - switch (e) { - case GL_TEXTURE_GEN_MODE: - return 1; - case GL_OBJECT_PLANE: - case GL_EYE_PLANE: - return 4; - default: - return 0; - } -} - -GLint __glTexGenfv_size(GLenum e) -{ - return __glTexGendv_size(e); -} - -GLint __glTexGeniv_size(GLenum e) -{ - return __glTexGendv_size(e); -} - -GLint __glTexParameterfv_size(GLenum e) -{ - switch (e) { - case GL_TEXTURE_WRAP_S: - case GL_TEXTURE_WRAP_T: - case GL_TEXTURE_WRAP_R: - case GL_TEXTURE_MIN_FILTER: - case GL_TEXTURE_MAG_FILTER: - return 1; - case GL_TEXTURE_BORDER_COLOR: - return 4; - case GL_TEXTURE_PRIORITY: - return 1; - case GL_TEXTURE_MIN_LOD: - case GL_TEXTURE_MAX_LOD: - case GL_TEXTURE_BASE_LEVEL: - case GL_TEXTURE_MAX_LEVEL: - return 1; - default: - return 0; - } -} - -GLint __glTexParameteriv_size(GLenum e) -{ - return __glTexParameterfv_size(e); -} - -GLint __glTexEnvfv_size(GLenum e) -{ - switch (e) { - case GL_TEXTURE_ENV_MODE: - return 1; - case GL_TEXTURE_ENV_COLOR: - return 4; - default: - return 0; - } -} - -GLint __glTexEnviv_size(GLenum e) -{ - return __glTexEnvfv_size(e); -} - -GLint __glTexImage1D_size(GLenum format, GLenum type, GLsizei w) -{ - GLint elements, esize; - - if (w < 0) return 0; - switch (format) { - case GL_COLOR_INDEX: - elements = 1; - break; - case GL_RED: - case GL_GREEN: - case GL_BLUE: - case GL_ALPHA: - case GL_LUMINANCE: - elements = 1; - break; - case GL_LUMINANCE_ALPHA: - elements = 2; - break; - case GL_RGB: - elements = 3; - break; - case GL_RGBA: - case GL_ABGR_EXT: - elements = 4; - break; - default: - return 0; - } - switch (type) { - case GL_BITMAP: - if (format == GL_COLOR_INDEX) { - return (w+7)/8; - } else { - return 0; - } - case GL_BYTE: - case GL_UNSIGNED_BYTE: - esize = 1; - break; - case GL_UNSIGNED_BYTE_3_3_2: - case GL_UNSIGNED_BYTE_2_3_3_REV: - esize = 1; - elements = 1; - break; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - esize = 2; - break; - case GL_UNSIGNED_SHORT_5_6_5: - case GL_UNSIGNED_SHORT_5_6_5_REV: - case GL_UNSIGNED_SHORT_4_4_4_4: - case GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL_UNSIGNED_SHORT_5_5_5_1: - case GL_UNSIGNED_SHORT_1_5_5_5_REV: - esize = 2; - elements = 1; - break; - case GL_INT: - case GL_UNSIGNED_INT: - case GL_FLOAT: - esize = 4; - break; - case GL_UNSIGNED_INT_8_8_8_8: - case GL_UNSIGNED_INT_8_8_8_8_REV: - case GL_UNSIGNED_INT_10_10_10_2: - case GL_UNSIGNED_INT_2_10_10_10_REV: - esize = 4; - elements = 1; - break; - default: - return 0; - } - return (elements * esize * w); -} - -GLint __glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h) -{ - GLint elements, esize; - - if (w < 0) return 0; - if (h < 0) return 0; - switch (format) { - case GL_COLOR_INDEX: - elements = 1; - break; - case GL_RED: - case GL_GREEN: - case GL_BLUE: - case GL_ALPHA: - case GL_LUMINANCE: - elements = 1; - break; - case GL_LUMINANCE_ALPHA: - elements = 2; - break; - case GL_RGB: - elements = 3; - break; - case GL_RGBA: - case GL_ABGR_EXT: - elements = 4; - break; - default: - return 0; - } - switch (type) { - case GL_BITMAP: - if (format == GL_COLOR_INDEX) { - return (h * ((w+7)/8)); - } else { - return 0; - } - case GL_BYTE: - case GL_UNSIGNED_BYTE: - esize = 1; - break; - case GL_UNSIGNED_BYTE_3_3_2: - case GL_UNSIGNED_BYTE_2_3_3_REV: - esize = 1; - elements = 1; - break; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - esize = 2; - break; - case GL_UNSIGNED_SHORT_5_6_5: - case GL_UNSIGNED_SHORT_5_6_5_REV: - case GL_UNSIGNED_SHORT_4_4_4_4: - case GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL_UNSIGNED_SHORT_5_5_5_1: - case GL_UNSIGNED_SHORT_1_5_5_5_REV: - esize = 2; - elements = 1; - break; - case GL_INT: - case GL_UNSIGNED_INT: - case GL_FLOAT: - esize = 4; - break; - case GL_UNSIGNED_INT_8_8_8_8: - case GL_UNSIGNED_INT_8_8_8_8_REV: - case GL_UNSIGNED_INT_10_10_10_2: - case GL_UNSIGNED_INT_2_10_10_10_REV: - esize = 4; - elements = 1; - break; - default: - return 0; - } - return (elements * esize * w * h); -} - -GLint __glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h, - GLsizei d) -{ - GLint elements, esize; - - if (w < 0) return 0; - if (h < 0) return 0; - if (d < 0) return 0; - switch (format) { - case GL_COLOR_INDEX: - elements = 1; - break; - case GL_RED: - case GL_GREEN: - case GL_BLUE: - case GL_ALPHA: - case GL_LUMINANCE: - elements = 1; - break; - case GL_LUMINANCE_ALPHA: - elements = 2; - break; - case GL_RGB: - elements = 3; - break; - case GL_RGBA: - case GL_ABGR_EXT: - elements = 4; - break; - default: - return 0; - } - switch (type) { - case GL_BITMAP: - if (format == GL_COLOR_INDEX) { - return (d * (h * ((w+7)/8))); - } else { - return 0; - } - case GL_BYTE: - case GL_UNSIGNED_BYTE: - esize = 1; - break; - case GL_UNSIGNED_BYTE_3_3_2: - case GL_UNSIGNED_BYTE_2_3_3_REV: - esize = 1; - elements = 1; - break; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - esize = 2; - break; - case GL_UNSIGNED_SHORT_5_6_5: - case GL_UNSIGNED_SHORT_5_6_5_REV: - case GL_UNSIGNED_SHORT_4_4_4_4: - case GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL_UNSIGNED_SHORT_5_5_5_1: - case GL_UNSIGNED_SHORT_1_5_5_5_REV: - esize = 2; - elements = 1; - break; - case GL_INT: - case GL_UNSIGNED_INT: - case GL_FLOAT: - esize = 4; - break; - case GL_UNSIGNED_INT_8_8_8_8: - case GL_UNSIGNED_INT_8_8_8_8_REV: - case GL_UNSIGNED_INT_10_10_10_2: - case GL_UNSIGNED_INT_2_10_10_10_REV: - esize = 4; - elements = 1; - break; - default: - return 0; - } - return (elements * esize * w * h * d); -} - -GLint __glLightfv_size(GLenum pname) -{ - switch (pname) { - case GL_SPOT_EXPONENT: return 1; - case GL_SPOT_CUTOFF: return 1; - case GL_AMBIENT: return 4; - case GL_DIFFUSE: return 4; - case GL_SPECULAR: return 4; - case GL_POSITION: return 4; - case GL_SPOT_DIRECTION: return 3; - case GL_CONSTANT_ATTENUATION: return 1; - case GL_LINEAR_ATTENUATION: return 1; - case GL_QUADRATIC_ATTENUATION: return 1; - default: - return 0; - } -} - -GLint __glLightiv_size(GLenum pname) -{ - return __glLightfv_size(pname); -} - -GLint __glLightModelfv_size(GLenum pname) -{ - switch (pname) { - case GL_LIGHT_MODEL_AMBIENT: return 4; - case GL_LIGHT_MODEL_LOCAL_VIEWER: return 1; - case GL_LIGHT_MODEL_TWO_SIDE: return 1; - case GL_LIGHT_MODEL_COLOR_CONTROL: return 1; - default: - return 0; - } -} - -GLint __glLightModeliv_size(GLenum pname) -{ - return __glLightModelfv_size(pname); -} - -GLint __glMaterialfv_size(GLenum pname) -{ - switch (pname) { - case GL_SHININESS: return 1; - case GL_EMISSION: return 4; - case GL_AMBIENT: return 4; - case GL_DIFFUSE: return 4; - case GL_SPECULAR: return 4; - case GL_AMBIENT_AND_DIFFUSE: return 4; - case GL_COLOR_INDEXES: return 3; - default: - return 0; - } -} - -GLint __glMaterialiv_size(GLenum pname) -{ - return __glMaterialfv_size(pname); -} - -GLint __glColorTableParameterfv_size(GLenum pname) -{ - switch (pname) { - case GL_COLOR_TABLE_FORMAT: - case GL_COLOR_TABLE_WIDTH: - case GL_COLOR_TABLE_RED_SIZE: - case GL_COLOR_TABLE_GREEN_SIZE: - case GL_COLOR_TABLE_BLUE_SIZE: - case GL_COLOR_TABLE_ALPHA_SIZE: - case GL_COLOR_TABLE_LUMINANCE_SIZE: - case GL_COLOR_TABLE_INTENSITY_SIZE: - return 1; - case GL_COLOR_TABLE_SCALE: - case GL_COLOR_TABLE_BIAS: - return 4; - default: - return -1; - } -} - -GLint __glColorTableParameteriv_size(GLenum pname) -{ - return __glColorTableParameterfv_size(pname); -} - -GLint __glConvolutionParameterfv_size(GLenum pname) -{ - switch(pname) { - case GL_CONVOLUTION_BORDER_MODE: - return 1; - case GL_CONVOLUTION_BORDER_COLOR: - case GL_CONVOLUTION_FILTER_SCALE: - case GL_CONVOLUTION_FILTER_BIAS: - return 4; - default: /* error: bad enum value */ - return -1; - } -} - -GLint __glConvolutionParameteriv_size(GLenum pname) -{ - return __glConvolutionParameterfv_size(pname); -} +/* + * 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. + */ + +#include + +GLint __glFogiv_size(GLenum pname) +{ + switch (pname) { + case GL_FOG_COLOR: return 4; + case GL_FOG_DENSITY: return 1; + case GL_FOG_END: return 1; + case GL_FOG_MODE: return 1; + case GL_FOG_INDEX: return 1; + case GL_FOG_START: return 1; + default: + return 0; + } +} + +GLint __glFogfv_size(GLenum pname) +{ + return __glFogiv_size(pname); +} + +GLint __glCallLists_size(GLsizei n, GLenum type) +{ + GLint size; + + if (n < 0) return 0; + switch (type) { + case GL_BYTE: size = 1; break; + case GL_UNSIGNED_BYTE: size = 1; break; + case GL_SHORT: size = 2; break; + case GL_UNSIGNED_SHORT: size = 2; break; + case GL_INT: size = 4; break; + case GL_UNSIGNED_INT: size = 4; break; + case GL_FLOAT: size = 4; break; + case GL_2_BYTES: size = 2; break; + case GL_3_BYTES: size = 3; break; + case GL_4_BYTES: size = 4; break; + default: + return 0; + } + return n * size; +} + +GLint __glDrawPixels_size(GLenum format, GLenum type, GLsizei w, GLsizei h) +{ + GLint elements, esize; + + switch (format) { + case GL_COLOR_INDEX: + case GL_STENCIL_INDEX: + case GL_DEPTH_COMPONENT: + elements = 1; + break; + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_LUMINANCE: + elements = 1; + break; + case GL_LUMINANCE_ALPHA: + elements = 2; + break; + case GL_RGB: + elements = 3; + break; + case GL_RGBA: + case GL_ABGR_EXT: + elements = 4; + break; + default: + return 0; + } + switch (type) { + case GL_BITMAP: + if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) { + return (h * ((w+7)/8)); + } else { + return 0; + } + case GL_BYTE: + case GL_UNSIGNED_BYTE: + esize = 1; + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; + case GL_SHORT: + case GL_UNSIGNED_SHORT: + esize = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + esize = 4; + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; + default: + return 0; + } + return elements * esize * w * h; +} + +GLint __glBitmap_size(GLsizei w, GLsizei h) +{ + return __glDrawPixels_size(GL_COLOR_INDEX, GL_BITMAP, w, h); +} + +GLint __glTexGendv_size(GLenum e) +{ + switch (e) { + case GL_TEXTURE_GEN_MODE: + return 1; + case GL_OBJECT_PLANE: + case GL_EYE_PLANE: + return 4; + default: + return 0; + } +} + +GLint __glTexGenfv_size(GLenum e) +{ + return __glTexGendv_size(e); +} + +GLint __glTexGeniv_size(GLenum e) +{ + return __glTexGendv_size(e); +} + +GLint __glTexParameterfv_size(GLenum e) +{ + switch (e) { + case GL_TEXTURE_WRAP_S: + case GL_TEXTURE_WRAP_T: + case GL_TEXTURE_WRAP_R: + case GL_TEXTURE_MIN_FILTER: + case GL_TEXTURE_MAG_FILTER: + return 1; + case GL_TEXTURE_BORDER_COLOR: + return 4; + case GL_TEXTURE_PRIORITY: + return 1; + case GL_TEXTURE_MIN_LOD: + case GL_TEXTURE_MAX_LOD: + case GL_TEXTURE_BASE_LEVEL: + case GL_TEXTURE_MAX_LEVEL: + return 1; + default: + return 0; + } +} + +GLint __glTexParameteriv_size(GLenum e) +{ + return __glTexParameterfv_size(e); +} + +GLint __glTexEnvfv_size(GLenum e) +{ + switch (e) { + case GL_TEXTURE_ENV_MODE: + return 1; + case GL_TEXTURE_ENV_COLOR: + return 4; + default: + return 0; + } +} + +GLint __glTexEnviv_size(GLenum e) +{ + return __glTexEnvfv_size(e); +} + +GLint __glTexImage1D_size(GLenum format, GLenum type, GLsizei w) +{ + GLint elements, esize; + + if (w < 0) return 0; + switch (format) { + case GL_COLOR_INDEX: + elements = 1; + break; + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_LUMINANCE: + elements = 1; + break; + case GL_LUMINANCE_ALPHA: + elements = 2; + break; + case GL_RGB: + elements = 3; + break; + case GL_RGBA: + case GL_ABGR_EXT: + elements = 4; + break; + default: + return 0; + } + switch (type) { + case GL_BITMAP: + if (format == GL_COLOR_INDEX) { + return (w+7)/8; + } else { + return 0; + } + case GL_BYTE: + case GL_UNSIGNED_BYTE: + esize = 1; + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; + case GL_SHORT: + case GL_UNSIGNED_SHORT: + esize = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + esize = 4; + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; + default: + return 0; + } + return elements * esize * w; +} + +GLint __glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h) +{ + GLint elements, esize; + + if (w < 0) return 0; + if (h < 0) return 0; + switch (format) { + case GL_COLOR_INDEX: + elements = 1; + break; + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_LUMINANCE: + elements = 1; + break; + case GL_LUMINANCE_ALPHA: + elements = 2; + break; + case GL_RGB: + elements = 3; + break; + case GL_RGBA: + case GL_ABGR_EXT: + elements = 4; + break; + default: + return 0; + } + switch (type) { + case GL_BITMAP: + if (format == GL_COLOR_INDEX) { + return (h * ((w+7)/8)); + } else { + return 0; + } + case GL_BYTE: + case GL_UNSIGNED_BYTE: + esize = 1; + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; + case GL_SHORT: + case GL_UNSIGNED_SHORT: + esize = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + esize = 4; + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; + default: + return 0; + } + return elements * esize * w * h; +} + +GLint __glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h, + GLsizei d) +{ + GLint elements, esize; + + if (w < 0) return 0; + if (h < 0) return 0; + if (d < 0) return 0; + switch (format) { + case GL_COLOR_INDEX: + elements = 1; + break; + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_LUMINANCE: + elements = 1; + break; + case GL_LUMINANCE_ALPHA: + elements = 2; + break; + case GL_RGB: + elements = 3; + break; + case GL_RGBA: + case GL_ABGR_EXT: + elements = 4; + break; + default: + return 0; + } + switch (type) { + case GL_BITMAP: + if (format == GL_COLOR_INDEX) { + return (d * (h * ((w+7)/8))); + } else { + return 0; + } + case GL_BYTE: + case GL_UNSIGNED_BYTE: + esize = 1; + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; + case GL_SHORT: + case GL_UNSIGNED_SHORT: + esize = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + esize = 4; + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; + default: + return 0; + } + return elements * esize * w * h * d; +} + +GLint __glLightfv_size(GLenum pname) +{ + switch (pname) { + case GL_SPOT_EXPONENT: return 1; + case GL_SPOT_CUTOFF: return 1; + case GL_AMBIENT: return 4; + case GL_DIFFUSE: return 4; + case GL_SPECULAR: return 4; + case GL_POSITION: return 4; + case GL_SPOT_DIRECTION: return 3; + case GL_CONSTANT_ATTENUATION: return 1; + case GL_LINEAR_ATTENUATION: return 1; + case GL_QUADRATIC_ATTENUATION: return 1; + default: + return 0; + } +} + +GLint __glLightiv_size(GLenum pname) +{ + return __glLightfv_size(pname); +} + +GLint __glLightModelfv_size(GLenum pname) +{ + switch (pname) { + case GL_LIGHT_MODEL_AMBIENT: return 4; + case GL_LIGHT_MODEL_LOCAL_VIEWER: return 1; + case GL_LIGHT_MODEL_TWO_SIDE: return 1; + case GL_LIGHT_MODEL_COLOR_CONTROL: return 1; + default: + return 0; + } +} + +GLint __glLightModeliv_size(GLenum pname) +{ + return __glLightModelfv_size(pname); +} + +GLint __glMaterialfv_size(GLenum pname) +{ + switch (pname) { + case GL_SHININESS: return 1; + case GL_EMISSION: return 4; + case GL_AMBIENT: return 4; + case GL_DIFFUSE: return 4; + case GL_SPECULAR: return 4; + case GL_AMBIENT_AND_DIFFUSE: return 4; + case GL_COLOR_INDEXES: return 3; + default: + return 0; + } +} + +GLint __glMaterialiv_size(GLenum pname) +{ + return __glMaterialfv_size(pname); +} + +GLint __glColorTableParameterfv_size(GLenum pname) +{ + switch (pname) { + case GL_COLOR_TABLE_FORMAT: + case GL_COLOR_TABLE_WIDTH: + case GL_COLOR_TABLE_RED_SIZE: + case GL_COLOR_TABLE_GREEN_SIZE: + case GL_COLOR_TABLE_BLUE_SIZE: + case GL_COLOR_TABLE_ALPHA_SIZE: + case GL_COLOR_TABLE_LUMINANCE_SIZE: + case GL_COLOR_TABLE_INTENSITY_SIZE: + return 1; + case GL_COLOR_TABLE_SCALE: + case GL_COLOR_TABLE_BIAS: + return 4; + default: + return -1; + } +} + +GLint __glColorTableParameteriv_size(GLenum pname) +{ + return __glColorTableParameterfv_size(pname); +} + +GLint __glConvolutionParameterfv_size(GLenum pname) +{ + switch(pname) { + case GL_CONVOLUTION_BORDER_MODE: + return 1; + case GL_CONVOLUTION_BORDER_COLOR: + case GL_CONVOLUTION_FILTER_SCALE: + case GL_CONVOLUTION_FILTER_BIAS: + return 4; + default: /* error: bad enum value */ + return -1; + } +} + +GLint __glConvolutionParameteriv_size(GLenum pname) +{ + return __glConvolutionParameterfv_size(pname); +} diff --git a/xorg-server/hw/dmx/glxProxy/g_renderswap.c b/xorg-server/hw/dmx/glxProxy/g_renderswap.c index 8aab433e8..39316a99b 100644 --- a/xorg-server/hw/dmx/glxProxy/g_renderswap.c +++ b/xorg-server/hw/dmx/glxProxy/g_renderswap.c @@ -64,6 +64,7 @@ void __glXDispSwap_Color3bv(GLbyte *pc) void __glXDispSwap_Color3dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -79,6 +80,7 @@ void __glXDispSwap_Color3dv(GLbyte *pc) void __glXDispSwap_Color3fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); } @@ -86,6 +88,7 @@ void __glXDispSwap_Color3fv(GLbyte *pc) void __glXDispSwap_Color3iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 3); @@ -94,6 +97,7 @@ void __glXDispSwap_Color3iv(GLbyte *pc) void __glXDispSwap_Color3sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); @@ -106,6 +110,7 @@ void __glXDispSwap_Color3ubv(GLbyte *pc) void __glXDispSwap_Color3uiv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 3); } @@ -113,6 +118,7 @@ void __glXDispSwap_Color3uiv(GLbyte *pc) void __glXDispSwap_Color3usv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); } @@ -124,6 +130,7 @@ void __glXDispSwap_Color4bv(GLbyte *pc) void __glXDispSwap_Color4dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -138,6 +145,7 @@ void __glXDispSwap_Color4dv(GLbyte *pc) void __glXDispSwap_Color4fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4); @@ -146,6 +154,7 @@ void __glXDispSwap_Color4fv(GLbyte *pc) void __glXDispSwap_Color4iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 4); @@ -154,6 +163,7 @@ void __glXDispSwap_Color4iv(GLbyte *pc) void __glXDispSwap_Color4sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); @@ -167,6 +177,7 @@ void __glXDispSwap_Color4ubv(GLbyte *pc) void __glXDispSwap_Color4uiv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 4); @@ -175,6 +186,7 @@ void __glXDispSwap_Color4uiv(GLbyte *pc) void __glXDispSwap_Color4usv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); @@ -191,6 +203,7 @@ void __glXDispSwap_End(GLbyte *pc) void __glXDispSwap_Indexdv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -206,6 +219,7 @@ void __glXDispSwap_Indexdv(GLbyte *pc) void __glXDispSwap_Indexfv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1); @@ -214,6 +228,7 @@ void __glXDispSwap_Indexfv(GLbyte *pc) void __glXDispSwap_Indexiv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 1); @@ -222,6 +237,7 @@ void __glXDispSwap_Indexiv(GLbyte *pc) void __glXDispSwap_Indexsv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 1); @@ -234,6 +250,7 @@ void __glXDispSwap_Normal3bv(GLbyte *pc) void __glXDispSwap_Normal3dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -249,6 +266,7 @@ void __glXDispSwap_Normal3dv(GLbyte *pc) void __glXDispSwap_Normal3fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); @@ -257,6 +275,7 @@ void __glXDispSwap_Normal3fv(GLbyte *pc) void __glXDispSwap_Normal3iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 3); @@ -265,6 +284,7 @@ void __glXDispSwap_Normal3iv(GLbyte *pc) void __glXDispSwap_Normal3sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); @@ -273,6 +293,7 @@ void __glXDispSwap_Normal3sv(GLbyte *pc) void __glXDispSwap_RasterPos2dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -288,6 +309,7 @@ void __glXDispSwap_RasterPos2dv(GLbyte *pc) void __glXDispSwap_RasterPos2fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); @@ -296,6 +318,7 @@ void __glXDispSwap_RasterPos2fv(GLbyte *pc) void __glXDispSwap_RasterPos2iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 2); @@ -304,6 +327,7 @@ void __glXDispSwap_RasterPos2iv(GLbyte *pc) void __glXDispSwap_RasterPos2sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 2); @@ -312,6 +336,7 @@ void __glXDispSwap_RasterPos2sv(GLbyte *pc) void __glXDispSwap_RasterPos3dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -327,6 +352,7 @@ void __glXDispSwap_RasterPos3dv(GLbyte *pc) void __glXDispSwap_RasterPos3fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); @@ -335,6 +361,7 @@ void __glXDispSwap_RasterPos3fv(GLbyte *pc) void __glXDispSwap_RasterPos3iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 3); @@ -343,6 +370,7 @@ void __glXDispSwap_RasterPos3iv(GLbyte *pc) void __glXDispSwap_RasterPos3sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); @@ -351,6 +379,7 @@ void __glXDispSwap_RasterPos3sv(GLbyte *pc) void __glXDispSwap_RasterPos4dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -366,6 +395,7 @@ void __glXDispSwap_RasterPos4dv(GLbyte *pc) void __glXDispSwap_RasterPos4fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4); @@ -374,6 +404,7 @@ void __glXDispSwap_RasterPos4fv(GLbyte *pc) void __glXDispSwap_RasterPos4iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 4); @@ -382,6 +413,7 @@ void __glXDispSwap_RasterPos4iv(GLbyte *pc) void __glXDispSwap_RasterPos4sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); @@ -390,6 +422,7 @@ void __glXDispSwap_RasterPos4sv(GLbyte *pc) void __glXDispSwap_Rectdv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -406,6 +439,7 @@ void __glXDispSwap_Rectdv(GLbyte *pc) void __glXDispSwap_Rectfv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); __GLX_SWAP_FLOAT_ARRAY(pc + 8, 2); @@ -415,6 +449,7 @@ void __glXDispSwap_Rectfv(GLbyte *pc) void __glXDispSwap_Rectiv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 2); __GLX_SWAP_INT_ARRAY(pc + 8, 2); @@ -424,6 +459,7 @@ void __glXDispSwap_Rectiv(GLbyte *pc) void __glXDispSwap_Rectsv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 2); __GLX_SWAP_SHORT_ARRAY(pc + 4, 2); @@ -433,6 +469,7 @@ void __glXDispSwap_Rectsv(GLbyte *pc) void __glXDispSwap_TexCoord1dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -448,6 +485,7 @@ void __glXDispSwap_TexCoord1dv(GLbyte *pc) void __glXDispSwap_TexCoord1fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1); @@ -456,6 +494,7 @@ void __glXDispSwap_TexCoord1fv(GLbyte *pc) void __glXDispSwap_TexCoord1iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 1); @@ -464,6 +503,7 @@ void __glXDispSwap_TexCoord1iv(GLbyte *pc) void __glXDispSwap_TexCoord1sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 1); @@ -472,6 +512,7 @@ void __glXDispSwap_TexCoord1sv(GLbyte *pc) void __glXDispSwap_TexCoord2dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -487,6 +528,7 @@ void __glXDispSwap_TexCoord2dv(GLbyte *pc) void __glXDispSwap_TexCoord2fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); @@ -495,6 +537,7 @@ void __glXDispSwap_TexCoord2fv(GLbyte *pc) void __glXDispSwap_TexCoord2iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 2); @@ -503,6 +546,7 @@ void __glXDispSwap_TexCoord2iv(GLbyte *pc) void __glXDispSwap_TexCoord2sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 2); @@ -511,6 +555,7 @@ void __glXDispSwap_TexCoord2sv(GLbyte *pc) void __glXDispSwap_TexCoord3dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -526,6 +571,7 @@ void __glXDispSwap_TexCoord3dv(GLbyte *pc) void __glXDispSwap_TexCoord3fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); @@ -534,6 +580,7 @@ void __glXDispSwap_TexCoord3fv(GLbyte *pc) void __glXDispSwap_TexCoord3iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 3); @@ -542,6 +589,7 @@ void __glXDispSwap_TexCoord3iv(GLbyte *pc) void __glXDispSwap_TexCoord3sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); @@ -550,6 +598,7 @@ void __glXDispSwap_TexCoord3sv(GLbyte *pc) void __glXDispSwap_TexCoord4dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -565,6 +614,7 @@ void __glXDispSwap_TexCoord4dv(GLbyte *pc) void __glXDispSwap_TexCoord4fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4); @@ -573,6 +623,7 @@ void __glXDispSwap_TexCoord4fv(GLbyte *pc) void __glXDispSwap_TexCoord4iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 4); @@ -581,6 +632,7 @@ void __glXDispSwap_TexCoord4iv(GLbyte *pc) void __glXDispSwap_TexCoord4sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); @@ -589,6 +641,7 @@ void __glXDispSwap_TexCoord4sv(GLbyte *pc) void __glXDispSwap_Vertex2dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -604,6 +657,7 @@ void __glXDispSwap_Vertex2dv(GLbyte *pc) void __glXDispSwap_Vertex2fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); @@ -612,6 +666,7 @@ void __glXDispSwap_Vertex2fv(GLbyte *pc) void __glXDispSwap_Vertex2iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 2); @@ -620,6 +675,7 @@ void __glXDispSwap_Vertex2iv(GLbyte *pc) void __glXDispSwap_Vertex2sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 2); @@ -628,6 +684,7 @@ void __glXDispSwap_Vertex2sv(GLbyte *pc) void __glXDispSwap_Vertex3dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -643,6 +700,7 @@ void __glXDispSwap_Vertex3dv(GLbyte *pc) void __glXDispSwap_Vertex3fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); @@ -651,6 +709,7 @@ void __glXDispSwap_Vertex3fv(GLbyte *pc) void __glXDispSwap_Vertex3iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 3); @@ -659,6 +718,7 @@ void __glXDispSwap_Vertex3iv(GLbyte *pc) void __glXDispSwap_Vertex3sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); @@ -667,6 +727,7 @@ void __glXDispSwap_Vertex3sv(GLbyte *pc) void __glXDispSwap_Vertex4dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -682,6 +743,7 @@ void __glXDispSwap_Vertex4dv(GLbyte *pc) void __glXDispSwap_Vertex4fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4); @@ -690,6 +752,7 @@ void __glXDispSwap_Vertex4fv(GLbyte *pc) void __glXDispSwap_Vertex4iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 4); @@ -698,6 +761,7 @@ void __glXDispSwap_Vertex4iv(GLbyte *pc) void __glXDispSwap_Vertex4sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); @@ -706,6 +770,7 @@ void __glXDispSwap_Vertex4sv(GLbyte *pc) void __glXDispSwap_ClipPlane(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -750,6 +815,7 @@ void __glXDispSwap_Fogfv(GLbyte *pc) GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); pname = *(GLenum *)(pc + 0); @@ -773,6 +839,7 @@ void __glXDispSwap_Fogiv(GLbyte *pc) GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); pname = *(GLenum *)(pc + 0); @@ -814,6 +881,7 @@ void __glXDispSwap_Lightfv(GLbyte *pc) GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); @@ -839,6 +907,7 @@ void __glXDispSwap_Lightiv(GLbyte *pc) GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); @@ -863,6 +932,7 @@ void __glXDispSwap_LightModelfv(GLbyte *pc) GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); pname = *(GLenum *)(pc + 0); @@ -886,6 +956,7 @@ void __glXDispSwap_LightModeliv(GLbyte *pc) GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); pname = *(GLenum *)(pc + 0); @@ -927,6 +998,7 @@ void __glXDispSwap_Materialfv(GLbyte *pc) GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); @@ -952,6 +1024,7 @@ void __glXDispSwap_Materialiv(GLbyte *pc) GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); @@ -1013,6 +1086,7 @@ void __glXDispSwap_TexParameterfv(GLbyte *pc) GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); @@ -1038,6 +1112,7 @@ void __glXDispSwap_TexParameteriv(GLbyte *pc) GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); @@ -1063,6 +1138,7 @@ void __glXDispSwap_TexEnvfv(GLbyte *pc) GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); @@ -1088,6 +1164,7 @@ void __glXDispSwap_TexEnviv(GLbyte *pc) GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); @@ -1121,6 +1198,7 @@ void __glXDispSwap_TexGendv(GLbyte *pc) GLint cmdlen; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); @@ -1154,6 +1232,7 @@ void __glXDispSwap_TexGenfv(GLbyte *pc) GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); @@ -1179,6 +1258,7 @@ void __glXDispSwap_TexGeniv(GLbyte *pc) GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); @@ -1414,6 +1494,7 @@ void __glXDispSwap_MapGrid2f(GLbyte *pc) void __glXDispSwap_EvalCoord1dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -1429,6 +1510,7 @@ void __glXDispSwap_EvalCoord1dv(GLbyte *pc) void __glXDispSwap_EvalCoord1fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1); @@ -1437,6 +1519,7 @@ void __glXDispSwap_EvalCoord1fv(GLbyte *pc) void __glXDispSwap_EvalCoord2dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -1452,6 +1535,7 @@ void __glXDispSwap_EvalCoord2dv(GLbyte *pc) void __glXDispSwap_EvalCoord2fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); @@ -1581,6 +1665,7 @@ void __glXDispSwap_PixelMapfv(GLbyte *pc) { GLint mapsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); mapsize = *(GLint *)(pc + 4); @@ -1593,6 +1678,7 @@ void __glXDispSwap_PixelMapuiv(GLbyte *pc) { GLint mapsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); mapsize = *(GLint *)(pc + 4); @@ -1605,6 +1691,7 @@ void __glXDispSwap_PixelMapusv(GLbyte *pc) { GLint mapsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); mapsize = *(GLint *)(pc + 4); @@ -1676,6 +1763,7 @@ void __glXDispSwap_LoadIdentity(GLbyte *pc) void __glXDispSwap_LoadMatrixf(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16); @@ -1684,6 +1772,7 @@ void __glXDispSwap_LoadMatrixf(GLbyte *pc) void __glXDispSwap_LoadMatrixd(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -1707,6 +1796,7 @@ void __glXDispSwap_MatrixMode(GLbyte *pc) void __glXDispSwap_MultMatrixf(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16); @@ -1715,6 +1805,7 @@ void __glXDispSwap_MultMatrixf(GLbyte *pc) void __glXDispSwap_MultMatrixd(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -1928,6 +2019,7 @@ void __glXDispSwap_PrioritizeTextures(GLbyte *pc) { GLsizei n; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); n = *(GLsizei *)(pc + 0); @@ -1964,6 +2056,7 @@ void __glXDispSwap_ColorTableParameterfv(GLbyte *pc) GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); @@ -1979,6 +2072,7 @@ void __glXDispSwap_ColorTableParameteriv(GLbyte *pc) GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); @@ -2028,6 +2122,7 @@ void __glXDispSwap_ConvolutionParameterfv(GLbyte *pc) GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); @@ -2053,6 +2148,7 @@ void __glXDispSwap_ConvolutionParameteriv(GLbyte *pc) GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); @@ -2150,6 +2246,7 @@ void __glXDispSwap_ActiveTextureARB(GLbyte *pc) void __glXDispSwap_MultiTexCoord1dvARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -2166,6 +2263,7 @@ void __glXDispSwap_MultiTexCoord1dvARB(GLbyte *pc) void __glXDispSwap_MultiTexCoord1fvARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT_ARRAY(pc + 4, 1); @@ -2175,6 +2273,7 @@ void __glXDispSwap_MultiTexCoord1fvARB(GLbyte *pc) void __glXDispSwap_MultiTexCoord1ivARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 4, 1); @@ -2184,6 +2283,7 @@ void __glXDispSwap_MultiTexCoord1ivARB(GLbyte *pc) void __glXDispSwap_MultiTexCoord1svARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_SHORT_ARRAY(pc + 4, 1); @@ -2193,6 +2293,7 @@ void __glXDispSwap_MultiTexCoord1svARB(GLbyte *pc) void __glXDispSwap_MultiTexCoord2dvARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -2209,6 +2310,7 @@ void __glXDispSwap_MultiTexCoord2dvARB(GLbyte *pc) void __glXDispSwap_MultiTexCoord2fvARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT_ARRAY(pc + 4, 2); @@ -2218,6 +2320,7 @@ void __glXDispSwap_MultiTexCoord2fvARB(GLbyte *pc) void __glXDispSwap_MultiTexCoord2ivARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 4, 2); @@ -2227,6 +2330,7 @@ void __glXDispSwap_MultiTexCoord2ivARB(GLbyte *pc) void __glXDispSwap_MultiTexCoord2svARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_SHORT_ARRAY(pc + 4, 2); @@ -2236,6 +2340,7 @@ void __glXDispSwap_MultiTexCoord2svARB(GLbyte *pc) void __glXDispSwap_MultiTexCoord3dvARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -2252,6 +2357,7 @@ void __glXDispSwap_MultiTexCoord3dvARB(GLbyte *pc) void __glXDispSwap_MultiTexCoord3fvARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT_ARRAY(pc + 4, 3); @@ -2261,6 +2367,7 @@ void __glXDispSwap_MultiTexCoord3fvARB(GLbyte *pc) void __glXDispSwap_MultiTexCoord3ivARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 4, 3); @@ -2270,6 +2377,7 @@ void __glXDispSwap_MultiTexCoord3ivARB(GLbyte *pc) void __glXDispSwap_MultiTexCoord3svARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_SHORT_ARRAY(pc + 4, 3); @@ -2279,6 +2387,7 @@ void __glXDispSwap_MultiTexCoord3svARB(GLbyte *pc) void __glXDispSwap_MultiTexCoord4dvARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 @@ -2295,6 +2404,7 @@ void __glXDispSwap_MultiTexCoord4dvARB(GLbyte *pc) void __glXDispSwap_MultiTexCoord4fvARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT_ARRAY(pc + 4, 4); @@ -2304,6 +2414,7 @@ void __glXDispSwap_MultiTexCoord4fvARB(GLbyte *pc) void __glXDispSwap_MultiTexCoord4ivARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 4, 4); @@ -2313,6 +2424,7 @@ void __glXDispSwap_MultiTexCoord4ivARB(GLbyte *pc) void __glXDispSwap_MultiTexCoord4svARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_SHORT_ARRAY(pc + 4, 4); diff --git a/xorg-server/hw/dmx/glxProxy/glxcmds.c b/xorg-server/hw/dmx/glxProxy/glxcmds.c index bac4478da..d0e3a9b77 100644 --- a/xorg-server/hw/dmx/glxProxy/glxcmds.c +++ b/xorg-server/hw/dmx/glxProxy/glxcmds.c @@ -80,7 +80,7 @@ Display *GetBackEndDisplay( __GLXclientState *cl, int s ) if (! cl->be_displays[s] ) { cl->be_displays[s] = XOpenDisplay( DisplayString(dmxScreens[s].beDisplay) ); } - return( cl->be_displays[s] ); + return cl->be_displays[s]; } /* @@ -628,7 +628,7 @@ int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s) return( cl->be_currentCTag[ (tag-1)*screenInfo.numScreens + s ] ); } else { - return( 0 ); + return 0; } } @@ -2841,6 +2841,7 @@ int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc) if (client->swapped) { __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY((int *)buf, 2*numAttribs); } WriteToClient(client, 2*numAttribs * __GLX_SIZE_CARD32, (char *)buf); diff --git a/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c b/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c index b3720f6f6..8a2efaa73 100644 --- a/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c +++ b/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c @@ -1,1050 +1,1059 @@ -/* - * 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. - */ - -#include "glxserver.h" -#include "glxutil.h" -#include -#include -#include -#include -#include "unpack.h" -#include "glxext.h" -#include "glxvendor.h" - -extern int glxIsExtensionSupported( char *ext ); - -/************************************************************************/ - -/* -** Byteswapping versions of GLX commands. In most cases they just swap -** the incoming arguments and then call the unswapped routine. For commands -** that have replies, a separate swapping routine for the reply is provided; -** it is called at the end of the unswapped routine. -*/ - -int __glXSwapCreateContext(__GLXclientState *cl, GLbyte *pc) -{ - xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->context); - __GLX_SWAP_INT(&req->visual); - __GLX_SWAP_INT(&req->screen); - __GLX_SWAP_INT(&req->shareList); - - return __glXCreateContext(cl, pc); -} - -int __glXSwapCreateNewContext(__GLXclientState *cl, GLbyte *pc) -{ - xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->context); - __GLX_SWAP_INT(&req->fbconfig); - __GLX_SWAP_INT(&req->screen); - __GLX_SWAP_INT(&req->shareList); - - return __glXCreateNewContext(cl, pc); -} - -int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) -{ - xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->context); - __GLX_SWAP_INT(&req->fbconfig); - __GLX_SWAP_INT(&req->screen); - __GLX_SWAP_INT(&req->shareList); - - return __glXCreateContextWithConfigSGIX(cl, pc); -} - -int __glXSwapQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc) -{ - xGLXQueryMaxSwapBarriersSGIXReq *req = - (xGLXQueryMaxSwapBarriersSGIXReq *)pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->screen); - - return __glXQueryMaxSwapBarriersSGIX(cl, pc); -} - -int __glXSwapBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) -{ - xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *)pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->drawable); - __GLX_SWAP_INT(&req->barrier); - - return __glXBindSwapBarrierSGIX(cl, pc); -} - -int __glXSwapJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc) -{ - xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *)pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->drawable); - __GLX_SWAP_INT(&req->member); - - return __glXJoinSwapGroupSGIX(cl, pc); -} - -int __glXSwapDestroyContext(__GLXclientState *cl, GLbyte *pc) -{ - xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->context); - - return __glXDestroyContext(cl, pc); -} - -int __glXSwapMakeCurrent(__GLXclientState *cl, GLbyte *pc) -{ - xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->drawable); - __GLX_SWAP_INT(&req->context); - __GLX_SWAP_INT(&req->oldContextTag); - - return __glXMakeCurrent(cl, pc); -} - -int __glXSwapMakeContextCurrent(__GLXclientState *cl, GLbyte *pc) -{ - xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->drawable); - __GLX_SWAP_INT(&req->readdrawable); - __GLX_SWAP_INT(&req->context); - __GLX_SWAP_INT(&req->oldContextTag); - - return __glXMakeContextCurrent(cl, pc); -} - -int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) -{ - xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->drawable); - __GLX_SWAP_INT(&req->readable); - __GLX_SWAP_INT(&req->context); - __GLX_SWAP_INT(&req->oldContextTag); - - return __glXMakeCurrentReadSGI(cl, pc); -} - -int __glXSwapIsDirect(__GLXclientState *cl, GLbyte *pc) -{ - xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->context); - - return __glXIsDirect(cl, pc); -} - -int __glXSwapQueryVersion(__GLXclientState *cl, GLbyte *pc) -{ - xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->majorVersion); - __GLX_SWAP_INT(&req->minorVersion); - - return __glXQueryVersion(cl, pc); -} - -int __glXSwapWaitGL(__GLXclientState *cl, GLbyte *pc) -{ - xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - - return __glXWaitGL(cl, pc); -} - -int __glXSwapWaitX(__GLXclientState *cl, GLbyte *pc) -{ - xGLXWaitXReq *req = (xGLXWaitXReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - - return __glXWaitX(cl, pc); -} - -int __glXSwapCopyContext(__GLXclientState *cl, GLbyte *pc) -{ - xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->source); - __GLX_SWAP_INT(&req->dest); - __GLX_SWAP_INT(&req->mask); - - return __glXCopyContext(cl, pc); -} - -int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) -{ - ClientPtr client = cl->client; - xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; - xGLXGetVisualConfigsReply reply; - __GLXscreenInfo *pGlxScreen; - __GLXvisualConfig *pGlxVisual; - CARD32 buf[__GLX_TOTAL_CONFIG]; - unsigned int screen; - int i, p; - __GLX_DECLARE_SWAP_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; - } - pGlxScreen = &__glXActiveScreens[screen]; - - reply.numVisuals = pGlxScreen->numGLXVisuals; - reply.numProps = __GLX_TOTAL_CONFIG; - reply.length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 * - __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; - /* - ** Add token/value pairs for extensions. - */ - buf[p++] = GLX_VISUAL_CAVEAT_EXT; - buf[p++] = pGlxVisual->visualRating; - buf[p++] = GLX_TRANSPARENT_TYPE_EXT; - buf[p++] = pGlxVisual->transparentPixel; - buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT; - buf[p++] = pGlxVisual->transparentRed; - buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT; - buf[p++] = pGlxVisual->transparentGreen; - buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT; - buf[p++] = pGlxVisual->transparentBlue; - buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT; - buf[p++] = pGlxVisual->transparentAlpha; - 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); - } - return Success; -} - -int __glXSwapCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) -{ - xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->screen); - __GLX_SWAP_INT(&req->visual); - __GLX_SWAP_INT(&req->pixmap); - __GLX_SWAP_INT(&req->glxpixmap); - - return __glXCreateGLXPixmap(cl, pc); -} - -int __glXSwapCreatePixmap(__GLXclientState *cl, GLbyte *pc) -{ - xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->screen); - __GLX_SWAP_INT(&req->fbconfig); - __GLX_SWAP_INT(&req->pixmap); - __GLX_SWAP_INT(&req->glxpixmap); - __GLX_SWAP_INT(&req->numAttribs); - - return __glXCreatePixmap(cl, pc); -} - -int __glXSwapDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) -{ - xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->glxpixmap); - - return __glXDestroyGLXPixmap(cl, pc); -} - -int __glXSwapSwapBuffers(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - __GLX_SWAP_INT(&req->drawable); - - return __glXSwapBuffers(cl, pc); -} - -int __glXSwapUseXFont(__GLXclientState *cl, GLbyte *pc) -{ - xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - __GLX_SWAP_INT(&req->font); - __GLX_SWAP_INT(&req->first); - __GLX_SWAP_INT(&req->count); - __GLX_SWAP_INT(&req->listBase); - - return __glXUseXFont(cl, pc); -} - - -int __glXSwapQueryExtensionsString(__GLXclientState *cl, GLbyte *pc) -{ - xGLXQueryExtensionsStringReq *req = NULL; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->screen); - - return __glXQueryExtensionsString(cl, pc); -} - -int __glXSwapQueryServerString(__GLXclientState *cl, GLbyte *pc) -{ - xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *)pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->screen); - __GLX_SWAP_INT(&req->name); - - return __glXQueryServerString(cl, pc); -} - -int __glXSwapClientInfo(__GLXclientState *cl, GLbyte *pc) -{ - xGLXClientInfoReq *req = (xGLXClientInfoReq *)pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->major); - __GLX_SWAP_INT(&req->minor); - __GLX_SWAP_INT(&req->numbytes); - - return __glXClientInfo(cl, 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); -} - -/************************************************************************/ - -/* -** Swap replies. -*/ - -void __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReadSGIReply *reply) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_SWAP_SHORT(&reply->sequenceNumber); - __GLX_SWAP_INT(&reply->length); - __GLX_SWAP_INT(&reply->contextTag); - __GLX_SWAP_INT(&reply->writeVid); - __GLX_SWAP_INT(&reply->writeType); - __GLX_SWAP_INT(&reply->readVid); - __GLX_SWAP_INT(&reply->readType); - WriteToClient(client, sz_xGLXMakeCurrentReadSGIReply, (char *)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); -} - -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); -} - -void glxSwapQueryExtensionsStringReply(ClientPtr client, - xGLXQueryExtensionsStringReply *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_xGLXQueryExtensionsStringReply, (char *)reply); - __GLX_SWAP_INT_ARRAY((int *)buf, length); - WriteToClient(client, length << 2, 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); - /** 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) -{ - 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_xGLXQueryContextInfoEXTReply, (char *)reply); - __GLX_SWAP_INT_ARRAY((int *)buf, length); - WriteToClient(client, length << 2, (char *)buf); -} - - -void __glXSwapQueryContextReply(ClientPtr client, - xGLXQueryContextReply *reply, int *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_xGLXQueryContextReply, (char *)reply); - __GLX_SWAP_INT_ARRAY((int *)buf, length); - WriteToClient(client, length << 2, (char *)buf); -} - -void __glXSwapGetDrawableAttributesReply(ClientPtr client, - xGLXGetDrawableAttributesReply *reply, int *buf) -{ - __GLX_DECLARE_SWAP_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); -} - -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); -} - -/************************************************************************/ - -/* -** Render and Renderlarge are not in the GLX API. They are used by the GLX -** client library to send batches of GL rendering commands. -*/ - -int __glXSwapRender(__GLXclientState *cl, GLbyte *pc) -{ - xGLXRenderReq *req; - int left; - __GLXrenderHeader *hdr; - ClientPtr client = cl->client; - __GLX_DECLARE_SWAP_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. - */ - - req = (xGLXRenderReq *) pc; - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - - 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); - - /* - * 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]; -#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; - } - - return __glXRender( cl, (GLbyte *)req ); -} - -/* -** Execute a large rendering request (one that spans multiple X requests). -*/ -int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) -{ - ClientPtr client = cl->client; - xGLXRenderLargeReq *req; - __GLXrenderLargeHeader *hdr; - __GLX_DECLARE_SWAP_VARIABLES; - - req = (xGLXRenderLargeReq *) pc; - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - __GLX_SWAP_INT(&req->dataBytes); - __GLX_SWAP_SHORT(&req->requestNumber); - __GLX_SWAP_SHORT(&req->requestTotal); - - pc += sz_xGLXRenderLargeReq; - - if (req->requestNumber == 1) { - void (* proc)(GLbyte *) = NULL; - __GLXRenderSwapInfo *info = NULL; - CARD16 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]; -#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 *) __glXMalloc(hdr->length); - } else { - cl->largeCmdBuf = (GLbyte *) __glXRealloc(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; - } - - memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, - pc, req->dataBytes); - - cl->largeCmdBytesSoFar += req->dataBytes; - - if (req->dataBytes > cl->largeCmdMaxReqDataSize) - cl->largeCmdMaxReqDataSize = req->dataBytes; - - 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) ); - - } - else { - cl->largeCmdRequestsTotal = 0; - return __glXBadLargeRequest; - } - -} - -/************************************************************************/ - -/* -** No support is provided for the vendor-private requests other than -** allocating these entry points in the dispatch table. -*/ - -int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq *req; - CARD32 vendorCode; - - __GLX_DECLARE_SWAP_VARIABLES; - - req = (xGLXVendorPrivateReq *) 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; -#endif - - case X_GLXvop_JoinSwapGroupSGIX: - return __glXSwapJoinSwapGroupSGIX( cl, pc ); - break; - - case X_GLXvop_BindSwapBarrierSGIX: - return __glXSwapBindSwapBarrierSGIX( cl, pc ); - break; - - case X_GLXvop_CreateContextWithConfigSGIX: - return __glXSwapCreateContextWithConfigSGIX( cl, pc ); - break; - - default: - /* - ** unsupported private request - */ - cl->client->errorValue = req->vendorCode; - return __glXUnsupportedPrivateRequest; - } - -} - -int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateWithReplyReq *req; - CARD32 vendorCode; - - __GLX_DECLARE_SWAP_VARIABLES; - - req = (xGLXVendorPrivateWithReplyReq *) 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: -#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; - } - -} - -int __glXSwapGetFBConfigs(__GLXclientState *cl, GLbyte *pc) -{ - xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->screen); - - return __glXGetFBConfigs(cl, pc); -} - -int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc) -{ - 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; - - return( __glXSwapGetFBConfigs( cl, (GLbyte *)&new_req ) ); -} - -int __glXSwapCreateWindow(__GLXclientState *cl, GLbyte *pc) -{ - xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->screen); - __GLX_SWAP_INT(&req->fbconfig); - __GLX_SWAP_INT(&req->window); - __GLX_SWAP_INT(&req->glxwindow); - __GLX_SWAP_INT(&req->numAttribs); - - return( __glXCreateWindow( 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 ) ); -} - -int __glXSwapQueryContext(__GLXclientState *cl, GLbyte *pc) -{ - xGLXQueryContextReq *req = (xGLXQueryContextReq *)pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->context); - - return( __glXQueryContext(cl, (GLbyte *)pc) ); - -} - -int __glXSwapCreatePbuffer(__GLXclientState *cl, GLbyte *pc) -{ - xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *)pc; - int nattr = req->numAttribs; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->screen); - __GLX_SWAP_INT(&req->fbconfig); - __GLX_SWAP_INT(&req->pbuffer); - __GLX_SWAP_INT(&req->numAttribs); - __GLX_SWAP_INT_ARRAY( (int *)(req+1), nattr*2 ); - - return( __glXCreatePbuffer( cl, 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 ) ); -} - -int __glXSwapGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) -{ - xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->drawable); - - return( __glXGetDrawableAttributes(cl, pc) ); -} - -int __glXSwapChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) -{ - xGLXChangeDrawableAttributesReq *req = (xGLXChangeDrawableAttributesReq *)pc; - __GLX_DECLARE_SWAP_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 ); - - return( __glXChangeDrawableAttributes(cl, pc) ); -} +/* + * 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. + */ + +#include "glxserver.h" +#include "glxutil.h" +#include +#include +#include +#include +#include "unpack.h" +#include "glxext.h" +#include "glxvendor.h" + +extern int glxIsExtensionSupported( char *ext ); + +/************************************************************************/ + +/* +** Byteswapping versions of GLX commands. In most cases they just swap +** the incoming arguments and then call the unswapped routine. For commands +** that have replies, a separate swapping routine for the reply is provided; +** it is called at the end of the unswapped routine. +*/ + +int __glXSwapCreateContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->visual); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->shareList); + + return __glXCreateContext(cl, pc); +} + +int __glXSwapCreateNewContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->shareList); + + return __glXCreateNewContext(cl, pc); +} + +int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->shareList); + + return __glXCreateContextWithConfigSGIX(cl, pc); +} + +int __glXSwapQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXQueryMaxSwapBarriersSGIXReq *req = + (xGLXQueryMaxSwapBarriersSGIXReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + + return __glXQueryMaxSwapBarriersSGIX(cl, pc); +} + +int __glXSwapBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->drawable); + __GLX_SWAP_INT(&req->barrier); + + return __glXBindSwapBarrierSGIX(cl, pc); +} + +int __glXSwapJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->drawable); + __GLX_SWAP_INT(&req->member); + + return __glXJoinSwapGroupSGIX(cl, pc); +} + +int __glXSwapDestroyContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + + return __glXDestroyContext(cl, pc); +} + +int __glXSwapMakeCurrent(__GLXclientState *cl, GLbyte *pc) +{ + xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->drawable); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->oldContextTag); + + return __glXMakeCurrent(cl, pc); +} + +int __glXSwapMakeContextCurrent(__GLXclientState *cl, GLbyte *pc) +{ + xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->drawable); + __GLX_SWAP_INT(&req->readdrawable); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->oldContextTag); + + return __glXMakeContextCurrent(cl, pc); +} + +int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) +{ + xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->drawable); + __GLX_SWAP_INT(&req->readable); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->oldContextTag); + + return __glXMakeCurrentReadSGI(cl, pc); +} + +int __glXSwapIsDirect(__GLXclientState *cl, GLbyte *pc) +{ + xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + + return __glXIsDirect(cl, pc); +} + +int __glXSwapQueryVersion(__GLXclientState *cl, GLbyte *pc) +{ + xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->majorVersion); + __GLX_SWAP_INT(&req->minorVersion); + + return __glXQueryVersion(cl, pc); +} + +int __glXSwapWaitGL(__GLXclientState *cl, GLbyte *pc) +{ + xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + + return __glXWaitGL(cl, pc); +} + +int __glXSwapWaitX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXWaitXReq *req = (xGLXWaitXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + + return __glXWaitX(cl, pc); +} + +int __glXSwapCopyContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->source); + __GLX_SWAP_INT(&req->dest); + __GLX_SWAP_INT(&req->mask); + + return __glXCopyContext(cl, pc); +} + +int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; + xGLXGetVisualConfigsReply reply; + __GLXscreenInfo *pGlxScreen; + __GLXvisualConfig *pGlxVisual; + 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; + } + pGlxScreen = &__glXActiveScreens[screen]; + + reply.numVisuals = pGlxScreen->numGLXVisuals; + reply.numProps = __GLX_TOTAL_CONFIG; + reply.length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 * + __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; + /* + ** Add token/value pairs for extensions. + */ + buf[p++] = GLX_VISUAL_CAVEAT_EXT; + buf[p++] = pGlxVisual->visualRating; + buf[p++] = GLX_TRANSPARENT_TYPE_EXT; + buf[p++] = pGlxVisual->transparentPixel; + buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT; + buf[p++] = pGlxVisual->transparentRed; + buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT; + buf[p++] = pGlxVisual->transparentGreen; + buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT; + buf[p++] = pGlxVisual->transparentBlue; + buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT; + buf[p++] = pGlxVisual->transparentAlpha; + 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); + } + return Success; +} + +int __glXSwapCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->visual); + __GLX_SWAP_INT(&req->pixmap); + __GLX_SWAP_INT(&req->glxpixmap); + + return __glXCreateGLXPixmap(cl, pc); +} + +int __glXSwapCreatePixmap(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->pixmap); + __GLX_SWAP_INT(&req->glxpixmap); + __GLX_SWAP_INT(&req->numAttribs); + + return __glXCreatePixmap(cl, pc); +} + +int __glXSwapDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) +{ + xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->glxpixmap); + + return __glXDestroyGLXPixmap(cl, pc); +} + +int __glXSwapSwapBuffers(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + __GLX_SWAP_INT(&req->drawable); + + return __glXSwapBuffers(cl, pc); +} + +int __glXSwapUseXFont(__GLXclientState *cl, GLbyte *pc) +{ + xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + __GLX_SWAP_INT(&req->font); + __GLX_SWAP_INT(&req->first); + __GLX_SWAP_INT(&req->count); + __GLX_SWAP_INT(&req->listBase); + + return __glXUseXFont(cl, pc); +} + + +int __glXSwapQueryExtensionsString(__GLXclientState *cl, GLbyte *pc) +{ + xGLXQueryExtensionsStringReq *req = NULL; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + + return __glXQueryExtensionsString(cl, pc); +} + +int __glXSwapQueryServerString(__GLXclientState *cl, GLbyte *pc) +{ + xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->name); + + return __glXQueryServerString(cl, pc); +} + +int __glXSwapClientInfo(__GLXclientState *cl, GLbyte *pc) +{ + xGLXClientInfoReq *req = (xGLXClientInfoReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->major); + __GLX_SWAP_INT(&req->minor); + __GLX_SWAP_INT(&req->numbytes); + + return __glXClientInfo(cl, 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); +} + +/************************************************************************/ + +/* +** Swap replies. +*/ + +void __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReadSGIReply *reply) +{ + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_SHORT(&reply->sequenceNumber); + __GLX_SWAP_INT(&reply->length); + __GLX_SWAP_INT(&reply->contextTag); + __GLX_SWAP_INT(&reply->writeVid); + __GLX_SWAP_INT(&reply->writeType); + __GLX_SWAP_INT(&reply->readVid); + __GLX_SWAP_INT(&reply->readType); + WriteToClient(client, sz_xGLXMakeCurrentReadSGIReply, (char *)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); +} + +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); +} + +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, length << 2, 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); + /** 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) +{ + 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); +} + + +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); +} + +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); +} + +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); +} + +/************************************************************************/ + +/* +** Render and Renderlarge are not in the GLX API. They are used by the GLX +** client library to send batches of GL rendering commands. +*/ + +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. + */ + + req = (xGLXRenderReq *) pc; + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + + 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); + + /* + * 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]; +#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; + } + + return __glXRender( cl, (GLbyte *)req ); +} + +/* +** Execute a large rendering request (one that spans multiple X requests). +*/ +int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXRenderLargeReq *req; + __GLXrenderLargeHeader *hdr; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; + + req = (xGLXRenderLargeReq *) pc; + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + __GLX_SWAP_INT(&req->dataBytes); + __GLX_SWAP_SHORT(&req->requestNumber); + __GLX_SWAP_SHORT(&req->requestTotal); + + pc += sz_xGLXRenderLargeReq; + + if (req->requestNumber == 1) { + void (* proc)(GLbyte *) = NULL; + __GLXRenderSwapInfo *info = NULL; + CARD16 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]; +#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 *) __glXMalloc(hdr->length); + } else { + cl->largeCmdBuf = (GLbyte *) __glXRealloc(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; + } + + memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, + pc, req->dataBytes); + + cl->largeCmdBytesSoFar += req->dataBytes; + + if (req->dataBytes > cl->largeCmdMaxReqDataSize) + cl->largeCmdMaxReqDataSize = req->dataBytes; + + 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) ); + + } + else { + cl->largeCmdRequestsTotal = 0; + return __glXBadLargeRequest; + } + +} + +/************************************************************************/ + +/* +** No support is provided for the vendor-private requests other than +** allocating these entry points in the dispatch table. +*/ + +int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq *req; + CARD32 vendorCode; + + __GLX_DECLARE_SWAP_VARIABLES; + + req = (xGLXVendorPrivateReq *) 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; +#endif + + case X_GLXvop_JoinSwapGroupSGIX: + return __glXSwapJoinSwapGroupSGIX( cl, pc ); + break; + + case X_GLXvop_BindSwapBarrierSGIX: + return __glXSwapBindSwapBarrierSGIX( cl, pc ); + break; + + case X_GLXvop_CreateContextWithConfigSGIX: + return __glXSwapCreateContextWithConfigSGIX( cl, pc ); + break; + + default: + /* + ** unsupported private request + */ + cl->client->errorValue = req->vendorCode; + return __glXUnsupportedPrivateRequest; + } + +} + +int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateWithReplyReq *req; + CARD32 vendorCode; + + __GLX_DECLARE_SWAP_VARIABLES; + + req = (xGLXVendorPrivateWithReplyReq *) 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: +#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; + } + +} + +int __glXSwapGetFBConfigs(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + + return __glXGetFBConfigs(cl, pc); +} + +int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc) +{ + 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; + + return( __glXSwapGetFBConfigs( cl, (GLbyte *)&new_req ) ); +} + +int __glXSwapCreateWindow(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->window); + __GLX_SWAP_INT(&req->glxwindow); + __GLX_SWAP_INT(&req->numAttribs); + + return( __glXCreateWindow( 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 ) ); +} + +int __glXSwapQueryContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXQueryContextReq *req = (xGLXQueryContextReq *)pc; + + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + + return( __glXQueryContext(cl, (GLbyte *)pc) ); + +} + +int __glXSwapCreatePbuffer(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *)pc; + int nattr = req->numAttribs; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->pbuffer); + __GLX_SWAP_INT(&req->numAttribs); + __GLX_SWAP_INT_ARRAY( (int *)(req+1), nattr*2 ); + + return( __glXCreatePbuffer( cl, 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 ) ); +} + +int __glXSwapGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->drawable); + + return( __glXGetDrawableAttributes(cl, pc) ); +} + +int __glXSwapChangeDrawableAttributes(__GLXclientState *cl, GLbyte *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 ); + + return( __glXChangeDrawableAttributes(cl, pc) ); +} diff --git a/xorg-server/hw/dmx/glxProxy/glxfbconfig.c b/xorg-server/hw/dmx/glxProxy/glxfbconfig.c index c721fdd24..3611cf61e 100644 --- a/xorg-server/hw/dmx/glxProxy/glxfbconfig.c +++ b/xorg-server/hw/dmx/glxProxy/glxfbconfig.c @@ -1,106 +1,106 @@ -/* - * 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. - */ - -#include "glxfbconfig.h" - -int AreFBConfigsMatch( __GLXFBConfig *c1, __GLXFBConfig *c2 ) -{ - int match; - - match = ( - (c1->visualType == c2->visualType) && - (c1->transparentType == c2->transparentType) && - (c1->transparentRed == c2->transparentRed) && - (c1->transparentGreen == c2->transparentGreen) && - (c1->transparentBlue == c2->transparentBlue) && - (c1->transparentAlpha == c2->transparentAlpha) && - (c1->transparentIndex == c2->transparentIndex) && - (c1->visualCaveat == c2->visualCaveat) && - (c1->drawableType == c2->drawableType) && - (c1->renderType == c2->renderType) && -#if 0 - (c1->maxPbufferWidth == c2->maxPbufferWidth) && - (c1->maxPbufferHeight == c2->maxPbufferHeight) && - (c1->maxPbufferPixels == c2->maxPbufferPixels) && - (c1->optimalPbufferWidth == c2->optimalPbufferWidth) && - (c1->optimalPbufferHeight == c2->optimalPbufferHeight) && -#endif - (c1->visualSelectGroup == c2->visualSelectGroup) && - (c1->rgbMode == c2->rgbMode) && - (c1->colorIndexMode == c2->colorIndexMode) && - (c1->doubleBufferMode == c2->doubleBufferMode) && - (c1->stereoMode == c2->stereoMode) && - (c1->haveAccumBuffer == c2->haveAccumBuffer) && - (c1->haveDepthBuffer == c2->haveDepthBuffer) && - (c1->haveStencilBuffer == c2->haveStencilBuffer) && - (c1->accumRedBits == c2->accumRedBits) && - (c1->accumGreenBits == c2->accumGreenBits) && - (c1->accumBlueBits == c2->accumBlueBits) && - (c1->accumAlphaBits == c2->accumAlphaBits) && - (c1->depthBits == c2->depthBits) && - (c1->stencilBits == c2->stencilBits) && - (c1->indexBits == c2->indexBits) && - (c1->redBits == c2->redBits) && - (c1->greenBits == c2->greenBits) && - (c1->blueBits == c2->blueBits) && - (c1->alphaBits == c2->alphaBits) && - (c1->redMask == c2->redMask) && - (c1->greenMask == c2->greenMask) && - (c1->blueMask == c2->blueMask) && - (c1->alphaMask == c2->alphaMask) && - (c1->multiSampleSize == c2->multiSampleSize) && - (c1->nMultiSampleBuffers == c2->nMultiSampleBuffers) && - (c1->maxAuxBuffers == c2->maxAuxBuffers) && - (c1->level == c2->level) && - (c1->extendedRange == c2->extendedRange) && - (c1->minRed == c2->minRed) && - (c1->maxRed == c2->maxRed) && - (c1->minGreen == c2->minGreen) && - (c1->maxGreen == c2->maxGreen) && - (c1->minBlue == c2->minBlue) && - (c1->maxBlue == c2->maxBlue) && - (c1->minAlpha == c2->minAlpha) && - (c1->maxAlpha == c2->maxAlpha) - ); - - return( match ); -} - -__GLXFBConfig *FindMatchingFBConfig( __GLXFBConfig *c, __GLXFBConfig *configs, int nconfigs ) -{ - int i; - - for (i=0; ivisualType == c2->visualType) && + (c1->transparentType == c2->transparentType) && + (c1->transparentRed == c2->transparentRed) && + (c1->transparentGreen == c2->transparentGreen) && + (c1->transparentBlue == c2->transparentBlue) && + (c1->transparentAlpha == c2->transparentAlpha) && + (c1->transparentIndex == c2->transparentIndex) && + (c1->visualCaveat == c2->visualCaveat) && + (c1->drawableType == c2->drawableType) && + (c1->renderType == c2->renderType) && +#if 0 + (c1->maxPbufferWidth == c2->maxPbufferWidth) && + (c1->maxPbufferHeight == c2->maxPbufferHeight) && + (c1->maxPbufferPixels == c2->maxPbufferPixels) && + (c1->optimalPbufferWidth == c2->optimalPbufferWidth) && + (c1->optimalPbufferHeight == c2->optimalPbufferHeight) && +#endif + (c1->visualSelectGroup == c2->visualSelectGroup) && + (c1->rgbMode == c2->rgbMode) && + (c1->colorIndexMode == c2->colorIndexMode) && + (c1->doubleBufferMode == c2->doubleBufferMode) && + (c1->stereoMode == c2->stereoMode) && + (c1->haveAccumBuffer == c2->haveAccumBuffer) && + (c1->haveDepthBuffer == c2->haveDepthBuffer) && + (c1->haveStencilBuffer == c2->haveStencilBuffer) && + (c1->accumRedBits == c2->accumRedBits) && + (c1->accumGreenBits == c2->accumGreenBits) && + (c1->accumBlueBits == c2->accumBlueBits) && + (c1->accumAlphaBits == c2->accumAlphaBits) && + (c1->depthBits == c2->depthBits) && + (c1->stencilBits == c2->stencilBits) && + (c1->indexBits == c2->indexBits) && + (c1->redBits == c2->redBits) && + (c1->greenBits == c2->greenBits) && + (c1->blueBits == c2->blueBits) && + (c1->alphaBits == c2->alphaBits) && + (c1->redMask == c2->redMask) && + (c1->greenMask == c2->greenMask) && + (c1->blueMask == c2->blueMask) && + (c1->alphaMask == c2->alphaMask) && + (c1->multiSampleSize == c2->multiSampleSize) && + (c1->nMultiSampleBuffers == c2->nMultiSampleBuffers) && + (c1->maxAuxBuffers == c2->maxAuxBuffers) && + (c1->level == c2->level) && + (c1->extendedRange == c2->extendedRange) && + (c1->minRed == c2->minRed) && + (c1->maxRed == c2->maxRed) && + (c1->minGreen == c2->minGreen) && + (c1->maxGreen == c2->maxGreen) && + (c1->minBlue == c2->minBlue) && + (c1->maxBlue == c2->maxBlue) && + (c1->minAlpha == c2->minAlpha) && + (c1->maxAlpha == c2->maxAlpha) + ); + + return match; +} + +__GLXFBConfig *FindMatchingFBConfig( __GLXFBConfig *c, __GLXFBConfig *configs, int nconfigs ) +{ + int i; + + for (i=0; iid == id) - return( __glXFBConfigs[j] ); + return __glXFBConfigs[j]; } - return(NULL); + return NULL; } __GLXFBConfig *glxLookupFBConfigByVID( VisualID vid ) @@ -350,10 +350,10 @@ __GLXFBConfig *glxLookupFBConfigByVID( VisualID vid ) for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) { if ( __glXFBConfigs[j]->associatedVisualId == vid) - return( __glXFBConfigs[j] ); + return __glXFBConfigs[j]; } - return(NULL); + return NULL; } __GLXFBConfig *glxLookupBackEndFBConfig( GLXFBConfigID id, int screen ) @@ -363,10 +363,10 @@ __GLXFBConfig *glxLookupBackEndFBConfig( GLXFBConfigID id, int screen ) for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) { if ( __glXFBConfigs[j]->id == id) - return( __glXFBConfigs[j+screen+1] ); + return __glXFBConfigs[j+screen+1]; } - return(NULL); + return NULL; } diff --git a/xorg-server/hw/dmx/glxProxy/glxsingle.c b/xorg-server/hw/dmx/glxProxy/glxsingle.c index 8325b4afc..056c74066 100644 --- a/xorg-server/hw/dmx/glxProxy/glxsingle.c +++ b/xorg-server/hw/dmx/glxProxy/glxsingle.c @@ -397,6 +397,7 @@ int __glXForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc ) { xGLXSingleReq *req = (xGLXSingleReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); @@ -420,6 +421,7 @@ int __glXForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc ) { xGLXSingleReq *req = (xGLXSingleReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); @@ -443,6 +445,7 @@ int __glXForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc ) { xGLXSingleReq *req = (xGLXSingleReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); @@ -467,6 +470,7 @@ int __glXForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc ) { xGLXSingleReq *req = (xGLXSingleReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); @@ -491,6 +495,7 @@ int __glXForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc ) { xGLXSingleReq *req = (xGLXSingleReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); @@ -515,6 +520,7 @@ int __glXForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc ) { xGLXSingleReq *req = (xGLXSingleReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); @@ -539,6 +545,7 @@ int __glXForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc ) { xGLXSingleReq *req = (xGLXSingleReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); @@ -563,6 +570,7 @@ int __glXForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc ) { xGLXSingleReq *req = (xGLXSingleReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); @@ -587,6 +595,7 @@ int __glXForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc ) { xGLXSingleReq *req = (xGLXSingleReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); @@ -659,7 +668,7 @@ static GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h, } if (elementbits_return) *elementbits_return = elements; if (rowbytes_return) *rowbytes_return = rowsize; - return (rowsize * h); + return rowsize * h; } else { return -1; } @@ -709,7 +718,7 @@ static GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h, if (elementbits_return) *elementbits_return = esize*elements*8; if (rowbytes_return) *rowbytes_return = rowsize; - return (rowsize * h); + return rowsize * h; } static int intersectRect( int x1, int x2, int y1, int y2, @@ -725,14 +734,14 @@ static int intersectRect( int x1, int x2, int y1, int y2, if ( (width <= 0) || (height <= 0) ) { *ix1 = *ix2 = *iy1 = *iy2 = 0; - return(0); + return 0; } else { *ix1 = left; *ix2 = right; *iy1 = top; *iy2 = bottom; - return( width * height ); + return width * height; } } @@ -802,7 +811,7 @@ int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc) if (buf_size > 0) { buf = (char *) malloc( buf_size ); if ( !buf ) { - return( BadAlloc ); + return BadAlloc; } } else { diff --git a/xorg-server/hw/dmx/glxProxy/glxutil.c b/xorg-server/hw/dmx/glxProxy/glxutil.c index 2460ed0dc..ad34eef05 100644 --- a/xorg-server/hw/dmx/glxProxy/glxutil.c +++ b/xorg-server/hw/dmx/glxProxy/glxutil.c @@ -105,7 +105,5 @@ __glXRealloc(void *addr, size_t newSize) void __glXFree(void *addr) { - if (addr) { - free(addr); - } + free(addr); } diff --git a/xorg-server/hw/dmx/glxProxy/glxvendor.c b/xorg-server/hw/dmx/glxProxy/glxvendor.c index f2cea706f..02c8ad73d 100644 --- a/xorg-server/hw/dmx/glxProxy/glxvendor.c +++ b/xorg-server/hw/dmx/glxProxy/glxvendor.c @@ -392,6 +392,7 @@ int __glXVForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc ) { xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->vendorCode); @@ -416,6 +417,7 @@ int __glXVForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc ) { xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->vendorCode); @@ -440,6 +442,7 @@ int __glXVForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc ) { xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->vendorCode); @@ -464,6 +467,7 @@ int __glXVForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc ) { xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->vendorCode); @@ -488,6 +492,7 @@ int __glXVForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc ) { xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->vendorCode); @@ -512,6 +517,7 @@ int __glXVForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc ) { xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->vendorCode); @@ -536,6 +542,7 @@ int __glXVForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc ) { xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->vendorCode); @@ -560,6 +567,7 @@ int __glXVForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc ) { xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->vendorCode); diff --git a/xorg-server/hw/dmx/glxProxy/glxvisuals.c b/xorg-server/hw/dmx/glxProxy/glxvisuals.c index 6e30b4edc..aaace39b6 100644 --- a/xorg-server/hw/dmx/glxProxy/glxvisuals.c +++ b/xorg-server/hw/dmx/glxProxy/glxvisuals.c @@ -77,11 +77,11 @@ int glxVisualsMatch( __GLXvisualConfig *v1, __GLXvisualConfig *v2 ) (v1->nMultiSampleBuffers == v2->nMultiSampleBuffers) && (v1->visualSelectGroup == v2->visualSelectGroup) ) { - return(1); + return 1; } - return(0); + return 0; } @@ -93,12 +93,12 @@ VisualID glxMatchGLXVisualInConfigList( __GLXvisualConfig *pGlxVisual, __GLXvisu if (glxVisualsMatch( pGlxVisual, &configs[i] )) { - return( configs[i].vid ); + return configs[i].vid; } } - return(0); + return 0; } VisualID glxMatchVisualInConfigList( ScreenPtr pScreen, VisualPtr pVisual, __GLXvisualConfig *configs, int nconfigs ) @@ -109,7 +109,7 @@ VisualID glxMatchVisualInConfigList( ScreenPtr pScreen, VisualPtr pVisual, __GLX /* check that the glx extension has been initialized */ if ( !__glXActiveScreens ) - return(0); + return 0; pGlxScreen = &__glXActiveScreens[pScreen->myNum]; pGlxVisual = pGlxScreen->pGlxVisual; @@ -124,7 +124,7 @@ VisualID glxMatchVisualInConfigList( ScreenPtr pScreen, VisualPtr pVisual, __GLX /* * the visual is not supported by glx */ - return(0); + return 0; } return( glxMatchGLXVisualInConfigList(pGlxVisual, configs, nconfigs) ); @@ -151,12 +151,12 @@ VisualPtr glxMatchVisual( ScreenPtr pScreen, VisualPtr pVisual, ScreenPtr pMatch */ for (j=0; jnumVisuals; j++) { if (vid == pMatchScreen->visuals[j].vid) { - return( &pMatchScreen->visuals[j] ); + return &pMatchScreen->visuals[j]; } } } - return(0); + return 0; } void glxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, @@ -198,7 +198,7 @@ static VisualID FindClosestVisual( VisualPtr pVisual, int rootDepth, while( pdepth[d].vids[v] != vis->vid ) vis++; if (vis->class == pVisual->class) { - return( pdepth[d].vids[v] ); + return pdepth[d].vids[v]; } } } @@ -216,7 +216,7 @@ static VisualID FindClosestVisual( VisualPtr pVisual, int rootDepth, while( pdepth[d].vids[v] != vis->vid ) vis++; if (vis->class == pVisual->class) { - return( pdepth[d].vids[v] ); + return pdepth[d].vids[v]; } } } @@ -224,7 +224,7 @@ static VisualID FindClosestVisual( VisualPtr pVisual, int rootDepth, /* * if not found - just take the first visual */ - return( pdepth[0].vids[0] ); + return pdepth[0].vids[0]; } Bool glxInitVisuals(int *nvisualp, VisualPtr *visualp, @@ -531,8 +531,7 @@ Bool glxInitVisuals(int *nvisualp, VisualPtr *visualp, __glXFree(pNewVisualConfigs); /* Free the private list created by DDX HW driver */ - if (visualPrivates) - free(visualPrivates); + free(visualPrivates); visualPrivates = NULL; return TRUE; diff --git a/xorg-server/hw/dmx/glxProxy/render2swap.c b/xorg-server/hw/dmx/glxProxy/render2swap.c index 34122fb36..34fd19624 100644 --- a/xorg-server/hw/dmx/glxProxy/render2swap.c +++ b/xorg-server/hw/dmx/glxProxy/render2swap.c @@ -69,6 +69,7 @@ void __glXDispSwap_Map1f(GLbyte *pc) GLenum target; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 12); @@ -99,6 +100,7 @@ void __glXDispSwap_Map2f(GLbyte *pc) GLenum target; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 12); @@ -137,6 +139,7 @@ void __glXDispSwap_Map1d(GLbyte *pc) GLenum target; GLdouble u1, u2, *points; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_DOUBLE(pc + 0); __GLX_SWAP_DOUBLE(pc + 8); @@ -179,6 +182,7 @@ void __glXDispSwap_Map2d(GLbyte *pc) GLint uorder, vorder, ustride, vstride, k, compsize; GLenum target; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_DOUBLE(pc + 0); __GLX_SWAP_DOUBLE(pc + 8); @@ -228,6 +232,7 @@ void __glXDispSwap_CallLists(GLbyte *pc) GLenum type; GLsizei n; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 0); diff --git a/xorg-server/hw/dmx/glxProxy/unpack.h b/xorg-server/hw/dmx/glxProxy/unpack.h index 73d0485e3..b89a53411 100644 --- a/xorg-server/hw/dmx/glxProxy/unpack.h +++ b/xorg-server/hw/dmx/glxProxy/unpack.h @@ -138,7 +138,9 @@ extern xGLXSingleReply __glXReply; ** conceivably be replaced with routines that do the job faster. */ #define __GLX_DECLARE_SWAP_VARIABLES \ - GLbyte sw; \ + GLbyte sw + +#define __GLX_DECLARE_SWAP_ARRAY_VARIABLES \ GLbyte *swapPC; \ GLbyte *swapEnd -- cgit v1.2.3