History log of /frameworks/base/libs/hwui/renderstate/RenderState.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
36393c3e8da725927357d7a235c18e2f6c1aea98 24-May-2017 John Reck <jreck@google.com> Fix null deref crash

Change-Id: Ic1a64e926b5faa2f4cf8d079a2b67e0261dcecd7
Fixes: 62035692
Test: manual
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
9a814875c4e3a98fea99dae623f22268a9afa38a 23-May-2017 John Reck <jreck@google.com> Improve time to texture destruction

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
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
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/renderstate/RenderState.cpp
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/renderstate/RenderState.cpp
c3f131696111a066d9efd9c7c3e37566a2a9fb89 06-Feb-2017 sergeyv <sergeyv@google.com> Clean up deferredLayers only onGpuContextDestroyed.

Test: manual
bug:34919311
Change-Id: I5488b0845ec3922424f5893943e4f42675dfc9fd
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
3e9999bd866fac71c72e6b484a9836c87c328a08 20-Jan-2017 sergeyv <sergeyv@google.com> Explicitly destroy Layer in DeferredLayerUpdater on destroyHardwareResources()

Change-Id: I0987104eabda9a2a302b9e765213aad48f93aea4
Test: refactoring CL. Existing tests still pass
bug:33753499
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
45ec62ba72c5017fae7d8baab20bfb0d4c99c627 04-Jan-2017 Greg Daniel <egdaniel@google.com> Add support for dummy draws for Vulkan webview and texture views.

Test: manual testing
Change-Id: Iaec8c3a34367673c281665ff6c6e97d1ce532265
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
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/renderstate/RenderState.cpp
2a38c42e921451abebb4ee5f5ecd738f1b6b04ed 26-Oct-2016 sergeyv <sergeyv@google.com> Add target to texture

Test: refactoring cl.
bug:32413624

Change-Id: I94b1c31cd4e0712dfcfd7777a0012424c1bf0dca
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
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/RenderState.cpp
5e00c7ce063116c11315639f0035aca8ad73e8cc 07-Jul-2016 Chris Craik <ccraik@google.com> Delete old rendering pipeline

fixes: 30002246

Change-Id: I45df0e924708526cee045b14c291bd23aa1a92db
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
92e7158f81843c23215d55dced1e25f15304eca5 04-May-2016 Chris Craik <ccraik@google.com> Merge "Use LUT for computing final shadow alpha" into nyc-dev
am: b2e36d7939

* commit 'b2e36d7939610de538a6ec95a821b61b365b3073':
Use LUT for computing final shadow alpha

Change-Id: Ia17e3b93e9ade0633aee5a1e9edd60b92dd1e062
138c21fbec12bead3c7ca1f181c3fd35542ccb00 29-Apr-2016 Chris Craik <ccraik@google.com> Use LUT for computing final shadow alpha

bug:27415250

Significantly reduces shadow fragment shader computation.

Change-Id: Ie9b3c712700754b3734d0ae9cda8751c298fc59e
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
85e0c89ba55188ecc484538efbfdb570606fc1a2 28-Apr-2016 Chih-Hung Hsieh <chh@google.com> resolve merge conflicts of 1599b981 to nyc-dev-plus-aosp

Change-Id: I90807581e10b6a0024515ff634ac8b29eaa5fc9f
c6baf563ba6aa207a48317c177b29f1d2b70cf3d 27-Apr-2016 Chih-Hung Hsieh <chh@google.com> Fix google-explicit-constructor warnings.

Bug: 28341362
Change-Id: Ibdd6a210bb7ff228e3624cc319169f77aca3b51e
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
1b7db4000eabb570697f4c5097588acbfa4df62b 25-Feb-2016 Chris Craik <ccraik@google.com> Cleanup vertex attrib management

bug:27289007

Also removes unused code in MeshState

Change-Id: I46116631111cc82e1cdffb5706344bbb6d4c6600
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
0b8d0677be2289bbc9e0b48c0878fb67d1cc0ebd 29-Jan-2016 John Reck <jreck@google.com> Fix copyLayerInto

Bug: 26763945
Change-Id: I21ffbd56cf70bad0928416963e6fc254be435af9
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
975591a7af883d866d86ab819e164c6004694744 23-Jan-2016 John Reck <jreck@google.com> Add fine-grained debug layer

Full GLES error checking layer via -include
trickery. Change DEBUG_OPENGL to a level system.

HIGH = every GL call is error checked
MODERATE = checkpointing at interesting spots
LOW = only asserts there are no errors at the end of a frame
or when the FBO changes
NONE = AIN'T GOT NO TIME FOR ERRORS GOTTA GO FAST!

Change-Id: Ibe81aae93d942059c4ddf1cbb11c828b7ce4c10b
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
e5530ec0b4204f4f3b4f92a87056ce18a8d76793 22-Jan-2016 John Reck <jreck@google.com> resolve merge conflicts of 32a95af029 to master.

Change-Id: I35b7cea1d34cb24f431ba2b76433a5b0ef1cb602
c5a3efd28668a62df3e3b364b49624c5af7549b6 21-Jan-2016 Dohyun Lee <leedhyun11@gmail.com> libhwui: fix texture memory leak

When there is not enough space and we cannot delete any
Texture in TextureCache to secure space, a new Texture is
created over and over again for the same SkBitmap and
there is the case that it is not deleted.
This patch avoids such cases.

Change-Id: Ic5353995e6d0716c31fe3bb49c60ec1a71574643
Signed-off-by: Dohyun Lee <leedhyun11@gmail.com>
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
9372ac3621848085e77b867f220c0b5ffce4010d 19-Jan-2016 John Reck <jreck@google.com> Fix ordering of texture->upload arguments

Caught by scatter-shotting GL_CHECKPOINTS which
seem generally useful to have

Bug: 26609444

Change-Id: Ie31d9297d8dae56405126720f338b4256c8bae77
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
a55b5d6c65cde2b7cc28bb3ea160bfaaef7a446a 15-Jan-2016 John Reck <jreck@google.com> Fix "leak" in FrameBuilder.textureLayer test

DeferredLayerUpdater always did a post to delete itself, which
would result in the test thinking it had leaked an object since
it wasn't deleted when it returned. Fix this by deleting immediately
if we're already on the right thread.

Remove RenderState's requireGlContext assert as it's now
covered by GpuMemoryTracker, which is also more test friendly.
RenderState's assert required an actual EGL context, which we
don't mock away in unit tests.

Change-Id: Ic23eb54e7151355f7acca483d7464350c9d6a87f
/frameworks/base/libs/hwui/renderstate/RenderState.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/RenderState.cpp
9fded232a9548a304e0145011df8849fba0dcda7 12-Nov-2015 Chris Craik <ccraik@google.com> Recycle OffscreenBuffers

Change-Id: Ia2e219026f211a5308ecf8209c5f986bb888aadd
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
818c9fbf1d76d5df19253ba4eb964efa939ec9ec 23-Oct-2015 Chris Craik <ccraik@google.com> Initial version of clipped saveLayer in new pipeline

Additionally disables usage of FBO cache, so FBO destruction safely
interacts with renderstate caching.

Change-Id: I25c277cb7afec2ca33bf226445d6c8867a15a915
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
12efe649d3f5df8e81f4b78179939c1d488673a0 29-Sep-2015 Chris Craik <ccraik@google.com> Move ortho matrix out of glop

It's fbo-global, so don't bother stashing/restoring it repeatedly.

Change-Id: Icb32e3eda5d2086aaae07140f8ff40e038dad5fe
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
b9ce116dac378b4cf4490f265dcbd5704a1dd43c 21-Aug-2015 Chris Craik <ccraik@google.com> Switch several enums to enum classes

Change-Id: I00ecd0b61657196b51704f70ca31a9d1c1ac254e
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
9db58c031f8ffa102a6d585cb585bed3bdb911a9 20-Aug-2015 Chris Craik <ccraik@google.com> Remove MathUtils::min/max

bug:22202895

Change-Id: Ia115d86871314e3819f684ea7307356aed13a28e
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
95cd24bb9d000eb541bc7ec7e6b53d1c7e313076 04-Aug-2015 John Reck <jreck@google.com> Fix crash in kModeProcessNoContext

Bug: 22931143
Change-Id: I9897a28b1edd006aee67ae2343874ad92bbd15a0
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
53e51e4aa933f9603587e1780f446c18816bf9be 01-Jun-2015 Chris Craik <ccraik@google.com> Handle shader matrix correctly when ignoring canvas transform

bug:20063841

Restores old SkShader matrix behavior from before the Glop refactor.

Many drawing operations draw without sending the canvas transform to
the GL shader. In such cases, we need to adapt the matrix sent to the
SkShader logic to invert the canvas transform that's built into
the mesh.

Change-Id: I42b6f59df36ce46436322b95bf9ad2140795ee58
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
1e6d566c5f8500e3639a8f8ceebf0226c07efc13 27-May-2015 Chris Craik <ccraik@google.com> Merge "Fix GL texture binding for TextureViews" into mnc-dev
5f1356c80a3f0daf436aa4250dcfa8fce3029828 27-May-2015 Chris Craik <ccraik@google.com> Fix GL texture binding for TextureViews

bug:21431334

Should be explicitly passing target through, to ensure
GL_EXTERNAL_OES textures are bound correctly.

Change-Id: I997672ae292ea7fc016c02a59a3c7c8358ecfe0b
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
d7db4d767246b41d44995acb93d03d220b53c748 20-May-2015 John Reck <jreck@google.com> Eliminate requireGlContext

Bug: 20297820

Change-Id: I37c63bab6f6c0d2337c8c6002046d2ef17e74097
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
2507c34d91bb0d722b6012e85cb47387b2aa6873 04-May-2015 Chris Craik <ccraik@google.com> Cleanup properties

bug:19967854

Separate properties from Caches, into static, RenderThread-only class.

Also rewrites the means for java to set properties to correctly handle
threading, and adds an override for profile bars so that SysUi doesn't clutter
the screen with them.

Change-Id: I6e21a96065f52b9ecc49d1a126244804ba106fa9
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
eb911c2b0e8edeb7595a98af4b9f1bd47de1381e 07-Mar-2015 Chris Craik <ccraik@google.com> Rewrite glop texture asserts

bug:19641517

Also switch Glop VertexAttribFlags to use int for group of flags.

Change-Id: Ib7b1934197a62206a55baa6ab484ac59f5bec816
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
26bf34200e40a0fa8c66366559aa016380cd8c6f 27-Feb-2015 Chris Craik <ccraik@google.com> Glop TextureLayer support

Change-Id: I348a926bd4a2f47be9fdbe74058c0aa2f8dc6276
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
ef2507439c08f4e9c4c9bba1c6243ca9df2ee827 26-Feb-2015 Chris Craik <ccraik@google.com> Glop mesh reorg, support for drawBitmapMesh

Change-Id: Iaf5550bdd93da93e59a5b838234ab5612e067387
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
f27133df2d179c99d6bc1ae644af09e9153a0071 19-Feb-2015 Chris Craik <ccraik@google.com> Glop layer mesh rendering

Change-Id: I2d902819d5d77f496b67d4d25a298782903e410d
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
922d3a7f6f8c1c05a996ee3e91e8cbadfff560c9 14-Feb-2015 Chris Craik <ccraik@google.com> Glop SkiaShader support

Change-Id: I894a0b62701bd02367ab970813e4c332147351a2
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
30036092b40badecbe64d9c2bff4850132147f78 12-Feb-2015 Chris Craik <ccraik@google.com> Glop path texture support

Change-Id: I505eb05991ca4c9b2e01e49988b8f962fad51462
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
0519c810a56bded1284fcb2ae40f438878c6585f 11-Feb-2015 Chris Craik <ccraik@google.com> Glop Bitmap and RoundRect clipping support

Change-Id: I4577546a5d2e5f084cc03f39a89db9231b8111ee
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
2ab95d780b023152556d9f8659de734ec7b55047 07-Feb-2015 Chris Craik <ccraik@google.com> Glop support for indexed quads

bug:19014311
Change-Id: If35a873421b41cc4508b0d8ac1b4d900c9bb3717
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
f7ccbfbd9811e3b1c3accd9e3e92688d31a8a2bd 07-Feb-2015 Chris Craik <ccraik@google.com> Merge "Glop ColorFilter & VertexBuffer support, initial enable"
117bdbcfa3e8306dad21e7e01fa71b00cdfa7265 05-Feb-2015 Chris Craik <ccraik@google.com> Glop ColorFilter & VertexBuffer support, initial enable

Enables Glop rendering for supported Rects and VertexBuffers
Also removes unused Query object

Change-Id: Ibe227bc362685a153159f75077664f0947764e06
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
ecad24b49d20f7fb4b75950e9444787967acd347 05-Feb-2015 Chris Craik <ccraik@google.com> Merge "GlopBuilder, and test app refactor"
031888744e24b5c7243ac99ec98b78aff5db1c78 03-Feb-2015 Chris Craik <ccraik@google.com> GlopBuilder, and test app refactor

Change-Id: I2cd299ccf178007fd5f83bab6c3448f03aec7843
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
9dfd7bd520ee598b3033a0c47b8b649bd3988c7c 03-Feb-2015 Chris Craik <ccraik@google.com> Merge "Refactoring of Program ownership/lifecycle, and WIP Glop rendering path"
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/renderstate/RenderState.cpp
d7328ae7909328ff4aa2205b0de0d4f6f72a2e66 30-Jan-2015 Chris Craik <ccraik@google.com> Merge "Refactor blending and texture gl state"
44eb2c00861098dd3e2950d923646814b4cc57c2 29-Jan-2015 Chris Craik <ccraik@google.com> Refactor blending and texture gl state

Change-Id: Ia6b3c8b2afd3dfcee7f3ce401d846b789612054a
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
ff5c8e8097e3eff910632a568195b798798ccccc 30-Jan-2015 Chris Craik <ccraik@google.com> Fix double create of Caches

bug:19208182
Change-Id: I91ac591cecc207da1b102013ca4985dd075cca80
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
49bc4acfadf9c5b1e520217278ccb38010d38c89 29-Jan-2015 John Reck <jreck@google.com> resolved conflicts for merge of fe5ac4fc to master

Change-Id: I6c0cc82db14b56297586469f940e408c0e218b3b
96a5c4c7bab6718524de7253da8309143ab48bef 28-Jan-2015 Chris Craik <ccraik@google.com> Move more GL state management to RenderState and its directory

Change-Id: Ic68584e1c08dc64be2ad43450cb6caa1de834fdc
/frameworks/base/libs/hwui/renderstate/RenderState.cpp
65fe5eeb19e2e15c8b1ee91e8a2dcf0c25e48ca6 27-Jan-2015 Chris Craik <ccraik@google.com> Move scissor state to RenderState

Change-Id: I1227a3886fb24e4d9fad79fca469794f06cfb15e
/frameworks/base/libs/hwui/renderstate/RenderState.cpp