man: Document new attrib WAFFLE_CONTEXT_DEBUG

The new attribute isn't implemented yet, but I like to commit
documentations before implementation. This attribute selects
a debug context.

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

This adds support only to core waffle. That is, this patch makes aware
only wcore_config_attrs_parse() and wcore_enum_to_string().

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

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
core: Add unittests for WAFFLE_CONTEXT_DEBUG

Add the following unittests.

wcore_config_attrs.debug_gl
wcore_config_attrs.debug_gl21
wcore_config_attrs.debug_gl32_core
wcore_config_attrs.debug_gl32_compat
wcore_config_attrs.debug_gles1
wcore_config_attrs.debug_gles2
wcore_config_attrs.debug_gles3

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

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
examples/gl_basic: Add support for debug contexts

Add new command line argument, --debug. If set and the created context
is not a debug context, then gl_basic fails.

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

As of 2013-09-16 and up to Mac OS 10.8 Mountain Lion, CGL doesn't allow
creation of debug contexts. Emit WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM if
the user requests one.

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

If the waffle_config has WAFFLE_CONTEXT_DEBUG=true, then try to create
a debug context.

Validated with ``gl_basic --platform=glx --api=gl --debug`` on Mesa
9.3.0-devel (git-24765c5) with Intel Ivybridge.

However, that Mesa is buggy.  glXCreateContextAttribsARB fails in
``gl_basic --platform=glx --api=gles2 --debug``.

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

If the waffle_config has WAFFLE_CONTEXT_DEBUG=true, then try to create
a debug context.

Validated with ``gl_basic --platform=x11_egl --api=gl --debug`` on Mesa
9.3.0-devel (git-24765c5) with Intel Ivybridge.

However, that Mesa is buggy.  In ``gl_basic --platform=x11_egl --api=$API
--debug`` for API=gles1,gles2,gles3, eglChooseConfig emits
EGL_BAD_ATTRIBUTE. Version 15 of EGL_KHR_create_context explicitly
allows the debug bit for GLES contexts, so Mesa should instead emit
EGL_BAD_MATCH.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
tests/gl_basic: Add tests for debug contexts

Add the following tests. Tests marked with '*' were validated on
Mesa 9.3.0-devel (git-24765c5) with Intel Ivybridge.

    gl_basicl.cgl_gl_debug_is_unsupported
    gl_basicl.glx_gl_debug *
    gl_basicl.wayland_gl_debug *
    gl_basicl.x11_egl_gl_debug *

Dont' add any tests for OpenGL ES debug contexts, because Mesa's GLX and
EGL do not correctly handle requests OpenGL ES debug contexts.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Merge branch 'debug-contexts'
tests/gl_basic: Fix order of CGL tests

The order which test functions are defined should match the order listed
in ${platform}_testsuite.

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