168 Commits

Author SHA1 Message Date
Mathias Agopian
29e0bd2f5a GLSurfaceView defaults to 888 instead of 565
Change-Id: Ie00fe578136365031e4bb878a04b68dc40e24b9e
2012-09-18 15:36:10 -07:00
Dianne Hackborn
f02b60aa4f Rename UserId to UserHandle.
This is the start of turning this into a formal public API.

Change-Id: I5786d2c320f1de41a06ed5d0f65adb68967287a0
2012-08-16 12:46:38 -07:00
Jeff Brown
1296c63bf1 Enable use of Surface as a native window in EGL14 wrapper.
Change-Id: Ia3546fd02f9b60d4505fbc0602522b95e3e5b6be
2012-08-08 18:23:59 -07:00
Romain Guy
42e1e0d482 Improve gradients
Avoid using textures for common gradients (two stops from 0.0 to 1.0)

Change-Id: Iff55d21b126c8cfc4cfb701669f2339c8f6b131a
2012-07-31 18:55:16 -07:00
Romain Guy
0a088f5d46 Fix android.opengl.Matrix frustum's generation
External bug report: http://code.google.com/p/android/issues/detail?id=35646

Change-Id: I845783c05da46855f0c1d824c9a367f0e4673b85
2012-07-30 14:06:35 -07:00
Romain Guy
63cf075222 Merge "Make HardwareRenderer able to target generic Surface objects" 2012-07-24 17:21:56 -07:00
Romain Guy
786fc93d71 Make HardwareRenderer able to target generic Surface objects
Change-Id: I4b7199a1eb30e0df354ae12c4819adc69db5df40
2012-07-24 16:41:21 -07:00
Thomas Tafertshofer
dd06946252 updated gles20 bindings, fixes broken methods
this adds correct versions of the broken GLES20 methods
glGetShaderSource, glGetActiveAttrib and glGetActiveUniform.
the old functions are still there and need to be @hide later.

Bug: 6006380
Change-Id: I8127a77c4b89aa8a9a54bea88774077535e2139d
2012-07-19 17:04:47 -07:00
Thomas Tafertshofer
9b18b51590 EGL 1.4 API without @hide
Change-Id: If03d23082b011aaba41594712601495dcbd70f6a
2012-07-13 17:44:00 -07:00
Thomas Tafertshofer
6b1e838fc1 EGL 1.4 bindings generated by glgen
Change-Id: I1c3da57101f4ea089a12f1796f25b72d6852141e
2012-07-10 15:48:30 -07:00
Jack Palevich
cee059dc76 Improve GLSurfaceView Pausing.
When pausing we want to do three separate things, in order:

 + release the EGL surface
 + optionally release the EGL context
 + optionally terminate Egl

Previously we would only do these things if we had an EGL surface. But
it is possible that we don't have an EGL Surface, but still have an EGL
context. And in that situation we still want to release the EGL context.

Now we check the preconditions for the three cases separately.

Bug: 6338235
Change-Id: I804683b3d5c136cc98ea3f5051067eea18152ddf
2012-04-16 12:25:36 -07:00
Jack Palevich
7dee7a38ba Notify monitor waiters when changing mSurfaceIsBad value.
Otherwise the waiters might not wake up, leading to ANRs.

Bug: 6307843
Change-Id: I0646b4e8368f80dbff46342f75709992796973fd
2012-04-10 06:05:42 -07:00
Jack Palevich
7d73df83f9 Try to survive a failure return from eglMakeCurrent.
Assume a failure in eglMakeCurrent occurs because the SurfaceView
surface has been destroyed.

See b/6257956 for an example of this failure happening during rotation
stress testing.

Change-Id: I4618703b5291aba3a3f0c6bd83c3435a67b97d33
2012-03-29 16:24:58 -07:00
Jack Palevich
db6c78b5bd Make GLSurfaceView handle eglSwapBuffers errors more robustly.
A careful reading of the EGL spec, as well as experience with many
different EGL drivers, has shown that it is error prone to attempt to
discriminate between different error conditions.

We now treat any error besides EGL_CONTEXT_LOST as an indication that the
EGL context is in a bad state, most likely due to the window manager
having removed the underlying surface flinger surface.

In addition, we changed the way we deal with this kind of error:
Previously we would ignore the error and keep rendering. But if the
EGL context and surface has become invalid, it would be better to
stop drawing. We now stop drawing until the surface view surface is
recreated.

See b/6032663 for an example of this problem affecting the GMM app,
but note that GMM is using their own version of GLSurfaceView, so this
change won't help them directly. They'll have to make a similar change
to their version of GLSurfaceView.

Change-Id: Iffe3e1e3a3c7a91d03140fd34391eadeaecf777e
Signed-off-by: Jack Palevich <jackpal@google.com>
2012-03-29 12:23:57 -07:00
Amith Yamasani
ad812a23df Merge "Package restrictions per user" 2012-03-22 15:11:51 -07:00
Jack Palevich
f7f4c20605 Merge "Remove EGL context limit for Adreno GPUs." 2012-03-22 11:47:30 -07:00
Amith Yamasani
483f3b06ea Package restrictions per user
Packages can be enabled/disabled per user.
This requires maintaining stopped/launched states and
enabled / disabled components and packages per user.

Refactored pm.Settings and PackageSettingsBase to keep
track of states per user.

Migrated the stopped-packages.xml to users/<u>/package-restrictions.xml

Changed intent resolution to handle individual user restrictions.
Bunch of IPackageManager calls now have a userId argument.
Make AppWidgetService handle removals of packages.

Added some tests for pm.Settings and PackageManager.

Change-Id: Ia83b529e1df88dbcb3bd55ebfc952a6e9b20e861
2012-03-22 10:08:24 -07:00
Jack Palevich
8b854cd74b Remove EGL context limit for Adreno GPUs.
This change allows Adreno GPUs to have multiple EGL contexts. We had
to limit this in earlier versions of Android due to limitations in
the Adreno GPU driver (only 8 EGL contexts allowed system wide.)
That brand of GPU has improved its EGL drivers to support multiple
EGL contexts in more recent versions of their drivers used on more
recent versions of Android.

Bug: 6142005
Change-Id: Id3030466be9a3d9fbe728f1785378c1f05da98fe
2012-03-19 11:17:40 -07:00
Jack Palevich
48a59c3d85 Ignore EGL_BAD_CURRENT_SURFACE errors from eglSwapBuffers
Certain EGL device drivers are generating this error, so we need to
survive it. (It's not clear from the EGL spec whether this is a
legitimate error code, but since it's being generated we need to
handle it.)

Remove logging of expected errors from elSwapBuffers. We expect these
errors to happen, and are handeling them by ignoring them.
No need to clutter the logs.

Bug: 6083241

Change-Id: If17dcfbb68d3009b92cf95a448728ccb47023b51
2012-03-15 11:50:45 -07:00
Siva Velusamy
64d10a1da0 Expose a function to set OpenGL Trace level.
This patch adds a function setGlDebugLevel() to libEGL, and
exposes it to the Java layer at android.opengl.GLUtils.enableTracing().

Change-Id: Ia5abb130bc32fcfe3ab25b0a0a5283a54c54f357
2012-03-09 15:25:29 -08:00
Romain Guy
97eda365fc Remove unused private APIs
Change-Id: Ib22005c7ed9923120089a1f1c806bca55bb90967
2012-02-17 13:08:35 -08:00
Romain Guy
0219af277e am ea54d0dc: am 723218b4: Merge "Hide ManagedEGLContext until we are sure this is the correct API." into ics-mr1
* commit 'ea54d0dc0dfeef5560fea04667804413d522025f':
  Hide ManagedEGLContext until we are sure this is the correct API.
2011-11-21 21:23:49 -08:00
Romain Guy
3526b00a53 am c26e4d18: am 8cd39e3a: Merge "Notify views when EGL resources are about to be destroyed Bug #5639899" into ics-mr1
* commit 'c26e4d18a20ab0b3e769fb3e547994f1c27d6713':
  Notify views when EGL resources are about to be destroyed Bug #5639899
2011-11-21 21:08:42 -08:00
Romain Guy
dccf73a50c Hide ManagedEGLContext until we are sure this is the correct API.
Change-Id: If54942d342ca8ea348e10231b2aed3e5d3bd701b
2011-11-21 18:27:21 -08:00
Romain Guy
31f2c2e946 Notify views when EGL resources are about to be destroyed
Bug #5639899

Change-Id: I7c5d8bebf02294426f5b3ab1358a31c38a4fd064
2011-11-21 10:55:41 -08:00
Jamie Gennis
fa1a6eb584 am 0272e600: am a37a78e2: Merge "GLES: add image external enums" into ics-mr1
* commit '0272e60060162d2c32aec02d9cd1414dbbe14782':
  GLES: add image external enums
2011-11-18 02:37:22 -08:00
Jamie Gennis
a37a78e2ef Merge "GLES: add image external enums" into ics-mr1 2011-11-17 15:47:28 -08:00
Jack Palevich
22da9a8beb Merge "Fix potential GLThread / GLSurfaceView memory leak." 2011-11-17 11:05:30 -08:00
Dianne Hackborn
77c5f4def4 am 9aa6bd1c: am 717a25dc: Add new ManagedEGLContext class to help apps participate in memory trimming.
* commit '9aa6bd1c34fe3583fe31f283a6415e84fec12567':
  Add new ManagedEGLContext class to help apps participate in memory trimming.
2011-11-17 05:46:34 -08:00
Dianne Hackborn
717a25dc2a Add new ManagedEGLContext class to help apps participate in memory trimming.
This class provides an API for an application to know when it is time to
destroy its EGL context when memory is being trimmed.  By having this in
the framework, we can still detect whether it will be useful to destroy
any EGL contexts (because we know if doing so will destroy all of them).

Change-Id: I1eac8d640052778052926b875c7928008f752182
2011-11-16 14:04:53 -08:00
Jack Palevich
80b3cd6bc6 Fix potential GLThread / GLSurfaceView memory leak.
Until now a leak was possible under the following scenario:

Create a GLSurfaceView
Register a renderer (this automatically starts a GLThread).
Discard the GLSurfaceView without installing it in the view system.

This scenario can occur when a device is rotated rapidly from
orientation A to orientation B to orientation C. In that scenario,
orientation B's GLSurfaceView might be discarded without ever being
attached to a window.

If this issue had been identified before GLSurfaceView had clients, one
possible fix would have been to delay the construction of the GLThread
until the GLSurfaceView was attached to a window. Unfortunately, it's
too late, and so making that change would lead to observable changes in
behavior, possibly breaking some clients.

Instead, fixed by making GLThread and EGLHelper static classes that hold
onto a weak reference to the GLSurfaceView. This allows the GLSurfaceView
to be garbage collected when it is no longer used, even if the GLThread
is active. GLSurfaceView's finalize method will manually stop the GLThread
if it is still running when the GLSurfaceView exits.

Part of this change was to remove the Renderer reference from GLThread,
because Renderer is a user-supplied class that could contain a reference
chain that points back to the GLSurfaceView.

Fixes b/5606613 "GLSurfaceView that's never added to a window will
leak threads and views, can leak activities"

Change-Id: Iafdc329eb6e9e40062358e7c119f5547ffe23d5e
2011-11-15 14:51:27 -08:00
Jamie Gennis
9726b1b54b GLES: add image external enums
This change adds Java definitions for the enums of the
GL_OES_EGL_image_external OpenGL ES extension.

Bug: 3482193
Change-Id: Ib50326f8be9b9cc9021753855c3846ddcdc5eaa2
2011-11-15 11:35:46 -08:00
Akwasi Boateng
1333742bed am cb0db030: Merge branch \'ics-mr1-plus-aosp\' of ssh://android-git:29418/platform/frameworks/base into ics-mr1-plus-aosp
* commit 'cb0db0306b5849a35d3d99eea1b34ce019c6f0d8':
  Make the overridden ImageView#setVisibility remotable
  Clamp non-monotonic stats instead of dropping.
  DO NOT MERGE. Fix leak in LayoutTransition
  Fix lastVisible/global rects
  Fix Wimax-less build.
  Fix leak in LayoutTransition
  Deferring wallpaper update to improve workspace scrolling (issue 5506959)
  Terminate EGL when an app goes in the background
  boot animation is dithered and scaled
  Fix NdefRecord byte-stream constructor.
  PopupWindow dismiss() can get into a recursive loop.
  Fold WiMAX state into the mobile RSSI.
  Remove dedicated wimax icon to fix RSSI layout.
2011-11-11 15:34:19 +00:00
Romain Guy
8ff6b9ebee Terminate EGL when an app goes in the background
This does not happen on high end gfx devices. This happens
only if only one EGL context is initialized in the current
process.

Change-Id: Ibd1737efdf84eef8a84108b05795440d1ae9964e
2011-11-10 16:44:49 -08:00
Alex Sakhartchouk
9829cceca1 Merge "Properly passing an unused variable through." 2011-11-07 09:53:28 -08:00
Alex Sakhartchouk
fc5e224e8d Properly passing an unused variable through.
Change-Id: Ie49b5855bfca4e202ed41b6167a899832e99d728
2011-11-03 17:28:33 -07:00
Joe Fernandez
eba186448f am 74b2b954: am 09848bc8: Merge "docs: add developer guide cross references, Project ACRE, round 3" into ics-mr0
* commit '74b2b9547329a0b05e0bd5701057696007b854bb':
  docs: add developer guide cross references, Project ACRE, round 3
2011-10-31 12:26:31 +00:00
Joe Fernandez
74b2b95473 am 09848bc8: Merge "docs: add developer guide cross references, Project ACRE, round 3" into ics-mr0
* commit '09848bc89de999416e2de82a7693b2deec6bf802':
  docs: add developer guide cross references, Project ACRE, round 3
2011-10-29 02:16:10 +00:00
Jack Palevich
b50e2afd67 Destroy and recreate the EGL surface when the surface size changes.
Details:
+ Split EGLHelper.createSurface into two methods.
+ Add a separate flag for specifying when to create the GlInterface.
+ destroy and recreate the EGL surface when the surface size changes
+ Remove no-longer-needed work-around for b/2263168.

This fixes b/2263168

Change-Id: I0d2596527e3c8dabacdd8a8e427531eaefe7d266
2011-10-28 14:38:53 -07:00
Joe Fernandez
61fd1e8d8c docs: add developer guide cross references, Project ACRE, round 3
Change-Id: I6125315ecdf0f78dd947c514a9944729d723e95d
2011-10-28 14:23:23 -07:00
Jack Palevich
a35c120d8f Work around race condition when shutting down a surface flinger surface.
Works around b/4588890

Change-Id: Ie0cf1f212686aec93cda85bf112f4b7ab4197256
2011-10-14 07:34:05 -07:00
Jack Palevich
cc5471c353 Avoid allocating temporary memory for Matrix operations.
Also fix a bug where Matrix.invertM was not returning false when the
matrix could not be inverted.

Change-Id: I68b172032093d9f257e88c802de936633bb4912c
2011-09-20 19:59:26 -07:00
Romain Guy
407ec78b82 Add OpenGL backend to ImageWallpaper
Bug #5204874

Currently disabled.

Change-Id: I5e7b35dce2981b0691f107e39c6394b260466543
2011-08-24 17:06:58 -07:00
Mathias Agopian
3ab8855794 fix an issue where the screen could be stale after a surface size change
some GLES drivers dequeue buffers before a frame is started
(which is allowed), which can cause a that frame to be rendered
into a buffer of the wrong size. Such buffer will be ignored
by the compositor. If the application draws only once after a
size change, the screen might stay in this stale state.

this can be avoided by telling the GL driver to purge all its
pending buffers, which is done by making the surface not current
and then current again.

this solution is specific to android, but acceptable because
handled solely in the framework.

Bug: 2263168
Change-Id: I3d3c9a019979a9186e329d3160fa54adac78d3f7
2011-08-01 20:24:02 -07:00
Mathias Agopian
43dd61e08a fix typo in a comment
Change-Id: If913611a65e8b578021e9f9a9546f05e0ce6ef44
2011-07-12 14:11:07 -07:00
Romain Guy
e5e0c50f7d Properly refcount SurfaceTexture in the JNI layer.
Change-Id: I4b4c8020c13b8d6ce0d302fe42410033bf5785a6
2011-06-15 16:14:26 -07:00
Romain Guy
8f0095cd33 Allows to render with an OpenGL context inside a TextureView.
Change-Id: I59453f7fc3997f0502a1c5d325d37fed376fabc7
2011-05-02 18:32:29 -07:00
Jack Palevich
7c80244afb Fix typo in Matrix.mPerspective.
(Introduced by a copy-and-paste mistake when factoring out a common
expression. D'Oh!)

Change-Id: I5e97dde2d2f4564fc74ba69bfa4a2f9db44c8873
2011-04-21 15:46:27 -07:00
Jack Palevich
d793299e87 Add utility method Matrix.perspectiveM
Change-Id: Ic9d5e5d967bbc08acc524c5092ce61a1cdbfd360
2011-04-21 14:52:37 -07:00
Elliott Hughes
24ce5fb2cc Kill the global references in the OpenGL wrappers.
Just use jniThrowException instead. Note that it would be trivial to throw
seemingly more appropriate exceptions (NullPointerException and
OutOfMemoryException in particular), but I'm only attempting to preserve
existing behavior here.

I also found shadowing bugs in some of the special-case functions, which
would previously always have leaked memory.

This also moves an accidental change to a generated file (ActivityThread ->
AppGlobals) into the generator, so it won't be overwritten in future.

Change-Id: Iab570310b568cb406c60dd0e2b8211f8a36ae590
2011-04-11 15:31:20 -07:00