From 4ebf07a426771b62123e5fcb5a8be0de24037af1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 13 Sep 2010 08:39:42 -0400 Subject: [PATCH] glx: Don't destroy DRI2 drawables for legacy glx drawables For GLX 1.3 drawables, we can destroy the DRI2 drawable when the GLX drawable is destroyed. However, for legacy drawables, there os no good way of knowing when the application is done with it, so we just let the DRI2 drawable linger on the server. The server will destroy the DRI2 drawable when it destroys the X drawable or the client exits anyway. https://bugs.freedesktop.org/show_bug.cgi?id=30109 --- src/glx/dri2_glx.c | 12 +++++++++++- src/mesa/vbo/vbo_exec_array.c | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index e38a40ce53d..8247588e76b 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -210,7 +210,17 @@ dri2DestroyDrawable(__GLXDRIdrawable *base) __glxHashDelete(pdp->dri2Hash, pdraw->base.xDrawable); (*psc->core->destroyDrawable) (pdraw->driDrawable); - DRI2DestroyDrawable(psc->base.dpy, pdraw->base.xDrawable); + + /* If it's a GLX 1.3 drawables, we can destroy the DRI2 drawable + * now, as the application explicitly asked to destroy the GLX + * drawable. Otherwise, for legacy drawables, we let the DRI2 + * drawable linger on the server, since there's no good way of + * knowing when the application is done with it. The server will + * destroy the DRI2 drawable when it destroys the X drawable or the + * client exits anyway. */ + if (pdraw->base.xDrawable != pdraw->base.drawable) + DRI2DestroyDrawable(psc->base.dpy, pdraw->base.xDrawable); + Xfree(pdraw); } diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 1759e578870..60b999f3456 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -490,6 +490,8 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) if (!_mesa_validate_DrawArrays( ctx, mode, start, count )) return; + vbo_exec_FlushVertices_internal( ctx, GL_FALSE ); + FLUSH_CURRENT( ctx, 0 ); if (!_mesa_valid_to_render(ctx, "glDrawArrays")) { -- 2.30.2