Commit Graph

17521 Commits

Author SHA1 Message Date
Brian Salomon
7f23543d1d Minor geometry processor clarification.
Some renames, comments, and override->final

Change-Id: Iebc7aeee9a64021e958f76bf4278ffff56884a56
Reviewed-on: https://skia-review.googlesource.com/35165
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-08-16 14:32:28 +00:00
Stephen White
3f5301b284 GrTessellator: fix for collinear out-of-range intersections.
Change 3b5a3fa8b1 introduced support
for out-of-range intersections, which is necessary when the top and
bottom vertices of an edge differ by only one ULP in the primary sort
order and can't be split in-order.

However, some out-of-range intersections produce edges which cancel
each other out on splitting, in particular when the intersection is
collinear with the newly-computed edge. This undoes the effect of the
split.  The tessellator then rewinds, re-detects the intersection, resplits,
an infinite loop.

The fix is to check for out-of-range intersections which are also
collinear, and ignore them. This is ok, because these are not
the cases we care about it change 3b5a3f above, which are
never collinear.

Bug: 753867
Change-Id: I590231e0e6f19c98f1ccf46cb7acc8a63ba35a9d
Reviewed-on: https://skia-review.googlesource.com/34925
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2017-08-16 13:52:48 +00:00
Stan Iliev
67cd673291 Cache more aggressively in GrSoftwarePathRenderer for Android
Discard fractional translation from the cache key in
GrSoftwarePathRenderer for Android framework. This improves
cache hit ratio and speeds up draw frame 50th percentile for quick
settings jank test by 0.7ms. This quality trade-off is fine and
it is matching HWUI OpenGL renderer behavior.

Bug: b/64487466
Change-Id: I865169aa2acbca80f1399da8bdd7f624f413295e
Reviewed-on: https://skia-review.googlesource.com/34900
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Stan Iliev <stani@google.com>
2017-08-16 13:23:27 +00:00
Mike Klein
25954b64c0 explicitly vectorize sk_memset{16,32,64}
This ought to help clients who don't enable autovectorization.

With autovectorization enabled, this new version is like,
hyper-vectorized compared to the old autovectorization.
Instead of handling 128 bytes max per loop, it now
handles up to 512 bytes per loop.  Pretty exciting.

Locally perf effects are a mix, but we'd expect this to help
Chrome unambiguously if they've turned off autovectorization.

  $ out/ok bench:samples=100 sw filter:match=memset32_\\d\* serial

  Before:
    [memset32_100000]   16ms    @0  20.1ms  @99 20.2ms  @100
    [memset32_10000]    1.07ms  @0  1.26ms  @99 1.31ms  @100
    [memset32_1000]     73.9µs  @0  89.4µs  @99 90.1µs  @100
    [memset32_100]      8.59µs  @0  9.74µs  @99 9.96µs  @100
    [memset32_10]       7.45µs  @0  8.96µs  @99 8.99µs  @100
    [memset32_1]        2.29µs  @0  2.81µs  @99 2.92µs  @100

  After:
    [memset32_100000]   16.2ms  @0  17.3ms  @99 17.3ms  @100
    [memset32_10000]    1.06ms  @0  1.18ms  @99 1.23ms  @100
    [memset32_1000]     72µs    @0  75.6µs  @99 84.7µs  @100
    [memset32_100]      9.14µs  @0  10.6µs  @99 10.7µs  @100
    [memset32_10]       5.43µs  @0  5.88µs  @99 5.99µs  @100
    [memset32_1]        3.43µs  @0  3.65µs  @99 3.83µs  @100

BUG=chromium:755391

Change-Id: If9059a30ca7a345f1f7c37bd51473c29e8bb8922
Reviewed-on: https://skia-review.googlesource.com/34746
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-08-15 22:28:17 +00:00
Herb Derby
8618338c4a Fix bogus math in object allocation.
When a size_t is convert from a very large number to ptrdiff_t, it
becomes negative causing the existing block to be used instead of
allocating a new block.

Remove broken test from last try.

TBR=bungeman@google.com
BUG=chromium:744109

Change-Id: Ifc81bb8f416d64f640730c66bce56a8e4c677173
Reviewed-on: https://skia-review.googlesource.com/35080
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2017-08-15 21:54:27 +00:00
Florin Malita
32491566da Revert "Fix bogus math in object allocation."
This reverts commit 0bc4d60fe0.

Reason for revert: https://chromium-swarm.appspot.com/task?id=38007b6df51fef10&refresh=10

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Caught signal 6 [Aborted], was running:
	8888 image scanline_kNonNative_premul interlaced3.png
	unit test  ArenaAllocReallyBigAlloc
	unit test  ClampRange
	565 image scaled_codec_premul_0.200 interlaced3.png_0.200
	unit test  ClipStack
Likely culprit:
	unit test  ArenaAllocReallyBigAlloc
Stack trace:
    /mnt/pd0/s/w/ir/out/Debug/dm(+0x2381c1) [0x567aa1c1]
    linux-gate.so.1(__kernel_sigreturn+0) [0xf770cca0]
    linux-gate.so.1(__kernel_vsyscall+0x9) [0xf770cc89]
    /lib/i386-linux-gnu/libc.so.6(gsignal+0xb0) [0xf7027dc0]
    /lib/i386-linux-gnu/libc.so.6(abort+0x157) [0xf7029287]
    /usr/lib/i386-linux-gnu/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x16f) [0xf729d2ff]
    /usr/lib/i386-linux-gnu/libstdc++.so.6(+0x71ea4) [0xf729aea4]
    /usr/lib/i386-linux-gnu/libstdc++.so.6(+0x71f1d) [0xf729af1d]
    /usr/lib/i386-linux-gnu/libstdc++.so.6(__cxa_rethrow+0) [0xf729b1d0]
    /usr/lib/i386-linux-gnu/libstdc++.so.6(+0x727ff) [0xf729b7ff]
    /usr/lib/i386-linux-gnu/libstdc++.so.6(_Znaj+0x18) [0xf729b898]
    /mnt/pd0/s/w/ir/out/Debug/dm(_ZN12SkArenaAlloc11ensureSpaceEjj+0xa0) [0x56f113a6]
    /mnt/pd0/s/w/ir/out/Debug/dm(+0x3c2462) [0x56934462]
    /mnt/pd0/s/w/ir/out/Debug/dm(+0x239acb) [0x567abacb]
    /mnt/pd0/s/w/ir/out/Debug/dm(+0x239bdc) [0x567abbdc]
    /mnt/pd0/s/w/ir/out/Debug/dm(+0xa6417b) [0x56fd617b]
    /mnt/pd0/s/w/ir/out/Debug/dm(_ZNKSt8functionIFvvEEclEv+0x20) [0x56f10504]
    /mnt/pd0/s/w/ir/out/Debug/dm(_ZN12SkThreadPool4LoopEPv+0x298) [0x56f10bdb]
    /mnt/pd0/s/w/ir/out/Debug/dm(+0xb39700) [0x570ab700]
    /lib/i386-linux-gnu/libpthread.so.0(+0x627a) [0xf76df27a]
    /lib/i386-linux-gnu/libc.so.6(clone+0x66) [0xf70e3b56]
Aborted
Command exited with code 134

Original change's description:
> Fix bogus math in object allocation.
> 
> When a size_t is convert from a very large number to ptrdiff_t, it
> becomes negative causing the existing block to be used instead of
> allocating a new block.
> 
> BUG=chromium:744109
> 
> Change-Id: I0bf98e3fb924851c162f6eca43d29a3f40dc9eaa
> Reviewed-on: https://skia-review.googlesource.com/34541
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Herb Derby <herb@google.com>

TBR=bungeman@google.com,herb@google.com

Change-Id: I8ce2b45d13178395247dabd7af6853354399721c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:744109
Reviewed-on: https://skia-review.googlesource.com/35000
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-08-15 21:07:19 +00:00
Herb Derby
0bc4d60fe0 Fix bogus math in object allocation.
When a size_t is convert from a very large number to ptrdiff_t, it
becomes negative causing the existing block to be used instead of
allocating a new block.

BUG=chromium:744109

Change-Id: I0bf98e3fb924851c162f6eca43d29a3f40dc9eaa
Reviewed-on: https://skia-review.googlesource.com/34541
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2017-08-15 20:40:27 +00:00
Florin Malita
3ad19e5957 Skip bilerp for integral-translate-only matrices (!clamp-clamp case)
We've landed https://skia-review.googlesource.com/24126 to restore this
optimization, but we check too late: for non-clamp/clamp cases we'd
already adjusted the matrix scale, so the optimization never kicks in.

Relocate the integral translation check before all other matrix
adjustments.

BUG=chromium:744674

Change-Id: I395d327c3ddf74dc6d23bb8aee782ec62a7373f1
Reviewed-on: https://skia-review.googlesource.com/34840
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2017-08-15 20:36:47 +00:00
Herb Derby
15bb26ec70 Add an average mode for sigma < 2
The original code had an optimization when sigma < 2 that averaged
pixels instead of Gaussian bluring them. This CL adds that
behavior back to the new implementation.

Add the flag SK_LEGACY_USE_GAUSS_FOR_SMALL_RADII to control the
new behavior.

BUG=chromium:745290

Change-Id: I6e7417ce7f42949f88376b549743a9f047667f09
Reviewed-on: https://skia-review.googlesource.com/34624
Commit-Queue: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2017-08-15 18:55:59 +00:00
Brian Osman
8d4b56b3f5 Don't emit CRLF when generating code on Windows (from SkSL)
Bug: skia:
Change-Id: I3f3c5f9df43e48f975b09f0bafadf03a15afec51
Reviewed-on: https://skia-review.googlesource.com/34745
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-08-15 18:51:08 +00:00
Brian Osman
634624a185 Micro optimizations to SkSL parser
Some of these are pretty trivial, but a few really moved the needle. In
total, this cut the time in the parser by about 10% in my profiling.

The early returns from peek and checkNext are probably the biggest wins,
everything else is mostly about cutting down on string copying.

Bug: skia:
Change-Id: I3da0a0cfbc557e8cef480cb3a7d301c2b3f8802a
Reviewed-on: https://skia-review.googlesource.com/34720
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-08-15 15:38:26 +00:00
Herb Derby
4009668cb8 Revert "Revert "Revert "Add an average mode for sigma < 2"""
This reverts commit f6975ea5fb.

Reason for revert:
Did not take into account there are layout test problems too. Adding a legacy flag.

Original change's description:
> Revert "Revert "Add an average mode for sigma < 2""
> 
> We are going to have the google3 auto roller build the CL,
> and add the fixes to the failing tests to that CL. Because
> these are scuba changes, this should be simpler.
> 
> This reverts commit 8e7503195c.
> 
> Reason for revert: <INSERT REASONING HERE>
> 
> Original change's description:
> > Revert "Add an average mode for sigma < 2"
> > 
> > This reverts commit ba8275148a.
> > 
> > Reason for revert: layout tests, Google3 equivalent failing.
> > 
> > Original change's description:
> > > Add an average mode for sigma < 2
> > > 
> > > The original code had an optimization when sigma < 2 that averaged
> > > pixels instead of Gaussian bluring them. This CL adds that
> > > behavior back to the new implementat.
> > > 
> > > BUG=chromium:745290
> > > Change-Id: I35b7de2138a859d546439cc2053b4b599a94ebe1
> > > Reviewed-on: https://skia-review.googlesource.com/34180
> > > Commit-Queue: Herb Derby <herb@google.com>
> > > Reviewed-by: Mike Klein <mtklein@chromium.org>
> > 
> > TBR=mtklein@chromium.org,mtklein@google.com,herb@google.com
> > 
> > Change-Id: Ie8f38b042acec42260913cb7bed5538a2c957e9b
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: chromium:745290
> > Reviewed-on: https://skia-review.googlesource.com/34640
> > Reviewed-by: Mike Klein <mtklein@google.com>
> > Commit-Queue: Mike Klein <mtklein@google.com>
> 
> TBR=mtklein@chromium.org,mtklein@google.com,herb@google.com
> 
> Change-Id: I5f7b706a2f8c8d52b3576c638ecddf12a1652031
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:745290
> Reviewed-on: https://skia-review.googlesource.com/34641
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Herb Derby <herb@google.com>

TBR=mtklein@chromium.org,mtklein@google.com,herb@google.com

Change-Id: I9064f8494e5a1a4a78dd545697e22f52985c0fa1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:745290
Reviewed-on: https://skia-review.googlesource.com/34623
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2017-08-15 15:09:57 +00:00
Herb Derby
f6975ea5fb Revert "Revert "Add an average mode for sigma < 2""
We are going to have the google3 auto roller build the CL,
and add the fixes to the failing tests to that CL. Because
these are scuba changes, this should be simpler.

This reverts commit 8e7503195c.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Revert "Add an average mode for sigma < 2"
> 
> This reverts commit ba8275148a.
> 
> Reason for revert: layout tests, Google3 equivalent failing.
> 
> Original change's description:
> > Add an average mode for sigma < 2
> > 
> > The original code had an optimization when sigma < 2 that averaged
> > pixels instead of Gaussian bluring them. This CL adds that
> > behavior back to the new implementat.
> > 
> > BUG=chromium:745290
> > Change-Id: I35b7de2138a859d546439cc2053b4b599a94ebe1
> > Reviewed-on: https://skia-review.googlesource.com/34180
> > Commit-Queue: Herb Derby <herb@google.com>
> > Reviewed-by: Mike Klein <mtklein@chromium.org>
> 
> TBR=mtklein@chromium.org,mtklein@google.com,herb@google.com
> 
> Change-Id: Ie8f38b042acec42260913cb7bed5538a2c957e9b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:745290
> Reviewed-on: https://skia-review.googlesource.com/34640
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

TBR=mtklein@chromium.org,mtklein@google.com,herb@google.com

Change-Id: I5f7b706a2f8c8d52b3576c638ecddf12a1652031
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:745290
Reviewed-on: https://skia-review.googlesource.com/34641
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2017-08-15 15:00:17 +00:00
Brian Osman
72a37bed66 Fix string typing in generated code
Bug: skia:
Change-Id: Ifbccc6d6880522177ac7a0ae2183be64a3ebfe50
Reviewed-on: https://skia-review.googlesource.com/34681
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2017-08-15 13:41:26 +00:00
Mike Klein
5b117eafdf rename confusing lowp guard
Change-Id: I346429015e5f902b0a35663e140bb9a025c4220e
Reviewed-on: https://skia-review.googlesource.com/34680
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-08-15 13:19:36 +00:00
Mike Klein
8e7503195c Revert "Add an average mode for sigma < 2"
This reverts commit ba8275148a.

Reason for revert: layout tests, Google3 equivalent failing.

Original change's description:
> Add an average mode for sigma < 2
> 
> The original code had an optimization when sigma < 2 that averaged
> pixels instead of Gaussian bluring them. This CL adds that
> behavior back to the new implementat.
> 
> BUG=chromium:745290
> Change-Id: I35b7de2138a859d546439cc2053b4b599a94ebe1
> Reviewed-on: https://skia-review.googlesource.com/34180
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Mike Klein <mtklein@chromium.org>

TBR=mtklein@chromium.org,mtklein@google.com,herb@google.com

Change-Id: Ie8f38b042acec42260913cb7bed5538a2c957e9b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:745290
Reviewed-on: https://skia-review.googlesource.com/34640
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2017-08-15 12:47:27 +00:00
Florin Malita
5bfc85a8b3 Lowp overlay, hardlight stages
Before:

    micros   	bench
   7669.09 ?	blendmode_rect_HardLight	8888
   8707.13 ?	blendmode_rect_Overlay	8888


After:

    micros   	bench
   6679.60 ?	blendmode_rect_HardLight	8888
   6789.57 ?	blendmode_rect_Overlay	8888

Change-Id: I52f389253fa07dafe18e572af550af7387264a16
Reviewed-on: https://skia-review.googlesource.com/34280
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2017-08-14 21:31:25 +00:00
Brian Osman
93ba0a4fc8 Switch SkSL to std::string
On desktop, this saves just over 5% of the time in the SkSL compiler.

As written, the code will now build either way, so it's much easier to
switch back (or even have some platforms use SkString, if that's ever
required).

Bug: skia:
Change-Id: I634f26a4f6fcb404e59bda6a5c6a21a9c6d73c0b
Reviewed-on: https://skia-review.googlesource.com/34381
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-08-14 21:24:55 +00:00
Herb Derby
ba8275148a Add an average mode for sigma < 2
The original code had an optimization when sigma < 2 that averaged
pixels instead of Gaussian bluring them. This CL adds that
behavior back to the new implementat.

BUG=chromium:745290
Change-Id: I35b7de2138a859d546439cc2053b4b599a94ebe1
Reviewed-on: https://skia-review.googlesource.com/34180
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
2017-08-14 20:20:55 +00:00
Ben Wagner
aee878d767 Move lang to list in Android font manager.
Change-Id: Ia4af2769f4761e6b444ed0c232c48199872f3acc
Reviewed-on: https://skia-review.googlesource.com/33480
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2017-08-14 19:29:05 +00:00
Robert Phillips
ddfd2a6627 Use kLow_SkFilterQuality in generateGlyphImage
This reduces jank when flinging a page of emoji on Android (I have separately shared out a spreadsheet). Arguably, the quality loss should be acceptable since we shouldn't be down-scaling that much (magnitude-wise not frequency-wise). Ideally, we would add a raster mode where we would draw at the correct size w/o generating the mip maps.

Change-Id: Id91d638db1b2457567e54c264ed3fa5d10316976
Reviewed-on: https://skia-review.googlesource.com/33763
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-08-14 17:39:04 +00:00
Mike Klein
17e33cc7b0 we never define BLEND_MODE
Change-Id: I88f3e56971e9844ab2ff74edb0718e6b6e9c6559
Reviewed-on: https://skia-review.googlesource.com/34260
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-08-14 16:58:04 +00:00
Ethan Nicholas
08b79b73a0 reduced number of string copies in SkSL parser
Bug: skia:
Change-Id: Iab823b01b6f5f85bbb47c4ac69c6ce396dabf497
Reviewed-on: https://skia-review.googlesource.com/34000
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2017-08-14 16:19:44 +00:00
Mike Klein
7cc49d65fc Record SkCanvas::flush().
We can record multiple frames in an .skp by recording SkCanvas::flush().
This should make SkPictures, SkLiteDL, and .skp files all record flush().

Change-Id: I6cf6e0e4ef993530d9f92fa168a53702ffce7d5e
Reviewed-on: https://skia-review.googlesource.com/34081
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-08-14 15:29:05 +00:00
Brian Osman
0db0779199 Fix tracing macros for framework builds
Bug: skia:
Change-Id: Ia5c27af2c8dafd5d6f2171fa82f435dbfdebd346
Reviewed-on: https://skia-review.googlesource.com/33760
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-08-14 15:12:05 +00:00
Mike Klein
228f761111 Simplify difference and exclusion.
We can fold through some math in these two modes.

$ out/ok bench:samples=100 rp filter:search="Difference|Exclusion" serial

Before:
    [blendmode_rect_Exclusion]  4.94ms  @0  6.13ms  @99 6.25ms  @100
    [blendmode_mask_Exclusion]  10.9ms  @0  12.8ms  @99 12.9ms  @100
    [blendmode_rect_Difference] 5.56ms  @0  6.79ms  @99 6.8ms   @100
    [blendmode_mask_Difference] 11.4ms  @0  13.8ms  @99 14.1ms  @100

After:
    [blendmode_rect_Exclusion]  3.5ms   @0  4.12ms  @99 4.59ms  @100
    [blendmode_mask_Exclusion]  9.27ms  @0  11.2ms  @99 11.6ms  @100
    [blendmode_rect_Difference] 5.37ms  @0  6.58ms  @99 6.6ms   @100
    [blendmode_mask_Difference] 11ms    @0  12.1ms  @99 12.6ms  @100

Change-Id: I03f32368244d4f979cfee83723fd78dfbc7d5fc1
Reviewed-on: https://skia-review.googlesource.com/33980
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2017-08-14 14:22:46 +00:00
Florin Malita
8ae12751f0 lowp: lighten, difference, exclusion
Change-Id: I5773cf831c7e41a932bee1f2c6830085fb7db025
Reviewed-on: https://skia-review.googlesource.com/33764
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2017-08-14 00:00:58 +00:00
Florin Malita
1c293c083d Guard lowp changes
Chromium uses the lowp code, we have to stage the changes.

TBR=
Change-Id: I45e97a51eca285c9afc71926bbf736a03d0d146c
Reviewed-on: https://skia-review.googlesource.com/33765
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-08-11 22:59:56 +00:00
Florin Malita
0bf0bc65e2 Lowp darken stage
Change-Id: I4bf618ad8728541fcef3fc1c6aa5b3ca106d50dc
Reviewed-on: https://skia-review.googlesource.com/33583
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
2017-08-11 21:13:37 +00:00
Yuqian Li
6ad3ffeed1 Guard AA change to wait for rebaselines
We use SK_SUPPORT_LEGACY_DELTA_AA to guard the golden image change.
Such flag is defined for Android, Chrome, and Google3 so our auto-rollers
should all be OK.

TBR: bungeman@google.com

Bug: skia:6947
Change-Id: Ic2705e82f4f7f15ec08499254dce75b93d41727e
Reviewed-on: https://skia-review.googlesource.com/33762
Reviewed-by: Yuqian Li <liyuqian@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
2017-08-11 21:12:37 +00:00
Derek Sollenberger
dbb9e3682e Avoid converting drawImage/drawImageRect into drawBitmap calls
Change-Id: I1ae551afa93222126852bb9e429a565379a93f24
Reviewed-on: https://skia-review.googlesource.com/33661
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2017-08-11 20:14:10 +00:00
Brian Salomon
528751873a Remove CHECK_SHOULD_DRAW from SkGpuDevice
Change-Id: Ieb3910e2085235c62374d3e30d1ce6b9089de567
Reviewed-on: https://skia-review.googlesource.com/33780
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-08-11 19:50:36 +00:00
Herb Derby
35ae65d5d0 SkSafeMath for tracking size_t overflow
Do multiply (mul) and add while tracking that the
calculation does not overflow, which can be checked with
ok().

The new unit test shows a couple examples.

Author:  Herb Derby <herb@google.com>
Change-Id: I7e67671d2488d67f21d47d9618736a6bae8f23c3
Reviewed-on: https://skia-review.googlesource.com/33721
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Herb Derby <herb@google.com>
2017-08-11 19:23:06 +00:00
Yuqian Li
4a31c46006 Don't store clipped x which could break edge order
We only need to clip a temporary x to ensure that we don't blit
beyond clip. Storing such clipped x is problematic because it
may make our edges unsorted.

The added unit test would fail without this fix.

Bug: skia:6947
Change-Id: I6c21d7c7c097e50fef18ab151921d6c07c089318
Reviewed-on: https://skia-review.googlesource.com/33420
Commit-Queue: Yuqian Li <liyuqian@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2017-08-11 19:05:56 +00:00
Mike Klein
c10850f4e7 remove mask load() and store()
They appear to be slower than the generic load() and store() now.

    [blendmode_mask_Hue]    14.7ms  @0  15.6ms  @95 39.6ms  @100
    [blendmode_rect_Hue]    31.5ms  @0  37.6ms  @95 39.5ms  @100
    ~~>
    [blendmode_mask_Hue]    14.7ms  @0  15.2ms  @95 39.5ms  @100
    [blendmode_rect_Hue]    30.5ms  @0  32.6ms  @95 37.8ms  @100

Change-Id: I674b75087b8139debead71f3016631bcb0cb0047
Reviewed-on: https://skia-review.googlesource.com/33800
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-08-11 18:52:36 +00:00
Brian Osman
6382f455f0 Replace log2 with SkNextLog2
log2 didn't exist on Android until API 18, and it's doing double
precision math. I think this integer version is what we want?

Bug: skia:
Change-Id: I4909153c56a266688355349cda5d553b69f5c942
Reviewed-on: https://skia-review.googlesource.com/33680
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-08-11 18:05:26 +00:00
Mike Klein
a1d1703b74 double pump 8-bit stages
This basically unrolls all loops, handling twice as many pixels in a
stride.  We now pass around 4 native registers instead of just 2.

I've temporarily disabled AVX2 mask loads and stores.  It shouldn't be
hard to turn them back on, but I'd want to test on AVX2 hardware first.

Change-Id: I0907070f086a0650167456c149a479c1d96b8a2d
Reviewed-on: https://skia-review.googlesource.com/33361
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-08-11 16:52:06 +00:00
Ben Wagner
423d1633d1 Revert "Remove subpixel positioning implies no bytecode hinting."
This reverts commit 880768032d.

Reason for revert: Pixel tests, and gfx tests can't handle hinting.

Original change's description:
> Remove subpixel positioning implies no bytecode hinting.
> 
> SkTypeface_FreeType::onFilterRec currently assumes that if we're asked
> to do subpixel positioning, don't do bytecode hinting. The idea was that
> both could not be satisfied at the same time, so pick something. This is
> no longer true, as with the v40 interpreter it is possible to get
> subpixel positioned but bytcode hinted glyphs.
> 
> BUG=skia:6931
> 
> Change-Id: Ifaeff20c121d6bb4b9287f552e383547eb6d5d49
> Reviewed-on: https://skia-review.googlesource.com/32201
> Reviewed-by: Yuqian Li <liyuqian@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

TBR=bungeman@google.com,liyuqian@google.com,reed@google.com

Change-Id: Idb1ee50d271846bdf962986914f6b75e3aa817c8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:6931
Reviewed-on: https://skia-review.googlesource.com/33586
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2017-08-11 16:25:42 +00:00
Ben Wagner
880768032d Remove subpixel positioning implies no bytecode hinting.
SkTypeface_FreeType::onFilterRec currently assumes that if we're asked
to do subpixel positioning, don't do bytecode hinting. The idea was that
both could not be satisfied at the same time, so pick something. This is
no longer true, as with the v40 interpreter it is possible to get
subpixel positioned but bytcode hinted glyphs.

BUG=skia:6931

Change-Id: Ifaeff20c121d6bb4b9287f552e383547eb6d5d49
Reviewed-on: https://skia-review.googlesource.com/32201
Reviewed-by: Yuqian Li <liyuqian@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2017-08-11 14:21:27 +00:00
Brian Osman
26080be49f Much lower overhead Skia event tracing in the framework
Bug: skia:
Change-Id: I0172e9e74898fb615cbb0ac61e46cbf9012ae75b
Reviewed-on: https://skia-review.googlesource.com/33262
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-08-11 14:15:06 +00:00
Brian Salomon
aff329b8e9 Make GrFragmentProcessor be non-refcounted and use std::unique_ptr.
Change-Id: I985e54a071338e99292a5aa2f42c92bc115b4008
Reviewed-on: https://skia-review.googlesource.com/32760
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2017-08-11 14:13:26 +00:00
Adrienne Walker
ad8da8ea99 Expose SkPath validation as boolean
As a part of serializing SkPaths, I want to be able to know (without
asserting) whether or not a path is valid so that I can discard
potentially malicious deserialized paths.

Currently, SkPath(Ref) both just have asserting validation functions
which can't be used externally.  This patch adds accessors that don't
assert.

Bug: chromium:752755 skia:6955
Change-Id: I4d0ceb31ec660b87e3fda438392ad2b60a27a0da
Reviewed-on: https://skia-review.googlesource.com/31720
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2017-08-10 20:22:35 +00:00
Brian Osman
e4f846aae7 Bypass libandroid dynamic linking for ATrace in framework builds
These symbols were resolving, but weren't really connected to systrace
on Android. Using the macros/functions allows this to work correctly.

This change doesn't actually cause anything to happen in framework
builds - that still requires installing an instance of SkATrace, but
now doing so will route all of Skia's TRACE_EVENT macros to systrace.

Bug: skia:
Change-Id: I6d2eafac7ef2531ba92094b92f68e59e0490ef62
Reviewed-on: https://skia-review.googlesource.com/33400
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-08-10 20:05:36 +00:00
Robert Phillips
8c326e9b81 Remove fStencilClearValue from Vulkan's CommandBufferInfo struct
Adding this extra field to the CommandBufferInfo may or may not have led to a memory regression.

Remove it until it is actually needed.

Change-Id: Ibdddbeb7625f91f5199584a575289f07f6e95304
Reviewed-on: https://skia-review.googlesource.com/33280
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-08-10 18:12:56 +00:00
Brian Salomon
b74ef035a4 Hide GrPaint copy constructor and add GrPaint::Clone and remove MoveOrNew and MoveOrCopy.
Also makes paint clones use cloned fragment processors.

Change-Id: I60efcfc6a46a4f8430a72f4d1ec79c7d99fbe593
Reviewed-on: https://skia-review.googlesource.com/33084
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-08-10 17:56:45 +00:00
Yuqian Li
92e6cc6b2d Some performance tweaks for DAA
1. Always inline (Clang previously ignored inline and got 25% slower)
2. SIMD everywhere other than x86 gcc:
   non-SIMD is only faster in my desktop with gcc;
   with Clang on my desktop, SIMD is 50% faster than non-SIMD.
3. Allocate 4x memory instead of 2x when running out of space:
   on old Android devices with Linux kernel 3.10 (e.g., Nexus 6P, 5X),
   the alloc/memcpy will triger a major bottleneck in kernel (30% of
   the running time). Such bottleneck goes away (the kernel is no
   longer doing stupid things during alloc/memcpy) in Linux kernel
   3.18 (e.g., Pixel), and that's why DAA is much faster on Pixel than
   on Nexus 6P.

I think maybe I should adopt SkRasterPipeline for device-specific
optimizations.

Bug: skia:
Change-Id: I0408aa7671a5f1b39aad3bec25f8fc994ff5a1bb
Reviewed-on: https://skia-review.googlesource.com/30820
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
2017-08-10 17:56:25 +00:00
Brian Osman
80488229ea Revert "Revert "Support single line objects and arrays""
This reverts commit a5a69cfb48.

Bug: skia:
Change-Id: I08475d96255b9df13e5c86e1ef9c7f4739e51459
Reviewed-on: https://skia-review.googlesource.com/33202
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-08-10 17:47:26 +00:00
Brian Osman
31c075eb14 Avoid errors about re-defining __STDC_FORMAT_MACROS
Bug: skia:
Change-Id: I880e3d5a668743ac12fb0101baca637443e920b4
Reviewed-on: https://skia-review.googlesource.com/33082
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-08-10 17:06:35 +00:00
Brian Osman
71a1889a14 Revert "Revert "GrContext::dump that produces JSON formatted output""
This reverts commit 0f450acd76.

Bug: skia:
Change-Id: I97428fbbc6d82bf8b186ec5fdbf1a939c00e4126
Reviewed-on: https://skia-review.googlesource.com/32726
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-08-10 15:42:25 +00:00
Mike Klein
c2f876bb8d Replace interp() with clut_{3,4}D stages.
I tried to follow exactly the same strategy as a start.
(Though I did fix the off-by-one dimensions.)

It does rather look like we only need 3D and 4D now
that I've looked at the call sites.

Looks like about a 20% speedup.

Change-Id: I8b1af64750ad1750716ee1ab0767e64591c7206a
Reviewed-on: https://skia-review.googlesource.com/32842
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2017-08-10 14:34:35 +00:00