summaryrefslogtreecommitdiff
path: root/src/glx
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@vmware.com>2009-01-22 09:43:42 +0000
committerAlan Hourihane <alanh@vmware.com>2009-01-22 09:43:42 +0000
commit4df482086ebf0663c708b089d8d8d22de0ef972c (patch)
treee802cc36b266bfdeb80ab9e55643c50f5a5e6d9c /src/glx
parent01cbd764962ff49bf104e5997914ced53360ef81 (diff)
parentb8bd0b0ddc357f9b430bb6ddeb60c5a2179d3791 (diff)
Merge commit 'origin/master' into gallium-0.2
Conflicts: windows/VC8/mesa/osmesa/osmesa.vcproj windows/VC8/progs/demos/gears.vcproj windows/VC8/progs/progs.sln
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/x11/glxcmds.c10
-rw-r--r--src/glx/x11/glxcurrent.c46
2 files changed, 32 insertions, 24 deletions
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index 1d373ed29d..c68b6ac4ef 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -864,6 +864,12 @@ PUBLIC void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
GLXContext gc;
GLXContextTag tag;
CARD8 opcode;
+#ifdef USE_XCB
+ xcb_connection_t *c;
+#else
+ xGLXSwapBuffersReq *req;
+#endif
+
#ifdef GLX_DIRECT_RENDERING
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
@@ -892,12 +898,10 @@ PUBLIC void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
}
#ifdef USE_XCB
- xcb_connection_t* c = XGetXCBConnection(dpy);
+ c = XGetXCBConnection(dpy);
xcb_glx_swap_buffers(c, tag, drawable);
xcb_flush(c);
#else
- xGLXSwapBuffersReq *req;
-
/* Send the glXSwapBuffers request */
LockDisplay(dpy);
GetReq(GLXSwapBuffers,req);
diff --git a/src/glx/x11/glxcurrent.c b/src/glx/x11/glxcurrent.c
index 5af46cf0ba..4d0a7c65eb 100644
--- a/src/glx/x11/glxcurrent.c
+++ b/src/glx/x11/glxcurrent.c
@@ -312,13 +312,11 @@ SendMakeCurrentRequest(Display * dpy, CARD8 opcode,
#ifdef GLX_DIRECT_RENDERING
static __GLXDRIdrawable *
-FetchDRIDrawable(Display * dpy,
- GLXDrawable glxDrawable, GLXContext gc, Bool pre13)
+FetchDRIDrawable(Display * dpy, GLXDrawable glxDrawable, GLXContext gc)
{
__GLXdisplayPrivate *const priv = __glXInitialize(dpy);
__GLXDRIdrawable *pdraw;
__GLXscreenConfigs *psc;
- XID drawable;
if (priv == NULL)
return NULL;
@@ -330,15 +328,7 @@ FetchDRIDrawable(Display * dpy,
if (__glxHashLookup(psc->drawHash, glxDrawable, (void *) &pdraw) == 0)
return pdraw;
- /* If this is glXMakeCurrent (pre GLX 1.3) we allow creating the
- * GLX drawable on the fly. Otherwise we pass None as the X
- * drawable */
- if (pre13)
- drawable = glxDrawable;
- else
- drawable = None;
-
- pdraw = psc->driScreen->createDrawable(psc, drawable,
+ pdraw = psc->driScreen->createDrawable(psc, glxDrawable,
glxDrawable, gc->mode);
if (__glxHashInsert(psc->drawHash, glxDrawable, pdraw)) {
(*pdraw->destroyDrawable) (pdraw);
@@ -357,7 +347,7 @@ FetchDRIDrawable(Display * dpy,
*/
static Bool
MakeContextCurrent(Display * dpy, GLXDrawable draw,
- GLXDrawable read, GLXContext gc, Bool pre13)
+ GLXDrawable read, GLXContext gc)
{
xGLXMakeCurrentReply reply;
const GLXContext oldGC = __glXGetCurrentContext();
@@ -384,8 +374,21 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
#ifdef GLX_DIRECT_RENDERING
/* Bind the direct rendering context to the drawable */
if (gc && gc->driContext) {
- __GLXDRIdrawable *pdraw = FetchDRIDrawable(dpy, draw, gc, pre13);
- __GLXDRIdrawable *pread = FetchDRIDrawable(dpy, read, gc, pre13);
+ __GLXDRIdrawable *pdraw = FetchDRIDrawable(dpy, draw, gc);
+ __GLXDRIdrawable *pread = FetchDRIDrawable(dpy, read, gc);
+
+ if ((pdraw == NULL) || (pread == NULL)) {
+ xError error;
+
+ error.errorCode = GLXBadDrawable;
+ error.resourceID = (pdraw == NULL) ? draw : read;
+ error.sequenceNumber = dpy->request;
+ error.type = X_Error;
+ error.majorCode = gc->majorOpcode;
+ error.minorCode = X_GLXMakeContextCurrent;
+ _XError(dpy, &error);
+ return False;
+ }
bindReturnValue =
(gc->driContext->bindContext) (gc->driContext, pdraw, pread);
@@ -516,15 +519,16 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
PUBLIC Bool
glXMakeCurrent(Display * dpy, GLXDrawable draw, GLXContext gc)
{
- return MakeContextCurrent(dpy, draw, draw, gc, True);
+ return MakeContextCurrent(dpy, draw, draw, gc);
}
PUBLIC
GLX_ALIAS(Bool, glXMakeCurrentReadSGI,
(Display * dpy, GLXDrawable d, GLXDrawable r, GLXContext ctx),
- (dpy, d, r, ctx, False), MakeContextCurrent)
+ (dpy, d, r, ctx), MakeContextCurrent)
- PUBLIC GLX_ALIAS(Bool, glXMakeContextCurrent,
- (Display * dpy, GLXDrawable d, GLXDrawable r,
- GLXContext ctx), (dpy, d, r, ctx, False),
- MakeContextCurrent)
+PUBLIC
+GLX_ALIAS(Bool, glXMakeContextCurrent,
+ (Display * dpy, GLXDrawable d, GLXDrawable r,
+ GLXContext ctx), (dpy, d, r, ctx),
+ MakeContextCurrent)