summaryrefslogtreecommitdiffstats
path: root/libs/hwui/TextureCache.h
Commit message (Collapse)AuthorAgeFilesLines
* Glop ColorFilter & VertexBuffer support, initial enableChris Craik2015-02-061-4/+1
| | | | | | | Enables Glop rendering for supported Rects and VertexBuffers Also removes unused Query object Change-Id: Ibe227bc362685a153159f75077664f0947764e06
* Update HWUI to store its own SkBitmap objectsDerek Sollenberger2015-01-091-2/+2
| | | | | | | | | | | 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
* Add overrides and switch to nullptr keywordChris Craik2014-12-221-1/+1
| | | | | | | | Changes generated with clang-modernize. Additionally, fixed some struct-vs-class usage to make clang happy. Change-Id: Ic6ef2427401ff1e794d26f21f7b44868fc75fb72
* resolved conflicts for merge of d67bb501 to masterYohann Roussel2014-12-111-0/+6
|\ | | | | | | Change-Id: I40698ce1e382cb41eec7af5ea49ac0e2f997d555
| * Don't preload textures for AssetAtlasJohn Reck2014-12-101-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 18317479 RenderNode::prepareSubTree calls prefetchAndMarkInUse on every bitmapResoruce in the DisplayList. However, this resulted in textures being uploaded for bitmaps that would be drawn from the AssetAtlas instead. To fix this we teach TextureCache about the AssetAtlas so that calls to TextureCache return the Texture from AssetAtlas if it exists. Thus usage of AssetAtlas is now purely to allow for further optimizations via draw merging instead of a requirement to get any benefit at all. Change-Id: I65282fa05bac46f4e93822b3467ffa0261ccf200
* | am 5ab86ba0: am 89a63f02: am 0c31d97a: Merge "Switch TextureCache to ↵John Reck2014-11-251-10/+6
|\ \ | |/ | | | | | | | | | | SkPixelRef::fStableId" into lmp-mr1-dev * commit '5ab86ba05decf12e8ee3f693aab6b265905049c6': Switch TextureCache to SkPixelRef::fStableId
| * Switch TextureCache to SkPixelRef::fStableIdJohn Reck2014-11-241-10/+6
| | | | | | | | | | Bug: 18245805 Change-Id: I08e6792dbeed86b13e569c7f2137de0e50dc2763
* | Clean up physical couplingTom Hudson2014-10-151-1/+2
|/ | | | | | | | 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
* resolved conflicts for merge of ecae1ffd to masterztenghui2014-06-161-1/+1
|\ | | | | | | Change-Id: I1ba660ce832e3360fa136be6aa0415645bfda328
| * update parameters in uploadToTexture() for GLES20Lu, Shenghua2014-06-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Google optimized the uploadToTexture with GLES3.0+, This allows us to upload a sub-rectangle of texture, but this has compliance issue with GLES 2.0. With OpenGL ES 2.0 we need to copy the bitmap in a temporary buffer if the stride doesn't match the width, and then upload entire temporary stripes. Change-Id: I8987cd8347913c61b7fa45bd47be1189aa6bdb05 Signed-off-by: Shenghua Lu <shenghua.lu@intel.com> Signed-off-by: Shuo Gao <shuo.gao@intel.com> Signed-off-by: Guobin Zhang<guobin.zhang@intel.com>
* | Inspect SkShader to determine hw shader.Leon Scroggins III2014-05-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Fix issue with bitmap uploadingJohn Reck2014-04-141-0/+17
| | | | | | | | | | | | Bug: 13912749 Change-Id: Ic23fa1d280118dc93dc2716a4a24cc0bbbdca595
* | Use const where possible for drawing parametersChris Craik2014-01-031-10/+10
|/ | | | | | They should never be modified by a Renderer, only read and copied. Change-Id: I9d8d55dca19115ee9dfeb2bb3f092ba2fb327cd4
* Take SkBitmap's stride into account when uploading texturesRomain Guy2013-09-251-2/+2
| | | | | Bug #10151807 Change-Id: I7ba4804fa3619088fea70eb55f10519fff0bf5f0
* Use LruCache instead of GenerationCache in libhwuiRomain Guy2012-11-291-2/+2
| | | | Change-Id: Ic26ddc7151eb5462bcd243b21daf7187ed6d3bec
* Enable mipmapping, without a deadlock this timeRomain Guy2012-10-171-1/+0
| | | | | | Bug #7353771 Change-Id: I89a08a58608e374f1c604a26ee0769d5850b2f7b
* Add API to enable mipmaps on BitmapRomain Guy2012-10-161-0/+1
| | | | | | | | | Bug #7353771 This API can be used when scaling large images down to a small size to get nicer looking results. Change-Id: If09087eed36077eee5355f6047a3ca67747d7d9e
* Remove all Dalvik allocations from Cavnas.drawBitmap(int[], ...)Romain Guy2012-05-141-0/+5
| | | | Change-Id: Ie28538a2104d21154fdc78a56525e7403f08287d
* Add missing includes for Mutex.hDerek Sollenberger2012-03-051-0/+1
| | | | | | | The missing header was being transitively included through a Skia header which is being removed. Change-Id: I5a65bae076027951fe07d1e7eecd4732124fb0e4
* Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGESteve Block2012-01-031-1/+1
| | | | | | | See https://android-git.corp.google.com/g/156016 Bug: 5449033 Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
* Memory optimizations for libhwuiRomain Guy2011-11-041-0/+13
| | | | | | | | | | | Bug #5566149 Lazily initialize font renderers Keep 60% of the texture cache when an app goes to the background Delete least used font renderer when going to the background Delete all font renderers on full memory trim Change-Id: I3c2454d46dc1107ec0f0f72a9ce69cbbcc8825e7
* Free resources only from the GL context thread.Romain Guy2010-11-111-6/+15
| | | | | | | | | | Bug #3179882 Resources were freed following garbage collections on a worker thread. This worker thread had no EGL context, which would cause the renderer to incorrectly assume that the memory was liberated. Change-Id: Ifdb51f94ddf42641e8654522787bfac532976c7c
* Add new runtime debug flags.Romain Guy2010-11-101-0/+2
| | | | Change-Id: I07955de166a89b5053c6c13f250bb3e2936ca86e
* Move all debug flags in a single place.Romain Guy2010-11-101-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | This change also adds a new memory usage flag. When turned on, the following is printed after every frame: D/OpenGLRenderer( 3723): Current memory usage / total memory usage (bytes): D/OpenGLRenderer( 3723): TextureCache 3766680 / 20971520 D/OpenGLRenderer( 3723): LayerCache 3538944 / 8388608 D/OpenGLRenderer( 3723): GradientCache 135168 / 524288 D/OpenGLRenderer( 3723): PathCache 41180 / 4194304 D/OpenGLRenderer( 3723): TextDropShadowCache 0 / 2097152 D/OpenGLRenderer( 3723): FontRenderer 0 262144 / 262144 D/OpenGLRenderer( 3723): FontRenderer 1 262144 / 262144 D/OpenGLRenderer( 3723): FontRenderer 2 262144 / 262144 D/OpenGLRenderer( 3723): Other: D/OpenGLRenderer( 3723): FboCache 2 / 12 D/OpenGLRenderer( 3723): PatchCache 31 / 512 D/OpenGLRenderer( 3723): Total memory usage: D/OpenGLRenderer( 3723): 8268404 bytes, 7.89 MB This should help tracking possibe memory issues. Change-Id: I83f483ca1d2dbef904829bce368e33fe5503e8d6
* Correctly remove unused paths from the cache.Romain Guy2010-11-091-0/+4
| | | | Change-Id: I41d9334dcd9871634037344ab49bf69383498161
* Optimize FBO drawing with regions.Romain Guy2010-11-021-4/+4
| | | | | | | | | 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
* DisplayList optimizations and fixes.Chet Haase2010-10-261-0/+14
| | | | | | | | 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
* Move GenerationCache to the utils directory.Romain Guy2010-10-081-1/+1
| | | | Change-Id: I210ffa8f1d76a102bb7d971c649c20a74d03fbe6
* Add support for paletted textures.Romain Guy2010-10-051-0/+1
| | | | Change-Id: I36e6069bd58f78c609cdd1f3e4560c98f128f48e
* Fix texture corruption issue, faster re-upload of textures.Romain Guy2010-09-221-0/+3
| | | | | | Bug #2950691 Change-Id: I57e2bc1d1a23e8683c25de7d09d6f5af2df59f41
* Purge Skia objects from GL caches as needed.Romain Guy2010-09-081-0/+4
| | | | Change-Id: I754c671cf790ad5ae8bf047ad328034217da4ecc
* Fix possible infinite loop when purging textures.Romain Guy2010-09-081-0/+2
| | | | Change-Id: Ib05b398ae03e734da2dab0496df416fed4570b1c
* Use only one GL context per process, share chaches.Romain Guy2010-08-241-0/+3
| | | | Change-Id: Ieabaa25338d2f4b8d4fd90e7401ad6e7452eae11
* Make libhwui entirely optional.Romain Guy2010-08-081-1/+1
| | | | | | | | | | | | The makefile variable USE_OPENGL_RENDERER must be set to true to compile libhwui and the related code in the JNI layer. This change also removes obsolete APIs from Canvas that must not be used and would be confusing if left in. These APIs were remnants of our first attempt at an OpenGL renderer for the view hierarchy and had not been taken out before Android 1.0 was released. Change-Id: I2475ff1307212bab26c926724f3c508681c7dae1
* Enforce maximum texture size.Romain Guy2010-08-071-0/+1
| | | | | | | | | | | | When an app tries to render a bitmap or path larger than the GPU's maximum texture size, the drawing command is ignored and a warning is logged. This change also makes texture drawing more robust by catching potential errors during texture creation. This change also fixes a crash in the FontRenderer. The destructor would sometimes try to free an uninitialized array. Change-Id: I95ae0939c52192d97b340aa02417bf6d0c962c57
* Simpler way to deal with the FBO multi-cache.Romain Guy2010-07-071-1/+1
| | | | | | | | This change removes the need for the SortedList and instead just add a generated id to each FBO stored in the cache. This is an artificial way to store several FBOs with the same dimensions. Change-Id: I9638364e9bdc0f2391261937a0c86096f20505bf
* Optimize FBO cache.Romain Guy2010-07-071-1/+1
| | | | | | | | | This change introduces a new generational cache called GenerationMultiCache that can store several values with the same key. This can be used to use multiple layers of the same size at the same time, without recreating them over and over again. Change-Id: I425466a20908b862c5f464a0f9e582ec18cbd7ac
* Add a layer (FBO) cache.Romain Guy2010-07-061-2/+2
| | | | | | | | | | | | | | The cache is used to draw layers so that a new texture does not have to be recreated every time a call to saveLayer() happens. The FBO cache used a KeyedVector, which is a bad idea. The cache should be able to store several FBOs of the same size (this happens a lot during scrolling with fading edges for instance.) This will be changed in a future CL. Change-Id: Ic316189e625f0dbcf0d273a71cc981a433d48726
* Remove extra leftover logs and use uint32_t instead of unsigned int.Romain Guy2010-07-021-6/+6
| | | | Change-Id: I944f82fe3255de38dc04048cc8bd861f578f01a7
* Track the size in memory of the texture cache.Romain Guy2010-07-011-3/+45
| | | | | | | | | The texture cache was previously checking the number of stored textures. This was not very useful as this could easily lead to an abuse of memory. The new cache instead tracks the total size occupied in RAM by the cached textures. When a new texture is generated, older textures are kicked out as needed. Change-Id: Ib27142f4a018d5bf84774c1fb6f45a67a85f20bc
* Remove unnecessary return and add bitmap generation ID tracking.Romain Guy2010-06-301-1/+1
| | | | Change-Id: Icf5e0635e789f5ea53268c22fad51cf733b5b1a6
* Fix the build.Romain Guy2010-06-301-1/+1
| | | | Change-Id: I08bd6daf25351daca3ae552e1cfcfce85eefa73b
* Add hooks for drawBitmap().Romain Guy2010-06-301-0/+48
Change-Id: I58e962c3a8b2bc75c2605fe369ad3002579d86e0 Add texture cache. Change-Id: I1c0e5581d228869e114438258a1014e33e024ad7