46 Commits

Author SHA1 Message Date
Romain Guy
5c88fc744d Prevent crash when flushing the layers cache
Bug #6258973

When flushing the layer caches we would attempt to delete the FBOs
associate with layers in the cache. The FBO property was however not
always properly cleared when recycling layers.

Change-Id: I7dedfe391d659a0849f1e1d84df17313b2c6e2b2
2012-04-02 17:45:25 -07:00
Steve Block
8564c8da81 Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/157065

Bug: 5449033
Change-Id: I00a4b904f9449e6f93b7fd35eac28640d7929e69
2012-01-06 10:07:54 +00:00
Steve Block
5baa3a62a9 Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/156016

Bug: 5449033
Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
2012-01-03 22:38:27 +00:00
Romain Guy
a1d3c91afb Further reduce the number of GL commands sent to the driver
Change-Id: Id922b2a166ea4573b767c27d3195e11c70320b23
2011-12-13 14:58:14 -08:00
Romain Guy
39d252a663 Various OpenGL optimizations
Change-Id: Ib0742c96f10f5f50e7e5148b742c31b6c232d127
2011-12-12 18:14:06 -08:00
Romain Guy
3e263fac8c Keep shaders to render properly
I don't know who's to blame, SGX or Tegra2 but one of those two GPUs is not
following the OpenGL ES 2.0 spec.

Change-Id: I2624e0efbc9c57d571c55c8b440a5e43f08a54f2
2011-12-12 16:47:48 -08:00
Romain Guy
9c4b79af22 Discard framebuffer rendering queues when discarding layers
Bug #5581817

Change-Id: Ie30700a29059d2ea60eb7bd3f8bd20ac48a149ab
2011-12-06 16:37:10 -08:00
Romain Guy
d21b6e1fe3 Optimize away unnecessary state changes
Change-Id: I0f6816f9f6234853575ecee5033186ad19e76380
2011-11-30 20:21:23 -08:00
Dave Burke
7077506f99 Revert "Discard framebuffer rendering queues when discarding layers"
This reverts commit da96f8ac2c1c35a54f3f36e6d776cb386a251d03.
2011-11-14 11:39:30 -08:00
Romain Guy
da96f8ac2c Discard framebuffer rendering queues when discarding layers
Bug #5581817

Change-Id: If612846ec5f7793710fc4df152791fb32c506551
2011-11-10 19:23:58 -08:00
Romain Guy
5cd5c3f7e4 Return early when we cannot allocate a hardware layer
Bug #5462308

Change-Id: I52dab809662f6f42a49ca03edc50f6b98fc35a06
2011-10-17 17:10:02 -07:00
Romain Guy
7953745dd5 Reduce the size of libhwui by 50%
This change removes unnessary symbols. All symbols are hidden by
default, public APIs with exported symbols are explicitly marked
with ANDROID_API.

Change-Id: I692fde432a86c12108de1cfd1f6504919a7d5f3f
2011-10-12 13:48:51 -07:00
Romain Guy
a9dc86b21d Correctly apply transforms when getting a TextureView's bitmap
Bug #5439406

Change-Id: I271a9a2e38f5b3600dc158f8f442a6b0893f472b
2011-10-11 14:06:21 -07:00
Romain Guy
8a3957d43b Add reminder in the code to fix T-junctions
Change-Id: I52b112694f930e641f01fb78dc55412986023411
2011-09-07 17:55:15 -07:00
Romain Guy
65b345fa22 Reclaim more memory, more often.
Yay.

Change-Id: I04557ad575c307a55088549f48f0e9ad994b7275
2011-07-27 18:51:50 -07:00
Romain Guy
eea60692b0 Improve layers debugging
Change-Id: Ia4950dd5f0e0a224ecb69c581d33aa4f32260a7c
2011-07-26 20:35:55 -07:00
Romain Guy
ec19b4a764 Use NEAREST filtering mode for TextureView.getBitmap().
Change-Id: I4649062bbdf18ebba7924bdf578f39ad8f6576ac
2011-07-07 21:27:14 -07:00
Romain Guy
9ace8f5e79 Use NEAREST filtering for layers whenever possible.
Change-Id: Id5bee1bd4a322cf93e8000b08e18f1e1b058648e
2011-07-07 20:50:11 -07:00
Romain Guy
4a5a71518a Don't set texture parameters on every frame.
Change-Id: Iec368405ad6a4ccfd569a0b3b4d681871a770396
2011-06-24 17:53:53 -07:00
Romain Guy
80429c4585 Properly tear down TextureView
Change-Id: Ic23cd9257889d0abe8cc3fc1d04a66d0505e383e
2011-06-24 17:20:32 -07:00
Romain Guy
a9489274d6 Add the ability to specify the opacity of a TextureView
TextureView assumes its content is opaque by default.

Change-Id: Iba873423566a5b67c388081838bd910dceba32ba
2011-06-22 20:58:11 -07:00
Romain Guy
d6b2a00dd4 Add error checking to LayerRenderer::copyLayer
This method is invoked by TextureView.getBitmap() and failures must be
caught to avoid leaving the GL context in a potentially bad state.

Change-Id: I620de395ba1bc20154de58c81963223dc55cac78
2011-06-17 17:45:59 -07:00
Romain Guy
77a811610f Add TextureView.getBitmap()
This API can be used to get a Bitmap copy of the content of a
TextureView.

Change-Id: I07522216c353720fba5cab333174f58f484eb911
2011-06-14 17:06:53 -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
Romain Guy
aa6c24c21c New widget: TextureView
Bug #4343984

TextureView can be used to render media content (video, OpenGL,
RenderScript) inside a View.

The key difference with SurfaceView is that TextureView does
not create a new Surface. This gives the ability to seamlessly
transform, animate, fade, etc. a TextureView, which was hard
if not impossible to do with a SurfaceView.
A TextureView also interacts perfectly with ScrollView,
ListView, etc. It allows application to embed media content
in a much more flexible way than before.

For instance, to render the camera preview at 50% opacity,
all you need to do is the following:

mTextureView.setAlpha(0.5f);
Camera c = Camera.open();
c.setPreviewTexture(mTextureView.getSurfaceTexture());
c.startPreview();

TextureView uses a SurfaceTexture to get the job done. More
APIs are required to make it easy to create OpenGL contexts
for a TextureView. It can currently be done with a bit of
JNI code.

Change-Id: Iaa7953097ab5beb8437bcbbfa03b2df5b7f80cd7
2011-04-28 18:46:19 -07:00
Romain Guy
9fc27819d7 Correctly compute tex coords for rect layers.
Bug #4192695

This change also fixes Javadoc links in the framework.

Change-Id: Ia548bcb18baba5d6fe6a4a04a2278e3a3bd465b2
2011-04-27 14:21:41 -07:00
Romain Guy
40667676e5 Optimize rect-shaped layers.
This brings back an optimization disabled in HC-MR1. This time the
correct geometry is generated to avoid unnecessary blending.

Change-Id: Id56404dc46bb84c75facc25c18488a690741b592
2011-03-18 14:36:44 -07:00
Romain Guy
6217a71cd2 Fix performance issue in Launcher
Bug #3515248

The problem is caused by the fast path when compositing layers on screen.
The fast path draws a single quad using glDrawArrays() whereas the general
path draws an arbitrary mesh using glDrawElements(). It looks like there's
an issue in the driver since glDrawArrays() is significantly slower than
glDrawElements() for a quad (6 vertices!)

This change just gets rid of the fast path.

Change-Id: Ib2361253ec67f44a988270f76c183422f12ce537
2011-03-15 16:32:28 -07:00
Romain Guy
40a787f89a Properly initialize FBO textures for linear filtering.
Change-Id: I67fc4fd760483ef85809be8d6e608cf4f469650f
2011-03-02 15:15:42 -08:00
Romain Guy
09b7c91de7 Allocate layers from the layers pool.
Bug #3413433

This change will be beneficial to Launcher to avoid hiccups when
swiping pages of icons. When a layer is discarded, it is kept
in the layers pool instead of being destroyed right away. This
favors memory reuse over allocations.

Change-Id: Ifb6944ba83d6ceb67c331527c0827b26ce648eb1
2011-02-02 20:28:09 -08:00
Romain Guy
62687ec12c Don't clobber the local dirty rect after rendering a layer.
Bug #3417254
Bug #3413433

Change-Id: I8045e9ec414ebe4ce4d38124142a00726d2c634d
2011-02-02 15:44:19 -08:00
Romain Guy
beff8d83ef Fix incorrect dirty rectangle transformation in hardware layers.
Bug #3413433

Change-Id: Iba201c7c4b4f11937797f3afcbf20c5a7395be25
2011-02-01 23:53:34 -08:00
Romain Guy
3a3133d876 Update layers based on the dirty region.
Bug #3413433

This helps Launcher when a widget updates during a scroll, or when interacting
with widgets on the workspace if layers are still turned on.

Change-Id: Ic7a42eb34f74f4ae988039754f815e2efd1d1e4f
2011-02-01 23:01:43 -08:00
Chet Haase
a45c056e62 Merge "Fix display List bugs" into honeycomb 2011-01-26 23:49:23 -08:00
Chet Haase
678e0adbdb Fix display List bugs
Various property setters in View need to invalidate the parent's
cache to get redrawn properly when accelerated with display lists.

Also, fix logic around display lists and old-style Animations in
ViewGroup.

Change-Id: I70e1c2fa49e62228ee4a1301a006ce50bda4c305
2011-01-26 22:44:52 -08:00
Romain Guy
4f09f5417b Don't draw the same triangles several times.
Bug #3388197

Change-Id: Ief1dfd9447f144e9992340a173d2893e5e049129
2011-01-26 22:45:16 -08:00
Romain Guy
7d7b5490a0 Enable partial invalidates when rendering with OpenGL.
Change-Id: Ie8be06c4776b815e8737753eb8003b4fd8936130
2011-01-24 18:39:56 -08:00
Romain Guy
c88e357d1e Fix regression with hardware layers.
The renderer was checking whether the layer's region is a rect to
draw it with a simple quad. This test was done against the layer's
region structure, which was cleared after generating the mesh.
Unfortunately Region::isRect() returns true when the region is
empty, which was causing the renderer to always use a quad to
draw a mesh on screen.

Change-Id: If4b874579ee0cedcb67367c9efa5c0c98ca55231
2011-01-22 00:35:23 -08:00
Romain Guy
42f3a4b7c3 Make embedded hardware layers work.
Bug #3369474

Change-Id: Ib6d7fb44eedda9dc2933b5e1b176f307968af91d
2011-01-19 13:42:26 -08:00
Romain Guy
fb13abd800 Fix 9patch rendering in ExpandableListView.
Change-Id: I60843d61a40b0cb7dd09923cb4489a5a76f20486
2011-01-16 15:16:38 -08:00
Romain Guy
f219da5e32 Don't blend transparent pixels when rendering layers.
With this change, the rendere keeps track of what regions are rendered into
and generates a mesh that matches these regions exactly. The mesh is used
to composite the layer on screen.

Change-Id: I1f342576b9134fb29caff7fb8f4c1da179fe956d
2011-01-16 12:54:25 -08:00
Romain Guy
ada830f639 Cleanup implementation of hardware layers.
The new implementation relies on OpenGLRenderer's existing layer
code instead of duplicating it. The new code is much cleaner, with
simpler and better APIs and allows tracking of drawn regions inside
layers. Region tracking is not yet enabled but this will be done
in a future CL.

Change-Id: Ie826121a2227de8252c77b992a61218defea5143
2011-01-13 12:13:20 -08:00
Romain Guy
1fc883b271 Add logging to the new layers API.
Change-Id: I78b9426eb17de3e775aca9fafe4a50bd9c0785c4
2011-01-12 14:31:55 -08:00
Romain Guy
57066eb64c Cleanup GL objects on the correct thread.
Change-Id: Iddfea6e08a6591a4fab147151098ef27005f373d
2011-01-12 12:53:32 -08:00
Romain Guy
a9d0711392 Don't break the build!
Change-Id: I42f68c7b023c03adeedc4e979e5f4705188ee9f4
2011-01-11 17:59:10 -08:00
Romain Guy
6c319ca127 Better backend for hardware layers.
With this new backend, a hardware layer is only recreated when
its associated view is udpated. This offers fast composition
in GL and fast update of the layer in GL as well.

Change-Id: I97c43a612f5955c6bf1c192c8ca4af10fdf1d076
2011-01-11 17:53:19 -08:00