x11: Don't teardown uninitialized state in x11_window

If x11_window::xcb has not been set, then don't call xcb_destroy_window().

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

A recent refactoring of src/waffle/CMakeLists.txt broke the Mac build. The
variable waffle_libdeps accumulates various library dependencies,
including Mac-specific libraries. After the botched refactoring, this
variable got dropped from target_link_libraries().

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
waffle: Fix -Wmissing-prototypes warnings

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
cmake: Remove -Werror from CFLAGS

Oliver rightfully complained that -Werror will causes the build to fail
for people who use a different compiler, or just a different version of
the same compiler.

This patch repalces the catch-all -Werror with a few specific ones that
waffle should care about.

Reported-by: Oliver McFadden <oliver.mcfadden@linux.intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
man: Fix omission of GBM

Replace the phrase with "X11/EGL and Wayland" with "EGL platforms".  Grep
reveals this to be the only omission.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
man: List valid values for WAFFLE_CONTEXT_PROFILE

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
tests/gl_basic: Refactor with new param, 'expect_config_unsupported'

Add a new param to gl_basic_draw, `bool expect_config_unsupported`. This
refactor should change no behavior, because all calls to gl_basic_draw set
expect_config_unsupported=false.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
tests/gl_basic: Check that GLX does not support GLES1

Replace tests
    gl_basic.glx_gles1_rgb
    gl_basic.glx_gles1_rgba
with
    gl_basic.glx_gles1_unsupported

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
tests/gl_basic: Check that CGL does not support ES1 and ES2

Add tests:
    gl_basic.cgl_gles1_unsupported
    gl_basic.cgl_gles2_unsupported

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
all: Declare vtbl functions in headers

This prepares for the next commit, which removes the vtbl from each
display, config, context, and window object.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
core: Aggregate all object vtbl's into wcore_platform_vtbl

Functions have always been dispatched at the granularity of platform, not
of object. Having each object possess a vtbl is unnecessary and just
overcomplicates things. Virtual dispatch in C is messy business, and we
should keep it as simple as possible.

This patch moves the vtbl for each of wcore_display, wcore_config,
wcore_context, and wcore_window into the vtbl of wcore_platform.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
cgl: Rename verbosely named functions

Remove 'platform' from the following function names:
    cgl_platform_make_current
    cgl_platform_get_proc_address

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

In the beginning, there was only one EGL platform: xegl.  Later, wayland
and android and gbm were added. As each new platform was added, it
inherited a large portion of the previous platform's egl code by
copy-and-paste. Some egl code was shared via helper functions in
egl_no_native.c and egl_native_template.c, but still large portions of
code were duplicated.

The most egregious example of the code duplication took place in the
config and context objects. The files {xegl,wayland,droid,gbm}_config.[ch]
are are nearly identical boilerplate. Ditto for context.[ch].

Now that a new feature needs to be added to the EGL code, support for ES3,
it is an opportune time to remove the duplicate EGL code and refactor.

The extant EGL utilitiy functions are "thin"; they take real EGL types as
input. In order to kill the duplicate code in the config and context
classes, and to smoothly add ES3 support, the thin utility functions need
to be replaced with real classes.

This patch rewrites the egl module by introducing four classes:
    wegl_display
    wegl_config
    wegl_context
    wegl_window

This patch keeps the old egl code in-place so that platform modules can
migrate to the new egl code one at a time.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
xegl: Convert to use new egl module

Lines of code changed: +118 / -508
Files removed: 6

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
xegl: Rename verbosely named functions

Remove 'platform' from the following function names:
    xegl_platform_dl_can_open
    xegl_platform_dl_sym

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
wayland: Convert to use new egl module

Lines of code: +91 / -494
Files removed: 6

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
wayland: Rename verbosely named functions

Remove 'platform' from the following function names:
    wayland_platform_dl_can_open
    wayland_platform_dl_sym

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
core: Store wcore_config_attrs in wcore_config

This removes the need for each platform's config object to transport
additional platform-specific information to the context and window.

In particular, wgbm_config currently transports the GBM_FORMAT
to wgbm_window. Once the gbm module is converted to use the egl module,
however, that transport will be impossible without this patch because
wegl_config contains no platform-specific data.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
wegl: Don't cache values in wegl_config; use wcore_config::attrs

Remove the following struct members:
    wegl_config::egl_render_buffer
    wegl_config::waffle_context_api

Instead, compute their values on demand by referring to
wcore_config::attrs.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
glx: Don't cache values in glx_config; use wcore_config::attrs

Remove the following struct members:
    glx_config::waffle_context_api
    glx_config::waffle_context_major_version
    glx_config::waffle_context_minor_version
    glx_config::waffle_context_profile

Intead, compute their values on demand by referring to
wcore_config::attrs.

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