summaryrefslogtreecommitdiffstats
path: root/libs/hwui/OpenGLRenderer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge commit 'b873a17ce7be0a9771c24999adca6964431728f6' into HEADThe Android Open Source Project2013-11-221-327/+405
|\ | | | | | | Change-Id: I938755073e70602cc8f51ce9bd420fdcf870cecd
| * Correct bitmap merging logicChris Craik2013-09-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bug:10863163 This fixes two issues The check for pure translation was incorrect. It was fixed and renamed for clarity. Certain matrix paths weren't setting kTypePositiveScale. For simplicity (and because positive scale is simple to check) removed flag in favor of dynamic checking. Change-Id: Ic5ce235653ef49a68b8b242bd89fc2e95874ecc9
| * Conservatively estimate geometry boundsChris Craik2013-09-171-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | bug:10761696 Avoids a case where a rect with top coordinate of (e.g.) 0.51f is assumed to not draw in the first row of pixels, which leads to it not being clipped. Since rounding can cause it to render in this first pixel anyway, we very slightly expand geometry bounds. Now, in ambiguous cases, the geometry bounds are expanded so clipping is more likely to happen. Change-Id: I119b7c7720de07bac1634549724ffb63935567fc
| * Fix scissor for functor invocationJohn Reck2013-09-101-2/+4
| | | | | | | | | | | | | | | | | | | | | | Bug: 10677765 enableScissor() must precede setScissorFromClip() as otherwise setScissorFromClip() doesn't do anything. Also make sure to call setScissorFromClip() if enableScissor() returns true as enableScissor() calls resetScissor() if the scissor state has changed. Change-Id: I9226b20bb256c92066aae344e4e6407540b6eae9
| * Move functor GL setup to just before functorChris Craik2013-08-261-6/+9
| | | | | | | | | | | | | | | | | | bug:10399469 Because the stencil setup can issue draws, it *must* come before the GL state setup. Change-Id: I52a36213549fc60b091a90cbb923a1f0d35f9a65
| * Add overdraw debugging that accounts for DeuteranomalyRomain Guy2013-08-211-4/+12
| | | | | | | | Change-Id: I31f68a07aa7cf0490d2572e24e4c5ac2066a1151
| * Remove an unnecessary allocationRomain Guy2013-08-091-19/+0
| | | | | | | | | | | | Also remove dead code from OpenGLRenderer.cpp Change-Id: I7eb54ca19e77ee3c32f1fe9513a031e6b2e115cf (cherry picked from commit 5c7d5ab878b26f855175a3305a14ac12fcacf25e)
| * Merge "Fix quickReject's handling of AA ramp geometry"Chris Craik2013-08-021-7/+22
| |\
| | * Fix quickReject's handling of AA ramp geometryChris Craik2013-08-021-7/+22
| | | | | | | | | | | | | | | | | | | | | | | | By having quickReject round out the window-space geometry bounds, we prevent the AA perimeter (which falls outside the local bounds passed in) from drawing outside the clip. Change-Id: I8ee36be9039a9c47906815ee2f0dbaa5eb910b82
| * | Fix region clipping bugsRomain Guy2013-08-011-5/+9
| | | | | | | | | | | | | | | | | | See external bug #58344 Change-Id: Iecd6c41fc8076cd76add2335d3442a6dd8878f12
| * | Support RGBA fonts and bitmap fonts (and RGBA bitmap fonts)Victoria Lease2013-07-311-65/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Merge "Ensure glActiveTexture is cleaned up correctly on functor resume"Chris Craik2013-07-221-0/+1
| |\
| | * Ensure glActiveTexture is cleaned up correctly on functor resumeChris Craik2013-07-221-0/+1
| | | | | | | | | | | | Change-Id: I103d7d63b17289d599c2c08dcc442cfba9b8e51d
| * | Use global indices array to draw layersRomain Guy2013-07-221-22/+46
| |/ | | | | | | | | | | | | | | | | | | | | | | An array of indices local to a layer would only be necessary if we changed the way we resolve T-junctions. Since we only ever draw quads, let's just use the indices we use everywhere else. This change also uses the global indices array to render list of colored rectangles to save on the number of vertices generated CPU-side. Change-Id: Ia6d1970b0e9247805af5a114ca2a84b5d0b7c282
| * Support stencil-based clipping for functorsChris Craik2013-07-161-0/+1
| | | | | | | | | | bug:9070351 Change-Id: I1c54e1bea1b84b1619cce27b14f189b42cab7062
| * am 55e789db: am ed96349a: am 3d1b158e: Merge "Fix out of range ↵Romain Guy2013-06-281-6/+9
| |\ | | | | | | | | | | | | | | | | | | glCopyTexImage2D Bug #9425270" into jb-mr2-dev * commit '55e789dbc782be0dcaf1d4bae5f32e9e2f674152': Fix out of range glCopyTexImage2D Bug #9425270
| * | Track the atlas' generation IDRomain Guy2013-06-271-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug #9589379 If the atlas is terminated/reinitialized and a view does not invalidate in between it might end up using a stale AssetAtlas::Entry. This change is similar to how 9patch meshes are cached in DrawPatchOp: we simply track the generation ID of the cache to make sure we always use the latest data. Change-Id: Ib5abb3769d2ce0eabe9adc04e320ca27c422019e
| * | Initialize MergingDrawBatch clip with viewport boundsChris Craik2013-06-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows merged, clipped operations to behave correctly within a savelayer, even if the base viewport has a large offset. Additionally, disregard opaqueness when within a complexclip/savelayer, as the coverage can't be trusted. Change-Id: Ic908b82a4bb410bc7fac1b4295f4874ed166efc5
| * | Batch 9-patches in a single mesh whenever possibleRomain Guy2013-06-211-14/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change also fixes the way batched bitmaps were handled inside a layer. The layer is now correctly dirtied to minimize the amount of pixels to blend. Fix alpha, mode and opaque computations for DrawPatchOp. Change-Id: I1b6cd581c0f0db66c1002bb4fb1a9811e55bfa78
| * | Merge "Fix regression: TextureView.setAlpha() was ignored"Romain Guy2013-06-191-1/+1
| |\ \
| | * | Fix regression: TextureView.setAlpha() was ignoredRomain Guy2013-06-191-1/+1
| | | | | | | | | | | | | | | | Change-Id: I9f43eec0fe23a65dcc1cf9cd0ac1f5e8907786a7
| * | | Merge "Share Caches' index buffer with FontRenderer"Romain Guy2013-06-191-1/+1
| |\ \ \ | | |/ /
| | * | Share Caches' index buffer with FontRendererRomain Guy2013-06-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | | Merge "Better handle op size edge cases"Chris Craik2013-06-171-3/+3
| |\ \ \
| | * | | Better handle op size edge casesChris Craik2013-06-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bug:9464358 Previously, empty and unknown sized ops are assumed to fully cover their clip. This is now corrected such that empty sized ops are pre-rejected before defer. Additionally, unknown sized ops disable overdraw avoidance. Change-Id: Icf2ce24f98be5ea6299e24ffcf826790373564a1
| * | | | Merge "Cancel layer update when a layer is about to be destroyed Bug #9310706"Romain Guy2013-06-171-0/+12
| |\ \ \ \ | | | |/ / | | |/| |
| | * | | Cancel layer update when a layer is about to be destroyedRomain Guy2013-06-171-0/+12
| | |/ / | | | | | | | | | | | | | | | | | | | | Bug #9310706 Change-Id: I73eea6314c326f15a979617e3a05b525935f0d3f
| * | | Fix clip merging behaviorChris Craik2013-06-141-1/+1
| |/ / | | | | | | | | | | | | | | | | | | Previously, a new op with a clipped side could be added to a MergingDrawBatch without considering the batch's current bounds. Change-Id: I1b873ecf821bad7cda6630c3f311edd90ac5cc8c
| * | Fix various draw ops that may incorrectly not scissorChris Craik2013-06-131-35/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bug:8965976 Also consolidates quickReject scissor-ing and scissor-less paths. Renamed plain 'quickReject' method, as it has sideEffects beyond what the java and skia canvases do. Change-Id: I4bdf874d3c8f469d283eae1e71c5e7ea53d47016
| * | Merge "Restore buildLayer()'s old behavior; it's synchronous again Bug #9193833"Romain Guy2013-06-131-0/+14
| |\ \
| | * | Restore buildLayer()'s old behavior; it's synchronous againRomain Guy2013-06-121-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | Bug #9193833 Change-Id: I4ee07e65c0a8967f0b55da030ecaad6dfc46136f
| * | | Overdraw avoidance and merging of clipped opsChris Craik2013-06-121-20/+38
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bug:8951267 If an opaque op, or group of opaque ops covers the invalidate region, skip draw operations that precede it. Clipped operations may now be merged, but only if they share a clipRect - this is a very case for e.g. ListView, where all background elements may now be a part of the same MergingDrawBatch. It is this more aggressive merging that groups together clipped background elements in the ListView case, enabling the overdraw avoidance skipping the window background. Change-Id: Ib0961977e272c5ac37f59e4c67d828467422d259
| * | Avoid 9patch cache lookups when possibleRomain Guy2013-06-111-7/+12
| | | | | | | | | | | | | | | | | | | | | This optimization saves up to 0.3ms per frame on the Play Store's front page, on a Nexus 4 device. Change-Id: Iaa4ef33c6e3b37e175efd5b9eea9ef59b43f14f3
| * | Introduce Caches::bindTexture() to reduce glBindTexture callsRomain Guy2013-06-041-1/+2
| | | | | | | | | | | | Change-Id: Ic345422567c020c0a9035ff51dcf2ae2a1fc59f4
| * | Make sure atlas antries can correctly filter/wrap texturesRomain Guy2013-05-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The virtual textures would each have their own values for wrapping and filtering which could lead to conflict and/or extraneous GL commands being issued. Change-Id: I64cb59a03e598f46bf645bd1d30fccfa63a07431
| * | Merge "Merge scaled bitmaps with translated bitmaps"Romain Guy2013-05-221-2/+6
| |\ \
| | * | Merge scaled bitmaps with translated bitmapsRomain Guy2013-05-211-2/+6
| | | | | | | | | | | | | | | | Change-Id: I03089f48f97b69fcb4a0171984d3ff548d41c4a8
| * | | Use individual glyph positions to determine text bounds.Chris Craik2013-05-211-31/+10
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bug:8766924 Previously text bounds were calculated to be from 0 to totalAdvance in the X, and from the font's top to bottom. These are incorrect, especially in light of the font fallback mechanism. Now, we calculate the bounds of the text as we layout each glyph. Since these are much tighter bounds in the common case, this significantly reduces the amount of clipping required (which in turn enables more aggressive text merging). Change-Id: I172e5466bf5975bf837af894a9964c41db538746
| * | Add tessellation path for pointsChris Craik2013-05-141-65/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bug:4351353 bug:8185479 Point tessellation is similar to line special case, except that we only tessellate one point (as a circle or rect) and duplicate it across other instances. Additionally: Fixes square caps for AA=false lines Cleanup in CanvasCompare, disabling interpolation on zoomed-in comparison view Change-Id: I0756fcc4b20f77878fed0d8057297c80e82ed9dc
| * | am b90ff505: am fdf13c90: Merge "Convert alpha from [0..1] to [0.255] range ↵Romain Guy2013-05-061-1/+1
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | Bug #8808886" into jb-mr2-dev * commit 'b90ff505df143abd957cfc19b60727e3460ee68c': Convert alpha from [0..1] to [0.255] range Bug #8808886
| * | | Add an on-screen overdraw counterRomain Guy2013-05-031-2/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-40/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | | Avoid incorrectly dirtying the functor output rectChris Craik2013-04-221-2/+2
| | | | | | | | | | | | | | | | | | | | bug:8640186 Change-Id: I360cb85e59cfdd0b499561e92b81089341d07046
* | | | Update the layer's alpha value upon composition of the layerDigish Pandya2013-11-051-0/+6
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | Fixes: This patch makes sure that the layer's alpha value is up-to-date and does not reflect the previous view's alpha value. it fixes the square block on marquee fading edge when text view is applied transparency. Change-Id: I110649db72a75fecc02ba56c201a05773f80328c
* | | Fix out of range glCopyTexImage2DRomain Guy2013-06-271-6/+9
| |/ |/| | | | | | | | | | | | | | | Bug #9425270 A better solution would be to use glCopyTexImage2D whenever possible but this change would be a little more dangerous. Change-Id: Ib1aaceda39d838716285ef97f356721416822dbb
* | Convert alpha from [0..1] to [0.255] rangeRomain Guy2013-05-031-1/+1
|/ | | | | | | | | | Bug #8808886 Without this conversion, alpha was always set to 0 or 1 which causes things to disappear mysteriously. Mysteries are meant to be solved and I solved them all in 6 characters. Change-Id: I2078420fbe968c046e999b0eabb24403e71108fd
* Make layer double drawing visible in overdraw debug modeChris Craik2013-04-161-6/+29
| | | | | | | | | | | | | | | | | | A clipped saveLayer will cause two draws - first to an onscreen buffer, then again back to the framebuffer. This change - when in overdraw debug - reissues draws associated with a clipped saveLayer, but only to the stencil buffer. Operations within a saveLayer are shown correctly to be twice drawn, and View.setAlpha() without an associated hardware layer, or hasOverlappingRendering() are made more visible. Hardware layers, on any frame that they are updated, similarly draw twice, and will also be counted against the stencil buffer doubly. Note: greater depths of layers - e.g. a saveLayer within a saveLayer - are not respected, as that would require additional region tracking. Change-Id: I61fb0e61038fe66013d59914c20bb47a550dea7d
* Draw Operation mergingChris Craik2013-04-151-18/+75
| | | | | | | | | | | | | | | | | | Merge simple bitmap draw operations and text operations to avoid issuing individual gl draws for each operation. Merging other ops to be done eventually. The methods are different - the bitmap merging generates a single mesh for reused, unclipped images (esp. repeated images in a listview) The text approach queries just defers the normal font rendering until the last drawText in the sequence that can share the same shader. Patches are sorted and merged, but don't yet have a multiDraw implementation. For now, the pretending-to-merge gives better sorting behavior by keeping similar patches together. Change-Id: Ic300cdab0a53814cf7b09c58bf54b1bf0f58ccd6
* Introduce PixelBuffer API to enable PBOsRomain Guy2013-04-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | 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
* Fix Contacts animation jankChet Haase2013-04-101-4/+5
| | | | | | | | | | | | | | | | | | | | | The last frame of an animation stays stuck on the screen for a couple of frames. Specifically, the "Quick Contact" animation that animates the picture closed (fades/scales it away) animates all the way to the end... then hangs there briefly before being taken down. The problem is a rendering bug where we correctly detect that a DisplayList has nothing to draw (since the last frame is completely transparent, alpha==0), but incorrectly ignore the fact that we cleared the transparent-background window prior to not-drawing that DisplayList. When we detect that there's nothing to draw, we don't bother swapping buffers. So even though we drew the right thing (clearing the buffer), we didn't actually post the buffer to the screen. This change factors in both the clear and the draw to decide when to swap buffers. Issue #8564865 Quick contact close animation jank redux Change-Id: Ib922cff88a94f025b62f7461c1a29e96fe454838