[Piglit] [PATCH] glx: Fix make-current

Ernestas Kulik ernestas.kulik at gmail.com
Fri Aug 24 17:49:09 UTC 2018

The test contains a couple of problems that cause failures - one of them
is described in https://bugzilla.freedesktop.org/show_bug.cgi?id=32946,
and can be fixed by swapping buffers in win_one when it is set as the
current drawable of the context, not when win_two is.
The other issue is the actual test failure, which is caused by calling
glClear() only once and when no drawables have been made current, so
nothing is drawn, and glReadPixels() returns garbage. That is fixable by
calling glClear() for each drawable at the appropriate time.

Signed-off-by: Ernestas Kulik <ernestas.kulik at gmail.com>
Tested-by: Ernestas Kulik <ernestas.kulik at gmail.com>
 tests/glx/glx-make-current.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/tests/glx/glx-make-current.c b/tests/glx/glx-make-current.c
index fd284ba70..0f743b741 100644
--- a/tests/glx/glx-make-current.c
+++ b/tests/glx/glx-make-current.c
@@ -52,20 +52,15 @@ draw(Display *dpy)
 	glClearColor(0.0, 1.0, 0.0, 1.0);
-	glXMakeCurrent(dpy, win_two, ctx);
+	glXMakeCurrent (dpy, win_one, ctx);
-	glXMakeCurrent(dpy, win_one, ctx);
 	pass &= piglit_probe_pixel_rgb(1, 1, green);
+	glXSwapBuffers(dpy, win_one);
 	glXMakeCurrent(dpy, win_two, ctx);
 	pass &= piglit_probe_pixel_rgb(1, 1, green);
-	glXSwapBuffers(dpy, win_one);
 	glXSwapBuffers(dpy, win_two);
 	/* Free our resources when we're done. */

More information about the Piglit mailing list