From 5444424562781a0a40559db40dfe9b97286dc9da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?RALOVICH=2C=20Krist=C3=B3f?= Date: Sat, 18 Oct 2008 16:53:08 +0200 Subject: glx: implement __glXQueryServerString using XCB --- src/glx/x11/glx_query.c | 31 +++++++++++++++++++++++++++++++ src/glx/x11/glxclient.h | 4 ++++ 2 files changed, 35 insertions(+) (limited to 'src/glx') diff --git a/src/glx/x11/glx_query.c b/src/glx/x11/glx_query.c index 56f3495186..ef33f7c403 100644 --- a/src/glx/x11/glx_query.c +++ b/src/glx/x11/glx_query.c @@ -31,6 +31,12 @@ #include "glxclient.h" +#if defined(USE_XCB) +# include +# include +# include +#endif + /** * GLX protocol structure for the ficticious "GXLGenericGetString" request. * @@ -101,3 +107,28 @@ __glXGetStringFromServer(Display * dpy, int opcode, CARD32 glxCode, return buf; } + +#ifdef USE_XCB +char * +__glXQueryServerString(Display* dpy, + CARD32 screen, + CARD32 name) +{ + xcb_connection_t *c = XGetXCBConnection(dpy); + xcb_glx_query_server_string_reply_t* reply = + xcb_glx_query_server_string_reply(c, + xcb_glx_query_server_string(c, + screen, + name), + NULL); + + /* The spec doesn't mention this, but the Xorg server replies with + * a string already terminated with '\0'. */ + uint32_t len = xcb_glx_query_server_string_string_length(reply); + char* buf = Xmalloc(len); + memcpy(buf, xcb_glx_query_server_string_string(reply), len); + free(reply); + + return buf; +} +#endif /* USE_XCB */ diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index 02e8750c97..8f1e69154a 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -742,6 +742,10 @@ extern void __glXInitializeVisualConfigFromTags( __GLcontextModes *config, extern char * __glXGetStringFromServer( Display * dpy, int opcode, CARD32 glxCode, CARD32 for_whom, CARD32 name ); +#ifdef USE_XCB +extern char * __glXQueryServerString(Display* dpy, CARD32 screen, CARD32 name); +#endif + extern char *__glXstrdup(const char *str); -- cgit v1.2.3 From fd52001c5c292d3b625c164a6c3c357e1da443e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?RALOVICH=2C=20Krist=C3=B3f?= Date: Sat, 18 Oct 2008 17:00:13 +0200 Subject: glx: implement QueryVersion using XCB --- src/glx/x11/glxext.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/glx') diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index b6bdbd52bb..d185942ddb 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -139,7 +139,8 @@ XEXT_GENERATE_FIND_DISPLAY(__glXFindDisplay, __glXExtensionInfo, ** Free the per screen configs data as well as the array of ** __glXScreenConfigs. */ - static void FreeScreenConfigs(__GLXdisplayPrivate * priv) +static void +FreeScreenConfigs(__GLXdisplayPrivate * priv) { __GLXscreenConfigs *psc; GLint i, screens; @@ -221,6 +222,25 @@ __glXFreeDisplayPrivate(XExtData * extension) static Bool QueryVersion(Display * dpy, int opcode, int *major, int *minor) { +#ifdef USE_XCB + xcb_connection_t *c = XGetXCBConnection(dpy); + xcb_glx_query_version_reply_t* reply = + xcb_glx_query_version_reply(c, + xcb_glx_query_version(c, + GLX_MAJOR_VERSION, + GLX_MINOR_VERSION), + NULL); + + if(reply->major_version != GLX_MAJOR_VERSION) + { + free(reply); + return GL_FALSE; + } + *major = reply->major_version; + *minor = min(reply->minor_version, GLX_MINOR_VERSION); + free(reply); + return GL_TRUE; +#else xGLXQueryVersionReq *req; xGLXQueryVersionReply reply; @@ -245,6 +265,7 @@ QueryVersion(Display * dpy, int opcode, int *major, int *minor) *major = reply.majorVersion; *minor = min(reply.minorVersion, GLX_MINOR_VERSION); return GL_TRUE; +#endif /* USE_XCB */ } -- cgit v1.2.3 From 24b8a8cfe8210ac7bdd661c88523465633151219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?RALOVICH=2C=20Krist=C3=B3f?= Date: Mon, 3 Nov 2008 18:31:22 +0100 Subject: glx: implement __glXGetString, hide __glXGetStringFromServer --- src/glx/x11/glx_query.c | 87 ++++++++++++++++++++++++++++++++++++++++--------- src/glx/x11/glxclient.h | 6 +--- 2 files changed, 72 insertions(+), 21 deletions(-) (limited to 'src/glx') diff --git a/src/glx/x11/glx_query.c b/src/glx/x11/glx_query.c index ef33f7c403..2ad2b82313 100644 --- a/src/glx/x11/glx_query.c +++ b/src/glx/x11/glx_query.c @@ -37,6 +37,62 @@ # include #endif +#ifdef USE_XCB + +/** + * Exchange a protocol request for glXQueryServerString. + */ +char * +__glXQueryServerString(Display* dpy, + CARD32 screen, + CARD32 name) +{ + xcb_connection_t *c = XGetXCBConnection(dpy); + xcb_glx_query_server_string_reply_t* reply = + xcb_glx_query_server_string_reply(c, + xcb_glx_query_server_string(c, + screen, + name), + NULL); + + /* The spec doesn't mention this, but the Xorg server replies with + * a string already terminated with '\0'. */ + uint32_t len = xcb_glx_query_server_string_string_length(reply); + char* buf = Xmalloc(len); + memcpy(buf, xcb_glx_query_server_string_string(reply), len); + free(reply); + + return buf; +} + +/** + * Exchange a protocol request for glGetString. + */ +char * +__glXGetString(Display* dpy, + CARD32 contextTag, + CARD32 name) +{ + xcb_connection_t *c = XGetXCBConnection(dpy); + xcb_glx_get_string_reply_t* reply = + xcb_glx_get_string_reply(c, + xcb_glx_get_string(c, + contextTag, + name), + NULL); + + /* The spec doesn't mention this, but the Xorg server replies with + * a string already terminated with '\0'. */ + uint32_t len = xcb_glx_get_string_string_length(reply); + char* buf = Xmalloc(len); + memcpy(buf, xcb_glx_get_string_string(reply), len); + free(reply); + + return buf; +} + +#else + /** * GLX protocol structure for the ficticious "GXLGenericGetString" request. * @@ -108,27 +164,26 @@ __glXGetStringFromServer(Display * dpy, int opcode, CARD32 glxCode, return buf; } -#ifdef USE_XCB char * __glXQueryServerString(Display* dpy, CARD32 screen, CARD32 name) { - xcb_connection_t *c = XGetXCBConnection(dpy); - xcb_glx_query_server_string_reply_t* reply = - xcb_glx_query_server_string_reply(c, - xcb_glx_query_server_string(c, - screen, - name), - NULL); - - /* The spec doesn't mention this, but the Xorg server replies with - * a string already terminated with '\0'. */ - uint32_t len = xcb_glx_query_server_string_string_length(reply); - char* buf = Xmalloc(len); - memcpy(buf, xcb_glx_query_server_string_string(reply), len); - free(reply); + GLXContext gc = __glXGetCurrentContext(); + return __glXGetStringFromServer(dpy, gc->majorOpcode, + X_GLXQueryServerString, + screen, name); +} - return buf; +char * +__glXGetString(Display* dpy, + CARD32 contextTag, + CARD32 name) +{ + GLXContext gc = __glXGetCurrentContext(); + return __glXGetStringFromServer(dpy, gc->majorOpcode, X_GLsop_GetString, + contextTag, name); } + #endif /* USE_XCB */ + diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index 8f1e69154a..361ab70841 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -739,12 +739,8 @@ 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 * __glXGetStringFromServer( Display * dpy, int opcode, - CARD32 glxCode, CARD32 for_whom, CARD32 name ); - -#ifdef USE_XCB extern char * __glXQueryServerString(Display* dpy, CARD32 screen, CARD32 name); -#endif +extern char * __glXGetString(Display* dpy, CARD32 screen, CARD32 name); extern char *__glXstrdup(const char *str); -- cgit v1.2.3 From 9c98e35ff638a7d3793ffa99933ae308005e7416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?RALOVICH=2C=20Krist=C3=B3f?= Date: Mon, 3 Nov 2008 18:32:20 +0100 Subject: glx: use __glXQueryServerString --- src/glx/x11/glxcmds.c | 8 +++----- src/glx/x11/glxext.c | 8 ++------ 2 files changed, 5 insertions(+), 11 deletions(-) (limited to 'src/glx') diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 391e0be05e..03c0e5ad11 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; diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index d185942ddb..85a3fc69f3 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -550,9 +550,7 @@ getFBConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen) __GLXscreenConfigs *psc; psc = priv->screenConfigs + screen; - psc->serverGLXexts = __glXGetStringFromServer(dpy, priv->majorOpcode, - X_GLXQueryServerString, - screen, GLX_EXTENSIONS); + psc->serverGLXexts = __glXQueryServerString(dpy, screen, GLX_EXTENSIONS); LockDisplay(dpy); @@ -610,9 +608,7 @@ AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv) memset(psc, 0, screens * sizeof(__GLXscreenConfigs)); priv->screenConfigs = psc; - priv->serverGLXversion = __glXGetStringFromServer(dpy, priv->majorOpcode, - X_GLXQueryServerString, - 0, GLX_VERSION); + priv->serverGLXversion = __glXQueryServerString(dpy, 0, GLX_VERSION); if (priv->serverGLXversion == NULL) { FreeScreenConfigs(priv); return GL_FALSE; -- cgit v1.2.3 From f0d015cccbe29d18ee03ce788b65f44124fefe7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?RALOVICH=2C=20Krist=C3=B3f?= Date: Mon, 3 Nov 2008 18:32:35 +0100 Subject: glx: use __glXGetString --- src/glx/x11/single2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/glx') diff --git a/src/glx/x11/single2.c b/src/glx/x11/single2.c index 83a2505222..4375cb3126 100644 --- a/src/glx/x11/single2.c +++ b/src/glx/x11/single2.c @@ -679,9 +679,7 @@ __indirect_glGetString(GLenum name) */ (void) __glXFlushRenderBuffer(gc, gc->pc); - s = (GLubyte *) __glXGetStringFromServer(dpy, gc->majorOpcode, - X_GLsop_GetString, - gc->currentContextTag, name); + s = (GLubyte *) __glXGetString(dpy, gc->currentContextTag, name); if (!s) { /* Throw data on the floor */ __glXSetError(gc, GL_OUT_OF_MEMORY); -- cgit v1.2.3 From 00f22f972f6c96589cb9f6fa75b803c9506d61f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?RALOVICH=2C=20Krist=C3=B3f?= Date: Tue, 4 Nov 2008 10:43:06 +0100 Subject: glx: missing static on local function --- src/glx/x11/glx_query.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glx') diff --git a/src/glx/x11/glx_query.c b/src/glx/x11/glx_query.c index 2ad2b82313..01911e2a3a 100644 --- a/src/glx/x11/glx_query.c +++ b/src/glx/x11/glx_query.c @@ -119,7 +119,7 @@ typedef struct GLXGenericGetString * Query the Server GLX string. * This routine will allocate the necessay space for the string. */ -char * +static char * __glXGetStringFromServer(Display * dpy, int opcode, CARD32 glxCode, CARD32 for_whom, CARD32 name) { -- cgit v1.2.3 From 9c7aaa7afbda92587f28cc28c4c8315e7861d318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?RALOVICH=2C=20Krist=C3=B3f?= 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') diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 03c0e5ad11..18bf12084b 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: =?UTF-8?q?RALOVICH=2C=20Krist=C3=B3f?= 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') diff --git a/src/glx/x11/glx_query.c b/src/glx/x11/glx_query.c index 01911e2a3a..2789b841b1 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 361ab70841..16f6074ed8 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 18bf12084b..0bb548f776 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 85a3fc69f3..be6edf9b19 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 4375cb3126..0b2d5113cc 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: =?UTF-8?q?RALOVICH=2C=20Krist=C3=B3f?= 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') diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 0bb548f776..93fc40c284 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 62688f11355cfa865d420755aa159875b425cc9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?RALOVICH=2C=20Krist=C3=B3f?= Date: Tue, 4 Nov 2008 17:17:18 +0100 Subject: glx: xcbified visual and FBConfig choosing --- src/glx/x11/glxext.c | 109 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 103 insertions(+), 6 deletions(-) (limited to 'src/glx') diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index be6edf9b19..90db81ed2d 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -465,8 +465,14 @@ __glXInitializeVisualConfigFromTags(__GLcontextModes * config, int count, } static __GLcontextModes * -createConfigsFromProperties(Display * dpy, int nvisuals, int nprops, - int screen, GLboolean tagged_only) +createConfigsFromProperties( +#ifdef USE_XCB + uint32_t* properties, +#else + Display *dpy, +#endif + int nvisuals, int nprops, + int screen, GLboolean tagged_only) { INT32 buf[__GLX_TOTAL_CONFIG], *props; unsigned prop_size; @@ -496,7 +502,11 @@ createConfigsFromProperties(Display * dpy, int nvisuals, int nprops, /* Read each config structure and convert it into our format */ m = modes; for (i = 0; i < nvisuals; i++) { +#ifdef USE_XCB + memcpy(props, &properties[i*nprops], prop_size); +#else _XRead(dpy, (char *) props, prop_size); +#endif /* Older X servers don't send this so we default it here. */ m->drawableType = GLX_WINDOW_BIT; __glXInitializeVisualConfigFromTags(m, nprops, props, @@ -514,8 +524,34 @@ createConfigsFromProperties(Display * dpy, int nvisuals, int nprops, static GLboolean getVisualConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen) { - xGLXGetVisualConfigsReq *req; __GLXscreenConfigs *psc; +#ifdef USE_XCB + xcb_connection_t* c = XGetXCBConnection(dpy); + xcb_glx_get_visual_configs_reply_t* reply = NULL; + uint32_t* props; + + psc = priv->screenConfigs + screen; + psc->visuals = NULL; + + reply = xcb_glx_get_visual_configs_reply(c, + xcb_glx_get_visual_configs(c, + screen), + NULL); + if(!reply) + goto out; + + props = xcb_glx_get_visual_configs_property_list(reply); + psc->visuals = createConfigsFromProperties(props, + reply->num_visuals, + reply->num_properties, + screen, + GL_FALSE); + free(reply); + +out: + return psc->visuals != NULL; +#else /* USE_XCB */ + xGLXGetVisualConfigsReq *req; xGLXGetVisualConfigsReply reply; LockDisplay(dpy); @@ -538,19 +574,78 @@ getVisualConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen) out: UnlockDisplay(dpy); return psc->visuals != NULL; +#endif /* USE_XCB */ } static GLboolean getFBConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen) { + __GLXscreenConfigs *psc; +#ifdef USE_XCB + xcb_connection_t* c = XGetXCBConnection(dpy); + xcb_glx_get_fb_configs_reply_t* reply_fb = NULL; + xcb_glx_get_fb_configs_sgix_reply_t* reply_sgix = NULL; + uint32_t num_fb_configs; + uint32_t num_properties; + uint32_t* props; + + psc = priv->screenConfigs + screen; + psc->serverGLXexts = __glXQueryServerString(dpy, priv->majorOpcode, + screen, GLX_EXTENSIONS); + psc->configs = NULL; + + if (atof(priv->serverGLXversion) >= 1.3) { + reply_fb = xcb_glx_get_fb_configs_reply(c, + xcb_glx_get_fb_configs(c, + screen), + NULL); + if (!reply_fb) + goto out; + + num_fb_configs = reply_fb->num_fb_configs; + num_properties = reply_fb->num_properties * 2; + props = xcb_glx_get_fb_configs_property_list(reply_fb); + } else if (strstr(psc->serverGLXexts, "GLX_SGIX_fbconfig") != NULL) { + reply_sgix = xcb_glx_get_fb_configs_sgix_reply( + c, + xcb_glx_get_fb_configs_sgix(c, + 65540, /* X_GLXvop_GetFBConfigsSGIX */ + 0, + screen), + NULL); + + if (!reply_sgix) + goto out; + + num_fb_configs = reply_sgix->num_fb_configs; + num_properties = reply_sgix->num_properties * 2; + props = xcb_glx_get_fb_configs_sgix_property_list(reply_sgix); + } else + goto out; + + psc->configs = createConfigsFromProperties(props, + num_fb_configs, + num_properties, + screen, + GL_TRUE); + + if (reply_fb) + free(reply_fb); + + if (reply_sgix) + free(reply_sgix); + +out: + return psc->configs != NULL; +#else /* USE_XCB */ xGLXGetFBConfigsReq *fb_req; xGLXGetFBConfigsSGIXReq *sgi_req; xGLXVendorPrivateWithReplyReq *vpreq; xGLXGetFBConfigsReply reply; - __GLXscreenConfigs *psc; psc = priv->screenConfigs + screen; - psc->serverGLXexts = __glXQueryServerString(dpy, priv->majorOpcode, screen, GLX_EXTENSIONS); + psc->serverGLXexts = __glXQueryServerString(dpy, priv->majorOpcode, + screen, GLX_EXTENSIONS); LockDisplay(dpy); @@ -585,6 +680,7 @@ getFBConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen) out: UnlockDisplay(dpy); return psc->configs != NULL; +#endif /* USE_XCB */ } /* @@ -608,7 +704,8 @@ AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv) memset(psc, 0, screens * sizeof(__GLXscreenConfigs)); priv->screenConfigs = psc; - priv->serverGLXversion = __glXQueryServerString(dpy, priv->majorOpcode, 0, GLX_VERSION); + priv->serverGLXversion = __glXQueryServerString(dpy, priv->majorOpcode, + 0, GLX_VERSION); if (priv->serverGLXversion == NULL) { FreeScreenConfigs(priv); return GL_FALSE; -- cgit v1.2.3 From ff3fa92eaa67579b3bd3480bc685cfc55ae1eff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?RALOVICH=2C=20Krist=C3=B3f?= 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') diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 93fc40c284..ec5ec4c3f0 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: =?UTF-8?q?RALOVICH=2C=20Krist=C3=B3f?= 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') diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index ec5ec4c3f0..1d373ed29d 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 From 53698765019e50172be25a4ff48c83d54f0e7981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?RALOVICH=2C=20Krist=C3=B3f?= Date: Sat, 8 Nov 2008 18:18:26 +0100 Subject: glx: revert using nonexsisten XCB version of glXGetFBConfigsSGIX This uses a GLX VendorPrivate request. VendorPrivates are real GLX API calls but use the same protocol request. XCB does not currently support specific VendorPrivetes directly. See eg.: http://lists.freedesktop.org/archives/xcb/2008-November/004036.html for more information. --- src/glx/x11/glxext.c | 58 ---------------------------------------------------- 1 file changed, 58 deletions(-) (limited to 'src/glx') diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 90db81ed2d..729cf3aa86 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -581,63 +581,6 @@ static GLboolean getFBConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen) { __GLXscreenConfigs *psc; -#ifdef USE_XCB - xcb_connection_t* c = XGetXCBConnection(dpy); - xcb_glx_get_fb_configs_reply_t* reply_fb = NULL; - xcb_glx_get_fb_configs_sgix_reply_t* reply_sgix = NULL; - uint32_t num_fb_configs; - uint32_t num_properties; - uint32_t* props; - - psc = priv->screenConfigs + screen; - psc->serverGLXexts = __glXQueryServerString(dpy, priv->majorOpcode, - screen, GLX_EXTENSIONS); - psc->configs = NULL; - - if (atof(priv->serverGLXversion) >= 1.3) { - reply_fb = xcb_glx_get_fb_configs_reply(c, - xcb_glx_get_fb_configs(c, - screen), - NULL); - if (!reply_fb) - goto out; - - num_fb_configs = reply_fb->num_fb_configs; - num_properties = reply_fb->num_properties * 2; - props = xcb_glx_get_fb_configs_property_list(reply_fb); - } else if (strstr(psc->serverGLXexts, "GLX_SGIX_fbconfig") != NULL) { - reply_sgix = xcb_glx_get_fb_configs_sgix_reply( - c, - xcb_glx_get_fb_configs_sgix(c, - 65540, /* X_GLXvop_GetFBConfigsSGIX */ - 0, - screen), - NULL); - - if (!reply_sgix) - goto out; - - num_fb_configs = reply_sgix->num_fb_configs; - num_properties = reply_sgix->num_properties * 2; - props = xcb_glx_get_fb_configs_sgix_property_list(reply_sgix); - } else - goto out; - - psc->configs = createConfigsFromProperties(props, - num_fb_configs, - num_properties, - screen, - GL_TRUE); - - if (reply_fb) - free(reply_fb); - - if (reply_sgix) - free(reply_sgix); - -out: - return psc->configs != NULL; -#else /* USE_XCB */ xGLXGetFBConfigsReq *fb_req; xGLXGetFBConfigsSGIXReq *sgi_req; xGLXVendorPrivateWithReplyReq *vpreq; @@ -680,7 +623,6 @@ out: out: UnlockDisplay(dpy); return psc->configs != NULL; -#endif /* USE_XCB */ } /* -- cgit v1.2.3 From 80d1531ebefe78aaa09a0378d0369963dd925132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?RALOVICH=2C=20Krist=C3=B3f?= Date: Thu, 27 Nov 2008 12:53:19 +0100 Subject: Revert "glx: revert using nonexsisten XCB version of glXGetFBConfigsSGIX" This reverts commit 53698765019e50172be25a4ff48c83d54f0e7981. --- src/glx/x11/glxext.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'src/glx') diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 729cf3aa86..90db81ed2d 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -581,6 +581,63 @@ static GLboolean getFBConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen) { __GLXscreenConfigs *psc; +#ifdef USE_XCB + xcb_connection_t* c = XGetXCBConnection(dpy); + xcb_glx_get_fb_configs_reply_t* reply_fb = NULL; + xcb_glx_get_fb_configs_sgix_reply_t* reply_sgix = NULL; + uint32_t num_fb_configs; + uint32_t num_properties; + uint32_t* props; + + psc = priv->screenConfigs + screen; + psc->serverGLXexts = __glXQueryServerString(dpy, priv->majorOpcode, + screen, GLX_EXTENSIONS); + psc->configs = NULL; + + if (atof(priv->serverGLXversion) >= 1.3) { + reply_fb = xcb_glx_get_fb_configs_reply(c, + xcb_glx_get_fb_configs(c, + screen), + NULL); + if (!reply_fb) + goto out; + + num_fb_configs = reply_fb->num_fb_configs; + num_properties = reply_fb->num_properties * 2; + props = xcb_glx_get_fb_configs_property_list(reply_fb); + } else if (strstr(psc->serverGLXexts, "GLX_SGIX_fbconfig") != NULL) { + reply_sgix = xcb_glx_get_fb_configs_sgix_reply( + c, + xcb_glx_get_fb_configs_sgix(c, + 65540, /* X_GLXvop_GetFBConfigsSGIX */ + 0, + screen), + NULL); + + if (!reply_sgix) + goto out; + + num_fb_configs = reply_sgix->num_fb_configs; + num_properties = reply_sgix->num_properties * 2; + props = xcb_glx_get_fb_configs_sgix_property_list(reply_sgix); + } else + goto out; + + psc->configs = createConfigsFromProperties(props, + num_fb_configs, + num_properties, + screen, + GL_TRUE); + + if (reply_fb) + free(reply_fb); + + if (reply_sgix) + free(reply_sgix); + +out: + return psc->configs != NULL; +#else /* USE_XCB */ xGLXGetFBConfigsReq *fb_req; xGLXGetFBConfigsSGIXReq *sgi_req; xGLXVendorPrivateWithReplyReq *vpreq; @@ -623,6 +680,7 @@ getFBConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen) out: UnlockDisplay(dpy); return psc->configs != NULL; +#endif /* USE_XCB */ } /* -- cgit v1.2.3 From 8c2b4b33c583401e2efe02db859d5af31872921d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?RALOVICH=2C=20Krist=C3=B3f?= Date: Thu, 27 Nov 2008 12:53:43 +0100 Subject: Revert "glx: xcbified visual and FBConfig choosing" This reverts commit 62688f11355cfa865d420755aa159875b425cc9b. --- src/glx/x11/glxext.c | 109 +++------------------------------------------------ 1 file changed, 6 insertions(+), 103 deletions(-) (limited to 'src/glx') diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 90db81ed2d..be6edf9b19 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -465,14 +465,8 @@ __glXInitializeVisualConfigFromTags(__GLcontextModes * config, int count, } static __GLcontextModes * -createConfigsFromProperties( -#ifdef USE_XCB - uint32_t* properties, -#else - Display *dpy, -#endif - int nvisuals, int nprops, - int screen, GLboolean tagged_only) +createConfigsFromProperties(Display * dpy, int nvisuals, int nprops, + int screen, GLboolean tagged_only) { INT32 buf[__GLX_TOTAL_CONFIG], *props; unsigned prop_size; @@ -502,11 +496,7 @@ createConfigsFromProperties( /* Read each config structure and convert it into our format */ m = modes; for (i = 0; i < nvisuals; i++) { -#ifdef USE_XCB - memcpy(props, &properties[i*nprops], prop_size); -#else _XRead(dpy, (char *) props, prop_size); -#endif /* Older X servers don't send this so we default it here. */ m->drawableType = GLX_WINDOW_BIT; __glXInitializeVisualConfigFromTags(m, nprops, props, @@ -524,34 +514,8 @@ createConfigsFromProperties( static GLboolean getVisualConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen) { - __GLXscreenConfigs *psc; -#ifdef USE_XCB - xcb_connection_t* c = XGetXCBConnection(dpy); - xcb_glx_get_visual_configs_reply_t* reply = NULL; - uint32_t* props; - - psc = priv->screenConfigs + screen; - psc->visuals = NULL; - - reply = xcb_glx_get_visual_configs_reply(c, - xcb_glx_get_visual_configs(c, - screen), - NULL); - if(!reply) - goto out; - - props = xcb_glx_get_visual_configs_property_list(reply); - psc->visuals = createConfigsFromProperties(props, - reply->num_visuals, - reply->num_properties, - screen, - GL_FALSE); - free(reply); - -out: - return psc->visuals != NULL; -#else /* USE_XCB */ xGLXGetVisualConfigsReq *req; + __GLXscreenConfigs *psc; xGLXGetVisualConfigsReply reply; LockDisplay(dpy); @@ -574,78 +538,19 @@ out: out: UnlockDisplay(dpy); return psc->visuals != NULL; -#endif /* USE_XCB */ } static GLboolean getFBConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen) { - __GLXscreenConfigs *psc; -#ifdef USE_XCB - xcb_connection_t* c = XGetXCBConnection(dpy); - xcb_glx_get_fb_configs_reply_t* reply_fb = NULL; - xcb_glx_get_fb_configs_sgix_reply_t* reply_sgix = NULL; - uint32_t num_fb_configs; - uint32_t num_properties; - uint32_t* props; - - psc = priv->screenConfigs + screen; - psc->serverGLXexts = __glXQueryServerString(dpy, priv->majorOpcode, - screen, GLX_EXTENSIONS); - psc->configs = NULL; - - if (atof(priv->serverGLXversion) >= 1.3) { - reply_fb = xcb_glx_get_fb_configs_reply(c, - xcb_glx_get_fb_configs(c, - screen), - NULL); - if (!reply_fb) - goto out; - - num_fb_configs = reply_fb->num_fb_configs; - num_properties = reply_fb->num_properties * 2; - props = xcb_glx_get_fb_configs_property_list(reply_fb); - } else if (strstr(psc->serverGLXexts, "GLX_SGIX_fbconfig") != NULL) { - reply_sgix = xcb_glx_get_fb_configs_sgix_reply( - c, - xcb_glx_get_fb_configs_sgix(c, - 65540, /* X_GLXvop_GetFBConfigsSGIX */ - 0, - screen), - NULL); - - if (!reply_sgix) - goto out; - - num_fb_configs = reply_sgix->num_fb_configs; - num_properties = reply_sgix->num_properties * 2; - props = xcb_glx_get_fb_configs_sgix_property_list(reply_sgix); - } else - goto out; - - psc->configs = createConfigsFromProperties(props, - num_fb_configs, - num_properties, - screen, - GL_TRUE); - - if (reply_fb) - free(reply_fb); - - if (reply_sgix) - free(reply_sgix); - -out: - return psc->configs != NULL; -#else /* USE_XCB */ xGLXGetFBConfigsReq *fb_req; xGLXGetFBConfigsSGIXReq *sgi_req; xGLXVendorPrivateWithReplyReq *vpreq; xGLXGetFBConfigsReply reply; + __GLXscreenConfigs *psc; psc = priv->screenConfigs + screen; - psc->serverGLXexts = __glXQueryServerString(dpy, priv->majorOpcode, - screen, GLX_EXTENSIONS); + psc->serverGLXexts = __glXQueryServerString(dpy, priv->majorOpcode, screen, GLX_EXTENSIONS); LockDisplay(dpy); @@ -680,7 +585,6 @@ out: out: UnlockDisplay(dpy); return psc->configs != NULL; -#endif /* USE_XCB */ } /* @@ -704,8 +608,7 @@ AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv) memset(psc, 0, screens * sizeof(__GLXscreenConfigs)); priv->screenConfigs = psc; - priv->serverGLXversion = __glXQueryServerString(dpy, priv->majorOpcode, - 0, GLX_VERSION); + priv->serverGLXversion = __glXQueryServerString(dpy, priv->majorOpcode, 0, GLX_VERSION); if (priv->serverGLXversion == NULL) { FreeScreenConfigs(priv); return GL_FALSE; -- cgit v1.2.3