167 Commits

Author SHA1 Message Date
Mike Reed
ab12c1fe73 update callers to newer Skia APIs
Test: refactoring CL. Existing unit tests still pass.

Change-Id: I47e73e00f14f78dd9d4c48a142ac9853e7e4cad7
2016-11-03 12:58:42 -04:00
Mike Reed
c2f31df8b3 use SkBlendMode
skbug.com/5814

Test: compile only
Change-Id: Ibbaff43df1117b2ca77fd8f917f03d88cc476330
(cherry picked from commit 26edbcba8a2ed4cb300e7f87e679e3b73cec2772)
2016-11-02 11:36:48 -04:00
Sergei Vasilinetc
97cc85fd4b Merge "Routine to upload hardware bitmaps" 2016-11-01 19:32:19 +00:00
sergeyv
694d499662 Routine to upload hardware bitmaps
Change-Id: Id8283a0975325e6830d55fd1e33c5f292a1e9be0
Test: refactoring cl.
bug:30999911
2016-10-31 16:11:21 -07:00
Matt Sarett
7de7385897 Implement getTransparentRegion() using SkLatticeIter
This allows us to delete utils/NinePatchImpl.cpp and
utils/NinePatch.h

Test: Passed cts tests - DrawableTest, NinePatchTest,
NinePatchDrawableTest.

Change-Id: I6b5d09fa3479e758d8b931fa0e977c25f4435a7c
2016-10-27 08:22:38 -04: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
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
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
Chih-hung Hsieh
25c9f6cede Merge "Fix google-explicit-constructor warnings in libs/hwui." am: 7207562ff7 am: d7a69e04eb am: 842f1e48e7
am: 1f50f80aab

Change-Id: I713bd07fee150cc684e630045e02872b23062a5a
2016-09-01 01:26:40 +00:00
Chih-hung Hsieh
1f50f80aab Merge "Fix google-explicit-constructor warnings in libs/hwui." am: 7207562ff7 am: d7a69e04eb
am: 842f1e48e7

Change-Id: I401bb7ef3a46bb317ba664667fab4a16c129e5aa
2016-08-31 17:43:44 +00:00
Chih-Hung Hsieh
a619ec70cf Fix google-explicit-constructor warnings in libs/hwui.
* Add explicit keyword to conversion constructors,
  or add NOLINT for implicit converters.
Bug: 28341362
Test: build with WITH_TIDY=1

Change-Id: Id8ca42433a4fc3652e4cb13787c4cb169f20d9a9
2016-08-29 14:56:58 -07:00
Chih-Hung Hsieh
56996ff61e resolve merge conflicts of 76ce8e5 to stage-aosp-master am: ed935c32f4
am: ef57a0d629

Change-Id: Ifcc24ad835f2e74a25954bf3fd7090c75abdc084
2016-08-12 00:40:25 +00:00
Chih-Hung Hsieh
ed935c32f4 resolve merge conflicts of 76ce8e5 to stage-aosp-master
Change-Id: I4b4ca9906373a95776d2da8ba2fa39a4a78e2a30
2016-08-11 16:48:46 -07:00
Chih-Hung Hsieh
f35c939cd7 Fix clang-tidy warnings in libs/hwui.
* Add explicit keyword to conversion constructors.
Bug: 28341362
* Use const reference type for read-only parameters.
Bug: 30407689
Test: build with WITH_TIDY=1

Change-Id: Iab3e6636f60a70cb124f29dc19f20f842fa8dfda
Merged-In: Iab3e6636f60a70cb124f29dc19f20f842fa8dfda
2016-08-10 23:26:59 +00:00
Chih-Hung Hsieh
49796451cb Fix clang-tidy warnings in libs/hwui.
* Add explicit keyword to conversion constructors.
Bug: 28341362
* Use const reference type for read-only parameters.
Bug: 30407689
Test: build with WITH_TIDY=1

Change-Id: Iab3e6636f60a70cb124f29dc19f20f842fa8dfda
2016-08-10 16:01:29 -07:00
sergeyv
c3849aa786 HWUI: reimplement rendernode ouput for single stream
bug: 26565102
Change-Id: I90b449b2dce52683c50b48091354104d76a5e44a
2016-08-09 16:29:44 -07:00
Matt Sarett
29c32cd2d5 Remove unused include SkNinePatch.h
Change-Id: I4c34d21633fd4f3d4b1403e3bb473dc2cbd245cd
2016-08-03 13:36:34 +00:00
Hugo Benichi
63d8aa930f Merge \\\"Fix missing IpConnectivity metrics\\\" into nyc-mr1-dev am: 66e7752ad1 am: b2db402899
am: fb5c675b7e

Change-Id: Iba1f81a892acd9f541b9dd564203bfebc56c9c73
2016-07-31 02:13:00 +00:00
John Reck
fb5c675b7e resolve merge conflicts of 67daab6 to nyc-mr1-dev-plus-aosp
Change-Id: I35f867b8d6408a7eae9cf5643f0908259de90cb1
2016-07-29 10:08:16 -07:00
John Reck
2d5b8d7392 Teach JankTracker about new swap behaviors
Bug: 30440166

If we are using HWC2, there's a change in timing
when in triple buffering with the pipelined offsets.
This changes JankTracker to recognize that and silently
erase that from the total duration

Change-Id: Ib1fd4209070f17dbd2baed707c8cf73fb11c3cf2
2016-07-29 07:56:02 -07:00
Chih-Hung Hsieh
faecb78a6b Fix google-explicit-constructor warnings in frameworks/base
* Add explicit keyword to conversion constructors.
* Add NOLINT to implicit conversion constructors.

Bug: 28341362
Test: build with clang-tidy
Change-Id: Ie4d37072ab57d1662d18db4de1c8577247f43337
2016-07-21 16:24:06 -07:00
Chris Craik
5e00c7ce06 Delete old rendering pipeline
fixes: 30002246

Change-Id: I45df0e924708526cee045b14c291bd23aa1a92db
2016-07-07 15:53:50 -07:00
John Reck
ab1080c4d0 Delete unused args
Bug: 21170575
Change-Id: Icc832f70f206342557f44667ad3498405d04db78
2016-06-21 16:24:20 -07:00
The Android Automerger
1ec2fd72ce stephenli@ manually merge many commits up to '032dcff'
* commit '032dcff': (22 commits)
  Remove outdated google services links.
  Fix misc-macro-parentheses warnings in services jni.
  Fix misc-macro-parentheses warnings in hwui and graphic jni.
  Fix misc-macro-parentheses warnings in aapt and androidfw.
  docs: Update to column widths for Complications table
  Fix a11y crash when window layer isn't unique.
  Never set resized while not drag resizing for pinned stack.
  While turning OFF do not honor ON requests.
  Fix GATT autoConnect race condition
  Fix GATT autoConnect race condition
  Fix RTL issue in delete dialog.
  Incorporate feedback on new wallpaper-related APIs
  Mapping up/down of legacy Gps vs. Gnss Status
  Fixed a bug where the chronometer was invisible
  Fixed a bug where the chronometer wasn't updating the time
  Update BlockedNumberContract javadocs.
  [RenderScript] Fix ScriptIntrinsicBlur documentation.
  Update documentation about copyTo and copyFrom.
  DO NOT MERGE Cherry pick libpng usage fixes
  Start the Wear Time System Service with SystemServer
  ...
2016-05-19 23:51:32 +00:00
Chih-Hung Hsieh
0a87059452 resolve merge conflicts of 404e2b2 to nyc-dev-plus-aosp
Change-Id: I3c486e83a3f2b27ee0e6bfe4e3bba3df3af758a5
2016-05-19 16:22:09 -07:00
Chih-Hung Hsieh
cef190de85 Fix misc-macro-parentheses warnings in hwui and graphic jni.
Bug: 28705665
Change-Id: I7d1eb38a713fe6cc7f41a3cc3f2f9d0aa0114b2c
2016-05-19 15:25:50 -07:00
Tenghui Zhu
a7a6be1085 Merge "Turn off some path drawing logs by default" 2016-05-11 21:33:44 +00:00
Matt Sarett
3727a7fada Remove dead code from NinePatch::Draw
This will give me the flexibility to change this API.

Change-Id: I1ee34986e37fffeb03b8a349f29923541f95b593
2016-05-11 19:09:44 +00:00
Chih-Hung Hsieh
d53e3bed1c Fix google-explicit-constructor warnings.
Bug: 28341362
Change-Id: I080090d50f1a368a4e7c1a0732297bb6a295e34f
2016-05-03 10:02:51 -07:00
Teng-Hui Zhu
85d99528b2 Turn off some path drawing logs by default
Originally the logs are added to track potential performance bug.
Like unexpectedly deep recursion loop.
However so far, we haven't captured anything by these logs.
And they are causing some misunderstanding in some bugs.
So I think it is better to disable it by default.

In the future, we will consider switching to direct Skia arcTo support
and drop this part.

Change-Id: Iff6df7a92e40b4775a644a1497e113de0eedbc8a
2016-04-25 15:10:48 -07:00
Sergei Vasilinetc
849ffa33bc Merge "Stop comparing Descriptions with memcmp" into nyc-dev am: e414371
am: 55134c8

* commit '55134c89fe5a524be26558b4ccccdfa6ffa0105f':
  Stop comparing Descriptions with memcmp

Change-Id: I43ea9f9bc2f3f7ba607a85d08dbecf95fcb9e585
2016-04-11 23:14:43 +00:00
Sergei Vasilinetc
e41437167b Merge "Stop comparing Descriptions with memcmp" into nyc-dev 2016-04-11 22:58:57 +00:00
sergeyv
7224e2b624 Stop comparing Descriptions with memcmp
bug:27894959
Change-Id: I379c11381c08f6f77577a914638b32415768f26e
2016-04-11 13:09:00 -07:00
John Reck
4e2838ead6 Merge "Fix some edge cases" into nyc-dev am: 4a62eff
am: c01a9b6

* commit 'c01a9b6a9ba2662fafa6f4152ca9986faacd2d66':
  Fix some edge cases

Change-Id: I52d65ed7c5da33b33a4f98953800c1dedea2bf09
2016-04-07 23:15:52 +00:00
John Reck
51f2d606dc Fix some edge cases
Bug: 27709981

This desperately needs a refactor, but to keep
the current (really needed & nice) behavior of
dispatching after sync finishes would be difficult
to handle cleanly without lots of ripping so... #yolo

Change-Id: I831a06c6ae7412a062720d68ecbe3085190f0258
2016-04-07 14:10:43 -07:00
Chris Craik
5a23f2d940 Merge "Overdraw avoidance in new pipeline" into nyc-dev am: 80a67f3
am: f42e9b1

* commit 'f42e9b1b1e2eeb0e97bfc8d77d1dd24cb21d9e31':
  Overdraw avoidance in new pipeline

Change-Id: I5fa751a4a2a212ef4c805a473d62da41ebaf70ae
2016-03-29 21:55:11 +00:00
Chris Craik
80d2ade939 Overdraw avoidance in new pipeline
bug:27873093

Adds the simple overdraw avoidance optimization to the new
pipeline. This means when LayerBuilder defers draws that are opaque over
the full area of the repaint region, it will discard all drawing content
beneth.

Also moves a lot of complexity out of BakedOpState's header.

Change-Id: Iffca6d8e1b170ef31a5d6c83d25592670e02323d
2016-03-29 13:30:15 -07:00
Chris Craik
a15762ef76 Support op dumping in new pipeline am: 91eff22b5d
am: d39f57e0a7

* commit 'd39f57e0a7bb669adc4aab2a3b40db771dbd23a2':
  Support op dumping in new pipeline
2016-02-23 19:11:47 +00:00
Chris Craik
91eff22b5d Support op dumping in new pipeline
bug:26565102

Change-Id: I266e420a2f18ba9ad62942b8a0de295dfa3a2a88
2016-02-23 18:52:54 +00:00
Chris Craik
a17b5366d5 Merge "Add create_trivial_array" into nyc-dev am: 339fc0a1d2
am: 064b467718

* commit '064b467718e02e42360fce45c985d88333a35cdf':
  Add create_trivial_array
2016-02-22 21:53:15 +00:00
Ben Wagner
ed87fa2a2d Use android_memset32 instead of sk_memset32.
Android code should use the Android version. Also, Skia is interested
in making sk_memset32 private.

BUG:27290333

Change-Id: Id5c8bc190cdd21673c8844eaa48e8b6a93e2e9df
2016-02-22 16:26:02 +00:00
Chris Craik
7a89600bac Add create_trivial_array
Change-Id: I5e4236ff59fdaceb95105c5590f4deeda6d0b4c8
2016-02-19 15:51:02 -08:00
John Reck
7df9ff2a08 Fix all LA memory leaks forever!
Bug: 27072626

Or at least fix this one and make it harder to leak
going forward. static_asserts are cool, use them liberally

Also makes allocation via LA (slightly) faster by fixing create*
variants to use rvalue references & std::forward, preventing
an accidental pass-by-value

Change-Id: I18fd696a93dd6ea49c8d8c587d4c8bee56dbfdf5
2016-02-11 00:42:23 +00:00
John Reck
e537330ead Revert "Fix all LA memory leaks forever!"
This reverts commit 499d83f21e7ffb687788bba1668b05fe38f6ebaf.

Change-Id: Ia893ae16ebbeae68e49cd13a20587104b73d39a0
2016-02-11 00:36:34 +00:00
John Reck
499d83f21e Fix all LA memory leaks forever!
Bug: 27072626

Or at least fix this one and make it harder to leak
going forward. static_asserts are cool, use them liberally

Also makes allocation via LA (slightly) faster by fixing create*
variants to use rvalue references & std::forward, preventing
an accidental pass-by-value

Change-Id: I5e0e36e72c6dd93324194ebf9a95f8204f05f261
2016-02-10 16:11:26 -08:00
John Reck
c52ac0b9e2 Merge "Add fine-grained debug layer" 2016-01-26 15:21:07 +00:00
John Reck
975591a7af Add fine-grained debug layer
Full GLES error checking layer via -include
trickery. Change DEBUG_OPENGL to a level system.

HIGH = every GL call is error checked
MODERATE = checkpointing at interesting spots
LOW = only asserts there are no errors at the end of a frame
 or when the FBO changes
NONE = AIN'T GOT NO TIME FOR ERRORS GOTTA GO FAST!

Change-Id: Ibe81aae93d942059c4ddf1cbb11c828b7ce4c10b
2016-01-25 16:15:14 -08:00
Derek Sollenberger
a3f16d4377 Replace SkALWAYSBREAK with equivalent Android macros.
Change-Id: Icb7786c789915375d7d8754fc8536302c1020858
2016-01-25 10:33:01 -05:00
John Reck
2de7771740 Normalize GL_UNPACK_ALIGNMENT
Several places were setting GL_UNPACK_ALIGNMENT
unneccessarily, whereas other places were assuming an
unpack alignment of 1. Since we never actually
do explicit row-alignment, set GL_UNPACK_ALIGNMENT
to 1 at context creation time and never change it

Bug: 26584230

Also turns on aggressive glGetError checking to
better catch potential problem zones

Change-Id: I190c8f0f0494a7f046d5ed769405c75d363be59a
2016-01-20 13:16:24 -08:00
John Reck
9372ac3621 Fix ordering of texture->upload arguments
Caught by scatter-shotting GL_CHECKPOINTS which
seem generally useful to have

Bug: 26609444

Change-Id: Ie31d9297d8dae56405126720f338b4256c8bae77
2016-01-19 12:58:48 -08:00