[Piglit] [PATCH] glx: Rerun failing tests in auto mode if there is a pending expose event

Brian Paul brianp at vmware.com
Tue Sep 26 16:42:19 UTC 2017


On 09/26/2017 10:55 AM, Thomas Hellstrom wrote:
> On 09/26/2017 08:47 AM, Brian Paul wrote:
>> 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.
>> "
>>
>
> Sure.
>
>>>
>>> Signed-off-by: Thomas Hellstrom <thellstrom at 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?
>>
> It can, but in the non-automatic mode we don't exit the event loop and
> the expose event would be caught by the next iteration, already causing
> a redraw.

OK, yeah, I didn't look at the surrounding code.  Sounds fine.

-Brian



More information about the Piglit mailing list