diff options
Diffstat (limited to 'src/glx')
-rw-r--r-- | src/glx/XF86dri.c | 2 | ||||
-rw-r--r-- | src/glx/dri2.c | 31 | ||||
-rw-r--r-- | src/glx/dri2_glx.c | 48 | ||||
-rw-r--r-- | src/glx/dri_glx.c | 3 | ||||
-rw-r--r-- | src/glx/drisw_glx.c | 3 | ||||
-rw-r--r-- | src/glx/glcontextmodes.c | 42 | ||||
-rw-r--r-- | src/glx/glcontextmodes.h | 2 | ||||
-rw-r--r-- | src/glx/glx_pbuffer.c | 7 | ||||
-rw-r--r-- | src/glx/glxclient.h | 8 | ||||
-rw-r--r-- | src/glx/glxcmds.c | 294 | ||||
-rw-r--r-- | src/glx/glxext.c | 3 | ||||
-rw-r--r-- | src/glx/indirect.c | 3 | ||||
-rw-r--r-- | src/glx/indirect.h | 2 | ||||
-rw-r--r-- | src/glx/indirect_size.c | 4 | ||||
-rw-r--r-- | src/glx/indirect_size.h | 4 | ||||
-rw-r--r-- | src/glx/indirect_vertex_array.c | 3 | ||||
-rw-r--r-- | src/glx/indirect_vertex_program.c | 2 | ||||
-rw-r--r-- | src/glx/pixelstore.c | 2 |
18 files changed, 234 insertions, 229 deletions
diff --git a/src/glx/XF86dri.c b/src/glx/XF86dri.c index 248d96ac5d..fdbdd43000 100644 --- a/src/glx/XF86dri.c +++ b/src/glx/XF86dri.c @@ -45,7 +45,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "xf86dristr.h" -#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303 +#if defined(__GNUC__) # define PUBLIC __attribute__((visibility("default"))) # define USED __attribute__((used)) #else diff --git a/src/glx/dri2.c b/src/glx/dri2.c index 91053d3fb6..5de55cdbf2 100644 --- a/src/glx/dri2.c +++ b/src/glx/dri2.c @@ -81,15 +81,13 @@ static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay, dri2Info, dri2ExtensionName, &dri2ExtensionHooks, - 1, NULL) + 0, NULL) static Bool DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire) { XExtDisplayInfo *info = DRI2FindDisplay(dpy); XExtDisplayInfo *glx_info = __glXFindDisplay(dpy); - static int glx_event_base; - static Bool found_glx_info = False; XextCheckExtension(dpy, info, dri2ExtensionName, False); @@ -126,7 +124,15 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire) return True; } #endif +#ifdef DRI2_InvalidateBuffers + case DRI2_InvalidateBuffers: + { + xDRI2InvalidateBuffers *awire = (xDRI2InvalidateBuffers *)wire; + dri2InvalidateBuffers(dpy, awire->drawable); + return False; + } +#endif default: /* client doesn't support server event */ break; @@ -174,6 +180,7 @@ DRI2QueryVersion(Display * dpy, int *major, int *minor) XExtDisplayInfo *info = DRI2FindDisplay(dpy); xDRI2QueryVersionReply rep; xDRI2QueryVersionReq *req; + int i, nevents; XextCheckExtension(dpy, info, dri2ExtensionName, False); @@ -193,6 +200,24 @@ DRI2QueryVersion(Display * dpy, int *major, int *minor) UnlockDisplay(dpy); SyncHandle(); + switch (rep.minorVersion) { + case 1: + nevents = 0; + break; + case 2: + nevents = 1; + break; + case 3: + default: + nevents = 2; + break; + } + + for (i = 0; i < nevents; i++) { + XESetWireToEvent (dpy, info->codes->first_event + i, DRI2WireToEvent); + XESetEventToWire (dpy, info->codes->first_event + i, DRI2EventToWire); + } + return True; } diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 15a3ea5907..5b0f335db6 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -67,6 +67,7 @@ struct __GLXDRIdisplayPrivateRec int driMinor; int driPatch; int swapAvailable; + int invalidateAvailable; }; struct __GLXDRIcontextPrivateRec @@ -310,12 +311,18 @@ dri2WaitGL(__GLXDRIdrawable * pdraw) XFixesDestroyRegion(pdraw->psc->dpy, region); } - static void -dri2FlushFrontBuffer(__DRIdrawable * driDrawable, void *loaderPrivate) +dri2FlushFrontBuffer(__DRIdrawable *driDrawable, void *loaderPrivate) { - (void) driDrawable; - dri2WaitGL((__GLXDRIdrawable *) loaderPrivate); + __GLXDRIdrawablePrivate *pdraw = loaderPrivate; + __GLXdisplayPrivate *priv = __glXInitialize(pdraw->base.psc->dpy); + __GLXDRIdisplayPrivate *pdp = (__GLXDRIdisplayPrivate *)priv->dri2Display; + + /* Old servers don't send invalidate events */ + if (!pdp->invalidateAvailable) + dri2InvalidateBuffers(priv->dpy, pdraw->base.xDrawable); + + dri2WaitGL(loaderPrivate); } @@ -375,6 +382,10 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor, (*pdraw->psc->f->flush)(pdraw->driDrawable); #endif + /* Old servers don't send invalidate events */ + if (!pdp->invalidateAvailable) + dri2InvalidateBuffers(dpyPriv->dpy, pdraw->xDrawable); + /* Old servers can't handle swapbuffers */ if (!pdp->swapAvailable) { dri2CopySubBuffer(pdraw, 0, 0, priv->width, priv->height); @@ -386,11 +397,6 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor, remainder, &ret); #endif -#if __DRI2_FLUSH_VERSION >= 2 - if (pdraw->psc->f) - (*pdraw->psc->f->flushInvalidate)(pdraw->driDrawable); -#endif - return ret; } @@ -485,6 +491,17 @@ static const __DRIextension *loader_extensions_old[] = { NULL }; +_X_HIDDEN void +dri2InvalidateBuffers(Display *dpy, XID drawable) +{ + __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL); + +#if __DRI2_FLUSH_VERSION >= 3 + if (pdraw && pdraw->psc->f) + pdraw->psc->f->invalidate(pdraw->driDrawable); +#endif +} + static __GLXDRIscreen * dri2CreateScreen(__GLXscreenConfigs * psc, int screen, __GLXdisplayPrivate * priv) @@ -502,9 +519,6 @@ dri2CreateScreen(__GLXscreenConfigs * psc, int screen, if (psp == NULL) return NULL; - /* Initialize per screen dynamic client GLX extensions */ - psc->ext_list_first_time = GL_TRUE; - if (!DRI2Connect(psc->dpy, RootWindow(psc->dpy, screen), &driverName, &deviceName)) { XFree(psp); @@ -597,6 +611,9 @@ dri2CreateScreen(__GLXscreenConfigs * psc, int screen, psp->setSwapInterval = dri2SetSwapInterval; psp->getSwapInterval = dri2GetSwapInterval; #endif +#if defined(X_DRI2GetMSC) && defined(X_DRI2WaitMSC) && defined(X_DRI2SwapInterval) + __glXEnableDirectExtension(psc, "GLX_OML_sync_control"); +#endif } /* DRI2 suports SubBuffer through DRI2CopyRegion, so it's always @@ -651,11 +668,8 @@ dri2CreateDisplay(Display * dpy) } pdp->driPatch = 0; - pdp->swapAvailable = 0; -#ifdef X_DRI2SwapBuffers - if (pdp->driMinor >= 2) - pdp->swapAvailable = 1; -#endif + pdp->swapAvailable = (pdp->driMinor >= 2); + pdp->invalidateAvailable = (pdp->driMinor >= 3); pdp->base.destroyDisplay = dri2DestroyDisplay; pdp->base.createScreen = dri2CreateScreen; diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c index f9fe9a25db..e47db82b70 100644 --- a/src/glx/dri_glx.c +++ b/src/glx/dri_glx.c @@ -648,9 +648,6 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen, if (psp == NULL) return NULL; - /* Initialize per screen dynamic client GLX extensions */ - psc->ext_list_first_time = GL_TRUE; - if (!driGetDriverName(priv->dpy, screen, &driverName)) { Xfree(psp); return NULL; diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index eed9a8c472..1b94a56fd1 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -364,9 +364,6 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen, if (psp == NULL) return NULL; - /* Initialize per screen dynamic client GLX extensions */ - psc->ext_list_first_time = GL_TRUE; - psc->driver = driOpenDriver(driverName); if (psc->driver == NULL) goto handle_error; diff --git a/src/glx/glcontextmodes.c b/src/glx/glcontextmodes.c index 232031c2ca..eb9037907f 100644 --- a/src/glx/glcontextmodes.c +++ b/src/glx/glcontextmodes.c @@ -31,42 +31,13 @@ * \author Ian Romanick <idr@us.ibm.com> */ -#if defined(IN_MINI_GLX) -#include <GL/gl.h> -#else -#if defined(HAVE_DIX_CONFIG_H) -# include <dix-config.h> -#endif -#include <X11/X.h> #include <GL/glx.h> #include "GL/glxint.h" -#endif - -/* Memory macros */ -#if defined(IN_MINI_GLX) -# include <stdlib.h> -# include <string.h> -# define _mesa_malloc(b) malloc(b) -# define _mesa_free(m) free(m) -# define _mesa_memset memset -#else -# ifdef XFree86Server -# include <os.h> -# include <string.h> -# define _mesa_malloc(b) xalloc(b) -# define _mesa_free(m) xfree(m) -# define _mesa_memset memset -# else -# include <X11/Xlibint.h> -# define _mesa_memset memset -# define _mesa_malloc(b) Xmalloc(b) -# define _mesa_free(m) Xfree(m) -# endif /* XFree86Server */ -#endif /* !defined(IN_MINI_GLX) */ +#include <stdlib.h> +#include <string.h> #include "glcontextmodes.h" -#if !defined(IN_MINI_GLX) #define NUM_VISUAL_TYPES 6 /** @@ -133,7 +104,7 @@ _gl_copy_visual_to_context_mode(__GLcontextModes * mode, { __GLcontextModes *const next = mode->next; - (void) _mesa_memset(mode, 0, sizeof(__GLcontextModes)); + (void) memset(mode, 0, sizeof(__GLcontextModes)); mode->next = next; mode->visualID = config->vid; @@ -355,7 +326,6 @@ _gl_get_context_mode_data(const __GLcontextModes * mode, int attribute, return GLX_BAD_ATTRIBUTE; } } -#endif /* !defined(IN_MINI_GLX) */ /** @@ -395,14 +365,14 @@ _gl_context_modes_create(unsigned count, size_t minimum_size) next = &base; for (i = 0; i < count; i++) { - *next = (__GLcontextModes *) _mesa_malloc(size); + *next = (__GLcontextModes *) malloc(size); if (*next == NULL) { _gl_context_modes_destroy(base); base = NULL; break; } - (void) _mesa_memset(*next, 0, size); + (void) memset(*next, 0, size); (*next)->visualID = GLX_DONT_CARE; (*next)->visualType = GLX_DONT_CARE; (*next)->visualRating = GLX_NONE; @@ -441,7 +411,7 @@ _gl_context_modes_destroy(__GLcontextModes * modes) while (modes != NULL) { __GLcontextModes *const next = modes->next; - _mesa_free(modes); + free(modes); modes = next; } } diff --git a/src/glx/glcontextmodes.h b/src/glx/glcontextmodes.h index 6676ae306c..ecf0280cba 100644 --- a/src/glx/glcontextmodes.h +++ b/src/glx/glcontextmodes.h @@ -32,14 +32,12 @@ #include "GL/internal/glcore.h" -#if !defined(IN_MINI_GLX) extern GLint _gl_convert_from_x_visual_type(int visualType); extern GLint _gl_convert_to_x_visual_type(int visualType); extern void _gl_copy_visual_to_context_mode(__GLcontextModes * mode, const __GLXvisualConfig * config); extern int _gl_get_context_mode_data(const __GLcontextModes * mode, int attribute, int *value_return); -#endif /* !defined(IN_MINI_GLX) */ extern __GLcontextModes *_gl_context_modes_create(unsigned count, size_t minimum_size); diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c index a0a02238b0..52e067165c 100644 --- a/src/glx/glx_pbuffer.c +++ b/src/glx/glx_pbuffer.c @@ -186,10 +186,6 @@ DestroyPbuffer(Display * dpy, GLXDrawable drawable) #ifdef GLX_DIRECT_RENDERING -extern __GLXDRIdrawable *GetGLXDRIDrawable(Display * dpy, - GLXDrawable drawable, - int *const scrn_num); - static GLenum determineTextureTarget(const int *attribs, int numAttribs) { @@ -383,7 +379,8 @@ CreateDrawable(Display * dpy, const __GLcontextModes * fbconfig, req->glxwindow = (GLXWindow) XAllocID(dpy); req->numAttribs = (CARD32) i; - memcpy(data, attrib_list, 8 * i); + if (attrib_list) + memcpy(data, attrib_list, 8 * i); UnlockDisplay(dpy); SyncHandle(); diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index e0b286b688..8e5dc785dd 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -69,7 +69,7 @@ * We also need to define a USED attribute, so the optimizer doesn't * inline a static function that we later use in an alias. - ajax */ -#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303 +#if defined(__GNUC__) # define PUBLIC __attribute__((visibility("default"))) # define USED __attribute__((used)) #else @@ -182,6 +182,8 @@ struct __GLXDRIdrawableRec extern __GLXDRIdisplay *driswCreateDisplay(Display * dpy); extern __GLXDRIdisplay *driCreateDisplay(Display * dpy); extern __GLXDRIdisplay *dri2CreateDisplay(Display * dpy); +extern void dri2InvalidateBuffers(Display *dpy, XID drawable); + extern void DRI_glXUseXFont(Font font, int first, int count, int listbase); @@ -798,6 +800,10 @@ __driGetMscRateOML(__DRIdrawable * draw, /* So that dri2.c:DRI2WireToEvent() can access * glx_info->codes->first_event */ XExtDisplayInfo *__glXFindDisplay (Display *dpy); + +extern __GLXDRIdrawable * +GetGLXDRIDrawable(Display *dpy, GLXDrawable drawable, int *const scrn_num); + #endif #endif /* !__GLX_client_h__ */ diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index c3be974ea9..49cbce72f8 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -42,6 +42,9 @@ #include <sys/time.h> #include <X11/extensions/xf86vmode.h> #include "xf86dri.h" +#define GC_IS_DIRECT(gc) ((gc)->driContext != NULL) +#else +#define GC_IS_DIRECT(gc) (0) #endif #if defined(USE_XCB) @@ -62,6 +65,8 @@ static Bool windowExistsFlag; static int windowExistsErrorHandler(Display * dpy, XErrorEvent * xerr) { + (void) dpy; + if (xerr->error_code == BadWindow) { windowExistsFlag = GL_FALSE; } @@ -105,10 +110,6 @@ GarbageCollectDRIDrawables(Display * dpy, __GLXscreenConfigs * sc) XSetErrorHandler(oldXErrorHandler); } -extern __GLXDRIdrawable *GetGLXDRIDrawable(Display * dpy, - GLXDrawable drawable, - int *const scrn_num); - /** * Get the __DRIdrawable for the drawable associated with a GLXContext * @@ -357,137 +358,105 @@ AllocateGLXContext(Display * dpy) */ static GLXContext -CreateContext(Display * dpy, XVisualInfo * vis, +CreateContext(Display * dpy, int generic_id, const __GLcontextModes * const fbconfig, GLXContext shareList, - Bool allowDirect, GLXContextID contextID, - Bool use_glx_1_3, int renderType) + Bool allowDirect, + unsigned code, int renderType, int screen) { GLXContext gc; #ifdef GLX_DIRECT_RENDERING - int screen = (fbconfig == NULL) ? vis->screen : fbconfig->screen; __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen); #endif if (dpy == NULL) return NULL; + if (generic_id == None) + return NULL; + gc = AllocateGLXContext(dpy); if (!gc) return NULL; - if (None == contextID) { - if ((vis == NULL) && (fbconfig == NULL)) - return NULL; - #ifdef GLX_DIRECT_RENDERING - if (allowDirect && psc->driScreen) { - const __GLcontextModes *mode; - - if (fbconfig == NULL) { - mode = _gl_context_modes_find_visual(psc->visuals, vis->visualid); - if (mode == NULL) { - xError error; - - error.errorCode = BadValue; - error.resourceID = vis->visualid; - error.sequenceNumber = dpy->request; - error.type = X_Error; - error.majorCode = gc->majorOpcode; - error.minorCode = X_GLXCreateContext; - _XError(dpy, &error); - return None; - } - if (renderType == 0) { - /* Initialize renderType now */ - renderType = mode->rgbMode ? GLX_RGBA_TYPE : GLX_COLOR_INDEX_TYPE; - } - } - else { - mode = fbconfig; - } - - gc->driContext = psc->driScreen->createContext(psc, mode, gc, - shareList, - renderType); - if (gc->driContext != NULL) { - gc->screen = mode->screen; - gc->psc = psc; - gc->mode = mode; - gc->isDirect = GL_TRUE; - } + if (allowDirect && psc->driScreen) { + gc->driContext = psc->driScreen->createContext(psc, fbconfig, gc, + shareList, renderType); + if (gc->driContext != NULL) { + gc->screen = screen; + gc->psc = psc; + gc->mode = fbconfig; + gc->isDirect = GL_TRUE; } + } #endif - LockDisplay(dpy); - if (fbconfig == NULL) { - xGLXCreateContextReq *req; - - /* Send the glXCreateContext request */ - GetReq(GLXCreateContext, req); - req->reqType = gc->majorOpcode; - req->glxCode = X_GLXCreateContext; - req->context = gc->xid = XAllocID(dpy); - req->visual = vis->visualid; - req->screen = vis->screen; - req->shareList = shareList ? shareList->xid : None; -#ifdef GLX_DIRECT_RENDERING - req->isDirect = gc->driContext != NULL; -#else - req->isDirect = 0; -#endif - } - else if (use_glx_1_3) { - xGLXCreateNewContextReq *req; - - /* Send the glXCreateNewContext request */ - GetReq(GLXCreateNewContext, req); - req->reqType = gc->majorOpcode; - req->glxCode = X_GLXCreateNewContext; - req->context = gc->xid = XAllocID(dpy); - req->fbconfig = fbconfig->fbconfigID; - req->screen = fbconfig->screen; - req->renderType = renderType; - req->shareList = shareList ? shareList->xid : None; -#ifdef GLX_DIRECT_RENDERING - req->isDirect = gc->driContext != NULL; -#else - req->isDirect = 0; -#endif - } - else { - xGLXVendorPrivateWithReplyReq *vpreq; - xGLXCreateContextWithConfigSGIXReq *req; - - /* Send the glXCreateNewContext request */ - GetReqExtra(GLXVendorPrivateWithReply, - sz_xGLXCreateContextWithConfigSGIXReq - - sz_xGLXVendorPrivateWithReplyReq, vpreq); - req = (xGLXCreateContextWithConfigSGIXReq *) vpreq; - req->reqType = gc->majorOpcode; - req->glxCode = X_GLXVendorPrivateWithReply; - req->vendorCode = X_GLXvop_CreateContextWithConfigSGIX; - req->context = gc->xid = XAllocID(dpy); - req->fbconfig = fbconfig->fbconfigID; - req->screen = fbconfig->screen; - req->renderType = renderType; - req->shareList = shareList ? shareList->xid : None; -#ifdef GLX_DIRECT_RENDERING - req->isDirect = gc->driContext != NULL; -#else - req->isDirect = 0; -#endif - } + LockDisplay(dpy); + switch (code) { + case X_GLXCreateContext: { + xGLXCreateContextReq *req; + + /* Send the glXCreateContext request */ + GetReq(GLXCreateContext, req); + req->reqType = gc->majorOpcode; + req->glxCode = X_GLXCreateContext; + req->context = gc->xid = XAllocID(dpy); + req->visual = generic_id; + req->screen = screen; + req->shareList = shareList ? shareList->xid : None; + req->isDirect = GC_IS_DIRECT(gc); + break; + } - UnlockDisplay(dpy); - SyncHandle(); - gc->imported = GL_FALSE; + case X_GLXCreateNewContext: { + xGLXCreateNewContextReq *req; + + /* Send the glXCreateNewContext request */ + GetReq(GLXCreateNewContext, req); + req->reqType = gc->majorOpcode; + req->glxCode = X_GLXCreateNewContext; + req->context = gc->xid = XAllocID(dpy); + req->fbconfig = generic_id; + req->screen = screen; + req->renderType = renderType; + req->shareList = shareList ? shareList->xid : None; + req->isDirect = GC_IS_DIRECT(gc); + break; } - else { - gc->xid = contextID; - gc->imported = GL_TRUE; + + case X_GLXvop_CreateContextWithConfigSGIX: { + xGLXVendorPrivateWithReplyReq *vpreq; + xGLXCreateContextWithConfigSGIXReq *req; + + /* Send the glXCreateNewContext request */ + GetReqExtra(GLXVendorPrivateWithReply, + sz_xGLXCreateContextWithConfigSGIXReq - + sz_xGLXVendorPrivateWithReplyReq, vpreq); + req = (xGLXCreateContextWithConfigSGIXReq *) vpreq; + req->reqType = gc->majorOpcode; + req->glxCode = X_GLXVendorPrivateWithReply; + req->vendorCode = X_GLXvop_CreateContextWithConfigSGIX; + req->context = gc->xid = XAllocID(dpy); + req->fbconfig = generic_id; + req->screen = screen; + req->renderType = renderType; + req->shareList = shareList ? shareList->xid : None; + req->isDirect = GC_IS_DIRECT(gc); + break; + } + + default: + /* What to do here? This case is the sign of an internal error. It + * should never be reachable. + */ + break; } + UnlockDisplay(dpy); + SyncHandle(); + + gc->imported = GL_FALSE; gc->renderType = renderType; return gc; @@ -497,8 +466,31 @@ PUBLIC GLXContext glXCreateContext(Display * dpy, XVisualInfo * vis, GLXContext shareList, Bool allowDirect) { - return CreateContext(dpy, vis, NULL, shareList, allowDirect, None, - False, 0); + const __GLcontextModes *mode = NULL; + int renderType = 0; + +#ifdef GLX_DIRECT_RENDERING + __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, vis->screen); + + mode = _gl_context_modes_find_visual(psc->visuals, vis->visualid); + if (mode == NULL) { + xError error; + + error.errorCode = BadValue; + error.resourceID = vis->visualid; + error.sequenceNumber = dpy->request; + error.type = X_Error; + error.majorCode = __glXSetupForCommand(dpy); + error.minorCode = X_GLXCreateContext; + _XError(dpy, &error); + return None; + } + + renderType = mode->rgbMode ? GLX_RGBA_TYPE : GLX_COLOR_INDEX_TYPE; +#endif + + return CreateContext(dpy, vis->visualid, mode, shareList, allowDirect, + X_GLXCreateContext, renderType, vis->screen); } _X_HIDDEN void @@ -864,11 +856,9 @@ glXIsDirect(Display * dpy, GLXContext gc) { if (!gc) { return GL_FALSE; -#ifdef GLX_DIRECT_RENDERING } - else if (gc->driContext) { + else if (GC_IS_DIRECT(gc)) { return GL_TRUE; -#endif } return __glXIsDirect(dpy, gc->xid); } @@ -1099,7 +1089,7 @@ init_fbconfig_for_chooser(__GLcontextModes * config, #define MATCH_DONT_CARE( param ) \ do { \ - if ( (a-> param != GLX_DONT_CARE) \ + if ( ((int) a-> param != (int) GLX_DONT_CARE) \ && (a-> param != b-> param) ) { \ return False; \ } \ @@ -1107,7 +1097,7 @@ init_fbconfig_for_chooser(__GLcontextModes * config, #define MATCH_MINIMUM( param ) \ do { \ - if ( (a-> param != GLX_DONT_CARE) \ + if ( ((int) a-> param != (int) GLX_DONT_CARE) \ && (a-> param > b-> param) ) { \ return False; \ } \ @@ -1174,7 +1164,7 @@ fbconfigs_compatible(const __GLcontextModes * const a, * the (broken) drivers. */ - if (a->transparentPixel != GLX_DONT_CARE && a->transparentPixel != 0) { + if (a->transparentPixel != (int) GLX_DONT_CARE && a->transparentPixel != 0) { if (a->transparentPixel == GLX_NONE) { if (b->transparentPixel != GLX_NONE && b->transparentPixel != 0) return False; @@ -1482,6 +1472,8 @@ glXQueryExtensionsString(Display * dpy, int screen) PUBLIC const char * glXGetClientString(Display * dpy, int name) { + (void) dpy; + switch (name) { case GLX_VENDOR: return (__glXGLXClientVendorName); @@ -1643,7 +1635,6 @@ static int __glXQueryContextInfo(Display * dpy, GLXContext ctx) else { int *propList, *pProp; int nPropListBytes; - int i; nPropListBytes = numValues << 3; propList = (int *) Xmalloc(nPropListBytes); @@ -1651,6 +1642,8 @@ static int __glXQueryContextInfo(Display * dpy, GLXContext ctx) retval = 0; } else { + unsigned i; + _XRead(dpy, (char *) propList, nPropListBytes); pProp = propList; for (i = 0; i < numValues; i++) { @@ -1746,10 +1739,14 @@ glXImportContextEXT(Display * dpy, GLXContextID contextID) return NULL; } - ctx = CreateContext(dpy, NULL, NULL, NULL, False, contextID, False, 0); + ctx = AllocateGLXContext(dpy); if (NULL != ctx) { + ctx->xid = contextID; + ctx->imported = GL_TRUE; + if (Success != __glXQueryContextInfo(dpy, ctx)) { - return NULL; + __glXFreeContext(ctx); + ctx = NULL; } } return ctx; @@ -1795,8 +1792,12 @@ PUBLIC GLXContext glXCreateNewContext(Display * dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool allowDirect) { - return CreateContext(dpy, NULL, (__GLcontextModes *) config, shareList, - allowDirect, None, True, renderType); + const __GLcontextModes *const fbconfig = + (const __GLcontextModes *const) config; + + return CreateContext(dpy, fbconfig->fbconfigID, fbconfig, shareList, + allowDirect, X_GLXCreateNewContext, renderType, + fbconfig->screen); } @@ -1819,14 +1820,15 @@ glXGetFBConfigs(Display * dpy, int screen, int *nelements) if (priv && (priv->screenConfigs != NULL) && (screen >= 0) && (screen <= ScreenCount(dpy)) && (priv->screenConfigs[screen].configs != NULL) - && (priv->screenConfigs[screen].configs->fbconfigID != GLX_DONT_CARE)) { + && (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 != GLX_DONT_CARE) { + if (modes->fbconfigID != (int) GLX_DONT_CARE) { num_configs++; } } @@ -1838,7 +1840,7 @@ glXGetFBConfigs(Display * dpy, int screen, int *nelements) i = 0; for (modes = priv->screenConfigs[screen].configs; modes != NULL; modes = modes->next) { - if (modes->fbconfigID != GLX_DONT_CARE) { + if (modes->fbconfigID != (int) GLX_DONT_CARE) { config[i] = modes; i++; } @@ -1956,10 +1958,6 @@ __glXSwapIntervalMESA(unsigned int interval) { GLXContext gc = __glXGetCurrentContext(); - if (interval < 0) { - return GLX_BAD_VALUE; - } - #ifdef __DRI_SWAP_CONTROL if (gc != NULL && gc->driContext) { __GLXscreenConfigs *const psc = GetGLXScreenConfigs(gc->currentDpy, @@ -2286,8 +2284,10 @@ glXCreateContextWithConfigSGIX(Display * dpy, psc = GetGLXScreenConfigs(dpy, fbconfig->screen); if ((psc != NULL) && __glXExtensionBitIsEnabled(psc, SGIX_fbconfig_bit)) { - gc = CreateContext(dpy, NULL, (__GLcontextModes *) config, shareList, - allowDirect, None, False, renderType); + gc = CreateContext(dpy, fbconfig->fbconfigID, fbconfig, shareList, + allowDirect, + X_GLXvop_CreateContextWithConfigSGIX, renderType, + fbconfig->screen); } return gc; @@ -2302,7 +2302,7 @@ glXGetFBConfigFromVisualSGIX(Display * dpy, XVisualInfo * vis) if ((GetGLXPrivScreenConfig(dpy, vis->screen, &priv, &psc) != Success) && __glXExtensionBitIsEnabled(psc, SGIX_fbconfig_bit) - && (psc->configs->fbconfigID != GLX_DONT_CARE)) { + && (psc->configs->fbconfigID != (int) GLX_DONT_CARE)) { return (GLXFBConfigSGIX) _gl_context_modes_find_visual(psc->configs, vis->visualid); } @@ -2364,7 +2364,7 @@ __glXGetSyncValuesOML(Display * dpy, GLXDrawable drawable, psc = &priv->screenConfigs[i]; #if defined(__DRI_SWAP_BUFFER_COUNTER) && defined(__DRI_MEDIA_STREAM_COUNTER) - if (pdraw && psc->sbc && psc->sbc) + if (pdraw && psc->sbc && psc->msc) return ( (pdraw && psc->sbc && psc->msc) && ((*psc->msc->getMSC)(psc->driScreen, msc) == 0) && ((*psc->sbc->getSBC)(pdraw->driDrawable, sbc) == 0) @@ -2390,6 +2390,8 @@ __driGetMscRateOML(__DRIdrawable * draw, int i; __GLXDRIdrawable *glxDraw = private; + (void) draw; + psc = glxDraw->psc; if (XF86VidModeQueryVersion(psc->dpy, &i, &i) && XF86VidModeGetModeLine(psc->dpy, psc->scr, &dot_clock, &mode_line)) { @@ -2436,6 +2438,11 @@ __driGetMscRateOML(__DRIdrawable * draw, else return False; #else + (void) draw; + (void) numerator; + (void) denominator; + (void) private; + return False; #endif } @@ -2487,7 +2494,7 @@ __glXSwapBuffersMscOML(Display * dpy, GLXDrawable drawable, __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen); __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen); - if (!pdraw || !gc->driContext) /* no GLX for this */ + if (!pdraw || !gc || !gc->driContext) /* no GLX for this */ return -1; /* The OML_sync_control spec says these should "generate a GLX_BAD_VALUE @@ -2527,8 +2534,6 @@ __glXWaitForMscOML(Display * dpy, GLXDrawable drawable, __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, screen ); int ret; - fprintf(stderr, "waitmsc: %lld, %lld, %lld\n", target_msc, divisor, - remainder); /* The OML_sync_control spec says these should "generate a GLX_BAD_VALUE * error", but the return type in the spec is Bool. @@ -2540,7 +2545,6 @@ __glXWaitForMscOML(Display * dpy, GLXDrawable drawable, #ifdef __DRI_MEDIA_STREAM_COUNTER if (pdraw != NULL && psc->msc != NULL) { - fprintf(stderr, "dri1 msc\n"); ret = (*psc->msc->waitForMSC) (pdraw->driDrawable, target_msc, divisor, remainder, msc, sbc); @@ -2556,7 +2560,6 @@ __glXWaitForMscOML(Display * dpy, GLXDrawable drawable, return ret; } - fprintf(stderr, "no drawable??\n"); return False; } @@ -2587,7 +2590,7 @@ __glXWaitForSbcOML(Display * dpy, GLXDrawable drawable, return ((ret == 0) && (__glXGetUST(ust) == 0)); } #endif - if (pdraw && psc->driScreen && psc->driScreen->waitForMSC) { + if (pdraw && psc->driScreen && psc->driScreen->waitForSBC) { ret = psc->driScreen->waitForSBC(pdraw, target_sbc, ust, msc, sbc); return ret; } @@ -2874,14 +2877,9 @@ __glXReleaseTexImageEXT(Display * dpy, GLXDrawable drawable, int buffer) INT32 *buffer_ptr; CARD8 opcode; - if (gc == NULL) + if ((gc == NULL) || GC_IS_DIRECT(gc)) return; -#ifdef GLX_DIRECT_RENDERING - if (gc->driContext) - return; -#endif - opcode = __glXSetupForCommand(dpy); if (!opcode) return; diff --git a/src/glx/glxext.c b/src/glx/glxext.c index c2de1a3fff..b5657baf2e 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -717,6 +717,9 @@ AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv) if (psc->drawHash == NULL) continue; + /* Initialize per screen dynamic client GLX extensions */ + psc->ext_list_first_time = GL_TRUE; + if (priv->dri2Display) psc->driScreen = (*priv->dri2Display->createScreen) (psc, i, priv); diff --git a/src/glx/indirect.c b/src/glx/indirect.c index 48bae1478f..42a225f671 100644 --- a/src/glx/indirect.c +++ b/src/glx/indirect.c @@ -30,7 +30,6 @@ #include "indirect.h" #include "glxclient.h" #include "indirect_size.h" -#include "glapitable.h" #include "glapidispatch.h" #include "glapi.h" #include "glthread.h" @@ -54,7 +53,7 @@ # define NOINLINE # endif -#if !defined __GNUC__ || __GNUC__ < 3 +#ifndef __GNUC__ # define __builtin_expect(x, y) x #endif diff --git a/src/glx/indirect.h b/src/glx/indirect.h index 9e73b33818..b09b61aae7 100644 --- a/src/glx/indirect.h +++ b/src/glx/indirect.h @@ -37,7 +37,7 @@ * \author Ian Romanick <idr@us.ibm.com> */ -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__) +# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) && defined(__ELF__) # define HIDDEN __attribute__((visibility("hidden"))) # else # define HIDDEN diff --git a/src/glx/indirect_size.c b/src/glx/indirect_size.c index 6356ddd49b..0c136d26cd 100644 --- a/src/glx/indirect_size.c +++ b/src/glx/indirect_size.c @@ -29,7 +29,7 @@ #include <GL/gl.h> #include "indirect_size.h" -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) +# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define PURE __attribute__((pure)) # else # define PURE @@ -41,7 +41,7 @@ # define FASTCALL # endif -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__) +# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) && defined(__ELF__) # define INTERNAL __attribute__((visibility("internal"))) # else # define INTERNAL diff --git a/src/glx/indirect_size.h b/src/glx/indirect_size.h index af0919f964..79b849b683 100644 --- a/src/glx/indirect_size.h +++ b/src/glx/indirect_size.h @@ -36,7 +36,7 @@ * \author Ian Romanick <idr@us.ibm.com> */ -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) +# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define PURE __attribute__((pure)) # else # define PURE @@ -48,7 +48,7 @@ # define FASTCALL # endif -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__) +# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) && defined(__ELF__) # define INTERNAL __attribute__((visibility("internal"))) # else # define INTERNAL diff --git a/src/glx/indirect_vertex_array.c b/src/glx/indirect_vertex_array.c index ad9882528f..ec0e654cea 100644 --- a/src/glx/indirect_vertex_array.c +++ b/src/glx/indirect_vertex_array.c @@ -291,7 +291,8 @@ __glXInitVertexArrayState(__GLXcontext * gc) arrays->stack_index = 0; arrays->stack = malloc(sizeof(struct array_stack_state) - * arrays->num_arrays); + * arrays->num_arrays + * __GL_CLIENT_ATTRIB_STACK_DEPTH); } diff --git a/src/glx/indirect_vertex_program.c b/src/glx/indirect_vertex_program.c index 3313ac008a..d822a7ee56 100644 --- a/src/glx/indirect_vertex_program.c +++ b/src/glx/indirect_vertex_program.c @@ -30,7 +30,7 @@ #include "indirect_vertex_array.h" #include <GL/glxproto.h> -#if !defined __GNUC__ || __GNUC__ < 3 +#if !defined(__GNUC__) # define __builtin_expect(x, y) x #endif diff --git a/src/glx/pixelstore.c b/src/glx/pixelstore.c index 8b51b5d8b7..dc193b9f74 100644 --- a/src/glx/pixelstore.c +++ b/src/glx/pixelstore.c @@ -31,7 +31,7 @@ #include "glxclient.h" #include "indirect.h" -#if !defined __GNUC__ || __GNUC__ < 3 +#if !defined(__GNUC__) # define __builtin_expect(x, y) x #endif |