5030 Commits

Author SHA1 Message Date
Chris Craik
d4b43b3cf3 Fix off by one error in log tracking
bug:8875715

Additionally moves op logging before the op is executed, to print
correctly, in pre-order traversal

Change-Id: I4e9566261f8363c73739d183e6d82b854f72ffad
2013-05-09 17:00:46 -07:00
Mathias Agopian
1f5762e646 libutils clean-up
Change-Id: I11ee943da23a66828455a9770fc3c5ceb4bbcaa9
2013-05-07 17:09:46 -07:00
Romain Guy
d5207b2eb9 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
2013-05-07 14:46:36 -07:00
Romain Guy
72bd95b8fe am b90ff505: am fdf13c90: Merge "Convert alpha from [0..1] to [0.255] range Bug #8808886" into jb-mr2-dev
* commit 'b90ff505df143abd957cfc19b60727e3460ee68c':
  Convert alpha from [0..1] to [0.255] range Bug #8808886
2013-05-06 13:56:23 -07:00
Chet Haase
94268b0dd9 am 33be275d: am d65eebf4: Merge "Fix scaled-view droppings artifact" into jb-mr2-dev
* commit '33be275deb072ca3e6155b61370578b16dbee64a':
  Fix scaled-view droppings artifact
2013-05-06 13:56:20 -07:00
Romain Guy
1f8a0db348 Remove stray log
Change-Id: I392eea216ad67f376ded802c19a3e2287aacc6f8
2013-05-06 11:15:28 -07:00
Romain Guy
fdf13c90cb Merge "Convert alpha from [0..1] to [0.255] range Bug #8808886" into jb-mr2-dev 2013-05-04 01:42:46 +00:00
Romain Guy
87b515cde5 Convert alpha from [0..1] to [0.255] range
Bug #8808886

Without this conversion, alpha was always set to 0 or 1 which causes
things to disappear mysteriously. Mysteries are meant to be solved
and I solved them all in 6 characters.

Change-Id: I2078420fbe968c046e999b0eabb24403e71108fd
2013-05-03 17:42:27 -07:00
Romain Guy
78dd96d5af 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
2013-05-03 17:08:20 -07:00
Chet Haase
259b696b00 Fix scaled-view droppings artifact
Sometimes views that are scaled leave behind rows/columns on the
screen as they move/scale around.

The problem was that the pivot point around which the scale takes place
(in the default case of scaling around the center of the view)
was getting truncated to integer coordinates in the display list.
Meanwhile, the pivot point at the Java level was using the true float
values, resulting in a mis-match between the invalidation rectangle
(computed at the Java level) and the drawing-operation rectangle (computed
at the native level).

This only occurred when views had odd bounds (thus the integer representation
of the center differed from the float representation of the center), and only
when some other drawing operation would expand the clip rect to allow the
incorrect drawing operation (using the wrong pivot point) to draw outside of
its clip boundaries.

Issue #8617023 7x7 screen not updated correctly

Change-Id: If88889b9450d34535df732b78077a29b1f24802d
2013-05-03 15:32:48 -07:00
Romain Guy
1212c9dafe Remove warning
Change-Id: Ia1523d02dc2b7f58ca26a142a5aef710792a5f3d
2013-05-02 17:50:23 -07:00
Romain Guy
877cfe0e32 Wrap EGLImage with a C++ API
Change-Id: I0fa3282ea7e2ace3ba2aadd929b32232b3d41628
2013-05-02 17:36:28 -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
Bjorn Bringert
fb903a45d7 Allow compiling aapt for the device
Changes:

- The static device version of libandroidfw now includes
  the extra functions needed by aapt. I could only find
  a few host tools that use the static library, so this is
  hopefully not a problem.

- The pseudolocalization code is moved into aapt.
  It was previously in libhost, but only used by aapt.

Change-Id: Ib393ebb7dcebee8abbb628cbe5255ea1679674ac
2013-04-26 15:07:09 +01:00
Chris Craik
69ca575b5b Merge "Avoid incorrectly dirtying the functor output rect" 2013-04-24 17:44:46 +00:00
Chris Craik
4a2bff7b38 Avoid incorrectly dirtying the functor output rect
bug:8640186
Change-Id: I360cb85e59cfdd0b499561e92b81089341d07046
2013-04-22 15:00:52 -07:00
Chet Haase
684634144b am 371d4ccc: am 339ac854: Merge "Fix quickReject logic to account for setClipChildren() setting" into jb-mr2-dev
* commit '371d4cccde56ec4d26e51f8e82ef68f196169a3d':
  Fix quickReject logic to account for setClipChildren() setting
2013-04-20 21:37:23 -07:00
Chet Haase
dd671599be Fix quickReject logic to account for setClipChildren() setting
The rendering code optimizes by rejecting drawing operations that
lie outside of the bounds of their views. This works in most
situations, but breaks down when containers have called
setClipChildren(false), because we reject drawing that is outside
of that container, but which should be drawn anyway.

Fix is to pass in the value of that flag to the DisplayList drawing
routines which take that flag into account when deciding whether
to quickReject any particular operation.

Issue #8659277 animation clipping

Change-Id: Ief568e4db01b533a97b3c5ea5ad777c03c0eea71
2013-04-19 15:36:37 -07:00
Chris Craik
e0cedc40a2 am 17917a95: am d3f9ffe2: Merge "Prevent transformed ops from merging in the first place" into jb-mr2-dev
* commit '17917a95f355634ba881cd3f587002cb7ef27ce6':
  Prevent transformed ops from merging in the first place
2013-04-18 13:51:57 -07:00
Chris Craik
d3f9ffe28d Merge "Prevent transformed ops from merging in the first place" into jb-mr2-dev 2013-04-18 20:43:25 +00:00
Chris Craik
ee5b2c6de7 Prevent transformed ops from merging in the first place
bug:8649215

Previously we prevented ops with non-translate transforms from
merging, but missed the case of the first op in a merging batch
containing a non-translate transform.

This fulfills the assumption of drawText's non-immediate mode that
merged ops will have pure translate transforms.

Change-Id: I6f6db341aff3f7e84e74b4c3ccf970d585a2db1a
2013-04-18 12:57:07 -07:00
Chris Craik
e76dd37bdb am 680ca941: am ec5dc76a: Merge "Make layer double drawing visible in overdraw debug mode" into jb-mr2-dev
* commit '680ca9418b6b3f01547b286d1a80e07e186bc05f':
  Make layer double drawing visible in overdraw debug mode
2013-04-16 18:02:31 -07:00
Chris Craik
34416eaa1c Make layer double drawing visible in overdraw debug mode
A clipped saveLayer will cause two draws - first to an onscreen
buffer, then again back to the framebuffer. This change - when in
overdraw debug - reissues draws associated with a clipped saveLayer,
but only to the stencil buffer. Operations within a saveLayer are
shown correctly to be twice drawn, and View.setAlpha() without an
associated hardware layer, or hasOverlappingRendering() are made more
visible.

Hardware layers, on any frame that they are updated, similarly draw
twice, and will also be counted against the stencil buffer doubly.

Note: greater depths of layers - e.g. a saveLayer within a saveLayer -
are not respected, as that would require additional region tracking.

Change-Id: I61fb0e61038fe66013d59914c20bb47a550dea7d
2013-04-16 15:05:49 -07:00
Romain Guy
09d3636485 Fix indentation
Change-Id: If54b7d7c016acb5e7300323d2eada57142a814c0
2013-04-16 11:30:05 -07:00
Dianne Hackborn
a40d7e7cdc am 15717a32: am 0985ac04: Merge "Maybe fix issue #8620910: Win_sdk build failed and unable to create..." into jb-mr2-dev
* commit '15717a32c497895b294396c0000bc571790d3691':
  Maybe fix issue #8620910: Win_sdk build failed and unable to create...
2013-04-15 21:54:43 -07:00
Dianne Hackborn
0985ac0431 Merge "Maybe fix issue #8620910: Win_sdk build failed and unable to create..." into jb-mr2-dev 2013-04-15 23:23:31 +00:00
Dianne Hackborn
c51d050f1b Maybe fix issue #8620910: Win_sdk build failed and unable to create...
...the sdk platform repo

Change-Id: Ib6cd7c0dfb9b6217ae79af3e2ac25fe0442996e3
2013-04-15 15:36:53 -07:00
Chris Craik
55709fc1c7 am 55b883b0: am 30c990c3: Merge "Draw Operation merging" into jb-mr2-dev
* commit '55b883b0a960b37aa453253f3ccb614dd95c221c':
  Draw Operation merging
2013-04-15 14:34:35 -07:00
Chris Craik
30c990c361 Merge "Draw Operation merging" into jb-mr2-dev 2013-04-15 21:27:11 +00:00
Chris Craik
527a3aace1 Draw Operation merging
Merge simple bitmap draw operations and text operations to avoid
issuing individual gl draws for each operation. Merging other ops to
be done eventually.

The methods are different - the bitmap merging generates a single
mesh for reused, unclipped images (esp. repeated images in a listview)

The text approach queries just defers the normal font rendering until
the last drawText in the sequence that can share the same shader.

Patches are sorted and merged, but don't yet have a multiDraw
implementation. For now, the pretending-to-merge gives better sorting
behavior by keeping similar patches together.

Change-Id: Ic300cdab0a53814cf7b09c58bf54b1bf0f58ccd6
2013-04-15 13:53:02 -07:00
Romain Guy
5069101c08 am 5141bf80: am 80fccb4d: Merge "There should be a mandatory coder\'s license. Bug #8586560" into jb-mr2-dev
* commit '5141bf801e9d58e618c76e4cdc042218b24193fc':
  There should be a mandatory coder's license. Bug #8586560
2013-04-12 18:05:48 -07:00
Romain Guy
80fccb4dda Merge "There should be a mandatory coder's license. Bug #8586560" into jb-mr2-dev 2013-04-13 00:37:37 +00:00
Dianne Hackborn
11dc37686f am 18e99d1d: am 15fed390: Merge "Add new resources trace, also trace apk dex loading." into jb-mr2-dev
* commit '18e99d1d5f7bb2e35fb9f5c3edbb4265d66e3d93':
  Add new resources trace, also trace apk dex loading.
2013-04-12 17:06:37 -07:00
Dianne Hackborn
15fed390c4 Merge "Add new resources trace, also trace apk dex loading." into jb-mr2-dev 2013-04-12 23:58:50 +00:00
Romain Guy
4abab937bf There should be a mandatory coder's license.
Bug #8586560

And I don't deserve to pass the test.

Change-Id: Ic7886205511f16145a925fc860e4a03dfaf473d5
2013-04-12 16:51:21 -07:00
Romain Guy
0f6ba07732 am 543c5dcf: am efcb252f: Merge "Properly computer gradient textures width" into jb-mr2-dev
* commit '543c5dcfcb93925a5b9ac073eedb0bd813b2ebe0':
  Properly computer gradient textures width
2013-04-12 16:49:14 -07:00
Romain Guy
95aeff8f11 Properly computer gradient textures width
Only on devices that do not have the npot extension

Change-Id: I472a13dc707d2abaf5fcc06f99c9da343b333558
2013-04-12 16:32:05 -07:00
Dianne Hackborn
f7be4800df Add new resources trace, also trace apk dex loading.
Change-Id: Ia48566efb21ee018659bd976ddb3a0f4997b9a3a
2013-04-12 14:53:10 -07:00
Romain Guy
e48da96ab5 resolved conflicts for merge of 886e1204 to master
Change-Id: Id002d2ae799c6946672335f122ecbfa07d9c0bc1
2013-04-12 11:00:21 -07:00
Romain Guy
cf51a41998 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
2013-04-11 14:07:34 -07:00
Chet Haase
c4c8f2d82e am 78b24b6f: am dacd4751: Merge "Fix Contacts animation jank" into jb-mr2-dev
* commit '78b24b6f03f467a59afd6797b4c03224fe3af767':
  Fix Contacts animation jank
2013-04-10 11:01:31 -07:00
Chet Haase
dacd475163 Merge "Fix Contacts animation jank" into jb-mr2-dev 2013-04-10 17:49:56 +00:00
Chet Haase
58d110afa0 Fix Contacts animation jank
The last frame of an animation stays stuck on the screen for a couple of frames.
Specifically, the "Quick Contact" animation that animates the picture
closed (fades/scales it away) animates all the way to the end... then hangs there
briefly before being taken down.

The problem is a rendering bug where we correctly detect that a DisplayList
has nothing to draw (since the last frame is completely transparent, alpha==0),
but incorrectly ignore the fact that we cleared the transparent-background
window prior to not-drawing that DisplayList. When we detect that there's
nothing to draw, we don't bother swapping buffers. So even though we drew
the right thing (clearing the buffer), we didn't actually post the buffer to the
screen.

This change factors in both the clear and the draw to decide when to swap buffers.

Issue #8564865 Quick contact close animation jank redux

Change-Id: Ib922cff88a94f025b62f7461c1a29e96fe454838
2013-04-10 07:43:29 -07:00
Ying Wang
28af35e8cd resolved conflicts for merge of a976bddd to master
Change-Id: I64e1cbfb0eee891ce4d1eee40eefdcedcc501f7f
2013-04-09 23:21:42 -07:00
Ying Wang
d8b26d6c42 Merge "Add liblog" into jb-mr2-dev 2013-04-10 05:16:14 +00:00
Ying Wang
d685894212 Add liblog
Bug: 8580410
Change-Id: I746aa8258866508c3a725d0773faf4518096548f
2013-04-09 21:54:12 -07:00
Romain Guy
6c825d49b7 am 52706c6c: am 4a745e78: Merge "Change the dither texture\'s swizzling" into jb-mr2-dev
* commit '52706c6cc0d8ded20cfa8d46f200ca38f1009468':
  Change the dither texture's swizzling
2013-04-09 14:26:10 -07:00
Romain Guy
032d47af73 Change the dither texture's swizzling
This is a more elegant way to sample from a float alpha texture.
Instead of sampling from the red channel in the fragment shader
we can set the alpha channel swizzle to redirect it to the
red channel. This lets us sample from the alpha channel in the
fragment shader and get the correct value.

Change-Id: I95bbf7a82964e1bf42c0fee1b782b6bdbbcef618
2013-04-09 10:12:47 -07:00
Michael Wright
8775af6319 am aaddfacf: am bdb706e4: Merge "Pipe through device resolution information" into jb-mr2-dev
* commit 'aaddfacf962655d82f3ad64723ea408f949a2b79':
  Pipe through device resolution information
2013-04-05 15:46:40 -07:00
Romain Guy
6adbb90335 am 5ea0465d: am 8299f683: Merge "Use float textures to render gradients when possible" into jb-mr2-dev
* commit '5ea0465d4550944e2e5ac953a5c18ef31f31ec4d':
  Use float textures to render gradients when possible
2013-04-05 15:46:37 -07:00