[Piglit] [PATCH] glx: destroy GLX pixmaps in fbconfig iteration

Nicolai Hähnle nhaehnle at gmail.com
Fri Jan 27 11:34:03 UTC 2017


I don't see anything in the GLX spec about GLXPixmaps being destroyed
automatically. Without this patch, glx-visuals-depth/stencil -pixmap fail
with an X protocol error after some number of FBConfigs.
---
 tests/util/piglit-glx-util.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tests/util/piglit-glx-util.c b/tests/util/piglit-glx-util.c
index 3042dc8..fb434db 100644
--- a/tests/util/piglit-glx-util.c
+++ b/tests/util/piglit-glx-util.c
@@ -310,20 +310,37 @@ piglit_glx_iterate_pixmap_fbconfigs(enum piglit_result (*draw)(Display *dpy,
 		glx_pix = glXCreatePixmap(dpy, config, pix, NULL);
 		glXMakeCurrent(dpy, glx_pix, ctx);
 
 		result = draw(dpy, config);
 
 		if (result == PIGLIT_FAIL)
 			any_fail = true;
 		else if (result == PIGLIT_PASS)
 			any_pass = true;
 
+		/*
+		 * Section 3.3.5 (Off Screen Rendering) of the GLX 1.4
+		 * Specification says:
+		 *
+		 *     "A GLXPixmap is destroyed by calling
+		 *
+		 *          glXDestroyPixmap(Display * dpy, GLXPixmap pixmap);
+		 *
+		 *     This request deletes the association between the XID
+		 *     pixmap and the GLX pixmap. The storage for the GLX
+		 *     pixmap will be freed when it is not current to any
+		 *     client."
+		 *
+		 * So it should be acceptable to destroy the pixmap while it is
+		 * bound.
+		 */
+		glXDestroyPixmap(dpy, glx_pix);
 		XFreePixmap(dpy, pix);
 		glXDestroyContext(dpy, ctx);
 	}
 
 	if (any_fail)
 		return PIGLIT_FAIL;
 	else if (any_pass)
 		return PIGLIT_PASS;
 	else
 		return PIGLIT_SKIP;
-- 
2.7.4



More information about the Piglit mailing list