aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrGpuResource.cpp
Commit message (Collapse)AuthorAge
* Remove unused code that was used for late mip allocations.Gravatar Greg Daniel2018-06-13
| | | | | | | | | | | This also includes removing code to support changing GrGpuResource's size since we now have to way to ever change the size. Bug: skia: Change-Id: Id27a8bc3cc94f5b954beda528b209727ede10ef6 Reviewed-on: https://skia-review.googlesource.com/134503 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Dump additional details about the gpu resources.Gravatar Derek Sollenberger2018-03-29
| | | | | | | | | | | | | | | | | GpuResources now dump optional string values that describe the type and category of the resource. The type provides a description of the kind of resource it is (e.g. texture, buffer object, stencil, etc.) and the category describes what the resource is currently tasked to do (e.g. path masks, images, scratch, etc.) This CL also refactors the dump logic in an attempt to consolidate duplicated code into GrGpuResources.cpp. Bug: b/74435803 Change-Id: I83cae825f41e6450a21398ab3ecea349c7c61c15 Reviewed-on: https://skia-review.googlesource.com/115989 Commit-Queue: Derek Sollenberger <djsollen@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
* Allow SkTraceMemoryDump to exclude wrapped objectsGravatar Eric Karl2018-03-19
| | | | | | | | | | | | Allow SkTraceMemoryDump to exclude wrapped objects from dumps. This helps avoid duplicate dumping when Skia is wrapping an external object which is already dumped externally. Bug: 795358 Change-Id: Icbda96b564c81b958d40f74693280ac7d5ba7332 Reviewed-on: https://skia-review.googlesource.com/114681 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Eric Karl <ericrk@chromium.org>
* Move resourceProvider accessor to GrContextPriv (take 2)Gravatar Robert Phillips2018-01-16
| | | | | | | | TBR=bsalomon@google.com Change-Id: I3fd46ebfad0d04b8a2bfa6190f81308f3a6be620 Reviewed-on: https://skia-review.googlesource.com/95121 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
* Revert "Move resourceProvider accessor to GrContextPriv"Gravatar Hal Canary2018-01-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 1f9ed8501b0007846b3032f4bfc38aee98c175a1. Reason for revert: 1. breaking android roll 2. breaking Build-Debian9-Clang-arm-Release-Android_API26 Original change's description: > Move resourceProvider accessor to GrContextPriv > > Change-Id: I5cddd620a7ec4b006b7359864ede58e9d4dd684e > Reviewed-on: https://skia-review.googlesource.com/94340 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Reviewed-by: Greg Daniel <egdaniel@google.com> > Commit-Queue: Robert Phillips <robertphillips@google.com> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com Change-Id: I20b2d267c0925f20453b635663654967199a1197 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/94964 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* Move resourceProvider accessor to GrContextPrivGravatar Robert Phillips2018-01-16
| | | | | | | | Change-Id: I5cddd620a7ec4b006b7359864ede58e9d4dd684e Reviewed-on: https://skia-review.googlesource.com/94340 Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
* Setup for another attempt to split up opListsGravatar Robert Phillips2017-05-11
| | | | | | | | | Split out of: https://skia-review.googlesource.com/c/14186 (Split up opLists (take 3)) Change-Id: Ifa600c88fb9185991d3197c7776c820f54c9bf0f Reviewed-on: https://skia-review.googlesource.com/16540 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
* Remove SkCrossContextImageData and all support codeGravatar Brian Osman2017-05-11
| | | | | | | | Bug: skia: Change-Id: I8eb8cef5456c05a8e314d8404698893c7af82d13 Reviewed-on: https://skia-review.googlesource.com/16368 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* Allow wrapped resources to have unique keysGravatar Brian Osman2017-05-08
| | | | | | | | | | | | | | | Previously, wrapped resources were never budgeted. Now we explicitly allow wrapped, unbudgeted resources with unique keys. This allows code that wraps (and re-wraps) external resources with a deterministic key to find the same wrapped resource - saving time and ensuring a single wrapped copy, to preserve state on the resource (like texture sampler state). Bug: skia: Change-Id: I1dd7642f1ed8bb6c620029d46203cf5cb6b3c160 Reviewed-on: https://skia-review.googlesource.com/15241 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Add GrExternalTextureData and SkCrossContextImageDataGravatar Brian Osman2017-02-28
| | | | | | | | | | | | | | | | | | | | | | | | GrExternalTextureData is an API for exporting the backend-specific information about a texture in a type-safe way, and without pointing into the GrTexture. The new detachBackendTexture API lets us release ownership of a texture to the client. SkCrossContextImageData is the public API that lets clients upload textures on one thread/GrContext, then safely transfer ownership to another thread and GrContext for rendering. Only GL is implemented/supported right now. Vulkan support requires that we add thread-safe memory pools, or otherwise transfer the actual memory block containing the texture to the new context. Re-land of https://skia-review.googlesource.com/c/8529/ BUG=skia: Change-Id: I48ebd57d1ea0cfd3a1db10c475f2903afb821966 Reviewed-on: https://skia-review.googlesource.com/8960 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* Revert "Add GrExternalTextureData and SkCrossContextImageData"Gravatar Brian Osman2017-02-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 9ad1f92e2fceea33215c0f13cee42a679fb88d44. Reason for revert: Breaking lots of bots Original change's description: > Add GrExternalTextureData and SkCrossContextImageData > > GrExternalTextureData is an API for exporting the backend-specific > information about a texture in a type-safe way, and without pointing > into the GrTexture. The new detachBackendTexture API lets us release > ownership of a texture to the client. > > SkCrossContextImageData is the public API that lets clients upload > textures on one thread/GrContext, then safely transfer ownership to > another thread and GrContext for rendering. > > Only GL is implemented/supported right now. Vulkan support requires > that we add thread-safe memory pools, or otherwise transfer the > actual memory block containing the texture to the new context. > > BUG=skia: > > Change-Id: I784a3a74be69807df038c7d192eaed002c7e45ca > Reviewed-on: https://skia-review.googlesource.com/8529 > Commit-Queue: Brian Osman <brianosman@google.com> > Reviewed-by: Brian Salomon <bsalomon@google.com> > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,brianosman@google.com,reviews@skia.org,chinmaygarde@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Change-Id: If27d1f4c3a169efb6533170f67a172664c0fe8ce Reviewed-on: https://skia-review.googlesource.com/8955 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* Add GrExternalTextureData and SkCrossContextImageDataGravatar Brian Osman2017-02-24
| | | | | | | | | | | | | | | | | | | | | | GrExternalTextureData is an API for exporting the backend-specific information about a texture in a type-safe way, and without pointing into the GrTexture. The new detachBackendTexture API lets us release ownership of a texture to the client. SkCrossContextImageData is the public API that lets clients upload textures on one thread/GrContext, then safely transfer ownership to another thread and GrContext for rendering. Only GL is implemented/supported right now. Vulkan support requires that we add thread-safe memory pools, or otherwise transfer the actual memory block containing the texture to the new context. BUG=skia: Change-Id: I784a3a74be69807df038c7d192eaed002c7e45ca Reviewed-on: https://skia-review.googlesource.com/8529 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Add explicit UniqueID classes for GrGpuResource & GrSurfaceProxyGravatar Robert Phillips2016-11-11
| | | | | | | | | | | This sets the stage for using the Proxy's/RenderTargetContext's ID above the flush and the RenderTarget's/GrGpuResource's below the flush. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4650 Change-Id: I9f1e6b00c02a0691d90b58c49e1d8c60684884c1 Reviewed-on: https://skia-review.googlesource.com/4650 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Change implementation of flush-count based GrGpuResource purgingGravatar bsalomon2016-09-22
| | | | | | | Change default to approx 30seconds (given some API usage assumptions) GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2361093002 Review-Url: https://codereview.chromium.org/2361093002
* Have GrSurfaceProxys and GrGpuResources draw from the same pool of unique idsGravatar robertphillips2016-08-31
| | | | | | | | | | The idea here is that, for wrapped Proxy objects, we want the uniqueID to reflect that of the wrapped object. For this to work the IDs for the non-wrapped versions can't conflict with GrGpuResource's pool of IDs. Split off of: https://codereview.chromium.org/2215323003/ (Start using RenderTargetProxy (omnibus)) GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2301523003 Review-Url: https://codereview.chromium.org/2301523003
* Remove custom data from GrGpuResourceGravatar bsalomon2016-08-30
| | | | | | | | | | Chrome is no longer relying on this feature to track mailboxes for textures. BUG=skia:4134 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2291203002 Review-Url: https://codereview.chromium.org/2291203002
* 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
* When a surface is backed by an external render target force a copy on image snapGravatar bsalomon2016-02-26
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1694943002 Review URL: https://codereview.chromium.org/1694943002
* Move Budgeted enum out of SkSurface, use in GrTextureProviderGravatar bsalomon2016-02-25
| | | | | | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1728093005 DOCS_PREVIEW= https://skia.org/?cl=1728093005 Committed: https://skia.googlesource.com/skia/+/57599fe6c0336feaeeeb9b1996e77b70219b483c CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot,Build-Mac-Clang-x86_64-Release-CMake-Trybot Review URL: https://codereview.chromium.org/1728093005
* Revert of Move Budgeted enum out of SkSurface, use in GrTextureProvider ↵Gravatar bsalomon2016-02-25
| | | | | | | | | | | | | | | | | | | | | | | | | (patchset #6 id:100001 of https://codereview.chromium.org/1728093005/ ) Reason for revert: Need workaround for chrome to build Original issue's description: > Move Budgeted enum out of SkSurface, use in GrTextureProvider > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1728093005 > DOCS_PREVIEW= https://skia.org/?cl=1728093005 > > Committed: https://skia.googlesource.com/skia/+/57599fe6c0336feaeeeb9b1996e77b70219b483c TBR=reed@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1734043002
* Move Budgeted enum out of SkSurface, use in GrTextureProviderGravatar bsalomon2016-02-25
| | | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1728093005 DOCS_PREVIEW= https://skia.org/?cl=1728093005 Review URL: https://codereview.chromium.org/1728093005
* Make methods on GrGpuResource safe to call on abandoned resourceGravatar bsalomon2015-09-24
| | | | | | BUG=chromium:528908 Review URL: https://codereview.chromium.org/1367533004
* Add onMemoryDump to GrContextGravatar ericrk2015-09-15
| | | | | | | | | | | | | 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
* 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
* Add support for creating texture backed images where Skia will delete the ↵Gravatar bsalomon2015-06-18
| | | | | | texture. Review URL: https://codereview.chromium.org/1187523005
* Refactor GrGpu path rendering functions to GrPathRenderingGravatar kkinnunen2015-06-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GrGpu, GrGLGpu, GrPathRendering, GrGLPathRendering all duplicated each others' path rendering related member functions. Make GrPathRending the logical extension of GrGpu by removing the methods from GrGpu. Similarly to the GL variants. Changes includes and forward declarations due to removing GrDrawTarget.h include from GrGpu.h. This was necessary due to GrDrawTarget.h including GrPathRendering.h, and now GrPathRendering.h includes GrGpu.h. (Also GrGpu.h does not need GrDrawTarget.h anymore). Very slight runtime improvement on x86_64: desk_fontwipe.skp_1 836us -> 841us 1.01x desk_silkfinance.skp_1 2.01ms -> 2.01ms 1x desk_forecastio.skp_1 7.03ms -> 7.05ms 1x desk_weather.skp_1 3.74ms -> 3.74ms 1x desk_twitter.skp_1 8.02ms -> 8.01ms 1x desk_mapsvg.skp_1 5.24ms -> 5.23ms 1x desk_pokemonwiki.skp_1 7.06ms -> 7.03ms 1x desk_sfgate.skp_1 3.19ms -> 3.17ms 1x tabl_cuteoverload.skp_1 2.66ms -> 2.64ms 0.99x ... tabl_transformice.skp_1 3.06ms -> 2.98ms 0.98x tabl_googlecalendar.skp_1 11.3ms -> 11ms 0.97x tabl_gamedeksiam.skp_1 12.8ms -> 12.4ms 0.97x desk_samoasvg.skp_1 10.6ms -> 10.3ms 0.97x tabl_worldjournal.skp_1 4.44ms -> 4.3ms 0.97x Review URL: https://codereview.chromium.org/1157683006
* Add mechanism to proactively purge old resources in GrResourceCache.Gravatar bsalomon2015-04-08
| | | | | | This change leaves the feature turned off by default. Review URL: https://codereview.chromium.org/1032873002
* Allow resources' unique keys to be changed.Gravatar bsalomon2015-02-19
| | | | Review URL: https://codereview.chromium.org/938943002
* Rename GrContentKey to GrUniqueKeyGravatar bsalomon2015-02-19
| | | | Review URL: https://codereview.chromium.org/940463006
* Make GrResourceCache use a priority queue of purgeable resources.Gravatar bsalomon2015-02-17
| | | | Review URL: https://codereview.chromium.org/921323002
* 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
* Reimplement gpu message bus for invalidated bitmap gen IDsGravatar bsalomon2015-02-06
| | | | Review URL: https://codereview.chromium.org/902873002
* Fix the speeling of "purgeable" in Gr codeGravatar bsalomon2015-01-23
| | | | | | TBR=robertphillips@google.com Review URL: https://codereview.chromium.org/874693002
* Allow unbudgeted resources to be recycled by the cache as scratch.Gravatar bsalomon2015-01-23
| | | | Review URL: https://codereview.chromium.org/870743002
* Add specialized content key class for resources.Gravatar bsalomon2015-01-23
| | | | Review URL: https://codereview.chromium.org/858123002
* Require budget decision when creating a RenderTarget SkSurface.Gravatar bsalomon2015-01-16
| | | | | | | | | 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
* 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
* Adding a custom data field to GrGpuResourceGravatar junov2014-12-11
| | | | | | | | | | 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
* 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
* Allow GPU resources to not be counted against the cache budget.Gravatar bsalomon2014-11-17
| | | | | | BUG=skia:2889 Review URL: https://codereview.chromium.org/721353002
* Correct accounting for wrapped resourcesGravatar bsalomon2014-11-17
| | | | | | BUG=skia:2889 Review URL: https://codereview.chromium.org/720033004
* 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