253f2c213f6ecda63b6872aee77bd30d5ec07c82 |
|
29-Sep-2016 |
Romain Guy <romainguy@google.com> |
Linear blending, step 1 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
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
baf29e7cf433624687c9d6b3bac180d33add8e0f |
|
08-Sep-2016 |
sergeyv <sergeyv@google.com> |
HWUI: calculate used memory in FontCache for gfxinfo bug:30427106 Change-Id: I653571d6a4e974e975fb0dc03fc2364eecbf2f84
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
f636e63c44fb9d9a299908f1d88da8e0a02d019c |
|
11-Dec-2015 |
John Reck <jreck@google.com> |
Fix memory leak Change-Id: I6e17b0957e6c470fe6a230e52e4d1b30c967214a
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
c08820f587ad94698691a6657e87712de07e484c |
|
22-Sep-2015 |
Chris Craik <ccraik@google.com> |
Remove lookup3 gamma code Also clean up gamma / glyph cache properties Change-Id: I75b1ac0cb55638bf787ffd3cf457483ae314f03b
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
11718bc17bcfc56dfb9f4362eebf640b025c4415 |
|
22-Sep-2015 |
Chris Craik <ccraik@google.com> |
Remove shader based gamma approach Also fixes some INIT_LOGD logs Change-Id: I212a71a1e7b366aea41f7c3c8cc169d509d6e4a2
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
6c15ffa196fc9b7724c189d833c3435d8db12266 |
|
02-Feb-2015 |
Chris Craik <ccraik@google.com> |
Refactoring of Program ownership/lifecycle, and WIP Glop rendering path Change-Id: I2549032790bddbc048b0bccc224ed8f386b4517c
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
51d6a3db97bdd5315f1a17a4b447d10a92217b98 |
|
23-Dec-2014 |
Chris Craik <ccraik@google.com> |
Cleanup various clang warnings, use unique_ptrs in several places Change-Id: I347904b25e51fcc7de14b1e72f1acd0f6ba26f3f
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
e84a208317e0ed388fcdad1e6743c7849acb51b0 |
|
22-Dec-2014 |
Chris Craik <ccraik@google.com> |
Add overrides and switch to nullptr keyword Changes generated with clang-modernize. Additionally, fixed some struct-vs-class usage to make clang happy. Change-Id: Ic6ef2427401ff1e794d26f21f7b44868fc75fb72
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
64bb413a664001c95c8439cf097dc3033f4ed733 |
|
22-Nov-2014 |
Andreas Gampe <agampe@google.com> |
Revert "resolved conflicts for merge of 220c3f4f to master" Reverted as hwui doesn't agree. This reverts commit 8a902d9f24e83c87b054adb5836b4a5b8a257be9. Change-Id: I109e7b02bee2921e2155ded6df36f52e6f574b5a
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
42ddc18d108f789705ad4eb697ce9599ad322507 |
|
21-Nov-2014 |
Andreas Gampe <agampe@google.com> |
Frameworks/base: Unused parameters in hwui Remove Clang cutout for unused parameters. Fix warnings. Remove Clang cutout for deprecated Skia function usage. Has been fixed in the L push. Change-Id: I7ea073ff67127cc1e14e798b655e2c50615fe8e7
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
1e546815bbb736c50679a8aefc25f48561026fc5 |
|
25-Jun-2013 |
Victoria Lease <violets@google.com> |
Support RGBA fonts and bitmap fonts (and RGBA bitmap fonts) 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
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
cf51a4199835e9604aa4c8b3854306f8fbabbf33 |
|
09-Apr-2013 |
Romain Guy <romainguy@google.com> |
Introduce PixelBuffer API to enable PBOs 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
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
8801b2fef3bc54db1bbb24748d91c909b901116a |
|
04-Aug-2012 |
Romain Guy <romainguy@google.com> |
Bowing my head in shame Bug #6924514 Change-Id: Ifcc08fb5dbaf3f9c6ac3a3e618db2fd6349dc290
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
0aa87bbfc41e8b5f52de701ac17b4e66a7a7b609 |
|
20-Jul-2012 |
Romain Guy <romainguy@google.com> |
Fix crash with new LookupGammaFontRenderer Bug #6853934 Change-Id: I15e6ca73bfe00eff1a37c4b9d2f7f709ee018eb6
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
6e25e38e43f9e7f71397dfab7ed32c81c7bf7d46 |
|
19-Jul-2012 |
Romain Guy <romainguy@google.com> |
Add a new method for text gamma correction To select the gamma correction method, adb shell setprop hwui.text_gamma_correction with one of the following values: lookup3 lookup shader3 shader See Properties.h for more information about these different methods. You can also control gamma correction using the following properties: hwui.text_gamma hwui.text_gamma.black_threshold hwui.text_gamma.white_threshold Change-Id: I47970b804d2c590c37d3da5008db094241579e25
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
4121063313ac0d6f69f6253cac821d0c1c122086 |
|
17-Jul-2012 |
Romain Guy <romainguy@google.com> |
Add shader-based text gamma correction To enable it, the system property ro.hwui.text_gamma_shader must be set to true. For testing, DEBUG_FONT_RENDERER_FORCE_SHADER_GAMMA can be set to 1 in libhwui/Debug.h. Change-Id: If345c6b71b67ecf1ef2e8847b71f30f3ef251a27
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
b1d0a4ed21168fefcb82232c8f22cb95d60acb85 |
|
14-Jul-2012 |
Romain Guy <romainguy@google.com> |
Refactor GammaFontRenderer This change is the first step to a shader-based text antialias gamma correction. Change-Id: I9eb02d4c56cb95d05219f712290c865b46141954
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
7de0cb12d0e5fd64811da0b5d1ae0c0d58b86f86 |
|
06-Dec-2011 |
Chet Haase <chet@google.com> |
Make glyph cache more flexible Some GPU architectures could not handle the previous implementation of our glyph cache. Frequent uploads would cause memory problems in the GPU and eventually a crash due to these memory issues. The solution is to move to a system of several, smaller caches instead of one monolythic cache for all glyphs. Change-Id: I0fc7a323360940d16d5a33eeb33abfab194c5920
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
eca0ca2424afc1e98912405906edfc32f7733e16 |
|
04-Nov-2011 |
Romain Guy <romainguy@google.com> |
Memory optimizations for libhwui 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
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
c15008e72ec00ca20a271c3006dac649fd07533b |
|
10-Nov-2010 |
Romain Guy <romainguy@google.com> |
Move all debug flags in a single place. 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
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
5b3b35296e8b2c8d3f07d32bb645d5414db41a1d |
|
28-Oct-2010 |
Romain Guy <romainguy@google.com> |
Optimize FBO drawing with regions. 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
/frameworks/base/libs/hwui/GammaFontRenderer.h
|
b45c0c9774bd19a9dbe77d149abae4e124b08bf6 |
|
27-Aug-2010 |
Romain Guy <romainguy@google.com> |
Apply gamma correction to font rendering. Change-Id: I1b05f40e356221b2a5eb9400e67d77ecd98ed6c4
/frameworks/base/libs/hwui/GammaFontRenderer.h
|