History log of /frameworks/base/libs/hwui/AssetAtlas.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
9a7fe1a034bf0a9dea7c0676211bb780d3ab30be 11-Dec-2014 John Reck <jreck@google.com> Force-flush state sync on texid change

Bug: 18718646

Caused because the Texture object thought the GLES texture
was in a different state than it was as it persists across
EGL/GL contexts. Fix this by force-flushing the default
values when the texid has changed.

Change-Id: I264bac9a2beb08df8e2ba8a85ad15f0dd1fce22a
/frameworks/base/libs/hwui/AssetAtlas.cpp
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/AssetAtlas.cpp
fbc8df03e498baf47ff1a5e05e182f1bcd60c770 15-Nov-2014 John Reck <jreck@google.com> Trace some interesting events

Bug: 18337099
Change-Id: Ie2e60da2b9f06e0368061c944d8123ab6903355c
/frameworks/base/libs/hwui/AssetAtlas.cpp
17ab38f8a87bc90eab11373f878f220ce3031de6 27-Jan-2014 Ashok Bhat <ashok.bhat@arm.com> AArch64: Make AssetAtlasService 64-bit compatible

Changes in this patch include

[x] Long(64-bit) is used to store native pointers in
AssetAtlasService and related classes as they can be 64-bit.

[x] Some minor changes have been done to conform with
standard JNI practice (e.g. use of jint instead of int
in JNI function prototypes)

Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>

(cherry-picked from 4de3f481bc59ab4b766dc027e41aff7cda9d62f7)

Change-Id: If22daf40eef46f8df9f94d65ddcc52c45b3acf2a
/frameworks/base/libs/hwui/AssetAtlas.cpp
d218a92c0afb8c0d98135b20b52ac87236e1c935 03-Jan-2014 Chris Craik <ccraik@google.com> Use const where possible for drawing parameters

They should never be modified by a Renderer, only read and copied.

Change-Id: I9d8d55dca19115ee9dfeb2bb3f092ba2fb327cd4
/frameworks/base/libs/hwui/AssetAtlas.cpp
7f6d6b0370df4b5a9e0f45bffc31ea6caeeb509d 06-Aug-2013 Romain Guy <romainguy@google.com> Split assets atlas batches
Bug #10185769

The assets atlas contains assets that need to be blended and assets
that do not need to be blended. With a single merge id, currently
set to be the pointer to the atlas itself, draw ops merging could
generate batches of commands containing both opaque and translucent
assets. The blend state was chosen from only one of the assets in
the batch, leading either to inefficiencies (blending large opaque
assets) or incorrect behaviors (not blending translucent assets.)

This change introduces two new merge ids in the atlas: an opaque
key and a blend key. These keys are simple booleans set to false
and true respectively (the values do not matter really.) Their
memory addresses are used as the merge ids when createing draw ops
batches, allowing all opaque ops to be batched together and all
translucent ops to be batched together.

Change-Id: I114dba0533c44987e53864b471ccb28c811f2025
/frameworks/base/libs/hwui/AssetAtlas.cpp
55b6f95ee4ace96c97508bcd14483fb4e9dbeaa0 28-Jun-2013 Romain Guy <romainguy@google.com> Track the atlas' generation ID
Bug #9589379

If the atlas is terminated/reinitialized and a view does not invalidate
in between it might end up using a stale AssetAtlas::Entry. This change
is similar to how 9patch meshes are cached in DrawPatchOp: we simply
track the generation ID of the cache to make sure we always use the
latest data.

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

Change-Id: Ic345422567c020c0a9035ff51dcf2ae2a1fc59f4
/frameworks/base/libs/hwui/AssetAtlas.cpp
a404e16e4933857464046d763ed7629cd0c86cbf 25-May-2013 Romain Guy <romainguy@google.com> Make sure atlas antries can correctly filter/wrap textures

The virtual textures would each have their own values for wrapping
and filtering which could lead to conflict and/or extraneous GL
commands being issued.

Change-Id: I64cb59a03e598f46bf645bd1d30fccfa63a07431
/frameworks/base/libs/hwui/AssetAtlas.cpp
d5207b2eb9ba520da822d61ff78b539842fc5255 07-May-2013 Romain Guy <romainguy@google.com> Fix double-free in AssetAtlas
Bug #8833153

If Atlas::terminate() is called twice without an init() in between
libhwui would double-free Atlas::mImage. This lead to a lot of crashes
with the monkeys as they can easily trigger memory trims.

Change-Id: I96798414e5e71cd498aaca85a790661ebccdaa91
/frameworks/base/libs/hwui/AssetAtlas.cpp
877cfe0e32a845d5a58252b8a6e1f54f95b4379c 03-May-2013 Romain Guy <romainguy@google.com> Wrap EGLImage with a C++ API

Change-Id: I0fa3282ea7e2ace3ba2aadd929b32232b3d41628
/frameworks/base/libs/hwui/AssetAtlas.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/AssetAtlas.cpp