Commit Graph

31 Commits

Author SHA1 Message Date
egdaniel
91957941ce Revert of Rewrite GrTextureMaker to disentangle bitmap case from base class and give GPU object a say in what… (patchset #4 id:60001 of https://codereview.chromium.org/1409163002/ )
Reason for revert:
breaking nanobench

Original issue's description:
> Rewrite GrTextureMaker to disentangle bitmap case from base class and give GPU object a say in what copying needs to be done.
>
> Committed: https://skia.googlesource.com/skia/+/fcffaf22d697f06f903c3193308f9dc54a959f79

TBR=reed@google.com,bsalomon@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1409923003
2015-10-16 13:59:14 -07:00
bsalomon
fcffaf22d6 Rewrite GrTextureMaker to disentangle bitmap case from base class and give GPU object a say in what copying needs to be done.
Review URL: https://codereview.chromium.org/1409163002
2015-10-16 13:35:10 -07:00
herb
62a69c26b3 Move Mutexy things to private.
There is no API change.

TBR=reed@google.com

BUG=skia:

Review URL: https://codereview.chromium.org/1368333004
2015-09-29 11:47:45 -07:00
bungeman
f3c15b7cfc Move SkTemplates.h to private.
SkTemplates.h contains a number of Skia specific utilities which are
not designed for external use. In addition to reducing the external
support burden, this will allow Skia to freely refactor this file.

Review URL: https://codereview.chromium.org/1272293004
2015-08-19 11:56:48 -07:00
senorblanco
84cd621670 Implement caching of filled paths in the tessellated path renderer.
Paths are cached as tessellated triangle meshes in vertex buffers on the GPU. Stroked paths are not (yet) cached.

Paths containing no curved segments (linear paths) are reused at all scales. Paths containing curved segments are reused within a scale tolerance threshold.

In order to invalidate the cache when an SkPath is changed or deleted,
this required implementing genID change notification in SkPath. This is
modelled almost exactly on SkPixelRef::GenIDChangeListener.
However, It does not currently implement the check for unique genIDs,
so notifiers will fire when the first instance of an SkPathRef
using a given genID is destroyed.

Another caveat is that you cannot successfully add a change notifier
to an empty path, since it uses the "canonical" empty path which is
never modified or destroyed. For this reason, we prevent adding
listeners to it.

BUG=skia:4121,skia:4122, 497403
DOCS_PREVIEW= https://skia.org/?cl=1114353004

Committed: https://skia.googlesource.com/skia/+/468dfa72eb6694145487be17876804dfca3b7adb

Review URL: https://codereview.chromium.org/1114353004
2015-08-04 10:01:58 -07:00
mtklein
562a66b093 Revert "Implement caching of filled paths in the tessellated path renderer."
This reverts commit 468dfa72eb.

    This CL caused signficant GM diffs.

Revert "Fix resource cache test."
This reverts commit b001c41ed3.
Revert "Fix SkData leaks at GrResourceKey::setCustomData() call sites."
This reverts commit c369348aa5.

    These CLs depend on the first one.

BUG=skia:
TBR=bsalomon@google.com

Review URL: https://codereview.chromium.org/1260363007
2015-08-04 08:46:16 -07:00
senorblanco
468dfa72eb Implement caching of filled paths in the tessellated path renderer.
Paths are cached as tessellated triangle meshes in vertex buffers on the GPU. Stroked paths are not (yet) cached.

Paths containing no curved segments (linear paths) are reused at all scales. Paths containing curved segments are reused within a scale tolerance threshold.

In order to invalidate the cache when an SkPath is changed or deleted,
this required implementing genID change notification in SkPath. This is
modelled almost exactly on SkPixelRef::GenIDChangeListener.
However, It does not currently implement the check for unique genIDs,
so notifiers will fire when the first instance of an SkPathRef
using a given genID is destroyed.

Another caveat is that you cannot successfully add a change notifier
to an empty path, since it uses the "canonical" empty path which is
never modified or destroyed. For this reason, we prevent adding
listeners to it.

BUG=skia:4121,skia:4122, 497403
DOCS_PREVIEW= https://skia.org/?cl=1114353004

Review URL: https://codereview.chromium.org/1114353004
2015-08-03 13:04:03 -07:00
kkinnunen
54b8511189 Make GrResourceCache perf less sensitive to key length change
Make GrResourceCache performance less sensitive to key length change.
The memcmp in GrResourceKey is called when SkTDynamicHash jumps the
slots to find the hash by a index. Avoid most of the memcmps by
comparing the hash first.

This is important because small changes in key data length can cause
big performance regressions. The theory is that key length change causes
different hash values. These hash values might trigger memcmps that
originally weren't there, causing the regression.

Adds few specialized benches to grresourcecache_add to test different
key lengths. The tests are run only on release, because on debug the
SkTDynamicHash validation takes too long, and adding many such delays
to development test runs would be unproductive. On release the tests
are quite fast.

Effect of this patch to the added tests on amd64:
grresourcecache_find_10  738us ->  768us        1.04x
 grresourcecache_find_2  472us ->  476us        1.01x
grresourcecache_find_25  841us ->  845us        1x
 grresourcecache_find_4  565us ->  531us        0.94x
grresourcecache_find_54 1.18ms ->  1.1ms        0.93x
 grresourcecache_find_5  834us ->  749us        0.9x
 grresourcecache_find_3  620us ->  542us        0.87x
 grresourcecache_add_25 2.74ms -> 2.24ms        0.82x
 grresourcecache_add_56 3.23ms -> 2.56ms        0.79x
 grresourcecache_add_54 3.34ms -> 2.62ms        0.78x
  grresourcecache_add_5 2.68ms ->  2.1ms        0.78x
 grresourcecache_add_10  2.7ms -> 2.11ms        0.78x
  grresourcecache_add_2 1.85ms -> 1.41ms        0.76x
    grresourcecache_add 1.84ms ->  1.4ms        0.76x
  grresourcecache_add_4 1.99ms -> 1.49ms        0.75x
  grresourcecache_add_3 2.11ms -> 1.55ms        0.73x
 grresourcecache_add_55   39ms -> 13.9ms        0.36x
grresourcecache_find_55 23.2ms -> 6.21ms        0.27x

On arm64 the results are similar.

On arm_v7_neon, the results lack the discontinuity at 55:
    grresourcecache_add 4.06ms -> 4.26ms        1.05x
  grresourcecache_add_2 4.05ms -> 4.23ms        1.05x
   grresourcecache_find 1.28ms ->  1.3ms        1.02x
grresourcecache_find_56 3.35ms -> 3.32ms        0.99x
 grresourcecache_find_2 1.31ms -> 1.29ms        0.99x
grresourcecache_find_54 3.28ms -> 3.24ms        0.99x
  grresourcecache_add_5 6.38ms -> 6.26ms        0.98x
 grresourcecache_add_55 8.44ms -> 8.24ms        0.98x
 grresourcecache_add_25 7.03ms -> 6.86ms        0.98x
grresourcecache_find_25  2.7ms -> 2.59ms        0.96x
 grresourcecache_find_4 1.45ms -> 1.38ms        0.95x
grresourcecache_find_10 2.52ms -> 2.39ms        0.95x
grresourcecache_find_55 3.54ms -> 3.33ms        0.94x
 grresourcecache_find_5  2.5ms -> 2.32ms        0.93x
 grresourcecache_find_3 1.57ms -> 1.43ms        0.91x

The extremely slow case, 55, is postulated to be due to the index jump
collisions running the memcmp. This is not visible on arm_v7_neon probably due
to hash function producing different results for 32 bit architectures.

This change is needed for extending path cache key in Gr
NV_path_rendering codepath. Extending is needed in order to add dashed
paths to the path cache.

Review URL: https://codereview.chromium.org/1132723003
2015-05-18 22:47:33 -07:00
bsalomon
ed0bcad9c8 Move instanced index buffer creation to flush time
Committed: https://skia.googlesource.com/skia/+/ab622c7b8cc8c39f0a594e4392b9e31b7e1ddb26

Review URL: https://codereview.chromium.org/1116943004
2015-05-04 10:36:43 -07:00
bsalomon
d8ed1b64a6 Revert of Move instanced index buffer creation to flush time (patchset #6 id:100001 of https://codereview.chromium.org/1116943004/)
Reason for revert:
messed up caching, recreating index buffers all the time.

Original issue's description:
> Move instanced index buffer creation to flush time
>
> Committed: https://skia.googlesource.com/skia/+/ab622c7b8cc8c39f0a594e4392b9e31b7e1ddb26

TBR=joshualitt@google.com,robertphillips@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1126613003
2015-05-04 10:09:24 -07:00
bsalomon
ab622c7b8c Move instanced index buffer creation to flush time
Review URL: https://codereview.chromium.org/1116943004
2015-05-04 08:09:30 -07:00
bsalomon
f99e961f55 Allow resources' unique keys to be changed.
Review URL: https://codereview.chromium.org/938943002
2015-02-19 08:24:16 -08:00
bsalomon
8718aafec2 Rename GrContentKey to GrUniqueKey
Review URL: https://codereview.chromium.org/940463006
2015-02-19 07:24:21 -08:00
bsalomon
0aa94798c9 Use SkAutoSTMalloc in GrResourceKey
TBR=robertphillips@google.com

Review URL: https://codereview.chromium.org/935863003
2015-02-18 11:33:04 -08:00
bsalomon
23e619cf46 Reimplement gpu message bus for invalidated bitmap gen IDs
Review URL: https://codereview.chromium.org/902873002
2015-02-06 11:54:28 -08:00
bsalomon
37f9a2694c Move npot resizing out of GrContext and simplify GrContext texture functions.
Committed: https://skia.googlesource.com/skia/+/8a8100349105c8c6de39fcb34e47679da7a67f54

Committed: https://skia.googlesource.com/skia/+/6c96672491b04cb782bce8fee778124df66524a0

Review URL: https://codereview.chromium.org/882223003
2015-02-02 13:00:10 -08:00
bsalomon
e137db8569 Revert of Move npot resizing out of GrContext and simplify GrContext texture functions. (patchset #10 id:200001 of https://codereview.chromium.org/882223003/)
Reason for revert:
perf fix didn't fix the cr webgl conformance tests

Original issue's description:
> Move npot resizing out of GrContext and simplify GrContext texture functions.
>
> Committed: https://skia.googlesource.com/skia/+/8a8100349105c8c6de39fcb34e47679da7a67f54
>
> Committed: https://skia.googlesource.com/skia/+/6c96672491b04cb782bce8fee778124df66524a0

TBR=robertphillips@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/887303002
2015-01-31 20:10:56 -08:00
bsalomon
6c96672491 Move npot resizing out of GrContext and simplify GrContext texture functions.
Committed: https://skia.googlesource.com/skia/+/8a8100349105c8c6de39fcb34e47679da7a67f54

Review URL: https://codereview.chromium.org/882223003
2015-01-31 19:27:53 -08:00
fmalita
6bfef2dfec Revert of Move npot resizing out of GrContext and simplify GrContext texture functions. (patchset #9 id:160001 of https://codereview.chromium.org/882223003/)
Reason for revert:
webGL conformance failures:

WebglConformance.conformance_textures_tex_image_and_sub_image_2d_with_video
WebglConformance.conformance_textures_texture_npot_video

https://codereview.chromium.org/892773003/
http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/29272

Original issue's description:
> Move npot resizing out of GrContext and simplify GrContext texture functions.
>
> Committed: https://skia.googlesource.com/skia/+/8a8100349105c8c6de39fcb34e47679da7a67f54

TBR=robertphillips@google.com,bsalomon@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/868233005
2015-01-31 07:02:18 -08:00
bsalomon
8a81003491 Move npot resizing out of GrContext and simplify GrContext texture functions.
Review URL: https://codereview.chromium.org/882223003
2015-01-30 12:43:44 -08:00
bsalomon
3bd12efdcf Fix wrapped content keys for npot textures.
Review URL: https://codereview.chromium.org/879193002
2015-01-28 11:39:48 -08:00
bsalomon
e167f9660c Fix GPU resource cache related assertions.
Review URL: https://codereview.chromium.org/879963003
2015-01-27 09:56:04 -08:00
bsalomon
4dffede04a Fix self assigment in GrResourceKey
TBR=robertphillips@google.com

BUG=skia:3340

Review URL: https://codereview.chromium.org/866263007
2015-01-23 07:17:55 -08:00
bsalomon
1ea1ebce10 Remove GrBinHashKey
Review URL: https://codereview.chromium.org/861323002
2015-01-23 06:46:16 -08:00
bsalomon
24db3b1c35 Add specialized content key class for resources.
Review URL: https://codereview.chromium.org/858123002
2015-01-23 04:24:05 -08:00
bsalomon
1c60dfe7ca Reland https://codereview.chromium.org/860333002 with fix for test failures.
Revert "Revert of Make GrScratchKey memory buffer correct size on copy (patchset #1 id:1 of https://codereview.chromium.org/860333002/)"

This reverts commit 988018c817.

BUG=skia:

Review URL: https://codereview.chromium.org/863983003
2015-01-21 09:32:40 -08:00
mtklein
988018c817 Revert of Make GrScratchKey memory buffer correct size on copy (patchset #1 id:1 of https://codereview.chromium.org/860333002/)
Reason for revert:
Our Valgrind bot just spewed out a weird error.  I don't know if it's related, but it looks at least like one of the stacks was in the right area, so I'm going to revert this precautionarily.  Sorry if this is a false positive.

http://build.chromium.org/p/client.skia/builders/Test-Ubuntu12-ShuttleA-GTX550Ti-x86_64-Release-Valgrind/builds/266/steps/dm/logs/stdio

Original issue's description:
> Make GrScratchKey memory buffer correct size on copy
>
> Scratch key memory buffer of a copy of a key was too big. The (new) copy
> was N times uint32_t bytes instead of N bytes.
>
> Adds few tests to resource cache. These tests would not catch the too
> big buffer. This is just a precaution for too small buffers. The main
> idea of the test change is that the scratch key should contain some
> information, so that lookup with a scratch key can also return no
> match. Otherwise testing of scratch lookup result is not indicative of
> correct code (eg. no-information scratch key will always match).
>
> Committed: https://skia.googlesource.com/skia/+/711ef4831363fb8cbdf061dc2c36c65b13c0ccf2

TBR=bsalomon@google.com,kkinnunen@nvidia.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/864833003
2015-01-21 08:05:55 -08:00
kkinnunen
711ef48313 Make GrScratchKey memory buffer correct size on copy
Scratch key memory buffer of a copy of a key was too big. The (new) copy
was N times uint32_t bytes instead of N bytes.

Adds few tests to resource cache. These tests would not catch the too
big buffer. This is just a precaution for too small buffers. The main
idea of the test change is that the scratch key should contain some
information, so that lookup with a scratch key can also return no
match. Otherwise testing of scratch lookup result is not indicative of
correct code (eg. no-information scratch key will always match).

Review URL: https://codereview.chromium.org/860333002
2015-01-21 06:39:14 -08:00
bsalomon
7775c85611 Add a simpler key type for scratch resource keys.
BUG=skia:2889

Review URL: https://codereview.chromium.org/815833004
2014-12-30 12:50:52 -08:00
bsalomon
fe369ee34b Move GrResourceKey static functions from .h to .cpp to fix shared lib builds
TBR=robertphillips@google.com

Review URL: https://codereview.chromium.org/718493002
2014-11-10 11:59:06 -08:00
bsalomon
744998e666 Make textures register with GrResourceCache2 as scratch.
R=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/510053003
2014-08-28 09:54:34 -07:00