summaryrefslogtreecommitdiffstats
path: root/libs/hwui/Caches.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* | Create private properties on GLCanvas for experimentation with 3dChris Craik2013-12-161-0/+32
| | | | | | | | Change-Id: I17772f61efce727cb4c1111f4d97f58c741786b8
* | Calculate and show Ambient shadow.ztenghui2013-12-131-2/+2
|/ | | | | | | | | Basically we compute the shadow as a strip of triangles, whose alpha value is the strength of the shadow. We use the normal to extend the geometry. And we use static function and try to avoid new/malloc in the computation. Change-Id: I382286f1cad351bd5ff983f76f446c075819dcaf
* Add overdraw debugging that accounts for DeuteranomalyRomain Guy2013-08-211-3/+18
| | | | Change-Id: I31f68a07aa7cf0490d2572e24e4c5ac2066a1151
* Fix hardware layers lifecycleRomain Guy2013-08-161-0/+2
| | | | | | | | Bug #10075732 Hardware layers could survive across EGL terminate events. Change-Id: Ie8565d55cb29fe6625fa1584d695edfecd37ab5e
* Prevent ANR in apps using drawPath()Romain Guy2013-08-161-1/+5
| | | | | | | | | Bug #10347089 If an app clears its path cache before stopping background tasks, it could get into an infinite loop in PathCache::trim(). Change-Id: Ieb865b762e7b00aebaba0c023769c2db286a94f5
* Clear FBO cache on full memory flushRomain Guy2013-08-161-0/+1
| | | | Change-Id: I44e06d5d15cd899a0522c62d7c0d042170665abb
* Support RGBA fonts and bitmap fonts (and RGBA bitmap fonts)Victoria Lease2013-07-311-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Quite a few things going on in this commit: - Enable bitmap strikes by default in Paint objects. The SkPaint parameter that enables bitmap strikes was not previously included in DEFAULT_PAINT_FLAGS. This effectively disabled bitmap fonts. Oops! It's for the best, though, as additional work was needed in Skia to make bitmap fonts work anyway. - Complain if TEXTURE_BORDER_SIZE is not 1. Our glyph cache code does not currently handle any value other than 1 here, including zero. I've added a little C preprocessor check to prevent future engineers (including especially future-me) from thinking that they can change this value without updating the related code. - Add GL_RGBA support to hwui's FontRenderer and friends This also happened to involve some refactoring for convenience and cleanliness. Bug: 9577689 Change-Id: I0abd1e5a0d6623106247fb6421787e2c2f2ea19c
* Ensure glActiveTexture is cleaned up correctly on functor resumeChris Craik2013-07-221-0/+4
| | | | Change-Id: I103d7d63b17289d599c2c08dcc442cfba9b8e51d
* Refcount 9-patches and properly handle GC eventsRomain Guy2013-06-261-0/+1
| | | | | | | | | | | | | | | | | 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
* Share Caches' index buffer with FontRendererRomain Guy2013-06-181-4/+4
| | | | | | | | | This reduces state changes when we draw 9patches and text together, which happens *a lot*. Also disable the NV profiling extension by default since it doesn't play nice with display lists deferrals. To enable it set debug.hwui.nv_profiling to true. Change-Id: I518b44b7d294e5def10c78911ceb9f01ae401609
* Add new Query class for debuggingRomain Guy2013-06-131-1/+1
| | | | | | | This class can be used to perform occlusion queries. An occlusion query can be used to test whether an object is entirely hidden or not. Change-Id: Ida456df81dbe008a64d3ff4cb7879340785c6abf
* Assume a texture is unbound after deleting itRomain Guy2013-06-061-0/+22
| | | | | | | | | | | Bug #9316260 The GL specification indicates that deleting a bound texture has the side effect of binding the default texture (name=0). This change replaces all calls to glDeleteTextures() by Caches::deleteTexture() to properly keep track of texture bindings. Change-Id: Ifbc60ef433e0f9776a668dd5bd5f0adbc65a77a0
* Introduce Caches::bindTexture() to reduce glBindTexture callsRomain Guy2013-06-041-1/+22
| | | | Change-Id: Ic345422567c020c0a9035ff51dcf2ae2a1fc59f4
* Enable GPU pixel buffers on OpenGL ES 3.0 devicesRomain Guy2013-06-041-0/+13
| | | | Change-Id: I164d72ccd7a9bf6ae0e3f79dfef50083558937ba
* Add an on-screen overdraw counterRomain Guy2013-05-031-1/+1
| | | | | | | | | The counter can be enabled by setting the system property called debug.hwui.overdraw to the string "count". If the string is set to "show", overdraw will be highlighted on screen instead of printing out a simple counter. Change-Id: I9a9c970d54bffab43138bbb7682f6c04bc2c40bd
* Pack preloaded framework assets in a texture atlasRomain Guy2013-05-021-26/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the Android runtime starts, the system preloads a series of assets in the Zygote process. These assets are shared across all processes. Unfortunately, each one of these assets is later uploaded in its own OpenGL texture, once per process. This wastes memory and generates unnecessary OpenGL state changes. This CL introduces an asset server that provides an atlas to all processes. Note: bitmaps used by skia shaders are *not* sampled from the atlas. It's an uncommon use case and would require extra texture transforms in the GL shaders. WHAT IS THE ASSETS ATLAS The "assets atlas" is a single, shareable graphic buffer that contains all the system's preloaded bitmap drawables (this includes 9-patches.) The atlas is made of two distinct objects: the graphic buffer that contains the actual pixels and the map which indicates where each preloaded bitmap can be found in the atlas (essentially a pair of x and y coordinates.) HOW IS THE ASSETS ATLAS GENERATED Because we need to support a wide variety of devices and because it is easy to change the list of preloaded drawables, the atlas is generated at runtime, during the startup phase of the system process. There are several steps that lead to the atlas generation: 1. If the device is booting for the first time, or if the device was updated, we need to find the best atlas configuration. To do so, the atlas service tries a number of width, height and algorithm variations that allows us to pack as many assets as possible while using as little memory as possible. Once a best configuration is found, it gets written to disk in /data/system/framework_atlas 2. Given a best configuration (algorithm variant, dimensions and number of bitmaps that can be packed in the atlas), the atlas service packs all the preloaded bitmaps into a single graphic buffer object. 3. The packing is done using Skia in a temporary native bitmap. The Skia bitmap is then copied into the graphic buffer using OpenGL ES to benefit from texture swizzling. HOW PROCESSES USE THE ATLAS Whenever a process' hardware renderer initializes its EGL context, it queries the atlas service for the graphic buffer and the map. It is important to remember that both the context and the map will be valid for the lifetime of the hardware renderer (if the system process goes down, all apps get killed as well.) Every time the hardware renderer needs to render a bitmap, it first checks whether the bitmap can be found in the assets atlas. When the bitmap is part of the atlas, texture coordinates are remapped appropriately before rendering. Change-Id: I8eaecf53e7f6a33d90da3d0047c5ceec89ea3af0
* Introduce PixelBuffer API to enable PBOsRomain Guy2013-04-111-0/+23
| | | | | | | | | | | | | | | | | | | | | | | PBOs (Pixel Buffer Objects) can be used on OpenGL ES 3.0 to perform asynchronous texture uploads to free up the CPU. This change does not enable the use of PBOs unless a specific property is set (Adreno drivers have issues with PBOs at the moment, Mali drivers work just fine.) This change also cleans up Font/FontRenderer a little bit and improves performance of drop shadows generations by using memcpy() instead of a manual byte-by-byte copy. On GL ES 2.0 devices, or when PBOs are disabled, a PixelBuffer instance behaves like a simple byte array. The extra APIs introduced for PBOs (map/unmap and bind/unbind) are pretty much no-ops for CPU pixel buffers and won't introduce any significant overhead. This change also fixes a bug with text drop shadows: if the drop shadow is larger than the max texture size, the renderer would leave the GL context in a bad state and generate 0x501 errors. This change simply skips drop shadows if they are too large. Change-Id: I2700aadb0c6093431dc5dee3d587d689190c4e23
* Stop worker threads on memory trim & fix bad pointer accessRomain Guy2013-03-201-0/+1
| | | | Change-Id: I6fe7e31aeb6dd41fa65ab952caed97bc2da510d7
* Merge all shapes/paths caches to PathCacheRomain Guy2013-03-181-20/+0
| | | | | | | | | This change will greatly simplify the multi-threading of all shape types. This change also uses PathTessellator to render convex paths. Change-Id: I4e65bc95c9d24ecae2183b72204de5c2dfb6ada4
* Fully deferred displaylist replayChris Craik2013-03-151-7/+2
| | | | | | | | | | | | | | | | | | 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
* Precache glyphs at final raster sizeRomain Guy2013-03-011-4/+24
| | | | | | | | | | 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
* Add new property to debug non-rectangular clip operationsRomain Guy2013-02-251-1/+18
| | | | | | | | | | | | | This change adds a new property called "debug.hwui.show_stencil_clip" that accepts the following values: - "highlight", colorizes in green any drawing command that's tested against a non-rectangular clip region - "region", shows the non-rectangular clip region in blue every time it is used - "hide", default value, nothing is shown Change-Id: I83c8602310edc4aaeb8b905371cdd185b17d32b5
* Implement support for drawBitmapMesh's colors arrayRomain Guy2013-02-131-4/+5
| | | | Change-Id: I3d901f6267c2918771ac30ff55c8d80c3ab5b725
* Add a render buffer cache to reuse stencil buffersRomain Guy2013-02-131-0/+4
| | | | | | | | | | Bug #7146141 This new cache is used in a similar way to LayerCache. It helps reuse already allocated stencil buffers and thus avoid churning memory on every frame. Change-Id: I19551d72da52c40039e65904563600e492c8b193
* Add a RenderBuffer object to store stencil buffers.Romain Guy2013-02-071-5/+5
| | | | | | | | | | | | | | | | | | Bug #7146141 This change is needed to add a render buffer cache to avoid creating and destroying stencil buffers on every frame. This change also allows the renderer to use a 1 bit or 4 bit stencil buffer whenever possible. Finally this change fixes a bug introduced by a previous CL which causes the stencil buffer to not be updated in certain conditions. The fix relies on a new optional parameter in drawColorRects() that can be used to avoid performing a quickReject on rectangles generated by the clip region. Change-Id: I2f55a8e807009887b276a83cde9f53fd5c01199f
* Fix uninitialized variables in Caches.cppRomain Guy2013-02-061-0/+3
| | | | | | Bug #8151401 Change-Id: I221f93de0f1981974f82a094297836dd3fe418bc
* Fix tiling on QCOM GPURomain Guy2013-01-311-2/+2
| | | | | | | | Rename Caches::startTiling parameter from opaque to discard to make it clearer what its role is. Tweak calls to startTiling to preserve the buffer when needed and discard it when possible. Change-Id: If7f8ff19003f79f36885a0a7207cc61901f637d2
* Apply dev. settings at runtimeRomain Guy2012-11-301-1/+7
| | | | | | Bug #7434649 Change-Id: I16f00eaa8a5eefd9f9849e196cf2cb1659215390
* Correctly adjust clip regions that lie offscreenChet Haase2012-10-161-3/+14
| | | | | | | | | | We were clamping the x/y location of the scissor to 0,0, but not adjusting the width/height appropriately. This fix adjusts width/height and also clamps them to 0 to correctly clip out offscreen operations. Issue #7221524 Top left and top right portions of the screen blanks out after some time Change-Id: I47f23336ea612409ed86652b9a68e272819ef00e
* Work around a possible driver bugRomain Guy2012-10-071-0/+1
| | | | | | | | | | Bug #7296475 When re-enabling the scissor the driver seems to ignore the already existing scissor box. This change resets the scissor box when the test state changes. Change-Id: I3a68433164f99d21fbab769a26c56fe416c1539a
* Fix texture corruptionChet Haase2012-09-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | When memory gets low on a device, activities flush everything they can. Hardware-accelerated activites, such as Launcher, flush GL resources and destroy the GL context. However, some resources were still hanging around, due to deferred destruction policies (we don't delete layers until the DisplayLists they are in are finalized, to ensure we don't deref deleted objects). This meant that we were referring to obsolete GL data in these objects. in particular, it meant that we might come around later, after a new GL context was created, and delete a texture object that was incorrect. We use the layer's "texture id" to refer to the texture underlying the layer. But if there's a new GL context, then this texture ID is no longer valid, and we may be deleting the texture that a different object (layer, icon, whatever) is referring to, because the driver may return that same ID under the new GL context. The fix is to more aggressively delete things that we know will not be used again when the GL context is destroyed. In particular, we delete all resources being used by all DisplayLists at GL context destruction time. Issue #7195815 Textures corruption on all devices, in many apps Change-Id: I52d2d208173690dbb794a83402d38f14ea4c6c22
* Merge changes I9873540e,I4f6c38e3 into jb-mr1-devRomain Guy2012-09-271-0/+18
|\ | | | | | | | | | | * changes: Skia's ColorMatrix vector is in the 0..255 range not 0..1 Bug #7248980 Don't use the QCOM_tiled_rendering extension with functors Bug #7247880
| * Don't use the QCOM_tiled_rendering extension with functorsRomain Guy2012-09-271-0/+18
| | | | | | | | | | | | Bug #7247880 Change-Id: I4f6c38e37b953c58e6107097c613891a49dac766
* | Add stroke support to polygonal shape renderingChris Craik2012-09-261-3/+7
|/ | | | | | | | | | | | bug:4419017 bug:7230005 - Adds support for stroke/strokeAndFill for shapes without joins - Fixes path-polygonization threshold calculation - Fixes rendering offset (now only used for points) - Several formatting fixes Change-Id: If72473dc881e45752e2ec212d0dcd1e3f97979ea
* fix a possible dead-lock when clearing cachesMathias Agopian2012-09-251-9/+17
| | | | | Bug: 7195815 Change-Id: I8e226b7ec445f9f4fe46ae216ef7cc41efc5a0fd
* make sure to destroy GL objects on the GL threadMathias Agopian2012-09-251-1/+1
| | | | | Bug: 7195815 Change-Id: I5bcac61cd0b903d1ccca0754fdb9cb1023efbe0f
* Fix overdraw debug on QCOMRomain Guy2012-09-231-5/+3
| | | | | | | Disable the use of the tiling extension when overdraw debug is turned on. Change-Id: Ib0a0b7d1998146aa0c7efef2d3822f9997efb123
* Add support for a new developer setting: overdraw debuggingRomain Guy2012-09-211-1/+10
| | | | Change-Id: I350ba4486577c3289f82c20938f7a35138778727
* Optimize tiling managementRomain Guy2012-09-201-1/+1
| | | | | | Bug #7186819 Change-Id: Iebc42a6e9c96ad5605fbbe1539aa887695d2e829
* Add support for QCOM_tiled_renderingRomain Guy2012-09-191-2/+2
| | | | | | | | | Bug #7186819 This optional OpenGL extension can be used by tiled renderers to optimize copies from main memory to tiles memory. Change-Id: Id4a5d64e61ad17f50e773e8104b9bf584bb65077
* Minimize state changes when updating layersRomain Guy2012-09-181-0/+3
| | | | Change-Id: I407fcc80bd3178f9f09a3b379ceb7f7ce0749e08
* Foundation for tiling optimizationRomain Guy2012-09-131-0/+28
| | | | Change-Id: I4db32a4749f196472ba0dde7e102439d2ba4a3a7
* Add new debug tool to track hardware layers updatesRomain Guy2012-08-061-4/+11
| | | | | | | | You can setprop debug.hwui.show_layers_updates true to flash hw layers in green when they update. This is also a setting in the Dev. section of the settings app. Change-Id: Ibe1d63a4f81567dc1d590c9b088d2e7505df8abf
* Add dithering to gradientsRomain Guy2012-08-011-0/+1
| | | | Change-Id: Ic1208855bde3a254eca2fd7cef43e0f1318ce419
* Don't clear the dirty clip flag if it's not appliedRomain Guy2012-07-171-3/+10
| | | | | | Bug #6833979 Change-Id: I0ea78b7f31a557a335de10d910d03b0520029080
* Refactor GammaFontRendererRomain Guy2012-07-131-6/+12
| | | | | | | This change is the first step to a shader-based text antialias gamma correction. Change-Id: I9eb02d4c56cb95d05219f712290c865b46141954
* Improve rendering speed by disabling scissor testsRomain Guy2012-07-131-1/+26
| | | | | | | | | | | | This change improves execution of display lists, particularly on tiled renderers. The goal is to disable the scissor test as often as possible. Drawing commands are rarely clipped by View bounds so most of them can be drawn without doing a scissor test. The speed improvements scale with the number of views and drawing commands. Change-Id: Ibd9b5e051a3e4300562463805acc4fd744ba6266
* Add call sites for OpenGL's debug label extensionRomain Guy2012-05-121-18/+32
| | | | Change-Id: I9c689127e8166cbef92c935f8aa07217ab806dda
* Delete display list objects and resources on the UI threadRomain Guy2012-03-051-0/+13
| | | | | | | | | | | | | | Bug #6073717 Bug #6065504 Bug #6026515 Bug #5971725 Prior to this patch, the destructor of DisplayList would always run on the finalizer thread. This could cause a race condition if the UI thread was busy rendering display lists at the same time leading to various random native crashes. Change-Id: Ie11108e3b1538d4b358a1a8b4cce1b2d33152d0c
* Add debug markers to OpenGLRendererRomain Guy2012-01-301-0/+10
| | | | | | | | These markers will be used to group the GL commands by View in the OpenGL ES debugging tool. This will help correlate individual GL calls to higher level components like Views. Change-Id: I73607ba2e7224a80ac32527968261ee008f049c6