4899 Commits

Author SHA1 Message Date
Chris Craik
408eb12631 Set ignore flag during deferred savelayer
bug:8471552

Additionally, add ignore check for draw functor

In deferred mode, if we don't set ignore, a 0 alpha displayList won't
be quickRejected, and not only would its contents be needlessly
deferred, but upon playback any functors would be drawn, ignoring the
state of the snapshot.

Change-Id: Ib1edb3252080f674254086edee6f965f0efcce78
2013-03-27 10:38:36 -07:00
Chirayu Desai
3e4a3ea2ff Correct executable bit for source files [Take 2]
Change Ieb51bafb46c895a21d2e83696f5a901ba752b2c5 left out some
files, this fixes them.

Change-Id: Ia949a8581668836ea0251602e048f09c852f5169
2013-03-27 16:52:35 +05:30
Romain Guy
4500a8d5d7 Path precaching creates duplicate cache entries
Bug #8478275

Change-Id: Ib541ea051e42e01cc0d277790e9c09de38ef72ee
2013-03-26 17:29:51 -07:00
Romain Guy
96885eb480 Avoid multiple font cache texture uploads
Bug #8378964

This change defers drawing into layers until after the renderer for FBO0
is ready to draw. At that point, all the precaching is done which means
all glyphs can be uploaded at once in the font caches.

Change-Id: Ie1f7a7ff30f76f06fb3dbc72c7d05e66207d1ecb
2013-03-26 15:25:07 -07:00
Chris Craik
a4e16c58c9 Restore final canvas state after deferred flush
bug:8450062

- Fixes overdraw indication with DeferredDisplayList
- Fixes drawHardwareLayer called after flush

Additionally changes drawLayer to pass its paint to native via setLayerPaint

Wrap flush in save/restore so that reordering doesn't affect final
transform

Change-Id: I08befa42c28500da6387699eefd4be28aedf9f4c
2013-03-22 11:54:51 -07:00
Chris Craik
741f6bb810 Merge "Isolate tiling clip state from snapshot" into jb-mr2-dev 2013-03-21 22:08:13 +00:00
Chris Craik
5f80362355 Isolate tiling clip state from snapshot
bug:8409891

Snapshots frequently have their clip overwritten due to applying
deferred state - now, store tiling clip information in a separate
rect, outside of the snapshot so it isn't overwritten.

Change-Id: I21ca4c45dcd802eae99e8de86f11525196777ccb
2013-03-21 14:39:04 -07:00
Romain Guy
c5cbee7d78 Stop worker threads on memory trim & fix bad pointer access
Change-Id: I6fe7e31aeb6dd41fa65ab952caed97bc2da510d7
2013-03-20 19:16:53 -07:00
Romain Guy
9eac52698b Merge "Optimize text GL setup" into jb-mr2-dev 2013-03-21 01:54:42 +00:00
Chris Craik
7564c716bb Merge "Use snapshot alpha in all layer drawing" into jb-mr2-dev 2013-03-21 01:17:29 +00:00
Chris Craik
e83569ca76 Use snapshot alpha in all layer drawing
Change-Id: Icc093390da2fc36b2b6693d0e5e4357b2f730bf9
2013-03-20 17:24:36 -07:00
Romain Guy
257ae3502c Optimize text GL setup
Only performs the GL setup steps when at least one glyph is drawn.
This change also skips various draw operations when the specified
paint draws with alpha = 0.

Change-Id: I9eda148b0503acffc552ee19196f5d52e958a1a2
2013-03-20 16:35:05 -07:00
Chris Craik
d90144db52 Update snapshot upon saveLayer deferral
bug:8409891

In order to defer fbo-targetting saveLayer operations, it's necessary
to update the snapshot at defer time so that deferred display state
(namely, clip and transform) are fbo relative.

Re-enables deferring, as the issues with saveLayer are fixed.

Change-Id: I74b0779bc732675c747208f0757c3ea85f6dfbed
2013-03-20 16:32:53 -07:00
Chris Craik
4494599e5a Merge "Use snapshot alpha for layers" into jb-mr2-dev 2013-03-20 22:22:44 +00:00
Romain Guy
ec3928bf09 Merge "Reduce number of glDraw calls when drawing text" into jb-mr2-dev 2013-03-20 02:29:47 +00:00
Romain Guy
661a87ec28 Reduce number of glDraw calls when drawing text
This change moves the mesh buffer from FontRenderer to CacheTexture
to help reduce the number of texture binds and glDraw calls when
drawing text that spans across multiple textures.

Change-Id: I7de574d88313ca3672879ca878c253ff5f131fc1
2013-03-19 17:24:13 -07:00
Romain Guy
df9d2ba9b0 Merge "Minimize texture binds when drawing text" into jb-mr2-dev 2013-03-19 18:56:19 +00:00
Romain Guy
115096f50a Minimize texture binds when drawing text
When several CacheTextures are used to draw text, sort the
draw batches by texture ID to minimize state changes in the
driver.

This change also tweaks the font cache size and renames
a property that was too long to be set using setprop.

Change-Id: I0a36dfffe58c9e75dd7384592d3343c192d042b1
2013-03-19 11:32:41 -07:00
Romain Guy
603ce559f2 Merge "Apply ComposeShader's local matrix to children" into jb-mr2-dev 2013-03-19 02:31:35 +00:00
Romain Guy
d4289922ce Apply ComposeShader's local matrix to children
Change-Id: Idf9b8e7d7b30f8fcd8ba1fd4bfe8991e9ca148e2
2013-03-18 19:30:48 -07:00
Romain Guy
16b7dc9c1c Merge "Merge all shapes/paths caches to PathCache" into jb-mr2-dev 2013-03-19 02:04:29 +00:00
Romain Guy
c46d07a29e Merge all shapes/paths caches to PathCache
This change will greatly simplify the multi-threading of all
shape types.

This change also uses PathTessellator to render convex paths.

Change-Id: I4e65bc95c9d24ecae2183b72204de5c2dfb6ada4
2013-03-18 18:32:17 -07:00
Chris Craik
cada41aeb1 Work around saveLayer clipping/transform deferring issues
bug:8409891

Disables deferring

Change-Id: I93498a4a45a5bfe01143faa154926c6a138db8f9
2013-03-18 17:00:18 -07:00
Chris Craik
d0afeac6df Reset draw modifiers after flushing
bug:8401910

This avoids leaving the renderer in a state with stale pointers (to,
e.g., shaders or color filters)

Change-Id: Idf8b63657041352e70e34e91ea416fe4385d4bc2
2013-03-15 18:48:41 -07:00
Chris Craik
a08f95cfec Use snapshot alpha for layers
Removes mMultipliedAlpha, using the snapshot alpha for all
non-overlapping display list alpha control.

Additionally, fixes opacity issues where children of
hasOverlappingRendering=false displaylists (both hw layer sublists and
other sublists with hasOverlappingRendering=false)

Change-Id: I6adc16da855835f9f518f8967628e5d0135c789b
2013-03-15 17:29:27 -07:00
Chris Craik
f40b8a939f Merge "Fully deferred displaylist replay" into jb-mr2-dev 2013-03-15 22:54:16 +00:00
Chris Craik
ff78583d8a Fully deferred displaylist replay
bug:8037003

A recursive drawDisplayList call is now entirely deferred before
playing back to the screen and issuing GL commands. This way, the
entire stream can be inspected, optimized, and batch work (such as
uploading textures) before issuing commands.

Additionally, this fixes an issue where operations draw could move
across restores corresponding to saveLayer(alpha). Those and other
similar cases (such as complex clipping, requiring the stencil) are
now treated as batching barriers, with the operations that change
renderer state in a way that's difficult to defer are just re-issued
at flush time.

Change-Id: Ie7348166662a5ad89fb9b1e87558334fb826b01e
2013-03-15 14:48:18 -07:00
Romain Guy
bd3055f95e Less aggressive glyphs precaching
The renderer used to pre-cache glyphs at record time. This then changed
to pre-caching at the beginning of every frame. This unfortunately entails
a lot of duplicate work on every frame, which amounts to 0.5 to 1ms in
some stock applications.

This change is somewhere in the middle: pre-caching happens the first
time a DrawTextOp is deferred or every time the screen-space transform
is different from the last pre-caching operation.

Change-Id: Id6d9e2599d90a5b75010b0f0a28746befbf3c205
2013-03-13 16:14:47 -07:00
Romain Guy
0f809f3b79 Prevent infinite loop when trimming the path cache
Change-Id: I04b5fa498336068f997c68d8613b35a99f67adbe
2013-03-13 14:32:45 -07:00
Romain Guy
5dc7fa7096 Add TaskManager API
This API can be used to run arbitrary tasks on a pool of worker
threads. The number of threads is calculated based on the number
of CPU cores available.

The API is made of 3 classes:

TaskManager
      Creates and manages the worker threads.

Task
      Describes the work to be done and the type of the output.
      A task contains a future used to wait for the worker thread
      to be done computing the result of the task.

TaskProcessor
      The processor dispatches tasks to the TaskManager and is
      responsible for performing the computation required by
      each task. A processor will only be asked to process tasks
      sent to the manager through the processor.

A typical use case:

class MyTask: Task<MyType>

class MyProcessor: TaskProcessor<MyType>

TaskManager m = new TaskManager();
MyProcessor p = new MyProcessor(m);
MyTask t = new MyTask();
p.add(t);

// Waits until the result is available
MyType result = t->getResult();

Change-Id: I1fe845ba4c49bb0e1b0627ab147f9a861c8e0749
2013-03-12 15:06:42 -07:00
Romain Guy
2a2ead93a9 Merge "Precache paths from a worker thread" into jb-mr2-dev 2013-03-12 01:43:20 +00:00
Romain Guy
ca89e2a687 Precache paths from a worker thread
Change-Id: I3e7b53d67e0e03e403beaf55c39350ead7f1e309
2013-03-11 17:05:28 -07:00
Christopher Tate
294b512eca DO NOT MERGE - Full backup/restore now handles OBBs sensibly
OBB backup/ restore is no longer handled within the target app
process.  This is done to avoid having to require that OBB-using
apps have full read/write permission for external storage.

The new OBB backup service is a new component running in the
same app as the already-existing shared storage backup agent.
The backup infrastructure delegates backup/restore of apps'
OBB contents to this component (because the system process
may not itself read/write external storage).

From the command line, OBB backup is enabled by using new
-obb / -noobb flags with adb backup.  The default is noobb.

Finally, a couple of nit fixes:

- buffer-size mismatch between the writer and reader of chunked
  file data has been corrected; now the reading side won't be
  issuing an extra pipe read per chunk.

- bu now explicitly closes the transport socket fd after
  adopting it. This was benign but triggered a logged
  warning about leaked fds.

(Cherrypicked)

Change-Id: I471f6348abcccb7bf1e1710b7beda9f23de53e14
2013-03-08 15:08:10 -08:00
Romain Guy
6e20040893 Move blur code from FontRenderer to utils/Blur.cpp
Change-Id: I2cebbfbcb722ed4b37e54ffbf8b53bb92ad0c964
2013-03-08 11:28:22 -08:00
Romain Guy
b09f147126 Don't apply scale to glyphs when a perspective is set.
Bug #8337925

Magazines uses very large scale factors that blow up font cache & CPU.

Change-Id: I1c0ed430ed91b86cc6c6f59f7e8bdcc89a464e46
2013-03-07 17:03:25 -08:00
Romain Guy
8afce816df Round scale factors to rasterize text
Harder, better, faster, stronger.

Change-Id: Iee4125de98c4e61603f56bb7f06002cc86458214
2013-03-06 19:09:59 -08:00
Romain Guy
624234f69b Take only the scale params into account to rasterize text
This change extracts the scale parameters of the current transform
to pass then to the font renderer. Rotation and perspective are
applied to the generated mesh inside the vertex shader. This limits
the number of glyphs we have to create in the font cache and thus
reduces memory churn.

Change-Id: Ic5b3bae2b2b0e0250a8ee723b071a1709725c749
2013-03-05 18:12:35 -08:00
Romain Guy
0b58a3deab Make glyph copies a little more cache friendly
Change-Id: Ie21b7079cc5d3ea67a03597c57842636e4afe143
2013-03-05 12:16:27 -08:00
Romain Guy
3b753829ae Fix colored rects clipping and code cleanup
The drawColorRects() method was clipping individual rectangles
using the wrong parameters left, top, right and bottom instead
of l, r, t and b. It also checked for count == 0 after the loop
when it should have checked for vertexCount == 0. The quickReject
is now not part of the loop since it's a bit overkill to perform
so many matrix multiplications. What we really care about is the
final quickReject performed on the max bounds of the entire set
of rectangles.

This change also replaces all instances of mSnapshot->transform
by currentTransform() to make the code slightly more readable.

Change-Id: I6485280414499716852f7dbfba186774eb6763d4
2013-03-05 10:27:35 -08:00
Romain Guy
19d4dd8599 Take text scale/skew into account only when rendering into a layer
3D rotations can undo scale/skew transforms; since FreeType only accepts
2x2 matrices we can end up generating very large glyphs that are drawn
at a 1:1 scale on screen. For instance, if the current transform has a
scale of 2000 set on both X and Y axis and a perspective Z factor set to
Z, the actual scale factor on screen ends up being 1. We would however
generate glyphs with a scale factor of 2000 causing the font renderer
to blow up.

Change-Id: Ia5c3618d36644e817825cb9c89e2f53aece2074e
2013-03-04 13:48:43 -08:00
Romain Guy
151b71cb52 Merge "Fix math issue when transforming text in perspective" into jb-mr2-dev 2013-03-02 02:08:18 +00:00
Romain Guy
874f5c6e4a Fix math issue when transforming text in perspective
Change-Id: Iad6b4e477c11bd1ef5f0ceab2fabcd440030154d
2013-03-01 18:07:35 -08:00
Romain Guy
28459117a7 Merge "Precache glyphs at final raster size" into jb-mr2-dev 2013-03-02 00:13:17 +00:00
Romain Guy
0f6675332c Precache glyphs at final raster size
The deferred display lists model now allows us to precache glyphs
at their exact size on screen.

This change also removes debug markers when the renderer defers
and reorders display lists. It also adds a flush event marker.

Change-Id: I66ec5216dc12b93ecfdad52a7146b1cfb31fbeb4
2013-03-01 16:04:53 -08:00
Chris Craik
1da8a6a36d Merge "Add shader program selection shortcut" into jb-mr2-dev 2013-03-01 19:42:38 +00:00
Chris Craik
096b8d96d5 Add shader program selection shortcut
Add a key manipulation that makes black text/paths use the standard
simple bitmap/patch shader, since they are the same. Previously we'd
create a separate shader for each because the keys differed, even
though the shaders were functionally equivalent.

Also fixes some issues around setting DEBUG_PROGRAM

Change-Id: I0c77c684d58da03501ee9ab8239c7d4a70fd6b5c
2013-03-01 11:11:31 -08:00
Romain Guy
1361dff5eb Merge "Support 3D rotations when drawing text" into jb-mr2-dev 2013-03-01 00:05:51 +00:00
Romain Guy
a4adcf0239 Support 3D rotations when drawing text
If a perspective transform is set on the Canvas, drawText() should
not attempt to rasterize glyphs in screen space. This change uses
the old behavior instead (i.e. rasterize the glyphs at the native
font size and apply the transform on the resulting mesh.)

This change also adds an optimization: empty glyphs (spaces) do
not generate vertices anymore. This saves a lot of vertices in text
heavy applications such as Gmail.

Change-Id: Ib531384163f5165b5785501612a7b1474f3ff599
2013-02-28 16:04:48 -08:00
Chris Craik
d6960a49b4 Account for text alignment in Op bounds calculation
bug:8243821

Previously this wasn't done for deferred clipping + reordering, so
non-left-aligned text would be clipped at defer time, when it wouldn't
have been at draw time (in OpenGLRenderer::quickReject())

Change-Id: Ic96949c2dca4378f284606b37d9411ed42f8d203
2013-02-28 11:25:39 -08:00
Romain Guy
19886f8b51 Merge "Properly scale text" into jb-mr2-dev 2013-02-28 01:05:34 +00:00