From 38765fe4c2ba96e642510eaed0c2f8c44f0c2b1d Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 28 Jul 2010 09:08:32 -0400 Subject: glx: Stop using glcore.h and glxint.h in glx We'd like to get rid of these header files. --- src/glx/glcontextmodes.h | 92 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 89 insertions(+), 3 deletions(-) (limited to 'src/glx/glcontextmodes.h') diff --git a/src/glx/glcontextmodes.h b/src/glx/glcontextmodes.h index ecf0280cba..7e6590624b 100644 --- a/src/glx/glcontextmodes.h +++ b/src/glx/glcontextmodes.h @@ -30,12 +30,98 @@ #ifndef GLCONTEXTMODES_H #define GLCONTEXTMODES_H -#include "GL/internal/glcore.h" +typedef struct __GLcontextModesRec { + struct __GLcontextModesRec * next; + + GLboolean rgbMode; + GLboolean floatMode; + GLboolean colorIndexMode; + GLuint doubleBufferMode; + GLuint stereoMode; + + GLboolean haveAccumBuffer; + GLboolean haveDepthBuffer; + GLboolean haveStencilBuffer; + + 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; +} __GLcontextModes; + +#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 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); -- cgit v1.2.3 From 4f9f066485d93cd6bb0e21fec0775ceed96d14de Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 28 Jul 2010 09:14:55 -0400 Subject: glx: Delete unused glcontextmodes.c functions --- src/glx/glcontextmodes.c | 86 ------------------------------------------------ src/glx/glcontextmodes.h | 8 ----- src/glx/glxext.c | 7 ---- 3 files changed, 101 deletions(-) (limited to 'src/glx/glcontextmodes.h') diff --git a/src/glx/glcontextmodes.c b/src/glx/glcontextmodes.c index 7778eea199..18c45d59d7 100644 --- a/src/glx/glcontextmodes.c +++ b/src/glx/glcontextmodes.c @@ -61,29 +61,6 @@ _gl_convert_from_x_visual_type(int visualType) ? 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, - * \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. - */ -GLint -_gl_convert_to_x_visual_type(int visualType) -{ - static const int x_visual_types[NUM_VISUAL_TYPES] = { - TrueColor, DirectColor, - PseudoColor, StaticColor, - GrayScale, StaticGray - }; - - return ((unsigned) (visualType - GLX_TRUE_COLOR) < NUM_VISUAL_TYPES) - ? x_visual_types[visualType - GLX_TRUE_COLOR] : -1; -} - - /** * Get data from a GL context mode. * @@ -365,66 +342,3 @@ _gl_context_modes_find_fbconfig(__GLcontextModes * modes, int fbid) return NULL; } - -/** - * 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 - * returned otherwise. - */ -GLboolean -_gl_context_modes_are_same(const __GLcontextModes * a, - const __GLcontextModes * b) -{ - return ((a->rgbMode == b->rgbMode) && - (a->floatMode == b->floatMode) && - (a->colorIndexMode == b->colorIndexMode) && - (a->doubleBufferMode == b->doubleBufferMode) && - (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->redMask == b->redMask) && - (a->greenMask == b->greenMask) && - (a->blueMask == b->blueMask) && (a->alphaMask == b->alphaMask) && -#endif - (a->rgbBits == b->rgbBits) && - (a->indexBits == b->indexBits) && - (a->accumRedBits == b->accumRedBits) && - (a->accumGreenBits == b->accumGreenBits) && - (a->accumBlueBits == b->accumBlueBits) && - (a->accumAlphaBits == b->accumAlphaBits) && - (a->depthBits == b->depthBits) && - (a->stencilBits == b->stencilBits) && - (a->numAuxBuffers == b->numAuxBuffers) && - (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) && - (a->renderType == b->renderType) && - (a->maxPbufferWidth == b->maxPbufferWidth) && - (a->maxPbufferHeight == b->maxPbufferHeight) && - (a->maxPbufferPixels == b->maxPbufferPixels) && - (a->optimalPbufferWidth == b->optimalPbufferWidth) && - (a->optimalPbufferHeight == b->optimalPbufferHeight) && - (a->swapMethod == b->swapMethod) && - (a->bindToTextureRgb == b->bindToTextureRgb) && - (a->bindToTextureRgba == b->bindToTextureRgba) && - (a->bindToMipmapTexture == b->bindToMipmapTexture) && - (a->bindToTextureTargets == b->bindToTextureTargets) && - (a->yInverted == b->yInverted)); -} diff --git a/src/glx/glcontextmodes.h b/src/glx/glcontextmodes.h index 7e6590624b..be2b29a195 100644 --- a/src/glx/glcontextmodes.h +++ b/src/glx/glcontextmodes.h @@ -39,10 +39,6 @@ typedef struct __GLcontextModesRec { GLuint doubleBufferMode; GLuint stereoMode; - GLboolean haveAccumBuffer; - GLboolean haveDepthBuffer; - GLboolean haveStencilBuffer; - GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */ GLuint redMask, greenMask, blueMask, alphaMask; GLint rgbBits; /* total bits for rgb */ @@ -121,10 +117,8 @@ typedef struct __GLcontextModesRec { (__GLX_MIN_CONFIG_PROPS + 2 * __GLX_EXT_CONFIG_PROPS) extern GLint _gl_convert_from_x_visual_type(int visualType); -extern GLint _gl_convert_to_x_visual_type(int visualType); extern int _gl_get_context_mode_data(const __GLcontextModes * mode, int attribute, int *value_return); - extern __GLcontextModes *_gl_context_modes_create(unsigned count, size_t minimum_size); extern void _gl_context_modes_destroy(__GLcontextModes * modes); @@ -132,7 +126,5 @@ 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 */ diff --git a/src/glx/glxext.c b/src/glx/glxext.c index 4a9c9d499e..7612e5e834 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -573,13 +573,6 @@ __glXInitializeVisualConfigFromTags(__GLcontextModes * config, int count, config->renderType = (config->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT; - - config->haveAccumBuffer = ((config->accumRedBits + - config->accumGreenBits + - config->accumBlueBits + - config->accumAlphaBits) > 0); - config->haveDepthBuffer = (config->depthBits > 0); - config->haveStencilBuffer = (config->stencilBits > 0); } static __GLcontextModes * -- cgit v1.2.3 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/apple/apple_glx_drawable.h | 2 +- src/glx/apple/apple_glx_pbuffer.c | 2 +- src/glx/apple/apple_glx_pixmap.c | 2 +- src/glx/apple/apple_visual.c | 2 +- src/glx/apple/apple_visual.h | 2 +- src/glx/dri2_glx.c | 10 +- src/glx/dri_common.c | 50 +++++---- src/glx/dri_common.h | 6 +- src/glx/dri_glx.c | 14 +-- src/glx/drisw_glx.c | 8 +- src/glx/glcontextmodes.c | 106 ++++++------------- src/glx/glcontextmodes.h | 27 ++--- src/glx/glx_pbuffer.c | 60 +++++------ src/glx/glxclient.h | 18 ++-- src/glx/glxcmds.c | 205 ++++++++++++++++++------------------- src/glx/glxcurrent.c | 2 +- src/glx/glxext.c | 31 ++++-- 17 files changed, 258 insertions(+), 289 deletions(-) (limited to 'src/glx/glcontextmodes.h') diff --git a/src/glx/apple/apple_glx_drawable.h b/src/glx/apple/apple_glx_drawable.h index e49eae355e..af79e0590e 100644 --- a/src/glx/apple/apple_glx_drawable.h +++ b/src/glx/apple/apple_glx_drawable.h @@ -211,7 +211,7 @@ bool apple_glx_pbuffer_get_event_mask(GLXDrawable d, unsigned long *mask); /* Pixmaps */ -/* mode is a __GLcontextModes * */ +/* mode is a struct glx_config * */ /* Returns true if an error occurred. */ bool apple_glx_pixmap_create(Display * dpy, int screen, Pixmap pixmap, const void *mode); diff --git a/src/glx/apple/apple_glx_pbuffer.c b/src/glx/apple/apple_glx_pbuffer.c index 1466fea487..a5ef59ccf8 100644 --- a/src/glx/apple/apple_glx_pbuffer.c +++ b/src/glx/apple/apple_glx_pbuffer.c @@ -128,7 +128,7 @@ apple_glx_pbuffer_create(Display * dpy, GLXFBConfig config, Window root; int screen; Pixmap xid; - __GLcontextModes *modes = (__GLcontextModes *) config; + struct glx_config *modes = (__GLcontextModes *) config; root = DefaultRootWindow(dpy); screen = DefaultScreen(dpy); diff --git a/src/glx/apple/apple_glx_pixmap.c b/src/glx/apple/apple_glx_pixmap.c index af1791afb7..fec05e02de 100644 --- a/src/glx/apple/apple_glx_pixmap.c +++ b/src/glx/apple/apple_glx_pixmap.c @@ -125,7 +125,7 @@ apple_glx_pixmap_create(Display * dpy, int screen, Pixmap pixmap, bool double_buffered; bool uses_stereo; CGLError error; - const __GLcontextModes *cmodes = mode; + const struct glx_config *cmodes = mode; if (apple_glx_drawable_create(dpy, screen, pixmap, &d, &callbacks)) return true; diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c index da5aa05fd5..7a9525e817 100644 --- a/src/glx/apple/apple_visual.c +++ b/src/glx/apple/apple_visual.c @@ -61,7 +61,7 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const void *mode, bool offscreen) { CGLPixelFormatAttribute attr[MAX_ATTR]; - const __GLcontextModes *c = mode; + const struct glx_config *c = mode; int numattr = 0; GLint vsref = 0; CGLError error = 0; diff --git a/src/glx/apple/apple_visual.h b/src/glx/apple/apple_visual.h index ebfafa340b..2cf9a9e251 100644 --- a/src/glx/apple/apple_visual.h +++ b/src/glx/apple/apple_visual.h @@ -33,7 +33,7 @@ #include #include -/* mode is expected to be of type __GLcontextModes. */ +/* mode is expected to be of type struct glx_config. */ void apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const void *mode, bool * double_buffered, bool * uses_stereo, bool offscreen); diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index a2c2b9785e..2429e0df03 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -156,12 +156,12 @@ dri2UnbindContext(__GLXcontext *context) static __GLXcontext * dri2_create_context(__GLXscreenConfigs *base, - const __GLcontextModes * mode, + struct glx_config *config_base, GLXContext shareList, int renderType) { struct dri2_context *pcp, *pcp_shared; struct dri2_screen *psc = (struct dri2_screen *) base; - __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode; + __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) config_base; __DRIcontext *shared = NULL; if (shareList) { @@ -174,7 +174,7 @@ dri2_create_context(__GLXscreenConfigs *base, return NULL; memset(pcp, 0, sizeof *pcp); - if (!glx_context_init(&pcp->base, &psc->base, mode)) { + if (!glx_context_init(&pcp->base, &psc->base, &config->base)) { Xfree(pcp); return NULL; } @@ -212,11 +212,11 @@ dri2DestroyDrawable(__GLXDRIdrawable *base) static __GLXDRIdrawable * dri2CreateDrawable(__GLXscreenConfigs *base, XID xDrawable, - GLXDrawable drawable, const __GLcontextModes * modes) + GLXDrawable drawable, struct glx_config *config_base) { struct dri2_drawable *pdraw; struct dri2_screen *psc = (struct dri2_screen *) base; - __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes; + __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) config_base; __GLXdisplayPrivate *dpyPriv; struct dri2_display *pdp; GLint vblank_mode = DRI_CONF_VBLANK_DEF_INTERVAL_1; 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; } diff --git a/src/glx/dri_common.h b/src/glx/dri_common.h index f3da50ecf0..32d98ed3c1 100644 --- a/src/glx/dri_common.h +++ b/src/glx/dri_common.h @@ -42,12 +42,12 @@ typedef struct __GLXDRIconfigPrivateRec __GLXDRIconfigPrivate; struct __GLXDRIconfigPrivateRec { - __GLcontextModes modes; + struct glx_config base; const __DRIconfig *driConfig; }; -extern __GLcontextModes *driConvertConfigs(const __DRIcoreExtension * core, - __GLcontextModes * modes, +extern struct glx_config *driConvertConfigs(const __DRIcoreExtension * core, + struct glx_config * modes, const __DRIconfig ** configs); extern void driDestroyConfigs(const __DRIconfig **configs); diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c index fd14285a48..291b9aacaf 100644 --- a/src/glx/dri_glx.c +++ b/src/glx/dri_glx.c @@ -337,7 +337,7 @@ CallCreateNewScreen(Display *dpy, int scrn, struct dri_screen *psc, drm_handle_t hFB; int junk; const __DRIconfig **driver_configs; - __GLcontextModes *visual; + struct glx_config *visual; /* DRI protocol version. */ dri_version.major = driDpy->driMajor; @@ -551,14 +551,14 @@ static const struct glx_context_vtable dri_context_vtable = { static __GLXcontext * dri_create_context(__GLXscreenConfigs *base, - const __GLcontextModes *mode, + struct glx_config *config_base, GLXContext shareList, int renderType) { struct dri_context *pcp, *pcp_shared; struct dri_screen *psc = (struct dri_screen *) base; drm_context_t hwContext; __DRIcontext *shared = NULL; - __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode; + __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) config_base; if (!psc->base.driScreen) return NULL; @@ -573,13 +573,13 @@ dri_create_context(__GLXscreenConfigs *base, return NULL; memset(pcp, 0, sizeof *pcp); - if (!glx_context_init(&pcp->base, &psc->base, mode)) { + if (!glx_context_init(&pcp->base, &psc->base, &config->base)) { Xfree(pcp); return NULL; } if (!XF86DRICreateContextWithConfig(psc->base.dpy, psc->base.scr, - mode->visualID, + config->base.visualID, &pcp->hwContextID, &hwContext)) { Xfree(pcp); return NULL; @@ -617,11 +617,11 @@ driDestroyDrawable(__GLXDRIdrawable * pdraw) static __GLXDRIdrawable * driCreateDrawable(__GLXscreenConfigs *base, XID xDrawable, - GLXDrawable drawable, const __GLcontextModes * modes) + GLXDrawable drawable, struct glx_config *config_base) { drm_drawable_t hwDrawable; void *empty_attribute_list = NULL; - __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes; + __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) config_base; struct dri_screen *psc = (struct dri_screen *) base; struct dri_drawable *pdp; diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index 5f7185de4c..39d71513a8 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -291,11 +291,11 @@ static const struct glx_context_vtable drisw_context_vtable = { static __GLXcontext * drisw_create_context(__GLXscreenConfigs *base, - const __GLcontextModes *mode, + struct glx_config *config_base, GLXContext shareList, int renderType) { struct drisw_context *pcp, *pcp_shared; - __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode; + __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) config_base; struct drisw_screen *psc = (struct drisw_screen *) base; __DRIcontext *shared = NULL; @@ -312,7 +312,7 @@ drisw_create_context(__GLXscreenConfigs *base, return NULL; memset(pcp, 0, sizeof *pcp); - if (!glx_context_init(&pcp->base, &psc->base, mode)) { + if (!glx_context_init(&pcp->base, &psc->base, &config->base)) { Xfree(pcp); return NULL; } @@ -347,7 +347,7 @@ driDestroyDrawable(__GLXDRIdrawable * pdraw) static __GLXDRIdrawable * driCreateDrawable(__GLXscreenConfigs *base, XID xDrawable, - GLXDrawable drawable, const __GLcontextModes * modes) + GLXDrawable drawable, struct glx_config *modes) { struct drisw_drawable *pdp; __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes; diff --git a/src/glx/glcontextmodes.c b/src/glx/glcontextmodes.c index 18c45d59d7..186de485ff 100644 --- a/src/glx/glcontextmodes.c +++ b/src/glx/glcontextmodes.c @@ -24,7 +24,7 @@ /** * \file glcontextmodes.c - * Utility routines for working with \c __GLcontextModes structures. At + * 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. * @@ -41,28 +41,7 @@ #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 - * be returned. Otherwise \c GLX_NONE will be returned. - */ -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_COLOR, GLX_PSEUDO_COLOR, - GLX_TRUE_COLOR, GLX_DIRECT_COLOR - }; - - return ((unsigned) visualType < NUM_VISUAL_TYPES) - ? glx_visual_types[visualType] : GLX_NONE; -} - -/** - * Get data from a GL context mode. + * 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. @@ -70,9 +49,8 @@ _gl_convert_from_x_visual_type(int visualType) * \return If \c attribute is a valid attribute of \c mode, zero is * returned. Otherwise \c GLX_BAD_ATTRIBUTE is returned. */ -int -_gl_get_context_mode_data(const __GLcontextModes * mode, int attribute, - int *value_return) +_X_HIDDEN int +glx_config_get(struct glx_config * mode, int attribute, int *value_return) { switch (attribute) { case GLX_USE_GL: @@ -222,7 +200,7 @@ _gl_get_context_mode_data(const __GLcontextModes * mode, int attribute, /** - * Allocate a linked list of \c __GLcontextModes structures. The fields of + * 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 @@ -233,36 +211,26 @@ _gl_get_context_mode_data(const __GLcontextModes * mode, int attribute, * \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 __GLcontextModes stucture used in libGL and in a + * \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. - * - * \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 - * structure in libGL is the same, then the meaning of each byte in - * the structure is the same in both places. \b Be \b careful! - * Basically this means that fields have to be added in libGL and - * then propagated to drivers. Drivers should \b never arbitrarilly - * extend the \c __GLcontextModes data-structure. */ -__GLcontextModes * -_gl_context_modes_create(unsigned count, size_t minimum_size) +_X_HIDDEN struct glx_config * +glx_config_create_list(unsigned count) { - const size_t size = (minimum_size > sizeof(__GLcontextModes)) - ? minimum_size : sizeof(__GLcontextModes); - __GLcontextModes *base = NULL; - __GLcontextModes **next; + 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 = (__GLcontextModes *) malloc(size); + *next = (struct glx_config *) malloc(size); if (*next == NULL) { - _gl_context_modes_destroy(base); - base = NULL; - break; + glx_config_destroy_list(base); + base = NULL; + break; } (void) memset(*next, 0, size); @@ -290,22 +258,14 @@ _gl_context_modes_create(unsigned count, size_t minimum_size) return base; } - -/** - * 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. - */ -void -_gl_context_modes_destroy(__GLcontextModes * modes) +_X_HIDDEN void +glx_config_destroy_list(struct glx_config *configs) { - while (modes != NULL) { - __GLcontextModes *const next = modes->next; + while (configs != NULL) { + struct glx_config *const next = configs->next; - free(modes); - modes = next; + free(configs); + configs = next; } } @@ -319,26 +279,26 @@ _gl_context_modes_destroy(__GLcontextModes * modes) * the list, or \c NULL if it was not. */ -__GLcontextModes * -_gl_context_modes_find_visual(__GLcontextModes * modes, int vid) +_X_HIDDEN struct glx_config * +glx_config_find_visual(struct glx_config *configs, int vid) { - __GLcontextModes *m; + struct glx_config *c; - for (m = modes; m != NULL; m = m->next) - if (m->visualID == vid) - return m; + for (c = configs; c != NULL; c = c->next) + if (c->visualID == vid) + return c; return NULL; } -__GLcontextModes * -_gl_context_modes_find_fbconfig(__GLcontextModes * modes, int fbid) +_X_HIDDEN struct glx_config * +glx_config_find_fbconfig(struct glx_config *configs, int fbid) { - __GLcontextModes *m; + struct glx_config *c; - for (m = modes; m != NULL; m = m->next) - if (m->fbconfigID == fbid) - return m; + 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 index be2b29a195..f7ee958e4b 100644 --- a/src/glx/glcontextmodes.h +++ b/src/glx/glcontextmodes.h @@ -30,8 +30,8 @@ #ifndef GLCONTEXTMODES_H #define GLCONTEXTMODES_H -typedef struct __GLcontextModesRec { - struct __GLcontextModesRec * next; +struct glx_config { + struct glx_config * next; GLboolean rgbMode; GLboolean floatMode; @@ -100,7 +100,7 @@ typedef struct __GLcontextModesRec { GLint bindToMipmapTexture; GLint bindToTextureTargets; GLint yInverted; -} __GLcontextModes; +}; #define __GLX_MIN_CONFIG_PROPS 18 #define __GLX_MAX_CONFIG_PROPS 500 @@ -117,14 +117,17 @@ typedef struct __GLcontextModesRec { (__GLX_MIN_CONFIG_PROPS + 2 * __GLX_EXT_CONFIG_PROPS) extern GLint _gl_convert_from_x_visual_type(int visualType); -extern int _gl_get_context_mode_data(const __GLcontextModes * mode, - int attribute, int *value_return); -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 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/glx_pbuffer.c b/src/glx/glx_pbuffer.c index 02809aacfa..abe618ddb3 100644 --- a/src/glx/glx_pbuffer.c +++ b/src/glx/glx_pbuffer.c @@ -183,7 +183,7 @@ determineTextureFormat(const int *attribs, int numAttribs) } static void -CreateDRIDrawable(Display *dpy, const __GLcontextModes *fbconfig, +CreateDRIDrawable(Display *dpy, struct glx_config *config, XID drawable, XID glxdrawable, const int *attrib_list, size_t num_attribs) { @@ -191,12 +191,12 @@ CreateDRIDrawable(Display *dpy, const __GLcontextModes *fbconfig, __GLXDRIdrawable *pdraw; __GLXscreenConfigs *psc; - psc = priv->screenConfigs[fbconfig->screen]; + psc = priv->screenConfigs[config->screen]; if (psc->driScreen == NULL) return; pdraw = psc->driScreen->createDrawable(psc, drawable, - glxdrawable, fbconfig); + glxdrawable, config); if (pdraw == NULL) { fprintf(stderr, "failed to create drawable\n"); return; @@ -228,7 +228,7 @@ DestroyDRIDrawable(Display *dpy, GLXDrawable drawable, int destroy_xdrawable) #else static void -CreateDRIDrawable(Display *dpy, const __GLcontextModes * fbconfig, +CreateDRIDrawable(Display *dpy, const struct glx_config * fbconfig, XID drawable, XID glxdrawable, const int *attrib_list, size_t num_attribs) { @@ -367,7 +367,7 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable, * This function needs to be modified to work with direct-rendering drivers. */ static GLXDrawable -CreateDrawable(Display * dpy, const __GLcontextModes * fbconfig, +CreateDrawable(Display *dpy, struct glx_config *config, Drawable drawable, const int *attrib_list, CARD8 glxCode) { xGLXCreateWindowReq *req; @@ -391,11 +391,11 @@ CreateDrawable(Display * dpy, const __GLcontextModes * fbconfig, req->reqType = opcode; req->glxCode = glxCode; - req->screen = (CARD32) fbconfig->screen; - req->fbconfig = fbconfig->fbconfigID; - req->window = (CARD32) drawable; - req->glxwindow = (GLXWindow) XAllocID(dpy); - req->numAttribs = (CARD32) i; + req->screen = config->screen; + req->fbconfig = config->fbconfigID; + req->window = drawable; + req->glxwindow = XAllocID(dpy); + req->numAttribs = i; if (attrib_list) memcpy(data, attrib_list, 8 * i); @@ -403,9 +403,9 @@ CreateDrawable(Display * dpy, const __GLcontextModes * fbconfig, UnlockDisplay(dpy); SyncHandle(); - CreateDRIDrawable(dpy, fbconfig, drawable, req->glxwindow, attrib_list, i); + CreateDRIDrawable(dpy, config, drawable, req->glxwindow, attrib_list, i); - return (GLXDrawable) req->glxwindow; + return req->glxwindow; } @@ -457,7 +457,7 @@ DestroyDrawable(Display * dpy, GLXDrawable drawable, CARD32 glxCode) * This function needs to be modified to work with direct-rendering drivers. */ static GLXDrawable -CreatePbuffer(Display * dpy, const __GLcontextModes * fbconfig, +CreatePbuffer(Display * dpy, struct glx_config *config, unsigned int width, unsigned int height, const int *attrib_list, GLboolean size_in_attribs) { @@ -490,10 +490,10 @@ CreatePbuffer(Display * dpy, const __GLcontextModes * fbconfig, req->reqType = opcode; req->glxCode = X_GLXCreatePbuffer; - req->screen = (CARD32) fbconfig->screen; - req->fbconfig = fbconfig->fbconfigID; - req->pbuffer = (GLXPbuffer) id; - req->numAttribs = (CARD32) (i + extra); + req->screen = config->screen; + req->fbconfig = config->fbconfigID; + req->pbuffer = id; + req->numAttribs = i + extra; if (!size_in_attribs) { data[(2 * i) + 0] = GLX_PBUFFER_WIDTH; @@ -513,11 +513,11 @@ CreatePbuffer(Display * dpy, const __GLcontextModes * fbconfig, vpreq->glxCode = X_GLXVendorPrivate; vpreq->vendorCode = X_GLXvop_CreateGLXPbufferSGIX; - data[0] = (CARD32) fbconfig->screen; - data[1] = (CARD32) fbconfig->fbconfigID; - data[2] = (CARD32) id; - data[3] = (CARD32) width; - data[4] = (CARD32) height; + data[0] = config->screen; + data[1] = config->fbconfigID; + data[2] = id; + data[3] = width; + data[4] = height; data += 5; } @@ -526,10 +526,10 @@ CreatePbuffer(Display * dpy, const __GLcontextModes * fbconfig, UnlockDisplay(dpy); SyncHandle(); - pixmap = XCreatePixmap(dpy, RootWindow(dpy, fbconfig->screen), - width, height, fbconfig->rgbBits); + pixmap = XCreatePixmap(dpy, RootWindow(dpy, config->screen), + width, height, config->rgbBits); - CreateDRIDrawable(dpy, fbconfig, pixmap, id, attrib_list, i); + CreateDRIDrawable(dpy, config, pixmap, id, attrib_list, i); return id; } @@ -598,7 +598,7 @@ glXCreateGLXPbufferSGIX(Display * dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list) { - return (GLXPbufferSGIX) CreatePbuffer(dpy, (__GLcontextModes *) config, + return (GLXPbufferSGIX) CreatePbuffer(dpy, (struct glx_config *) config, width, height, attrib_list, GL_FALSE); } @@ -674,7 +674,7 @@ glXCreatePbuffer(Display * dpy, GLXFBConfig config, const int *attrib_list) } } - return (GLXPbuffer) CreatePbuffer(dpy, (__GLcontextModes *) config, + return (GLXPbuffer) CreatePbuffer(dpy, (struct glx_config *) config, width, height, attrib_list, GL_TRUE); #endif } @@ -836,14 +836,14 @@ glXCreatePixmap(Display * dpy, GLXFBConfig config, Pixmap pixmap, WARN_ONCE_GLX_1_3(dpy, __func__); #ifdef GLX_USE_APPLEGL - const __GLcontextModes *modes = (const __GLcontextModes *) config; + const struct glx_config *modes = (const __GLcontextModes *) config; if (apple_glx_pixmap_create(dpy, modes->screen, pixmap, modes)) return None; return pixmap; #else - return CreateDrawable(dpy, (__GLcontextModes *) config, + return CreateDrawable(dpy, (struct glx_config *) config, (Drawable) pixmap, attrib_list, X_GLXCreatePixmap); #endif } @@ -878,7 +878,7 @@ glXCreateWindow(Display * dpy, GLXFBConfig config, Window win, return win; #else - return CreateDrawable(dpy, (__GLcontextModes *) config, + return CreateDrawable(dpy, (struct glx_config *) config, (Drawable) win, attrib_list, X_GLXCreateWindow); #endif } diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index 01087d035f..3a8d294dab 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -74,7 +74,7 @@ # define USED #endif - +#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) #define GLX_MAJOR_VERSION 1 /* current version numbers */ #define GLX_MINOR_VERSION 4 @@ -127,13 +127,13 @@ struct __GLXDRIscreenRec { void (*destroyScreen)(__GLXscreenConfigs *psc); __GLXcontext *(*createContext)(__GLXscreenConfigs *psc, - const __GLcontextModes *mode, + struct glx_config *config, GLXContext shareList, int renderType); __GLXDRIdrawable *(*createDrawable)(__GLXscreenConfigs *psc, XID drawable, GLXDrawable glxDrawable, - const __GLcontextModes *modes); + struct glx_config *config); int64_t (*swapBuffers)(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor, int64_t remainder); @@ -403,9 +403,9 @@ struct __GLXcontextRec GLint majorOpcode; /** - * Pointer to the mode used to create this context. + * Pointer to the config used to create this context. */ - const __GLcontextModes *mode; + struct glx_config *config; #ifdef GLX_DIRECT_RENDERING #ifdef GLX_USE_APPLEGL @@ -462,7 +462,7 @@ struct __GLXcontextRec extern Bool glx_context_init(__GLXcontext *gc, - __GLXscreenConfigs *psc, const __GLcontextModes *fbconfig); + __GLXscreenConfigs *psc, struct glx_config *fbconfig); #define __glXSetError(gc,code) \ if (!(gc)->error) { \ @@ -505,7 +505,7 @@ extern void __glFreeAttributeState(__GLXcontext *); */ struct glx_screen_vtable { __GLXcontext *(*create_context)(__GLXscreenConfigs *psc, - const __GLcontextModes *mode, + struct glx_config *config, GLXContext shareList, int renderType); }; @@ -539,7 +539,7 @@ struct __GLXscreenConfigsRec /** * Linked list of glx visuals and fbconfigs for this screen. */ - __GLcontextModes *visuals, *configs; + struct glx_config *visuals, *configs; /** * Per-screen dynamic GLX extension tracking. The \c direct_support @@ -766,7 +766,7 @@ extern void _XSend(Display *, const void *, long); #endif -extern void __glXInitializeVisualConfigFromTags(__GLcontextModes * config, +extern void __glXInitializeVisualConfigFromTags(struct glx_config * config, int count, const INT32 * bp, Bool tagged_only, Bool fbconfig_style_tags); diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index 0782b1d70f..85bfa657e0 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -208,26 +208,25 @@ GetGLXPrivScreenConfig(Display * dpy, int scrn, __GLXdisplayPrivate ** ppriv, * \param config Application supplied \c GLXFBConfig. * * \returns If the \c GLXFBConfig is valid, the a pointer to the matching - * \c __GLcontextModes structure is returned. Otherwise, \c NULL + * \c struct glx_config structure is returned. Otherwise, \c NULL * is returned. */ -static __GLcontextModes * -ValidateGLXFBConfig(Display * dpy, GLXFBConfig config) +static struct glx_config * +ValidateGLXFBConfig(Display * dpy, GLXFBConfig fbconfig) { __GLXdisplayPrivate *const priv = __glXInitialize(dpy); - const unsigned num_screens = ScreenCount(dpy); + int num_screens = ScreenCount(dpy); unsigned i; - const __GLcontextModes *modes; - + struct glx_config *config; if (priv != NULL) { for (i = 0; i < num_screens; i++) { - for (modes = priv->screenConfigs[i]->configs; modes != NULL; - modes = modes->next) { - if (modes == (__GLcontextModes *) config) { - return (__GLcontextModes *) config; - } - } + for (config = priv->screenConfigs[i]->configs; config != NULL; + config = config->next) { + if (config == (struct glx_config *) fbconfig) { + return config; + } + } } } @@ -240,8 +239,8 @@ static const struct glx_context_vtable applegl_context_vtable; static __GLcontext * applegl_create_context(__GLXscreenConfigs *psc, - const __GLcontextModes *mode, - GLXContext shareList, int renderType) + struct glx_config *mode, + GLXContext shareList, int renderType) { __GLXcontext *gc; int errorcode; @@ -296,7 +295,7 @@ applegl_create_context(__GLXscreenConfigs *psc, */ static GLXContext indirect_create_context(__GLXscreenConfigs *psc, - const __GLcontextModes *mode, + struct glx_config *mode, GLXContext shareList, int renderType) { GLXContext gc; @@ -416,7 +415,7 @@ indirect_create_screen(int screen, __GLXdisplayPrivate * priv) _X_HIDDEN Bool glx_context_init(__GLXcontext *gc, - __GLXscreenConfigs *psc, const __GLcontextModes *fbconfig) + __GLXscreenConfigs *psc, struct glx_config *config) { gc->majorOpcode = __glXSetupForCommand(psc->display->dpy); if (!gc->majorOpcode) @@ -424,7 +423,7 @@ glx_context_init(__GLXcontext *gc, gc->screen = psc->scr; gc->psc = psc; - gc->mode = fbconfig; + gc->config = config; gc->isDirect = GL_TRUE; return GL_TRUE; @@ -442,7 +441,7 @@ glx_context_init(__GLXcontext *gc, static GLXContext CreateContext(Display * dpy, int generic_id, - const __GLcontextModes * const fbconfig, + struct glx_config *config, GLXContext shareList, Bool allowDirect, unsigned code, int renderType, int screen) @@ -458,10 +457,9 @@ CreateContext(Display * dpy, int generic_id, gc = NULL; if (allowDirect && psc->vtable->create_context) - gc = psc->vtable->create_context(psc, fbconfig, - shareList, renderType); + gc = psc->vtable->create_context(psc, config, shareList, renderType); if (!gc) - gc = indirect_create_context(psc, fbconfig, shareList, renderType); + gc = indirect_create_context(psc, config, shareList, renderType); if (!gc) return NULL; @@ -539,14 +537,14 @@ PUBLIC GLXContext glXCreateContext(Display * dpy, XVisualInfo * vis, GLXContext shareList, Bool allowDirect) { - const __GLcontextModes *mode = NULL; + struct glx_config *config = NULL; int renderType = 0; #if defined(GLX_DIRECT_RENDERING) || defined(GLX_USE_APPLEGL) __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, vis->screen); - mode = _gl_context_modes_find_visual(psc->visuals, vis->visualid); - if (mode == NULL) { + config = glx_config_find_visual(psc->visuals, vis->visualid); + if (config == NULL) { xError error; error.errorCode = BadValue; @@ -559,10 +557,10 @@ glXCreateContext(Display * dpy, XVisualInfo * vis, return None; } - renderType = mode->rgbMode ? GLX_RGBA_TYPE : GLX_COLOR_INDEX_TYPE; + renderType = config->rgbMode ? GLX_RGBA_TYPE : GLX_COLOR_INDEX_TYPE; #endif - return CreateContext(dpy, vis->visualid, mode, shareList, allowDirect, + return CreateContext(dpy, vis->visualid, config, shareList, allowDirect, X_GLXCreateContext, renderType, vis->screen); } @@ -942,11 +940,11 @@ glXCreateGLXPixmap(Display * dpy, XVisualInfo * vis, Pixmap pixmap) #ifdef GLX_USE_APPLEGL int screen = vis->screen; __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen); - const __GLcontextModes *modes; + const struct glx_config *config; - modes = _gl_context_modes_find_visual(psc->visuals, vis->visualid); + config = _gl_context_modes_find_visual(psc->visuals, vis->visualid); - if(apple_glx_pixmap_create(dpy, vis->screen, pixmap, modes)) + if(apple_glx_pixmap_create(dpy, vis->screen, pixmap, config)) return None; return pixmap; @@ -980,13 +978,13 @@ glXCreateGLXPixmap(Display * dpy, XVisualInfo * vis, Pixmap pixmap) __GLXdisplayPrivate *const priv = __glXInitialize(dpy); __GLXDRIdrawable *pdraw; __GLXscreenConfigs *psc; - __GLcontextModes *modes; + struct glx_config *config; psc = priv->screenConfigs[vis->screen]; if (psc->driScreen == NULL) break; - modes = _gl_context_modes_find_visual(psc->visuals, vis->visualid); - pdraw = psc->driScreen->createDrawable(psc, pixmap, req->glxpixmap, modes); + config = glx_config_find_visual(psc->visuals, vis->visualid); + pdraw = psc->driScreen->createDrawable(psc, pixmap, req->glxpixmap, config); if (pdraw == NULL) { fprintf(stderr, "failed to create pixmap\n"); break; @@ -1123,16 +1121,16 @@ glXGetConfig(Display * dpy, XVisualInfo * vis, int attribute, { __GLXdisplayPrivate *priv; __GLXscreenConfigs *psc; - __GLcontextModes *modes; + struct glx_config *config; int status; status = GetGLXPrivScreenConfig(dpy, vis->screen, &priv, &psc); if (status == Success) { - modes = _gl_context_modes_find_visual(psc->visuals, vis->visualid); + config = glx_config_find_visual(psc->visuals, vis->visualid); /* Lookup attribute after first finding a match on the visual */ - if (modes != NULL) { - return _gl_get_context_mode_data(modes, attribute, value_return); + if (config != NULL) { + return glx_config_get(config, attribute, value_return); } status = GLX_BAD_VISUAL; @@ -1153,10 +1151,10 @@ glXGetConfig(Display * dpy, XVisualInfo * vis, int attribute, /************************************************************************/ static void -init_fbconfig_for_chooser(__GLcontextModes * config, +init_fbconfig_for_chooser(struct glx_config * config, GLboolean fbconfig_style_tags) { - memset(config, 0, sizeof(__GLcontextModes)); + memset(config, 0, sizeof(struct glx_config)); config->visualID = (XID) GLX_DONT_CARE; config->visualType = GLX_DONT_CARE; @@ -1222,8 +1220,8 @@ init_fbconfig_for_chooser(__GLcontextModes * config, * \param b Server specified config to test against \c a. */ static Bool -fbconfigs_compatible(const __GLcontextModes * const a, - const __GLcontextModes * const b) +fbconfigs_compatible(const struct glx_config * const a, + const struct glx_config * const b) { MATCH_DONT_CARE(doubleBufferMode); MATCH_DONT_CARE(visualType); @@ -1342,8 +1340,7 @@ fbconfigs_compatible(const __GLcontextModes * const a, * \sa qsort, glXChooseVisual, glXChooseFBConfig, glXChooseFBConfigSGIX */ static int -fbconfig_compare(const __GLcontextModes * const *const a, - const __GLcontextModes * const *const b) +fbconfig_compare(struct glx_config **a, struct glx_config **b) { /* The order of these comparisons must NOT change. It is defined by * the GLX 1.3 spec and ARB_multisample. @@ -1428,10 +1425,10 @@ fbconfig_compare(const __GLcontextModes * const *const a, * \sa glXChooseVisual, glXChooseFBConfig, glXChooseFBConfigSGIX */ static int -choose_visual(__GLcontextModes ** configs, int num_configs, +choose_visual(struct glx_config ** configs, int num_configs, const int *attribList, GLboolean fbconfig_style_tags) { - __GLcontextModes test_config; + struct glx_config test_config; int base; int i; @@ -1467,7 +1464,7 @@ choose_visual(__GLcontextModes ** configs, int num_configs, * specifications. */ - qsort(configs, base, sizeof(__GLcontextModes *), + qsort(configs, base, sizeof(struct glx_config *), (int (*)(const void *, const void *)) fbconfig_compare); return base; } @@ -1485,9 +1482,9 @@ glXChooseVisual(Display * dpy, int screen, int *attribList) XVisualInfo *visualList = NULL; __GLXdisplayPrivate *priv; __GLXscreenConfigs *psc; - __GLcontextModes test_config; - __GLcontextModes *modes; - const __GLcontextModes *best_config = NULL; + struct glx_config test_config; + struct glx_config *config; + struct glx_config *best_config = NULL; /* ** Get a list of all visuals, return if list is empty @@ -1514,26 +1511,23 @@ glXChooseVisual(Display * dpy, int screen, int *attribList) ** Otherwise, create an XVisualInfo list with just the selected X visual ** and return this. */ - for (modes = psc->visuals; modes != NULL; modes = modes->next) { - if (fbconfigs_compatible(&test_config, modes) - && ((best_config == NULL) - || - (fbconfig_compare - ((const __GLcontextModes * const *const) &modes, - &best_config) < 0))) { + for (config = psc->visuals; config != NULL; config = config->next) { + if (fbconfigs_compatible(&test_config, config) + && ((best_config == NULL) || + (fbconfig_compare (&config, &best_config) < 0))) { XVisualInfo visualTemplate; XVisualInfo *newList; int i; visualTemplate.screen = screen; - visualTemplate.visualid = modes->visualID; + visualTemplate.visualid = config->visualID; newList = XGetVisualInfo(dpy, VisualScreenMask | VisualIDMask, &visualTemplate, &i); if (newList) { Xfree(visualList); visualList = newList; - best_config = modes; + best_config = config; } } } @@ -1689,7 +1683,7 @@ glXImportContextEXT(Display *dpy, GLXContextID contextID) int propList[__GLX_MAX_CONTEXT_PROPS * 2], *pProp, nPropListBytes; int i, renderType; XID share; - __GLcontextModes *mode; + struct glx_config *mode; if (contextID == None || __glXIsDirect(dpy, contextID)) return NULL; @@ -1753,10 +1747,10 @@ glXImportContextEXT(Display *dpy, GLXContextID contextID) share = pProp[1]; break; case GLX_VISUAL_ID_EXT: - mode = _gl_context_modes_find_visual(psc->visuals, pProp[1]); + mode = glx_config_find_visual(psc->visuals, pProp[1]); break; case GLX_FBCONFIG_ID: - mode = _gl_context_modes_find_fbconfig(psc->configs, pProp[1]); + mode = glx_config_find_fbconfig(psc->configs, pProp[1]); break; case GLX_RENDER_TYPE: renderType = pProp[1]; @@ -1787,13 +1781,13 @@ glXQueryContext(Display * dpy, GLXContext ctx, int attribute, int *value) *value = ctx->share_xid; break; case GLX_VISUAL_ID_EXT: - *value = ctx->mode ? ctx->mode->visualID : None; + *value = ctx->config ? ctx->config->visualID : None; break; case GLX_SCREEN: *value = ctx->screen; break; case GLX_FBCONFIG_ID: - *value = ctx->mode ? ctx->mode->fbconfigID : None; + *value = ctx->config ? ctx->config->fbconfigID : None; break; case GLX_RENDER_TYPE: *value = ctx->renderType; @@ -1825,11 +1819,11 @@ PUBLIC GLXFBConfig * glXChooseFBConfig(Display * dpy, int screen, const int *attribList, int *nitems) { - __GLcontextModes **config_list; + struct glx_config **config_list; int list_size; - config_list = (__GLcontextModes **) + config_list = (struct glx_config **) glXGetFBConfigs(dpy, screen, &list_size); if ((config_list != NULL) && (list_size > 0) && (attribList != NULL)) { @@ -1846,15 +1840,14 @@ glXChooseFBConfig(Display * dpy, int screen, PUBLIC GLXContext -glXCreateNewContext(Display * dpy, GLXFBConfig config, +glXCreateNewContext(Display * dpy, GLXFBConfig fbconfig, int renderType, GLXContext shareList, Bool allowDirect) { - const __GLcontextModes *const fbconfig = - (const __GLcontextModes *const) config; + struct glx_config *config = (struct glx_config *) fbconfig; - return CreateContext(dpy, fbconfig->fbconfigID, fbconfig, shareList, - allowDirect, X_GLXCreateNewContext, renderType, - fbconfig->screen); + return CreateContext(dpy, config->fbconfigID, config, shareList, + allowDirect, X_GLXCreateNewContext, renderType, + config->screen); } @@ -1870,7 +1863,9 @@ PUBLIC GLXFBConfig * glXGetFBConfigs(Display * dpy, int screen, int *nelements) { __GLXdisplayPrivate *priv = __glXInitialize(dpy); - __GLcontextModes **config = NULL; + struct glx_config **config_list = NULL; + struct glx_config *config; + unsigned num_configs = 0; int i; *nelements = 0; @@ -1879,58 +1874,56 @@ glXGetFBConfigs(Display * dpy, int screen, int *nelements) && (priv->screenConfigs[screen]->configs != NULL) && (priv->screenConfigs[screen]->configs->fbconfigID != (int) GLX_DONT_CARE)) { - unsigned num_configs = 0; - __GLcontextModes *modes; - - for (modes = priv->screenConfigs[screen]->configs; modes != NULL; - modes = modes->next) { - if (modes->fbconfigID != (int) GLX_DONT_CARE) { + for (config = priv->screenConfigs[screen]->configs; config != NULL; + config = config->next) { + if (config->fbconfigID != (int) GLX_DONT_CARE) { num_configs++; } } - config = (__GLcontextModes **) Xmalloc(sizeof(__GLcontextModes *) - * num_configs); - if (config != NULL) { + config_list = Xmalloc(num_configs * sizeof *config_list); + if (config_list != NULL) { *nelements = num_configs; i = 0; - for (modes = priv->screenConfigs[screen]->configs; modes != NULL; - modes = modes->next) { - if (modes->fbconfigID != (int) GLX_DONT_CARE) { - config[i] = modes; + for (config = priv->screenConfigs[screen]->configs; config != NULL; + config = config->next) { + if (config->fbconfigID != (int) GLX_DONT_CARE) { + config_list[i] = config; i++; } } } } - return (GLXFBConfig *) config; + + return (GLXFBConfig *) config_list; } PUBLIC int -glXGetFBConfigAttrib(Display * dpy, GLXFBConfig config, +glXGetFBConfigAttrib(Display * dpy, GLXFBConfig fbconfig, int attribute, int *value) { - __GLcontextModes *const modes = ValidateGLXFBConfig(dpy, config); + struct glx_config *config = ValidateGLXFBConfig(dpy, fbconfig); + + if (config == NULL) + return GLXBadFBConfig; - return (modes != NULL) - ? _gl_get_context_mode_data(modes, attribute, value) - : GLXBadFBConfig; + return glx_config_get(config, attribute, value); } PUBLIC XVisualInfo * -glXGetVisualFromFBConfig(Display * dpy, GLXFBConfig config) +glXGetVisualFromFBConfig(Display * dpy, GLXFBConfig fbconfig) { XVisualInfo visualTemplate; - __GLcontextModes *fbconfig = (__GLcontextModes *) config; + struct glx_config *config = (struct glx_config *) fbconfig; int count; /* ** Get a list of all visuals, return if list is empty */ - visualTemplate.visualid = fbconfig->visualID; + visualTemplate.visualid = config->visualID; return XGetVisualInfo(dpy, VisualIDMask, &visualTemplate, &count); } @@ -2144,7 +2137,7 @@ PUBLIC GLX_ALIAS(XVisualInfo *, glXGetVisualFromFBConfigSGIX, PUBLIC GLXPixmap glXCreateGLXPixmapWithConfigSGIX(Display * dpy, - GLXFBConfigSGIX config, + GLXFBConfigSGIX fbconfig, Pixmap pixmap) { #ifndef GLX_USE_APPLEGL @@ -2154,19 +2147,19 @@ glXCreateGLXPixmapWithConfigSGIX(Display * dpy, CARD8 opcode; __GLXscreenConfigs *psc; #endif - const __GLcontextModes *const fbconfig = (__GLcontextModes *) config; + struct glx_config *config = (struct glx_config *) fbconfig; if ((dpy == NULL) || (config == NULL)) { return None; } #ifdef GLX_USE_APPLEGL - if(apple_glx_pixmap_create(dpy, fbconfig->screen, pixmap, fbconfig)) + if(apple_glx_pixmap_create(dpy, config->screen, pixmap, config)) return None; return pixmap; #else - psc = GetGLXScreenConfigs(dpy, fbconfig->screen); + psc = GetGLXScreenConfigs(dpy, config->screen); if ((psc != NULL) && __glXExtensionBitIsEnabled(psc, SGIX_fbconfig_bit)) { opcode = __glXSetupForCommand(dpy); @@ -2183,8 +2176,8 @@ glXCreateGLXPixmapWithConfigSGIX(Display * dpy, req->reqType = opcode; req->glxCode = X_GLXVendorPrivateWithReply; req->vendorCode = X_GLXvop_CreateGLXPixmapWithConfigSGIX; - req->screen = fbconfig->screen; - req->fbconfig = fbconfig->fbconfigID; + req->screen = config->screen; + req->fbconfig = config->fbconfigID; req->pixmap = pixmap; req->glxpixmap = xid = XAllocID(dpy); UnlockDisplay(dpy); @@ -2197,11 +2190,11 @@ glXCreateGLXPixmapWithConfigSGIX(Display * dpy, PUBLIC GLXContext glXCreateContextWithConfigSGIX(Display * dpy, - GLXFBConfigSGIX config, int renderType, + GLXFBConfigSGIX fbconfig, int renderType, GLXContext shareList, Bool allowDirect) { GLXContext gc = NULL; - const __GLcontextModes *const fbconfig = (__GLcontextModes *) config; + struct glx_config *config = (struct glx_config *) fbconfig; __GLXscreenConfigs *psc; @@ -2209,13 +2202,13 @@ glXCreateContextWithConfigSGIX(Display * dpy, return None; } - psc = GetGLXScreenConfigs(dpy, fbconfig->screen); + psc = GetGLXScreenConfigs(dpy, config->screen); if ((psc != NULL) && __glXExtensionBitIsEnabled(psc, SGIX_fbconfig_bit)) { - gc = CreateContext(dpy, fbconfig->fbconfigID, fbconfig, shareList, + gc = CreateContext(dpy, config->fbconfigID, config, shareList, allowDirect, X_GLXvop_CreateContextWithConfigSGIX, renderType, - fbconfig->screen); + config->screen); } return gc; @@ -2231,8 +2224,8 @@ glXGetFBConfigFromVisualSGIX(Display * dpy, XVisualInfo * vis) if ((GetGLXPrivScreenConfig(dpy, vis->screen, &priv, &psc) != Success) && __glXExtensionBitIsEnabled(psc, SGIX_fbconfig_bit) && (psc->configs->fbconfigID != (int) GLX_DONT_CARE)) { - return (GLXFBConfigSGIX) _gl_context_modes_find_visual(psc->configs, - vis->visualid); + return (GLXFBConfigSGIX) glx_config_find_visual(psc->configs, + vis->visualid); } return NULL; diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c index e8649b6765..416e9c42c5 100644 --- a/src/glx/glxcurrent.c +++ b/src/glx/glxcurrent.c @@ -303,7 +303,7 @@ FetchDRIDrawable(Display * dpy, GLXDrawable glxDrawable, GLXContext gc) return pdraw; pdraw = psc->driScreen->createDrawable(psc, glxDrawable, - glxDrawable, gc->mode); + glxDrawable, gc->config); if (__glxHashInsert(priv->drawHash, glxDrawable, pdraw)) { (*pdraw->destroyDrawable) (pdraw); return NULL; diff --git a/src/glx/glxext.c b/src/glx/glxext.c index 7612e5e834..8e8b362d10 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -208,14 +208,14 @@ FreeScreenConfigs(__GLXdisplayPrivate * priv) for (i = 0; i < screens; i++) { psc = priv->screenConfigs[i]; if (psc->configs) { - _gl_context_modes_destroy(psc->configs); + glx_config_destroy_list(psc->configs); if (psc->effectiveGLXexts) Xfree(psc->effectiveGLXexts); psc->configs = NULL; /* NOTE: just for paranoia */ } if (psc->visuals) { - _gl_context_modes_destroy(psc->visuals); - psc->visuals = NULL; /* NOTE: just for paranoia */ + glx_config_destroy_list(psc->visuals); + psc->visuals = NULL; /* NOTE: just for paranoia */ } Xfree((char *) psc->serverGLXexts); @@ -349,12 +349,27 @@ enum { }; +static GLint +convert_from_x_visual_type(int visualType) +{ + static const int glx_visual_types[] = { + GLX_STATIC_GRAY, GLX_GRAY_SCALE, + GLX_STATIC_COLOR, GLX_PSEUDO_COLOR, + GLX_TRUE_COLOR, GLX_DIRECT_COLOR + }; + + if (visualType < ARRAY_SIZE(glx_visual_types)) + return glx_visual_types[visualType]; + + return GLX_NONE; +} + /* * getVisualConfigs uses the !tagged_only path. * getFBConfigs uses the tagged_only path. */ _X_HIDDEN void -__glXInitializeVisualConfigFromTags(__GLcontextModes * config, int count, +__glXInitializeVisualConfigFromTags(struct glx_config * config, int count, const INT32 * bp, Bool tagged_only, Bool fbconfig_style_tags) { @@ -364,7 +379,7 @@ __glXInitializeVisualConfigFromTags(__GLcontextModes * config, int count, /* Copy in the first set of properties */ config->visualID = *bp++; - config->visualType = _gl_convert_from_x_visual_type(*bp++); + config->visualType = convert_from_x_visual_type(*bp++); config->rgbMode = *bp++; @@ -575,13 +590,13 @@ __glXInitializeVisualConfigFromTags(__GLcontextModes * config, int count, (config->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT; } -static __GLcontextModes * +static struct glx_config * createConfigsFromProperties(Display * dpy, int nvisuals, int nprops, int screen, GLboolean tagged_only) { INT32 buf[__GLX_TOTAL_CONFIG], *props; unsigned prop_size; - __GLcontextModes *modes, *m; + struct glx_config *modes, *m; int i; if (nprops == 0) @@ -594,7 +609,7 @@ createConfigsFromProperties(Display * dpy, int nvisuals, int nprops, return NULL; /* Allocate memory for our config structure */ - modes = _gl_context_modes_create(nvisuals, sizeof(__GLcontextModes)); + modes = glx_config_create_list(nvisuals); if (!modes) return NULL; -- 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/glcontextmodes.h') 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