History log of /frameworks/base/libs/hwui/Extensions.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
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/Extensions.h
8762e332e3797fb41929a1c6069207f4906ca329 12-Oct-2016 Romain Guy <romainguy@google.com> Various fixes for linear blending and gradients

With linear blending turned off some textures were still
created as sRGB textures instead of linear textures.
Multi-stop gradients were not behaving properly on devices
with no support for float textures.
Gradients are now always interpolated in linear space
even if linear blending is off.
New functions to always force sRGB->linear->sRGB conversions.

Test: Manual testing
Bug: 29940137
Change-Id: Ie2f84ee2a65fd85570e88af813e841e0e625df6c
/frameworks/base/libs/hwui/Extensions.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/Extensions.h
1540153198fc59e5f344b363c198acf5b65251aa 16-Nov-2015 John Reck <jreck@google.com> Extensions must load in ctor

Because Caches is terrible

Change-Id: I91e2442d97664759ee2c7602eb7172f009b20d53
/frameworks/base/libs/hwui/Extensions.h
704bed0da7cc75d0c517d425445de70ceb58060b 05-Nov-2015 John Reck <jreck@google.com> add DeviceInfo

This reverts commit 096895550b9d5430d7a001d491566decf4f9791b.

Change-Id: Ib2ed1e96d8f7f88302f5e27fe735687194553104
/frameworks/base/libs/hwui/Extensions.h
096895550b9d5430d7a001d491566decf4f9791b 05-Nov-2015 John Reck <jreck@google.com> Revert "add DeviceInfo"

This reverts commit b2442896e3a226c7ebe9d47fa80b257e98a6a34d.

Change-Id: I50f6555451f71067505245333c8e558b5e3b2b3b
/frameworks/base/libs/hwui/Extensions.h
b2442896e3a226c7ebe9d47fa80b257e98a6a34d 04-Nov-2015 John Reck <jreck@google.com> add DeviceInfo

Change-Id: I4c122278a7e88b6f47c4dd3c5fc553df7d3c900d
/frameworks/base/libs/hwui/Extensions.h
6b50780363d3bb8db600c770183fa07677509ae8 03-Nov-2015 John Reck <jreck@google.com> Remove almost-all android::Singleton users

Bug: 25426213
Change-Id: I88e6206e8915cce95c3a8a8a82a4bb8fbf668141
/frameworks/base/libs/hwui/Extensions.h
6e6646c03788f198a9878763680c05342d7622f3 15-Sep-2015 Chris Craik <ccraik@google.com> Unify extensions parsing behavior

Removes remnants of EGL extension support, and persistence of
GL extension list.

Change-Id: I35aec12d900bdb33549ea47654bb8146f350ef48
/frameworks/base/libs/hwui/Extensions.h
149173d28c0843aba86b0810ce75b34be6a0d08f 10-Aug-2015 John Reck <jreck@google.com> Support new EGL extensions

Bug: 21753739

Includes a revert of 13d1b4ab10fbee5e81a2ba1ac59cfae1e51d3ef0
as that only supported EGL_EXT_buffer_age

Change-Id: Ia86a47d19e3355c067934d7764c330b640c6958d
/frameworks/base/libs/hwui/Extensions.h
b47ea9b2ed24f8eb6fc8b338555ff0d8825d8565 04-Aug-2015 John Reck <jreck@google.com> am 2fa3eec0: am 93c14069: Merge "hwui: add extension to support unpack operations in OpenGL ES 2.0"

* commit '2fa3eec0e1807f6a45b71a41624698e8cc949026':
hwui: add extension to support unpack operations in OpenGL ES 2.0
d538d30e2f498de12a46e2aa3b0814c8d9526226 04-Aug-2015 xiaozhengdong <xiaozhengdong@xiaomi.com> hwui: add extension to support unpack operations in OpenGL ES 2.0

OpenGL ES 3.0+ lets us specify the row length for unpack operations
such as glTexSubImage2D(). This allows us to upload a sub-rectangle
of a texture. Also, the GL_EXT_unpack_subimage extension can also
support this feature in OpenGL ES 2.0

Change-Id: Id43c2c55c5eaefbace67087c955f0b4324fb2c35
Signed-off-by: xiaozhengdong <xiaozhengdong@xiaomi.com>
/frameworks/base/libs/hwui/Extensions.h
041b985dbb2f75aa492236d46ab47dbda8c2c74e 25-Feb-2015 John Reck <jreck@google.com> Add null egl/gles stub support

Change-Id: I41372585202f69ef31a4ef95efc75fb7a1ff7289
/frameworks/base/libs/hwui/Extensions.h
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/Extensions.h
318ae7bb92869d99a05388c598ad105e7aa4cdbd 25-Sep-2013 Romain Guy <romainguy@google.com> Take SkBitmap's stride into account when uploading textures
Bug #10151807

Change-Id: I7ba4804fa3619088fea70eb55f10519fff0bf5f0
/frameworks/base/libs/hwui/Extensions.h
7f4307668b10467ee39d41c7ea29cf1ff238a835 13-Jun-2013 Romain Guy <romainguy@google.com> Add new Query class for debugging

This class can be used to perform occlusion queries. An occlusion query
can be used to test whether an object is entirely hidden or not.

Change-Id: Ida456df81dbe008a64d3ff4cb7879340785c6abf
/frameworks/base/libs/hwui/Extensions.h
e9bc11f7121dbe373b0cbe5779ee6a12d824492c 23-May-2013 Romain Guy <romainguy@google.com> Add PerfHUD ES profiling capabilities

The eglGetSystemTimeNV extension can be used to enable profiling
in PerfHUD ES. When the delta of two calls to eglGetSystemTimeNV
equals 0, we now cancels display lists updates. This allows the
tool to redraw the same frame several times in a row to run its
analysis.

For better results profiling should only be attempted after
setting viewroot.profile_rendering to true using adb shell
setprop.

Change-Id: I02e3c237418004cff8d6cb0b9a37126efae44c90
/frameworks/base/libs/hwui/Extensions.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/Extensions.h
df1dc28ba0c63b195016ad0453fc58025ee82acb 30-Mar-2013 Romain Guy <romainguy@google.com> Add internal API to query GL version number

Change-Id: Idc02efc237b8e97445a9bab05c291bf193c7f279
/frameworks/base/libs/hwui/Extensions.h
3bbacf27c0be1bae4e4483577fc89ae3113abe5d 07-Feb-2013 Romain Guy <romainguy@google.com> Add a RenderBuffer object to store stencil buffers.
Bug #7146141

This change is needed to add a render buffer cache to avoid
creating and destroying stencil buffers on every frame.

This change also allows the renderer to use a 1 bit or 4 bit
stencil buffer whenever possible.

Finally this change fixes a bug introduced by a previous CL
which causes the stencil buffer to not be updated in certain
conditions. The fix relies on a new optional parameter in
drawColorRects() that can be used to avoid performing a
quickReject on rectangles generated by the clip region.

Change-Id: I2f55a8e807009887b276a83cde9f53fd5c01199f
/frameworks/base/libs/hwui/Extensions.h
85ef80d8902afe8d26cb75fa7837fd9e6d019620 14-Sep-2012 Romain Guy <romainguy@google.com> Foundation for tiling optimization

Change-Id: I4db32a4749f196472ba0dde7e102439d2ba4a3a7
/frameworks/base/libs/hwui/Extensions.h
63553478130f78d44c8fbeaebc610e19925544a5 19-Jul-2012 Romain Guy <romainguy@google.com> Remove vendor specific precision qualifier

Change-Id: I0a56ca7a5a399ec94993d3cea0c4aff6c0f86e39
/frameworks/base/libs/hwui/Extensions.h
dfa1046ecab165eb0daf5caa8475e993350f4a2b 13-May-2012 Romain Guy <romainguy@google.com> Add call sites for OpenGL's debug label extension

Change-Id: I9c689127e8166cbef92c935f8aa07217ab806dda
/frameworks/base/libs/hwui/Extensions.h
13631f3da855f200a151e7837ed9f6b079622b58 31-Jan-2012 Romain Guy <romainguy@google.com> Add debug markers to OpenGLRenderer

These markers will be used to group the GL commands by View in the
OpenGL ES debugging tool. This will help correlate individual GL
calls to higher level components like Views.

Change-Id: I73607ba2e7224a80ac32527968261ee008f049c6
/frameworks/base/libs/hwui/Extensions.h
5baa3a62a97544669fba6d65a11c07f252e654dd 20-Dec-2011 Steve Block <steveblock@google.com> Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/156016

Bug: 5449033
Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
/frameworks/base/libs/hwui/Extensions.h
9c4b79af221b53f602f946faa9ff317a596a0c39 11-Nov-2011 Romain Guy <romainguy@google.com> Discard framebuffer rendering queues when discarding layers
Bug #5581817

Change-Id: Ie30700a29059d2ea60eb7bd3f8bd20ac48a149ab
/frameworks/base/libs/hwui/Extensions.h
7077506f9945b87b02bdd47ffce75a5b813c821c 14-Nov-2011 Dave Burke <daveburke@google.com> Revert "Discard framebuffer rendering queues when discarding layers"

This reverts commit da96f8ac2c1c35a54f3f36e6d776cb386a251d03.
/frameworks/base/libs/hwui/Extensions.h
da96f8ac2c1c35a54f3f36e6d776cb386a251d03 11-Nov-2011 Romain Guy <romainguy@google.com> Discard framebuffer rendering queues when discarding layers
Bug #5581817

Change-Id: If612846ec5f7793710fc4df152791fb32c506551
/frameworks/base/libs/hwui/Extensions.h
a60c3889718f4513a6c9d8b80f655db5d6346905 02-Aug-2011 Romain Guy <romainguy@google.com> Use high precision iterators on specific GPUs
Bug #5098359

Change-Id: I52ee8c7b4c9e8d4c7bedb684eaf7bef6c44c74b9
/frameworks/base/libs/hwui/Extensions.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/Extensions.h
a5aed0d58962a24c44728ffc46dc9e1ba2f9fda5 09-Sep-2010 Romain Guy <romainguy@google.com> Add support for advanced blend modes with the framebuffer.

This adds the ability to blend with the framebuffer using Darken,
Lighten, Add, Multiply, Overlay and Screen.

Change-Id: Iae01a53797d4ad39c373cba6ff2a42293129da1a
/frameworks/base/libs/hwui/Extensions.h
db1938e0e6ef816e228c815adccebd5cb05f2aa8 03-Aug-2010 Romain Guy <romainguy@google.com> Add support for ColorFilters.

Color filters are fully supported and can be used with shaders.

Change-Id: Id90ccf1c81cb462f2431f366f3f8f710d7971e04
/frameworks/base/libs/hwui/Extensions.h
51769a68a5cb34e9564740c6a854fcb93018789d 23-Jul-2010 Romain Guy <romainguy@android.com> Cleanup, added properties for the FontRenderer.

Change-Id: I909c74815d3ac394438ad8071d17fef5401dbeed
/frameworks/base/libs/hwui/Extensions.h
bd0e6aa0ff0bd8b376772c3e23513a6021bdda87 23-Jul-2010 Romain Guy <romainguy@google.com> Add a way to query GL extensions.

Change-Id: Ic27dbf72289dacf641b640a749fbd40c12cd474f
/frameworks/base/libs/hwui/Extensions.h