Make it faster and correcter.
Also, fixed the "gen" script to update the static/egl/*.java files
as part of doing an update. Altered the "git" lines to change
directories before invoking git -- necessary because we're now
split between frameworks/base and frameworks/native.
Bug 9204146
Change-Id: Ie60504b1932349e6f2c9d3868dee6a645ef2b36e
destroyed but current-to-a-thread resources are only destroyed
when they're made not-current; however, we were not destroying
those when the thread itself terminated, causing these resources
to be leaked forever.
we now install a tls-key destructor that takes care of this
by calling eglReleaseThread upon thread termination.
Bug: 9209776
Change-Id: I88298a34e3a27488eb81eab76717715569c7d57c
Initially populated with EGL_ANDROID_presentation_time (moved from the
EGL14 class) and the ES-relevant parts of EGL_KHR_create_context.
Bug: 8678160
Change-Id: Ifed2ee3da264ca701ae1f4b309a0758f7fcc3acc
We were recommending SystemClock#uptimeMillis() from Java code, but
millisecond resolution is a little coarse. We don't have an
appropriate call in SystemClock, so use System.nanoTime() instead.
Bug 8733179
Change-Id: Ifb85a03eabf7ff168966adcb5ed5914bbf3884b2
for single library:
/vendor/lib/egl/GLES.so
for multiple libraries:
/vendor/lib/egl/EGL.so
/vendor/lib/egl/GLESv1_CM.so
/vendor/lib/egl/GLESv2.so
EGL_BOARD_CONFIG as well as egl.cfg are not needed anymore.
To facilitate the transition, the loader will also look
for the older naming scheme.
Bug: 8631636
Change-Id: Id4b113468df29bae72b323f76598229914e1c7a1
The getarray() function checks to see if there's enough room in
the buffer, but it's using a byte count for the available size
and a possibly non-byte count for the space required. Dividing
down by the unit size corrects the problem.
Bug 8713753
Change-Id: Id42c0df65c3233dcc5f76d05e229f7d40d4c1f99
the code intended to filter out the software-renderer, but the
test as written was essentially a no-op.
the problem didn't happen most of the time because we had
updated egl.cfg to not even list the software renderer.
the test as written didn't generate a compile-time error
because String8 has a const char* cast operator; but the
end result was to compare pointers instead of the string
itself.
http://code.google.com/p/android/issues/detail?id=54606
Change-Id: I739dd1c838fbc24c5643a631fae19713a8ef1717
eglCreateSyncKHR requires a call to glFlush which we were not doing.
fixed by moving the code above eglSwapBuffers(), which both
fixes the problem and gives us a slightly better idea of when
the GPU is done drawing.
Change-Id: Ic826ef1fe25a6247742c3d49d0cb69f4031e3593
Updating the generator to handle GLvoid*/java.nio.Buffer return values
probably wouldn't be too hard, but this is the only function that
needs it currently.
Bug: 8566953
Change-Id: I359a951136ab479ab576ce2e5a2881b937b7e8c9
Just a search-and-replace on the glGetActiveAttrib special-case, since
they have the same signature and parameter handling.
Bug: 8566953
Change-Id: I40834d6f32bf9ecb39718df29036aa2d1bbfa07a
Some of these are new ES3 functions, some are existing ES2 functions
that can now use the new pixel pack/unpack buffer bindings.
glDrawElementsInstanced needs a special case since the pointer/offset
arg isn't the last one like the generator assumes.
Bug: 8566953
Change-Id: I638a36b0a31aefcb5bfee6f4d049348223045103
Return values are declared with the C return type, but the JNI
function returns the JNI return type. In the case of GLsync/jlong as
in glFenceSync(), this causes a compile error. So the generator now
explicitly casts the return value to the JNI return type.
Bug: 8566953
Change-Id: I814befe2e4cce745434cbc4e1c8639fc3ce8aeae
This change adds ES3 functions to GLES30.spec, disabling any that
require non-trivial changes for the generator to handle.
Steps taken to add these:
- Copy ES3 function declarations from gl3.h
- Remove GL_APICALL, GL_APIENTRY, and semicolon from each declaration
- Add whitespace around parens and *s as required by the parser
- Comment out functions that the generator doesn't understand or that
it generates bad Java interfaces for (by inspection).
Bug: 8566953
Change-Id: Iaaef7d53e24f9a576759dbba72cd206bae1c1276
With the addition of float framebuffer support in ES3, some parameters
to ES2 functions are now GLfloat instead of GLclampf. Both are
typedefs for 'float', so this is a source and binary compatible change.
Bug: 8566953
Change-Id: I0b5acc78da7799a04053fdb568205f793792cad9
We now detect at runtime which sync features to use, which
allows us to remove a lot of the compile-time configuration
options. There is still one option though, to disable
KHR_fence_sync on some devices (which are more efficient
without it).
- added a backdoor to get the vendor's EGL strings
the new logic is:
- use always ANDROID_native_fence_sync if available
- fallback to KHR_fence_sync if available and not disabled
by the compile-time option
- use KHR_wait_sync if available and either of the above is
enabled
Change-Id: I9c4b49d9ff1151faf902cc93bd53ea5f205aaabf
- move all the code related to EGL extensions in one place
- add missing extension strings:
EGL_KHR_lock_surface
EGL_KHR_reusable_sync
- add public extensions strings and entry-points
EGL_ANDROID_wait_sync
EGL_ANDROID_presentation_time
- add missing entry-points for EGL_KHR_reusable_sync
Change-Id: Ifd98966b549e8efd8ef5385eba0efde8c4cbc77b
In gcc 4.8, the warning for unused parameters (such as JNIEnv* pointers
in JNI functions that don't need it) is enabled by default - causing
-Werror to break the build.
Change-Id: Ib91721f2cb9912b79c2ac19b4210b1309b08304f
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
- added a ctor that updates and dumps the stack immediately
- added a "logtag" parameter to dump()
Change-Id: Ie51c256071d282591752243bdb4f68cf9ff8829d
This isn't really right either, but avoids having an extra buffer that
the consumer has to drain which it might not be expecting.
To be correct, disconnecting a surface from a context should retain
the current buffer and continue using it when reconnected. The buffer
should only be canceled when the surface is destroyed. That will wait
for a later change.
Bug: 8320762
Change-Id: I5efa39c741193ca4f5612ea9de001ccbb683b345
Added EGL extension to set a timestamp on a surface.
Also, fix JNI encoding of "long" in glgen.
Bug 8191230
Change-Id: I38b7334bade3f8ff02bffe600bb74469ef22c164
- added support for comments in checks.spec
- added most missing checks
- added and commented with // special-cased functions
- added and commented with # functions that are still missing validation checks
- moved glGet* to a special case and updated all the "pnames" from the khronos spec
- changed ifcheck to default to 1 value. this allows us to simplify the checks.spec file
and handle unknown pnames automatically (they'll be validated against 1 value, if
it happens to need more, the call will go through but the validation will not
happen).
- refactored the cpp headers in to a common header + GLES version specific
header
Bug: 7402895
Change-Id: Ib5c68ca0ca416407b4cfa36e3a21901b2d6263ab
* changes:
Symlink /system/lib/libGLESv3.so -> libGLESv2.so
Add ES3 support to libGLESv2 and tracing tools
Import OpenGL ES 3.0 headers from Khronos SVN
- it looks like UserId has been renamed to UserHandle in the
framework.
- also for some reason I don't understand glgen didn't seem
to be up to date with respect to the generated bindings in the tree.
It's like the bindings were generated with a more recent version of
glgen (maybe it was never checked in). So we fix that here.
Change-Id: Ie49522ebf67fcab9213246b4d93500e37a3cbc05
The platform has a unified GLES2/GLES3 wrapper in libGLESv2.so, which
is what bundled binaries should link against. The NDK will have
separate GLES2 and GLES3 libraries so that applications will get a
link error if they accidentally use GLES3 entry points in a GLES2
application. This symlink allows GLES3 NDK apps to load using the
unified wrapper.
Change-Id: Ic344ef63c334047fccebb55b7cb2fb23a4c2d61b
Since ES3 is backwards compatible with ES2, a new wrapper isn't
necessary, and the Khronos implementation guidelines recommend
supporting both versions with the same library.
Change-Id: If9bb02be60ce01cc5fe25d1f40c4e7f37244ebf6
Add MODULE_LICENSE_MIT: The GLES headers use an MIT license or a
slight variant of it (the "SGI Free Software License B version 2.0",
http://oss.sgi.com/projects/FreeB/).
Change-Id: Ic8f946341cdd0d579f51b6f7a3ee109cd31b1691
This change has been made in Khronos SVN for GLES2 already, however it
is mildly controversial and discussion is on-going.
This change is necessary for Android because otherwise applications
cannot include both GLES2/gl2.h and GLES3/gl3.h as the glShaderSource()
prototype mismatches. Native programs may include framework headers
(which now include GLES3 headers only) but already have included GLES2
headers, creating an incompatibility.
Change-Id: I70a4075e079ee063e76cef5a227abb0ae70aebb4
Avoids irrelevant output differences based on the user's locale. The
current output files were generated with a C or POSIX locale, and sort
differently under en_US.UTF-8.
Change-Id: I0dd85475e9ee2d58e7fa9fe2a4f86ad5c8142e00
# By luliuhui
# Via Android Git Automerger (1) and others
* commit '873ab60e94811488caea1906eb98133329a3e28f':
Gfx-3d: fix GetProcAddress in egl extention
This patch can fix issue when Proc address return NULL.
Glbench10, egl-ext and conformance test need this patch to run pass.
Change-Id: I275c7cb6f77cb334c3ee7fa23cd696bba1c5a458
Author: Liuhui Lu <liuhui.lu@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 52622
Currently, to activate OpenGL tracing, an application has to be
start with --opengl-trace option (or have a debug prop set).
This CL adds support for tracing an application which may already
be running. This is implemented as follows:
- DDMS initiates a JDWP message to the VM indicating that
opengl traces be enabled.
- When that message is received, a flag is set that indicates
that tracing should be enabled.
- The trace flag is checked during every eglSwap() operation,
and if it finds that tracing should be active and it isn't,
then it starts the tracing component.
Change-Id: I3347fe89fc06c7404d7aa9360f4b21e5bf36ebcb
The C++ class names don't match what the classes do, so rename
ISurfaceTexture to IGraphicBufferProducer, and SurfaceTexture to
GLConsumer.
Bug 7736700
Change-Id: Ia03e468888025b5cae3c0ee1995434515dbea387
No significant changes. The extensions now have assigned extensions
numbers. And Jon Leech added missing suffixes in the declaration of
eglSetBlobCacheFuncsANDROID; our header and code already had the
suffix.
Change-Id: I2faad8ebe0ca81b13e29729a15515ee6b17b94b2
This change replaces all references to the "EGL_NO_NATIVE_FENCE_ANDROID" enum
with "EGL_NO_NATIVE_FENCE_FD_ANDROID".
Bug: http://code.google.com/p/android/issues/detail?id=40295
(cherry-pick from master)
Change-Id: Ie25d4ab9721d8b69b8d4afcf18e902ef8e3ad911
This change replaces all references to the "EGL_NO_NATIVE_FENCE_ANDROID" enum
with "EGL_NO_NATIVE_FENCE_FD_ANDROID".
Bug: http://code.google.com/p/android/issues/detail?id=40295
Change-Id: I049b2ba185c2dbdccb8fc069701dbe805d63f645
The shell property debug.egl.trace can now be set to:
0
disables tracing
1
logs all GL calls
error
checks glGetError after every GL call, logs a stack trace on error
systrace
logs each GL call to systrace
Change-Id: I34a2a2d4e19c373fd9eaa1b0cd93e67c87378996
The debugging and tracing levels are initialized both during
early_egl_init and egl_display_t::initialize(). For apps this has
no effect since early_egl_init is called in the context of zygote.
This CL removes the unnecessary call from early_egl_init.
Change-Id: Ibc55c26228cd197f2e2623fbfb2d1a63d0722401
This change adds a new extension for EGL implementations to indicate the
EGLConfigs that support use as a HWComposer framebuffer target layer.
Change-Id: Ia7c8fbe8da09d57b4ec8bf1d9ddb67ca21aa2885
This change fixes a bug where initializing EGL multiple times (eglTerminate
followed by eglInitialize) would cause extensions to show up in the extension
string multiple times.
Change-Id: I707a3da62ed30ef13835087167f84a08bc6addd7
This change adds support for the EGL_ANDROID_native_fence_sync extension to the
Android EGL layer. It also fixes a couple minor issues with the extension spec.
Change-Id: Ic8829d21f37b701f33aa9c72c3d25e88e03fa3cd
This change updates the extension spec to refer to generic "native fence sync
objects" rather than "Android fence sync objects."
Change-Id: I15a79f08571586431845b54c58c8420b652f40ef
eglGetRenderBufferANDROID was removed as it had no users. This commit
reintroduces this extensions as it's used by Qualcomm graphics HAL.
Change-Id: I493306830a0d4f8722a42bcc84fb49236afdabeb
Certain apps (e.g. chrome) seem to create contexts which are unused
for long periods of time. If tracing is stopped before those contexts
are used, then the debugger never gets to know that these contexts
were created. Flushing the trace after these calls ensures that
the debugger knows about all created/used contexts.
Change-Id: I01baa11aa56ac89eddce3c2851e4bf01076984d1
This fixes the glgen code generation for methods
which have a buffer arg that can be NULL.
Bug: 6845189
Change-Id: I5fb745b806601e5665f97bfd15fd865cd9c241ed
- Process is killed by system with SIGBUS signal if it writes
data to mapped sparse file on full filesystem.
- Allocate space using write() function instead of ftruncate()
to avoid creation of sparse files on full filesystem.
Catch write() errors to handle out-of-space case during allocation.
Bug: http://code.google.com/p/android/issues/detail?id=35376
Change-Id: Ifc366454f34e71a43a0973eda4f591a920ea3a14
Signed-off-by: Kirill Artamonov <kartamonov@nvidia.com>
this adds correct versions of the broken GLES20 methods
glGetShaderSource, glGetActiveAttrib and glGetActiveUniform.
the old broken methods are still there and need to be @hide later.
Bug: 6006380
Change-Id: Ide74242ada54b85459b459ae4f20cd26a23c7610
This changes generation of the OpenGL bindings to prevent
crashes of methods with more then one nio buffer argument.
Bug: 6772416
Change-Id: I4eff25c2f568dea78a6ffd3e95ff4620ab4b3b7d
This fixes lighting when using point lights, when eye space
lighting is used (which is the default).
Change-Id: I0cd0d2329893d6b5f8af3b1e595274c2076fc322
This change updates the uses of ANativeWindow to use the new ANW functions that
accept and return Sync HAL fence file descriptors.
Change-Id: I3ca648b6ac33f7360e86754f924aa072f95242f6
The acquire and release fences aren't yet used; this is just support
for the new version and temporary backwards compatibility for older
versions.
Change-Id: Ia5ccc05a97c86f649042b9a35e11042fa0187e84
this allows us to enable h/w acceleration on low-end
devices while keeping memory usage down.
Bug: 6557760
Change-Id: I8af2de3038dc2579360b8b73aa452cb7a0e506a9
Implementing this in libagl allows us to start using it for
SurfaceTexture in emulator builds, which is necessary to avoid
corruption in the Browser when using the host-accelerated GL path.
Bug: 6515813
Change-Id: Icafba8687cb5d010d8d42b3866b298d2be984fc9
Currently, gltrace offers very few trace collection options. As a
result, these options are encoded in a single integer. The trace
control task simply receives integers and interprets them as
commands.
This patch changes the control protocol to first receive the
command length followed by the actual command itself. This allows
for future flexibility to provide enable other commands.
Change-Id: Id5f56c80a025bbbe7613ab4457e092732e7d9dc9
Hibernating EGL takes a long time (>100 ms) and blocks all other
rendering. During window animations, the outgoing activity begins
hibernation before the animation stops, causing visible stutter.
Hibernation is still available by setting 'BOARD_ALLOW_EGL_HIBERNATION
:= true' in the devices BoardConfig.mk
Change-Id: Iab4e00723a1adcd97481e81b2efdc821b3e9712f
When eglTerminate() is called with a window surface still exists, a
deadlock would occur since egl_display_t::terminate() holds a lock
while destroying the window surface, which calls
onWindowSurfaceDestroyed() which attempts to take the same lock.
This change refactors the hibernation code and data into a separate
object with its own lock, separate from the egl_display_t lock. This
avoids the deadlock and better encapsulates the hibernation logic.
The change also fixes a bug discovered incidentally while debugging:
hibernating after calling eglTerminate() succeeds, but will cause
awakens from subsequent eglInitialize() to fail. We will no longer
hibernate a terminated display.
Change-Id: If55e5bb603d4f8953babc439ffc8d8a60af103d9
This tests if eglTerminate can succeed while objects
are leaked. Currently the test fails because of a deadlock.
Change-Id: Ibe26edfda28691284d0674e803e8d3114f3ce4c6
If the EGL implementation supports the EGL_IMG_hibernate_process
extension, use it to hibernate (and hopefully release memory or other
resources) when the process isn't actively using EGL or OpenGL ES. The
idleness heuristic used in this change is:
(a) Wake up when entering any EGL API call, and remain awake for the
duration of the call.
(b) Do not hibernate when any window surface exists; this means the
application is very likely in the foreground.
(c) Do not hibernate while any context is made current to a thread.
The app may be using a client API without the EGL layer knowing,
so it is not safe to hibernate.
(d) Only check these conditions and attempt to hibernate after a
window surface is destroyed or a thread's context is detached. By
not attempting to hibernate at the end of every EGL call, we avoid
some transient wakeups/hibernate cycles when the app is mostly idle,
or is starting to become active but hasn't created its window
surface yet.
On a Galaxy Nexus, hibernating frees 1567 VM pages from the process.
Both hibernating and waking can take anywhere from 30ms to over 100ms
-- measurements have been very inconsistent.
Change-Id: Ib555f5d9d069aefccca06e8173a89625b5f32d7e
This is in preparation for a change that will hibernate the underlying
EGL when idle. Instead of a bare egl_display_t*, get_display() now
returns a egl_display_ptr, which acts like a smart pointer. The
"wakecount" counter managed by the smart pointer isn't used for
anything in this change. It will be used to make sure we don't
hibernate when any thread is in an EGL call, without having to hold a
mutex for the duration of the call.
Change-Id: Iee52f3549a51162efc3800e1195d3f76bba2f2ce
This change adds a debug option to EGL to use an EGLSyncKHR each frame to
determine when the GPU finishes rendering the frame.
Change-Id: I09ce071db904b44f07ca814c586c291c8b59385a
Some of the tests in frameworks/native/opengl/tests depend on java
or jni, and shouldn't be in frameworks/native. Prevent them from
building in pdk builds for now.
Change-Id: Ie7a012513dd03992ac1f093bd245aeca826c9cb9
This patch adds a function setGlDebugLevel() to libEGL to enable
GL tracing. This will be used by the Java layer to add an option
to "am start" that can enable tracing for a particular application.
Change-Id: Ie1dbdd550f502df8633553595cb33ee9d9ae44e1
This patch enables tracing of vertex attribute data that
is specified using glVertexAttribPointer().
At the time the glVertexAttribPointer() call is made, we
only receive a pointer in client space, without any indication
of the size (# of attributes). This size is known only at
the time of the glDraw() call.
This patch generates a new message glVertexAttribPointerData()
when a draw call is issued that contains the vertex attribute
data.
A glDrawArrays() call directly gives the size of data to copy.
A glDrawElements() call gives the indices to copy. In such a
case, all data between the min & max indices drawn are copied
and sent to the host. To support glDrawElements() with an
element array buffer, this patch also adds state that maintains
a copy of all element array buffers.
Change-Id: I434da794a0aa9ada8e7474e219ffb1d79b183ecf
Currently, the trace API passes the pointers that need to be
patched up via 32 bit integers. Such code will not be 64 bit safe.
This patch sends all pointers in a separate array of pointers
for the fixup calls to read from.
Change-Id: If975333f11a6f6f9a74fba57de328affaed452a5
this simplify our EGL wrapper implementation a lot.
This wrapping is no longer needed now that we can only
support a single underlaying EGL implementation.
Change-Id: I8213df7ac69daac447f1fe6e37044b78aac4e9a9
This patch updates the trace information for all glUniform*() calls
to have the right data (the actual uniforms that are passed).
In addition, as soon as a program is linked, information regarding
all the active attributes and uniforms is passed on to the debugger.
Change-Id: Icfbc6722789b42c413a845cf546577fa6de7da2b
this is possible now that we support only a single
EGL implementation. this allows a large code simplification.
Change-Id: I7a6b9db4c5d60f4407c6061e7a68729af63d5242
from now on, the system can only have one EGL
implementation. this means the software and h/w renderer
cannot be used at the same time on a device. Of course, the
h/w renderer is always prefered; in its absence we
default to the software renderer.
Change-Id: Ib579f58055dd0ce4c4a99144131efa11c16ca3d3
this was introduced in a recent change. eglMakeCurrent can
end up calling eglDestroyImageKHR via ANativewWindow::disconnect
when the consumer is in the same process.
we make sure we don't hold the lock while this is happening.
Change-Id: Id17fe4fd76eecf5f962cefb9aa32be41fc1b042d
it would happen when a context was made non-current, in this
case we would call the implementation's eglMakeCurrent() which
would succeed, if we're rescheduled at that point, another
eglMakeCurrent() could make that context current to another thread,
however, when we came back to the original call we would
overwrite egl_context_t internal state.
this is fixed by moving the critical section under
egl_display_t's lock.
Change-Id: I743c85696e13263d3a9570824940263df0caacdc
when increasing MAX_NUMBER_OF_GL_EXTENSIONS to 256
we also needed to create all the corresponding wrappers.
Change-Id: I90edaaf0885ccdfab48e7a1396bcf88e039cfb25
This extension is always added to the GL_EXTENSIONS
extension string for the current GL context, regardless
of if it's supported by the h/w driver.
The extension itself will be handled by GLES_trace (eventually),
when GLES_trace is not enabled, it'll result to a no-op.
If the h/w implementation has this extension, we'll call that version
instead of our dummy version.
Change-Id: Ie5dd3387c4d45cd5ed5f03b73bda6045620a96bc
Export trace information via abstract Unix Domain Socket (UDS).
This allows tracing of applications without INTERNET permission,
and should be faster as well.
Change-Id: Iabb67fcc2bc2484afd8128af07dca723b81c52c6