From c03af8e78069921d02cf4d9b70aabb82d5326764 Mon Sep 17 00:00:00 2001 From: Daniel Zimmermann Date: Wed, 26 Nov 2008 11:48:53 +0100 Subject: fix possible memory leak in bezierPatchMeshMake --- src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc b/src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc index 3dc16313ff..ac7ff84fc4 100644 --- a/src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc +++ b/src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc @@ -103,23 +103,22 @@ bezierPatchMesh *bezierPatchMeshMake(int maptype, float umin, float umax, int us int dimension; int the_ustride; int the_vstride; - - bezierPatchMesh *ret = (bezierPatchMesh*) malloc(sizeof(bezierPatchMesh)); - assert(ret); - ret->bpatch = NULL; - ret->bpatch_normal = NULL; - ret->bpatch_color = NULL; - ret->bpatch_texcoord = NULL; - if(maptype == GL_MAP2_VERTEX_3) dimension = 3; else if (maptype==GL_MAP2_VERTEX_4) dimension = 4; else { fprintf(stderr, "error in inMap2f, maptype=%i is wrong, maptype,map is invalid\n", maptype); return NULL; } - + + bezierPatchMesh *ret = (bezierPatchMesh*) malloc(sizeof(bezierPatchMesh)); + assert(ret); + + ret->bpatch_normal = NULL; + ret->bpatch_color = NULL; + ret->bpatch_texcoord = NULL; ret->bpatch = bezierPatchMake(umin, vmin, umax, vmax, uorder, vorder, dimension); + /*copy the control points there*/ the_ustride = vorder * dimension; the_vstride = dimension; -- cgit v1.2.3 From 11701b4c151de450e0b80d9e61266ff178b4bd60 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 26 Nov 2008 07:21:12 -0700 Subject: mesa: add some missing switch cases for generating state var strings --- src/mesa/shader/prog_statevars.c | 44 +++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c index 971eb25a49..0a21bebfaa 100644 --- a/src/mesa/shader/prog_statevars.c +++ b/src/mesa/shader/prog_statevars.c @@ -604,6 +604,9 @@ append(char *dst, const char *src) } +/** + * Convert token 'k' to a string, append it only 'dst' string. + */ static void append_token(char *dst, gl_state_index k) { @@ -736,11 +739,30 @@ append_token(char *dst, gl_state_index k) case STATE_LOCAL: append(dst, "local"); break; + /* BEGIN internal state vars */ + case STATE_INTERNAL: + append(dst, "(internal)"); + break; case STATE_NORMAL_SCALE: append(dst, "normalScale"); break; - case STATE_INTERNAL: - append(dst, "(internal)"); + case STATE_TEXRECT_SCALE: + append(dst, "texrectScale"); + break; + case STATE_FOG_PARAMS_OPTIMIZED: + append(dst, "fogParamsOptimized"); + break; + case STATE_LIGHT_SPOT_DIR_NORMALIZED: + append(dst, "lightSpotDirNormalized"); + break; + case STATE_LIGHT_POSITION: + append(dst, "lightPosition"); + break; + case STATE_LIGHT_POSITION_NORMALIZED: + append(dst, "light.position.normalized"); + break; + case STATE_LIGHT_HALF_VECTOR: + append(dst, "lightHalfVector"); break; case STATE_PT_SCALE: append(dst, "PTscale"); @@ -758,6 +780,7 @@ append_token(char *dst, gl_state_index k) append(dst, "ShadowAmbient"); break; default: + assert(0); ; } } @@ -791,16 +814,16 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH]) char tmp[30]; append(str, "state."); - append_token(str, (gl_state_index) state[0]); + append_token(str, state[0]); switch (state[0]) { case STATE_MATERIAL: append_face(str, state[1]); - append_token(str, (gl_state_index) state[2]); + append_token(str, state[2]); break; case STATE_LIGHT: append_index(str, state[1]); /* light number [i]. */ - append_token(str, (gl_state_index) state[2]); /* coefficients */ + append_token(str, state[2]); /* coefficients */ break; case STATE_LIGHTMODEL_AMBIENT: append(str, "lightmodel.ambient"); @@ -816,11 +839,11 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH]) case STATE_LIGHTPROD: append_index(str, state[1]); /* light number [i]. */ append_face(str, state[2]); - append_token(str, (gl_state_index) state[3]); + append_token(str, state[3]); break; case STATE_TEXGEN: append_index(str, state[1]); /* tex unit [i] */ - append_token(str, (gl_state_index) state[2]); /* plane coef */ + append_token(str, state[2]); /* plane coef */ break; case STATE_TEXENV_COLOR: append_index(str, state[1]); /* tex unit [i] */ @@ -842,11 +865,11 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH]) /* state[2] = first row to fetch */ /* state[3] = last row to fetch */ /* state[4] = transpose, inverse or invtrans */ - const gl_state_index mat = (gl_state_index) state[0]; + const gl_state_index mat = state[0]; const GLuint index = (GLuint) state[1]; const GLuint firstRow = (GLuint) state[2]; const GLuint lastRow = (GLuint) state[3]; - const gl_state_index modifier = (gl_state_index) state[4]; + const gl_state_index modifier = state[4]; if (index || mat == STATE_TEXTURE_MATRIX || mat == STATE_PROGRAM_MATRIX) @@ -874,10 +897,11 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH]) case STATE_VERTEX_PROGRAM: /* state[1] = {STATE_ENV, STATE_LOCAL} */ /* state[2] = parameter index */ - append_token(str, (gl_state_index) state[1]); + append_token(str, state[1]); append_index(str, state[2]); break; case STATE_INTERNAL: + append_token(str, state[1]); break; default: _mesa_problem(NULL, "Invalid state in _mesa_program_state_string"); -- cgit v1.2.3 From fea3a32e17502ac16ec9a12dc9d18742cea2efd5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 26 Nov 2008 09:02:37 -0700 Subject: mesa: remove debug code --- src/mesa/shader/slang/slang_compile.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index efae4e98fb..457a6b92c1 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -1391,7 +1391,6 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O, RETURN0; break; case OP_METHOD: - printf("******* begin OP_METHOD\n"); op->type = SLANG_OPER_METHOD; op->a_obj = parse_identifier(C); if (op->a_obj == SLANG_ATOM_NULL) -- cgit v1.2.3 From aa40de5c6f7f70844d4a4c726456cceaee9f0e4d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 26 Nov 2008 09:35:08 -0700 Subject: mesa: add missing size check for assignment optimization --- src/mesa/shader/slang/slang_emit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index f31e9b4e6c..e3cb252a3d 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -1324,7 +1324,8 @@ emit_copy(slang_emit_info *emitInfo, slang_ir_node *n) _slang_is_temp(emitInfo->vt, n->Children[1]->Store) && (inst->DstReg.File == n->Children[1]->Store->File) && (inst->DstReg.Index == n->Children[1]->Store->Index) && - !n->Children[0]->Store->IsIndirect) { + !n->Children[0]->Store->IsIndirect && + n->Children[0]->Store->Size <= 4) { /* Peephole optimization: * The Right-Hand-Side has its results in a temporary place. * Modify the RHS (and the prev instruction) to store its results -- cgit v1.2.3 From 001b1cbb0dacf76dd09cda56840c30226abd3534 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 26 Nov 2008 09:35:26 -0700 Subject: mesa: add missing type check for function calls --- src/mesa/shader/slang/slang_codegen.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 8d2655ec51..8abb642a72 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -2028,6 +2028,21 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name, return NULL; } + /* type checking to be sure function's return type matches 'dest' type */ + if (dest) { + slang_typeinfo t0; + + slang_typeinfo_construct(&t0); + _slang_typeof_operation(A, dest, &t0); + + if (!slang_type_specifier_equal(&t0.spec, &fun->header.type.specifier)) { + slang_info_log_error(A->log, + "Incompatible type returned by call to '%s'", + name); + return NULL; + } + } + n = _slang_gen_function_call(A, fun, oper, dest); if (n && !n->Store && !dest -- cgit v1.2.3 From 279343059f8ec676afc1713f9d15030ba06f4a07 Mon Sep 17 00:00:00 2001 From: Thomas Henn Date: Wed, 26 Nov 2008 09:49:32 -0700 Subject: windows: fix _mesa_unreference_framebuffer() to pass ** type. --- src/mesa/drivers/windows/gdi/wmesa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c index 1ddea33e35..42432d6064 100644 --- a/src/mesa/drivers/windows/gdi/wmesa.c +++ b/src/mesa/drivers/windows/gdi/wmesa.c @@ -56,11 +56,13 @@ wmesa_free_framebuffer(HDC hdc) prev = pwfb; } if (pwfb) { + struct gl_framebuffer *fb; if (pwfb == FirstFramebuffer) FirstFramebuffer = pwfb->next; else prev->next = pwfb->next; - _mesa_unreference_framebuffer(&pwfb->Base); + fb = &pwfb->Base; + _mesa_unreference_framebuffer(&fb); } } -- cgit v1.2.3 From 55aeeef5476528907f12ba42d6157dc1b016cadf Mon Sep 17 00:00:00 2001 From: Thomas Henn Date: Wed, 26 Nov 2008 09:51:29 -0700 Subject: windows: fix visual object memleak --- src/mesa/drivers/windows/gdi/wmesa.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c index 42432d6064..80746950c7 100644 --- a/src/mesa/drivers/windows/gdi/wmesa.c +++ b/src/mesa/drivers/windows/gdi/wmesa.c @@ -1505,6 +1505,9 @@ WMesaContext WMesaCreateContext(HDC hDC, ctx = &c->gl_ctx; _mesa_initialize_context(ctx, visual, NULL, &functions, (void *)c); + /* visual no longer needed - it was copied by _mesa_initialize_context() */ + _mesa_destroy_visual(visual); + _mesa_enable_sw_extensions(ctx); _mesa_enable_1_3_extensions(ctx); _mesa_enable_1_4_extensions(ctx); -- cgit v1.2.3 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 From c303e7299b5f95d4728c3710c56f50b1fefca09d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 27 Nov 2008 11:01:30 -0700 Subject: mesa: remove an assertion (see bug 18734) --- src/mesa/shader/prog_statevars.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c index 0a21bebfaa..1c333848ee 100644 --- a/src/mesa/shader/prog_statevars.c +++ b/src/mesa/shader/prog_statevars.c @@ -780,7 +780,6 @@ append_token(char *dst, gl_state_index k) append(dst, "ShadowAmbient"); break; default: - assert(0); ; } } -- cgit v1.2.3