cmake,waffle: Bump requirement to waffle>=1.0

If piglit is configured to use waffle, then use pkgconfig to require
waffle>=1.0. Also, replace the custom cmake WAFFLE variables with those
provided by the pkg_check_modules.

Waffle 1.0 moved its header directory from $prefix/include/waffle to
$prefix/include/waffle-1. So add '-I $prefix/include/waffle-1' to the
CFLAGS and update the #include directives appropriately.

Signed-off-by: Chad Versace <chad@chad.versace.us>
cmake: Remove unused moudule FindWaffle

Now that Piglit uses pkgconfig to find Waffle, this module is no longer
used.

Signed-off-by: Chad Versace <chad@chad.versace.us>
glut_waffle: Always choose a config with RGBA

It is impossible to not request RGBA because GLUT_RGB and GLUT_RGBA are
both 0. That is, (display_mode & (GLUT_RGB | GLUT_RGBA)) is unconditonally
true.

Signed-off-by: Chad Versace <chad@chad.versace.us>
proxy-texture: test proxy texture error checking

When a glTexImage(GL_PROXY_TEXTURE_x) call generates an error there are
two possible outcomes:
1. Generate a regular GL error.
2. Don't generate a GL error.  Instead, zero-out the texture image's
   width, height, depth and format.

The spec isn't totally explicit about all this but in general the second
case happens when we exceed texture size/memory limits (that's the point
of proxy textures afterall).

Test passes with NVIDIA's driver.  Untested with AMD.  Mesa fixes/patches
are pending.
quad-invariance: Fix undefined ReadPixels behavior and make concurrent.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
copyteximage: add more red/rg formats in supported_format()

This fixes some failures when GL_ARB_texture_rg is not supported.

Reiewed-by: Anuj Phogat <anuj.phogat@gmail.com>
copyteximage: refactor the code for readability and debugging

Test a single target/format combination in test_target_and_format().
This makes it a bit easier to hack the code to debug a specific
combination.  It's also easier to read.

(note: the patch/diff might look really ugly and complicated but the
code movement is pretty simple, actually)

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Handle OpenGL ES-CM 1.x strings in piglit_get_gl_version

Otherwise, piglit would fail to parse the version string and report a
failure if glGetString(GL_VERSION) were called in an ES 1.x context.
util: Add piglit_is_egl_extension_supported()
egl_khr_create_context: Add common test infrastructure

v2: - Require EGL_KHR_surfaceless_context instead of other surfaceless
      extensions.
    - Fix for-loop typo.
    - Make EGL_KHR_create_context_setup take a renderable_type_mask argument.
    - Make EGL_KHR_create_context_setup return whether it succeeded.
    - PIGLIT_SKIP if eglChooseConfig fails (in the case of requesting an
      ES 1.x context when 1.x isn't supported).
    - Add version_is_valid_for_context helper function.
egl_khr_create_context: Verify default major version is 1 for GLES

v2: - Ask for minor version 0 and expect to get a 1.0 or 1.1 context.
    - Ask for EGL_OPENGL_ES_BIT renderable type, and skip the test if ES 1
      isn't available.
egl_khr_create_context: Verify default minor version is 0 for GLES

v2: - Try for EGL_OPENGL_ES_BIT renderable type, and if it fails try
      EGL_OPENGL_ES2_BIT renderable type.
egl_khr_create_context: Verify that the attributes list can be empty for GLES

v2: - Ask for EGL_OPENGL_ES_BIT renderable type since the defaults for
      major/minor are 1.0, so we can't get an ES2 context with an empty
      attributes list. If ES 1 isn't available, skip.
egl_khr_create_context: Verify that the attributes list pointer can be NULL for GLES

v2: - Ask for EGL_OPENGL_ES_BIT renderable type since the defaults for
      major/minor are 1.0, so we can't get an ES2 context with a null
      attributes list. If ES 1 isn't available, skip.
egl_khr_create_context: Verify that the invalid GL versions are rejected

v2: - Do "pass = pass && ...;" instead of "pass = ... && pass;".
    - Pass EGL_OPENGL_*BIT to _setup() and check versions for the
      specific rendering API.
egl_khr_create_context: Verify that the invalid attributes are rejected for Desktop GL

v2: - Update typo'd (in the spec) EGL_CONTEXT_OPENGL_* names.
    - Ask for EGL_OPENGL_BIT and skip if not available.
    - Call eglBindAPI(EGL_OPENGL_API) after _setup.
    - Fix gl_version condition (from '< 32' to '>= 32').
egl_khr_create_context: Verify that the invalid flags are rejected for Desktop GL

v2: - Correct value of first_valid_flag.
    - Ask for EGL_OPENGL_API and skip if not available.
egl_khr_create_context: Verify that the forward-compatible flag can be accepted for Desktop GL

v2: - Ask for EGL_OPENGL_BIT and skip if not available.
    - Only check EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR if GL
      3.2+
v3: - Only check EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR if GL
      3.0+
    - Skip if GL < 3.0.
egl_khr_create_context: Verify that the attributes list can be empty for Desktop GL
egl_khr_create_context: Verify that the attributes list pointer can be NULL for Desktop GL