19 Commits

Author SHA1 Message Date
Romain Guy
7f4307668b 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
2013-06-13 14:58:32 -07:00
Romain Guy
e9bc11f712 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
2013-05-23 12:50:13 -07:00
Romain Guy
3b748a44c6 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
2013-05-02 13:32:09 -07:00
Romain Guy
df1dc28ba0 Add internal API to query GL version number
Change-Id: Idc02efc237b8e97445a9bab05c291bf193c7f279
2013-04-04 10:50:48 -07:00
Romain Guy
3bbacf27c0 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
2013-02-07 12:11:22 -08:00
Romain Guy
85ef80d890 Foundation for tiling optimization
Change-Id: I4db32a4749f196472ba0dde7e102439d2ba4a3a7
2012-09-13 20:26:50 -07:00
Romain Guy
6355347813 Remove vendor specific precision qualifier
Change-Id: I0a56ca7a5a399ec94993d3cea0c4aff6c0f86e39
2012-07-18 20:04:14 -07:00
Romain Guy
dfa1046eca Add call sites for OpenGL's debug label extension
Change-Id: I9c689127e8166cbef92c935f8aa07217ab806dda
2012-05-12 16:22:35 -07:00
Romain Guy
13631f3da8 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
2012-01-30 17:41:55 -08:00
Steve Block
5baa3a62a9 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
2012-01-03 22:38:27 +00:00
Romain Guy
9c4b79af22 Discard framebuffer rendering queues when discarding layers
Bug #5581817

Change-Id: Ie30700a29059d2ea60eb7bd3f8bd20ac48a149ab
2011-12-06 16:37:10 -08:00
Dave Burke
7077506f99 Revert "Discard framebuffer rendering queues when discarding layers"
This reverts commit da96f8ac2c1c35a54f3f36e6d776cb386a251d03.
2011-11-14 11:39:30 -08:00
Romain Guy
da96f8ac2c Discard framebuffer rendering queues when discarding layers
Bug #5581817

Change-Id: If612846ec5f7793710fc4df152791fb32c506551
2011-11-10 19:23:58 -08:00
Romain Guy
a60c388971 Use high precision iterators on specific GPUs
Bug #5098359

Change-Id: I52ee8c7b4c9e8d4c7bedb684eaf7bef6c44c74b9
2011-08-01 15:28:16 -07:00
Romain Guy
5b3b35296e 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
2010-11-02 16:17:23 -07:00
Romain Guy
a5aed0d589 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
2010-09-09 14:42:43 -07:00
Romain Guy
db1938e0e6 Add support for ColorFilters.
Color filters are fully supported and can be used with shaders.

Change-Id: Id90ccf1c81cb462f2431f366f3f8f710d7971e04
2010-08-02 18:50:56 -07:00
Romain Guy
51769a68a5 Cleanup, added properties for the FontRenderer.
Change-Id: I909c74815d3ac394438ad8071d17fef5401dbeed
2010-07-23 00:28:00 -07:00
Romain Guy
bd0e6aa0ff Add a way to query GL extensions.
Change-Id: Ic27dbf72289dacf641b640a749fbd40c12cd474f
2010-07-22 18:52:24 -07:00