summaryrefslogtreecommitdiff
path: root/libs/hwui/renderstate
AgeCommit message (Collapse)Author
2020-01-10Add memory tracing in HWUIStan Iliev
Add ATRACE memory counters to track memory usage at the end of each frame in HWUI. There are 3 catagories: CPU, GPU and Texture memory. There are 3 more counters for memory that can be purged. This CL deletes GpuMemoryTracker class, which implemented similar function for Android O HWUI renderer. Test: Collected systrace with gmail and setting. Test: memory tracing adds ~0.1ms per frame when ATRACE is enabled Bug: 146580770 Change-Id: Icbcc0478bc426dff578e83726fe7c95df171ed93
2018-09-20Refactor RenderState and remove unused functionality.Derek Sollenberger
Test: hwui_unit_tests still pass Change-Id: Ie943671535ab8c5da1bac05985e815e0cb842dc1
2018-09-20Fix crash when EGLSurface is no longer valid.Derek Sollenberger
The EGLSurface stored in the pipeline can become obsolete if the EglManager/RenderThread has to destroy the context. This CL enables the RenderThread to notify all active pipelines that their surface is invalid. Bug: 115290937 Test: hwui_unit_tests Change-Id: Ib3054822273bc35406630b7442229a81b39a2c91
2018-09-05Reland "TextureView Vulkan support and optimized OpenGL draw"Stan Iliev
Fix an issue with incorrect texture matrix, when there is 90/270 rotation. This happened, because after refactoring SkImage has buffer width/height, instead of layer width/height. This reverts commit a683eb3945320f592f58705c3c31b3c044f4bd72. Bug: 113673613 Test: Ran TextureView CTS and lensblur in camera app Change-Id: If3bcf9cd5195de09fd67a753708568a8e3ca3a9a
2018-09-04Revert "Revert "Revert "TextureView Vulkan support and optimized OpenGL draw"""Stan Iliev
This reverts commit 85f9096b5272c9a39e592e2e97cbbe6cb0e767ab. Reason for revert: lensblur broken. Change-Id: I83ac163159fc537bc15936a0f8597a7512ca9d6e
2018-08-31Revert "Revert "TextureView Vulkan support and optimized OpenGL draw""Stan Iliev
This reverts commit 867c43de0544217d26c3ee18f4d6603bb2ea97ce. Reason for revert: Fixed issue with unsupported hardware buffer formats by landing https://skia-review.googlesource.com/c/skia/+/150470 "Support more hardware buffer formats" Bug: 113673613 Change-Id: I1f7c528f138e290160e75833c8d989d9535002ee
2018-08-30Revert "TextureView Vulkan support and optimized OpenGL draw"John Reck
This reverts commit c8e22a653297837da9a80b0ba65f6854c8986c96. Reason for revert: broke camera, b/113555199 Bug: 113555199 Change-Id: Iae9b462694d5de0cd99427afead63b567fb4d71d
2018-08-29TextureView Vulkan support and optimized OpenGL drawStan Iliev
Render TextureView as hardware bitmaps, instead of GL textures. Cache SkImage for each observed GraphicBuffer, which is faster even for GL. Implement C++ SurfaceTexture, which allows Java SurfaceTexture to be used with Vulkan HWUI render thread and application GL. threads. Delete GLLayer and VkLayer classes and texture code from old HWUI pipeline. Test: Ran skiagl and skiavk pipeline with a TextureView app. Test: TextureView CTS tests pass for GL pipeline. Test: Ran Android NDK Native codec sample app. Change-Id: Idc94f864ce2d34fd6ceff4be4fc7d3327e99879c
2018-05-30Remove dead codeJohn Reck
Test: builds Change-Id: I57cf72ca460115463d7759097d5ba598b5ec1775
2018-05-08remove obsolete Glop, Tessellators, Programs, and SkiaShaderMike Reed
Test: make Change-Id: I92f36335830dfc37be72468546637d9986f0baf1
2018-05-04remove BakedOps and much of renderstateMike Reed
Test: make Change-Id: If070b7436b848c6840abfac5f051b0f5b6cb17ce
2018-05-04Merge "remove shadow related references"android-build-team Robot
2018-05-04remove shadow related referencesMike Reed
Test: make Change-Id: I1fc387ee442ca9120ff4f80248cc2395e93128f6
2018-05-03Delete a bunch of codeJohn Reck
This removes the duality of DisplayList, removing a small amount of overhead Test: buids & hwuiunit passes Change-Id: I8bb3a20e9ead1caec4b4a8a3e9f2c08f717a7096
2018-05-03remove (dead) caches from hwuiMike Reed
Test: make Change-Id: I18bfe51896672272ce7d471eaead69b651399368
2017-11-03Format the world (or just HWUI)John Reck
Test: No code changes, just ran through clang-format Change-Id: Id23aa4ec7eebc0446fe3a30260f33e7fd455bb8c
2017-10-27Switch to a fancy new queueJohn Reck
Test: unit tests & benchmarks pass/faster Change-Id: I9521432172d6dd6039c5280b1265479a36a86247
2017-10-25Don't clear a layerPool that is never initialized.Derek Sollenberger
Test: device now boots in Vulkan without crash Change-Id: Ib0a3d8253a49fbcdb75e9f4edda0c32d06903669
2017-09-01Add test for first draw blend behavior in HWUI pipelineChris Craik
Bug: 65077146 Test: BakedOpRendererTests Change-Id: Ia3139a01fe25344a19f2b947069bd686303b9fd5
2017-08-18Disable hwui blending for first draw to main FBOArun
bug:34809371 In some applications, the first draw is not opaque - either because the application is misbehaved, or because hwui is not able to reliably tell whether the layer is opaque or translucent. This is undefined behaviour in OpenGL ES and has a significant performance and bandwidth impact on some tiler GPUs as it requires loading the previous frame's color data. This change disables blending in that case and also for effectively opaque blend modes (SRC=GL_ONE, DST=GL_ZERO). It increases performance by ~10% for Leanback CTS on some low-end GPUs (gradient layer that hwui incorrectly believes to be translucent). Test: manual - visual inspection on fugu (nexus player) Change-Id: I2cbf1c76678acae1a36923e72fd18ed55cd89dc2
2017-08-10Delete all ro.hwui.* propsJohn Reck
Remove all ro.hwui.* tuning props and instead calculate them from the screen resolution. Or just hardcode them to what all devices were hardcoding them to anyway. Bug: 63741221 Test: Check cache size results on sailfish Change-Id: I8b0d210572a246f4fefb076935cf5156a70c274c Merged-In: I8b0d210572a246f4fefb076935cf5156a70c274c (cherry picked from commit 8dc02f99d09130ace2ee738c2e689db1b3f33181)
2017-07-18Fix use-after-freeGeorge Burgess IV
Since putOrDelete may delete the layer, we shouldn't be accessing its member after calling it. Caught by the static analyzer: frameworks/base/libs/hwui/renderstate/OffscreenBufferPool.cpp:183:44: warning: Use of memory after it is freed Bug: 27101951 Test: mma. Static analyzer warning is gone. Change-Id: I25ee8b45ede608da52bf58d1d9f52ce3bb60d4cb
2017-06-14Use RGBA16F layers when wide color gamut rendering is onRomain Guy
Layers created using View.setLayerType() or Canvas.saveLayer() need to be RGBA16F/scRGB-nl when within a window that requested wide color gamut rendering. Bug: 29940137 Test: CtsUiRenderingTestCases, CtsGraphicsTestCases, hwui_unit_tests Change-Id: I42fd6355448c92041491a7109e3ac8a153d38bf9
2017-06-06Implement CacheManager for the Skia pipelines.Derek Sollenberger
The core of the implementation is complete and provides heuristic cache sizing based on the size of the surface being used. This CL will also be used to add the following features in the future... 1) Support Vulkan pipeline reporting on the size of the surface. 2) Complete the VectorDrawableAtlas stub code 3) Automatic purging of stale resources for low memory devices. Test: hwui_unit_tests (new test added) and CtsUiRendering Bug: 62260637 Change-Id: Ib85159cca28b646fe249f2190b07f1b7e0f50d8f
2017-06-01Merge "Optimised hwui rounded corners shader" am: d7287c96eb am: ed7bdd6549Arun
am: 92ef0a59f8 Change-Id: I9f5e6ef057ba6049804226d65f2f2f06594efc69
2017-06-01Optimised hwui rounded corners shaderArun
This is a ~2x performance increase for the rounded corners shader which was previously shader limited even on many high-end GPUs. It simplifies the calculations by pre-dividing by the radius, which also allows to maintain mediump/FP16 precision (this improves performance and might improve image quality on GPUs that don't support highp e.g. Mali-400). It also uses a conditional in the shader to save much of the work on the vast majority of pixels which are not close to the corners. Test: manual - visual inspection on fugu (nexus player) Change-Id: I38f491cfb006e2991ef0b9d6b3d67d2c4d328d44
2017-05-24Merge "Fix null deref crash" into oc-devJohn Reck
am: c1affe14c2 Change-Id: Ib8e4c34fb38400dc748b463c5ab965d57e260fd0
2017-05-23Fix null deref crashJohn Reck
Change-Id: Ic1a64e926b5faa2f4cf8d079a2b67e0261dcecd7 Fixes: 62035692 Test: manual
2017-05-23Merge "Improve time to texture destruction" into oc-devJohn Reck
am: 1bc0286ef8 Change-Id: I93daab53961a018a2cf8d4e2d4d8300b84bb917e
2017-05-22Improve time to texture destructionJohn Reck
Eliminate textureCache.mGarbage which is only cleared in a trimMemory. Instead when we hit ~Bitmap post a message to RenderThread to release the texture immediately Bug: 38258699 Test: manual Change-Id: I962ba275e89afb628ba02f74769287edbab9fed4
2017-05-05Merge "Reduce hwui CPU time by using glDrawRangeElements" am: 057c7c3164 am: ↵Arun
94f4f5e45f am: b5facc7516 Change-Id: I9e96bf83ae5ebd4237fc4d78a58e83793de86aad
2017-05-05Reduce hwui CPU time by using glDrawRangeElementsArun
The CPU overhead of glDrawElements in the GPU driver is significant with client-side vertex data (unique per draw call) as the driver has to calculate the mininimum and maximum indices from the index buffer in order to evaluate the range of vertex data required. This can be avoided by keeping track of the min-max in hwui and passing it with glDrawRangeElements. This requires OpenGL ES3.0 support (which is already checked for elsewhere in hwui). Test: manual - visual inspection on fugu (nexus player) Change-Id: I57bb1ddd239a1032f74f1cd2683bbe0970e84bd9
2017-03-28Convert bitmaps to sRGB/scRGB when they have a color profileRomain Guy
This change also fixes an issue with RGBA16F bitmaps when modulated with a color (for instance by setting an alpha on the Paint object). The color space conversion is currently done entirely in the shader, by doing these operations in order: 1. Sample the texture 2. Un-premultiply alpha 3. Apply the EOTF 4. Multiply by the 3x3 color space matrix 5. Apply the OETF 6. Premultiply alpha Optimizations: - Steps 2 & 6 are skipped for opaque (common) bitmaps - Step 3 is skipped when the color space's EOTF is close to sRGB (Display P3 for instance). Instead, we use a hardware sRGB fetch (when the GPU supports it) - When step 3 is necessary, we use one of four standard EOTF implementations, to save cycles when possible: + Linear (doesn't do anything) + Full parametric (ICC parametric curve type 4 as defined in ICC.1:2004-10, section 10.15) + Limited parametric (ICC parametric curve type 3) + Gamma (ICC parametric curve type 0) Color space conversion could be done using texture samplers instead, for instance 3D LUTs, with or without transfer functions baked in, or 1D LUTs for transfer functions. This would result in dependent texture fetches which may or may not be an advantage over an ALU based implementation. The current solution favor the use of ALUs to save precious bandwidth. Test: CtsUiRenderingTests, CtsGraphicsTests Bug: 32984164 Change-Id: I10bc3db515e13973b45220f129c66b23f0f7f8fe
2017-03-06Add ColorSpace information on BitmapRomain Guy
This is the first step toward interpreting color spaces at render time. Bug: 32984164 Test: BitmapColorSpaceTest in CtsGraphicsTestCases Change-Id: I0164a18f1ed74a745874fe5229168042afe27a04
2017-02-06Clean up deferredLayers only onGpuContextDestroyed.sergeyv
Test: manual bug:34919311 Change-Id: I5488b0845ec3922424f5893943e4f42675dfc9fd
2017-01-30Explicitly destroy Layer in DeferredLayerUpdater on destroyHardwareResources()sergeyv
Change-Id: I0987104eabda9a2a302b9e765213aad48f93aea4 Test: refactoring CL. Existing tests still pass bug:33753499
2017-01-10Add support for dummy draws for Vulkan webview and texture views.Greg Daniel
Test: manual testing Change-Id: Iaec8c3a34367673c281665ff6c6e97d1ce532265
2017-01-10Break Layer class into Gl and Vulkan subclassesGreg Daniel
Test: manual testing Change-Id: Ibd2beed39de3ac6da7448e96496253cfe427dfbb
2016-10-26Add target to texturesergeyv
Test: refactoring cl. bug:32413624 Change-Id: I94b1c31cd4e0712dfcfd7777a0012424c1bf0dca
2016-10-13use SkBlendMode instead of SkXfermodeMike Reed
use sk_sp versions of paint setters/getters Change-Id: I86591a0a8ec92e6039776cbf00424ea24f585b28
2016-10-11Linear blending, step 1Romain Guy
NOTE: Linear blending is currently disabled in this CL as the feature is still a work in progress Android currently performs all blending (any kind of linear math on colors really) on gamma-encoded colors. Since Android assumes that the default color space is sRGB, all bitmaps and colors are encoded with the sRGB Opto-Electronic Conversion Function (OECF, which can be approximated with a power function). Since the power curve is not linear, our linear math is incorrect. The result is that we generate colors that tend to be too dark; this affects blending but also anti-aliasing, gradients, blurs, etc. The solution is to convert gamma-encoded colors back to linear space before doing any math on them, using the sRGB Electo-Optical Conversion Function (EOCF). This is achieved in different ways in different parts of the pipeline: - Using hardware conversions when sampling from OpenGL textures or writing into OpenGL frame buffers - Using software conversion functions, to translate app-supplied colors to and from sRGB - Using Skia's color spaces Any type of processing on colors must roughly ollow these steps: [sRGB input]->EOCF->[linear data]->[processing]->OECF->[sRGB output] For the sRGB color space, the conversion functions are defined as follows: OECF(linear) := linear <= 0.0031308 ? linear * 12.92 : (pow(linear, 1/2.4) * 1.055) - 0.055 EOCF(srgb) := srgb <= 0.04045 ? srgb / 12.92 : pow((srgb + 0.055) / 1.055, 2.4) The EOCF is simply the reciprocal of the OECF. While it is highly recommended to use the exact sRGB conversion functions everywhere possible, it is sometimes useful or beneficial to rely on approximations: - pow(x,2.2) and pow(x,1/2.2) - x^2 and sqrt(x) The latter is particularly useful in fragment shaders (for instance to apply dithering in sRGB space), especially if the sqrt() can be replaced with an inversesqrt(). Here is a fairly exhaustive list of modifications implemented in this CL: - Set TARGET_ENABLE_LINEAR_BLENDING := false in BoardConfig.mk to disable linear blending. This is only for GLES 2.0 GPUs with no hardware sRGB support. This flag is currently assumed to be false (see note above) - sRGB writes are disabled when entering a functor (WebView). This will need to be fixed at some point - Skia bitmaps are created with the sRGB color space - Bitmaps using a 565 config are expanded to 888 - Linear blending is disabled when entering a functor - External textures are not properly sampled (see below) - Gradients are interpolated in linear space - Texture-based dithering was replaced with analytical dithering - Dithering is done in the quantization color space, which is why we must do EOCF(OECF(color)+dither) - Text is now gamma corrected differently depending on the luminance of the source pixel. The asumption is that a bright pixel will be blended on a dark background and the other way around. The source alpha is gamma corrected to thicken dark on bright and thin bright on dark to match the intended design of fonts. This also matches the behavior of popular design/drawing applications - Removed the asset atlas. It did not contain anything useful and could not be sampled in sRGB without a yet-to-be-defined GL extension - The last column of color matrices is converted to linear space because its value are added to linear colors Missing features: - Resource qualifier? - Regeneration of goldeng images for automated tests - Handle alpha8/grey8 properly - Disable sRGB write for layers with external textures Test: Manual testing while work in progress Bug: 29940137 Change-Id: I6a07b15ab49b554377cd33a36b6d9971a15e9a0b
2016-09-01Merge "Fix google-explicit-constructor warnings in libs/hwui." am: ↵Chih-hung Hsieh
7207562ff7 am: d7a69e04eb am: 842f1e48e7 am: 1f50f80aab Change-Id: I713bd07fee150cc684e630045e02872b23062a5a
2016-08-29Fix google-explicit-constructor warnings in libs/hwui.Chih-Hung Hsieh
* Add explicit keyword to conversion constructors, or add NOLINT for implicit converters. Bug: 28341362 Test: build with WITH_TIDY=1 Change-Id: Id8ca42433a4fc3652e4cb13787c4cb169f20d9a9
2016-08-11resolve merge conflicts of 76ce8e5 to stage-aosp-masterChih-Hung Hsieh
Change-Id: I4b4ca9906373a95776d2da8ba2fa39a4a78e2a30
2016-08-10Fix clang-tidy warnings in libs/hwui.Chih-Hung Hsieh
* Add explicit keyword to conversion constructors. Bug: 28341362 * Use const reference type for read-only parameters. Bug: 30407689 Test: build with WITH_TIDY=1 Change-Id: Iab3e6636f60a70cb124f29dc19f20f842fa8dfda Merged-In: Iab3e6636f60a70cb124f29dc19f20f842fa8dfda
2016-08-10Fix clang-tidy warnings in libs/hwui.Chih-Hung Hsieh
* Add explicit keyword to conversion constructors. Bug: 28341362 * Use const reference type for read-only parameters. Bug: 30407689 Test: build with WITH_TIDY=1 Change-Id: Iab3e6636f60a70cb124f29dc19f20f842fa8dfda
2016-07-07Delete old rendering pipelineChris Craik
fixes: 30002246 Change-Id: I45df0e924708526cee045b14c291bd23aa1a92db
2016-05-17Merge "Fix hw layer overdraw/update visualization" into nyc-dev am: ↵Chris Craik
189e3e5ec5 am: bd2edfca03 am: f075b05d5a * commit 'f075b05d5a8516ff98d9c25c1b5ac307fdfc234a': Fix hw layer overdraw/update visualization Change-Id: I70968a90dbc3ea13654b7dbb8065d5a577a0f9ae
2016-05-17Merge "Fix hw layer overdraw/update visualization" into nyc-devChris Craik
am: 189e3e5ec5 * commit '189e3e5ec5b698f1062fb98692fa75d3750148e0': Fix hw layer overdraw/update visualization Change-Id: Ic4c49b25e0d1709d34974adb828c3ab4644415e5
2016-05-16Fix hw layer overdraw/update visualizationChris Craik
Fixes: 28748255 Change-Id: I83b531cdf5e4407fd17edd72d96e6189924926fa