cmake: Fix waffle version requirement

CMake is so stupid sometimes :(

When building with waffle, piglit requires waffle >= 1.2.2. Piglit's
CMake captures the required by calling

    pkg_check_modules(WAFFLE REQUIRED waffle-1>=1.2.2)

However, we cannot reliably check the version with pkg_check_modules(). The
problem is that, if one passes a required version to pkg_check_modules(), CMake
validates the required version at most once for the lifetime of the source tree.
If someone changes the required version by editing the CMakeLists, CMake fails
to detect the new requirement.

To workaround this deficiency of CMake, check the version instead with

    if(WAFFLE_VERSION VERSION_LESS 1.2.2)

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
cmake: If using Waffle, require waffle >= 1.3

Subsequent patches will enable creation of forward-compatible and debug
contexts, which arrived in waffle-1.3.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
util/waffle: Print more info when context creation fails

When waffle_config_choose() or waffle_context_create() fails, print
Waffle's error message to stderr. Several people (Carl, Ian, Timothy
Arceri) have requested this.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
util/wfl: Refactor make_context_current_singlepass()

Let make_context_current_singlepass() directly call
waffle_config_choose(). Add helper function make_config_attrib_list()
that makes the attribute list passed to waffle_config_choose(). This
refactor will make possible better error messages.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
util/waffle: Improve error messages when context creation fails

Unify the 3 occurences of message "Failed to create ... context", and
move the message closer to the failure.

Print a more helpful message when special_case_gl_31() fails.

Add helper function make_context_description(), used in the newer better
error messages.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
util/gl: Support creation of forward-compatible contexts

Add a new boolean flag to the PIGLIT_GL_TEST_CONFIG block,
`config.require_forward_compatible_context`. If the test is unable to
create a foward-compatible context, then the test skips.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
util/gl: Support creation of debug contexts

Add a new boolean flag to the PIGLIT_GL_TEST_CONFIG block,
`config.require_debug_context`. If the test is unable to create a debug
context, then the test skips.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
util/wfl: Remove hacks for compat contexts

When a test requested a compatibility context, Piglit did not pass the
context version to Waffle. Instead, Piglit requested an unversioned
compatibility context and then verified with piglit_get_gl_version()
that the actual version was >= requested version.

This hack prevented Piglit from creating forward-compatible contexts,
because, according to thw EGL_KHR_create_context spec, "requesting
a forward-compatible context for OpenGL versions less than
3.0 will generate an error."

Remove the hack. Pass the requested context version to Waffle.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
gl-3.0: Add test for the forward-compatible bit

Create a context with or without the forward-compatible bit, according to
a command line flag.  Then verify that GL_CONTEXT_FLAGS does or does not
contain GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>