8254 Commits

Author SHA1 Message Date
Mike Reed
ca9b1ed9f0 Merge "use SkBlendMode instead of SkXfermode use sk_sp versions of paint setters/getters" 2016-10-18 13:57:13 +00:00
Seigo Nonaka
9cd73b6828 Remove obsolete interface GetTable.
Test: Manually done.

Change-Id: Ib9f50610454a6ddd7179c40d5f31c74916bcff84
2016-10-18 15:10:21 +09:00
George Burgess IV
11ca129c2b Merge "Fix static analyzer warnings." am: ff5c3ad08b am: 1db1a86bba
am: e76253055c

Change-Id: I37be36a86dbab762c64696843916e88f17908251
2016-10-18 01:56:57 +00:00
George Burgess IV
e76253055c Merge "Fix static analyzer warnings." am: ff5c3ad08b
am: 1db1a86bba

Change-Id: Iafed2ab4df7297ed8e3b0b86cafe15af3e1c8823
2016-10-18 01:49:53 +00:00
George Burgess IV
1db1a86bba Merge "Fix static analyzer warnings."
am: ff5c3ad08b

Change-Id: I655fd765cfeae407c070261cfe07ce8b739b06fa
2016-10-18 01:43:24 +00:00
Adam Lesinski
7a37b74d37 Add tests for attribute resolution
- Adds unit tests for attribute resolution. These include
  some test data resource tables and compiled XML files.
- Convert touched files to Google style guide.

Test: make libandroidfw_tests
Change-Id: Ib3a36061dc874de5f6a266b4e82c0a12ef435f23
2016-10-17 18:33:42 -07:00
Treehugger Robot
ff5c3ad08b Merge "Fix static analyzer warnings." 2016-10-18 01:30:55 +00:00
Adam Lesinski
2582465bb4 Fix race with Asset destruction and printing allocation stats
A race could occur when printing the list of Asset allocations for
debugging purposes.

Each Asset object would insert themselves into a global linked list
on construction and remove themselves on destruction. Iterating the list
and the insertion/remove operations all acquire a global lock.

The race occurs after the Asset subclass destructor runs but before the Asset
base class destructor runs, which performs the actual removal from the list.

The vtable of the object being destroyed ends up pointing at the base Asset class'
vtable, and during the iteration of the global list, a pure virtual method is called
leading to an abort, since the wrong vtable is dereferenced.

This change moves the insertion/removal of the Asset object into the global list
to the concrete class, which adds some maintenance overhead but solves the problem.

Bug:31113965
Test: make libandroidfw_tests
Change-Id: I1a620897e5e04a8519ee247883bba0719b1fa6f3
(cherry picked from commit 0358efe4f76f42d9eea91600202a5ab0831d9cef)
2016-10-18 01:27:39 +00:00
TreeHugger Robot
047f5a7b4f Merge "Fix race with Asset destruction and printing allocation stats" 2016-10-18 00:25:00 +00:00
TreeHugger Robot
52528d7629 Merge "Fix complex clipping on mergeable ops" 2016-10-17 22:11:46 +00:00
Mark Salyzyn
21c2e9e60c Merge "missing includes" am: 78929f3ee0 am: 6a8f0d70b0
am: 6e60ab12e7

Change-Id: I1b5c6f49d2ae565ebd59c6ce8d590512ab306487
2016-10-17 21:38:33 +00:00
Mark Salyzyn
6e60ab12e7 Merge "missing includes" am: 78929f3ee0
am: 6a8f0d70b0

Change-Id: I40ff974f4333aaa714a63d5436b822491b9d78d6
2016-10-17 21:31:35 +00:00
Mark Salyzyn
6a8f0d70b0 Merge "missing includes"
am: 78929f3ee0

Change-Id: I3e7a25ded484d516fab453abe434c2e53cf0f27e
2016-10-17 21:25:59 +00:00
Adam Lesinski
0358efe4f7 Fix race with Asset destruction and printing allocation stats
A race could occur when printing the list of Asset allocations for
debugging purposes.

Each Asset object would insert themselves into a global linked list
on construction and remove themselves on destruction. Iterating the list
and the insertion/remove operations all acquire a global lock.

The race occurs after the Asset subclass destructor runs but before the Asset
base class destructor runs, which performs the actual removal from the list.

The vtable of the object being destroyed ends up pointing at the base Asset class'
vtable, and during the iteration of the global list, a pure virtual method is called
leading to an abort, since the wrong vtable is dereferenced.

This change moves the insertion/removal of the Asset object into the global list
to the concrete class, which adds some maintenance overhead but solves the problem.

Bug:31113965
Test: make libandroidfw_tests
Change-Id: I1a620897e5e04a8519ee247883bba0719b1fa6f3
2016-10-17 14:04:09 -07:00
Chris Craik
f8f56cbb20 Fix complex clipping on mergeable ops
Fixes: 32106003
Test: unit tests passing (and one added)

Change-Id: I519bc38a1fa8c25c9ae317ffdb7e59e5a0824f59
2016-10-17 13:40:32 -07:00
Stan Iliev
c0e7a90f1f Initial refactoring to enable reuse of SkiaDisplayList
on a per RenderNode basis. With Skia renderer we
see 30% speed improvement in Invalidate Tree UI Jank test,
when SkiaDisplayList objects are reused.

Test: manually built and run on angler-eng.
Change-Id: Ie4ec50ddb2015150e3ec678dde7ebed0c8d90067
2016-10-17 16:30:28 -04:00
Chris Craik
dfe4a1b6ee Fix complex clipping on mergeable ops DO NOT MERGE am: d183e0b988
am: a6bfd8d12c

Change-Id: I5af8d0fac1e47e7bf831ca2f387fe550acf4165c
2016-10-17 19:59:32 +00:00
Chris Craik
a6bfd8d12c Fix complex clipping on mergeable ops DO NOT MERGE
am: d183e0b988

Change-Id: Icb357a11cb8a4be473aa8b0acdb4d799973ff54a
2016-10-17 19:52:53 +00:00
Mark Salyzyn
4d6c372eae missing includes
Assumptions are made about header side effects

Test: compile
Bug: 30465923
Change-Id: Icc9415aed5e54b2bc00b70aa0da6df4148f30654
2016-10-17 12:32:54 -07:00
Chris Craik
d183e0b988 Fix complex clipping on mergeable ops DO NOT MERGE
Fixes: 32106003

Change-Id: I519bc38a1fa8c25c9ae317ffdb7e59e5a0824f59
2016-10-17 10:51:11 -07:00
sergeyv
c36bd6c16d Move allocatePixelRef methods to hwui.
This patch also makes tests to use SkBitmap backed by hwui/PixelRef,
Test: refactoring cl.
bug:27762775

Change-Id: Ib936e81877790849118420f5e565fc8f4466c1be
2016-10-13 18:22:04 -07:00
George Burgess IV
e8efec56f0 Fix static analyzer warnings.
frameworks/base/libs/androidfw/ResourceTypes.cpp:742:46: warning: Result
of 'calloc' is converted to a pointer of type 'char16_t *', which is
incompatible with sizeof operand type 'char16_t **'
    mCache = (char16_t**)calloc(mHeader->stringCount,
        sizeof(char16_t**));

frameworks/base/libs/androidfw/ResourceTypes.cpp:4359:28: warning:
Potential leak of memory pointed to by 'set'
     return NO_MEMORY;

Bug: None
Test: Builds without the aforementioned warnings.
Change-Id: I1f84c1b9f4cba05f5cc7c3ae9fec1a07bc9cd8fe
2016-10-13 15:32:33 -07:00
Adam Lesinski
57e1950542 Merge "Move attribute resolution from core/jni to libandroidfw" 2016-10-13 21:22:26 +00:00
Mike Reed
260ab72648 use SkBlendMode instead of SkXfermode
use sk_sp versions of paint setters/getters

Change-Id: I86591a0a8ec92e6039776cbf00424ea24f585b28
2016-10-13 17:14:52 -04:00
Derek Sollenberger
6e68bedacc Merge "Initial refactoring to enable the addition of the SkiaOpenGLPipeline." 2016-10-13 16:53:14 +00:00
TreeHugger Robot
8e56eea48c Merge changes Icd65d906,I109cb9db
* changes:
  Don't apply the OECF twice to multi-stop gradients
  JNI does not use hwui_flags but LOCAL_CFLAGS
2016-10-13 03:27:21 +00:00
Romain Guy
f9037dabea Don't apply the OECF twice to multi-stop gradients
Test: Manual

Change-Id: Icd65d906df2f0a059373edb8c6d55fe378c92f92
2016-10-12 18:31:31 -07:00
TreeHugger Robot
a6abb1031f Merge "Fatal abort on invalid state" 2016-10-12 23:12:18 +00:00
Romain Guy
3b26c211e3 Merge "Various fixes for linear blending and gradients" 2016-10-12 22:17:10 +00:00
John Reck
cecec702eb Fatal abort on invalid state
Use mCaches.size() to track item count instead of trying
to do it manually on the side.

Bug: 31856965
Test: manual, minimal. Repro steps for bug are unknown, fix
is speculative as a result
Change-Id: Ic32f27262548a99be95440881420d224ede4db74
2016-10-12 14:18:17 -07:00
Martin Wallgren
85dd1b8594 RRO: Synchronize access to overlays.list am: 0fbb608110 am: dce79f10ba
am: 3970c44547

Change-Id: I4c9eecad4c2d935a1f1840fed6d70685b82b7e65
2016-10-12 21:15:58 +00:00
Doris Liu
4e230f4688 Fix SkShader leak for Gradient VectorDrawable and test am: fc9cf72339 am: c47199bb6a
am: 1ef744a3b8

Change-Id: Iee4f98f10a4e1b3947166777040918ab779ab023
2016-10-12 21:10:47 +00:00
Martin Wallgren
3970c44547 RRO: Synchronize access to overlays.list am: 0fbb608110
am: dce79f10ba

Change-Id: Idc121ffe64f1bc7b5bdcb1a800305165f27f1c0a
2016-10-12 21:09:42 +00:00
Doris Liu
1ef744a3b8 Fix SkShader leak for Gradient VectorDrawable and test am: fc9cf72339
am: c47199bb6a

Change-Id: I261f8f3708f526c15ae93c51d24bdaee054354f6
2016-10-12 21:03:14 +00:00
Martin Wallgren
dce79f10ba RRO: Synchronize access to overlays.list
am: 0fbb608110

Change-Id: I44a716df3954b6d2d58d7c9784f8b55cf041b10b
2016-10-12 21:03:11 +00:00
Doris Liu
c47199bb6a Fix SkShader leak for Gradient VectorDrawable and test
am: fc9cf72339

Change-Id: I493a8c52cd4cca79971a4fd2e3eed7f566ce8ecd
2016-10-12 20:56:55 +00:00
Adam Lesinski
baac85ec1f Merge "RRO: Synchronize access to overlays.list" into nyc-mr1-dev 2016-10-12 20:55:55 +00:00
Romain Guy
8762e332e3 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
2016-10-12 13:28:26 -07:00
Romain Guy
21986f2ae7 Merge "Linear blending, step 1" 2016-10-12 15:52:14 +00:00
Martin Wallgren
0fbb608110 RRO: Synchronize access to overlays.list
idmap --scan is executed as a part of the pre-loading in ZygoteInit.
The pre loading is executed in parallel for each supported architecture
(32/64 bit). This will cause a race condition in the creation of the
overlays.list file and the idmap files for the system overlays.

Apply flock on overlays.list to prevent the file from being thrown away
and recreated when it is in use by another Zygote.

Cherry-picked from AOSP.

Bug: 28032298
Test: manual
Change-Id: I51d39f121d207b11181340b68b164b60020f0c61
2016-10-12 14:56:31 +00:00
Adam Lesinski
78382db820 Merge "RRO: Synchronize access to overlays.list" 2016-10-12 14:52:49 +00:00
Adam Lesinski
4452e137ff Move attribute resolution from core/jni to libandroidfw
Without the entire JNI environment, testing the attribute
resolution code will be much easier and enable safer
refactoring.

Change-Id: I2815cc1e10a694a3b01bc37e191a0d5e9d0e6735
Test: Existing CTS tests pass
2016-10-12 07:47:28 -07:00
Martin Wallgren
f12af5e907 RRO: Synchronize access to overlays.list
idmap --scan is executed as a part of the pre-loading in ZygoteInit.
The pre loading is executed in parallel for each supported architecture
(32/64 bit). This will cause a race condition in the creation of the
overlays.list file and the idmap files for the system overlays.

Apply flock on overlays.list to prevent the file from being thrown away
and recreated when it is in use by another Zygote.

Bug: 28032298

Change-Id: I51d39f121d207b11181340b68b164b60020f0c61
2016-10-12 15:42:04 +09:00
Doris Liu
fc9cf72339 Fix SkShader leak for Gradient VectorDrawable and test
This CL fixes a SkShader leak in VD when applying local matrix
to the shader. Specifically, the usage of newWithLocalMatrix(...)
increments the shader's ref count in every draw() call for
Gradient VectorDrawable, whereas there's no balancing call to
decrement the ref count in draw(). In this CL, we assume
the ownership of the shader returned from newWithLocalMatrix(...)
to ensure the correct ref count management.

Also, add test to verify that shader is no longer being leaked

BUG: 32067647
Test: this CL

Change-Id: Ic15fe46cde06a73d81b44e2d3c56b51907344cc0
2016-10-12 01:22:11 +00:00
Romain Guy
253f2c213f 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
2016-10-11 17:47:58 -07:00
Sergei Vasilinetc
e9eefce9f8 Merge "Move PixelRef to hwui Test: refactoring cl. bug:27762775" 2016-10-11 18:08:56 +00:00
sergeyv
0728f0872f resolve merge conflicts of e830f35 to master
Change-Id: I4d2b10a6a2ac983986775f1f925c4a09734bb70d
2016-10-10 18:20:04 -07:00
sergeyv
e830f351e1 Turn off additional logging in text rendering am: 5bb5626599
am: 4778f6a43e

Change-Id: If031a1d480d8c2e75e9f6268d15c8ccc098a0268
2016-10-11 00:54:34 +00:00
sergeyv
4778f6a43e Turn off additional logging in text rendering
am: 5bb5626599

Change-Id: Ic7f6c59ca2c3a92f81bf55a8916e20d99fcc01a7
2016-10-11 00:43:32 +00:00
Sergei Vasilinetc
f10763d23d Merge "HWUI: prepare script for ryu Test: cpu adb shell cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq Test: gpu adb shell cat /sys/devices/57000000.gpu/pstate" 2016-10-10 22:29:34 +00:00