diff options
Diffstat (limited to 'xorg-server/hw/xquartz/GL')
-rw-r--r-- | xorg-server/hw/xquartz/GL/capabilities.c | 104 | ||||
-rw-r--r-- | xorg-server/hw/xquartz/GL/capabilities.h | 10 | ||||
-rw-r--r-- | xorg-server/hw/xquartz/GL/glcontextmodes.c | 145 | ||||
-rw-r--r-- | xorg-server/hw/xquartz/GL/glcontextmodes.h | 40 | ||||
-rw-r--r-- | xorg-server/hw/xquartz/GL/indirect.c | 191 | ||||
-rw-r--r-- | xorg-server/hw/xquartz/GL/visualConfigs.c | 102 | ||||
-rw-r--r-- | xorg-server/hw/xquartz/GL/visualConfigs.h | 3 |
7 files changed, 339 insertions, 256 deletions
diff --git a/xorg-server/hw/xquartz/GL/capabilities.c b/xorg-server/hw/xquartz/GL/capabilities.c index 4624fd4db..4702595f4 100644 --- a/xorg-server/hw/xquartz/GL/capabilities.c +++ b/xorg-server/hw/xquartz/GL/capabilities.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008 Apple Inc. + * Copyright (c) 2008-2012 Apple Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -25,7 +25,7 @@ #include <assert.h> #define Cursor Mac_Cursor -#define BOOL Mac_BOOL +#define BOOL Mac_BOOL #include <OpenGL/OpenGL.h> #include <OpenGL/gl.h> #include <OpenGL/glu.h> @@ -120,7 +120,7 @@ handleColorAndAccumulation(struct glColorBufCapabilities *c, { int offset = 0; - /*1 */ + /*1*/ if (kCGLRGB444Bit & cmodes) { c[offset].r = 4; c[offset].g = 4; @@ -128,7 +128,7 @@ handleColorAndAccumulation(struct glColorBufCapabilities *c, ++offset; } - /*2 */ + /*2*/ if (kCGLARGB4444Bit & cmodes) { c[offset].a = 4; c[offset].r = 4; @@ -138,7 +138,7 @@ handleColorAndAccumulation(struct glColorBufCapabilities *c, ++offset; } - /*3 */ + /*3*/ if (kCGLRGB444A8Bit & cmodes) { c[offset].r = 4; c[offset].g = 4; @@ -147,7 +147,7 @@ handleColorAndAccumulation(struct glColorBufCapabilities *c, ++offset; } - /*4 */ + /*4*/ if (kCGLRGB555Bit & cmodes) { c[offset].r = 5; c[offset].g = 5; @@ -155,7 +155,7 @@ handleColorAndAccumulation(struct glColorBufCapabilities *c, ++offset; } - /*5 */ + /*5*/ if (kCGLARGB1555Bit & cmodes) { c[offset].a = 1; c[offset].r = 5; @@ -165,7 +165,7 @@ handleColorAndAccumulation(struct glColorBufCapabilities *c, ++offset; } - /*6 */ + /*6*/ if (kCGLRGB555A8Bit & cmodes) { c[offset].r = 5; c[offset].g = 5; @@ -174,7 +174,7 @@ handleColorAndAccumulation(struct glColorBufCapabilities *c, ++offset; } - /*7 */ + /*7*/ if (kCGLRGB565Bit & cmodes) { c[offset].r = 5; c[offset].g = 6; @@ -182,7 +182,7 @@ handleColorAndAccumulation(struct glColorBufCapabilities *c, ++offset; } - /*8 */ + /*8*/ if (kCGLRGB565A8Bit & cmodes) { c[offset].r = 5; c[offset].g = 6; @@ -191,7 +191,7 @@ handleColorAndAccumulation(struct glColorBufCapabilities *c, ++offset; } - /*9 */ + /*9*/ if (kCGLRGB888Bit & cmodes) { c[offset].r = 8; c[offset].g = 8; @@ -199,7 +199,7 @@ handleColorAndAccumulation(struct glColorBufCapabilities *c, ++offset; } - /*10 */ + /*10*/ if (kCGLARGB8888Bit & cmodes) { c[offset].a = 8; c[offset].r = 8; @@ -209,7 +209,7 @@ handleColorAndAccumulation(struct glColorBufCapabilities *c, ++offset; } - /*11 */ + /*11*/ if (kCGLRGB888A8Bit & cmodes) { c[offset].r = 8; c[offset].g = 8; @@ -219,16 +219,16 @@ handleColorAndAccumulation(struct glColorBufCapabilities *c, } if (forAccum) { -//#if 0 + //#if 0 /* FIXME - * Disable this path, because some part of libGL, X, or Xplugin + * Disable this path, because some part of libGL, X, or Xplugin * doesn't work with sizes greater than 8. * When this is enabled and visuals are chosen using depths * such as 16, the result is that the windows don't redraw * and are often white, until a resize. */ - /*12 */ + /*12*/ if (kCGLRGB101010Bit & cmodes) { c[offset].r = 10; c[offset].g = 10; @@ -236,7 +236,7 @@ handleColorAndAccumulation(struct glColorBufCapabilities *c, ++offset; } - /*13 */ + /*13*/ if (kCGLARGB2101010Bit & cmodes) { c[offset].a = 2; c[offset].r = 10; @@ -246,7 +246,7 @@ handleColorAndAccumulation(struct glColorBufCapabilities *c, ++offset; } - /*14 */ + /*14*/ if (kCGLRGB101010_A8Bit & cmodes) { c[offset].r = 10; c[offset].g = 10; @@ -255,7 +255,7 @@ handleColorAndAccumulation(struct glColorBufCapabilities *c, ++offset; } - /*15 */ + /*15*/ if (kCGLRGB121212Bit & cmodes) { c[offset].r = 12; c[offset].g = 12; @@ -263,7 +263,7 @@ handleColorAndAccumulation(struct glColorBufCapabilities *c, ++offset; } - /*16 */ + /*16*/ if (kCGLARGB12121212Bit & cmodes) { c[offset].a = 12; c[offset].r = 12; @@ -273,7 +273,7 @@ handleColorAndAccumulation(struct glColorBufCapabilities *c, ++offset; } - /*17 */ + /*17*/ if (kCGLRGB161616Bit & cmodes) { c[offset].r = 16; c[offset].g = 16; @@ -281,7 +281,7 @@ handleColorAndAccumulation(struct glColorBufCapabilities *c, ++offset; } - /*18 */ + /*18*/ if (kCGLRGBA16161616Bit & cmodes) { c[offset].r = 16; c[offset].g = 16; @@ -290,7 +290,7 @@ handleColorAndAccumulation(struct glColorBufCapabilities *c, ++offset; } } -//#endif + //#endif /* FIXME should we handle the floating point color modes, and if so, how? */ @@ -318,46 +318,45 @@ static void handleDepthModes(struct glCapabilitiesConfig *c, GLint dmodes) { int offset = 0; +#define DEPTH(flag, value) do { \ + if (dmodes & flag) { \ + c->depth_buffers[offset++] = value; \ + } \ +} while (0) -#define DEPTH(flag,value) do { \ - if(dmodes & flag) { \ - c->depth_buffers[offset++] = value; \ - } \ - } while(0) - - /*1 */ + /*1*/ DEPTH(kCGL0Bit, 0); - /*2 */ + /*2*/ DEPTH(kCGL1Bit, 1); - /*3 */ + /*3*/ DEPTH(kCGL2Bit, 2); - /*4 */ + /*4*/ DEPTH(kCGL3Bit, 3); - /*5 */ + /*5*/ DEPTH(kCGL4Bit, 4); - /*6 */ + /*6*/ DEPTH(kCGL5Bit, 5); - /*7 */ + /*7*/ DEPTH(kCGL6Bit, 6); - /*8 */ + /*8*/ DEPTH(kCGL8Bit, 8); - /*9 */ + /*9*/ DEPTH(kCGL10Bit, 10); - /*10 */ + /*10*/ DEPTH(kCGL12Bit, 12); - /*11 */ + /*11*/ DEPTH(kCGL16Bit, 16); - /*12 */ + /*12*/ DEPTH(kCGL24Bit, 24); - /*13 */ + /*13*/ DEPTH(kCGL32Bit, 32); - /*14 */ + /*14*/ DEPTH(kCGL48Bit, 48); - /*15 */ + /*15*/ DEPTH(kCGL64Bit, 64); - /*16 */ + /*16*/ DEPTH(kCGL96Bit, 96); - /*17 */ + /*17*/ DEPTH(kCGL128Bit, 128); #undef DEPTH @@ -483,8 +482,9 @@ initConfig(struct glCapabilitiesConfig *c) for (i = 0; i < GLCAPS_COLOR_BUFFERS; ++i) { c->color_buffers[i].r = c->color_buffers[i].g = - c->color_buffers[i].b = c->color_buffers[i].a = - GLCAPS_COLOR_BUF_INVALID_VALUE; + c->color_buffers[i].b = + c->color_buffers[i].a = + GLCAPS_COLOR_BUF_INVALID_VALUE; c->color_buffers[i].is_argb = false; } @@ -492,8 +492,9 @@ initConfig(struct glCapabilitiesConfig *c) for (i = 0; i < GLCAPS_COLOR_BUFFERS; ++i) { c->accum_buffers[i].r = c->accum_buffers[i].g = - c->accum_buffers[i].b = c->accum_buffers[i].a = - GLCAPS_COLOR_BUF_INVALID_VALUE; + c->accum_buffers[i].b = + c->accum_buffers[i].a = + GLCAPS_COLOR_BUF_INVALID_VALUE; c->accum_buffers[i].is_argb = false; } @@ -540,7 +541,8 @@ getGlCapabilities(struct glCapabilities *cap) err = handleRendererDescriptions(info, r, &tmpconf); if (err) { ErrorF("handleRendererDescriptions returned error: %s\n", - CGLErrorString(err)); + CGLErrorString( + err)); ErrorF("trying to continue...\n"); continue; } diff --git a/xorg-server/hw/xquartz/GL/capabilities.h b/xorg-server/hw/xquartz/GL/capabilities.h index 361856b07..62b3ac25a 100644 --- a/xorg-server/hw/xquartz/GL/capabilities.h +++ b/xorg-server/hw/xquartz/GL/capabilities.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008 Apple Inc. + * Copyright (c) 2008-2012 Apple Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -55,12 +55,14 @@ struct glCapabilitiesConfig { struct glCapabilitiesConfig *next; }; -struct glCapabilities { +struct glCapabilities { struct glCapabilitiesConfig *configurations; int total_configurations; }; -bool getGlCapabilities(struct glCapabilities *cap); -void freeGlCapabilities(struct glCapabilities *cap); +bool +getGlCapabilities(struct glCapabilities *cap); +void +freeGlCapabilities(struct glCapabilities *cap); #endif diff --git a/xorg-server/hw/xquartz/GL/glcontextmodes.c b/xorg-server/hw/xquartz/GL/glcontextmodes.c index 79fadf876..dc97f89e4 100644 --- a/xorg-server/hw/xquartz/GL/glcontextmodes.c +++ b/xorg-server/hw/xquartz/GL/glcontextmodes.c @@ -47,31 +47,31 @@ #include <stdlib.h> #include <string.h> #define _mesa_malloc(b) malloc(b) -#define _mesa_free(m) free(m) -#define _mesa_memset memset +#define _mesa_free(m) free(m) +#define _mesa_memset memset #else #ifdef XFree86Server #include <os.h> #include <string.h> #define _mesa_malloc(b) malloc(b) #define _mesa_free(m) free(m) -#define _mesa_memset memset +#define _mesa_memset memset #else #include <X11/Xlibint.h> #define _mesa_memset memset #define _mesa_malloc(b) Xmalloc(b) -#define _mesa_free(m) free(m) -#endif /* XFree86Server */ -#endif /* !defined(IN_MINI_GLX) */ +#define _mesa_free(m) free(m) +#endif /* XFree86Server */ +#endif /* !defined(IN_MINI_GLX) */ #include "glcontextmodes.h" #if !defined(IN_MINI_GLX) -#define NUM_VISUAL_TYPES 6 +#define NUM_VISUAL_TYPES 6 /** * Convert an X visual type to a GLX visual type. - * + * * \param visualType X visual type (i.e., \c TrueColor, \c StaticGray, etc.) * to be converted. * \return If \c visualType is a valid X visual type, a GLX visual type will @@ -81,19 +81,19 @@ GLint _gl_convert_from_x_visual_type(int visualType) { static const int glx_visual_types[NUM_VISUAL_TYPES] = { - GLX_STATIC_GRAY, GLX_GRAY_SCALE, + GLX_STATIC_GRAY, GLX_GRAY_SCALE, GLX_STATIC_COLOR, GLX_PSEUDO_COLOR, - GLX_TRUE_COLOR, GLX_DIRECT_COLOR + GLX_TRUE_COLOR, GLX_DIRECT_COLOR }; - return ((unsigned) visualType < NUM_VISUAL_TYPES) - ? glx_visual_types[visualType] : GLX_NONE; + return ((unsigned)visualType < NUM_VISUAL_TYPES) + ? glx_visual_types[visualType] : GLX_NONE; } /** * Convert a GLX visual type to an X visual type. - * - * \param visualType GLX visual type (i.e., \c GLX_TRUE_COLOR, + * + * \param visualType GLX visual type (i.e., \c GLX_TRUE_COLOR, * \c GLX_STATIC_GRAY, etc.) to be converted. * \return If \c visualType is a valid GLX visual type, an X visual type will * be returned. Otherwise -1 will be returned. @@ -102,13 +102,13 @@ GLint _gl_convert_to_x_visual_type(int visualType) { static const int x_visual_types[NUM_VISUAL_TYPES] = { - TrueColor, DirectColor, + TrueColor, DirectColor, PseudoColor, StaticColor, - GrayScale, StaticGray + GrayScale, StaticGray }; - return ((unsigned) (visualType - GLX_TRUE_COLOR) < NUM_VISUAL_TYPES) - ? x_visual_types[visualType - GLX_TRUE_COLOR] : -1; + return ((unsigned)(visualType - GLX_TRUE_COLOR) < NUM_VISUAL_TYPES) + ? x_visual_types[visualType - GLX_TRUE_COLOR] : -1; } /** @@ -117,10 +117,10 @@ _gl_convert_to_x_visual_type(int visualType) * \c mode that can be derrived from the fields of \c config (i.e., * \c haveDepthBuffer) are also filled in. The remaining fields in \c mode * that cannot be derived are set to default values. - * + * * \param mode Destination GL context mode. * \param config Source GLX visual config. - * + * * \note * The \c fbconfigID and \c visualID fields of the \c __GLcontextModes * structure will be set to the \c vid of the \c __GLXvisualConfig structure. @@ -129,9 +129,9 @@ void _gl_copy_visual_to_context_mode(__GLcontextModes * mode, const __GLXvisualConfig * config) { - __GLcontextModes *const next = mode->next; + __GLcontextModes * const next = mode->next; - (void) _mesa_memset(mode, 0, sizeof(__GLcontextModes)); + (void)_mesa_memset(mode, 0, sizeof(__GLcontextModes)); mode->next = next; mode->visualID = config->vid; @@ -190,17 +190,18 @@ _gl_copy_visual_to_context_mode(__GLcontextModes * mode, mode->bindToTextureRgb = (mode->rgbMode) ? GL_TRUE : GL_FALSE; mode->bindToTextureRgba = (mode->rgbMode && mode->alphaBits) ? - GL_TRUE : GL_FALSE; + GL_TRUE : GL_FALSE; mode->bindToMipmapTexture = mode->rgbMode ? GL_TRUE : GL_FALSE; mode->bindToTextureTargets = mode->rgbMode ? - GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT | - GLX_TEXTURE_RECTANGLE_BIT_EXT : 0; + GLX_TEXTURE_1D_BIT_EXT | + GLX_TEXTURE_2D_BIT_EXT | + GLX_TEXTURE_RECTANGLE_BIT_EXT : 0; mode->yInverted = GL_FALSE; } /** * Get data from a GL context mode. - * + * * \param mode GL context mode whose data is to be returned. * \param attribute Attribute of \c mode that is to be returned. * \param value_return Location to store the data member of \c mode. @@ -208,151 +209,193 @@ _gl_copy_visual_to_context_mode(__GLcontextModes * mode, * returned. Otherwise \c GLX_BAD_ATTRIBUTE is returned. */ int -_gl_get_context_mode_data(const __GLcontextModes * mode, int attribute, +_gl_get_context_mode_data(const __GLcontextModes *mode, int attribute, int *value_return) { switch (attribute) { case GLX_USE_GL: *value_return = GL_TRUE; return 0; + case GLX_BUFFER_SIZE: *value_return = mode->rgbBits; return 0; + case GLX_RGBA: *value_return = mode->rgbMode; return 0; + case GLX_RED_SIZE: *value_return = mode->redBits; return 0; + case GLX_GREEN_SIZE: *value_return = mode->greenBits; return 0; + case GLX_BLUE_SIZE: *value_return = mode->blueBits; return 0; + case GLX_ALPHA_SIZE: *value_return = mode->alphaBits; return 0; + case GLX_DOUBLEBUFFER: *value_return = mode->doubleBufferMode; return 0; + case GLX_STEREO: *value_return = mode->stereoMode; return 0; + case GLX_AUX_BUFFERS: *value_return = mode->numAuxBuffers; return 0; + case GLX_DEPTH_SIZE: *value_return = mode->depthBits; return 0; + case GLX_STENCIL_SIZE: *value_return = mode->stencilBits; return 0; + case GLX_ACCUM_RED_SIZE: *value_return = mode->accumRedBits; return 0; + case GLX_ACCUM_GREEN_SIZE: *value_return = mode->accumGreenBits; return 0; + case GLX_ACCUM_BLUE_SIZE: *value_return = mode->accumBlueBits; return 0; + case GLX_ACCUM_ALPHA_SIZE: *value_return = mode->accumAlphaBits; return 0; + case GLX_LEVEL: *value_return = mode->level; return 0; + case GLX_TRANSPARENT_TYPE_EXT: *value_return = mode->transparentPixel; return 0; + case GLX_TRANSPARENT_RED_VALUE: *value_return = mode->transparentRed; return 0; + case GLX_TRANSPARENT_GREEN_VALUE: *value_return = mode->transparentGreen; return 0; + case GLX_TRANSPARENT_BLUE_VALUE: *value_return = mode->transparentBlue; return 0; + case GLX_TRANSPARENT_ALPHA_VALUE: *value_return = mode->transparentAlpha; return 0; + case GLX_TRANSPARENT_INDEX_VALUE: *value_return = mode->transparentIndex; return 0; + case GLX_X_VISUAL_TYPE: *value_return = mode->visualType; return 0; + case GLX_CONFIG_CAVEAT: *value_return = mode->visualRating; return 0; + case GLX_VISUAL_ID: *value_return = mode->visualID; return 0; + case GLX_DRAWABLE_TYPE: *value_return = mode->drawableType; return 0; + case GLX_RENDER_TYPE: *value_return = mode->renderType; return 0; + case GLX_X_RENDERABLE: *value_return = mode->xRenderable; return 0; + case GLX_FBCONFIG_ID: *value_return = mode->fbconfigID; return 0; + case GLX_MAX_PBUFFER_WIDTH: *value_return = mode->maxPbufferWidth; return 0; + case GLX_MAX_PBUFFER_HEIGHT: *value_return = mode->maxPbufferHeight; return 0; + case GLX_MAX_PBUFFER_PIXELS: *value_return = mode->maxPbufferPixels; return 0; + case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX: *value_return = mode->optimalPbufferWidth; return 0; + case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX: *value_return = mode->optimalPbufferHeight; return 0; + case GLX_SWAP_METHOD_OML: *value_return = mode->swapMethod; return 0; + case GLX_SAMPLE_BUFFERS_SGIS: *value_return = mode->sampleBuffers; return 0; + case GLX_SAMPLES_SGIS: *value_return = mode->samples; return 0; + case GLX_BIND_TO_TEXTURE_RGB_EXT: *value_return = mode->bindToTextureRgb; return 0; + case GLX_BIND_TO_TEXTURE_RGBA_EXT: *value_return = mode->bindToTextureRgba; return 0; + case GLX_BIND_TO_MIPMAP_TEXTURE_EXT: *value_return = mode->bindToMipmapTexture == GL_TRUE ? GL_TRUE : - GL_FALSE; + GL_FALSE; return 0; + case GLX_BIND_TO_TEXTURE_TARGETS_EXT: *value_return = mode->bindToTextureTargets; return 0; + case GLX_Y_INVERTED_EXT: *value_return = mode->yInverted; return 0; - /* Applications are NOT allowed to query GLX_VISUAL_SELECT_GROUP_SGIX. - * It is ONLY for communication between the GLX client and the GLX - * server. - */ + /* Applications are NOT allowed to query GLX_VISUAL_SELECT_GROUP_SGIX. + * It is ONLY for communication between the GLX client and the GLX + * server. + */ case GLX_VISUAL_SELECT_GROUP_SGIX: default: return GLX_BAD_ATTRIBUTE; } } -#endif /* !defined(IN_MINI_GLX) */ +#endif /* !defined(IN_MINI_GLX) */ /** * Allocate a linked list of \c __GLcontextModes structures. The fields of @@ -362,7 +405,7 @@ _gl_get_context_mode_data(const __GLcontextModes * mode, int attribute, * zero or \c GLX_DONT_CARE (which is -1). As support for additional * extensions is added, the new values will be initialized to appropriate * values from the extension specification. - * + * * \param count Number of structures to allocate. * \param minimum_size Minimum size of a structure to allocate. This allows * for differences in the version of the @@ -370,7 +413,7 @@ _gl_get_context_mode_data(const __GLcontextModes * mode, int attribute, * DRI-based driver. * \returns A pointer to the first element in a linked list of \c count * stuctures on success, or \c NULL on failure. - * + * * \warning Use of \c minimum_size does \b not guarantee binary compatibility. * The fundamental assumption is that if the \c minimum_size * specified by the driver and the size of the \c __GLcontextModes @@ -384,21 +427,21 @@ __GLcontextModes * _gl_context_modes_create(unsigned count, size_t minimum_size) { const size_t size = (minimum_size > sizeof(__GLcontextModes)) - ? minimum_size : sizeof(__GLcontextModes); - __GLcontextModes *base = NULL; - __GLcontextModes **next; + ? minimum_size : sizeof(__GLcontextModes); + __GLcontextModes * base = NULL; + __GLcontextModes ** next; unsigned i; next = &base; for (i = 0; i < count; i++) { - *next = (__GLcontextModes *) _mesa_malloc(size); + *next = (__GLcontextModes *)_mesa_malloc(size); if (*next == NULL) { _gl_context_modes_destroy(base); base = NULL; break; } - (void) _mesa_memset(*next, 0, size); + (void)_mesa_memset(*next, 0, size); (*next)->visualID = GLX_DONT_CARE; (*next)->visualType = GLX_DONT_CARE; (*next)->visualRating = GLX_NONE; @@ -426,7 +469,7 @@ _gl_context_modes_create(unsigned count, size_t minimum_size) /** * Destroy a linked list of \c __GLcontextModes structures created by * \c _gl_context_modes_create. - * + * * \param modes Linked list of structures to be destroyed. All structres * in the list will be freed. */ @@ -434,7 +477,7 @@ void _gl_context_modes_destroy(__GLcontextModes * modes) { while (modes != NULL) { - __GLcontextModes *const next = modes->next; + __GLcontextModes * const next = modes->next; _mesa_free(modes); modes = next; @@ -451,7 +494,7 @@ _gl_context_modes_destroy(__GLcontextModes * modes) */ __GLcontextModes * -_gl_context_modes_find_visual(__GLcontextModes * modes, int vid) +_gl_context_modes_find_visual(__GLcontextModes *modes, int vid) { __GLcontextModes *m; @@ -463,7 +506,7 @@ _gl_context_modes_find_visual(__GLcontextModes * modes, int vid) } __GLcontextModes * -_gl_context_modes_find_fbconfig(__GLcontextModes * modes, int fbid) +_gl_context_modes_find_fbconfig(__GLcontextModes *modes, int fbid) { __GLcontextModes *m; @@ -477,7 +520,7 @@ _gl_context_modes_find_fbconfig(__GLcontextModes * modes, int fbid) /** * Determine if two context-modes are the same. This is intended to be used * by libGL implementations to compare to sets of driver generated FBconfigs. - * + * * \param a Context-mode to be compared. * \param b Context-mode to be compared. * \returns \c GL_TRUE if the two context-modes are the same. \c GL_FALSE is @@ -494,11 +537,13 @@ _gl_context_modes_are_same(const __GLcontextModes * a, (a->stereoMode == b->stereoMode) && (a->redBits == b->redBits) && (a->greenBits == b->greenBits) && - (a->blueBits == b->blueBits) && (a->alphaBits == b->alphaBits) && -#if 0 /* For some reason these don't get set on the client-side in libGL. */ + (a->blueBits == b->blueBits) && + (a->alphaBits == b->alphaBits) && +#if 0 /* For some reason these don't get set on the client-side in libGL. */ (a->redMask == b->redMask) && (a->greenMask == b->greenMask) && - (a->blueMask == b->blueMask) && (a->alphaMask == b->alphaMask) && + (a->blueMask == b->blueMask) && + (a->alphaMask == b->alphaMask) && #endif (a->rgbBits == b->rgbBits) && (a->indexBits == b->indexBits) && @@ -512,14 +557,18 @@ _gl_context_modes_are_same(const __GLcontextModes * a, (a->level == b->level) && (a->pixmapMode == b->pixmapMode) && (a->visualRating == b->visualRating) && + (a->transparentPixel == b->transparentPixel) && + ((a->transparentPixel != GLX_TRANSPARENT_RGB) || ((a->transparentRed == b->transparentRed) && (a->transparentGreen == b->transparentGreen) && (a->transparentBlue == b->transparentBlue) && (a->transparentAlpha == b->transparentAlpha))) && + ((a->transparentPixel != GLX_TRANSPARENT_INDEX) || (a->transparentIndex == b->transparentIndex)) && + (a->sampleBuffers == b->sampleBuffers) && (a->samples == b->samples) && ((a->drawableType & b->drawableType) != 0) && diff --git a/xorg-server/hw/xquartz/GL/glcontextmodes.h b/xorg-server/hw/xquartz/GL/glcontextmodes.h index 871c2e1b3..7237ccc06 100644 --- a/xorg-server/hw/xquartz/GL/glcontextmodes.h +++ b/xorg-server/hw/xquartz/GL/glcontextmodes.h @@ -33,22 +33,28 @@ #include "GL/internal/glcore.h" #if !defined(IN_MINI_GLX) -extern GLint _gl_convert_from_x_visual_type(int visualType); -extern GLint _gl_convert_to_x_visual_type(int visualType); -extern void _gl_copy_visual_to_context_mode(__GLcontextModes * mode, - const __GLXvisualConfig * config); -extern int _gl_get_context_mode_data(const __GLcontextModes * mode, - int attribute, int *value_return); -#endif /* !defined(IN_MINI_GLX) */ +extern GLint +_gl_convert_from_x_visual_type(int visualType); +extern GLint +_gl_convert_to_x_visual_type(int visualType); +extern void +_gl_copy_visual_to_context_mode(__GLcontextModes * mode, + const __GLXvisualConfig * config); +extern int +_gl_get_context_mode_data(const __GLcontextModes *mode, int attribute, + int *value_return); +#endif /* !defined(IN_MINI_GLX) */ -extern __GLcontextModes *_gl_context_modes_create(unsigned count, - size_t minimum_size); -extern void _gl_context_modes_destroy(__GLcontextModes * modes); -extern __GLcontextModes *_gl_context_modes_find_visual(__GLcontextModes * modes, - int vid); -extern __GLcontextModes *_gl_context_modes_find_fbconfig(__GLcontextModes * - modes, int fbid); -extern GLboolean _gl_context_modes_are_same(const __GLcontextModes * a, - const __GLcontextModes * b); +extern __GLcontextModes * +_gl_context_modes_create(unsigned count, size_t minimum_size); +extern void +_gl_context_modes_destroy(__GLcontextModes * modes); +extern __GLcontextModes * +_gl_context_modes_find_visual(__GLcontextModes *modes, int vid); +extern __GLcontextModes * +_gl_context_modes_find_fbconfig(__GLcontextModes *modes, int fbid); +extern GLboolean +_gl_context_modes_are_same(const __GLcontextModes * a, + const __GLcontextModes * b); -#endif /* GLCONTEXTMODES_H */ +#endif /* GLCONTEXTMODES_H */ diff --git a/xorg-server/hw/xquartz/GL/indirect.c b/xorg-server/hw/xquartz/GL/indirect.c index 1f4f79c4b..d9dc2a15b 100644 --- a/xorg-server/hw/xquartz/GL/indirect.c +++ b/xorg-server/hw/xquartz/GL/indirect.c @@ -2,7 +2,7 @@ * GLX implementation that uses Apple's OpenGL.framework * (Indirect rendering path -- it's also used for some direct mode code too) * - * Copyright (c) 2007-2011 Apple Inc. + * Copyright (c) 2007-2012 Apple Inc. * Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved. * Copyright (c) 2002 Greg Parker. All Rights Reserved. * @@ -40,7 +40,7 @@ #include <dlfcn.h> #include <OpenGL/OpenGL.h> -#include <OpenGL/gl.h> /* Just to prevent glxserver.h from loading mesa's and colliding with OpenGL.h */ +#include <OpenGL/gl.h> /* Just to prevent glxserver.h from loading mesa's and colliding with OpenGL.h */ #include <X11/Xproto.h> #include <GL/glxproto.h> @@ -56,30 +56,41 @@ #include "dri.h" #include "darwin.h" -#define GLAQUA_DEBUG_MSG(msg, args...) ASL_LOG(ASL_LEVEL_DEBUG, "GLXAqua", msg, ##args) +#define GLAQUA_DEBUG_MSG(msg, args ...) ASL_LOG(ASL_LEVEL_DEBUG, "GLXAqua", \ + msg, \ + ## args) -__GLXprovider *GlxGetDRISWrastProvider(void); +__GLXprovider * +GlxGetDRISWrastProvider(void); -static void setup_dispatch_table(void); -GLuint __glFloorLog2(GLuint val); -void warn_func(void *p1, char *format, ...); +static void +setup_dispatch_table(void); +GLuint +__glFloorLog2(GLuint val); +void +warn_func(void * p1, char *format, ...); // some prototypes -static __GLXscreen *__glXAquaScreenProbe(ScreenPtr pScreen); -static __GLXdrawable *__glXAquaScreenCreateDrawable(ClientPtr client, - __GLXscreen * screen, - DrawablePtr pDraw, - XID drawId, int type, - XID glxDrawId, - __GLXconfig * conf); - -static void __glXAquaContextDestroy(__GLXcontext * baseContext); -static int __glXAquaContextMakeCurrent(__GLXcontext * baseContext); -static int __glXAquaContextLoseCurrent(__GLXcontext * baseContext); -static int __glXAquaContextCopy(__GLXcontext * baseDst, __GLXcontext * baseSrc, - unsigned long mask); - -static CGLPixelFormatObj makeFormat(__GLXconfig * conf); +static __GLXscreen * +__glXAquaScreenProbe(ScreenPtr pScreen); +static __GLXdrawable * +__glXAquaScreenCreateDrawable(ClientPtr client, __GLXscreen *screen, + DrawablePtr pDraw, XID drawId, int type, + XID glxDrawId, + __GLXconfig *conf); + +static void +__glXAquaContextDestroy(__GLXcontext *baseContext); +static int +__glXAquaContextMakeCurrent(__GLXcontext *baseContext); +static int +__glXAquaContextLoseCurrent(__GLXcontext *baseContext); +static int +__glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, + unsigned long mask); + +static CGLPixelFormatObj +makeFormat(__GLXconfig *conf); __GLXprovider __glXDRISWRastProvider = { __glXAquaScreenProbe, @@ -94,9 +105,9 @@ typedef struct __GLXAquaDrawable __GLXAquaDrawable; /* * The following structs must keep the base as the first member. * It's used to treat the start of the struct as a different struct - * in GLX. + * in GLX. * - * Note: these structs should be initialized with xcalloc or memset + * Note: these structs should be initialized with xcalloc or memset * prior to usage, and some of them require initializing * the base with function pointers. */ @@ -111,7 +122,7 @@ struct __GLXAquaContext { CGLContextObj ctx; CGLPixelFormatObj pixelFormat; xp_surface_id sid; - unsigned isAttached:1; + unsigned isAttached : 1; }; struct __GLXAquaDrawable { @@ -122,12 +133,12 @@ struct __GLXAquaDrawable { }; static __GLXcontext * -__glXAquaScreenCreateContext(__GLXscreen * screen, - __GLXconfig * conf, - __GLXcontext * baseShareContext) +__glXAquaScreenCreateContext(__GLXscreen *screen, + __GLXconfig *conf, + __GLXcontext *baseShareContext) { __GLXAquaContext *context; - __GLXAquaContext *shareContext = (__GLXAquaContext *) baseShareContext; + __GLXAquaContext *shareContext = (__GLXAquaContext *)baseShareContext; CGLError gl_err; GLAQUA_DEBUG_MSG("glXAquaScreenCreateContext\n"); @@ -176,21 +187,21 @@ __glXAquaScreenCreateContext(__GLXscreen * screen, static x_hash_table *surface_hash; static void -__glXAquaContextDestroy(__GLXcontext * baseContext) +__glXAquaContextDestroy(__GLXcontext *baseContext) { x_list *lst; - __GLXAquaContext *context = (__GLXAquaContext *) baseContext; + __GLXAquaContext *context = (__GLXAquaContext *)baseContext; GLAQUA_DEBUG_MSG("glAquaContextDestroy (ctx %p)\n", baseContext); if (context != NULL) { if (context->sid != 0 && surface_hash != NULL) { lst = - x_hash_table_lookup(surface_hash, - x_cvt_uint_to_vptr(context->sid), NULL); + x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr( + context->sid), NULL); lst = x_list_remove(lst, context); - x_hash_table_insert(surface_hash, x_cvt_uint_to_vptr(context->sid), - lst); + x_hash_table_insert(surface_hash, x_cvt_uint_to_vptr( + context->sid), lst); } if (context->ctx != NULL) @@ -204,7 +215,7 @@ __glXAquaContextDestroy(__GLXcontext * baseContext) } static int -__glXAquaContextLoseCurrent(__GLXcontext * baseContext) +__glXAquaContextLoseCurrent(__GLXcontext *baseContext) { CGLError gl_err; @@ -214,9 +225,9 @@ __glXAquaContextLoseCurrent(__GLXcontext * baseContext) if (gl_err != 0) ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err)); - /* + /* * There should be no need to set __glXLastContext to NULL here, because - * glxcmds.c does it as part of the context cache flush after calling + * glxcmds.c does it as part of the context cache flush after calling * this. */ @@ -228,11 +239,10 @@ __glXAquaContextLoseCurrent(__GLXcontext * baseContext) static void surface_notify(void *_arg, void *data) { - DRISurfaceNotifyArg *arg = (DRISurfaceNotifyArg *) _arg; - __GLXAquaDrawable *draw = (__GLXAquaDrawable *) data; + DRISurfaceNotifyArg *arg = (DRISurfaceNotifyArg *)_arg; + __GLXAquaDrawable *draw = (__GLXAquaDrawable *)data; __GLXAquaContext *context; x_list *lst; - if (_arg == NULL || data == NULL) { ErrorF("surface_notify called with bad params"); return; @@ -250,14 +260,15 @@ surface_notify(void *_arg, void *data) case AppleDRISurfaceNotifyChanged: if (surface_hash != NULL) { lst = - x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr(arg->id), - NULL); + x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr( + arg->id), NULL); for (; lst != NULL; lst = lst->next) { context = lst->data; xp_update_gl_context(context->ctx); } } break; + default: ErrorF("surface_notify: unknown kind %d\n", arg->kind); break; @@ -265,7 +276,7 @@ surface_notify(void *_arg, void *data) } static BOOL -attach(__GLXAquaContext * context, __GLXAquaDrawable * draw) +attach(__GLXAquaContext *context, __GLXAquaDrawable *draw) { DrawablePtr pDraw; @@ -284,7 +295,8 @@ attach(__GLXAquaContext * context, __GLXAquaDrawable * draw) if (draw->sid == 0) { //if (!quartzProcs->CreateSurface(pDraw->pScreen, pDraw->id, pDraw, if (!DRICreateSurface(pDraw->pScreen, pDraw->id, pDraw, - 0, &draw->sid, NULL, surface_notify, draw)) + 0, &draw->sid, NULL, + surface_notify, draw)) return TRUE; draw->pDraw = pDraw; } @@ -311,16 +323,16 @@ attach(__GLXAquaContext * context, __GLXAquaDrawable * draw) surface_hash = x_hash_table_new(NULL, NULL, NULL, NULL); lst = - x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr(context->sid), - NULL); + x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr( + context->sid), NULL); if (x_list_find(lst, context) == NULL) { lst = x_list_prepend(lst, context); - x_hash_table_insert(surface_hash, x_cvt_uint_to_vptr(context->sid), - lst); + x_hash_table_insert(surface_hash, x_cvt_uint_to_vptr( + context->sid), lst); } - GLAQUA_DEBUG_MSG("attached 0x%x to 0x%x\n", (unsigned int) pDraw->id, - (unsigned int) draw->sid); + GLAQUA_DEBUG_MSG("attached 0x%x to 0x%x\n", (unsigned int)pDraw->id, + (unsigned int)draw->sid); } draw->context = context; @@ -328,12 +340,11 @@ attach(__GLXAquaContext * context, __GLXAquaDrawable * draw) return FALSE; } -#if 0 // unused +#if 0 // unused static void -unattach(__GLXAquaContext * context) +unattach(__GLXAquaContext *context) { x_list *lst; - GLAQUA_DEBUG_MSG("unattach\n"); if (context == NULL) { ErrorF("Tried to unattach a null context\n"); @@ -343,10 +354,10 @@ unattach(__GLXAquaContext * context) GLAQUA_DEBUG_MSG("unattaching\n"); if (surface_hash != NULL) { - lst = - x_hash_table_lookup(surface_hash, (void *) context->sid, NULL); + lst = x_hash_table_lookup(surface_hash, (void *)context->sid, + NULL); lst = x_list_remove(lst, context); - x_hash_table_insert(surface_hash, (void *) context->sid, lst); + x_hash_table_insert(surface_hash, (void *)context->sid, lst); } CGLClearDrawable(context->ctx); @@ -357,16 +368,16 @@ unattach(__GLXAquaContext * context) #endif static int -__glXAquaContextMakeCurrent(__GLXcontext * baseContext) +__glXAquaContextMakeCurrent(__GLXcontext *baseContext) { CGLError gl_err; - __GLXAquaContext *context = (__GLXAquaContext *) baseContext; - __GLXAquaDrawable *drawPriv = (__GLXAquaDrawable *) context->base.drawPriv; + __GLXAquaContext *context = (__GLXAquaContext *)baseContext; + __GLXAquaDrawable *drawPriv = (__GLXAquaDrawable *)context->base.drawPriv; GLAQUA_DEBUG_MSG("glAquaMakeCurrent (ctx 0x%p)\n", baseContext); if (attach(context, drawPriv)) - return /*error */ 0; + return /*error*/ 0; gl_err = CGLSetCurrentContext(context->ctx); if (gl_err != 0) @@ -376,13 +387,13 @@ __glXAquaContextMakeCurrent(__GLXcontext * baseContext) } static int -__glXAquaContextCopy(__GLXcontext * baseDst, __GLXcontext * baseSrc, +__glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, unsigned long mask) { CGLError gl_err; - __GLXAquaContext *dst = (__GLXAquaContext *) baseDst; - __GLXAquaContext *src = (__GLXAquaContext *) baseSrc; + __GLXAquaContext *dst = (__GLXAquaContext *)baseDst; + __GLXAquaContext *src = (__GLXAquaContext *)baseSrc; GLAQUA_DEBUG_MSG("GLXAquaContextCopy\n"); @@ -395,7 +406,7 @@ __glXAquaContextCopy(__GLXcontext * baseDst, __GLXcontext * baseSrc, /* Drawing surface notification callbacks */ static GLboolean -__glXAquaDrawableSwapBuffers(ClientPtr client, __GLXdrawable * base) +__glXAquaDrawableSwapBuffers(ClientPtr client, __GLXdrawable *base) { CGLError err; __GLXAquaDrawable *drawable; @@ -407,11 +418,11 @@ __glXAquaDrawableSwapBuffers(ClientPtr client, __GLXdrawable * base) return GL_FALSE; } - drawable = (__GLXAquaDrawable *) base; + drawable = (__GLXAquaDrawable *)base; if (NULL == drawable->context) { ErrorF("%s called with a NULL->context for drawable %p!\n", - __func__, (void *) drawable); + __func__, (void *)drawable); return GL_FALSE; } @@ -427,7 +438,7 @@ __glXAquaDrawableSwapBuffers(ClientPtr client, __GLXdrawable * base) } static CGLPixelFormatObj -makeFormat(__GLXconfig * conf) +makeFormat(__GLXconfig *conf) { CGLPixelFormatAttribute attr[64]; CGLPixelFormatObj fobj; @@ -451,7 +462,7 @@ makeFormat(__GLXconfig * conf) attr[i++] = kCGLPFAAccumSize; attr[i++] = conf->accumRedBits + conf->accumGreenBits - + conf->accumBlueBits + conf->accumAlphaBits; + + conf->accumBlueBits + conf->accumAlphaBits; } attr[i++] = kCGLPFADepthSize; @@ -486,7 +497,7 @@ makeFormat(__GLXconfig * conf) } static void -__glXAquaScreenDestroy(__GLXscreen * screen) +__glXAquaScreenDestroy(__GLXscreen *screen) { GLAQUA_DEBUG_MSG("glXAquaScreenDestroy(%p)\n", screen); @@ -517,9 +528,8 @@ __glXAquaScreenProbe(ScreenPtr pScreen) screen->base.swapInterval = /*FIXME*/ NULL; screen->base.pScreen = pScreen; - screen->base.fbconfigs = - __glXAquaCreateVisualConfigs(&screen->base.numFBConfigs, - pScreen->myNum); + screen->base.fbconfigs = __glXAquaCreateVisualConfigs( + &screen->base.numFBConfigs, pScreen->myNum); __glXScreenInit(&screen->base, pScreen); @@ -536,24 +546,24 @@ __glXAquaScreenProbe(ScreenPtr pScreen) return &screen->base; } -#if 0 // unused +#if 0 // unused static void -__glXAquaDrawableCopySubBuffer(__GLXdrawable * drawable, +__glXAquaDrawableCopySubBuffer(__GLXdrawable *drawable, int x, int y, int w, int h) { - /*TODO finish me */ + /*TODO finish me*/ } #endif static void -__glXAquaDrawableDestroy(__GLXdrawable * base) +__glXAquaDrawableDestroy(__GLXdrawable *base) { - /* gstaplin: base is the head of the structure, so it's at the same + /* gstaplin: base is the head of the structure, so it's at the same * offset in memory. * Is this safe with strict aliasing? I noticed that the other dri code * does this too... */ - __GLXAquaDrawable *glxPriv = (__GLXAquaDrawable *) base; + __GLXAquaDrawable *glxPriv = (__GLXAquaDrawable *)base; GLAQUA_DEBUG_MSG("TRACE"); @@ -562,10 +572,10 @@ __glXAquaDrawableDestroy(__GLXdrawable * base) frees the surface itself. */ /*gstaplin: verify the statement above. The surface destroy - *messages weren't making it through, and may still not be. - *We need a good test case for surface creation and destruction. - *We also need a good way to enable introspection on the server - *to validate the test, beyond using gdb with print. + *messages weren't making it through, and may still not be. + *We need a good test case for surface creation and destruction. + *We also need a good way to enable introspection on the server + *to validate the test, beyond using gdb with print. */ free(glxPriv); @@ -573,10 +583,12 @@ __glXAquaDrawableDestroy(__GLXdrawable * base) static __GLXdrawable * __glXAquaScreenCreateDrawable(ClientPtr client, - __GLXscreen * screen, + __GLXscreen *screen, DrawablePtr pDraw, XID drawId, - int type, XID glxDrawId, __GLXconfig * conf) + int type, + XID glxDrawId, + __GLXconfig *conf) { __GLXAquaDrawable *glxPriv; @@ -587,8 +599,8 @@ __glXAquaScreenCreateDrawable(ClientPtr client, memset(glxPriv, 0, sizeof *glxPriv); - if (!__glXDrawableInit - (&glxPriv->base, screen, pDraw, type, glxDrawId, conf)) { + if (!__glXDrawableInit(&glxPriv->base, screen, pDraw, type, glxDrawId, + conf)) { free(glxPriv); return NULL; } @@ -619,7 +631,8 @@ __glFloorLog2(GLuint val) } #ifndef OPENGL_FRAMEWORK_PATH -#define OPENGL_FRAMEWORK_PATH "/System/Library/Frameworks/OpenGL.framework/OpenGL" +#define OPENGL_FRAMEWORK_PATH \ + "/System/Library/Frameworks/OpenGL.framework/OpenGL" #endif static void @@ -639,7 +652,7 @@ setup_dispatch_table(void) opengl_framework_path = OPENGL_FRAMEWORK_PATH; } - (void) dlerror(); /*drain dlerror */ + (void)dlerror(); /*drain dlerror */ handle = dlopen(opengl_framework_path, RTLD_LOCAL); if (!handle) { diff --git a/xorg-server/hw/xquartz/GL/visualConfigs.c b/xorg-server/hw/xquartz/GL/visualConfigs.c index c02427c99..e37eefbe4 100644 --- a/xorg-server/hw/xquartz/GL/visualConfigs.c +++ b/xorg-server/hw/xquartz/GL/visualConfigs.c @@ -73,7 +73,7 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) } /* - conf->stereo is 0 or 1, but we need at least 1 iteration of the loop, + conf->stereo is 0 or 1, but we need at least 1 iteration of the loop, so we treat a true conf->stereo as 2. The depth size is 0 or 24. Thus we do 2 iterations for that. @@ -86,9 +86,9 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) conf->total_color_buffers indicates the RGB/RGBA color depths. - conf->total_accum_buffers iterations for accum (with at least 1 if equal to 0) + conf->total_accum_buffers iterations for accum (with at least 1 if equal to 0) - conf->total_depth_buffer_depths + conf->total_depth_buffer_depths conf->multisample_buffers iterations (with at least 1 if equal to 0). We add 1 for the 0 multisampling config. @@ -104,14 +104,15 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) continue; numConfigs += (conf->stereo ? 2 : 1) - * (conf->aux_buffers ? 2 : 1) - * conf->buffers - * - ((conf->total_stencil_bit_depths > - 0) ? conf->total_stencil_bit_depths : 1) - * conf->total_color_buffers * - ((conf->total_accum_buffers > 0) ? conf->total_accum_buffers : 1) - * conf->total_depth_buffer_depths * (conf->multisample_buffers + 1); + * (conf->aux_buffers ? 2 : 1) + * conf->buffers + * ((conf->total_stencil_bit_depths > + 0) ? conf->total_stencil_bit_depths : 1) + * conf->total_color_buffers + * ((conf->total_accum_buffers > + 0) ? conf->total_accum_buffers : 1) + * conf->total_depth_buffer_depths + * (conf->multisample_buffers + 1); } if (numConfigsPtr) @@ -125,22 +126,22 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) return NULL; } - c = visualConfigs; /* current buffer */ + c = visualConfigs; /* current buffer */ for (conf = caps.configurations; conf; conf = conf->next) { for (stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) { for (aux = 0; aux < (conf->aux_buffers ? 2 : 1); ++aux) { for (buffers = 0; buffers < conf->buffers; ++buffers) { for (stencil = 0; - stencil < - ((conf->total_stencil_bit_depths > - 0) ? conf->total_stencil_bit_depths : 1); + stencil < ((conf->total_stencil_bit_depths > 0) ? + conf-> + total_stencil_bit_depths : 1); ++stencil) { for (color = 0; color < conf->total_color_buffers; ++color) { for (accum = 0; - accum < - ((conf->total_accum_buffers > - 0) ? conf->total_accum_buffers : 1); + accum < ((conf->total_accum_buffers > 0) ? + conf-> + total_accum_buffers : 1); ++accum) { for (depth = 0; depth < conf->total_depth_buffer_depths; @@ -159,7 +160,7 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) c->level = 0; c->indexBits = 0; - c->pixmapMode = 0; // TODO: What should this be? + c->pixmapMode = 0; // TODO: What should this be? if (conf->accelerated) { c->visualRating = GLX_NONE; @@ -178,7 +179,8 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) c->visualSelectGroup = 0; - c->swapMethod = GLX_SWAP_UNDEFINED_OML; + c->swapMethod = + GLX_SWAP_UNDEFINED_OML; // Stereo c->stereoMode = stereo ? TRUE : FALSE; @@ -192,10 +194,11 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) buffers ? TRUE : FALSE; // Stencil Buffer - if (conf->total_stencil_bit_depths > 0) { + if (conf->total_stencil_bit_depths > + 0) { c->stencilBits = - conf-> - stencil_bit_depths[stencil]; + conf->stencil_bit_depths[ + stencil]; } else { c->stencilBits = 0; @@ -217,22 +220,27 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) c->blueBits = conf->color_buffers[color].b; - c->rgbBits = - c->alphaBits + c->redBits + - c->greenBits + c->blueBits; + c->rgbBits = c->alphaBits + + c->redBits + + c->greenBits + + c->blueBits; c->alphaMask = AM_ARGB(c->alphaBits, c->redBits, - c->greenBits, c->blueBits); + c->greenBits, + c->blueBits); c->redMask = RM_ARGB(c->alphaBits, c->redBits, - c->greenBits, c->blueBits); + c->greenBits, + c->blueBits); c->greenMask = GM_ARGB(c->alphaBits, c->redBits, - c->greenBits, c->blueBits); + c->greenBits, + c->blueBits); c->blueMask = BM_ARGB(c->alphaBits, c->redBits, - c->greenBits, c->blueBits); + c->greenBits, + c->blueBits); // Accumulation Buffers if (conf->total_accum_buffers > 0) { @@ -242,12 +250,14 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) conf->accum_buffers[accum].g; c->accumBlueBits = conf->accum_buffers[accum].b; - if (GLCAPS_COLOR_BUF_INVALID_VALUE + if ( + GLCAPS_COLOR_BUF_INVALID_VALUE != - conf->accum_buffers[accum].a) { + conf->accum_buffers[accum].a) + { c->accumAlphaBits = - conf->accum_buffers[accum]. - a; + conf->accum_buffers[accum + ].a; } else { c->accumAlphaBits = 0; @@ -276,33 +286,33 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) c->sampleBuffers = 0; } - /* - * The Apple libGL supports GLXPixmaps and + /* + * The Apple libGL supports GLXPixmaps and * GLXPbuffers in direct mode. */ /* SGIX_fbconfig / GLX 1.3 */ - c->drawableType = - GLX_WINDOW_BIT | GLX_PIXMAP_BIT | - GLX_PBUFFER_BIT; + c->drawableType = GLX_WINDOW_BIT | + GLX_PIXMAP_BIT | + GLX_PBUFFER_BIT; c->renderType = GLX_RGBA_BIT; c->xRenderable = GL_TRUE; c->fbconfigID = -1; /* SGIX_pbuffer / GLX 1.3 */ - /* + /* * The CGL layer provides a way of retrieving * the maximum pbuffer width/height, but only * if we create a context and call glGetIntegerv. - * + * * The following values are from a test program * that does so. */ c->maxPbufferWidth = 8192; c->maxPbufferHeight = 8192; c->maxPbufferPixels = - /*Do we need this? */ 0; - /* + /*Do we need this?*/ 0; + /* * There is no introspection for this sort of thing * with CGL. What should we do realistically? */ @@ -330,9 +340,9 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) (c - 1)->next = NULL; if (c - visualConfigs != numConfigs) { - FatalError - ("numConfigs calculation error in setVisualConfigs! numConfigs is %d i is %d\n", - numConfigs, (int) (c - visualConfigs)); + FatalError( + "numConfigs calculation error in setVisualConfigs! numConfigs is %d i is %d\n", + numConfigs, (int)(c - visualConfigs)); } freeGlCapabilities(&caps); diff --git a/xorg-server/hw/xquartz/GL/visualConfigs.h b/xorg-server/hw/xquartz/GL/visualConfigs.h index 2e1a1b3fd..889cdb904 100644 --- a/xorg-server/hw/xquartz/GL/visualConfigs.h +++ b/xorg-server/hw/xquartz/GL/visualConfigs.h @@ -23,6 +23,7 @@ #ifndef VISUAL_CONFIGS_H #define VISUAL_CONFIGS_H -__GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber); +__GLXconfig * +__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber); #endif |