The gralloc API assumes system-wide reference counting of gralloc
buffers. The host-GL accelerated gralloc maps buffers to host-side
ColorBuffer objects, but was destroying them unconditionally in
gralloc_free(), ignoring any additional references from
gralloc_register_buffer().
This affected the SurfaceTexture gralloc buffers used by the
Browser/WebView. For some reason these buffers are actually allocated
by SurfaceFlinger and passed back to the WebView through Binder. But
since SurfaceFlinger doesn't actually need the buffer for anything,
sometime after the WebView has called gralloc_register_buffer()
SurfaceFlinger calls gralloc_free() on it. This caused the host
ColorBuffer to be destroyed long before the WebView is done using it.
Change-Id: I33dbee887a48a6907041cf19e9f38a1f6c983eff
This adds an initLibrary() function to libOpenglRender.
It will be used by the emulator to fallback on software rendering
if the library cannot be initialized properly, e.g. if it is not
possible to load the host EGL/GLES libraries.
Change-Id: I41e8ad73a315166e4a15cbee1db72c2552370f46
There is a flashing effect we see on Mac when switching between
drawables (pbuffer and a window) on the same context.
This change make the FrameBuffer object in the renderer to use
two different OpenGL contexts, one which is used while the pbuffer
drawable is bound and another which is used when the subwindow is
bounded during swap. The two contexts share textures so both contexts
have access to all allocated color buffers.
While this fixes the flashing effect on Mac, it should be more effective on
other platforms as well.
Change-Id: I63b49f0cdae8e2785765503750bbf5fbd4d963a1
This change removes the 'blitFromPbuffer' path in the renderer
which uses binding pbuffer to texture. This path does not work
on all platforms and is not relavent any more. It simplifies
a lot the FBConfig filtering code.
Also, added a check to fail the renderer initialization if
the translator plugin does not support EGL_KHR_gl_texture_2d_image
and GL_OES_EGL_IMAGE (by both GLES implementations [1 and 2])
since our implementation requires it.
Change-Id: Ifd4c66943a8da56308cfb7e38914c962b4f5befe
Changes the render_api to support re-creating the display
sub-window and the ability to rotate the displayed framebuffer
image.
That currently works only when the renderer runs as a thread
and not as seperate process. Therefore we setup the library
to run the renderer as thread(s) inside the calling process
on *all* platforms for now.
Change-Id: Ifd009db903759042a7edcf89866d3c3fe076cae9
needed changes to support glEGLImageTargetRenderbufferStorageOES,
added implementation in egl and added tokens to renderControl.
Also fixed function pointers returned by eglGetProcAddress to
return functions that works independant of the current context,
see system/egl/ClientAPIExts.cpp
That makes the egl_image conformance test to pass on the guest.
Change-Id: I580cda82ba0fb44f12b75aa0bbacf5cd9f15f744
Make the event pump loop in the renderer process we do on Windows
exit when the Framebuffer's subwindow is destroyed.
Fixed TcpStream to close the socket using 'closesocket' on windows,
otherwise the other end of the socket does not sense that the socket
is closed.
+ Use WS_DISABLED to ensure that our GL subwindow doesn't receive
any input events.
Change-Id: Icb477b3e1d7993a8880acb5e01bc5da29309ae50
Handling clean exit of the renderer when stopOpenGLRenderer
is called. This is done by openning a connection to the renderer
and flag that it should exit. Added 'clientFlags' field which must
be send after every connection is made to the renderer for this purpose.
The server will wait for running rendering threads to exit and then will
close all EGL/GL resources and will exit. The stopOpenGLRenderer will
return only when the renderer has exited.
Change-Id: I8272b8ea59d5fc78453bb7bd2d25908068869fa7
The following enables the renderer build on darwin.
Moved platform specific type declarations from render_api.h
to render_api_platform_types.h so it can be included from the
objective c code.
Fixed subwindow to use EmuGLView which overrides NSView to prevent
background drawing of the view.
The application provides the window handle to which the
OpenglRenderer should render to however only a sub-region of
this window needs to be rendered. This change adds this functionality
by creating a native child subwindow into which rendering will happen.
Added GLESv2 library to system.
Made fixes to the host libOpenGLRender to
compile and support GLESv2 (defined WITH_GLES2).
Other fixes required to make GLESv2 to work.
Change-Id: I9eb198e6092e7fa3550342c50929dd1714282cb3
Those are the host side fixups required for the system to load
without failure to the point of bootanimation is run.
Change-Id: I42eebb123b05aaf6a0671e91e77a4ba6b330b852
This is a library which includes all the OpenGL renderer functionality,
it is packaged in a library so that both the renderer process and the emulator
program will be able to use that functionality.
NOTES:
1) gl_proc.h and GLDispatch.{h,cpp} in this commit will be replaced
with the decoder auto-generated dispatch in a later commit, the
auto-generated dispatch is currently missing some extension functions
required for the renderer.
2) look at host/include/libOpenglRender/render_api.h for the external
interface defined for this library (to be used by the emulator).
The following is a description of each component:
FrameBuffer - The main object which manages the framebuffer and color buffers.
This is a singleton which get initialized through its initialize
static function. It initializes the OpenGL renderer and must be
called first. This initialization function is not thread safe so
it must be called before any thread that is calling to this
library is created.
FBConfig - Includes a static set of configs supported by the renderer which get
initialized during FrameBuffer initialization phase. Also,
an instance of this class includes the a description of one frame
buffer configuration supported by the renderer.
RenderContext - encapsulate a rendering context state.
ColorBuffer - implements a color buffer object as a texture which can be bind
as render target or source.
WindowSurface - implements the functionality of a native window which can be
bound to a rendering context and its target ColorBuffer can
be specified and replaced.
ThreadInfo - holds per-thread information.
EGLDispatch - loads the EGL plugin library, all egl calls are made through
this dispatch table which get initialized during initialization
phase.
GLDispatch - loads the GLES plugin library, all GLES calls are made through
this dispatch table which get initialized during initialization
phase - This will be replaced by the auto-generated code of the
decoder ...
RenderThread - implements a thread that reads command tokens from an IOStream
and decode it.
RenderControl - implements the host side implementation of the renderControl
API, when a renderControl token is decoded from the stream
it is dispatched to this implementation.
RenderServer - implements a TCP server which listens to port number and
launcges a RenderThread for each new connection.
Change-Id: I9f34d17bdfcb715893a13cd30086c767f499df87