summaryrefslogtreecommitdiffstats
path: root/libs/hwui/Caches.h
Commit message (Collapse)AuthorAgeFilesLines
* Use pre-computed index to draw the shadow.ztenghui2014-02-251-2/+5
| | | | | | | | Also draw the umbra part as triangle fans instead of zig zag fashion. b/12840179 Change-Id: Iaa5d15e77351acdd71f076bd8f9bb2d4d2b92faf
* Separate spot and ambient shadow strength settingztenghui2014-02-131-1/+2
| | | | Change-Id: I4530e618b09a7f44b5382f8a40646c0ebf5f214c
* Property support for light positioning.ztenghui2014-01-171-0/+8
| | | | | | Tune up the light size to make it look better. Change-Id: I139a05f3dd53dacbe55759b91188f0e1cc2c7f80
* Create private properties on GLCanvas for experimentation with 3dChris Craik2013-12-161-0/+8
| | | | Change-Id: I17772f61efce727cb4c1111f4d97f58c741786b8
* Calculate and show Ambient shadow.ztenghui2013-12-131-4/+4
| | | | | | | | | 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
* am dfb79408: am 5b8efc47: Merge "Add overdraw debugging that accounts for ↵Romain Guy2013-08-211-0/+13
|\ | | | | | | | | | | | | Deuteranomaly" into klp-dev * commit 'dfb79408892b3f168204c54a9b81d813921fb0f9': Add overdraw debugging that accounts for Deuteranomaly
| * Add overdraw debugging that accounts for DeuteranomalyRomain Guy2013-08-211-0/+13
| | | | | | | | Change-Id: I31f68a07aa7cf0490d2572e24e4c5ac2066a1151
* | Replace float arrays with readable namesRomain Guy2013-08-151-1/+1
|/ | | | Change-Id: I32a8be560b60a4ac5cbee2fec4574b2c5df9f825
* Ensure glActiveTexture is cleaned up correctly on functor resumeChris Craik2013-07-221-0/+5
| | | | Change-Id: I103d7d63b17289d599c2c08dcc442cfba9b8e51d
* Share Caches' index buffer with FontRendererRomain Guy2013-06-181-2/+3
| | | | | | | | | 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
* Assume a texture is unbound after deleting itRomain Guy2013-06-061-1/+12
| | | | | | | | | | | 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-0/+20
| | | | Change-Id: Ic345422567c020c0a9035ff51dcf2ae2a1fc59f4
* Enable GPU pixel buffers on OpenGL ES 3.0 devicesRomain Guy2013-06-041-0/+3
| | | | Change-Id: I164d72ccd7a9bf6ae0e3f79dfef50083558937ba
* Pack preloaded framework assets in a texture atlasRomain Guy2013-05-021-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+11
| | | | | | | | | | | | | | | | | | | | | | | 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
* Merge all shapes/paths caches to PathCacheRomain Guy2013-03-181-6/+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
* Add TaskManager APIRomain Guy2013-03-121-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This API can be used to run arbitrary tasks on a pool of worker threads. The number of threads is calculated based on the number of CPU cores available. The API is made of 3 classes: TaskManager Creates and manages the worker threads. Task Describes the work to be done and the type of the output. A task contains a future used to wait for the worker thread to be done computing the result of the task. TaskProcessor The processor dispatches tasks to the TaskManager and is responsible for performing the computation required by each task. A processor will only be asked to process tasks sent to the manager through the processor. A typical use case: class MyTask: Task<MyType> class MyProcessor: TaskProcessor<MyType> TaskManager m = new TaskManager(); MyProcessor p = new MyProcessor(m); MyTask t = new MyTask(); p.add(t); // Waits until the result is available MyType result = t->getResult(); Change-Id: I1fe845ba4c49bb0e1b0627ab147f9a861c8e0749
* Precache glyphs at final raster sizeRomain Guy2013-03-011-0/+3
| | | | | | | | | | 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-0/+9
| | | | | | | | | | | | | 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-2/+3
| | | | Change-Id: I3d901f6267c2918771ac30ff55c8d80c3ab5b725
* Add a render buffer cache to reuse stencil buffersRomain Guy2013-02-131-0/+2
| | | | | | | | | | 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
* Merge "Add a RenderBuffer object to store stencil buffers. Bug #7146141"Romain Guy2013-02-071-4/+2
|\
| * Add a RenderBuffer object to store stencil buffers.Romain Guy2013-02-071-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Add cap tessellation support"Chris Craik2013-02-071-1/+0
|\ \ | |/ |/|
| * Add cap tessellation supportChris Craik2013-02-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | bug:7117155 bug:8114304 Currently used for lines (with and without AA) and arcs with useCenter=false Also removes 0.375, 0.375 offset for AA lines Change-Id: Ic8ace418739344db1e2814edf65253fe7448b0b0
* | Tag HardwareRenderers with a name to help debuggingRomain Guy2013-01-311-1/+1
| | | | | | | | | | | | The name of the renderer is the same as the window it belongs to. Change-Id: Ie9adc0a1978afa026923ea41f5540eda6ba65a92
* | Fix tiling on QCOM GPURomain Guy2013-01-311-1/+1
|/ | | | | | | | 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
* Implement clipRect with a transform, clipRegion & clipPathRomain Guy2013-01-171-2/+0
| | | | | | | | | | | | | | | | | | | | | Bug #7146141 When non-rectangular clipping occurs in a layer the render buffer used as the stencil buffer is not cached. If this happens on a View's hardware layer the render buffer will live for as long as the layer is bound to the view. When a stencil buffer is required because of a call to Canvas.saveLayer() it will be allocated on every frame. A future change will address this problem. If "show GPU overdraw" is enabled, non-rectangular clips are not supported anymore and we fall back to rectangular clips instead. This is a limitation imposed by OpenGL ES that cannot be worked around at this time. This change also improves the Matrix4 implementation to easily detect when a rect remains a rect after transform. Change-Id: I0e69fb901792d38bc0c4ca1bf9fdb02d7db415b9
* Apply dev. settings at runtimeRomain Guy2012-11-301-1/+5
| | | | | | Bug #7434649 Change-Id: I16f00eaa8a5eefd9f9849e196cf2cb1659215390
* Merge changes I9873540e,I4f6c38e3 into jb-mr1-devRomain Guy2012-09-271-0/+6
|\ | | | | | | | | | | * 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/+6
| | | | | | | | | | | | Bug #7247880 Change-Id: I4f6c38e37b953c58e6107097c613891a49dac766
* | Fix rectangle AA offset calculationChris Craik2012-09-271-1/+1
| | | | | | | | | | | | | | | | | | | | bug:4419017 Fixes compiler warning Handle bezier thresholds with large stroke widths better Fix sub-hairlines (for scaleX == scaleY) Change-Id: Ida387483348ee61424b7fba729abca2a88bd68b3
* | Add stroke support to polygonal shape renderingChris Craik2012-09-261-3/+3
|/ | | | | | | | | | | | 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
* Add support for a new developer setting: overdraw debuggingRomain Guy2012-09-211-0/+1
| | | | Change-Id: I350ba4486577c3289f82c20938f7a35138778727
* Foundation for tiling optimizationRomain Guy2012-09-131-0/+3
| | | | Change-Id: I4db32a4749f196472ba0dde7e102439d2ba4a3a7
* Merge "Varying-based AA rect drawing" into jb-mr1-devChris Craik2012-09-061-0/+1
|\
| * Varying-based AA rect drawingChris Craik2012-09-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Instead of calculating opacity from relative position in the shader, use a shader varying to do this computation for us. bug:5045101 Also adds a test to HwAccelerationTest to show incorrect antialiasing in scaled drawAARect / boundarySize calculation. Change-Id: Icdc41acb01dc10ce354834f8389a5aed2f439162
* | Revert "Revert "Add more support for transformed clip rects and paths""Romain Guy2012-08-311-1/+6
| | | | | | | | | | | | This reverts commit a8557d2169e14997637f57bc897640c8882d4a46. Change-Id: I36d4883d548fc47ba6c0b4a42012107d0d2f85a6
* | Revert "Add more support for transformed clip rects and paths"Mathias Agopian2012-08-311-6/+1
| | | | | | | | | | | | | | | | | | this introduced a dead lock in GradientCache's ctor. This reverts commit dfe082f63e94cde9aee271c94d13de5e7217e036. Bug: 7096001 Change-Id: I57b8bbab11fb7cb502fa58e3bbf5d19864db874f
* | Add more support for transformed clip rects and pathsRomain Guy2012-08-311-1/+6
|/ | | | Change-Id: I41791b1e1bffef77d503dc9e52428395d2309688
* Add new debug tool to track hardware layers updatesRomain Guy2012-08-061-0/+2
| | | | | | | | 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/+2
| | | | Change-Id: Ic1208855bde3a254eca2fd7cef43e0f1318ce419
* Don't clear the dirty clip flag if it's not appliedRomain Guy2012-07-171-3/+3
| | | | | | Bug #6833979 Change-Id: I0ea78b7f31a557a335de10d910d03b0520029080
* Refactor GammaFontRendererRomain Guy2012-07-131-1/+3
| | | | | | | 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-0/+5
| | | | | | | | | | | | 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-3/+18
| | | | Change-Id: I9c689127e8166cbef92c935f8aa07217ab806dda
* Delete display list objects and resources on the UI threadRomain Guy2012-03-051-0/+8
| | | | | | | | | | | | | | 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/+8
| | | | | | | | 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
* Properly restore the GL scissor after a GL draw functorRomain Guy2012-01-031-0/+5
| | | | | | Bug #5781254 Change-Id: I1dc4809563a793b6b579814951d4d73b4c34bf32
* Generate even fewer GL commandsRomain Guy2011-12-141-0/+10
| | | | Change-Id: I0f4dcacb03ef5ee7f6ebd501df98bfead5f0a7f8