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/renderstate/OffscreenBufferPool.cpp
|
aff230f6f9f9e44a5e111ba3f087d03f7a0e24f3 |
|
05-May-2016 |
Chris Craik <ccraik@google.com> |
Add layer tracing tags in new pipeline bug:28596354 Change-Id: I351cb50c8c9ddfc73be73d28a1af94d2a8f9992e
/frameworks/base/libs/hwui/renderstate/OffscreenBufferPool.cpp
|
74af6e282f8a8f75928a071e8200039517cf5c12 |
|
05-Apr-2016 |
Chris Craik <ccraik@google.com> |
Fix OffscreenBuffer leak Fixes: 27941148 Make OffscreenBuffer lifecycle an explicit (and tested) contract between FrameBuilder and BakedOpRenderer, entirely separate from dispatch. This makes it safe to reject any rendering work via overdraw content rejection (before it gets to a BakedOpDispatcher). Adds a couple tests around OffscreenBuffer leaks, and switches OffscreenBuffer tests to RENDERTHREAD_TEST macro, as appropriate. Change-Id: Id114b835d042708ae921028fb4b17e5fa485fe64
/frameworks/base/libs/hwui/renderstate/OffscreenBufferPool.cpp
|
02806288d1c56475413888a934c796e6e4eb11c5 |
|
12-Mar-2016 |
Chris Craik <ccraik@google.com> |
Fix flickering when layers resize in-place bug:27248275 Change-Id: Ia11c93ebc1097f3735071204b6f14ca079bb9fc4
/frameworks/base/libs/hwui/renderstate/OffscreenBufferPool.cpp
|
64db2bf1118db88c937e2b8c61b299bb2a80e3cb |
|
27-Feb-2016 |
Chris Craik <ccraik@google.com> |
Clip buffer damage to viewport bounds bug:27287946 Change-Id: Ief3ae9c2dd92196b7d09f1b9fadf009eb228d80a
/frameworks/base/libs/hwui/renderstate/OffscreenBufferPool.cpp
|
bd41ded59090e8cdf598e0c65693f1cf0885bbea |
|
22-Jan-2016 |
John Reck <jreck@google.com> |
Fix accidental activateTexture(0) Bug: 26584230 activateTexture(0) was accidentally refactored into Texture::upload. Only OffscreenBuffer intended for the texture unit to change Change-Id: I5dbfc3eab8843733084ce1ce38a0a946abf0e05b
/frameworks/base/libs/hwui/renderstate/OffscreenBufferPool.cpp
|
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/renderstate/OffscreenBufferPool.cpp
|
7435eb148e72382126e9073183e881357bb38a8b |
|
08-Jan-2016 |
Chris Craik <ccraik@google.com> |
Unclipped savelayer support in new renderer bug:22480459 Change-Id: I89dd5de8d7d008a1e298d227d767aabff5c96e27
/frameworks/base/libs/hwui/renderstate/OffscreenBufferPool.cpp
|
9fded232a9548a304e0145011df8849fba0dcda7 |
|
12-Nov-2015 |
Chris Craik <ccraik@google.com> |
Recycle OffscreenBuffers Change-Id: Ia2e219026f211a5308ecf8209c5f986bb888aadd
/frameworks/base/libs/hwui/renderstate/OffscreenBufferPool.cpp
|