aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/GrResourceCacheBench.cpp
Commit message (Collapse)AuthorAge
* bench, samples, etc: s/SkAutoTUnref/sk_sp/Gravatar Hal Canary2016-11-07
| | | | | | | | | GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4437 Change-Id: Ice071684ac8a99e4bb405b4b9be8e8f42c7bac42 Reviewed-on: https://skia-review.googlesource.com/4437 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* Refactor to separate backend object lifecycle and GpuResource budget decisionGravatar kkinnunen2016-04-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor GrGpuResource to contain two different pieces of state: a) instance is budgeted or not budgeted b) instance references wrapped backend objects or not The "object lifecycle" was also attached to backend object handles (ids), which made the code a bit unclear. Backend objects would be associated with GrGpuResource::LifeCycle, even though GrGpuResource::LifeCycle refers to the GpuResource, and individual backend objects in one GpuResource might be governed with different "lifecycle". Mark the budgeted/not budgeted with SkBudgeted::kYes, SkBudgeted::kNo. This was previously GrGpuResource::kCached_LifeCycle, GrGpuResource::kUncached_LifeCycle. Mark the "references wrapped object" with boolean. This was previously GrGpuResource::kBorrowed_LifeCycle, GrGpuResource::kAdopted_LifeCycle for GrGpuResource. Associate the backend object ownership status with GrBackendObjectOwnership for the backend object handles. The resource type leaf constuctors, such has GrGLTexture or GrGLTextureRenderTarget take "budgeted" parameter. This parameter is passed to GrGpuResource::registerWithCache(). The resource type intermediary constructors, such as GrGLTexture constructors for class GrGLTextureRenderTarget do not take "budgeted" parameters, intermediary construtors do not call registerWithCache. Removes the need for tagging GrGpuResource -derived subclass constructors with "Derived" parameter. Makes instances that wrap backend objects be registered with a new function GrGpuResource::registerWithCacheWrapped(). Removes "budgeted" parameter from classes such as StencilAttahment, as they are always cached and never wrap any external backend objects. Removes the use of concept "external" from the member function names. The API refers to the objects as "wrapped", so make all related functions use the term consistently. No change in functionality. Resources referencing wrapped objects are always inserted to the cache with budget decision kNo. BUG=594928 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1862043002 Review URL: https://codereview.chromium.org/1862043002
* Style bikeshed - remove extraneous whitespaceGravatar halcanary2016-03-29
| | | | | | GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1842753002 Review URL: https://codereview.chromium.org/1842753002
* Remove const from `const int loops`.Gravatar mtklein2015-10-01
| | | | | | | | This drives me nuts, and prevents `while (loops --> 0)`. BUG=skia: Review URL: https://codereview.chromium.org/1379923005
* Fix for nexus 5 crashing in GL benchesGravatar joshualitt2015-09-30
| | | | | | | | | | GLBenches do not expect gl state to change between onPerCanvasPreDraw and *PostDraw, but we do a clear and sometimes we clear as draw. This causes us to bind vertex objects / programs / etc. This change creates two new virtual methods which are called right before and immediately after timing. BUG=skia: Review URL: https://codereview.chromium.org/1379853003
* Style Change: NULL->nullptrGravatar halcanary2015-08-27
| | | | | | DOCS_PREVIEW= https://skia.org/?cl=1316233002 Review URL: https://codereview.chromium.org/1316233002
* Style Change: SkNEW->new; SkDELETE->deleteGravatar halcanary2015-08-26
| | | | | | DOCS_PREVIEW= https://skia.org/?cl=1316123003 Review URL: https://codereview.chromium.org/1316123003
* remove SkInstCntGravatar mtklein2015-06-26
| | | | | | | | | | | | | | It's been outclassed by Valgrind and leak sanitizer, and it seems to be causing problems for external folks building Skia. I'm not sure why our own builds seem unaffected. Latest thread: https://groups.google.com/forum/#!topic/skia-discuss/oj9FsQwwSF0 BUG=skia: Review URL: https://codereview.chromium.org/1217573002
* Make GrResourceCache perf less sensitive to key length changeGravatar kkinnunen2015-05-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla}Gravatar mtklein2015-03-25
| | | | | | | | | NOPRESUBMIT=true BUG=skia: DOCS_PREVIEW= https://skia.org/?cl=1037793002 Review URL: https://codereview.chromium.org/1037793002
* Rename GrContentKey to GrUniqueKeyGravatar bsalomon2015-02-19
| | | | Review URL: https://codereview.chromium.org/940463006
* Split out methods in GrGpuResource::CacheAccess that can be called outside ↵Gravatar bsalomon2015-02-13
| | | | | | of the cache. Review URL: https://codereview.chromium.org/923143002
* Rename GrResourceCache2->GrResourceCacheGravatar bsalomon2015-02-11
| | | | | | TBR=robertphillips@google.com Review URL: https://codereview.chromium.org/921453002
* Add specialized content key class for resources.Gravatar bsalomon2015-01-23
| | | | Review URL: https://codereview.chromium.org/858123002
* Make uncached textures uncached from the get go.Gravatar bsalomon2015-01-14
| | | | | | | | This avoids the problem of a newly created uncached texture causing a purge of cached resources. BUG=chromium:445885 Review URL: https://codereview.chromium.org/846303002
* Add a simpler key type for scratch resource keys.Gravatar bsalomon2014-12-30
| | | | | | BUG=skia:2889 Review URL: https://codereview.chromium.org/815833004
* Use scratch keys for stencil buffers.Gravatar bsalomon2014-11-25
| | | | | | | | BUG=skia:2889 Committed: https://skia.googlesource.com/skia/+/91175f19664a62851da4ca4e0984a7c7c45b258f Review URL: https://codereview.chromium.org/747043004
* Revert "Use scratch keys for stencil buffers."Gravatar bsalomon2014-11-24
| | | | | | | | | | | | | | | | This reverts commit 91175f19664a62851da4ca4e0984a7c7c45b258f. Revert "Cleanup res cache bench and split out into a unit test." This reverts commit 4e4303f002c5958c6c958e7ba8e49b24c25f0b22. Revert "rebaselines" This reverts commit 65ba7b57759bfca60b24bc34dc46fc8caaf146f0. TBR=tomhudson@google.com Review URL: https://codereview.chromium.org/752233002
* Cleanup res cache bench and split out into a unit test.Gravatar bsalomon2014-11-24
| | | | | | BUG=skia:2889 Review URL: https://codereview.chromium.org/754833002
* Use scratch keys for stencil buffers.Gravatar bsalomon2014-11-24
| | | | | | BUG=skia:2889 Review URL: https://codereview.chromium.org/747043004
* Make GrResourceCache2 responsible for calling release, abandon, and ~.Gravatar bsalomon2014-11-14
| | | | | | | | | | BUG=skia:2889 TBR=robertphillips@google.com NOTRY=true Review URL: https://codereview.chromium.org/729683002
* Replace GrResourceCache with GrResourceCache2.Gravatar bsalomon2014-11-14
| | | | | | | | | | BUG=skia:2889 Committed: https://skia.googlesource.com/skia/+/66a450f21a3da174b7eed89a1d5fc8591e8b6ee6 Committed: https://skia.googlesource.com/skia/+/407aa584d183c1bf314f5defd1cf0202e8a96c89 Review URL: https://codereview.chromium.org/716143004
* Revert of Replace GrResourceCache with GrResourceCache2. (patchset #7 ↵Gravatar bsalomon2014-11-14
| | | | | | | | | | | | | | | | | | | | | | | id:120001 of https://codereview.chromium.org/716143004/) Reason for revert: broken again Original issue's description: > Replace GrResourceCache with GrResourceCache2. > > BUG=skia:2889 > > Committed: https://skia.googlesource.com/skia/+/66a450f21a3da174b7eed89a1d5fc8591e8b6ee6 > > Committed: https://skia.googlesource.com/skia/+/407aa584d183c1bf314f5defd1cf0202e8a96c89 TBR=robertphillips@google.com NOTREECHECKS=true NOTRY=true BUG=skia:2889 Review URL: https://codereview.chromium.org/726913002
* Replace GrResourceCache with GrResourceCache2.Gravatar bsalomon2014-11-14
| | | | | | | | BUG=skia:2889 Committed: https://skia.googlesource.com/skia/+/66a450f21a3da174b7eed89a1d5fc8591e8b6ee6 Review URL: https://codereview.chromium.org/716143004
* Revert of Replace GrResourceCache with GrResourceCache2. (patchset #6 ↵Gravatar bsalomon2014-11-13
| | | | | | | | | | | | | | | | | | | | | id:100001 of https://codereview.chromium.org/716143004/) Reason for revert: Breaking stuff Original issue's description: > Replace GrResourceCache with GrResourceCache2. > > BUG=skia:2889 > > Committed: https://skia.googlesource.com/skia/+/66a450f21a3da174b7eed89a1d5fc8591e8b6ee6 TBR=robertphillips@google.com NOTREECHECKS=true NOTRY=true BUG=skia:2889 Review URL: https://codereview.chromium.org/715333003
* Replace GrResourceCache with GrResourceCache2.Gravatar bsalomon2014-11-13
| | | | | | BUG=skia:2889 Review URL: https://codereview.chromium.org/716143004
* Make GrGpuResource::gpuMemorySize non-virtual w/ onGpuMemorySize virtual implGravatar bsalomon2014-11-12
| | | | | | BUG=skia:2889 Review URL: https://codereview.chromium.org/702413003
* Use GrResourceCache2 to service content key lookupsGravatar bsalomon2014-11-10
| | | | | | BUG=skia:2889 Review URL: https://codereview.chromium.org/707493002
* rename GrTextureDesc->GrSurfaceDesc, GrTextureFlags->GrSurfaceFlagsGravatar bsalomon2014-10-28
| | | | Review URL: https://codereview.chromium.org/682223002
* Use presence of a content key as non-scratch indicatorGravatar bsalomon2014-10-09
| | | | | | | | BUG=skia:2889 Committed: https://skia.googlesource.com/skia/+/9eefe0851eeaa8ded05b4774ebcb38ed201d5dbf Review URL: https://codereview.chromium.org/639873002
* GrResourceCache2 manages scratch texture.Gravatar bsalomon2014-10-08
| | | | | | BUG=skia:2889 Review URL: https://codereview.chromium.org/608883003
* Make "priv" classes for GrTexure and GrSurface.Gravatar bsalomon2014-09-30
| | | | | | | | R=robertphillips@google.com, egdaniel@google.com, joshualitt@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/596053002
* Revert of Make "priv" classes for GrTexure and GrSurface. (patchset #9 ↵Gravatar robertphillips2014-09-30
| | | | | | | | | | | | | | | | | | | | | | | id:260001 of https://codereview.chromium.org/596053002/) Reason for revert: Breaking the Chrome builds with: lib/libcc.so: error: undefined reference to 'GrAutoScratchTexture::detach()' (http://108.170.220.120:10117/builders/Canary-Chrome-Ubuntu13.10-Ninja-x86_64-DRT/builds/2990/steps/Retry_BuildContentShell_1/logs/stdio) Original issue's description: > Make "priv" classes for GrTexure and GrSurface. R=egdaniel@google.com, joshualitt@google.com, bsalomon@google.com TBR=bsalomon@google.com, egdaniel@google.com, joshualitt@google.com NOTREECHECKS=true NOTRY=true Author: robertphillips@google.com Review URL: https://codereview.chromium.org/618733002
* Make "priv" classes for GrTexure and GrSurface.Gravatar bsalomon2014-09-29
| | | | | | | | R=robertphillips@google.com, egdaniel@google.com, joshualitt@google.com, joshualitt@chromium.org Author: bsalomon@google.com Review URL: https://codereview.chromium.org/596053002
* "NULL !=" = NULLGravatar bsalomon2014-09-05
| | | | | | | | R=reed@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/544233002
* Make GrGpuResources register with GrResourceCache2 after fully constructed.Gravatar bsalomon2014-08-26
| | | | | | | | | | Committed: https://skia.googlesource.com/skia/+/d68b3e491bb765beb7ca5e4ac8e0c80dedf5a83b R=robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/504313002
* Revert of Make GrGpuResources register with GrResourceCache2 after fully ↵Gravatar bsalomon2014-08-26
| | | | | | | | | | | | | | | | | | | | | constructed. (patchset #3 of https://codereview.chromium.org/504313002/) Reason for revert: Breaking the bots Original issue's description: > Make GrGpuResources register with GrResourceCache2 after fully constructed. > > Committed: https://skia.googlesource.com/skia/+/d68b3e491bb765beb7ca5e4ac8e0c80dedf5a83b R=robertphillips@google.com TBR=robertphillips@google.com NOTREECHECKS=true NOTRY=true Author: bsalomon@google.com Review URL: https://codereview.chromium.org/488463004
* Make GrGpuResources register with GrResourceCache2 after fully constructed.Gravatar bsalomon2014-08-26
| | | | | | | | R=robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/504313002
* Rename GrGpuObject to GrGpuResourceGravatar bsalomon2014-07-25
| | | | | | | | R=robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/418143004
* Merge GrGpuObject and GrCacheable.Gravatar bsalomon2014-07-25
| | | | | | | | | | We want to create a new base class for "meta" gr resources as part of the GrResourceCache rewrite and this is an iterim step towards that goal.s R=robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/414013005
* Remove Sk prefix from some bench classes.Gravatar tfarina2014-06-19
| | | | | | | | | | | | | | | | This idea came while commenting on https://codereview.chromium.org/343583005/ Since SkBenchmark, SkBenchLogger and SkGMBench are not part of the Skia library, they should not have the Sk prefix. BUG=None TEST=make all R=mtklein@google.com Author: tfarina@chromium.org Review URL: https://codereview.chromium.org/347823004
* Factor GrTexture into public GrTexture and private GrTextureImpl.Gravatar commit-bot@chromium.org2014-05-09
| | | | | | | | | | | | Committed: http://code.google.com/p/skia/source/detail?r=14680 R=jvanverth@google.com, robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/275903002 git-svn-id: http://skia.googlecode.com/svn/trunk@14687 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert of Factor GrTexture into public GrTexture and private GrTextureImpl. ↵Gravatar commit-bot@chromium.org2014-05-09
| | | | | | | | | | | | | | | | | | | | | | | (https://codereview.chromium.org/275903002/) Reason for revert: Breaks chrome build. Original issue's description: > Factor GrTexture into public GrTexture and private GrTextureImpl. > > Committed: http://code.google.com/p/skia/source/detail?r=14680 R=jvanverth@google.com, robertphillips@google.com TBR=jvanverth@google.com, robertphillips@google.com NOTREECHECKS=true NOTRY=true Author: bsalomon@google.com Review URL: https://codereview.chromium.org/278073002 git-svn-id: http://skia.googlecode.com/svn/trunk@14681 2bbb7eff-a529-9590-31e7-b0007b416f81
* Factor GrTexture into public GrTexture and private GrTextureImpl.Gravatar commit-bot@chromium.org2014-05-09
| | | | | | | | | | R=jvanverth@google.com, robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/275903002 git-svn-id: http://skia.googlecode.com/svn/trunk@14680 2bbb7eff-a529-9590-31e7-b0007b416f81
* Split GrResource into GrCacheable/GrGpuObjectGravatar commit-bot@chromium.org2014-05-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change, an object needed to inherit from GrResource (and thus be a GPU object) in order to live in the GrResourceCache. That was a problem for caching items that weren't GPU objects themselves, but owned GPU objects. This change splits GrResource into two classes: 1. GrCacheable: The base class for objects that can live in the GrResourceCache. 2. GrGpuObject, which inherits from GrCacheable: The base class for objects that get tracked by GrGpu. This change is purely a refactor; there is no change in functionality. Change-Id: I3e8daeb1f123041f414aa306c1366e959ae9e39e BUG=skia: R=bsalomon@google.com Author: cdalton@nvidia.com Review URL: https://codereview.chromium.org/251013002 git-svn-id: http://skia.googlecode.com/svn/trunk@14553 2bbb7eff-a529-9590-31e7-b0007b416f81
* Convert GrCrash->SkFAIL GrDebugCrash->SkDEBUGFAILGravatar commit-bot@chromium.org2014-04-30
| | | | | | | | | | R=robertphillips@google.com, reed@google.com, mtklein@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/257393004 git-svn-id: http://skia.googlecode.com/svn/trunk@14460 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix compilation with SK_ENABLE_INST_COUNT=1Gravatar commit-bot@chromium.org2013-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add INHERITED declarations to class declarations that prevent compilation with the flag. Remove SK_DEFINE_INST_COUNT from all class implementations. Instead, use function-local static variables in the reference count helper classes to create the global instances to store the needed info. The accessor functions are defined inline in the helper classes, so definitions are not needed. The initialization point of the variables should be as well defined as previously. Remove SK_DECLARE_INST_COUNT_TEMPLATE and use SK_DECLARE_INST_COUNT instead. This avoids possible future compilation errors further. For SK_ENABLE_INST_COUNT=0 compilation, add an empty static member function to all classes that use SK_DECLARE_INST_COUNT and SK_DECLARE_INST_COUNT_ROOT macros. The function ensures that classes contain public INHERITED typedef. This member function seems to be compiled away. This shouĺd ensure that part of the compilation errors are caught earlier. Also adds DSK_DECLARE_INST_COUNT to few SkPDFDict subclasses. R=robertphillips@google.com, richardlin@chromium.org, bsalomon@google.com Author: kkinnunen@nvidia.com Review URL: https://codereview.chromium.org/98703002 git-svn-id: http://skia.googlecode.com/svn/trunk@12501 2bbb7eff-a529-9590-31e7-b0007b416f81
* Simplify benchmark internal API.Gravatar commit-bot@chromium.org2013-12-03
| | | | | | | | | | | | | | | | | | I'm not quite sure why I wrote such a convoluted API with setLoops()/getLoops(). This replaces it with a loops argument passed to onDraw(). This CL is largely mechanical translation from the old API to the new one. MathBench used this->getLoops() outside onDraw(), which seems incorrect. I fixed it. BUG= R=djsollen@google.com Author: mtklein@google.com Review URL: https://codereview.chromium.org/99893003 git-svn-id: http://skia.googlecode.com/svn/trunk@12466 2bbb7eff-a529-9590-31e7-b0007b416f81
* Implement a benchmark for GrResourceCacheGravatar commit-bot@chromium.org2013-11-21
Adds "grresourcecache_add" and "grresourcecache_find" bench tests to test GrResourceCache::add and GrResourceCache::find. The tests work only with GPU backends, since GrResourceCache needs an GrGpu. Modifies bench tests to override SkBenchmark::isSuitableFor(Backend) function that specifies what kind of backend the test is inteded for. This replaces the previous "fIsRendering" flag that would indicate test that did no rendering. Adds SkCanvas::getGrContext() call to get the GrContext that the canvas ends up drawing to. The member function solves a common use-case that is also used in the benchmark added here. R=mtklein@google.com, bsalomon@google.com Author: kkinnunen@nvidia.com Review URL: https://codereview.chromium.org/73643005 git-svn-id: http://skia.googlecode.com/svn/trunk@12334 2bbb7eff-a529-9590-31e7-b0007b416f81