Validate that OML Sync Control syncs to vblank.

The existing tests don't demonstrate a variety of implementation bugs
that we've observed in current drivers, so this is our attempt to
demonstrate those bugs.

v2:

- Report which loop iteration each warning is from. It's often helpful
  to know whether it was the first iteration or a later one.
- From Eric Anholt's review comments:
  - Added PIGLIT_WARN where appropriate
  - Wrapped lines to 80 characters
  - Removed comments describing checks
  - Removed glFlush()
- From Chris Wilson's review comments:
  - Don't require a glXGetSyncValuesOML call immediately after
    glXWaitForSbc/Msc to return the same UST or MSC, because
    uncontrolled delays during the test may mean that the counters
    increment between the two calls. Instead, require that alternating
    GetSyncValues and Wait calls return monotonically increasing UST and
    MSC values. Since a common failure mode in the current drivers is to
    return UST and MSC as 0 from the WaitForSbc/Msc requests (which
    obviously violates monotonicity), if those values are illegal, try
    to muddle through the rest of the test using the GetSyncValues
    results instead.
  - When divisor is 0 and the target msc equals the current msc, swaps
    may occur without syncing to vertical retrace. So don't test timing
    with a divisor of 0.

Signed-off-by: Theo Hill <Theo0x48@gmail.com>
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Added timeouts to tests that use SwapBuffersMsc.

We've observed hangs on some drivers in these calls, which make it
harder to run the rest of the Piglit test suite.

Version 2 fixes from Eric Anholt's review:
Set timeouts to 5 seconds instead of trying to calculate them on the fly

Signed-off-by: Theo Hill <Theo0x48@gmail.com>
Signed-off-by: Jamey Sharp <jamey@minilop.net>