glx: Fix make-current

Submitted by Ernestas Kulik on Aug. 24, 2018, 5:49 p.m.

Details

Message ID 20180824174909.13894-1-ernestas.kulik@gmail.com
State New
Headers show
Series "glx: Fix make-current" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Ernestas Kulik Aug. 24, 2018, 5:49 p.m.
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@gmail.com>
Tested-by: Ernestas Kulik <ernestas.kulik@gmail.com>
---
 tests/glx/glx-make-current.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Patch hide | download patch | download mbox

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)
 	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 
 	glClearColor(0.0, 1.0, 0.0, 1.0);
-	glClear(GL_COLOR_BUFFER_BIT);
-
-	glXMakeCurrent(dpy, win_two, ctx);
 
+	glXMakeCurrent (dpy, win_one, ctx);
 	glClear(GL_COLOR_BUFFER_BIT);
-
-
-	glXMakeCurrent(dpy, win_one, ctx);
 	pass &= piglit_probe_pixel_rgb(1, 1, green);
+	glXSwapBuffers(dpy, win_one);
 
 	glXMakeCurrent(dpy, win_two, ctx);
+	glClear(GL_COLOR_BUFFER_BIT);
 	pass &= piglit_probe_pixel_rgb(1, 1, green);
-
-	glXSwapBuffers(dpy, win_one);
 	glXSwapBuffers(dpy, win_two);
 
 	/* Free our resources when we're done. */

Comments

Actually, scratch that, I must have been high when I wrote the commit
message.

Even though the fix for BadMatch is probably correct, glClear() is
obviously called for both drawables, but switching them between drawing
and reading seems to result in discarded framebuffers or somesuch (in
i965 they are straight up null, unlike swrast, but the issue manifests
there as well).
I'm not even sure what you're trying to fix.  As far as I can tell, that
test is making a perfectly valid sequence of calls.  If a particular
driver fails on that, it is a bug in the driver.

On 08/25/2018 12:29 PM, Ernestas Kulik wrote:
> Actually, scratch that, I must have been high when I wrote the commit
> message.
> 
> Even though the fix for BadMatch is probably correct, glClear() is
> obviously called for both drawables, but switching them between drawing
> and reading seems to result in discarded framebuffers or somesuch (in
> i965 they are straight up null, unlike swrast, but the issue manifests
> there as well).
> 
> _______________________________________________
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit