66c3a829dc129b6081979facf5a652d5d9f1f51a |
|
25-Apr-2017 |
Chris Craik <ccraik@google.com> |
Fix include Bug: 35387665 Test: builds with HWUI_ENABLE_OPENGL_VALIDATION := false Dependency on gl3.h was added while that header was auto-included for error checking purposes. Add the include to enable us to disable gl error checking. Change-Id: Ic969da716e2323f8e42d20da8fd0a6fa653f9775
/frameworks/base/libs/hwui/Texture.h
|
caaaa66e57293e4a6f312649bf472eab84d5c7fe |
|
27-Mar-2017 |
Romain Guy <romainguy@google.com> |
Convert bitmaps to sRGB/scRGB when they have a color profile 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
/frameworks/base/libs/hwui/Texture.h
|
efb4b06493fe7b1604c762a448b13c7af2845a8d |
|
27-Feb-2017 |
Romain Guy <romainguy@google.com> |
Add ColorSpace information on Bitmap This is the first step toward interpreting color spaces at render time. Bug: 32984164 Test: BitmapColorSpaceTest in CtsGraphicsTestCases Change-Id: I0164a18f1ed74a745874fe5229168042afe27a04
/frameworks/base/libs/hwui/Texture.h
|
636afc1877882dc9cf73b49f8a68c73cc418d8cd |
|
07-Feb-2017 |
Romain Guy <romainguy@google.com> |
Apply transfer function when rendering with linear textures RGBA16F bitmaps are always encoded in linear space, which means we must apply the opto-electronic transfer function before we can render them in the framebuffer. Since our linear bitmaps are assumed to be scRGB, values can be negative. The OETF is a slightly modified sRGB OETF: sign(x) * OETF_sRGB(abs(x)) This effectively mirrors the OETF over the negative domain. This CL also removes the "optimized" shader generation path. With current compilers, the optimized path doesn't do anything of value and makes ProgramCache difficult to maintain. Shader compilers inline everything and are really good at folding expressions and removing unused code. Bug: 32984164 Test: CtsUiRenderingTestCases Change-Id: Ieb458ad53574e3a8959aa6bccbbd2d1fe203cbc5
/frameworks/base/libs/hwui/Texture.h
|
8cd3edfa15cc9cdbffa935d19ab894426b08d174 |
|
09-Jan-2017 |
Greg Daniel <egdaniel@google.com> |
Break Layer class into Gl and Vulkan subclasses Test: manual testing Change-Id: Ibd2beed39de3ac6da7448e96496253cfe427dfbb
/frameworks/base/libs/hwui/Texture.h
|
694d499662838123f474f41b31dea84ec5d563f0 |
|
27-Oct-2016 |
sergeyv <sergeyv@google.com> |
Routine to upload hardware bitmaps Change-Id: Id8283a0975325e6830d55fd1e33c5f292a1e9be0 Test: refactoring cl. bug:30999911
/frameworks/base/libs/hwui/Texture.h
|
2a38c42e921451abebb4ee5f5ecd738f1b6b04ed |
|
26-Oct-2016 |
sergeyv <sergeyv@google.com> |
Add target to texture Test: refactoring cl. bug:32413624 Change-Id: I94b1c31cd4e0712dfcfd7777a0012424c1bf0dca
/frameworks/base/libs/hwui/Texture.h
|
98fa4f9e7b33a3004ce9142c9acd4300391b9a0e |
|
25-Oct-2016 |
sergeyv <sergeyv@google.com> |
Use Bitmap in Texture.upload Test: refactoring cl. bug:32216791 Change-Id: Ib0b16c878d8371e0471e9a502f55626ec5999c60
/frameworks/base/libs/hwui/Texture.h
|
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/Texture.h
|
05160d70d14180fef3782a63dff2e822b51c3cf5 |
|
22-Jul-2016 |
Chih-Hung Hsieh <chh@google.com> |
resolve merge conflicts of 5152fd9 to stage-aosp-master Change-Id: I2066125eb4076dbc9e8996bb1fa87735aa6040d3
|
faecb78a6b11c780db47bc940ca7662899ab5d5e |
|
21-Jul-2016 |
Chih-Hung Hsieh <chh@google.com> |
Fix google-explicit-constructor warnings in frameworks/base * Add explicit keyword to conversion constructors. * Add NOLINT to implicit conversion constructors. Bug: 28341362 Test: build with clang-tidy Change-Id: Ie4d37072ab57d1662d18db4de1c8577247f43337
/frameworks/base/libs/hwui/Texture.h
|
48247a2956f34d5d709660869273e0f7356e42b6 |
|
22-Jan-2016 |
John Reck <jreck@google.com> |
Fix mismatch in assumed defaults vs. actual defaults Bug: 26584230 Change-Id: Ia0271b097a40123c18f6b3540c1168cba109b5ce
/frameworks/base/libs/hwui/Texture.h
|
38e0c32852e3b9d8ca4a9d3791577f52536419cb |
|
10-Nov-2015 |
John Reck <jreck@google.com> |
Track texture memory globally Also mostly consolidates texture creation Change-Id: Ifea01303afda531dcec99b8fe2a0f64cf2f24420
/frameworks/base/libs/hwui/Texture.h
|
386aa031793bb037ec43b6cdbd8908c343cc86cb |
|
08-Dec-2015 |
Chris Craik <ccraik@google.com> |
Add more shape drawing to new reorderer/renderer bug:22480459 Add support for outsetting final bounds based on stroke. Change-Id: I659318ccec51882bba1906ce3c7042288ce35c30
/frameworks/base/libs/hwui/Texture.h
|
00e79c9947b741194ff6c0d08ede9b3befbf9c9d |
|
21-Jul-2015 |
John Reck <jreck@google.com> |
Mark isInUse per-window Bug: 22509159 Change-Id: I0ae0f1fa582ee38dcb9f24ca20f0b4d0c57ccb32
/frameworks/base/libs/hwui/Texture.h
|
e2bb380bc26749782c873e5488cfdf4e42b27346 |
|
13-Mar-2015 |
Chris Craik <ccraik@google.com> |
Use glops for text rendering Change-Id: I5e155c8baf3149f0ff231ec3c89dbff6bb8eae92
/frameworks/base/libs/hwui/Texture.h
|
8e93a7c9377b4ae43ecfb408f4906a09f6c83c03 |
|
23-Feb-2015 |
Chris Craik <ccraik@google.com> |
Simplify Texture member initialization Change-Id: Iaaa6dd20e64a0a075d732b101e3c4278cad44047
/frameworks/base/libs/hwui/Texture.h
|
860d155f866cc15a725e7ce03763280987f24901 |
|
12-Apr-2014 |
John Reck <jreck@google.com> |
Fix issue with bitmap uploading Bug: 13912749 Change-Id: Ic23fa1d280118dc93dc2716a4a24cc0bbbdca595
/frameworks/base/libs/hwui/Texture.h
|
be1b127c7bec252e0c6ab0e06ed6babed07d496f |
|
06-Jun-2013 |
Romain Guy <romainguy@google.com> |
Assume a texture is unbound after deleting it 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
/frameworks/base/libs/hwui/Texture.h
|
8aa195d7081b889f3a7b1f426cbd8556377aae5e |
|
05-Jun-2013 |
Romain Guy <romainguy@google.com> |
Introduce Caches::bindTexture() to reduce glBindTexture calls Change-Id: Ic345422567c020c0a9035ff51dcf2ae2a1fc59f4
/frameworks/base/libs/hwui/Texture.h
|
a404e16e4933857464046d763ed7629cd0c86cbf |
|
25-May-2013 |
Romain Guy <romainguy@google.com> |
Make sure atlas antries can correctly filter/wrap textures 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
/frameworks/base/libs/hwui/Texture.h
|
3b748a44c6bd2ea05fe16839caf73dbe50bd7ae9 |
|
18-Apr-2013 |
Romain Guy <romainguy@google.com> |
Pack preloaded framework assets in a texture atlas 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
/frameworks/base/libs/hwui/Texture.h
|
713e1bb9df6bdfc21bd5c40d1a6ecf6c822a4be5 |
|
17-Oct-2012 |
Romain Guy <romainguy@google.com> |
Add API to enable mipmaps on Bitmap Bug #7353771 This API can be used when scaling large images down to a small size to get nicer looking results. Change-Id: If09087eed36077eee5355f6047a3ca67747d7d9e
/frameworks/base/libs/hwui/Texture.h
|
98d3a64ffa13596e3ea9125bbff40c51ec96bd8d |
|
26-Sep-2012 |
Chet Haase <chet@google.com> |
Assign default texture id of 0 Some logic depends on a default value of 0, which was not being assigned. Issue #7195815 chrome url bar is corrupted Issue #7190656 Textures corrupted on mr1 Change-Id: I346b7b76e885bf8f04740e711fd88f917a5418c7
/frameworks/base/libs/hwui/Texture.h
|
39d252a6632d057d5077f7eaf1b8ed7a142f3397 |
|
13-Dec-2011 |
Romain Guy <romainguy@google.com> |
Various OpenGL optimizations Change-Id: Ib0742c96f10f5f50e7e5148b742c31b6c232d127
/frameworks/base/libs/hwui/Texture.h
|
d21b6e1fe337b35f62cf2028e9bd0637fd009a75 |
|
01-Dec-2011 |
Romain Guy <romainguy@google.com> |
Optimize away unnecessary state changes Change-Id: I0f6816f9f6234853575ecee5033186ad19e76380
/frameworks/base/libs/hwui/Texture.h
|
e3c26851dc315b730ea0fe5ef35bb1db81f6d675 |
|
26-Jul-2011 |
Romain Guy <romainguy@google.com> |
Improve rendering performance on some GPUs This change sets textures filtering to GL_NEAREST by default. GL_LINEAR filtering is only used when textures are transformed with a scale or a rotation. This helps save a couple of fps on some GPUs. Change-Id: I1efaa452c2c79905f00238e54d886a37203a2ac1
/frameworks/base/libs/hwui/Texture.h
|
9ace8f5e79e76893fe4ca9e4d10f6c4056330485 |
|
08-Jul-2011 |
Romain Guy <romainguy@google.com> |
Use NEAREST filtering for layers whenever possible. Change-Id: Id5bee1bd4a322cf93e8000b08e18f1e1b058648e
/frameworks/base/libs/hwui/Texture.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/Texture.h
|
8164c2d338781c3a3c4a443941070dca5d88f2a7 |
|
26-Oct-2010 |
Romain Guy <romainguy@google.com> |
Don't change textures wrap modes on every draw. Change-Id: If6d3f313778cc7f3e803a063338539c8b3e165e3
/frameworks/base/libs/hwui/Texture.h
|
9aaa8269a3e7291aab84d01c3fc9c744d8f2d2f4 |
|
09-Sep-2010 |
Romain Guy <romainguy@google.com> |
Fix possible infinite loop when purging textures. Change-Id: Ib05b398ae03e734da2dab0496df416fed4570b1c
/frameworks/base/libs/hwui/Texture.h
|
22158e139a3d6c6a9787ca0de224e9368f643284 |
|
06-Aug-2010 |
Romain Guy <romainguy@google.com> |
Automatically cleanup textures that don't fit in the cache. Change-Id: I4f29ed96ea11118b391fb957e1e4d1b8fcef1537
/frameworks/base/libs/hwui/Texture.h
|
7d139ba2c331f11e9b485753cc727a0ff202f2a4 |
|
02-Jul-2010 |
Romain Guy <romainguy@android.com> |
Remove extra leftover logs and use uint32_t instead of unsigned int. Change-Id: I944f82fe3255de38dc04048cc8bd861f578f01a7
/frameworks/base/libs/hwui/Texture.h
|
fe8809471a40cac8acc984adfa51c39e13e83947 |
|
01-Jul-2010 |
Romain Guy <romainguy@google.com> |
Remove unnecessary return and add bitmap generation ID tracking. Change-Id: Icf5e0635e789f5ea53268c22fad51cf733b5b1a6
/frameworks/base/libs/hwui/Texture.h
|
ce0537b80087a6225273040a987414b1dd081aa0 |
|
30-Jun-2010 |
Romain Guy <romainguy@google.com> |
Add hooks for drawBitmap(). Change-Id: I58e962c3a8b2bc75c2605fe369ad3002579d86e0 Add texture cache. Change-Id: I1c0e5581d228869e114438258a1014e33e024ad7
/frameworks/base/libs/hwui/Texture.h
|