To enable multi-touch on a tethered device, allow a callback to be
registered with the OpenGL renderer. On every frame, the framebuffer
is read into system memory and provided to the callback, so it can be
mirrored to the device.
This change is co-dependent on Idae3b026d52ed8dd666cbcdc3f3af80175c90ad3
in external/qemu.
Change-Id: I03c49bc55ed9e66ffb59462333181f77e7e46035
All ten libraries can now be built in 64-bit named "lib64*" (*)
in addition to the original 32-bit form named "lib*".
Also, dlopen "lib64*so" in 64-bit.
(*) eg. In Ubuntu, all can be built with the following command:
make out/host/linux-x86/lib/lib64OpenglRender.so \
out/host/linux-x86/lib/lib64EGL_translator.so \
out/host/linux-x86/lib/lib64GLES_CM_translator.so \
out/host/linux-x86/lib/lib64GLES_V2_translator.so
Rules to build static libraries lib64log.a, lib64cutils.a and lib64utils.a
they depend were added in other CLs.
Change-Id: I3afb64de6dda1d55dbd1b4443d2dbc78a683b19f
On Macs running OS X 10.6 and 10.7 with Intel HD Graphics 3000, some
screens or parts of the screen are displayed upside down. The exact
conditions/sequence that triggers this aren't known yet; I haven't
been able to reproduce it in a standalone test. This also means I
don't know whether it is a driver bug, or a bug in the OpenglRender or
Translator code that just happens to work elsewhere.
Thanks to zhiyuan.li@intel.com for a patch this change is based on.
Change-Id: I04823773818d3b587a6951be48e70b03804b33d0
1. "emugen" generates four *dec.cpp files containing code like this
to decode offset to pointer in stream
tmp = *(T *)(ptr + 8 + 4 + 4 + 4 + *(size_t *)(ptr +8 + 4 + 4));
If *dec.cpp are compiled in 64-bit, size_t is 8-byte and dereferencing of
it is likley to get wild offset for dereferencing of *(T *) to crash the
code. Solution is to define tsize_t for "target size_t" instead
of using host size_t.
2. Cast pointer to "uintptr_t" instead of "unsigned int" for 2nd param of
ShareGroup::getGlobalName(NamedObjectType, ObjectLocalName/*64bit*/).
3. Instance of EGLSurface, EGLContext and EGLImageKHR are used as 32-bit
key for std::map< unsigned int, * > SurfacesHndlMap, ContextsHndlMap,
and ImagesHndlMap, respectively. Cast pointer to uintptr_t and assert
upper 32-bit is zero before passing to map::find().
4. Instance of GLeglImageOES is used to eglAttachEGLImage() which expect
"unsigned int". Cast it to uintptr_t and assert upper 32-bit is zero.
5. The 5th param to GLEScontext::setPointer is GLvoid* but contains 32-bit
offset to vbo if bufferName exists. Cast it to uintptr_t and assert
upper 32-bit is zero.
6. Use %zu instead of %d to print size_t
7. Cast pointer to (uintptr_t) in many other places
Change-Id: Iba6e5bda08c43376db5b011e9d781481ee1f5a12
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
* Disable verbose debug spam.
* Add missing GL enum to utility function. The default case was
returning the correct size, so this doesn't fix any bugs, just
removes some logcat spam.
* Comment and whitespace corrections.
Change-Id: I83fb8644331ae1072d6a8dae9c041da92073089f
The code that creates the GL-accelerated screen view wasn't converting
the upper-left-relative coordinates used within the emulator to the
lower-left coordinates used by the Cocoa APIs on OS X. Since most
skins have the screen view centered vertically this often just
happened to work.
Bug: 5782118
Change-Id: I2f96ee181e850df5676d10a82d86c94421149b40
This patch adds support for Win32 named pipes for the communication
channel between the Opengl renderer library and its clients.
Named pipes should be much faster than local TCP sockets on this
platform. Note that by default, TCP sockets are still used. The
emulator needs to call setStreamMode(STREAM_MODE_PIPE) to be able
to use these.
Change-Id: I86d36624cf2b7fdd50f41e1e43c908348dca4657
This patch allows the OpenGLES rendering library to use Unix
sockets instead of TCP ones when communicating with its clients.
On certain benchmarks (e.g. 0xBench teapot), this provides a
noticeable improvement (x1.05 fps) without any other changes.
On practice, Unix sockets are faster than TCP sockets, even
local ones. Also, this introduces a moderate amount of
abstraction that will allow us to use Win32 named pipes
on Windows (where TCP sockets are much slower than they
are on Unix).
Note that by default, TCP streams are still used.
The client (emulator) must call the new API 'setStreamMode'
to change it to STREAM_MODE_UNIX between 'initLibrary' and
'startOpenglRenderer' calls.
+ Adjust callers / user appropriately.
Change-Id: I4105bbf07541f3146b50a58d1a5b51e8cf044fab
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
This patch changes the filter used to scale the GL window
in the rendering library. Instead of nearest-neighbour, use
bi-linear, which will provide for much more pleasant results
when scaling the emulator UI window, or toggling to full-screen
mode.
Change-Id: If2d9e1300fa4878c25e1221eaedb565b9150431a
You can still re-enable them by uncommenting one line in
development/tools/emulator/opengl/Android.mk
Change-Id: Ie0a640b6f3359b437aba40b124da0892defb00ef
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
That replaces the readback to host we do at the end of each frame
with two blits on the GPU, one to copy the pixels into a texture
and another to render the texture to another in order to flip
the image.
Change-Id: I7e0e10493d38944d0b613e245023f34236d3dfc4
This is a workaround to a driver bug on Intel/Linux, when destroying
a subwindow do not close the X display connection, keep it for the
next call to createSubWindow. It happens that the intel/linux driver
caches the display connection for each window ID and use it during
swap or something similar. Using the same display connection for
all subwindows workaround the problem.
Also added a wait loop to wait until the window becomes mapped
instead of just calling XSync after calling XMapWindow. This
is more accurate and make sure we do not miss the first window
refresh.
Change-Id: I63c69d736df433666a8c79d71127afe72776e89f
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
On Mac it happens that when a context is bound to a pbuffer
and you want to bind it to a window (NSView) instead you must
release it from the pbuffer before binding the window by calling
clearDrawable handle of NSOpenGLContext.
This change added an override of NSOpenGLContext in order to track
to which drawable type the context was previously bound and
call clearDrawable when necessary.
Change-Id: Iece5ab16a46aa0d107ccb773986a6b280d09d181
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
some applications and conformance tests expects to have
non-zero bit counts for all red,green and blue channels.
The translator expose all EGL compliant configs, including
monochrome and RG configs.
We now filter those out and expose to the guest only the RGB
configs.
Change-Id: I9a293675359135a548ce1c089f31a48ea2b7f46e
resize the internal pbuffer we use for a WindowSurface
when a color buffer of different size is attached to the "window".
That fixes "Glyder 2 by glu" application view while loading.
Change-Id: I8f235f428e93077d57bd200f10b45b9a92f1a9d3
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
In case we're receiving packets larger then the initial size
of the read buffer, we dynamicaly grow (X2 steps) the size of
the buffer. An example for this large buffer is a 4MB texture
in JetCarStunts.
Change-Id: I167caddb731583811c009321d4f8fb2f7eea032c
This change modifies the function declarations under
developement/tools/emulator/opengl/host/include/render_api.h
to make them callable from C.
This is preparation work for integrating the rendering library
into the emulator. The plan is to dlopen() the library dynamically
and using non-mangled function names makes using dlsym() both
easier and more portable.
Change-Id: I34656ea4618dbb989fb6ff78df43e9bfb38a7799
Support for eglChooseConfig with configs==NULL.
Also added small change to query EGL_LARGEST_PBUFFER attrib of surfaces.
Fixed error print in QemuPipeStream::readFully.
Those changes make sure that covegl completes & passes on the emulator with Translator
on linux in the backend.
Change-Id: I892917ec102ae85d56a16a7cb321e8c12e7083f1
This is a debugging tool which enables to dump the guest
command stream to a file which can be later be examined
and "played" using a seperate tool.
Change-Id: I3fec19c1a651f0ed4394c33a0c0cd9ba54384355
On windows we need to have a thread on the renderer process
which handles windows messages sent to the subwindow
we are creating during framebuffer initialization.
We run this message pump in the main renderer thread
and the server listener on a seperate thread.
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.
This commit add CHECK_GL_ERROR define to decoders/renderer which enables various
glGetError() calls. Also changed emugen to add glGetError() after every dispatch call (based on
defintion of CHECK_GL_ERROR). Also cleaned some annoying printf's.
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.
fixed functions calling conventions in dispatch tables,
added link flag to translator libraries to produce an alias
function for all exported functions with stdcall name mangling.
Change-Id: I4360f26da1f897764ba6d4dd02c365ed00420b51
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
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
This fix performs a flip software copy to match our coords with those expected by the flinger.
We may think of a better implementation in the future.
Change-Id: Ic09a5d0e22f7e209b33c07c993a3d56e328dd3ed
This patch is a major rework of the build opengl-emulation
build scripts. See README for details.
In a nutshell, this introduces various functions that considerably
simplify the declaration of the 26+ modules in this implementation,
by handling auto-generation of sources and module imports/exports.
Change-Id: I827522d783c7b6cf5eafd37204a1025c235458cd
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
Initialize EGL extensions functions in the EGLDispatch
table using eglGetProcAddress instead of dlsym.
(try dlsym if eglGetProcAddress failed).
Change-Id: I256c4c5f9f3728a5b0e4d5bbcc75b83aa8a85f29