94 Commits

Author SHA1 Message Date
Chris Craik
b36af87f82 Use LinearStdAllocator in DisplayList
bug:24300128

This removes most of the remaining calls to malloc when
recording DisplayLists.

Change-Id: If928bd53dac0f145aadc436a62759086b67da0ed
2015-10-19 11:32:28 -07:00
Chris Craik
003cc3dec8 Rename DisplayListData to DisplayList
Change-Id: I25f6bb88ffdf9baf7e8e4e2a294aa8c9d2a4605b
2015-10-16 10:38:34 -07:00
Chris Craik
10ed692118 Use typedefs to differentiate between flavors of DisplayLists
Change-Id: Id3b0a5aa045f2343fb046ca0889b375a7d00e03f
2015-10-15 10:55:15 -07:00
Chris Craik
b565df13a9 Initial commit of new Canvas operation recording / replay
Done:
- drawRect, drawBitmap, drawColor, drawPaint, drawRenderNode, drawRegion
- Recording with new DisplayList format
- batching & reordering
- Stateless op reorder
- Stateless op rendering
- Frame lifecycle (clear, geterror, cleanup)

Not done:
- SaveLayer (clipped and unclipped)
- HW layers
- Complex clipping
- Ripple projection
- Z reordering
- Z shadows
- onDefer prefetching (text + task kickoff)
- round rect clip
- linear allocation for std collections
- AssetAtlas support

Change-Id: Iaf98c1a3aeab5fa47cc8f9c6d964420abc0e7691
2015-10-14 16:10:40 -07:00
John Reck
4a4bc892e8 Microbench hackery
Change-Id: I35428350e16982824bb4e8a0015a4cb98b1c0799
2015-10-12 15:45:01 -07:00
John Reck
272a685f17 Replace most usages of utils/Vector.h
Change-Id: I540d1b3523244d6c71fc52d6fb30555271c25644
2015-07-30 09:51:52 -07:00
Chris Craik
5a4690bf26 Clean up unncessary defines
LOG_TAG and TRACE_TAG are already defined in the makefile

Change-Id: I9e53e3dacbe018441edd74cb7c8c90846defee74
2015-07-14 13:25:38 -07:00
John Reck
e75ab4c26a Remove SkBitmap from ResourceCache
Bug: 18928352

Fully-proper refcounting via SkBitmap/SkPixelRef, no more
side-channel refcounting via ResourceCache. Makes HWUI
more resilient to the bitmap being modified as well as
the SkBitmap's info & rowBytes() is updated every time
a DisplayList is recorded instead of relying on buggy
cache eviction logic

Change-Id: I2e8292d62ab6c257a2cfa1542387bf2bf1ade816
2015-05-07 13:17:18 -07:00
Derek Sollenberger
ee248599d4 Refactor DisplayList path caching.
This removes dependence on SkPath ptrs that HWUI does not control
the lifecycle of. This clears up some errors where the paths are
not generated from Java, but rather the Skia test suites.

Cherry-pick of a change that originally landed in master-skia and is
dependent on a skia merge (ag/655422).

Change-Id: I41b9797a2b0af5d6b4ea51891565469d4f1d832d
2015-03-13 08:05:55 -04:00
Chris Craik
2ae0733982 Remove DisplayListLogBuffer
Change-Id: I001832fc444b6d532f4a382e0a31cc1d8956dbd8
2015-01-21 14:22:39 -08:00
Derek Sollenberger
3d4eed7f1a Update HWUI to store its own SkBitmap objects
This enables us to...

1) simplify the lifecycle/ownership between Java and HWUI
2) remove DisplayListRenderer::drawBitmapData and associated logic
3) track pixel lifecycle using standard SkPixelRef refcounting
4) Remove uncessary calls to ref/unref the bitmap's pixels and colorTable

Change-Id: I3c95078da20995444f6388a029414280fd654318
2015-01-09 13:56:56 -05:00
Chris Craik
51d6a3db97 Cleanup various clang warnings, use unique_ptrs in several places
Change-Id: I347904b25e51fcc7de14b1e72f1acd0f6ba26f3f
2014-12-23 16:53:56 -08:00
John Reck
a35778c799 Yank ResourceCache out of Caches
Bug: 17947547

Pull the ResourceCache (aka, ref-counting side channel) out of
Caches so that DisplayListRenderer doesn't use Caches, avoiding
the risk of instantiating Caches on the wrong thread or
without a GL context

Change-Id: I7d63b70b3b0a0163308c5dedd6ef255eadebe8fd
2014-11-06 09:45:10 -08:00
John Reck
0e89e2b7bc Layer changes
Bug: 17208461

* Switch Layer to be VirtualLightRefBase instead of
  Caches' side-channel ref-counting
* Include active layers in gfxinfo dump
* Run gfxinfo dump on the correct thread
* Dump gfxinfo on Layer creation failure

Change-Id: I28d195699e2334518e215ab28c7a17355aee9678
2014-10-31 15:30:10 -07:00
Chris Craik
8afd0f245c Create z reordering boundaries around dispatchDraw
bug:16012254

This means rendernodes with a Z will no longer be drawn at the end of
their parent's DisplayList, but at the end of the associated reorder
region (DisplayListData::Chunk).

Change-Id: Ia033fee9d9a4db567b2a8d5e90fc57a4d0a64544
2014-08-25 15:35:40 -07:00
John Reck
09d5cddf67 Add kModeSync
Bug: 16526750

Change-Id: I4c087160e80432739321172fd57880846c8de6e0
2014-07-24 10:36:08 -07:00
Chris Craik
a7090e0cfd Update 'DisplayList' vs 'RenderNode' naming in several places
Change-Id: I635c6627d098b661fb9b0ba1bd42fa6d7277d287
2014-06-23 09:57:07 -07:00
Derek Sollenberger
139088228f Update HWUI matrix API
1. more closely mirror Skia API by using const ref instead of ptrs
2. store SkMatrix in the drawOp instead of the linear allocation heap

Change-Id: I4b9f6f76b9f7d19325e29303d27b793679fd4823
2014-05-29 16:51:23 -04:00
Leon Scroggins III
d1ad5e62fd Inspect SkShader to determine hw shader.
Instead of duplicating internal info about SkShader, inspect the
SkShader installed on the SkPaint.

core/java/android/view/GLES20Canvas.java:
Remove setupModifiers, nResetModifiers, and nSetupShader.

core/jni/android/graphics/Shader.cpp:
Remove calls to create/destroy the (previously) attached SkiaShader.

core/jni/android_view_GLES20Canvas.cpp:
Remove native code for setupShader and resetModifiers.

graphics/java/android/graphics/BitmapShader.java:
graphics/java/android/graphics/ComposeShader.java:
graphics/java/android/graphics/LinearGradient.java:
graphics/java/android/graphics/RadialGradient.java:
graphics/java/android/graphics/Shader.java:
graphics/java/android/graphics/SweepGradient.java:
Remove code keeping track of native SkiaShader.

libs/hwui/Caches.h:
Include Extensions.h.

libs/hwui/DeferredDisplayList.cpp:
Compare shaders on the paint, instead of on DrawModifiers.

libs/hwui/DisplayList.cpp:
libs/hwui/DisplayList.h:
Remove vector of SkiaShaders.

libs/hwui/DisplayListOp.h:
Access the SkShader on mPaint.
Remove SetupShaderOp and ResetShaderOp.

libs/hwui/DisplayListRenderer.cpp:
libs/hwui/DisplayListRenderer.h:
Remove resetShader, setupShader, refShader, and mShaderMap.

libs/hwui/FontRenderer.cpp:
Pass SkShader to setupDrawShader and setupDrawShaderUniforms.

libs/hwui/OpenGLRenderer.cpp:
libs/hwui/OpenGLRenderer.h:
Add LayerShader, a class inheriting from SkShader, to mimic the
behavior of SkiaLayerShader. Unlike SkiaLayerShader, it can be set on
the SkPaint so it can be inspected later.
Set a LayerShader instead of a SkiaLayerShader.
setupDrawShader and setupDrawShaderUniforms now inspect an SkShader
passed in.
Inspect SkShader instead of mDrawModifiers.mShader.
Remove resetShader and setupShader.
setupDrawColorUniforms now takes a boolean indicating whether there is
a shader.
Add an inline function for accessing the SkShader on an SkPaint.
In setupDrawBlending(Layer*, bool), do not check the shader (which will
never be set), but do check whether the color filter may change the
alpha (newly fixed behavior).
In setupDrawBlending(SkPaint, ...), check the SkShader and whether the
color filter affects alpha (the latter is new behavior).

libs/hwui/Renderer.h:
Remove pure virtual functions setupShader and resetShader.

libs/hwui/ResourceCache.cpp:
libs/hwui/ResourceCache.h:
Remove functions for refing/unrefing shaders.

libs/hwui/SkiaShader.cpp:
libs/hwui/SkiaShader.h:
Much of this code was redundant and has been removed.
Convert structs into class with nothing but static functions for
calling describe/setupProgram.

libs/hwui/TextureCache.cpp:
libs/hwui/TextureCache.h:
Use the SkPixelRef as the key to the bitmap Lru cache, since shader
inspection will provide a different SkBitmap pointer (though it will
hold the correct SkPixelRef with the correct generation ID).

tests/CanvasCompare/src/com/android/test/hwuicompare/DisplayModifier.java:
tests/CanvasCompare/src/com/android/test/hwuicompare/ResourceModifiers.java:
Update manual test to have more shaders: radial, sweep, compose,
invalid compose.

BUG:10650594

Change-Id: Iaa7189178bda1c55f96da044d2a9fa602ba36034
2014-05-22 14:46:59 -04:00
Chris Craik
3f085429fd Clip TouchFeedbackDrawable effect to receiver Outline
Projected RenderNodes are now wrapped with a ClipRect or masked
SaveLayer, so that they are clipped to the outline of the projection
receiver surface.

Change-Id: I1d4afc1bb5d638d650bc0b1dac51a498f216773e
2014-04-23 16:15:11 -07:00
John Reck
087bc0c14b Refcount RenderNode
Change-Id: I7a86db8acc2b78ef33d987a43a119f5933d7d752
2014-04-07 14:53:08 -07:00
John Reck
113e0824d6 Move RenderNode to own file
Change-Id: I9380d161fd3ddd7b569c262dd8e7aa0c96151b1e
2014-03-19 16:40:04 -07:00
Chris Craik
34f67f26e3 Remove castsShadow and globalCamera APIs
Change-Id: I5c1c375f45946609b1635d952c5adf55e23bdd60
2014-03-17 13:24:08 -07:00
Chris Craik
618236fe88 Revert "Remove castsShadow and globalCamera APIs"
This reverts commit 0334c314a5721f49b4d172a9cefe10f157cb28a4.

Change-Id: I64714d17fb877e1b43c65eb44820d1128281c7a2
2014-03-17 19:27:49 +00:00
Chris Craik
0334c314a5 Remove castsShadow and globalCamera APIs
Change-Id: I4d81a7849eba60a1a9debce74eedd55d6331842d
2014-03-17 18:13:31 +00:00
John Reck
acb6f07623 Split out RenderProperties
Change-Id: Ia9888b4fb2c849d95a8c395cafef2e2294a23aae
2014-03-12 23:32:24 +00:00
John Reck
33896588e8 No-op isolatedZVolumen property
Change-Id: I7aa474d65a3d12efd4ffb731e07ee42f4d348183
2014-03-12 15:14:12 -07:00
John Reck
e18264b079 Rename DisplayList->RenderNode
Change-Id: Id42e23c9a1a6eb6eaeafef707ced7fa6887b03d0
2014-03-12 13:56:30 -07:00
Chris Craik
b79a3e301a Fix orthographic shadows projection, simplify shadow reordering
Separate matrix passed to shadow system into two parts, one for
transforming the polygon XY points (using the actual draw matrix) and
a separate one which respects correct 4x4 3d rotations and
translations for determining Z values.

Change-Id: I7e30a84774a8709df6b2241e8f51fc5583648fe8
2014-03-12 09:44:41 -07:00
Chris Craik
e361ad7ab1 Remove experimental perspective projection
Change-Id: Iad688c8395ccd4673cc129973802b5f01dfb45ba
2014-03-11 15:41:40 -07:00
Chris Craik
726118b352 Improve shadow tessellation performance
- Tune and simplify shadow parameters
- Remove additional inner rings
- Improve polygon ray casting algorithm

Change-Id: If0f28b2d66ae0480b675942bb65e8fcd2864425d
2014-03-11 15:23:36 -07:00
John Reck
a88bdf8d46 Make sure we register functor count
Bug: 13339664

Change-Id: Iafb8ba77bdf1d971c1d0a345ff525e7f7fa80352
2014-03-06 16:22:47 -08:00
Chris Craik
ef8c07c86f Merge "Draw shadows from casters together if the Z values are similar" 2014-03-06 17:45:29 +00:00
Chris Craik
eea6ef9c76 Fix warnings in hwui
Change-Id: I6ad6b78531cc0426dc2ea82a32775f7b0265b5b1
2014-03-05 16:37:35 -08:00
Chris Craik
8b6f2df48e Draw shadows from casters together if the Z values are similar
Change-Id: Ib5d00c83e81d9d4c384685a84988a681da8b4490
2014-03-05 16:25:50 -08:00
John Reck
44fd8d24f7 DisplayList overhaul
Change-Id: I53418d580c98f706e971545cff81b9921c12cc5f
2014-03-04 15:18:16 -08:00
Chris Craik
919e95cc23 Modulate shadow alpha by caster alpha
Change-Id: Ibc4b3958feb3b5dba91d30af470d76555a6209c8
2014-02-21 17:15:12 -08:00
Chris Craik
e9b8817bd7 Make outline and shadow APIs public
Change-Id: If40dc27b2fdc41c3ed355bc9029474b1344c1a03
2014-02-18 16:55:45 -08:00
Derek Sollenberger
eef1be1d83 Merge "Removing SkiaColorFilter and inspecting the native object directly." 2014-02-10 19:19:07 +00:00
Chris Craik
b67a7bf27b Add shadow casting / global perspective APIs, hidden for now.
Global perspective isn't yet hooked up in rendering.

Change-Id: I64ad272ea5dc523505260ce114f0a6bebdcfe9dc
2014-02-07 16:02:51 -08:00
Derek Sollenberger
76d3a1b8d0 Removing SkiaColorFilter and inspecting the native object directly.
bug: 10650594
Change-Id: I4fcf66d008765afa0e35d011f58bc792183cb74f
2014-02-07 17:06:14 -05:00
ztenghui
fad4593a3c Add the clipToOutline by just using the clipPathOp
Change-Id: I6ba23b589e579599d018600d0744be0efe2028c1
2014-02-07 13:36:57 -08:00
Derek Sollenberger
8852ab4357 Merge "Keep the SkPaint used when creating a layer." 2014-02-07 20:52:22 +00:00
Chris Craik
27bfb24518 Merge "Rework and clean up DisplayList projection" 2014-02-07 18:47:57 +00:00
Derek Sollenberger
d44fbe55a9 Keep the SkPaint used when creating a layer.
This will allow us to inspect the paint for thing other than
color and xfermode, such as SkColorFilters and SkShaders.

bug: 10650594
Change-Id: I2c3ddd07a3966e1e77af34136307e2b59b2898c1
2014-02-07 13:33:29 -05:00
Chris Craik
1df26446b7 Rework and clean up DisplayList projection
Move the projection surface to be a property of a DisplayList,
set to true for every background drawable.

Additionally, handle a projecting view background such that it doesn't
try to project onto itself (which is undesirable).

Change-Id: Ic70b17474bd87340e80767f8518f73b233419c7a
2014-02-06 16:07:37 -08:00
Chris Craik
629f67709b Simplify DisplayList matrices
Somewhat unifies the ortho/perspecive paths - the property matrix
(translate/scale/rotate) is now always a Matrix4.

Change-Id: I36e4fe83d1150ee6e4be5f64f34d0fc8d6525cc6
2014-02-05 13:12:04 -08:00
Chris Craik
a2fe7affd3 Add initial hidden outline APIs
Background drawable outline usage and drawable outline calculation
still to come.

Change-Id: I8c7539f1638f86e1f8eb11f4fe49f705f61d58ba
2014-01-30 16:04:16 -08:00
Chris Craik
6657a6c539 Update reordering method names, and make 3d reordering API public
IsContainedVolume -> hasIsolatedZVolume conveys that this affects Z
ordering of views

ProjectToContainedBackground -> ProjectBackwards, since it ended up
using its own projection target, separate from the 3d volume bit

Change-Id: Ia2cde838cc4da134366fe6ff623290fbd65e50c3
2014-01-29 13:55:39 -08:00
Chris Craik
3783e70b55 Remove logging of DisplayList staleness
Change-Id: Ie6b3af3065d4d10ec0bc9b419223d3458d297ea8
2014-01-27 14:29:37 -08:00