android-emugl: Move render_api.h to host/libs/libOpenglRender

Small cleanup: move the render_api.h header (and render_api_platform_types.h) to
host/libs/libOpenglRender/, a more logical location since these are not
included by anything else.

Initally, the headers were exposed to be included from the emulator,
but since the latter relies on lazy dynamic linking, this is no longer
the case.

Change-Id: I74c1287b1a44bc0027caadfbd49b7a3250114ac8
android-emugl: Add IOStream::forceStop() method.

This adds a method used to force an I/O stream to stop, i.e. any
blocking read()/write() call on it will fail. This is required by
later patches to allow gracefully force-termination of threads
blocked on stream i/o.

Change-Id: Ie2db57e5ed66c8e2a425c04be4a53011dff9759b
android-emugl: Fix RenderThread termination.

This ensures that RenderThread instances are properly deleted by the
RenderServer thread when shutting down the GPU emulation library.

Before the patch, the thread wait() call blocked endlessly because
the thread could be blocked waiting on I/O.

Change-Id: I08ec89d80b2499765a248205af4c8337f2f0f096
android-emugl: Add RenderWindow class.

This patch introduces a new class called RenderWindow which is in
charge of handling the sub-window that displays the emulated GPU
content inside the main window.

For now, this simply moves a little bit of code from render_api.cpp to
RenderWindow.cpp, however in the future, a dedicated thread will be
created and wrapped by the class to ensure there are no conflicts
between the main window and the sub-window GL display and context.

This should fix the SDL2 UI backend on all platforms.

Change-Id: Ic516559202d51b52778db569993ed9f0820404ea
android-emugl: Add ::emugl::CondVariable.

This adds an implementation of conditional variables to emugl/common/
which will be used in a future patch to implement an IPC channel between
two threads.

The Posix implementation is a mere wrapper around pthread_cond_t.
On the other hand, the Win32 one is based on the Chromium implementation
of ::base::ConditionVariable for this platform, and uses one event HANDLE
per wait()-ing thread.

Note that this is all very basic, i.e. no support for broadcast(),
tryWait(), or timedWait() for now.

Change-Id: Id4bca065f51c61a22eb106a2e2e6b66677e47ee1
android-emugl: Add ::emugl::MessageChannel<> template.

Add a new templated type used to implenent a uni-directional IPC channel
between two threads. It allows one thread to send fixed-size messages to
another thread in a synchronized way, with an internal buffer of
configurable size.

Change-Id: I9f48ccbc444784ccb9901c452abc4a7dd62d5797
android/qemu-launcher: Group target information.

This compiles all target-specific constants into a single structure
to make it easier to port the new ranchu launcher to newer targets.

Change-Id: Ib33e80e3c34f10189a239fb8c0634953647d6d23
Rename new launcher to emulator-ranchu-<arch> instead of emulator-<arch>

This ensures the new launcher programs for QEMU have a distinct name,
this will allow in the future to support 32-bit Ranchu ARM emulation,
through either 'emulator-arm' (classic emulator) and 'emulator-ranchu-arm'
(new emulator).

Of course, the selection between both will probably depend on the AVD's
API level, but for now this is good enough.

The 'emulator' launcher is also modified to probe for emulator-ranchu-<arch>
before emulator-<arch> to ease testing.

Change-Id: Idfd628484535d20baf78e95dd71b640e9917b0e4
Merge changes Idfd62848,Ib33e80e3

* changes:
  Rename new launcher to emulator-ranchu-<arch> instead of emulator-<arch>
  android/qemu-launcher: Group target information.
android/skin/: Ensure EmuGL is properly shutdown on program exit.

Change-Id: I7a07d67a90e1f3817c969034385ad4bc11038852
Merge "android-emugl: Move render_api.h to host/libs/libOpenglRender"
Merge changes I7a07d67a,I9f48ccbc,Id4bca065,Ic5165592,I08ec89d8, ...

* changes:
  android/skin/: Ensure EmuGL is properly shutdown on program exit.
  android-emugl: Add ::emugl::MessageChannel<> template.
  android-emugl: Add ::emugl::CondVariable.
  android-emugl: Add RenderWindow class.
  android-emugl: Fix RenderThread termination.
  android-emugl: Add IOStream::forceStop() method.