util/x11: Wait for expose event in manual mode or with front buffer tests.

When running piglit in manual mode (no "-auto" command-line option is
given), there's no point in calling piglit_display() before the window
is exposed.  This just leads to confusion because it will be called
again once the window appears, leading to duplicate test output in the
console window.

When running piglit in "-auto" mode, if the test accesses the front
buffer, then we need to wait until the window is exposed before
calling piglit_display(), since a front buffer is not guaranteed to be
available before then (in practice, this only happens with
non-compositing window managers).  However, if the test doesn't access
the front buffer, then it is still safe to call piglit_display()
before the expose event; doing so avoids wasting time.

Note: there are two known bugs that cause sporadic failures in certain
piglit tests with Mesa/Intel hardware (and possibly other Mesa
drivers).  See bugs #1 and #2 in
http://lists.freedesktop.org/archives/mesa-dev/2013-May/039985.html.
This change seems to exacerbate those sporadic failures.  As far
as I'm aware, the tests that are affected are:

- spec/!OpenGL 1.1/drawbuffer-modes
- spec/EXT_framebuffer_blit/fbo-sys-blit
- spec/EXT_framebuffer_blit/fbo-sys-sub-blit

I have patches on the list to fix bug #1 from that email (see
http://lists.freedesktop.org/archives/mesa-dev/2013-May/040010.html),
and Eric Anholt is working on bug #2.  I believe that once those fixes
land, the above tests should pass consistently.

Based on work by Chad Versace.

Cc: Chad Versace <chad.versace@linux.intel.com>
Cc: Eric Anholt <eric@anholt.net>

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Test a front buffer corner case: invalidate causes data loss.

Cc: Eric Anholt <eric@anholt.net>

v2: Move to spec/gl-1.0.  Add to all.tests.
Test interaction between fast color clears and glXSwapBuffers.
!UPSTREAM: Performance micro-benchmark for fast color clears.
util: Create generic piglit_draw_rect() functions.  TODO: rework.

This patch adds the following functions to piglit-util-gl-common:
- piglit_draw_rect_generic
- piglit_draw_rect_back_generic
- piglit_draw_rect_z_generic
- piglit_draw_rect_tex_generic

These functions are similar to corresponding functions without the
"_generic" suffix, except that instead of delivering vertex position
and texture coordinates to the vertex shader using glVertexPointer()
and glTexCoordPointer(), they deliver to the generic attributes
PIGLIT_ATTRIB_POS and PIGLIT_ATTRIB_TEX.  These functions use VBO's
and VAO's when available, so they may be used when testing core
contexts.

These functions also work with compatibility contexts and with all
GLES versions.  Since GLES1 doesn't support generic vertex attributes,
we fall back to using glVertexPointer() and glTexCoordPointer() in the
GLES1 case.

When building GLES tests, the behaviour of the new _generic functions
is for all intents and purposes the same as that of the pre-existing
non-generic functions.  So to avoid code duplication, the non-generic
functions simply call their generic equivalents in GLES builds.
WIP: start testing GS in/out types
WIP: fix shader_runner error reporting when vertex data included.
WIP: Basic test of GS input varyings
Geometry shaders: add a basic EndPrimitive() test.
WIP: large EndPrimitive test
shader_runner: Add missing newlines to error messages.

Certain shader error messages were missing newlines, leading to the
error message being concatenated on the same line with "PIGLIT:
{'result': 'fail' }".
Make shader_runner able to test new primitive types
!UPSTREAM: Start working on a function accuracy test
!UPSTREAM: more experimentation with function accuracy
!UPSTREAM: glx-fast-color-clear experiments
!UPSTREAM: read-after-swap

This works but I'm not convinced it's a good idea yet.

TODO:
- Discuss on mailing list.
!UPSTREAM: hacks
Front buffer rendering sanity test
Hacks
Clean up fbo-sys-blit.c