egl: Add a module_init function for loading modules and pass EGL functions into the platform modules
egl:wayland: Send a wl_display.sync event after wl_surface.commit in queueBuffer

Some compositors, namely weston, queue buffer release events and wait until
something like a frame event to flush them out.  Without a frame event, you
need to send a wl_display.sync event to ensure that the resulting
wl_buffer.release actually gets sent.  Without this, you may get starved
for buffers.
egl:wayland: Properly handle eglSwapBuffer commit symantics

eglSwapBuffers should not return without calling wl_surface.commit.  This
is because wl_surface.commit is used to synchronize a lot more than just
the currently attached buffer and damage.  Unfortunately, in some EGL
implementations, eglSwapBuffers returns before queueBuffer is actually
called.  In particular, the Android binary blob for the Mali 400 does this.
To make matters worse, the Mali 400 blob doesn't call queueBuffers at all
if no rendering commands have been issued since the last swap.

In order to deal with this we notify the WaylandNativeWindow of the
impending swap, then call eglSwapBuffers on the parent implementation, and
then notify the WaylandNativeWindow once the swap is complete.  The
EGL_EXT_fence_sync extension is used ensure that the swap has actually
completed before we notify the window.  If the window has not seen a call
to queueBuffer yet, it simply does an extra commit.

The one other possible edge case here is if EGL_EXT_fence_sync is not
provided by the parent blob or if it doesn't work to detect the end of the
swap.  However, all that happens in this case is that we generate an extra
swap.  This means the protocol stream will be wrong, but not nearly as
wrong as it used to be.
egl:wayland: Add support for EGL_EXT_swap_buffers_with_damage
Merge pull request #200 from jekstrand/master

Fix up eglSwapBuffers and add eglSwapBuffersWithDamageEXT