History log of /frameworks/base/libs/hwui/Caches.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
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/Caches.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/Caches.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/Caches.cpp
dcbc0e9e25bf99600d487f3c6f5e26487545cd9c 14-Sep-2016 sergeyv <sergeyv@google.com> resolve merge conflicts of 0ec2fd7 to master

Change-Id: I113ede26ab42e3f9a36a52a756c38d365731e16d
af102bee518191f1e6ad843f06dcd7a64611462d 10-Sep-2016 sergeyv <sergeyv@google.com> HWUI: track upload & recent usage in font cache

FontCacheHistoryTracker should be turned off before shipping: b/31438876

bug:30427106
Change-Id: Ic26b25e790d4ee69e484ca0cb23dc9cc522b2ed3
/frameworks/base/libs/hwui/Caches.cpp
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/Caches.cpp
56ad6ec42f814e9e61030ff819cac4e5d31def8b 22-Jul-2016 Derek Sollenberger <djsollen@google.com> Remove LayerRenderer.

There is only one caller each for the static functions here so this
CL moves the logic to the caller. Also by moving some of the code
into the pipeline it makes it easier for future changes to configure
how a pipeline handles a layer.

Change-Id: Ib735b5154325cbb658fd151f7a19dbf434ab44b7
/frameworks/base/libs/hwui/Caches.cpp
5e00c7ce063116c11315639f0035aca8ad73e8cc 07-Jul-2016 Chris Craik <ccraik@google.com> Delete old rendering pipeline

fixes: 30002246

Change-Id: I45df0e924708526cee045b14c291bd23aa1a92db
/frameworks/base/libs/hwui/Caches.cpp
fd3744b7d88d0015cfb36be2b485c4b6ba0c1b58 12-May-2016 sergeyv <sergeyv@google.com> Move gl calls from PatchCache to MeshState

bug:27358166
Change-Id: I5f544f497e9480e64faa2ddd369eb16318e82dc3
/frameworks/base/libs/hwui/Caches.cpp
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/Caches.cpp
89add11bb4c4a3cae38d84d1151e60617efb26a5 11-Dec-2015 John Reck <jreck@google.com> resolve merge conflicts of f1df0f59c1 to master.

Change-Id: Ia0ae0f753541f5203a4a3683721361c5e90ddae8
441cc421b51377ec27bf97ed690c63aa5509ae90 11-Dec-2015 Sangkyu Lee <geteuid@gmail.com> Fix memory leak in HWUI

std::unique_ptr::release just releases the ownership of the
managed object. To delete the object, std::unique_ptr::reset
function should be called.

Change-Id: If65f74085b1fc2be3a9fffc433326e0bcdb40ff3
/frameworks/base/libs/hwui/Caches.cpp
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/Caches.cpp
be4d8ddf1d5ff274ad9d814dbe7bbfdc7bc8486a 14-Nov-2015 Christopher Ferris <cferris@google.com> Fix bug where mExtensions was not initialized.

Recent changes to mExtensions moved the initialization code from the
constructor to a separate function called load. Make sure to call
this function in the initExtensions function call.

Bug: 25615666

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

Bug: 25426213
Change-Id: I88e6206e8915cce95c3a8a8a82a4bb8fbf668141
/frameworks/base/libs/hwui/Caches.cpp
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/Caches.cpp
b9ce116dac378b4cf4490f265dcbd5704a1dd43c 21-Aug-2015 Chris Craik <ccraik@google.com> Switch several enums to enum classes

Change-Id: I00ecd0b61657196b51704f70ca31a9d1c1ac254e
/frameworks/base/libs/hwui/Caches.cpp
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/Caches.cpp
9e5f4af1ed29c28b77c432804bd508b2aabd31d1 24-Jul-2015 John Reck <jreck@google.com> am 11f9da31: am bdb2a905: am d08fb687: am e5783e58: am 2abf0f24: Fix a race condition that could cause lockup

* commit '11f9da310ac3129cd859ef98f7f10d897308a59b':
Fix a race condition that could cause lockup
2abf0f24af60b8644d5b61eed9666793083546ee 23-Jul-2015 John Reck <jreck@google.com> Fix a race condition that could cause lockup

Bug: 22676664

If a task is queued on a worker thread that is busy
processing a task AND a trim memory signal comes along
prior to the initial task being completed then the
tasks that were queued prior to the exit request will
never be processed.

This is bad, as when those futures are used later on, such
as in trying to delete them from the cache, they will block
waiting for the orphaned task to be finished.

Simple fix is to just never stop the worker threads. Increase
RAM usage slightly as we won't reclaim that stack space, but
this cost is fairly small

Change-Id: I818b011f9bc6ba06942fdad81c27656bd97b42d4
/frameworks/base/libs/hwui/Caches.cpp
5a4690bf26932c0d6940e4af8516d920e09ae81a 14-Jul-2015 Chris Craik <ccraik@google.com> Clean up unncessary defines

LOG_TAG and TRACE_TAG are already defined in the makefile

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

Bug: 20297820

Change-Id: I37c63bab6f6c0d2337c8c6002046d2ef17e74097
/frameworks/base/libs/hwui/Caches.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/Caches.cpp
db663fe83f976107fd8fd9307d871b37d9e47370 20-Apr-2015 Chris Craik <ccraik@google.com> Rename native DisplayListRenderer to DisplayListCanvas

Change-Id: I33e6f8cc85da1e7da7ff7bf18d4ebde64222067a
/frameworks/base/libs/hwui/Caches.cpp
fb10ffe484b04a77c3aaf8a78ed87d018a6edcda 26-Feb-2015 John Reck <jreck@google.com> Merge "Add null egl/gles stub support"
041b985dbb2f75aa492236d46ab47dbda8c2c74e 25-Feb-2015 John Reck <jreck@google.com> Add null egl/gles stub support

Change-Id: I41372585202f69ef31a4ef95efc75fb7a1ff7289
/frameworks/base/libs/hwui/Caches.cpp
06518aa8deff2808b873b2639e9949a369bb6576 20-Feb-2015 ztenghui <ztenghui@google.com> Merge "Correctly name the lightRadius"
62aa44c5eef2b1e888f0eee8841dc87074eaa0e8 20-Feb-2015 ztenghui <ztenghui@google.com> Correctly name the lightRadius

b/18282208

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

Change-Id: I2d902819d5d77f496b67d4d25a298782903e410d
/frameworks/base/libs/hwui/Caches.cpp
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/Caches.cpp
34725687748cc2b4ace2bdb49becfdcd569e9a5d 05-Feb-2015 Chris Craik <ccraik@google.com> Don't try to fully tear down program in terminate()

bug:19277550

The program will be destroyed anyway by nature of the program cache cleanup.

Change-Id: I304becd34fdf40baf314bae8b37d2c072ad44409
/frameworks/base/libs/hwui/Caches.cpp
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/Caches.cpp
44eb2c00861098dd3e2950d923646814b4cc57c2 29-Jan-2015 Chris Craik <ccraik@google.com> Refactor blending and texture gl state

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

Change-Id: I6c0cc82db14b56297586469f940e408c0e218b3b
57998017ff137f7d4ec33df21b6596141f8c4547 29-Jan-2015 John Reck <jreck@google.com> Allow ~Layer() to happen after onGLContextDestroyed

Bug: 19146354
Change-Id: I9e885936168bd541bfbed4064ad67ab524f58e32
/frameworks/base/libs/hwui/Caches.cpp
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/Caches.cpp
65fe5eeb19e2e15c8b1ee91e8a2dcf0c25e48ca6 27-Jan-2015 Chris Craik <ccraik@google.com> Move scissor state to RenderState

Change-Id: I1227a3886fb24e4d9fad79fca469794f06cfb15e
/frameworks/base/libs/hwui/Caches.cpp
d41c4d8c732095ae99c955b6b82f7306633004b1 06-Jan-2015 Chris Craik <ccraik@google.com> Add overrides and switch to nullptr keyword for all files

Adds remaining missing overrides and nullptr usages, missed due to
an extreme failure in tool usage.

Change-Id: I56abd72975a3999ad13330003c348db40f59aebf
/frameworks/base/libs/hwui/Caches.cpp
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/Caches.cpp
a2732a2bf98f7dbd063f4e5679f5b8bfcbec2698 18-Dec-2014 John Reck <jreck@google.com> Stop pretending USE_OPENGL_RENDERER is a thing

Change-Id: I732b490431fe90eafa00a00f3b5429f0d3a067e6
/frameworks/base/libs/hwui/Caches.cpp
59cf734f9ee8fa0154d199f0f36779a6ffe0dfb5 11-Dec-2014 Yohann Roussel <yroussel@google.com> resolved conflicts for merge of d67bb501 to master

Change-Id: I40698ce1e382cb41eec7af5ea49ac0e2f997d555
ebd52610cfeff6e557fde284a7e1efc5e6438285 11-Dec-2014 John Reck <jreck@google.com> Don't preload textures for AssetAtlas

Bug: 18317479

RenderNode::prepareSubTree calls prefetchAndMarkInUse
on every bitmapResoruce in the DisplayList. However,
this resulted in textures being uploaded for bitmaps
that would be drawn from the AssetAtlas instead.

To fix this we teach TextureCache about the AssetAtlas
so that calls to TextureCache return the Texture from
AssetAtlas if it exists. Thus usage of AssetAtlas
is now purely to allow for further optimizations via
draw merging instead of a requirement to get
any benefit at all.

Change-Id: I65282fa05bac46f4e93822b3467ffa0261ccf200
/frameworks/base/libs/hwui/Caches.cpp
27eaec23881f9564f98b484765d000822de5fdc3 18-Nov-2014 John Reck <jreck@google.com> am 842697a3: am decc26df: am f0f68117: Merge "Trace some interesting events" into lmp-mr1-dev

* commit '842697a3602204036e991cfea8b74da3df6e7f14':
Trace some interesting events
fbc8df03e498baf47ff1a5e05e182f1bcd60c770 15-Nov-2014 John Reck <jreck@google.com> Trace some interesting events

Bug: 18337099
Change-Id: Ie2e60da2b9f06e0368061c944d8123ab6903355c
/frameworks/base/libs/hwui/Caches.cpp
6398d2d42e20b751509ba1c60632bf6cf61a6b71 03-Nov-2014 John Reck <jreck@google.com> am 8a8a4055: am 541641d0: Merge "Fix counting" into lmp-mr1-dev automerge: 5c8d135

* commit '8a8a40556ea3b0fb4cc8cd1ec063fb9988db497f':
Fix counting
88f5fc7c5a9fb1e677c508165f732cd76f5eef3a 03-Nov-2014 John Reck <jreck@google.com> Fix counting

Change-Id: I9a3568908a7223d69430c1765fb5a4db96d7ac9c
/frameworks/base/libs/hwui/Caches.cpp
9481684560b2815d2706512086bb36467ef6acc0 01-Nov-2014 John Reck <jreck@google.com> am e05575e9: am a8d83d63: Merge "Layer changes" into lmp-mr1-dev automerge: a51fba0

* commit 'e05575e9c36850d8cfe49396ac9a1372511b12bf':
Layer changes
0e89e2b7bcb2c035e8cee77f93120e7c5617f8d2 31-Oct-2014 John Reck <jreck@google.com> Layer changes

Bug: 17208461

* Switch Layer to be VirtualLightRefBase instead of
Caches' side-channel ref-counting
* Include active layers in gfxinfo dump
* Run gfxinfo dump on the correct thread
* Dump gfxinfo on Layer creation failure

Change-Id: I28d195699e2334518e215ab28c7a17355aee9678
/frameworks/base/libs/hwui/Caches.cpp
2dc236b2bae13b9a0ed9b3f7320502aecd7983b3 15-Oct-2014 Tom Hudson <tomhudson@google.com> Clean up physical coupling

Narrow the use of #include directives in hwui, replacing with forward
declarations where straightforward. Speeds compiles; doesn't do any
restructuring of code.

Change-Id: Icac2baffb5896f55d8c6718e9bd9d4bfa02d3ca0
/frameworks/base/libs/hwui/Caches.cpp
4ced2620b730a7c7140f73da503946f9827442bc 19-Sep-2014 John Reck <jreck@google.com> glFinish to flush deletes

Bug: 17479800
Change-Id: I4d4a3eeda510e037f806052025184f3cde18c847
/frameworks/base/libs/hwui/Caches.cpp
bfd1cd620991ac2fa9202fdce6c00ec47d071935 10-Sep-2014 Chris Craik <ccraik@google.com> Additional layer logging

bug:17208461

Track layer's last known state.

Change-Id: Ic1799191f5839a1d6cc56f598f2ac2671dc27a6f
/frameworks/base/libs/hwui/Caches.cpp
70735bd5ddd6ba3063d5537f510324cb2515aba6 29-Aug-2014 Fred Fettinger <fred.fettinger@motorola.com> hwui: Caches: use mBoundTextures only for GL_TEXTURE_2D

bug:17441218

GLConsumer uses glBindTexture() directly instead of going through
Caches::bindTexture(). This can cause libhwui to draw with the wrong
texture bound in the following case which involves 2 TextureViews:

Frame 1:
GLConsumer::updateTexImage() calls glBindTexture(GL_TEXTURE_EXTERNAL_OES, 1)
HWUI renders TextureView A:
calls Caches::bindTexture(GL_TEXTURE_EXTERNAL_OES, 1) and draws

Frame 2:
GLConsumer::updateTexImage() calls glBindTexture(GL_TEXTURE_EXTERNAL_OES, 1)
GLConsumer::updateTexImage() calls glBindTexture(GL_TEXTURE_EXTERNAL_OES, 2)
HWUI renders TextureView A:
calls Caches::bindTexture(GL_TEXTURE_EXTERNAL_OES, 1) and draws
HWUI renders TextureView B:
calls Caches::bindTexture(GL_TEXTURE_EXTERNAL_OES, 2) and draws

In this case, HWUI will incorrectly draw TextureView A using texture 2 on
frame 2, because mBoundTextures[0]=1, even though the texture currently
bound to GL_TEXTURE_EXTERNAL_OES is 2.

Since GLConsumer is always used with a target of GL_TEXTURE_EXTERNAL_OES,
work around this problem by having mBoundTextures[] store only the
textures bound to the target GL_TEXTURE_2D. This is the common case
where the extra performance is needed. Since it's legal to have
different textures bound to GL_TEXTURE_2D and GL_TEXTURE_EXTERNAL_OES
on one texture unit, Caches::bindTexture() does not need to clear
mBoundTextures[mTextureUnit] when target != GL_TEXTURE_2D.

Change-Id: I8bc54ab8adcfacad7f3ed17a31236dc7a86c967a
Signed-off-by: Fred Fettinger <fred.fettinger@motorola.com>
/frameworks/base/libs/hwui/Caches.cpp
17035b0211a3c9d45ea46a99217a6acbe76e8fbe 03-Sep-2014 John Reck <jreck@google.com> Have destroy call freePrefetchedLayers

Bug: 17208461

There's a potential race condition between HardwareRenderer.destroy()
being called (which calls destroyCanvasAndSurface()) and the renderer
being finalized (which is what calls freePrefetchedLayers), during which
time it's possible we get a TRIM_MEMORY_COMPLETE and destroy the EGL
context.

Fix this race condition by moving stopDrawing() and freePrefetchedLayers()
into destroyCanvasAndSurface() where they should have been in the first
place.

Also, if we hit the assertion failure, dump the current state of
Caches to try and provide more context for the failure.

Change-Id: Ife0ba3562041e8b08e87e3e13640472b3004eed6
/frameworks/base/libs/hwui/Caches.cpp
14a4e35208b7e97bbfa38f36130827c86bfafc2b 13-Aug-2014 ztenghui <ztenghui@google.com> Bring back the shadow strength tweak

bug:16712006

Change-Id: Ifc0ecca139d58140b45d7d227536a53069e1d480
/frameworks/base/libs/hwui/Caches.cpp
a736cd9d3587a120e5233d627cd8bf06353be107 04-Aug-2014 Chris Craik <ccraik@google.com> Remove scaling bucket hack

bug:16626221

Fixes glyph cache pressure and double scaling artifacts.

Change-Id: I06cde720db646531b45943283cb4ecb48af8ff5b
/frameworks/base/libs/hwui/Caches.cpp
58ddced27752b5e47b0d42fec66f8dcfde070ec1 17-Jul-2014 Chris Craik <ccraik@google.com> Initializing variables - generally a good practice

Change-Id: Ib29a69f741eda869701493bb04e155d786e6e402
/frameworks/base/libs/hwui/Caches.cpp
59744b79ec302000802cd56d30a1bf70f0183c80 02-Jul-2014 Chris Craik <ccraik@google.com> Add hack for custom re-rasterization buckets

bug:14083128

Moves all of the font transform management into
OpenGLRenderer::findBestFontTransform(), and now simply passes down
final rasterization transforms into the FontRenderer.

Change-Id: Ie02752e6af863347b142367c7d628db5f9fc2998
/frameworks/base/libs/hwui/Caches.cpp
0732ba5756296f1ae3da48a39e4d498aba366386 17-Jun-2014 Chris Craik <ccraik@android.com> am 88b1c9ad: am e709d53f: am 0d28bb47: Merge "Fix the texture ID reuse issue in HWUI."

* commit '88b1c9ad87ca6d6faaf824bff4ee9d3c799362e5':
Fix the texture ID reuse issue in HWUI.
4a473c7d9406a2d6f6792f0f48d933424740ec5c 10-Jun-2014 jiayuanr <jiayuanr@codeaurora.org> Fix the texture ID reuse issue in HWUI.

Issue: When the layer of previous frame is destroyed, it doesn't clear the
texture id in mBoundTextures[mTextureUnit], so in the next frame, if
glGenTexture returns same texture ID of the previous frame,
the new texture is not bound.

CRs-fixed: 671736

Change-Id: Ifc5fd2115fb1863b3c006ab14b0faabeaeb4eab4
/frameworks/base/libs/hwui/Caches.cpp
05f3d6e5111fd08df5cd9aae2c3d28399dc0e7f5 03-Jun-2014 Chris Craik <ccraik@google.com> Tessellate on worker threads

Tessellate and cache (where possible) shadow and round rect
tessellation tasks.

Change-Id: I2cfda8e11d83d51ea74af871235cf26e8f831d40
/frameworks/base/libs/hwui/Caches.cpp
797b95b26bbb7557678af78b9a2a61830158920f 21-May-2014 Chris Craik <ccraik@google.com> Define light position (using new lighting spec) in Java

Also updates the relative shadow strengths.

Change-Id: I6cac7275d38df98aea9f0dda463cd7207102986a
/frameworks/base/libs/hwui/Caches.cpp
f5be3ca5cc5b3a10747b577f60059a99862bb9a8 01-May-2014 Chris Craik <ccraik@google.com> Add more shadow control knobs

Change-Id: I1ff500bf429029a97b681ced9df652f4ee9f1332
/frameworks/base/libs/hwui/Caches.cpp
087bc0c14bdccf7c258dce0cdef46a69a839b427 05-Apr-2014 John Reck <jreck@google.com> Refcount RenderNode

Change-Id: I7a86db8acc2b78ef33d987a43a119f5933d7d752
/frameworks/base/libs/hwui/Caches.cpp
50ecf849cb7ccc3482517b74d2214b347927791e 12-Mar-2014 ztenghui <ztenghui@google.com> Create one hole inside the umbra area to avoid overdraw.

bug:13439450

Change-Id: I859575196bd5a3029f447883025a6ec3a1f1face
/frameworks/base/libs/hwui/Caches.cpp
e18264b079481a244b30e3f71012c53bbd861f92 12-Mar-2014 John Reck <jreck@google.com> Rename DisplayList->RenderNode

Change-Id: Id42e23c9a1a6eb6eaeafef707ced7fa6887b03d0
/frameworks/base/libs/hwui/Caches.cpp
e361ad7ab15fcf4919a56a6293689d968ee8dcff 11-Mar-2014 Chris Craik <ccraik@google.com> Remove experimental perspective projection

Change-Id: Iad688c8395ccd4673cc129973802b5f01dfb45ba
/frameworks/base/libs/hwui/Caches.cpp
726118b35240957710d4d85fb5747e2ba8b934f7 08-Mar-2014 Chris Craik <ccraik@google.com> Improve shadow tessellation performance

- Tune and simplify shadow parameters
- Remove additional inner rings
- Improve polygon ray casting algorithm

Change-Id: If0f28b2d66ae0480b675942bb65e8fcd2864425d
/frameworks/base/libs/hwui/Caches.cpp
63d41abb40b3ce40d8b9bccb1cf186e8158a3687 14-Feb-2014 ztenghui <ztenghui@google.com> Use pre-computed index to draw the shadow.

Also draw the umbra part as triangle fans instead of zig zag fashion.

b/12840179

Change-Id: Iaa5d15e77351acdd71f076bd8f9bb2d4d2b92faf
/frameworks/base/libs/hwui/Caches.cpp
ef94c6f88fbb1deb095b1494378befcdb9722839 14-Feb-2014 ztenghui <ztenghui@google.com> Separate spot and ambient shadow strength setting

Change-Id: I4530e618b09a7f44b5382f8a40646c0ebf5f214c
/frameworks/base/libs/hwui/Caches.cpp
cc3c25622c731d14a6f01bce684330eccba7db5a 17-Jan-2014 ztenghui <ztenghui@google.com> Property support for light positioning.

Tune up the light size to make it look better.

Change-Id: I139a05f3dd53dacbe55759b91188f0e1cc2c7f80
/frameworks/base/libs/hwui/Caches.cpp
ba9b613437c34873fa95800a25fc51720638267c 16-Dec-2013 Chris Craik <ccraik@google.com> Create private properties on GLCanvas for experimentation with 3d

Change-Id: I17772f61efce727cb4c1111f4d97f58c741786b8
/frameworks/base/libs/hwui/Caches.cpp
55bfb4e728fe1db619af5d2c287f4abe711b3343 03-Dec-2013 ztenghui <ztenghui@google.com> Calculate and show Ambient shadow.

Basically we compute the shadow as a strip of triangles, whose alpha value
is the strength of the shadow.
We use the normal to extend the geometry.
And we use static function and try to avoid new/malloc in the computation.

Change-Id: I382286f1cad351bd5ff983f76f446c075819dcaf
/frameworks/base/libs/hwui/Caches.cpp
627c6fd91377ead85f74a365438e25610ef1e2ee 21-Aug-2013 Romain Guy <romainguy@google.com> Add overdraw debugging that accounts for Deuteranomaly

Change-Id: I31f68a07aa7cf0490d2572e24e4c5ac2066a1151
/frameworks/base/libs/hwui/Caches.cpp
46bfc4811094e5b1e3196246e457d4c6b58332ec 17-Aug-2013 Romain Guy <romainguy@google.com> Fix hardware layers lifecycle
Bug #10075732

Hardware layers could survive across EGL terminate events.

Change-Id: Ie8565d55cb29fe6625fa1584d695edfecd37ab5e
/frameworks/base/libs/hwui/Caches.cpp
b0a41ed3dcc34a2b4026f6cc8336796f3523aa21 16-Aug-2013 Romain Guy <romainguy@google.com> Prevent ANR in apps using drawPath()
Bug #10347089

If an app clears its path cache before stopping background tasks, it could
get into an infinite loop in PathCache::trim().

Change-Id: Ieb865b762e7b00aebaba0c023769c2db286a94f5
/frameworks/base/libs/hwui/Caches.cpp
b746371de7f21ae36a14953d9b253df06838efb1 16-Aug-2013 Romain Guy <romainguy@google.com> Clear FBO cache on full memory flush

Change-Id: I44e06d5d15cd899a0522c62d7c0d042170665abb
/frameworks/base/libs/hwui/Caches.cpp
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/Caches.cpp
9ab2d1847552aa4169b4325aae1b1368d6947a9f 23-Jul-2013 Chris Craik <ccraik@google.com> Ensure glActiveTexture is cleaned up correctly on functor resume

Change-Id: I103d7d63b17289d599c2c08dcc442cfba9b8e51d
/frameworks/base/libs/hwui/Caches.cpp
e3b0a0117a2ab4118f868a731b238fe8f2430276 27-Jun-2013 Romain Guy <romainguy@google.com> Refcount 9-patches and properly handle GC events

This change adds refcounting of Res_png_9patch instances, the native
data structure used to represent 9-patches. The Dalvik NinePatch class
now holds a native pointer instead of a Dalvik byte[]. This pointer
is used whenever we need to draw the 9-patch (software or hardware.)

Since we are now tracking garbage collection of NinePatch objects
libhwui's PatchCache must keep a list of free blocks in the VBO
used to store the meshes.

This change also removes unnecessary instances tracking from
GLES20DisplayList. Bitmaps and 9-patches are refcounted at the
native level and do not need to be tracked by the Dalvik layer.

Change-Id: Ib8682d573a538aaf1945f8ec5a9bd5da5d16f74b
/frameworks/base/libs/hwui/Caches.cpp
31e08e953fe7bdb1b1cbc247156cb6a19917a2f1 19-Jun-2013 Romain Guy <romainguy@google.com> Share Caches' index buffer with FontRenderer

This reduces state changes when we draw 9patches and text together,
which happens *a lot*. Also disable the NV profiling extension by
default since it doesn't play nice with display lists deferrals.
To enable it set debug.hwui.nv_profiling to true.

Change-Id: I518b44b7d294e5def10c78911ceb9f01ae401609
/frameworks/base/libs/hwui/Caches.cpp
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/Caches.cpp
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/Caches.cpp
8aa195d7081b889f3a7b1f426cbd8556377aae5e 05-Jun-2013 Romain Guy <romainguy@google.com> Introduce Caches::bindTexture() to reduce glBindTexture calls

Change-Id: Ic345422567c020c0a9035ff51dcf2ae2a1fc59f4
/frameworks/base/libs/hwui/Caches.cpp
f9f0016b1ff816eb2c7561eed482c056189005f8 09-May-2013 Romain Guy <romainguy@google.com> Enable GPU pixel buffers on OpenGL ES 3.0 devices

Change-Id: I164d72ccd7a9bf6ae0e3f79dfef50083558937ba
/frameworks/base/libs/hwui/Caches.cpp
78dd96d5af20f489f0e8b288617d57774ec284f7 03-May-2013 Romain Guy <romainguy@google.com> Add an on-screen overdraw counter

The counter can be enabled by setting the system property called
debug.hwui.overdraw to the string "count". If the string is set
to "show", overdraw will be highlighted on screen instead of
printing out a simple counter.

Change-Id: I9a9c970d54bffab43138bbb7682f6c04bc2c40bd
/frameworks/base/libs/hwui/Caches.cpp
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/Caches.cpp
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/Caches.cpp
c5cbee7d78513527e89450e6369a30a04b2d5e7a 21-Mar-2013 Romain Guy <romainguy@google.com> Stop worker threads on memory trim & fix bad pointer access

Change-Id: I6fe7e31aeb6dd41fa65ab952caed97bc2da510d7
/frameworks/base/libs/hwui/Caches.cpp
c46d07a29e94807e768f8b162ce9f77a88ba6f46 16-Mar-2013 Romain Guy <romainguy@google.com> Merge all shapes/paths caches to PathCache

This change will greatly simplify the multi-threading of all
shape types.

This change also uses PathTessellator to render convex paths.

Change-Id: I4e65bc95c9d24ecae2183b72204de5c2dfb6ada4
/frameworks/base/libs/hwui/Caches.cpp
ff78583d8a73ca35ce65b5d2592570ff6fb9901b 08-Mar-2013 Chris Craik <ccraik@google.com> Fully deferred displaylist replay

bug:8037003

A recursive drawDisplayList call is now entirely deferred before
playing back to the screen and issuing GL commands. This way, the
entire stream can be inspected, optimized, and batch work (such as
uploading textures) before issuing commands.

Additionally, this fixes an issue where operations draw could move
across restores corresponding to saveLayer(alpha). Those and other
similar cases (such as complex clipping, requiring the stencil) are
now treated as batching barriers, with the operations that change
renderer state in a way that's difficult to defer are just re-issued
at flush time.

Change-Id: Ie7348166662a5ad89fb9b1e87558334fb826b01e
/frameworks/base/libs/hwui/Caches.cpp
0f6675332c04c74909425d1d328f02b32c0ff40e 01-Mar-2013 Romain Guy <romainguy@google.com> Precache glyphs at final raster size

The deferred display lists model now allows us to precache glyphs
at their exact size on screen.

This change also removes debug markers when the renderer defers
and reorders display lists. It also adds a flush event marker.

Change-Id: I66ec5216dc12b93ecfdad52a7146b1cfb31fbeb4
/frameworks/base/libs/hwui/Caches.cpp
3ff0bfdd144bba3b023eda8c49b25fb0d0de8653 25-Feb-2013 Romain Guy <romainguy@google.com> Add new property to debug non-rectangular clip operations

This change adds a new property called "debug.hwui.show_stencil_clip"
that accepts the following values:

- "highlight", colorizes in green any drawing command that's tested
against a non-rectangular clip region
- "region", shows the non-rectangular clip region in blue every time
it is used
- "hide", default value, nothing is shown

Change-Id: I83c8602310edc4aaeb8b905371cdd185b17d32b5
/frameworks/base/libs/hwui/Caches.cpp
ff316ec7a76e52572a2e89b691e6b3bba0cafba3 14-Feb-2013 Romain Guy <romainguy@google.com> Implement support for drawBitmapMesh's colors array

Change-Id: I3d901f6267c2918771ac30ff55c8d80c3ab5b725
/frameworks/base/libs/hwui/Caches.cpp
8d4aeb7111afac0c3c7e56d4ad5d92f9cfce2ffd 13-Feb-2013 Romain Guy <romainguy@google.com> Add a render buffer cache to reuse stencil buffers
Bug #7146141

This new cache is used in a similar way to LayerCache. It helps
reuse already allocated stencil buffers and thus avoid churning
memory on every frame.

Change-Id: I19551d72da52c40039e65904563600e492c8b193
/frameworks/base/libs/hwui/Caches.cpp
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/Caches.cpp
c2a972131f1870042eb63847d4b24fbe718d8e3f 07-Feb-2013 Romain Guy <romainguy@google.com> Fix uninitialized variables in Caches.cpp
Bug #8151401

Change-Id: I221f93de0f1981974f82a094297836dd3fe418bc
/frameworks/base/libs/hwui/Caches.cpp
f735c8e5cb59d6e1d1aa152fed7a6480a08d1c2a 01-Feb-2013 Romain Guy <romainguy@google.com> Fix tiling on QCOM GPU

Rename Caches::startTiling parameter from opaque to discard to
make it clearer what its role is. Tweak calls to startTiling
to preserve the buffer when needed and discard it when possible.

Change-Id: If7f8ff19003f79f36885a0a7207cc61901f637d2
/frameworks/base/libs/hwui/Caches.cpp
5bb3c730f5ebd2a0db1b02a8981c6fdbea6c1a2e 30-Nov-2012 Romain Guy <romainguy@google.com> Apply dev. settings at runtime
Bug #7434649

Change-Id: I16f00eaa8a5eefd9f9849e196cf2cb1659215390
/frameworks/base/libs/hwui/Caches.cpp
aa42c9af6ea2158a685ebf9b338e6d2355712268 17-Oct-2012 Chet Haase <chet@google.com> Correctly adjust clip regions that lie offscreen

We were clamping the x/y location of the scissor to 0,0, but not adjusting
the width/height appropriately. This fix adjusts width/height and also clamps
them to 0 to correctly clip out offscreen operations.

Issue #7221524 Top left and top right portions of the screen blanks out after some time

Change-Id: I47f23336ea612409ed86652b9a68e272819ef00e
/frameworks/base/libs/hwui/Caches.cpp
50ae66a554126fadee2054e0d01a9e57150cedb5 07-Oct-2012 Romain Guy <romainguy@google.com> Work around a possible driver bug
Bug #7296475

When re-enabling the scissor the driver seems to ignore the already
existing scissor box. This change resets the scissor box when the
test state changes.

Change-Id: I3a68433164f99d21fbab769a26c56fe416c1539a
/frameworks/base/libs/hwui/Caches.cpp
6a2d17f71342f981c9df1dc5beff33e30eb3ae2b 30-Sep-2012 Chet Haase <chet@google.com> Fix texture corruption

When memory gets low on a device, activities flush everything they can.
Hardware-accelerated activites, such as Launcher, flush GL resources and destroy
the GL context. However, some resources were still hanging around, due to deferred
destruction policies (we don't delete layers until the DisplayLists they are in
are finalized, to ensure we don't deref deleted objects). This meant that we were
referring to obsolete GL data in these objects. in particular, it meant that we might
come around later, after a new GL context was created, and delete a texture object
that was incorrect. We use the layer's "texture id" to refer to the texture underlying the
layer. But if there's a new GL context, then this texture ID is no longer valid, and
we may be deleting the texture that a different object (layer, icon, whatever) is referring
to, because the driver may return that same ID under the new GL context.

The fix is to more aggressively delete things that we know will not be used again
when the GL context is destroyed. In particular, we delete all resources being used
by all DisplayLists at GL context destruction time.

Issue #7195815 Textures corruption on all devices, in many apps

Change-Id: I52d2d208173690dbb794a83402d38f14ea4c6c22
/frameworks/base/libs/hwui/Caches.cpp
a852ff3a4b637e8101c2f54e110467586fe604cf 28-Sep-2012 Romain Guy <romainguy@google.com> Merge changes I9873540e,I4f6c38e3 into jb-mr1-dev

* changes:
Skia's ColorMatrix vector is in the 0..255 range not 0..1 Bug #7248980
Don't use the QCOM_tiled_rendering extension with functors Bug #7247880
54c1a64d5441a964890b44280e4457e11f4f924a 28-Sep-2012 Romain Guy <romainguy@google.com> Don't use the QCOM_tiled_rendering extension with functors
Bug #7247880

Change-Id: I4f6c38e37b953c58e6107097c613891a49dac766
/frameworks/base/libs/hwui/Caches.cpp
cb4d6009576cf08195dc23f341a3f4939c0878bb 25-Sep-2012 Chris Craik <ccraik@google.com> Add stroke support to polygonal shape rendering

bug:4419017
bug:7230005

- Adds support for stroke/strokeAndFill for shapes without joins
- Fixes path-polygonization threshold calculation
- Fixes rendering offset (now only used for points)
- Several formatting fixes

Change-Id: If72473dc881e45752e2ec212d0dcd1e3f97979ea
/frameworks/base/libs/hwui/Caches.cpp
17ef62cc1f9d092669af0fed465a9a77e0dc1a4f 26-Sep-2012 Mathias Agopian <mathias@google.com> fix a possible dead-lock when clearing caches

Bug: 7195815
Change-Id: I8e226b7ec445f9f4fe46ae216ef7cc41efc5a0fd
/frameworks/base/libs/hwui/Caches.cpp
54643d72f86d0ee0b23e3643ac9257d52ddfae6b 26-Sep-2012 Mathias Agopian <mathias@google.com> make sure to destroy GL objects on the GL thread

Bug: 7195815
Change-Id: I5bcac61cd0b903d1ccca0754fdb9cb1023efbe0f
/frameworks/base/libs/hwui/Caches.cpp
4285de3c8bc77856a2df98894f74bb7333f1d348 23-Sep-2012 Romain Guy <romainguy@google.com> Fix overdraw debug on QCOM

Disable the use of the tiling extension when overdraw debug is
turned on.

Change-Id: Ib0a0b7d1998146aa0c7efef2d3822f9997efb123
/frameworks/base/libs/hwui/Caches.cpp
7c450aaa3caac2a05fcb20a177483d0e92378426 22-Sep-2012 Romain Guy <romainguy@google.com> Add support for a new developer setting: overdraw debugging

Change-Id: I350ba4486577c3289f82c20938f7a35138778727
/frameworks/base/libs/hwui/Caches.cpp
57b5268708c3b974296c7d4e58a02a957979224a 21-Sep-2012 Romain Guy <romainguy@google.com> Optimize tiling management
Bug #7186819

Change-Id: Iebc42a6e9c96ad5605fbbe1539aa887695d2e829
/frameworks/base/libs/hwui/Caches.cpp
2b7028eabac80cec170572bc0e945a1d4224e595 20-Sep-2012 Romain Guy <romainguy@google.com> Add support for QCOM_tiled_rendering
Bug #7186819

This optional OpenGL extension can be used by tiled renderers to optimize
copies from main memory to tiles memory.

Change-Id: Id4a5d64e61ad17f50e773e8104b9bf584bb65077
/frameworks/base/libs/hwui/Caches.cpp
35643ddc689913f5b5f80ceed864470d987bd6cd 19-Sep-2012 Romain Guy <romainguy@google.com> Minimize state changes when updating layers

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

Change-Id: I4db32a4749f196472ba0dde7e102439d2ba4a3a7
/frameworks/base/libs/hwui/Caches.cpp
4ff0cf4b83605bff630c4e6f1fabe4f72a3f93a1 06-Aug-2012 Romain Guy <romainguy@google.com> Add new debug tool to track hardware layers updates

You can setprop debug.hwui.show_layers_updates true to flash
hw layers in green when they update. This is also a setting
in the Dev. section of the settings app.

Change-Id: Ibe1d63a4f81567dc1d590c9b088d2e7505df8abf
/frameworks/base/libs/hwui/Caches.cpp
211efea7376371ee755edd2ad03e83ef6eea464e 01-Aug-2012 Romain Guy <romainguy@google.com> Add dithering to gradients

Change-Id: Ic1208855bde3a254eca2fd7cef43e0f1318ce419
/frameworks/base/libs/hwui/Caches.cpp
8a4ac610e1aaf04931ac1af54b146a7fc8e66114 18-Jul-2012 Romain Guy <romainguy@google.com> Don't clear the dirty clip flag if it's not applied
Bug #6833979

Change-Id: I0ea78b7f31a557a335de10d910d03b0520029080
/frameworks/base/libs/hwui/Caches.cpp
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/Caches.cpp
586cae3ac69c0c667fbf8a954edbd399f620a717 14-Jul-2012 Romain Guy <romainguy@google.com> Improve rendering speed by disabling scissor tests

This change improves execution of display lists, particularly on
tiled renderers. The goal is to disable the scissor test as
often as possible. Drawing commands are rarely clipped by View
bounds so most of them can be drawn without doing a scissor test.

The speed improvements scale with the number of views and drawing
commands.

Change-Id: Ibd9b5e051a3e4300562463805acc4fd744ba6266
/frameworks/base/libs/hwui/Caches.cpp
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/Caches.cpp
bb0acdf9e1d862a7cf0e2533321fc1105c29b5e3 05-Mar-2012 Romain Guy <romainguy@google.com> Delete display list objects and resources on the UI thread
Bug #6073717
Bug #6065504
Bug #6026515
Bug #5971725

Prior to this patch, the destructor of DisplayList would always run
on the finalizer thread. This could cause a race condition if the UI
thread was busy rendering display lists at the same time leading to
various random native crashes.

Change-Id: Ie11108e3b1538d4b358a1a8b4cce1b2d33152d0c
/frameworks/base/libs/hwui/Caches.cpp
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/Caches.cpp
8564c8da817a845353d213acd8636b76f567b234 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE

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

Bug: 5449033
Change-Id: I00a4b904f9449e6f93b7fd35eac28640d7929e69
/frameworks/base/libs/hwui/Caches.cpp
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/Caches.cpp
82bc7a772747fcf8a6fe7097f70bf2981429ffe9 03-Jan-2012 Romain Guy <romainguy@google.com> Properly restore the GL scissor after a GL draw functor
Bug #5781254

Change-Id: I1dc4809563a793b6b579814951d4d73b4c34bf32
/frameworks/base/libs/hwui/Caches.cpp
8f85e80b64b89fd38cc23b129f61ec36ddde7f15 15-Dec-2011 Romain Guy <romainguy@google.com> Generate even fewer GL commands

Change-Id: I0f4dcacb03ef5ee7f6ebd501df98bfead5f0a7f8
/frameworks/base/libs/hwui/Caches.cpp
ec31f83bd3af1f900d1ee9116b15f56904c66dcd 14-Dec-2011 Romain Guy <romainguy@google.com> <Insert something improper about OpenGL>

Change-Id: Ib645376093838156771588adc76a718da0ceb0db
/frameworks/base/libs/hwui/Caches.cpp
a1d3c91afbd52c7e8b01f4a9060c5459f02ae7a5 13-Dec-2011 Romain Guy <romainguy@google.com> Further reduce the number of GL commands sent to the driver

Change-Id: Id922b2a166ea4573b767c27d3195e11c70320b23
/frameworks/base/libs/hwui/Caches.cpp
15bc6437f8b4cf10dba55c7638d349e7b9563f4f 13-Dec-2011 Romain Guy <romainguy@google.com> Reduce the number of GL commands generated by the UI

This optimization along with the previous one lets us render an
application like Gmail using only 30% of the number of GL commands
previously required

Change-Id: Ifee63edaf495e04490b5abd5433bb9a07bc327a8
/frameworks/base/libs/hwui/Caches.cpp
f3a910b423db7ad79cf61518bdd9278c048ad0d8 13-Dec-2011 Romain Guy <romainguy@google.com> Optimize state changes

Change-Id: Iae59bc8dfd6427d0967472462cc1994987092827
/frameworks/base/libs/hwui/Caches.cpp
8ff6b9ebeeb24a6161ec6098e6bfdf8790ee5695 10-Nov-2011 Romain Guy <romainguy@google.com> Terminate EGL when an app goes in the background

This does not happen on high end gfx devices. This happens
only if only one EGL context is initialized in the current
process.

Change-Id: Ibd1737efdf84eef8a84108b05795440d1ae9964e
/frameworks/base/libs/hwui/Caches.cpp
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/Caches.cpp
6203f6c8147069976342be8f42add797a50f9557 02-Aug-2011 Romain Guy <romainguy@google.com> Reduce the amount of data cached by the gradients cache.

Change-Id: I8546f5a5ecf38031c9a40bdcc434d4c7f22da63d
/frameworks/base/libs/hwui/Caches.cpp
6d7475d666baefaa3ba9f0dcee25238739454241 28-Jul-2011 Romain Guy <romainguy@google.com> Destroy layers and flush layers cache when a window is destroyed.

Change-Id: I3fa1bc3ff50fb99e3d2e490925bd6b0a0f809fff
/frameworks/base/libs/hwui/Caches.cpp
bdf7609867a3f886455c51dba91623a86cceb6e2 19-Jul-2011 Romain Guy <romainguy@google.com> Trim OpenGLRenderer's memory usage whenever possible

Change-Id: I9225077184f374b1a43300add15cc1d5b6869d1c
/frameworks/base/libs/hwui/Caches.cpp
042f7d64b5ccd7b5b73e7e9814a84576f04fb7d4 13-Jul-2011 Kenny Root <kroot@google.com> Fix debugging for hwui caches

Debugging code attempted to delete a stack item.

Also, the flag fields weren't exactly clear, so rewrite it so it's
clear that kDebugMoreCaches is a combined flag.

Change-Id: If42b7f0f754919343301da5656aee5943cc9bd4a
/frameworks/base/libs/hwui/Caches.cpp
02ccac69fd1c0a03c24c5f3ace0ad4bed337b1fd 24-Jun-2011 Romain Guy <romainguy@google.com> Code cleanup

Change-Id: I64c346004e0adf9a776d0315534d4fe445f0c0ca
/frameworks/base/libs/hwui/Caches.cpp
d2ba50ab861ec0950bda18dd0f463b687e66249f 27-May-2011 Romain Guy <romainguy@google.com> Prettify memory dump.

Change-Id: I071c6a04a144a96955d85f56dffc6162288ee33e
/frameworks/base/libs/hwui/Caches.cpp
9c1e23baf5bfbebd1aebbd6d9a18c225325567ce 24-Mar-2011 Chet Haase <chet@google.com> Add logging of graphics acceleration info to bugreports

Change-Id: I9fa4cda6ccf92df9d1c644ccdc0e7274a30106e0
/frameworks/base/libs/hwui/Caches.cpp
2fc941e4650d618ff6e122f28b616d9032ffa134 04-Feb-2011 Romain Guy <romainguy@google.com> Fixes cache misses and extra allocations.
Bug #3421454

Change-Id: If4d5c960a7e4c581a9d213073e658284b4e1c497
/frameworks/base/libs/hwui/Caches.cpp
09b7c91de73b59aa3f679b3ae3ba299f82ec9f8a 03-Feb-2011 Romain Guy <romainguy@google.com> Allocate layers from the layers pool.
Bug #3413433

This change will be beneficial to Launcher to avoid hiccups when
swiping pages of icons. When a layer is discarded, it is kept
in the layers pool instead of being destroyed right away. This
favors memory reuse over allocations.

Change-Id: Ifb6944ba83d6ceb67c331527c0827b26ce648eb1
/frameworks/base/libs/hwui/Caches.cpp
01d58e43ede5ca98cbebdd166f9b0c545032c01b 20-Jan-2011 Romain Guy <romainguy@google.com> Add rounded rects and circles support to OpenGLRenderer.

Change-Id: I6cedf2b495d58de7c0437096809fa9e4518a1b8c
/frameworks/base/libs/hwui/Caches.cpp
ada830f639591b99c3e40de22b07296c7932a33f 13-Jan-2011 Romain Guy <romainguy@google.com> Cleanup implementation of hardware layers.

The new implementation relies on OpenGLRenderer's existing layer
code instead of duplicating it. The new code is much cleaner, with
simpler and better APIs and allows tracking of drawn regions inside
layers. Region tracking is not yet enabled but this will be done
in a future CL.

Change-Id: Ie826121a2227de8252c77b992a61218defea5143
/frameworks/base/libs/hwui/Caches.cpp
57066eb64c9a190d1afc87bb060bbb2d31e5b86c 12-Jan-2011 Romain Guy <romainguy@google.com> Cleanup GL objects on the correct thread.

Change-Id: Iddfea6e08a6591a4fab147151098ef27005f373d
/frameworks/base/libs/hwui/Caches.cpp
7230a74e9a36dfc6c4346c14e325bf07cd05b380 11-Jan-2011 Romain Guy <romainguy@google.com> Composite layers as regions.

This change detects what area of a layer was drawn into and generates a mesh
to match this area exactly. This can be used to avoid blending empty pixels
when the layer is composited.
This change also adds proper layers support to lines rendering and implements
layers composition in a more readable way.

Change-Id: I4a5588b98b19bd66891ebdc39631b193c5e31999
/frameworks/base/libs/hwui/Caches.cpp
fe48f65922d4a3cc4aefe058cee5acec51504a20 12-Nov-2010 Romain Guy <romainguy@google.com> Free resources only from the GL context thread.
Bug #3179882

Resources were freed following garbage collections on a worker thread.
This worker thread had no EGL context, which would cause the renderer
to incorrectly assume that the memory was liberated.

Change-Id: Ifdb51f94ddf42641e8654522787bfac532976c7c
/frameworks/base/libs/hwui/Caches.cpp
e190aa69756aecfaffabdd4c6d32cb6b3220d842 11-Nov-2010 Romain Guy <romainguy@google.com> Add new runtime debug flags.

Change-Id: I07955de166a89b5053c6c13f250bb3e2936ca86e
/frameworks/base/libs/hwui/Caches.cpp
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/Caches.cpp
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/Caches.cpp
746b7401ceb86b5f2805f8c0d3b39ac739152015 27-Oct-2010 Romain Guy <romainguy@google.com> Remove unnecessary GL calls.

This change batches calls to glScissor() and removes extra GL
queries and glActiveTexture() calls.

Change-Id: I1cd079d314f87cd9c088f95c8d4909c2f860f6aa
/frameworks/base/libs/hwui/Caches.cpp
9bca4793a33d2714b306d69ceb870925a588fe71 26-Oct-2010 Romain Guy <romainguy@google.com> Small cleanup.

Removes unnecessary forward class declaration, make Caches::currentBuffer
private instead of public.

Change-Id: Idba6325c8c602d89239e667cb8ec87e7943f8e75
/frameworks/base/libs/hwui/Caches.cpp
dd78ccacff83f0714ad90be98b58ad85f5d08c66 23-Oct-2010 Chet Haase <chet@google.com> Fix Caches singleton to avoid resource leaks

The declaration of Singleton objects must be in CPP files (not header
files) to avoid creating separate instances of what is supposedly a
single object.

Change-Id: Ie903384824a458b5572f3ce5b6cfb359c18a9c44
/frameworks/base/libs/hwui/Caches.cpp