summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2017-06-21 13:12:44 +0200
committerBrian Paul <brianp@vmware.com>2017-06-21 13:43:05 -0600
commit8cdb621a91bc3c37bccf6dced2821431f49cb77f (patch)
treed905bf84aa09f7f54dc3b45bd6b286fc63bcc13d
parentc6e1dc5247bf3fa09f7b78157b3d5f18b200293d (diff)
gl-1.0/swapbuffers-behavior: Try avoid reading from real front v2
Window systems (read dri3) that allocate a fake frontbuffer on demand will effectively read out from the real front before the first swapbuffers after fake front creation, and the real front buffer content is subject to errors caused by, among other things, window reparenting. So increase the likelyhood of not reading out from the real front by advertizing early that we will access the front buffer. After all, real front consistency is not the objective of this test. Fixes sporadic failures due to window reparenting on dri3/vmwgfx. v2: Address review comments from Brian Paul. Cc: Brian Paul <brianp@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
-rw-r--r--tests/spec/gl-1.0/swapbuffers-behavior.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/spec/gl-1.0/swapbuffers-behavior.c b/tests/spec/gl-1.0/swapbuffers-behavior.c
index d914020a0..8d20badaf 100644
--- a/tests/spec/gl-1.0/swapbuffers-behavior.c
+++ b/tests/spec/gl-1.0/swapbuffers-behavior.c
@@ -41,7 +41,7 @@ PIGLIT_GL_TEST_CONFIG_END
static const float blue[4] = { 0.0f, 0.0f, 1.0f, 0.0f };
static const float green[4] = { 0.0f, 1.0f, 0.0f, 0.0f };
-
+static const float red[4] = { 1.0f, 0.0f, 0.0f, 0.0f };
static bool
match(const float c1[4], const float c2[4])
@@ -65,6 +65,17 @@ piglit_display(void)
glClearColor(green[0], green[1], green[2], green[3]);
glClear(GL_COLOR_BUFFER_BIT);
+ /* Clear front buffer to red. This is done to trigger the creation
+ * of a fake front buffer on GLX/dri3.
+ * Without this we'll be effectively probing the real front buffer
+ * later on, and its contents may have been modified by reparenting.
+ */
+ glDrawBuffer(GL_FRONT);
+ glClearColor(red[0], red[1], red[2], red[3]);
+ glClear(GL_COLOR_BUFFER_BIT);
+ glFlush();
+ glDrawBuffer(GL_BACK);
+
/* First swap */
piglit_swap_buffers();