summaryrefslogtreecommitdiffstats
path: root/libs/hwui/ResourceCache.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove SkBitmap from ResourceCacheJohn Reck2015-05-071-40/+0
| | | | | | | | | | | | | 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
* Remove Bitmap#getSkBitmapJohn Reck2015-05-011-5/+5
| | | | Change-Id: Ifb9047b426122d3e5a445eb7a0eb3fce38dedf27
* Revert "Remove Bitmap#getSkBitmap"John Reck2015-04-171-5/+5
| | | | | | This reverts commit 4bd981ec533a65e8dee053a0a709b484770b0a76. Change-Id: I5c92cd955c6e70e197dc5cbc5dfeed8369a24a31
* Remove Bitmap#getSkBitmapJohn Reck2015-04-151-5/+5
| | | | Change-Id: Ifb9047b426122d3e5a445eb7a0eb3fce38dedf27
* Refactor DisplayList path caching.Derek Sollenberger2015-03-131-7/+0
| | | | | | | | | | | 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
* GlopBuilder, and test app refactorChris Craik2015-02-041-1/+1
| | | | Change-Id: I2cd299ccf178007fd5f83bab6c3448f03aec7843
* Update HWUI to store its own SkBitmap objectsDerek Sollenberger2015-01-091-13/+40
| | | | | | | | | | | 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
* am 5ab86ba0: am 89a63f02: am 0c31d97a: Merge "Switch TextureCache to ↵John Reck2014-11-251-1/+0
|\ | | | | | | | | | | | | SkPixelRef::fStableId" into lmp-mr1-dev * commit '5ab86ba05decf12e8ee3f693aab6b265905049c6': Switch TextureCache to SkPixelRef::fStableId
| * Switch TextureCache to SkPixelRef::fStableIdJohn Reck2014-11-241-1/+0
| | | | | | | | | | Bug: 18245805 Change-Id: I08e6792dbeed86b13e569c7f2137de0e50dc2763
* | resolved conflicts for merge of be70c771 to masterJohn Reck2014-11-061-2/+6
|\ \ | |/ | | | | Change-Id: I469905bef7361c18aab725778694567d1987c06d
| * Yank ResourceCache out of CachesJohn Reck2014-11-061-2/+6
| | | | | | | | | | | | | | | | | | | | | | 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
* | am e05575e9: am a8d83d63: Merge "Layer changes" into lmp-mr1-dev automerge: ↵John Reck2014-10-311-6/+1
|\ \ | |/ | | | | | | | | | | a51fba0 * commit 'e05575e9c36850d8cfe49396ac9a1372511b12bf': Layer changes
| * Layer changesJohn Reck2014-10-311-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Clean up physical couplingTom Hudson2014-10-151-2/+3
|/ | | | | | | | Narrow the use of #include directives in hwui, replacing with forward declarations where straightforward. Speeds compiles; doesn't do any restructuring of code. Change-Id: Icac2baffb5896f55d8c6718e9bd9d4bfa02d3ca0
* Inspect SkShader to determine hw shader.Leon Scroggins III2014-05-221-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Removing SkiaColorFilter and inspecting the native object directly.Derek Sollenberger2014-02-071-8/+0
| | | | | bug: 10650594 Change-Id: I4fcf66d008765afa0e35d011f58bc792183cb74f
* Use const where possible for drawing parametersChris Craik2014-01-031-16/+16
| | | | | | They should never be modified by a Renderer, only read and copied. Change-Id: I9d8d55dca19115ee9dfeb2bb3f092ba2fb327cd4
* Refcount 9-patches and properly handle GC eventsRomain Guy2013-06-261-0/+11
| | | | | | | | | | | | | | | | | This change adds refcounting of Res_png_9patch instances, the native data structure used to represent 9-patches. The Dalvik NinePatch class now holds a native pointer instead of a Dalvik byte[]. This pointer is used whenever we need to draw the 9-patch (software or hardware.) Since we are now tracking garbage collection of NinePatch objects libhwui's PatchCache must keep a list of free blocks in the VBO used to store the meshes. This change also removes unnecessary instances tracking from GLES20DisplayList. Bitmaps and 9-patches are refcounted at the native level and do not need to be tracked by the Dalvik layer. Change-Id: Ib8682d573a538aaf1945f8ec5a9bd5da5d16f74b
* Don't null the reference to Bitmap pixels until we're really readyChet Haase2012-10-221-2/+2
| | | | | | | | | | | | | | | | | | | | | A change in the VM triggers a native memory error more aggressively than before, showing that there's a bug in the logic of recycling bitmaps. Since the pixel memory is allocated on the Java heap, nulling out the reference to that memory in the Java level Bitmap object can cause that memory to get collected at any time. Meanwhile, we may have a reference to that memory at the native level for rendering purposes, causing an error if/when we access that memory after it has been collected by the VM. The fix is to avoid setting the reference to the pixels to null unless we are not referring to it in native code. This is determined at the time we call recycle() - we return a boolean to indicate whether the native code is still using the memory. if not, the Java code can null out the reference and allow the VM to collect it. Otherwise, it will get collected later when the encompassing Bitmap object is collected. Issue #7339156 HTML5 tests crash the app (Vellamo) Change-Id: I3a0d6b9a6c5dd3b86cc2b0ff7719007e774b5e3c
* Avoid deadlock when deleting layersRomain Guy2012-09-231-1/+1
| | | | | | Bug #7217459 Change-Id: I12bfa6c30c5030bd1b23ea6a3ce64240ab1dfba3
* Fix occasional crash bug with layersChet Haase2012-09-171-0/+6
| | | | | | | | | | | | | | | | | | | | Launcher occasionally crashes with a stack trace indicating that the memory of a Layer object is corrupt. It is possible for us to delete a Layer structure and then, briefly, use it to draw a DisplayList again before that DisplayList gets recreated (without the layer that got deleted). When this happens, if the memory got corrupted, it's possible to crash. The fix is to add Layer to the other objects which we currently refcount (bitmaps, shaders, etc.). Then instead of deleting a Layer, we decrement the refcount. We increment when creating it, then increment it again when it's referenced from a DisplayList. Then we decrement the refcount instead of deleting it, and decrement when we clear a DisplayList that refers to it. Then when the refcount reaches 0, we delete it. Issue #6994632 Native crash in launcher when trying to launch all apps screen Change-Id: I0627be8d49bb2f9ba8d158a84b764bb4e7df934c
* Reduce the number of locks acquired by display listsRomain Guy2012-09-071-4/+37
| | | | Change-Id: I1123aae0355de84db705bb75042c7083fc69c9f2
* Reduce the size of libhwui by 50%Romain Guy2011-10-121-1/+3
| | | | | | | | 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
* Fix crash when Paths are GCd in hw accelerated appsChet Haase2011-02-041-0/+4
| | | | | | | | | | | | | | | | | | A recent change to optimize path rendering didn't account for the destruction of native objects by the VM finalizer. We may be done with the Java level version before we're done with the native structure that's used by the display list. For example, a drawing method on a View that creates a temporary path to render into the canvas will implicitly create a native structure that is put onto the GL display list. That temporary path may go away, but the native version should stick around as long as the display list does. The fix is to refcount the original native version of the path and only delete it when the refcoutn reaches zero (which means that it is no longer needed by any display list). This is a similar mechanism used for bitmaps and shaders. Change-Id: I4de1047415066d425d1c689aa60827f97729b470
* Fix hang in native bitmap recycling due to nested mutex locksChet Haase2010-11-231-1/+0
| | | | Change-Id: Ic37d5408ddb3f68aba6520fb0c78ffde91dfbe62
* make ResourceCache for display lists thread-safeChet Haase2010-11-111-0/+7
| | | | Change-Id: I41885b4ae249d7d7c000bab17bf32340ba85ab3a
* Optimize FBO drawing with regions.Romain Guy2010-11-021-3/+3
| | | | | | | | | This optimization is currently disabled until Launcher is modified to take advantage of it. The optimization can be enabled by turning on RENDER_LAYERS_AS_REGIONS in the OpenGLRenderer.h file. Change-Id: I2fdf59d0f4dc690a3d7f712173ab8db3848b27b1
* Optimizing ColorFilter in display listsChet Haase2010-10-261-0/+5
| | | | Change-Id: Ie4d5e5b0bc45e0ce47bba144049303c270762e54
* DisplayList optimizations and fixes.Chet Haase2010-10-261-8/+0
| | | | | | | | We now use a copy of SkPaint objects to avoid having it changed from under us. We reuse copies that have not changed. We also copy the SkMatrix every time to avoid the same problem. Change-Id: If3fd80698f2d43ea16d23302063e0fd8d0549027
* Optimizing display lists by referencing pointers to resources instead of ↵Chet Haase2010-10-211-0/+81
copying them Change-Id: I81ad3551d74aa1e5bb64d69e33d2eb29a6c1eb6a