Commit Graph

8 Commits

Author SHA1 Message Date
Jesse Hall
ac018fe3f6 EmuGL: refcount ColorBuffers on the host
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
2012-02-21 11:13:20 -08:00
Guy Zadickario
f6b9241094 opengles emulator: support glEGLImageTargetRenderbufferStorageOES
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
2011-08-10 10:53:06 +02:00
Guy Zadikario
0536060b40 emulator opengl: guest/host rendering syncronization.
Added a return value for rcFlushWindowColorBuffer and
rcUpdateColorBuffer in order to make those calls to block
with a round-trip to the host. This is to make sure that
the color buffer is up-to-date before the flinger use it
for rendering.
Also added a call to the native windows's lock function after
EGL is attached and bound to render on the window. This call
was missed before.

This syncronization can be optimized by removing the round-trip
and insert sync primitive to the stream at every draw command that
reads from a color buffer to make the sync happen on the host
before rendering the color buffer and remove the need for the
guest to wait for that update.

Change-Id: I1c2d8bc407b69663e992a68d5aa755f19bbe0ec3
2011-06-25 16:56:08 +03:00
Guy Zadikario
1ef706f96f emulator opengl: implement glGetString
Added rcGetGLString token to renderControl to query
a GL string constant from the current context from the host.
Implement glGetString functinality in EGL so that the string
value can be cached in the context structure and also
implementation can be shared between GLESv1 and GLESv2.

Also, fixed clientAPI context initialization check in
eglMakeCurrent. The check was for the previously bounded
context instead for the newly bounded context.

Change-Id: I41c0b4ad462c9ad5bd5c66719b41509bb1b7a947
2011-06-21 20:47:43 +02:00
Stas Gurtovoy
613025efb3 emulator opengl: pool of fixups to the host side.
Those are the host side fixups required for the system to load
without failure to the point of bootanimation is run.

Change-Id: I42eebb123b05aaf6a0671e91e77a4ba6b330b852
2011-06-21 14:48:44 +03:00
Stas Gurtovoy
2220d27302 emulator opengl: added Bind texture to EGLImage/surface
added functionality to bind an EGLImage to a texture both
in the system and host sides.

Change-Id: I2dc26090b45da080ac4d0e8f5799c95f7cc54634
2011-06-21 01:41:50 +03:00
Stas Gurtovoy
a7b7e95b03 emulator opengl: implement eglChooseConfig functionality.
Added new RenderControl command to request the host to execute
the ChooseConfig functionality.

Change-Id: Ib92be313a6df740de69d671c6994ec6cae17ea13
2011-06-11 00:16:21 +03:00
Guy Zadikario
1f0d3939ed emulatgor opengl: First commit of the host renderer library.
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
2011-04-16 10:45:39 +03:00