eglplatform: lock when initializing

Signed-off-by: Adrian Negreanu <groleo@gmail.com>
test_glesv2: run for 3 seconds and render to whole screen

to test the destructors, the test terminates after 3 seconds;
also, to catch tearing, the whole screen is cleared to white
and the spiral rendered w/o downscale

Signed-off-by: Adrian Negreanu <groleo@gmail.com>
fbdev_window: cleanups

I've used the same idea from wayland_window.cpp, having
the buffers placed in a std::list and marked busy/free via the "busy"
member.

Fixed the crash which apparently was caused by reference counting but
in fact was dequeueBuffer not calling incRef on the buffer.

Also added documentation for most of the methods

After debugging with Carsten, fb->post is now used correctly by
adding checks for frontbuffer in ::dequeueBuffer.

[carsten] nailed the second cond_wait when cond was signaled but no
          buffers were actually available

[carsten] makefile.am changes to make it aware of --enable-debug

[carsten] add need_realloc, to trigger buffer reallocation

v3: remove custom TRACE

v2: changed licensing from lgpl to apache2
    use DEBUG which is enabled bt --enable-debug

Signed-off-by: Adrian Negreanu <groleo@gmail.com>
Merge pull request #38 from groleo/for-upstream

Reimplement FbDevNativeWindow