diff options
author | Chris Craik <ccraik@google.com> | 2014-06-12 16:54:18 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-06-12 16:54:18 +0000 |
commit | 3e136626daa184a8191808343c95be9c7313448b (patch) | |
tree | a9f051d7cc5b7d2d383874faa41fb03a7ad57de1 /libs | |
parent | eebf7b954e793cb2183cf5381ff6ad1208ba2b14 (diff) | |
parent | ffdd37ff142ade5de6cc97f77087194892fd9714 (diff) | |
download | frameworks_base-3e136626daa184a8191808343c95be9c7313448b.zip frameworks_base-3e136626daa184a8191808343c95be9c7313448b.tar.gz frameworks_base-3e136626daa184a8191808343c95be9c7313448b.tar.bz2 |
am 69453787: Merge "Fix race in shadow tessellation by deep copying task params" into lmp-preview-dev
* commit '6945378752381a04d81eb426876a6495488cd459':
Fix race in shadow tessellation by deep copying task params
Diffstat (limited to 'libs')
-rw-r--r-- | libs/hwui/TessellationCache.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/libs/hwui/TessellationCache.cpp b/libs/hwui/TessellationCache.cpp index 41cc9d2..79fe4d3 100644 --- a/libs/hwui/TessellationCache.cpp +++ b/libs/hwui/TessellationCache.cpp @@ -165,12 +165,12 @@ public: ShadowTask(const Matrix4* drawTransform, const Rect& localClip, bool opaque, const SkPath* casterPerimeter, const Matrix4* transformXY, const Matrix4* transformZ, const Vector3& lightCenter, float lightRadius) - : drawTransform(drawTransform) + : drawTransform(*drawTransform) , localClip(localClip) , opaque(opaque) - , casterPerimeter(casterPerimeter) - , transformXY(transformXY) - , transformZ(transformZ) + , casterPerimeter(*casterPerimeter) + , transformXY(*transformXY) + , transformZ(*transformZ) , lightCenter(lightCenter) , lightRadius(lightRadius) { } @@ -182,14 +182,19 @@ public: delete bufferPair; } - // Note - only the localClip is deep copied, since other pointers point at Allocator controlled - // objects, which are safe for the entire frame - const Matrix4* drawTransform; + /* Note - we deep copy all task parameters, because *even though* pointers into Allocator + * controlled objects (like the SkPath and Matrix4s) should be safe for the entire frame, + * certain Allocators are destroyed before trim() is called to flush incomplete tasks. + * + * These deep copies could be avoided, long term, by cancelling or flushing outstanding tasks + * before tearning down single-frame LinearAllocators. + */ + const Matrix4 drawTransform; const Rect localClip; bool opaque; - const SkPath* casterPerimeter; - const Matrix4* transformXY; - const Matrix4* transformZ; + const SkPath casterPerimeter; + const Matrix4 transformXY; + const Matrix4 transformZ; const Vector3 lightCenter; const float lightRadius; }; @@ -281,8 +286,8 @@ public: VertexBuffer* ambientBuffer = new VertexBuffer; VertexBuffer* spotBuffer = new VertexBuffer; - tessellateShadows(t->drawTransform, &t->localClip, t->opaque, t->casterPerimeter, - t->transformXY, t->transformZ, t->lightCenter, t->lightRadius, + tessellateShadows(&t->drawTransform, &t->localClip, t->opaque, &t->casterPerimeter, + &t->transformXY, &t->transformZ, t->lightCenter, t->lightRadius, *ambientBuffer, *spotBuffer); t->setResult(new TessellationCache::vertexBuffer_pair_t(ambientBuffer, spotBuffer)); |