On 09/26/2017 10:32 AM, Thomas Hellstrom wrote:
Tests that check frontbuffer contents after drawing may fail because
the X server touch the front contents between drawing and checking. In those
cases, there's typically a pending expose event. So check for that
situation and optionally rerun the test.

Maybe a little word-smithing:

"
Tests that check the frontbuffer contents after drawing may fail because
the X server may touch the front contents between drawing and reading.
In those cases, there's typically a pending expose event. So check for that situation and rerun the test.
"


Signed-off-by: Thomas Hellstrom <thellst...@vmware.com>
---
  tests/util/piglit-glx-util.c | 14 ++++++++++++++
  1 file changed, 14 insertions(+)

diff --git a/tests/util/piglit-glx-util.c b/tests/util/piglit-glx-util.c
index 95e33ae..85f7eef 100644
--- a/tests/util/piglit-glx-util.c
+++ b/tests/util/piglit-glx-util.c
@@ -212,6 +212,20 @@ piglit_glx_event_loop(Display *dpy, enum piglit_result 
(*draw)(Display *dpy))
                        enum piglit_result result = draw(dpy);

                        if (piglit_automatic) {
+                               /*
+                                * Rerun if we have failed and have a
+                                * pending expose event, which might be an
+                                * indication of invalid front buffer
+                                * contents.
+                                */
+                               if (result == PIGLIT_FAIL &&
+                                   XCheckTypedEvent(dpy, Expose, &event)) {
+                                       fprintf(stderr,
+                                               "Pending expose event- "
+                                               "rerunning.\n");
+                                       XPutBackEvent(dpy, &event);
+                                       continue;
+                               }
                                XCloseDisplay(dpy);
                                piglit_report_result(result);
                                break;


I think the problem you describe could also happen when we're not running in automatic mode. Therefore, I think the new code could be put before the if (piglit_automatic) block. What do you think?

-Brian

_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to