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 re-enables the build of the gralloc GLES emulation library.
This is only for experimentation / debugging purpose. GLES emulation
is still disabled by default in the emulator. Even if you force-enable
it by using the '-gpu on' flag, this module will not properly yet
and nothing will be displayed.
Change-Id: I8f0ca8805ed99037b011365d08507ca08bff5e75
This fixes the definition of the emulator-specific egl.cfg file
used to indicate to our EGL system library which support modules
are available in the emulator.
We need to list two modules here:
'emulation' corresponding to GPU emulation
'android' corresponding to the software renderer
The indices before each name correspond to the 'display' and 'impl'
numbers that are expected by frameworks/base/opengl/libs/EGL/Loader.cpp
In a nutshell, 'display' should always be 0, and 'impl' should be 0
for the software renderer, and 1 for a hardware-based one. See the code
under framewors/base/opengl/libs/EGL/egl.cpp for mode details.
Change-Id: I52c898759200c2dfba9049ed00b31b18e8c37f69
This patch modifies the gralloc.goldfish module to check
that the emulator does, indeed, support GPU emulation.
If this is not the case, it loads the framebuffer-based fallback
module (gralloc.default) explicitely and uses it instead.
This is necessary because sometimes the emulator will be started
in headless mode in restricted environment, i.e. without access
to the display subsystem or GL libraries, which make GPU emulation
impossible.
We check for ro.kernel.qemu.gles which will be either undefined
or set to 0 if the emulator doesn't support GPU emulation, or 1
otherwise.
Change-Id: Ib6b143e6dcdfb44ff2c5b889138d0fb4118bb461
It is possible to move the final installation path of a shared
library by using LOCAL_MODULE_PATH/LOCAL_UNSTRIPPED_PATH in its
module declaration.
We do this for example to put certain libraries under /system/lib/egl
or /system/lib/hw.
However, the Android build system has a small bug where you cannot
depend on these shared libraries because it will complain it doesn't
find them under /system/lib, the default install location.
More precisely, consider libfoo defined as:
include $(CLEAR_VARS)
LOCAL_MODULE := libfoo
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
...
include $(BUILD_SHARED_LIBRARY)
Its final binary will be installed to /system/lib/egl/libfoo.so
Now, let's write a module that depends on it, as:
include $(CLEAR_VARS)
LOCAL_MODULE := libbar
LOCAL_SHARED_LIBRARIES += libfoo
...
include $(BUILD_SHARED_LIBRARY)
The build system will complain there is no rule to define the target
/system/lib/libfoo.so, but the target should be /system/lib/egl/libfoo.so.
A work-around is to define libbar as follows instead:
include $(CLEAR_VARS)
LOCAL_MODULE := libbar
LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_SHARED_LIBRARIES)/egl/libfoo.so
...
include $(BUILD_SHARED_LIBRARY)
This works if you don't need to link against the library when building your
shared library (which is fortunately the case for the GLES emulation
libraries).
That's essentially what this patch implements under common.mk. We update
emugl-set-shared-library-subpath to record that a module has been "moved",
and we avoid adding them to the LOCAL_SHARED_LIBRARIES variable of the
modules that export it.
+ Simplify three Android.mk files accordingly.
Change-Id: Id15bef5359b0daa8d82bfaa5abf9346f00190ab5
This make the EGL/GLESv1/GLESv2 libraries on the guest to use
the OPENGL bionic tls slot for faster tls access.
Note that we still setting the slower tls in order to have the
tls destructor which allow us to close the host connection
when the thread exits.
Gives slightly performance improvement, the avg score for the
teapot test in 0xBench goes from 34 to 37 fps. (This test is
near immediate mode since it renders a lot of small primitives
so it is a good candicate to be improved).
Change-Id: I9060c75cc29c2e28721fa11d3f318b438edb5da9
our framebuffer implementation in gralloc does not support
setUpdateRect but we erronously publish as we do. Reset
the setUpdateRect so that flinger will not try to use it.
Change-Id: I2e4f2ef7e5701aed69caa194426945bafd5ac4c9
Fixed the location shift WAR to work for arrays that starts at
location 0. Fixed conformance regressions made by this workaround.
The conversion should be smarter than just shifting 16-bits back
and forth, it should take into account if array element is being
accessed.
Change-Id: Icb746c67e16edfacb8264a1e687fd24ac6e868e7
fix glGetAttachedShaders
NULL is allowed in count parameter
fix problem with nvidia driver which returned invalid count
Change-Id: Icfaa5688b04325de2890486eb87b163babaddf30
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
Uniform locations are 32-bit values which the application queries
from the driver after a shader program is linked. It seems that Cordy
game (possibly all Unity based apps) store the returned location as
16-bit value. Intel driver returns location values in the upper 16-bit
range :(
This is a workaround for this issue, when a program is linked we check
the locations of all uniforms, if all locations are within the upper
16-bit range (as with Intel driver) we shift the location value before
returning to the application. Also override all functions which take
a location parameter and do the reverse shift before sending a location
value to the host.
Change-Id: I234aaafe3313774b5da79eb1dac713b89b10ad60
added state tracking for uniforms in program objects
for each active uniform in index i we will save its starting location
,size and type, so when calling glGetUniform on its location,
we can tell how many bytes we should read from the stream according to
the uniform's type
add some type and size definitions to functions
that calculate size from enum
some other fixes to the codec
Change-Id: I4ecdf41e752454a908d131e76bab113a616f2bc8
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
added NullAllowed flag to length parameter of glGetShaderSource
calling glGetShaderSource with NULL length caused length data
from the host get left on the stream and get the stream out of sync
Change-Id: I45e8e523a67698c9b0cd003e2af7e15c76ed22b7
The was a bug in the calculation of the pixels data size, caused by wrong usage
of pack/unpack alignment.
Pack should be used for glReadPixels, while unpack should be used for glTexImage and such.
Also fixes crash in "Angry Birds" & "Angry Birds Rio"
Change-Id: I099308a57a1ea907d38c59bad056429bc107de98
This is needed to support the rare, but still legal scenario,
when glDrawElemets is used with some index array data is stored in VBO's
while the actual attributes (vertices) data is in immediate mode.
When in immediate mode, we need to process the incodes, in order to know
which vertex data to send, which was impossible without the caching.
This commit introduces a new class GLSharedGroup, which will hold all data
that can be shared by shared contexts (buffers are such data).
This also makes the "Jet Cars Stunts" app work properly.
Change-Id: Ic937080dae461bc8cdf4d10cf37066a6e847f464
On every swapBuffers, we make sure to decRef on the prev buffer,
and incRef on the current buffer. This fixes all the anoying
crashes on application exit, and also after the speech windows
on Replica Island
Change-Id: I1981fbf17a24ef6f60cdcf6d7ec3a5e7eef5377f
Thought the spec doesn't speak about null in data parameter,
it is checked in covgl - so we'll base it on glTexImage2D and allow
null in data.
Change-Id: I9bf5131852bf795acc7ab89bd17b9df90ac99460
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
Sometimes we need to check parameter values before encoding
to prevent crashes, for example:
glDeleteBufferes(-1, ptr); - would crash
For that we need to check some gl errors on the guest.
The change adds error state to the encoder and also
adds new feature to emugen which allows to insert
parameter check code into the attribute file.
Added such parameter check code in the appropiate
gl functions in gl.attrib and gl2.attrib
Change-Id: I7f317df52ac8fbd96979100a1031cf023a0b49d3
The shaders fail to compile if we don't omit those changes (Cordy game for example).
Anyways, they have no semantic meaning in GLSL, quote for GLSL 4.1 spec:
"Precision qualifiers are added for code portability with OpenGL ES, not for functionality. They have the
same syntax as in OpenGL ES, as described below, but they have no semantic meaning, which includes no
effect on the precision used to store or operate on variables."
Also removed an anoying print in the encoder.
set its glFormat to GL_RGB since GL_RGB565_OES is not supported on the host.
This also fixes the wallpaper issue, making it visible.
Change-Id: Icf616e70d8f41ca0d01e7cdeb9585107dc8ebc31
The GL2Encoder::m_compressedTextureFormats member wasn't initialized, so the d'tor
would sometimes crash trying to delete it. Also init m_num_compressedTextureFormats.
Change-Id: Iae423c16a84a4e454e0e1167f7478f9e2f6183c0
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
The config_size argument in rcChooseConfig should match the number
of requested configs and not the size in bytes to store it.
Moved the configs array size computation into rendeerControl.attrib.
Change-Id: I9e797024522965a656764c20252b25ff5ae657f5
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
Fixed bug in list implementation in gralloc_free which caused a crash,
also removed some log prints.
Change-Id: Ie932c838086c99567643868682419ceb122cf787
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
Also changed emugen to generates gl_ftable.h needed for
getProcAddress implementation.
Added not_api attrib to emugen's gl.attrib to exclude from the
generated ftable.
Change-Id: I03786ea5d5a640bbcf5efccadca5bf2ec3e09fca
This is the first commit for the GLESv1 implementation.
It also includes needed fixes in emugen to support const types.
Also, changed glFinish definition in gl.in to match the
definition as in gl.h.
Change-Id: I90262a1db6035a90af8db17984acecef6499847a