Commit Graph

39 Commits

Author SHA1 Message Date
Romain Guy
23bcd8d298 am 825a9a2d: Merge "Update comments to reflect what the code actually does" into jb-mr1-dev
* commit '825a9a2dcd1b3e139dd0677ff46f966fb23f963c':
  Update comments to reflect what the code actually does
2012-10-16 09:47:38 -07:00
Romain Guy
49fe8addbf am b96fe085: Merge "Add new debug option to force 4x MSAA in OpenGL ES 2.0 apps" into jb-mr1-dev
* commit 'b96fe08540dcf7e90be56919ea9863f687da779c':
  Add new debug option to force 4x MSAA in OpenGL ES 2.0 apps
2012-10-15 20:19:18 -07:00
Romain Guy
be3c3e4eca Update comments to reflect what the code actually does
Change-Id: I2613aa32c29eddc52a00090656c1bd11f9f5732b
2012-10-15 19:25:18 -07:00
Romain Guy
1cffc80f97 Add new debug option to force 4x MSAA in OpenGL ES 2.0 apps
Change-Id: I53ac91a9ce07b5dd5f2ee0e3cc5b65b6402f9229
2012-10-15 18:13:05 -07:00
Mathias Agopian
0d45d71197 am 500407a2: log an error when eglCreateContext() fails in an inconsistant way
* commit '500407a2c07ced40c36e7356574a47bcec9c2fd9':
  log an error when eglCreateContext() fails in an inconsistant way
2012-09-24 18:09:21 -07:00
Mathias Agopian
500407a2c0 log an error when eglCreateContext() fails in an inconsistant way
this will help debugging bug: 7216919

Change-Id: I54ac65f20c5ed55cc93a5cbc5350fadfb0fcb804
2012-09-24 17:57:48 -07:00
Mathias Agopian
81b316aa53 am 98838aa0: am 77af25b6: Merge "Return back-end result from eglDestroyImageKHR"
* commit '98838aa0836518b7397cbfe763f34305e3387a5f':
  Return back-end result from eglDestroyImageKHR
2012-09-24 15:43:54 -07:00
Steven Holte
646a5c593f Return back-end result from eglDestroyImageKHR
Change-Id: I0e972b778f9802c28f52092bb9af087285833e0b
2012-09-12 15:14:55 -07:00
Jamie Gennis
010dd4fb89 EGL: Add the EGL_ANDROID_wait_sync extension
Change-Id: Ie9a78e07fcaf27c5c13797141ad3c692217607fb
2012-09-09 17:52:18 -07:00
Jamie Gennis
331841b96b EGL: add the native_fence_sync extension
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
2012-09-06 16:11:37 -07:00
Jesse Hall
258385978c Hibernate the EGL implementation when idle
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
2012-04-09 21:36:17 -07:00
Jesse Hall
b29e5e8c26 Increment/decrement a counter around EGL calls
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
2012-04-09 21:35:17 -07:00
Jamie Gennis
28ef8d7911 EGL: add GPU frame completion tracing
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
2012-04-06 09:23:13 -07:00
Mathias Agopian
7db993a98b debug.egl.finish can be used to force a glFinish() when eglSwapBuffers() is called
this debug property is evaludated at eglInitialize() time.

Change-Id: Ie439e4aac87f7fdc6ab2add86183d6d042f3ee8b
2012-03-25 00:49:46 -07:00
Jamie Gennis
1c8e95cf86 Add tracing to various graphics components.
This change adds ATRACE call tracing to BufferQueue,
SurfaceTextureClient, SurfaceTexture, SurfaceFlinger, Layer, and EGL.

Change-Id: I9d75ed26f5a3f0d1af635da38289520134cfbbb7
2012-02-27 17:50:35 -08:00
Mathias Agopian
7c0441ac27 Don't wrap EGLImageKHR and EGLSyncKHR anymore
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
2012-02-14 17:14:36 -08:00
Mathias Agopian
7773c435bc EGLConfig is now not remaped to an internal EGLConfig
this is possible now that we support only a single
EGL implementation. this allows a large code simplification.

Change-Id: I7a6b9db4c5d60f4407c6061e7a68729af63d5242
2012-02-13 20:23:15 -08:00
Mathias Agopian
ada798b7ca remove multiplexing of multiple EGL implementation
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
2012-02-13 18:11:42 -08:00
Mathias Agopian
fb87e54a9a fix a race condition in eglMakeCurrent()
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
2012-01-30 18:20:52 -08:00
Mathias Agopian
48d438d05f add support for GL_EXT_debug_marker
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
2012-01-29 22:22:09 -08:00
Jamie Gennis
e8696a40e0 hack up frame latency measurement
Change-Id: I6d9a466a23285304f0e229a5649815636ab5d6af
2012-01-24 15:41:50 -08:00
Steve Block
e6f43ddce7 Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/#/c/157220

Bug: 5449033
Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
2012-01-08 13:19:13 +00:00
Siva Velusamy
93a826f78f gltrace: transport buffering and context management
This patch adds two improvements:
1. Protobuf messages are buffered and sent in chunks.
2. Multiple EGL contexts are handled properly: Corresponding
to each EGLContext, a GLTraceContext with a unique ID is created.
On eglMakeCurrent, the appropriate GLTraceContext is set and is
used while tracing subsequent GL Calls in that thread.

Change-Id: I34076376d3e5af205c87c7396ea47659844abd6e
2012-01-04 11:38:37 -08:00
Siva Velusamy
73d2b3c7e5 Merge "glestrace: Framework for GLES tracing library" 2011-12-02 15:49:01 -08:00
Siva Velusamy
0469dd6d55 glestrace: Framework for GLES tracing library
This patch provides a framework for tracing GLES 1.0 and 2.0
functions. It is missing a lot of features, but here are the
things it accomplishes:

- Stop building the glesv2dbg library, and build the
    glestrace library instead.
- Replace the hooks for glesv2dbg with the ones for glestrace.
- Add the basics for the trace library. Currently, this
    traces all GL functions, but not all required data is
    sent for all the functions.  As a result, it will not
    be possible to reconstruct the entire GL state on the
    host side.

The files gltrace.pb.* and gltrace_api.* are both generated
using the tools/genapi.py script.

Change-Id: Id60a468f7278657f008bc6ea1df01f9bdfecfdd3
2011-12-02 15:30:17 -08:00
Mathias Agopian
bc2d79ed7a add a way to access the version string of the h/w implementation of EGL
we use a hidden egl extension. the version string is printed
in SF's dumpsys log.

Change-Id: I123eb4bde6de462bb2404c67b74d6d6219a48d6a
2011-11-29 18:00:35 -08:00
Jamie Gennis
59769469e4 EGL: default to swap interval 1
This change explicitly sets swap interval 1 on the window when an
EGLSurface is created to render to it.

Change-Id: I91eb29dbee3ae4a55076b921f084d503fbe94e03
2011-11-21 14:37:29 -08:00
Mathias Agopian
4b9511c161 rework a bit how we manage EGL extensions
- don't advertise extensions that are not supported
  by any implementation

- remove EGL_ANDROID_swap_rectangle which is not
  implemented by anybody and confuses people

- add some comments about mandatory extensions

Bug: 5428001
Change-Id: Id8dc48116ac1d1eb79ec9ef55d03e29d4257c1f3
2011-11-14 19:05:45 -08:00
Mathias Agopian
f0480de374 fix crash when validating an invalid EGL objects
the code that validated EGL objects dereferenced the object
to access its EGLDisplay -- needed for validation (!).
This was wrong for two reasons, first we dereferenced the object
before validating it (potentially leading to a crash), secondly
we didn't validate that the object existed in the right EGLDisplay.

We now use the EGLDisplay passed by the user API.

Change-Id: I66f9e851d4f8507892a6b1fee3065f124c4e7138
2011-11-14 17:40:21 -08:00
Jamie Gennis
c42fcf05ce EGL: add the ANDROID suffix to the blob cache ext
This change adds the ANDROID suffix to the all the types and functions
defined by the EGL_ANDROID_blob_cache extension.

Change-Id: I087875b96d9a7053efb9c8d5614f9f765eed799d
2011-11-11 13:17:03 -08:00
Jamie Gennis
aca51c06f3 EGL: Add stubs for EGL_ANDROID_blob_cache
This change adds a stub cache implementation that gets passed to the
underlying EGL implementation at initialization time.

Change-Id: I14437c5b6f91b7a34a19bb02ad802e6e54f88d2a
2011-11-04 15:01:51 -07:00
Mathias Agopian
0e8bbee577 don't log EGL errors due to unimplemented proprietary extensions
Change-Id: Icfc33d4f55d1e7fb49390ce0921ba37a438c9fc2
2011-10-05 19:15:32 -07:00
Jonas Yang
1c3d72a229 Add (support for) EGL_NV_system_time extension.
Change-Id: I62bf0fcb5ccdc77c042b425a42054fb3122575b6
Signed-off-by: Mathias Agopian <mathias@google.com>
2011-09-13 16:44:22 -07:00
Mathias Agopian
5fecea776a fix logging of eglMakeCurrent() errors
Change-Id: Ie22cabff822a8fb3186f082491234b9503b431c3
2011-08-25 18:38:24 -07:00
Jamie Gennis
9f24fd020e EGL: move disconnect to surface dtor
This change moves the call to native_window_api_disconnect from
eglDestroySurface to the egl_surface_t destructor.  The egl_surface_t
can outlive the external EGLSurface if eglDestroySurface is called while
the surface is made current on a thread.

Change-Id: I0df6117a5633c2a19935fe356579abdd76fc471f
2011-08-24 15:00:23 -07:00
Mathias Agopian
81a6335052 connect/disconnect is now called from our EGL wrapper
the original connect/disconnect hooks are deprecated
and replace by api_connect/api_disconnect. the original
hooks are no no-ops.
api_connect/api_disconnect is now only called from the
android framework.

Bug: 5057915
Change-Id: I8ca64cd1acd6cabf915bf54689ec2e5f6dfa495a
2011-08-01 14:06:20 -07:00
Jamie Gennis
bee205fd58 EGL: fix the ANativeWindow size/fmt override
This change fixes how the Android EGL layer overrides the size and
format of an ANativeWindow in eglCreateWindowSurface.  The new behavior
is to leave the size untouched when overriding the format.  The previous
behavior was to reset the ANativeWindow to use the default size set by
the ANativeWindow implementation.

It also adds two new 'perform' methods to the ANativeWindow interface:
set_buffers_dimensions and set_buffers_format, and redefines the
behavior of set_buffers_geometry to be the combination of these two new
methods.

Additionally, this change adds an error check for the return value of
the new native_window_set_buffers_format call, which required adding a
(stub) handler for to FramebufferNativeWindow.

Change-Id: I805c7ccd8d4730dfb132d10d8bc3fb058a0b9df1
2011-07-11 12:31:45 -07:00
Mathias Agopian
5b287a6ea8 eglTerminate() now actually frees up all active egl objects
as specified by the EGL specification, terminated objects's
handles become invalid, the objects themselves are destroyed
when they're not current to some thread.

Change-Id: Id3a4a5736a5bbc3926a9ae8385d43772edb88eeb
2011-05-16 19:03:33 -07:00
Mathias Agopian
518ec112f4 refactor EGL source code
no changes is functionality. split various objects into their own files.
make egl_display objec's lock internal.
2011-05-16 19:02:45 -07:00