From 9c98e35ff638a7d3793ffa99933ae308005e7416 Mon Sep 17 00:00:00 2001 From: "RALOVICH, Kristóf" Date: Mon, 3 Nov 2008 18:32:20 +0100 Subject: glx: use __glXQueryServerString --- src/glx/x11/glxcmds.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/glx/x11/glxcmds.c') diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 391e0be05e7..03c0e5ad110 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -1314,9 +1314,8 @@ PUBLIC const char *glXQueryExtensionsString( Display *dpy, int screen ) if (!psc->effectiveGLXexts) { if (!psc->serverGLXexts) { - psc->serverGLXexts = __glXGetStringFromServer(dpy, priv->majorOpcode, - X_GLXQueryServerString, - screen, GLX_EXTENSIONS); + psc->serverGLXexts = + __glXQueryServerString(dpy, screen, GLX_EXTENSIONS); } __glXCalculateUsableExtensions(psc, @@ -1371,8 +1370,7 @@ PUBLIC const char *glXQueryServerString( Display *dpy, int screen, int name ) } if ( *str == NULL ) { - *str = __glXGetStringFromServer(dpy, priv->majorOpcode, - X_GLXQueryServerString, screen, name); + *str = __glXQueryServerString(dpy, screen, name); } return *str; -- cgit v1.2.3 From 9c7aaa7afbda92587f28cc28c4c8315e7861d318 Mon Sep 17 00:00:00 2001 From: "RALOVICH, Kristóf" Date: Tue, 4 Nov 2008 10:59:39 +0100 Subject: glx: xcbified __glXIsDirect --- src/glx/x11/glxcmds.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/glx/x11/glxcmds.c') diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 03c0e5ad110..18bf12084b4 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -44,6 +44,12 @@ #include "xf86dri.h" #endif +#if defined(USE_XCB) +#include +#include +#include +#endif + static const char __glXGLXClientVendorName[] = "SGI"; static const char __glXGLXClientVersion[] = "1.4"; @@ -749,8 +755,10 @@ PUBLIC void glXCopyContext(Display *dpy, GLXContext source, */ static Bool __glXIsDirect(Display *dpy, GLXContextID contextID) { +#if !defined(USE_XCB) xGLXIsDirectReq *req; xGLXIsDirectReply reply; +#endif CARD8 opcode; opcode = __glXSetupForCommand(dpy); @@ -758,6 +766,18 @@ static Bool __glXIsDirect(Display *dpy, GLXContextID contextID) return GL_FALSE; } +#ifdef USE_XCB + xcb_connection_t* c = XGetXCBConnection(dpy); + xcb_glx_is_direct_reply_t* reply = + xcb_glx_is_direct_reply(c, + xcb_glx_is_direct(c, contextID), + NULL); + + const Bool is_direct = reply->is_direct ? True : False; + free(reply); + + return is_direct; +#else /* Send the glXIsDirect request */ LockDisplay(dpy); GetReq(GLXIsDirect,req); @@ -769,6 +789,7 @@ static Bool __glXIsDirect(Display *dpy, GLXContextID contextID) SyncHandle(); return reply.isDirect; +#endif /* USE_XCB */ } /** -- cgit v1.2.3 From 6d1d1576062e569fe1d372f44ba3f646c21ae1c3 Mon Sep 17 00:00:00 2001 From: "RALOVICH, Kristóf" Date: Tue, 4 Nov 2008 11:31:53 +0100 Subject: glx: no graphics context during initialization --- src/glx/x11/glx_query.c | 10 ++++++---- src/glx/x11/glxclient.h | 6 ++++-- src/glx/x11/glxcmds.c | 4 ++-- src/glx/x11/glxext.c | 4 ++-- src/glx/x11/single2.c | 2 +- 5 files changed, 15 insertions(+), 11 deletions(-) (limited to 'src/glx/x11/glxcmds.c') diff --git a/src/glx/x11/glx_query.c b/src/glx/x11/glx_query.c index 01911e2a3a9..2789b841b1b 100644 --- a/src/glx/x11/glx_query.c +++ b/src/glx/x11/glx_query.c @@ -44,6 +44,7 @@ */ char * __glXQueryServerString(Display* dpy, + int opcode, CARD32 screen, CARD32 name) { @@ -70,6 +71,7 @@ __glXQueryServerString(Display* dpy, */ char * __glXGetString(Display* dpy, + int opcode, CARD32 contextTag, CARD32 name) { @@ -166,22 +168,22 @@ __glXGetStringFromServer(Display * dpy, int opcode, CARD32 glxCode, char * __glXQueryServerString(Display* dpy, + int opcode, CARD32 screen, CARD32 name) { - GLXContext gc = __glXGetCurrentContext(); - return __glXGetStringFromServer(dpy, gc->majorOpcode, + return __glXGetStringFromServer(dpy, opcode, X_GLXQueryServerString, screen, name); } char * __glXGetString(Display* dpy, + int opcode, CARD32 contextTag, CARD32 name) { - GLXContext gc = __glXGetCurrentContext(); - return __glXGetStringFromServer(dpy, gc->majorOpcode, X_GLsop_GetString, + return __glXGetStringFromServer(dpy, opcode, X_GLsop_GetString, contextTag, name); } diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index 361ab70841c..16f6074ed89 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -739,8 +739,10 @@ extern void _XSend(Display*, const void*, long); extern void __glXInitializeVisualConfigFromTags( __GLcontextModes *config, int count, const INT32 *bp, Bool tagged_only, Bool fbconfig_style_tags ); -extern char * __glXQueryServerString(Display* dpy, CARD32 screen, CARD32 name); -extern char * __glXGetString(Display* dpy, CARD32 screen, CARD32 name); +extern char * __glXQueryServerString(Display* dpy, int opcode, + CARD32 screen, CARD32 name); +extern char * __glXGetString(Display* dpy, int opcode, + CARD32 screen, CARD32 name); extern char *__glXstrdup(const char *str); diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 18bf12084b4..0bb548f776d 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -1336,7 +1336,7 @@ PUBLIC const char *glXQueryExtensionsString( Display *dpy, int screen ) if (!psc->effectiveGLXexts) { if (!psc->serverGLXexts) { psc->serverGLXexts = - __glXQueryServerString(dpy, screen, GLX_EXTENSIONS); + __glXQueryServerString(dpy, priv->majorOpcode, screen, GLX_EXTENSIONS); } __glXCalculateUsableExtensions(psc, @@ -1391,7 +1391,7 @@ PUBLIC const char *glXQueryServerString( Display *dpy, int screen, int name ) } if ( *str == NULL ) { - *str = __glXQueryServerString(dpy, screen, name); + *str = __glXQueryServerString(dpy, priv->majorOpcode, screen, name); } return *str; diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 85a3fc69f39..be6edf9b193 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -550,7 +550,7 @@ getFBConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen) __GLXscreenConfigs *psc; psc = priv->screenConfigs + screen; - psc->serverGLXexts = __glXQueryServerString(dpy, screen, GLX_EXTENSIONS); + psc->serverGLXexts = __glXQueryServerString(dpy, priv->majorOpcode, screen, GLX_EXTENSIONS); LockDisplay(dpy); @@ -608,7 +608,7 @@ AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv) memset(psc, 0, screens * sizeof(__GLXscreenConfigs)); priv->screenConfigs = psc; - priv->serverGLXversion = __glXQueryServerString(dpy, 0, GLX_VERSION); + priv->serverGLXversion = __glXQueryServerString(dpy, priv->majorOpcode, 0, GLX_VERSION); if (priv->serverGLXversion == NULL) { FreeScreenConfigs(priv); return GL_FALSE; diff --git a/src/glx/x11/single2.c b/src/glx/x11/single2.c index 4375cb31260..0b2d5113cc8 100644 --- a/src/glx/x11/single2.c +++ b/src/glx/x11/single2.c @@ -679,7 +679,7 @@ __indirect_glGetString(GLenum name) */ (void) __glXFlushRenderBuffer(gc, gc->pc); - s = (GLubyte *) __glXGetString(dpy, gc->currentContextTag, name); + s = (GLubyte *) __glXGetString(dpy, gc->majorOpcode, gc->currentContextTag, name); if (!s) { /* Throw data on the floor */ __glXSetError(gc, GL_OUT_OF_MEMORY); -- cgit v1.2.3 From 66db1b64e85a2225dff930d3bb9e1194bde75622 Mon Sep 17 00:00:00 2001 From: "RALOVICH, Kristóf" Date: Tue, 4 Nov 2008 12:41:55 +0100 Subject: glx: xcbified __glXClientInfo --- src/glx/x11/glxcmds.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/glx/x11/glxcmds.c') diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 0bb548f776d..93fc40c2848 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -254,6 +254,10 @@ GLXContext AllocateGLXContext( Display *dpy ) CARD8 opcode; __GLXattribute *state; +#ifdef USE_XCB + printf("USE_XCB\n"); +#endif + if (!dpy) return NULL; @@ -1399,9 +1403,18 @@ PUBLIC const char *glXQueryServerString( Display *dpy, int screen, int name ) void __glXClientInfo ( Display *dpy, int opcode ) { - xGLXClientInfoReq *req; - int size; char * ext_str = __glXGetClientGLExtensionString(); + int size = strlen( ext_str ) + 1; + +#ifdef USE_XCB + xcb_connection_t *c = XGetXCBConnection(dpy); + xcb_glx_client_info(c, + GLX_MAJOR_VERSION, + GLX_MINOR_VERSION, + size, + (const uint8_t *)ext_str); +#else + xGLXClientInfoReq *req; /* Send the glXClientInfo request */ LockDisplay(dpy); @@ -1411,14 +1424,14 @@ void __glXClientInfo ( Display *dpy, int opcode ) req->major = GLX_MAJOR_VERSION; req->minor = GLX_MINOR_VERSION; - size = strlen( ext_str ) + 1; req->length += (size + 3) >> 2; req->numbytes = size; Data(dpy, ext_str, size); UnlockDisplay(dpy); SyncHandle(); - +#endif /* USE_XCB */ + Xfree( ext_str ); } -- cgit v1.2.3 From ff3fa92eaa67579b3bd3480bc685cfc55ae1eff2 Mon Sep 17 00:00:00 2001 From: "RALOVICH, Kristóf" Date: Tue, 4 Nov 2008 17:30:21 +0100 Subject: glx: xcbified glXSwapBuffers --- src/glx/x11/glxcmds.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/glx/x11/glxcmds.c') diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 93fc40c2848..ec5ec4c3f07 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -865,7 +865,6 @@ PUBLIC void glXDestroyGLXPixmap(Display *dpy, GLXPixmap glxpixmap) PUBLIC void glXSwapBuffers(Display *dpy, GLXDrawable drawable) { - xGLXSwapBuffersReq *req; GLXContext gc; GLXContextTag tag; CARD8 opcode; @@ -896,6 +895,13 @@ PUBLIC void glXSwapBuffers(Display *dpy, GLXDrawable drawable) tag = 0; } +#ifdef USE_XCB + xcb_connection_t* 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); @@ -906,6 +912,7 @@ PUBLIC void glXSwapBuffers(Display *dpy, GLXDrawable drawable) UnlockDisplay(dpy); SyncHandle(); XFlush(dpy); +#endif /* USE_XCB */ } -- cgit v1.2.3 From 1e167f6b5c91062264d6340d3d78364f0869e8ef Mon Sep 17 00:00:00 2001 From: "RALOVICH, Kristóf" Date: Sat, 8 Nov 2008 17:58:55 +0100 Subject: glx: remove XCB debug leftover --- src/glx/x11/glxcmds.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/glx/x11/glxcmds.c') diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index ec5ec4c3f07..1d373ed29d8 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -254,10 +254,6 @@ GLXContext AllocateGLXContext( Display *dpy ) CARD8 opcode; __GLXattribute *state; -#ifdef USE_XCB - printf("USE_XCB\n"); -#endif - if (!dpy) return NULL; -- cgit v1.2.3