From 6ddf66e9230ee862ac341c4767cf6b3b2dd2552b Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 28 Jul 2010 10:07:52 -0400 Subject: glx: Rename __GLcontextModes to struct glx_config With this rename, we use 'config' consitently to refer to GLX configurations instead of the modes/configs/visual mess before. --- src/glx/dri_common.c | 50 ++++++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 26 deletions(-) (limited to 'src/glx/dri_common.c') diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index 9b7da3e7df..7866521e42 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -176,7 +176,7 @@ _X_HIDDEN const __DRIsystemTimeExtension systemTimeExtension = { }; #define __ATTRIB(attrib, field) \ - { attrib, offsetof(__GLcontextModes, field) } + { attrib, offsetof(struct glx_config, field) } static const struct { @@ -225,10 +225,8 @@ __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb), bindToMipmapTexture), __ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),}; -#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) - static int -scalarEqual(__GLcontextModes * mode, unsigned int attrib, unsigned int value) +scalarEqual(struct glx_config *mode, unsigned int attrib, unsigned int value) { unsigned int glxValue; int i; @@ -243,8 +241,8 @@ scalarEqual(__GLcontextModes * mode, unsigned int attrib, unsigned int value) } static int -driConfigEqual(const __DRIcoreExtension * core, - __GLcontextModes * modes, const __DRIconfig * driConfig) +driConfigEqual(const __DRIcoreExtension *core, + struct glx_config *config, const __DRIconfig *driConfig) { unsigned int attrib, value, glxValue; int i; @@ -260,7 +258,7 @@ driConfigEqual(const __DRIcoreExtension * core, else if (value & __DRI_ATTRIB_COLOR_INDEX_BIT) { glxValue |= GLX_COLOR_INDEX_BIT; } - if (glxValue != modes->renderType) + if (glxValue != config->renderType) return GL_FALSE; break; @@ -271,7 +269,7 @@ driConfigEqual(const __DRIcoreExtension * core, glxValue = GLX_SLOW_CONFIG; else glxValue = GLX_NONE; - if (glxValue != modes->visualRating) + if (glxValue != config->visualRating) return GL_FALSE; break; @@ -283,13 +281,13 @@ driConfigEqual(const __DRIcoreExtension * core, glxValue |= GLX_TEXTURE_2D_BIT_EXT; if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT) glxValue |= GLX_TEXTURE_RECTANGLE_BIT_EXT; - if (modes->bindToTextureTargets != GLX_DONT_CARE && - glxValue != modes->bindToTextureTargets) + if (config->bindToTextureTargets != GLX_DONT_CARE && + glxValue != config->bindToTextureTargets) return GL_FALSE; break; default: - if (!scalarEqual(modes, attrib, value)) + if (!scalarEqual(config, attrib, value)) return GL_FALSE; } } @@ -297,41 +295,41 @@ driConfigEqual(const __DRIcoreExtension * core, return GL_TRUE; } -static __GLcontextModes * +static struct glx_config * createDriMode(const __DRIcoreExtension * core, - __GLcontextModes * modes, const __DRIconfig ** driConfigs) + struct glx_config *config, const __DRIconfig **driConfigs) { - __GLXDRIconfigPrivate *config; + __GLXDRIconfigPrivate *driConfig; int i; for (i = 0; driConfigs[i]; i++) { - if (driConfigEqual(core, modes, driConfigs[i])) + if (driConfigEqual(core, config, driConfigs[i])) break; } if (driConfigs[i] == NULL) return NULL; - config = Xmalloc(sizeof *config); - if (config == NULL) + driConfig = Xmalloc(sizeof *driConfig); + if (driConfig == NULL) return NULL; - config->modes = *modes; - config->driConfig = driConfigs[i]; + driConfig->base = *config; + driConfig->driConfig = driConfigs[i]; - return &config->modes; + return &driConfig->base; } -_X_HIDDEN __GLcontextModes * +_X_HIDDEN struct glx_config * driConvertConfigs(const __DRIcoreExtension * core, - __GLcontextModes * modes, const __DRIconfig ** configs) + struct glx_config *configs, const __DRIconfig **driConfigs) { - __GLcontextModes head, *tail, *m; + struct glx_config head, *tail, *m; tail = &head; head.next = NULL; - for (m = modes; m; m = m->next) { - tail->next = createDriMode(core, m, configs); + for (m = configs; m; m = m->next) { + tail->next = createDriMode(core, m, driConfigs); if (tail->next == NULL) { /* no matching dri config for m */ continue; @@ -341,7 +339,7 @@ driConvertConfigs(const __DRIcoreExtension * core, tail = tail->next; } - _gl_context_modes_destroy(modes); + glx_config_destroy_list(configs); return head.next; } -- cgit v1.2.3 From 65d98e25770487456eb3d7eb8ec3ec8272f170b1 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 28 Jul 2010 10:13:44 -0400 Subject: glx: Rename glcontextmodes.[ch] to glxconfig.[ch] --- src/glx/Makefile | 2 +- src/glx/dri_common.c | 1 - src/glx/glcontextmodes.c | 304 ----------------------------------------------- src/glx/glcontextmodes.h | 133 --------------------- src/glx/glxclient.h | 2 +- src/glx/glxcmds.c | 1 - src/glx/glxconfig.c | 304 +++++++++++++++++++++++++++++++++++++++++++++++ src/glx/glxconfig.h | 133 +++++++++++++++++++++ src/glx/glxext.c | 1 - 9 files changed, 439 insertions(+), 442 deletions(-) delete mode 100644 src/glx/glcontextmodes.c delete mode 100644 src/glx/glcontextmodes.h create mode 100644 src/glx/glxconfig.c create mode 100644 src/glx/glxconfig.h (limited to 'src/glx/dri_common.c') diff --git a/src/glx/Makefile b/src/glx/Makefile index 48d901fb89..70def7a2fb 100644 --- a/src/glx/Makefile +++ b/src/glx/Makefile @@ -5,10 +5,10 @@ EXTRA_DEFINES = -DXF86VIDMODE -D_REENTRANT \ -DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" SOURCES = \ - glcontextmodes.c \ clientattrib.c \ compsize.c \ eval.c \ + glxconfig.c \ glxcmds.c \ glxcurrent.c \ glxext.c \ diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index 7866521e42..812fb2eb08 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -39,7 +39,6 @@ #include #include #include "glxclient.h" -#include "glcontextmodes.h" #include "dri_common.h" #ifndef RTLD_NOW diff --git a/src/glx/glcontextmodes.c b/src/glx/glcontextmodes.c deleted file mode 100644 index 186de485ff..0000000000 --- a/src/glx/glcontextmodes.c +++ /dev/null @@ -1,304 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2003 - * 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 - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, 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 and this permission notice (including the next - * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS 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. - */ - -/** - * \file glcontextmodes.c - * Utility routines for working with \c struct glx_config structures. At - * some point most or all of these functions will be moved to the Mesa - * code base. - * - * \author Ian Romanick - */ - -#include -#include "GL/glxint.h" -#include -#include - -#include "glcontextmodes.h" - -#define NUM_VISUAL_TYPES 6 - -/** - * Get data from a GLX config - * - * \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. - * \return If \c attribute is a valid attribute of \c mode, zero is - * returned. Otherwise \c GLX_BAD_ATTRIBUTE is returned. - */ -_X_HIDDEN int -glx_config_get(struct glx_config * 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; -#ifndef GLX_USE_APPLEGL /* This isn't supported by CGL. */ - case GLX_TRANSPARENT_TYPE_EXT: - *value_return = mode->transparentPixel; - return 0; -#endif - 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; -#ifndef GLX_USE_APPLEGL /* These aren't supported by CGL. */ - 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; -#endif - 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; - 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. - */ - case GLX_VISUAL_SELECT_GROUP_SGIX: - default: - return GLX_BAD_ATTRIBUTE; - } -} - - -/** - * Allocate a linked list of \c struct glx_config structures. The fields of - * each structure will be initialized to "reasonable" default values. In - * most cases this is the default value defined by table 3.4 of the GLX - * 1.3 specification. This means that most values are either initialized to - * 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 - * \c struct glx_config stucture used in libGL and in a - * 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. - */ -_X_HIDDEN struct glx_config * -glx_config_create_list(unsigned count) -{ - const size_t size = sizeof(struct glx_config); - struct glx_config *base = NULL; - struct glx_config **next; - unsigned i; - - next = &base; - for (i = 0; i < count; i++) { - *next = (struct glx_config *) malloc(size); - if (*next == NULL) { - glx_config_destroy_list(base); - base = NULL; - break; - } - - (void) memset(*next, 0, size); - (*next)->visualID = GLX_DONT_CARE; - (*next)->visualType = GLX_DONT_CARE; - (*next)->visualRating = GLX_NONE; - (*next)->transparentPixel = GLX_NONE; - (*next)->transparentRed = GLX_DONT_CARE; - (*next)->transparentGreen = GLX_DONT_CARE; - (*next)->transparentBlue = GLX_DONT_CARE; - (*next)->transparentAlpha = GLX_DONT_CARE; - (*next)->transparentIndex = GLX_DONT_CARE; - (*next)->xRenderable = GLX_DONT_CARE; - (*next)->fbconfigID = GLX_DONT_CARE; - (*next)->swapMethod = GLX_SWAP_UNDEFINED_OML; - (*next)->bindToTextureRgb = GLX_DONT_CARE; - (*next)->bindToTextureRgba = GLX_DONT_CARE; - (*next)->bindToMipmapTexture = GLX_DONT_CARE; - (*next)->bindToTextureTargets = GLX_DONT_CARE; - (*next)->yInverted = GLX_DONT_CARE; - - next = &((*next)->next); - } - - return base; -} - -_X_HIDDEN void -glx_config_destroy_list(struct glx_config *configs) -{ - while (configs != NULL) { - struct glx_config *const next = configs->next; - - free(configs); - configs = next; - } -} - - -/** - * Find a context mode matching a Visual ID. - * - * \param modes List list of context-mode structures to be searched. - * \param vid Visual ID to be found. - * \returns A pointer to a context-mode in \c modes if \c vid was found in - * the list, or \c NULL if it was not. - */ - -_X_HIDDEN struct glx_config * -glx_config_find_visual(struct glx_config *configs, int vid) -{ - struct glx_config *c; - - for (c = configs; c != NULL; c = c->next) - if (c->visualID == vid) - return c; - - return NULL; -} - -_X_HIDDEN struct glx_config * -glx_config_find_fbconfig(struct glx_config *configs, int fbid) -{ - struct glx_config *c; - - for (c = configs; c != NULL; c = c->next) - if (c->fbconfigID == fbid) - return c; - - return NULL; -} diff --git a/src/glx/glcontextmodes.h b/src/glx/glcontextmodes.h deleted file mode 100644 index f7ee958e4b..0000000000 --- a/src/glx/glcontextmodes.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2003 - * 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 - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, 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 and this permission notice (including the next - * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS 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. - */ - -/** - * \file glcontextmodes.h - * \author Ian Romanick - */ - -#ifndef GLCONTEXTMODES_H -#define GLCONTEXTMODES_H - -struct glx_config { - struct glx_config * next; - - GLboolean rgbMode; - GLboolean floatMode; - GLboolean colorIndexMode; - GLuint doubleBufferMode; - GLuint stereoMode; - - GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */ - GLuint redMask, greenMask, blueMask, alphaMask; - GLint rgbBits; /* total bits for rgb */ - GLint indexBits; /* total bits for colorindex */ - - GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits; - GLint depthBits; - GLint stencilBits; - - GLint numAuxBuffers; - - GLint level; - - GLint pixmapMode; - - /* GLX */ - GLint visualID; - GLint visualType; /**< One of the GLX X visual types. (i.e., - * \c GLX_TRUE_COLOR, etc.) - */ - - /* EXT_visual_rating / GLX 1.2 */ - GLint visualRating; - - /* EXT_visual_info / GLX 1.2 */ - GLint transparentPixel; - /* colors are floats scaled to ints */ - GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha; - GLint transparentIndex; - - /* ARB_multisample / SGIS_multisample */ - GLint sampleBuffers; - GLint samples; - - /* SGIX_fbconfig / GLX 1.3 */ - GLint drawableType; - GLint renderType; - GLint xRenderable; - GLint fbconfigID; - - /* SGIX_pbuffer / GLX 1.3 */ - GLint maxPbufferWidth; - GLint maxPbufferHeight; - GLint maxPbufferPixels; - GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */ - GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */ - - /* SGIX_visual_select_group */ - GLint visualSelectGroup; - - /* OML_swap_method */ - GLint swapMethod; - - GLint screen; - - /* EXT_texture_from_pixmap */ - GLint bindToTextureRgb; - GLint bindToTextureRgba; - GLint bindToMipmapTexture; - GLint bindToTextureTargets; - GLint yInverted; -}; - -#define __GLX_MIN_CONFIG_PROPS 18 -#define __GLX_MAX_CONFIG_PROPS 500 -#define __GLX_EXT_CONFIG_PROPS 10 - -/* -** Since we send all non-core visual properties as token, value pairs, -** we require 2 words across the wire. In order to maintain backwards -** compatibility, we need to send the total number of words that the -** VisualConfigs are sent back in so old libraries can simply "ignore" -** the new properties. -*/ -#define __GLX_TOTAL_CONFIG \ - (__GLX_MIN_CONFIG_PROPS + 2 * __GLX_EXT_CONFIG_PROPS) - -extern GLint _gl_convert_from_x_visual_type(int visualType); - -extern int -glx_config_get(struct glx_config * mode, int attribute, int *value_return); -extern struct glx_config * -glx_config_create_list(unsigned count); -extern void -glx_config_destroy_list(struct glx_config *configs); -extern struct glx_config * -glx_config_find_visual(struct glx_config *configs, int vid); -extern struct glx_config * -glx_config_find_fbconfig(struct glx_config *configs, int fbid); - -#endif /* GLCONTEXTMODES_H */ - diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index 3a8d294dab..f8691433a6 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -51,7 +51,7 @@ #endif #include "GL/glxproto.h" #include "glapi/glapitable.h" -#include "glcontextmodes.h" +#include "glxconfig.h" #include "glxhash.h" #if defined( PTHREADS ) # include diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index 85bfa657e0..55a736ce47 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -36,7 +36,6 @@ #include "glxclient.h" #include "glapi.h" #include "glxextensions.h" -#include "glcontextmodes.h" #ifdef GLX_DIRECT_RENDERING #ifdef GLX_USE_APPLEGL diff --git a/src/glx/glxconfig.c b/src/glx/glxconfig.c new file mode 100644 index 0000000000..1d9678f48c --- /dev/null +++ b/src/glx/glxconfig.c @@ -0,0 +1,304 @@ +/* + * (C) Copyright IBM Corporation 2003 + * 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 + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, 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 and this permission notice (including the next + * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS 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. + */ + +/** + * \file glxconfig.c + * Utility routines for working with \c struct glx_config structures. At + * some point most or all of these functions will be moved to the Mesa + * code base. + * + * \author Ian Romanick + */ + +#include +#include "GL/glxint.h" +#include +#include + +#include "glxconfig.h" + +#define NUM_VISUAL_TYPES 6 + +/** + * Get data from a GLX config + * + * \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. + * \return If \c attribute is a valid attribute of \c mode, zero is + * returned. Otherwise \c GLX_BAD_ATTRIBUTE is returned. + */ +_X_HIDDEN int +glx_config_get(struct glx_config * 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; +#ifndef GLX_USE_APPLEGL /* This isn't supported by CGL. */ + case GLX_TRANSPARENT_TYPE_EXT: + *value_return = mode->transparentPixel; + return 0; +#endif + 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; +#ifndef GLX_USE_APPLEGL /* These aren't supported by CGL. */ + 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; +#endif + 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; + 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. + */ + case GLX_VISUAL_SELECT_GROUP_SGIX: + default: + return GLX_BAD_ATTRIBUTE; + } +} + + +/** + * Allocate a linked list of \c struct glx_config structures. The fields of + * each structure will be initialized to "reasonable" default values. In + * most cases this is the default value defined by table 3.4 of the GLX + * 1.3 specification. This means that most values are either initialized to + * 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 + * \c struct glx_config stucture used in libGL and in a + * 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. + */ +_X_HIDDEN struct glx_config * +glx_config_create_list(unsigned count) +{ + const size_t size = sizeof(struct glx_config); + struct glx_config *base = NULL; + struct glx_config **next; + unsigned i; + + next = &base; + for (i = 0; i < count; i++) { + *next = (struct glx_config *) malloc(size); + if (*next == NULL) { + glx_config_destroy_list(base); + base = NULL; + break; + } + + (void) memset(*next, 0, size); + (*next)->visualID = GLX_DONT_CARE; + (*next)->visualType = GLX_DONT_CARE; + (*next)->visualRating = GLX_NONE; + (*next)->transparentPixel = GLX_NONE; + (*next)->transparentRed = GLX_DONT_CARE; + (*next)->transparentGreen = GLX_DONT_CARE; + (*next)->transparentBlue = GLX_DONT_CARE; + (*next)->transparentAlpha = GLX_DONT_CARE; + (*next)->transparentIndex = GLX_DONT_CARE; + (*next)->xRenderable = GLX_DONT_CARE; + (*next)->fbconfigID = GLX_DONT_CARE; + (*next)->swapMethod = GLX_SWAP_UNDEFINED_OML; + (*next)->bindToTextureRgb = GLX_DONT_CARE; + (*next)->bindToTextureRgba = GLX_DONT_CARE; + (*next)->bindToMipmapTexture = GLX_DONT_CARE; + (*next)->bindToTextureTargets = GLX_DONT_CARE; + (*next)->yInverted = GLX_DONT_CARE; + + next = &((*next)->next); + } + + return base; +} + +_X_HIDDEN void +glx_config_destroy_list(struct glx_config *configs) +{ + while (configs != NULL) { + struct glx_config *const next = configs->next; + + free(configs); + configs = next; + } +} + + +/** + * Find a context mode matching a Visual ID. + * + * \param modes List list of context-mode structures to be searched. + * \param vid Visual ID to be found. + * \returns A pointer to a context-mode in \c modes if \c vid was found in + * the list, or \c NULL if it was not. + */ + +_X_HIDDEN struct glx_config * +glx_config_find_visual(struct glx_config *configs, int vid) +{ + struct glx_config *c; + + for (c = configs; c != NULL; c = c->next) + if (c->visualID == vid) + return c; + + return NULL; +} + +_X_HIDDEN struct glx_config * +glx_config_find_fbconfig(struct glx_config *configs, int fbid) +{ + struct glx_config *c; + + for (c = configs; c != NULL; c = c->next) + if (c->fbconfigID == fbid) + return c; + + return NULL; +} diff --git a/src/glx/glxconfig.h b/src/glx/glxconfig.h new file mode 100644 index 0000000000..f7ee958e4b --- /dev/null +++ b/src/glx/glxconfig.h @@ -0,0 +1,133 @@ +/* + * (C) Copyright IBM Corporation 2003 + * 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 + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, 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 and this permission notice (including the next + * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS 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. + */ + +/** + * \file glcontextmodes.h + * \author Ian Romanick + */ + +#ifndef GLCONTEXTMODES_H +#define GLCONTEXTMODES_H + +struct glx_config { + struct glx_config * next; + + GLboolean rgbMode; + GLboolean floatMode; + GLboolean colorIndexMode; + GLuint doubleBufferMode; + GLuint stereoMode; + + GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */ + GLuint redMask, greenMask, blueMask, alphaMask; + GLint rgbBits; /* total bits for rgb */ + GLint indexBits; /* total bits for colorindex */ + + GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits; + GLint depthBits; + GLint stencilBits; + + GLint numAuxBuffers; + + GLint level; + + GLint pixmapMode; + + /* GLX */ + GLint visualID; + GLint visualType; /**< One of the GLX X visual types. (i.e., + * \c GLX_TRUE_COLOR, etc.) + */ + + /* EXT_visual_rating / GLX 1.2 */ + GLint visualRating; + + /* EXT_visual_info / GLX 1.2 */ + GLint transparentPixel; + /* colors are floats scaled to ints */ + GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha; + GLint transparentIndex; + + /* ARB_multisample / SGIS_multisample */ + GLint sampleBuffers; + GLint samples; + + /* SGIX_fbconfig / GLX 1.3 */ + GLint drawableType; + GLint renderType; + GLint xRenderable; + GLint fbconfigID; + + /* SGIX_pbuffer / GLX 1.3 */ + GLint maxPbufferWidth; + GLint maxPbufferHeight; + GLint maxPbufferPixels; + GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */ + GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */ + + /* SGIX_visual_select_group */ + GLint visualSelectGroup; + + /* OML_swap_method */ + GLint swapMethod; + + GLint screen; + + /* EXT_texture_from_pixmap */ + GLint bindToTextureRgb; + GLint bindToTextureRgba; + GLint bindToMipmapTexture; + GLint bindToTextureTargets; + GLint yInverted; +}; + +#define __GLX_MIN_CONFIG_PROPS 18 +#define __GLX_MAX_CONFIG_PROPS 500 +#define __GLX_EXT_CONFIG_PROPS 10 + +/* +** Since we send all non-core visual properties as token, value pairs, +** we require 2 words across the wire. In order to maintain backwards +** compatibility, we need to send the total number of words that the +** VisualConfigs are sent back in so old libraries can simply "ignore" +** the new properties. +*/ +#define __GLX_TOTAL_CONFIG \ + (__GLX_MIN_CONFIG_PROPS + 2 * __GLX_EXT_CONFIG_PROPS) + +extern GLint _gl_convert_from_x_visual_type(int visualType); + +extern int +glx_config_get(struct glx_config * mode, int attribute, int *value_return); +extern struct glx_config * +glx_config_create_list(unsigned count); +extern void +glx_config_destroy_list(struct glx_config *configs); +extern struct glx_config * +glx_config_find_visual(struct glx_config *configs, int vid); +extern struct glx_config * +glx_config_find_fbconfig(struct glx_config *configs, int fbid); + +#endif /* GLCONTEXTMODES_H */ + diff --git a/src/glx/glxext.c b/src/glx/glxext.c index 8e8b362d10..b02755a6c2 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -47,7 +47,6 @@ #include "apple_visual.h" #endif #include "glxextensions.h" -#include "glcontextmodes.h" #ifdef USE_XCB #include -- cgit v1.2.3 From c491e585e43d48a2aeec96ccc4008da6c443fb42 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 28 Jul 2010 15:33:09 -0400 Subject: glx: Move bind and unbind to context vtable --- src/glx/dri2_glx.c | 28 ++-- src/glx/dri_common.c | 27 ++++ src/glx/dri_common.h | 3 + src/glx/dri_glx.c | 57 ++++---- src/glx/drisw_glx.c | 32 +++-- src/glx/glxclient.h | 25 ++-- src/glx/glxcmds.c | 28 ++-- src/glx/glxcurrent.c | 246 +++++++++++------------------------ src/glx/glxext.c | 2 +- src/glx/indirect.c | 30 ++--- src/glx/singlepix.c | 2 +- src/mapi/glapi/gen/glX_proto_send.py | 2 +- 12 files changed, 206 insertions(+), 276 deletions(-) (limited to 'src/glx/dri_common.c') diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 8ad0e339ed..e57d10f091 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -95,7 +95,6 @@ struct dri2_screen { struct dri2_context { struct glx_context base; - __GLXDRIcontext dri_vtable; __DRIcontext *driContext; }; @@ -133,20 +132,28 @@ dri2_destroy_context(struct glx_context *context) } static Bool -dri2BindContext(struct glx_context *context, - __GLXDRIdrawable *draw, __GLXDRIdrawable *read) +dri2_bind_context(struct glx_context *context, struct glx_context *old, + GLXDrawable draw, GLXDrawable read) { struct dri2_context *pcp = (struct dri2_context *) context; struct dri2_screen *psc = (struct dri2_screen *) pcp->base.psc; - struct dri2_drawable *pdr = (struct dri2_drawable *) draw; - struct dri2_drawable *prd = (struct dri2_drawable *) read; + struct dri2_drawable *pdraw, *pread; - return (*psc->core->bindContext) (pcp->driContext, - pdr->driDrawable, prd->driDrawable); + pdraw = (struct dri2_drawable *) driFetchDrawable(context, draw); + pread = (struct dri2_drawable *) driFetchDrawable(context, read); + + if (pdraw == NULL || pread == NULL) + return GLXBadDrawable; + + if ((*psc->core->bindContext) (pcp->driContext, + pdraw->driDrawable, pread->driDrawable)) + return Success; + + return GLXBadContext; } static void -dri2UnbindContext(struct glx_context *context) +dri2_unbind_context(struct glx_context *context, struct glx_context *new) { struct dri2_context *pcp = (struct dri2_context *) context; struct dri2_screen *psc = (struct dri2_screen *) pcp->base.psc; @@ -189,9 +196,6 @@ dri2_create_context(struct glx_screen *base, } pcp->base.vtable = &dri2_context_vtable; - pcp->base.driContext = &pcp->dri_vtable; - pcp->dri_vtable.bindContext = dri2BindContext; - pcp->dri_vtable.unbindContext = dri2UnbindContext; return &pcp->base; } @@ -684,6 +688,8 @@ dri2_release_tex_image(Display * dpy, GLXDrawable drawable, int buffer) static const struct glx_context_vtable dri2_context_vtable = { dri2_destroy_context, + dri2_bind_context, + dri2_unbind_context, dri2_wait_gl, dri2_wait_x, DRI_glXUseXFont, diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index 812fb2eb08..a7fb4c6424 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -353,4 +353,31 @@ driDestroyConfigs(const __DRIconfig **configs) free(configs); } +_X_HIDDEN __GLXDRIdrawable * +driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable) +{ + struct glx_display *const priv = __glXInitialize(gc->psc->dpy); + __GLXDRIdrawable *pdraw; + struct glx_screen *psc; + + if (priv == NULL) + return NULL; + + psc = priv->screens[gc->screen]; + if (priv->drawHash == NULL) + return NULL; + + if (__glxHashLookup(priv->drawHash, glxDrawable, (void *) &pdraw) == 0) + return pdraw; + + pdraw = psc->driScreen->createDrawable(psc, glxDrawable, + glxDrawable, gc->config); + if (__glxHashInsert(priv->drawHash, glxDrawable, pdraw)) { + (*pdraw->destroyDrawable) (pdraw); + return NULL; + } + + return pdraw; +} + #endif /* GLX_DIRECT_RENDERING */ diff --git a/src/glx/dri_common.h b/src/glx/dri_common.h index 32d98ed3c1..846a905a88 100644 --- a/src/glx/dri_common.h +++ b/src/glx/dri_common.h @@ -52,6 +52,9 @@ extern struct glx_config *driConvertConfigs(const __DRIcoreExtension * core, extern void driDestroyConfigs(const __DRIconfig **configs); +extern __GLXDRIdrawable * +driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable); + extern const __DRIsystemTimeExtension systemTimeExtension; extern void InfoMessageF(const char *f, ...); diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c index 70281f663e..43a2aa495a 100644 --- a/src/glx/dri_glx.c +++ b/src/glx/dri_glx.c @@ -79,7 +79,6 @@ struct dri_screen struct dri_context { struct glx_context base; - __GLXDRIcontext dri_vtable; __DRIcontext *driContext; XID hwContextID; }; @@ -518,21 +517,29 @@ dri_destroy_context(struct glx_context * context) Xfree(pcp); } -static Bool -driBindContext(struct glx_context *context, - __GLXDRIdrawable *draw, __GLXDRIdrawable *read) +static int +dri_bind_context(struct glx_context *context, struct glx_context *old, + GLXDrawable draw, GLXDrawable read) { struct dri_context *pcp = (struct dri_context *) context; struct dri_screen *psc = (struct dri_screen *) pcp->base.psc; - struct dri_drawable *pdr = (struct dri_drawable *) draw; - struct dri_drawable *prd = (struct dri_drawable *) read; + struct dri_drawable *pdraw, *pread; + + pdraw = (struct dri_drawable *) driFetchDrawable(context, draw); + pread = (struct dri_drawable *) driFetchDrawable(context, read); + + if (pdraw == NULL || pread == NULL) + return GLXBadDrawable; - return (*psc->core->bindContext) (pcp->driContext, - pdr->driDrawable, prd->driDrawable); + if ((*psc->core->bindContext) (pcp->driContext, + pdraw->driDrawable, pread->driDrawable)) + return Success; + + return GLXBadContext; } static void -driUnbindContext(struct glx_context * context) +dri_unbind_context(struct glx_context *context, struct glx_context *new) { struct dri_context *pcp = (struct dri_context *) context; struct dri_screen *psc = (struct dri_screen *) pcp->base.psc; @@ -542,6 +549,8 @@ driUnbindContext(struct glx_context * context) static const struct glx_context_vtable dri_context_vtable = { dri_destroy_context, + dri_bind_context, + dri_unbind_context, NULL, NULL, DRI_glXUseXFont, @@ -564,7 +573,7 @@ dri_create_context(struct glx_screen *base, return NULL; if (shareList) { - pcp_shared = (struct dri_context *) shareList->driContext; + pcp_shared = (struct dri_context *) shareList; shared = pcp_shared->driContext; } @@ -596,9 +605,6 @@ dri_create_context(struct glx_screen *base, } pcp->base.vtable = &dri_context_vtable; - pcp->base.driContext = &pcp->dri_vtable; - pcp->dri_vtable.bindContext = driBindContext; - pcp->dri_vtable.unbindContext = driUnbindContext; return &pcp->base; } @@ -756,17 +762,12 @@ driWaitForSBC(__GLXDRIdrawable *pdraw, int64_t target_sbc, int64_t *ust, static int driSetSwapInterval(__GLXDRIdrawable *pdraw, int interval) { - struct glx_context *gc = __glXGetCurrentContext(); struct dri_drawable *pdp = (struct dri_drawable *) pdraw; - struct dri_screen *psc; - - if (gc->driContext) { - psc = (struct dri_screen *) pdraw->psc; + struct dri_screen *psc = (struct dri_screen *) pdraw->psc; - if (psc->swapControl != NULL && pdraw != NULL) { - psc->swapControl->setSwapInterval(pdp->driDrawable, interval); - return 0; - } + if (psc->swapControl != NULL && pdraw != NULL) { + psc->swapControl->setSwapInterval(pdp->driDrawable, interval); + return 0; } return GLX_BAD_CONTEXT; @@ -775,17 +776,11 @@ driSetSwapInterval(__GLXDRIdrawable *pdraw, int interval) static int driGetSwapInterval(__GLXDRIdrawable *pdraw) { - struct glx_context *gc = __glXGetCurrentContext(); struct dri_drawable *pdp = (struct dri_drawable *) pdraw; - struct dri_screen *psc; - - if (gc != NULL && gc->driContext) { - psc = (struct dri_screen *) pdraw->psc; + struct dri_screen *psc = (struct dri_screen *) pdraw->psc; - if (psc->swapControl != NULL && pdraw != NULL) { - return psc->swapControl->getSwapInterval(pdp->driDrawable); - } - } + if (psc->swapControl != NULL && pdraw != NULL) + return psc->swapControl->getSwapInterval(pdp->driDrawable); return 0; } diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index 070c9d612b..46c56066e6 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -36,7 +36,6 @@ struct drisw_display struct drisw_context { struct glx_context base; - __GLXDRIcontext dri_vtable; __DRIcontext *driContext; }; @@ -258,21 +257,29 @@ drisw_destroy_context(struct glx_context *context) Xfree(pcp); } -static Bool -driBindContext(struct glx_context * context, - __GLXDRIdrawable * draw, __GLXDRIdrawable * read) +static int +drisw_bind_context(struct glx_context *context, struct glx_context *old, + GLXDrawable draw, GLXDrawable read) { struct drisw_context *pcp = (struct drisw_context *) context; struct drisw_screen *psc = (struct drisw_screen *) pcp->base.psc; - struct drisw_drawable *pdr = (struct drisw_drawable *) draw; - struct drisw_drawable *prd = (struct drisw_drawable *) read; + struct drisw_drawable *pdraw, *pread; + + pdraw = (struct drisw_drawable *) driFetchDrawable(context, draw); + pread = (struct drisw_drawable *) driFetchDrawable(context, read); + + if (pdraw == NULL || pread == NULL) + return GLXBadDrawable; + + if ((*psc->core->bindContext) (pcp->driContext, + pdraw->driDrawable, pread->driDrawable)) + return Success; - return (*psc->core->bindContext) (pcp->driContext, - pdr->driDrawable, prd->driDrawable); + return GLXBadContext; } static void -driUnbindContext(struct glx_context * context) +drisw_unbind_context(struct glx_context *context, struct glx_context *new) { struct drisw_context *pcp = (struct drisw_context *) context; struct drisw_screen *psc = (struct drisw_screen *) pcp->base.psc; @@ -282,6 +289,8 @@ driUnbindContext(struct glx_context * context) static const struct glx_context_vtable drisw_context_vtable = { drisw_destroy_context, + drisw_bind_context, + drisw_unbind_context, NULL, NULL, DRI_glXUseXFont, @@ -303,7 +312,7 @@ drisw_create_context(struct glx_screen *base, return NULL; if (shareList) { - pcp_shared = (struct drisw_context *) shareList->driContext; + pcp_shared = (struct drisw_context *) shareList; shared = pcp_shared->driContext; } @@ -326,9 +335,6 @@ drisw_create_context(struct glx_screen *base, } pcp->base.vtable = &drisw_context_vtable; - pcp->base.driContext = &pcp->dri_vtable; - pcp->dri_vtable.bindContext = driBindContext; - pcp->dri_vtable.unbindContext = driUnbindContext; return &pcp->base; } diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index 4f5c02fc34..b13cc81b57 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -88,7 +88,6 @@ extern void DRI_glXUseXFont(struct glx_context *ctx, typedef struct __GLXDRIdisplayRec __GLXDRIdisplay; typedef struct __GLXDRIscreenRec __GLXDRIscreen; typedef struct __GLXDRIdrawableRec __GLXDRIdrawable; -typedef struct __GLXDRIcontextRec __GLXDRIcontext; #include "glxextensions.h" @@ -131,13 +130,6 @@ struct __GLXDRIscreenRec { int (*getSwapInterval)(__GLXDRIdrawable *pdraw); }; -struct __GLXDRIcontextRec -{ - Bool(*bindContext) (struct glx_context *context, __GLXDRIdrawable *pdraw, - __GLXDRIdrawable *pread); - void (*unbindContext) (struct glx_context *context); -}; - struct __GLXDRIdrawableRec { void (*destroyDrawable) (__GLXDRIdrawable * drawable); @@ -221,6 +213,9 @@ typedef struct __GLXattributeMachineRec struct glx_context_vtable { void (*destroy)(struct glx_context *ctx); + int (*bind)(struct glx_context *context, struct glx_context *old, + GLXDrawable draw, GLXDrawable read); + void (*unbind)(struct glx_context *context, struct glx_context *new); void (*wait_gl)(struct glx_context *ctx); void (*wait_x)(struct glx_context *ctx); void (*use_x_font)(struct glx_context *ctx, @@ -388,15 +383,6 @@ struct glx_context */ struct glx_config *config; -#ifdef GLX_DIRECT_RENDERING -#ifdef GLX_USE_APPLEGL - void *driContext; - Bool do_destroy; -#else - __GLXDRIcontext *driContext; -#endif -#endif - /** * The current read-drawable for this context. Will be None if this * context is not current to any drawable. @@ -790,5 +776,10 @@ GetGLXDRIDrawable(Display *dpy, GLXDrawable drawable); extern struct glx_screen * indirect_create_screen(int screen, struct glx_display * priv); +extern int +indirect_bind_context(struct glx_context *gc, struct glx_context *old, + GLXDrawable draw, GLXDrawable read); +extern void +indirect_unbind_context(struct glx_context *gc, struct glx_context *new); #endif /* !__GLX_client_h__ */ diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index f2081fdd2c..717108e2fc 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -42,15 +42,12 @@ #include "apple_glx_context.h" #include "apple_glx.h" #include "glx_error.h" -#define GC_IS_DIRECT(gc) ((gc)->isDirect) #else #include #include #include "xf86dri.h" -#define GC_IS_DIRECT(gc) ((gc)->driContext != NULL) #endif #else -#define GC_IS_DIRECT(gc) (0) #endif #if defined(USE_XCB) @@ -424,6 +421,7 @@ glx_context_init(struct glx_context *gc, gc->psc = psc; gc->config = config; gc->isDirect = GL_TRUE; + gc->currentContextTag = -1; return GL_TRUE; } @@ -475,7 +473,7 @@ CreateContext(Display * dpy, int generic_id, req->visual = generic_id; req->screen = screen; req->shareList = shareList ? shareList->xid : None; - req->isDirect = GC_IS_DIRECT(gc); + req->isDirect = gc->isDirect; break; } @@ -491,7 +489,7 @@ CreateContext(Display * dpy, int generic_id, req->screen = screen; req->renderType = renderType; req->shareList = shareList ? shareList->xid : None; - req->isDirect = GC_IS_DIRECT(gc); + req->isDirect = gc->isDirect; break; } @@ -512,7 +510,7 @@ CreateContext(Display * dpy, int generic_id, req->screen = screen; req->renderType = renderType; req->shareList = shareList ? shareList->xid : None; - req->isDirect = GC_IS_DIRECT(gc); + req->isDirect = gc->isDirect; break; } @@ -836,7 +834,7 @@ glXCopyContext(Display * dpy, GLXContext source_user, } #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - if (gc->driContext) { + if (gc->isDirect) { /* NOT_DONE: This does not work yet */ } #endif @@ -929,7 +927,7 @@ glXIsDirect(Display * dpy, GLXContext gc_user) if (!gc) { return GL_FALSE; } - else if (GC_IS_DIRECT(gc)) { + else if (gc->isDirect) { return GL_TRUE; } #ifdef GLX_USE_APPLEGL /* TODO: indirect on darwin */ @@ -1962,7 +1960,7 @@ __glXSwapIntervalSGI(int interval) psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen); #ifdef GLX_DIRECT_RENDERING - if (gc->driContext && psc->driScreen && psc->driScreen->setSwapInterval) { + if (gc->isDirect && psc->driScreen && psc->driScreen->setSwapInterval) { __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable); psc->driScreen->setSwapInterval(pdraw, interval); @@ -2004,7 +2002,7 @@ __glXSwapIntervalMESA(unsigned int interval) #ifdef GLX_DIRECT_RENDERING struct glx_context *gc = __glXGetCurrentContext(); - if (gc != NULL && gc->driContext) { + if (gc != NULL && gc->isDirect) { struct glx_screen *psc; psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen); @@ -2026,7 +2024,7 @@ __glXGetSwapIntervalMESA(void) #ifdef GLX_DIRECT_RENDERING struct glx_context *gc = __glXGetCurrentContext(); - if (gc != NULL && gc->driContext) { + if (gc != NULL && gc->isDirect) { struct glx_screen *psc; psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen); @@ -2060,7 +2058,7 @@ __glXGetVideoSyncSGI(unsigned int *count) return GLX_BAD_CONTEXT; #ifdef GLX_DIRECT_RENDERING - if (!gc->driContext) + if (!gc->isDirect) return GLX_BAD_CONTEXT; #endif @@ -2102,7 +2100,7 @@ __glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count) return GLX_BAD_CONTEXT; #ifdef GLX_DIRECT_RENDERING - if (!gc->driContext) + if (!gc->isDirect) return GLX_BAD_CONTEXT; #endif @@ -2423,7 +2421,7 @@ __glXSwapBuffersMscOML(Display * dpy, GLXDrawable drawable, return -1; #ifdef GLX_DIRECT_RENDERING - if (!pdraw || !gc->driContext) + if (!pdraw || !gc->isDirect) return -1; #endif @@ -2721,6 +2719,8 @@ indirect_release_tex_image(Display * dpy, GLXDrawable drawable, int buffer) static const struct glx_context_vtable indirect_context_vtable = { indirect_destroy_context, + indirect_bind_context, + indirect_unbind_context, indirect_wait_gl, indirect_wait_x, indirect_use_x_font, diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c index c293af30c2..5955860494 100644 --- a/src/glx/glxcurrent.c +++ b/src/glx/glxcurrent.c @@ -283,37 +283,6 @@ SendMakeCurrentRequest(Display * dpy, CARD8 opcode, return ret; } - -#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) -static __GLXDRIdrawable * -FetchDRIDrawable(Display * dpy, - GLXDrawable glxDrawable, struct glx_context *gc) -{ - struct glx_display *const priv = __glXInitialize(dpy); - __GLXDRIdrawable *pdraw; - struct glx_screen *psc; - - if (priv == NULL) - return NULL; - - psc = priv->screens[gc->screen]; - if (priv->drawHash == NULL) - return NULL; - - if (__glxHashLookup(priv->drawHash, glxDrawable, (void *) &pdraw) == 0) - return pdraw; - - pdraw = psc->driScreen->createDrawable(psc, glxDrawable, - glxDrawable, gc->config); - if (__glxHashInsert(priv->drawHash, glxDrawable, pdraw)) { - (*pdraw->destroyDrawable) (pdraw); - return NULL; - } - - return pdraw; -} -#endif /* GLX_DIRECT_RENDERING */ - static void __glXGenerateError(Display * dpy, struct glx_context *gc, XID resource, BYTE errorCode, CARD16 minorCode) @@ -331,6 +300,55 @@ __glXGenerateError(Display * dpy, struct glx_context *gc, XID resource, #endif /* GLX_USE_APPLEGL */ +_X_HIDDEN int +indirect_bind_context(struct glx_context *gc, struct glx_context *old, + GLXDrawable draw, GLXDrawable read) +{ + xGLXMakeCurrentReply reply; + GLXContextTag tag; + __GLXattribute *state; + Display *dpy = gc->psc->dpy; + int opcode = __glXSetupForCommand(dpy); + + if (old && !old->isDirect && old->psc->dpy == dpy) + tag = old->currentContextTag; + else + tag = None; + + SendMakeCurrentRequest(dpy, opcode, gc->xid, tag, draw, read, &reply); + + if (!IndirectAPI) + IndirectAPI = __glXNewIndirectAPI(); + _glapi_set_dispatch(IndirectAPI); + + gc->currentContextTag = reply.contextTag; + state = gc->client_state_private; + if (state->array_state == NULL) { + glGetString(GL_EXTENSIONS); + glGetString(GL_VERSION); + __glXInitVertexArrayState(gc); + } + + return Success; +} + +_X_HIDDEN void +indirect_unbind_context(struct glx_context *gc, struct glx_context *new) +{ + Display *dpy = gc->psc->dpy; + int opcode = __glXSetupForCommand(dpy); + xGLXMakeCurrentReply reply; + + /* We are either switching to no context, away from a indirect + * context to a direct context or from one dpy to another and have + * to send a request to the dpy to unbind the previous context. + */ + if (!new || new->isDirect || new->psc->dpy != dpy) + SendMakeCurrentRequest(dpy, opcode, None, + gc->currentContextTag, None, None, &reply); + gc->currentContextTag = 0; +} + /** * Make a particular context current. * @@ -342,25 +360,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, { struct glx_context *gc = (struct glx_context *) gc_user; struct glx_context *oldGC = __glXGetCurrentContext(); -#ifdef GLX_USE_APPLEGL - bool error = apple_glx_make_current_context(dpy, - (oldGC && oldGC != &dummyContext) ? oldGC->driContext : NULL, - gc ? gc->driContext : NULL, draw); - - apple_glx_diagnostic("%s: error %s\n", __func__, error ? "YES" : "NO"); - if(error) - return GL_FALSE; -#else - xGLXMakeCurrentReply reply; - const CARD8 opcode = __glXSetupForCommand(dpy); - const CARD8 oldOpcode = ((gc == oldGC) || (oldGC == &dummyContext)) - ? opcode : __glXSetupForCommand(oldGC->currentDpy); - Bool bindReturnValue; - __GLXattribute *state; - - if (!opcode || !oldOpcode) { - return GL_FALSE; - } + int ret = Success; /* Make sure that the new context has a nonzero ID. In the request, * a zero context ID is used only to mean that we bind to no current @@ -388,134 +388,36 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, return False; } -#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - /* Bind the direct rendering context to the drawable */ - if (gc && gc->driContext) { - __GLXDRIdrawable *pdraw = FetchDRIDrawable(dpy, draw, gc); - __GLXDRIdrawable *pread = FetchDRIDrawable(dpy, read, gc); - - if ((pdraw == NULL) || (pread == NULL)) { - __glXGenerateError(dpy, gc, (pdraw == NULL) ? draw : read, - GLXBadDrawable, X_GLXMakeContextCurrent); - return False; - } - - bindReturnValue = - (gc->driContext->bindContext) (gc, pdraw, pread); + if (oldGC != &dummyContext && oldGC != gc) { + oldGC->vtable->unbind(oldGC, gc); + oldGC->currentDpy = 0; + oldGC->currentDrawable = None; + oldGC->currentReadable = None; + oldGC->thread_id = 0; + if (oldGC->xid == None) + /* We are switching away from a context that was + * previously destroyed, so we need to free the memory + * for the old handle. + */ + oldGC->vtable->destroy(oldGC); } - else if (!gc && oldGC && oldGC->driContext) { - bindReturnValue = True; - } - else -#endif - { - /* Send a glXMakeCurrent request to bind the new context. */ - bindReturnValue = - SendMakeCurrentRequest(dpy, opcode, gc ? gc->xid : None, - ((dpy != oldGC->currentDpy) - || oldGC->isDirect) - ? None : oldGC->currentContextTag, draw, read, - &reply); - } - - if (!bindReturnValue) { - return False; + if (gc) { + ret = gc->vtable->bind(gc, oldGC, draw, read); + gc->currentDpy = dpy; + gc->currentDrawable = draw; + gc->currentReadable = read; + gc->thread_id = _glthread_GetID(); + __glXSetCurrentContext(gc); + } else { + __glXSetCurrentContextNull(); } -#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - if ((dpy != oldGC->currentDpy || (gc && gc->driContext)) && - !oldGC->isDirect && oldGC != &dummyContext) { -#else - if ((dpy != oldGC->currentDpy) && oldGC != &dummyContext) { -#endif - xGLXMakeCurrentReply dummy_reply; - - /* We are either switching from one dpy to another and have to - * send a request to the previous dpy to unbind the previous - * context, or we are switching away from a indirect context to - * a direct context and have to send a request to the dpy to - * unbind the previous context. - */ - (void) SendMakeCurrentRequest(oldGC->currentDpy, oldOpcode, None, - oldGC->currentContextTag, None, None, - &dummy_reply); - } -#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - else if (oldGC->driContext && oldGC != gc) { - oldGC->driContext->unbindContext(oldGC); - } -#endif - -#endif /* GLX_USE_APPLEGL */ - - /* Update our notion of what is current */ - __glXLock(); - if (gc == oldGC) { - /* Even though the contexts are the same the drawable might have - * changed. Note that gc cannot be the dummy, and that oldGC - * cannot be NULL, therefore if they are the same, gc is not - * NULL and not the dummy. - */ - if(gc) { - gc->currentDrawable = draw; - gc->currentReadable = read; - } + if (ret) { + __glXGenerateError(dpy, gc, None, ret, X_GLXMakeContextCurrent); + return GL_FALSE; } - else { - if (oldGC != &dummyContext) { - /* Old current context is no longer current to anybody */ - oldGC->currentDpy = 0; - oldGC->currentDrawable = None; - oldGC->currentReadable = None; - oldGC->currentContextTag = 0; - oldGC->thread_id = 0; - - if (oldGC->xid == None) { - /* We are switching away from a context that was - * previously destroyed, so we need to free the memory - * for the old handle. - */ - oldGC->vtable->destroy(oldGC); - } - } - if (gc) { - __glXSetCurrentContext(gc); - - gc->currentDpy = dpy; - gc->currentDrawable = draw; - gc->currentReadable = read; -#ifndef GLX_USE_APPLEGL - gc->thread_id = _glthread_GetID(); -#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - if (!gc->driContext) { -#endif - if (!IndirectAPI) - IndirectAPI = __glXNewIndirectAPI(); - _glapi_set_dispatch(IndirectAPI); - - state = (__GLXattribute *) (gc->client_state_private); - - gc->currentContextTag = reply.contextTag; - if (state->array_state == NULL) { - (void) glGetString(GL_EXTENSIONS); - (void) glGetString(GL_VERSION); - __glXInitVertexArrayState(gc); - } -#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - } - else { - gc->currentContextTag = -1; - } -#endif -#endif /* GLX_USE_APPLEGL */ - } - else { - __glXSetCurrentContextNull(); - } - } - __glXUnlock(); return GL_TRUE; } diff --git a/src/glx/glxext.c b/src/glx/glxext.c index 5930d7d5a8..e48c4c289c 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -742,7 +742,7 @@ glx_screen_init(struct glx_screen *psc, ** If that works then fetch the per screen configs data. */ static Bool - AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv) +AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv) { struct glx_screen *psc; GLint i, screens; diff --git a/src/glx/indirect.c b/src/glx/indirect.c index 0dea8e9f5a..c0fff6c4dc 100644 --- a/src/glx/indirect.c +++ b/src/glx/indirect.c @@ -5199,7 +5199,7 @@ glDeleteTexturesEXT(GLsizei n, const GLuint * textures) struct glx_context *const gc = __glXGetCurrentContext(); #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - if (gc->driContext) { + if (gc->isDirect) { CALL_DeleteTextures(GET_DISPATCH(), (n, textures)); } else #endif @@ -5270,7 +5270,7 @@ glGenTexturesEXT(GLsizei n, GLuint * textures) struct glx_context *const gc = __glXGetCurrentContext(); #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - if (gc->driContext) { + if (gc->isDirect) { CALL_GenTextures(GET_DISPATCH(), (n, textures)); } else #endif @@ -5335,7 +5335,7 @@ glIsTextureEXT(GLuint texture) struct glx_context *const gc = __glXGetCurrentContext(); #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - if (gc->driContext) { + if (gc->isDirect) { return CALL_IsTexture(GET_DISPATCH(), (texture)); } else #endif @@ -5651,7 +5651,7 @@ glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid * table) struct glx_context *const gc = __glXGetCurrentContext(); #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - if (gc->driContext) { + if (gc->isDirect) { CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table)); } else #endif @@ -5727,7 +5727,7 @@ glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat * params) struct glx_context *const gc = __glXGetCurrentContext(); #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - if (gc->driContext) { + if (gc->isDirect) { CALL_GetColorTableParameterfv(GET_DISPATCH(), (target, pname, params)); } else @@ -5800,7 +5800,7 @@ glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint * params) struct glx_context *const gc = __glXGetCurrentContext(); #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - if (gc->driContext) { + if (gc->isDirect) { CALL_GetColorTableParameteriv(GET_DISPATCH(), (target, pname, params)); } else @@ -6126,7 +6126,7 @@ gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type, struct glx_context *const gc = __glXGetCurrentContext(); #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - if (gc->driContext) { + if (gc->isDirect) { CALL_GetConvolutionFilter(GET_DISPATCH(), (target, format, type, image)); } else @@ -6204,7 +6204,7 @@ gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params) struct glx_context *const gc = __glXGetCurrentContext(); #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - if (gc->driContext) { + if (gc->isDirect) { CALL_GetConvolutionParameterfv(GET_DISPATCH(), (target, pname, params)); } else @@ -6277,7 +6277,7 @@ gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params) struct glx_context *const gc = __glXGetCurrentContext(); #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - if (gc->driContext) { + if (gc->isDirect) { CALL_GetConvolutionParameteriv(GET_DISPATCH(), (target, pname, params)); } else @@ -6357,7 +6357,7 @@ gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format, struct glx_context *const gc = __glXGetCurrentContext(); #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - if (gc->driContext) { + if (gc->isDirect) { CALL_GetHistogram(GET_DISPATCH(), (target, reset, format, type, values)); } else @@ -6434,7 +6434,7 @@ gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params) struct glx_context *const gc = __glXGetCurrentContext(); #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - if (gc->driContext) { + if (gc->isDirect) { CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params)); } else #endif @@ -6505,7 +6505,7 @@ gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params) struct glx_context *const gc = __glXGetCurrentContext(); #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - if (gc->driContext) { + if (gc->isDirect) { CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params)); } else #endif @@ -6580,7 +6580,7 @@ gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format, struct glx_context *const gc = __glXGetCurrentContext(); #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - if (gc->driContext) { + if (gc->isDirect) { CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values)); } else #endif @@ -6654,7 +6654,7 @@ gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params) struct glx_context *const gc = __glXGetCurrentContext(); #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - if (gc->driContext) { + if (gc->isDirect) { CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params)); } else #endif @@ -6722,7 +6722,7 @@ gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params) struct glx_context *const gc = __glXGetCurrentContext(); #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - if (gc->driContext) { + if (gc->isDirect) { CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params)); } else #endif diff --git a/src/glx/singlepix.c b/src/glx/singlepix.c index edb8858d7a..b61f26b2f3 100644 --- a/src/glx/singlepix.c +++ b/src/glx/singlepix.c @@ -120,7 +120,7 @@ void NAME(_gloffset_GetSeparableFilter) (GLenum target, GLenum format, struct glx_context *const gc = __glXGetCurrentContext(); #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - if (gc->driContext) { + if (gc->isDirect) { CALL_GetSeparableFilter(GET_DISPATCH(), (target, format, type, row, column, span)); return; diff --git a/src/mapi/glapi/gen/glX_proto_send.py b/src/mapi/glapi/gen/glX_proto_send.py index 08f332f504..0ca0ff92a6 100644 --- a/src/mapi/glapi/gen/glX_proto_send.py +++ b/src/mapi/glapi/gen/glX_proto_send.py @@ -374,7 +374,7 @@ const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 }; print ' struct glx_context * const gc = __glXGetCurrentContext();' print '' print '#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)' - print ' if (gc->driContext) {' + print ' if (gc->isDirect) {' print ' %sCALL_%s(GET_DISPATCH(), (%s));' % (ret_string, func.name, func.get_called_parameter_string()) print ' } else' print '#endif' -- cgit v1.2.3