Commit Graph

66 Commits

Author SHA1 Message Date
ericrk
0a5fa484fd Add onMemoryDump to GrContext
Adds an entry point to GrContext to allow enumeration and tracing of GPU resources
via the newly added SkTraceMemoryDump.

Plan is for Chrome to call this on each of its GrContexts.

Dumps both the total size of GPU resources, as well as the total purgeable size.

BUG=526261

Review URL: https://codereview.chromium.org/1313743002
2015-09-15 14:16:10 -07:00
mtklein
2766c00fc0 remove SkInstCnt
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
2015-06-26 11:45:03 -07:00
bsalomon
6dc6f5f4a1 Add support for creating texture backed images where Skia will delete the texture.
Review URL: https://codereview.chromium.org/1187523005
2015-06-18 09:12:17 -07:00
bsalomon
3f324321cd Add mechanism to proactively purge old resources in GrResourceCache.
This change leaves the feature turned off by default.

Review URL: https://codereview.chromium.org/1032873002
2015-04-08 11:01:55 -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
f320e04c50 Use an array of nonpurgeable resources in GrResourceCache
Review URL: https://codereview.chromium.org/932863004
2015-02-17 15:09:34 -08:00
bsalomon
9f2d1571ed Make GrResourceCache use a priority queue of purgeable resources.
Review URL: https://codereview.chromium.org/921323002
2015-02-17 11:47:41 -08:00
bsalomon
3582d3ee9f Split out methods in GrGpuResource::CacheAccess that can be called outside of the cache.
Review URL: https://codereview.chromium.org/923143002
2015-02-13 14:20:05 -08:00
bsalomon
0ea80f43a1 Rename GrResourceCache2->GrResourceCache
TBR=robertphillips@google.com

Review URL: https://codereview.chromium.org/921453002
2015-02-11 10:49:59 -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
563ff60b33 make getContentKey() available in GrGpuResource public interface
TBR=robertphillips@google.com

Committed: https://skia.googlesource.com/skia/+/85ed2db092e75db41b711b9116a8d5b465fc2b0c

Review URL: https://codereview.chromium.org/886313005
2015-02-02 17:25:26 -08:00
stephana
9b440260d5 Revert of make getContentKey() available in GrGpuResource public interface (patchset #2 id:20001 of https://codereview.chromium.org/886313005/)
Reason for revert:
This causes in one case the linker and in the other the compiler to segfault. On

Test-Ubuntu12-ShuttleA-GTX660-x86_64-Debug/Release

Original issue's description:
> make getContentKey() available in GrGpuResource public interface
>
> TBR=robertphillips@google.com
>
> Committed: https://skia.googlesource.com/skia/+/85ed2db092e75db41b711b9116a8d5b465fc2b0c

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

Review URL: https://codereview.chromium.org/864343005
2015-02-02 14:52:11 -08:00
bsalomon
85ed2db092 make getContentKey() available in GrGpuResource public interface
TBR=robertphillips@google.com

Review URL: https://codereview.chromium.org/886313005
2015-02-02 14:08:09 -08:00
bsalomon
63c992f6c0 Fix the speeling of "purgeable" in Gr code
TBR=robertphillips@google.com

Review URL: https://codereview.chromium.org/874693002
2015-01-23 12:47:59 -08:00
bsalomon
c2f35b750a Allow unbudgeted resources to be recycled by the cache as scratch.
Review URL: https://codereview.chromium.org/870743002
2015-01-23 07:19:22 -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
afe3005be3 Require budget decision when creating a RenderTarget SkSurface.
Restructure SkGpuDevice creation:
*SkSurfaceProps are optional.
*Use SkSurfaceProps to communicate DF text rather than a flag.
*Tell SkGpuDevice::Create whether RT comes from cache or not.

Review URL: https://codereview.chromium.org/848903004
2015-01-16 07:32:33 -08:00
bsalomon
5236cf480d Make uncached textures uncached from the get go.
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
2015-01-14 10:42:08 -08:00
mtklein
6f07665768 Simplify SkInstCnt
This code requires fewer macros to use it (just one), has less code in macro
definitions, and has simpler synchronization code (just atomic ints, no SkOnce,
no SkMutex, etc.)

A minor downside, we lose indentation and reverse-ordering in the final report:
  Leaked SkRefCntBase: 7
     Leaked SkFontMgr: 1
     Leaked SkWeakRefCnt: 1
         Leaked SkTypeface: 1
     Leaked SkFlattenable: 3
         Leaked SkXfermode: 3
     Leaked SkPathRef: 1
     Leaked SkPixelRef: 1
         Leaked SkMallocPixelRef: 1
becomes
  Leaked SkXfermode: 3
  Leaked SkMallocPixelRef: 1
  Leaked SkPixelRef: 1
  Leaked SkPathRef: 1
  Leaked SkFlattenable: 3
  Leaked SkTypeface: 1
  Leaked SkWeakRefCnt: 1
  Leaked SkFontMgr: 1
  Leaked SkRefCntBase: 7

This is motivated by wanting to land https://codereview.chromium.org/806473006/,
which makes sure all static use of SkOnce are in global scope.  The current
implementation of SkInstCnt uses them in function scope, which isn't safe.
BUG=skia:

No public API changes.
TBR=reed@google.com

Review URL: https://codereview.chromium.org/841263004
2015-01-13 08:22:44 -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
junov
5756aff409 Adding a custom data field to GrGpuResource
Motivation: allow Blink to track pre-existing mailbox names for
textures that are recycled by the ganesh scratch texture pool.

BUG=440462
TBR=bsalomon@google.com

Review URL: https://codereview.chromium.org/796163002
2014-12-11 14:59:32 -08:00
junov
436293a330 Making GrGpuResource::release public for special case in Blink
BUG=440462

Review URL: https://codereview.chromium.org/739383006
2014-12-11 10:32:32 -08:00
bsalomon
10e23caea3 Use scratch keys for stencil buffers.
BUG=skia:2889

Committed: https://skia.googlesource.com/skia/+/91175f19664a62851da4ca4e0984a7c7c45b258f

Review URL: https://codereview.chromium.org/747043004
2014-11-25 05:52:06 -08:00
bsalomon
84c8e62fad Allow GPU resources to not be counted against the cache budget.
BUG=skia:2889

Review URL: https://codereview.chromium.org/721353002
2014-11-17 09:33:27 -08:00
bsalomon
12299ab7a1 Make GrResourceCache2 responsible for calling release, abandon, and ~.
BUG=skia:2889

TBR=robertphillips@google.com

NOTRY=true

Review URL: https://codereview.chromium.org/729683002
2014-11-14 13:33:09 -08:00
bsalomon
71cb0c241e Replace GrResourceCache with GrResourceCache2.
BUG=skia:2889

Committed: https://skia.googlesource.com/skia/+/66a450f21a3da174b7eed89a1d5fc8591e8b6ee6

Committed: https://skia.googlesource.com/skia/+/407aa584d183c1bf314f5defd1cf0202e8a96c89

Review URL: https://codereview.chromium.org/716143004
2014-11-14 12:10:15 -08:00
bsalomon
ac49acda52 Revert of Replace GrResourceCache with GrResourceCache2. (patchset #7 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
2014-11-14 06:47:39 -08:00
bsalomon
407aa584d1 Replace GrResourceCache with GrResourceCache2.
BUG=skia:2889

Committed: https://skia.googlesource.com/skia/+/66a450f21a3da174b7eed89a1d5fc8591e8b6ee6

Review URL: https://codereview.chromium.org/716143004
2014-11-14 06:29:40 -08:00
bsalomon
f21dab9540 Revert of Replace GrResourceCache with GrResourceCache2. (patchset #6 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
2014-11-13 13:33:28 -08:00
bsalomon
66a450f21a Replace GrResourceCache with GrResourceCache2.
BUG=skia:2889

Review URL: https://codereview.chromium.org/716143004
2014-11-13 13:19:10 -08:00
bsalomon
69ed47f42d Make GrGpuResource::gpuMemorySize non-virtual w/ onGpuMemorySize virtual impl
BUG=skia:2889

Review URL: https://codereview.chromium.org/702413003
2014-11-12 11:13:39 -08:00
bsalomon
453cf40ac7 Add GrGpuResource::CacheAccess
Internal only helper class for manipulating and accessing cache keys.

BUG=skia:2889

Review URL: https://codereview.chromium.org/703303003
2014-11-11 14:15:57 -08:00
bsalomon
6d4488c5e0 Remove all knowledge of resource keys from the legacy cache.
BUG=skia:2889

Review URL: https://codereview.chromium.org/705413002
2014-11-11 07:27:16 -08:00
bsalomon
8b79d23f82 Use GrResourceCache2 to service content key lookups
BUG=skia:2889

Review URL: https://codereview.chromium.org/707493002
2014-11-10 10:19:06 -08:00
bsalomon
37dd331b20 Add class GrGLTextureRenderTarget for GL texture/rendertarget objects
BUG=skia:2889

Review URL: https://codereview.chromium.org/695813003
2014-11-03 08:47:23 -08:00
bsalomon
1e2530babb Use presence of a content key as non-scratch indicator
BUG=skia:2889

Committed: https://skia.googlesource.com/skia/+/9eefe0851eeaa8ded05b4774ebcb38ed201d5dbf

Review URL: https://codereview.chromium.org/639873002
2014-10-09 09:57:18 -07:00
bsalomon
ac211af359 call derived ~ from GrIORef
TBR=mtklein@google.com
NOTREECHECKS=true

Review URL: https://codereview.chromium.org/641813002
2014-10-08 12:36:54 -07:00
bsalomon
81e64484ff Remove ~GrIORef since last remaining virtual and now all inline
TBR=reed@google.com
NOTRY=true

Review URL: https://codereview.chromium.org/638003003
2014-10-08 11:42:10 -07:00
bsalomon
0f9e8a720c Revert of Use presence of a content key as non-scratch indicator (patchset #5 id:80001 of https://codereview.chromium.org/639873002/)
Reason for revert:
breaking nanobench on ubuntu

Original issue's description:
> Use presence of a content key as non-scratch indicator
>
> BUG=skia:2889
>
> Committed: https://skia.googlesource.com/skia/+/9eefe0851eeaa8ded05b4774ebcb38ed201d5dbf

TBR=robertphillips@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:2889

Review URL: https://codereview.chromium.org/642493003
2014-10-08 11:21:33 -07:00
bsalomon
9eefe0851e Use presence of a content key as non-scratch indicator
BUG=skia:2889

Review URL: https://codereview.chromium.org/639873002
2014-10-08 10:48:15 -07:00
bsalomon
544fe2338f Add SK_API to GrGpuResource
TBR=reed@google.com

Review URL: https://codereview.chromium.org/638963003
2014-10-08 10:24:07 -07:00
bsalomon
bcf0a52d4f GrResourceCache2 manages scratch texture.
BUG=skia:2889

Review URL: https://codereview.chromium.org/608883003
2014-10-08 08:40:09 -07:00
Brian Salomon
9323b8b8e1 Revert "GrResourceCache2 manages scratch texture."
This reverts commit d14e1a2764.
2014-10-07 15:07:38 -04:00
bsalomon
d14e1a2764 GrResourceCache2 manages scratch texture.
BUG=skia:2889

Review URL: https://codereview.chromium.org/608883003
2014-10-07 07:27:07 -07:00
robertphillips
dbe6074a06 Revert of GrResourceCache2 manages scratch texture. (patchset #14 id:260001 of https://codereview.chromium.org/608883003/)
Reason for revert:
Turning bots red:
Nanobench seems to be uniformly failing on Android
(http://108.170.220.21:10117/builders/Perf-Android-Venue8-PowerVR-x86-Release/builds/99/steps/RunNanobench/logs/stdio)

Ubuntu GTX660 32bit is failing in both Debug and Release on GM generation (it appears to be out of memory) (http://108.170.220.120:10117/builders/Test-Ubuntu12-ShuttleA-GTX660-x86-Debug/builds/2457/steps/GenerateGMs/logs/stdio)

Original issue's description:
> GrResourceCache2 manages scratch texture.
>
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/3d398c876440deaab39bbf2a9b881c337e6dc8d4

R=bsalomon@google.com
TBR=bsalomon@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/611383003
2014-09-30 06:54:17 -07:00
bsalomon
3d398c8764 GrResourceCache2 manages scratch texture.
BUG=skia:
R=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/608883003
2014-09-30 06:02:23 -07:00
bsalomon
8d034a154f Don't flush on read/write pixels unless necessary
BUG=skia:2889

Committed: https://skia.googlesource.com/skia/+/150723b9298772a5096bec7acd2999c5c9d66239

R=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/586073002
2014-09-22 12:21:08 -07:00
bsalomon
4401a1f7d6 Revert of Don't flush on read/write pixels unless necessary (patchset #2 id:20001 of https://codereview.chromium.org/586073002/)
Reason for revert:
Breaking the tree

Original issue's description:
> Don't flush on read/write pixels unless necessary
>
> BUG=skia:2889
>
> Committed: https://skia.googlesource.com/skia/+/150723b9298772a5096bec7acd2999c5c9d66239

R=robertphillips@google.com
TBR=robertphillips@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:2889

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/594543004
2014-09-22 09:12:11 -07:00
bsalomon
150723b929 Don't flush on read/write pixels unless necessary
BUG=skia:2889
R=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/586073002
2014-09-22 08:17:02 -07:00