Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Issue 1862043002: Refactor to separate backend object lifecycle and GpuResource budget decision (Closed)

Created:
4 years, 8 months ago by Kimmo Kinnunen
Modified:
4 years, 8 months ago
Reviewers:
bsalomon
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Refactor to separate backend object lifecycle and GpuResource budget decision 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 Committed: https://skia.googlesource.com/skia/+/2e6055b3ea14a04fcde1ac1974a70bf00b1e295b

Patch Set 1 #

Patch Set 2 : rebase #

Total comments: 4

Patch Set 3 : address review comments and refactor #

Patch Set 4 : remove verbosity #

Total comments: 3

Patch Set 5 : move GrBackendObjectOwnership to GrTypesPriv.h #

Patch Set 6 : rebase and small fixes #

Total comments: 3

Patch Set 7 : fix a compile error due to unused parameter #

Patch Set 8 : fix unrelated GrBuffer::onGpuMemorySize() lack of override keyword compile error #

Unified diffs Side-by-side diffs Delta from patch set Stats (+446 lines, -439 lines) Patch
M bench/GrResourceCacheBench.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M include/gpu/GrBuffer.h View 1 2 3 4 5 6 7 2 chunks +9 lines, -7 lines 0 comments Download
M include/gpu/GrGpuResource.h View 1 2 3 4 5 6 6 chunks +19 lines, -46 lines 0 comments Download
M include/gpu/GrRenderTarget.h View 1 chunk +2 lines, -2 lines 0 comments Download
M include/gpu/GrSurface.h View 1 chunk +2 lines, -2 lines 0 comments Download
M include/gpu/GrTexture.h View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M include/gpu/GrTypesPriv.h View 1 2 3 4 1 chunk +10 lines, -0 lines 0 comments Download
M src/gpu/GrGpu.h View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M src/gpu/GrGpu.cpp View 1 2 2 chunks +2 lines, -5 lines 0 comments Download
M src/gpu/GrGpuResource.cpp View 3 chunks +20 lines, -17 lines 0 comments Download
M src/gpu/GrGpuResourceCacheAccess.h View 1 chunk +0 lines, -12 lines 0 comments Download
M src/gpu/GrGpuResourcePriv.h View 2 chunks +2 lines, -2 lines 0 comments Download
M src/gpu/GrPath.h View 1 chunk +1 line, -1 line 0 comments Download
M src/gpu/GrPathRange.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M src/gpu/GrResourceCache.h View 3 chunks +4 lines, -14 lines 0 comments Download
M src/gpu/GrResourceCache.cpp View 3 chunks +5 lines, -5 lines 0 comments Download
M src/gpu/GrStencilAttachment.h View 1 chunk +2 lines, -2 lines 0 comments Download
M src/gpu/GrTexture.cpp View 1 2 2 chunks +9 lines, -9 lines 0 comments Download
M src/gpu/gl/GrGLBuffer.cpp View 1 1 chunk +1 line, -1 line 0 comments Download
M src/gpu/gl/GrGLGpu.h View 1 2 2 chunks +4 lines, -4 lines 0 comments Download
M src/gpu/gl/GrGLGpu.cpp View 1 2 3 11 chunks +23 lines, -33 lines 0 comments Download
M src/gpu/gl/GrGLPath.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M src/gpu/gl/GrGLPathRange.cpp View 3 chunks +3 lines, -3 lines 0 comments Download
M src/gpu/gl/GrGLRenderTarget.h View 1 2 3 4 chunks +6 lines, -15 lines 0 comments Download
M src/gpu/gl/GrGLRenderTarget.cpp View 1 2 3 4 5 4 chunks +19 lines, -10 lines 0 comments Download
M src/gpu/gl/GrGLStencilAttachment.h View 1 chunk +7 lines, -8 lines 0 comments Download
M src/gpu/gl/GrGLStencilAttachment.cpp View 1 chunk +1 line, -1 line 0 comments Download
M src/gpu/gl/GrGLTexture.h View 1 2 3 4 chunks +12 lines, -14 lines 0 comments Download
M src/gpu/gl/GrGLTexture.cpp View 1 2 3 4 5 3 chunks +28 lines, -13 lines 0 comments Download
M src/gpu/gl/GrGLTextureRenderTarget.h View 1 2 3 4 5 2 chunks +21 lines, -4 lines 0 comments Download
M src/gpu/gl/GrGLTextureRenderTarget.cpp View 1 2 3 4 5 1 chunk +13 lines, -0 lines 0 comments Download
M src/gpu/vk/GrVkGpu.h View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M src/gpu/vk/GrVkGpu.cpp View 1 2 3 4 5 7 chunks +6 lines, -16 lines 0 comments Download
M src/gpu/vk/GrVkIndexBuffer.cpp View 1 1 chunk +1 line, -1 line 0 comments Download
M src/gpu/vk/GrVkRenderTarget.h View 3 chunks +7 lines, -15 lines 0 comments Download
M src/gpu/vk/GrVkRenderTarget.cpp View 1 2 3 4 5 12 chunks +24 lines, -33 lines 0 comments Download
M src/gpu/vk/GrVkStencilAttachment.h View 2 chunks +1 line, -3 lines 0 comments Download
M src/gpu/vk/GrVkStencilAttachment.cpp View 1 2 3 4 5 2 chunks +3 lines, -5 lines 0 comments Download
M src/gpu/vk/GrVkTexture.h View 3 chunks +12 lines, -11 lines 0 comments Download
M src/gpu/vk/GrVkTexture.cpp View 1 2 3 4 5 6 chunks +32 lines, -23 lines 0 comments Download
M src/gpu/vk/GrVkTextureRenderTarget.h View 2 chunks +48 lines, -18 lines 0 comments Download
M src/gpu/vk/GrVkTextureRenderTarget.cpp View 1 2 3 4 5 7 chunks +16 lines, -20 lines 0 comments Download
M src/gpu/vk/GrVkTransferBuffer.cpp View 1 1 chunk +1 line, -1 line 0 comments Download
M src/gpu/vk/GrVkVertexBuffer.cpp View 1 1 chunk +1 line, -1 line 0 comments Download
M src/image/SkSurface_Gpu.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download
M tests/ResourceCacheTest.cpp View 13 chunks +51 lines, -44 lines 0 comments Download
M tools/gpu/GrTest.cpp View 1 2 2 chunks +5 lines, -6 lines 0 comments Download

Messages

Total messages: 28 (12 generated)
Kimmo Kinnunen
This should be a no-change refactoring. It should be usable with or without the fbo ...
4 years, 8 months ago (2016-04-06 14:28:15 UTC) #3
bsalomon
Sorry for the slow review. I like this direction. https://codereview.chromium.org/1862043002/diff/20001/include/gpu/GrGpuResource.h File include/gpu/GrGpuResource.h (right): https://codereview.chromium.org/1862043002/diff/20001/include/gpu/GrGpuResource.h#newcode269 include/gpu/GrGpuResource.h:269: ...
4 years, 8 months ago (2016-04-19 14:37:46 UTC) #4
Kimmo Kinnunen
https://codereview.chromium.org/1862043002/diff/20001/include/gpu/GrGpuResource.h File include/gpu/GrGpuResource.h (right): https://codereview.chromium.org/1862043002/diff/20001/include/gpu/GrGpuResource.h#newcode269 include/gpu/GrGpuResource.h:269: virtual void computeScratchKey(GrScratchKey* scratchKey) const { }; On 2016/04/19 ...
4 years, 8 months ago (2016-04-20 12:04:55 UTC) #5
Kimmo Kinnunen
https://codereview.chromium.org/1862043002/diff/20001/include/gpu/GrGpuResource.h File include/gpu/GrGpuResource.h (right): https://codereview.chromium.org/1862043002/diff/20001/include/gpu/GrGpuResource.h#newcode269 include/gpu/GrGpuResource.h:269: virtual void computeScratchKey(GrScratchKey* scratchKey) const { }; On 2016/04/19 ...
4 years, 8 months ago (2016-04-20 12:04:55 UTC) #6
Kimmo Kinnunen
https://codereview.chromium.org/1862043002/diff/60001/include/gpu/GrTypes.h File include/gpu/GrTypes.h (right): https://codereview.chromium.org/1862043002/diff/60001/include/gpu/GrTypes.h#newcode428 include/gpu/GrTypes.h:428: enum class GrBackendObjectOwnership : bool { I guess now ...
4 years, 8 months ago (2016-04-20 13:59:03 UTC) #8
bsalomon
https://codereview.chromium.org/1862043002/diff/60001/include/gpu/GrTypes.h File include/gpu/GrTypes.h (right): https://codereview.chromium.org/1862043002/diff/60001/include/gpu/GrTypes.h#newcode428 include/gpu/GrTypes.h:428: enum class GrBackendObjectOwnership : bool { On 2016/04/20 13:59:03, ...
4 years, 8 months ago (2016-04-20 15:48:03 UTC) #9
Kimmo Kinnunen
On 2016/04/20 15:48:03, bsalomon wrote: > https://codereview.chromium.org/1862043002/diff/60001/include/gpu/GrTypes.h#newcode428 > include/gpu/GrTypes.h:428: enum class GrBackendObjectOwnership : bool { ...
4 years, 8 months ago (2016-04-21 08:08:45 UTC) #10
bsalomon
lgtm
4 years, 8 months ago (2016-04-21 12:58:41 UTC) #11
Kimmo Kinnunen
On 2016/04/21 12:58:41, bsalomon wrote: > lgtm I had to do small changes that I ...
4 years, 8 months ago (2016-04-22 08:25:50 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1862043002/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1862043002/100001
4 years, 8 months ago (2016-04-22 08:26:04 UTC) #15
commit-bot: I haz the power
Try jobs failed on following builders: Build-Mac-Clang-x86_64-Release-Trybot on client.skia.compile (JOB_FAILED, http://build.chromium.org/p/client.skia.compile/builders/Build-Mac-Clang-x86_64-Release-Trybot/builds/2114) Build-Ubuntu-Clang-x86_64-Debug-Trybot on client.skia.compile (JOB_FAILED, ...
4 years, 8 months ago (2016-04-22 08:27:35 UTC) #17
Kimmo Kinnunen
https://chromiumcodereview.appspot.com/1862043002/diff/100001/src/gpu/gl/GrGLRenderTarget.cpp File src/gpu/gl/GrGLRenderTarget.cpp (right): https://chromiumcodereview.appspot.com/1862043002/diff/100001/src/gpu/gl/GrGLRenderTarget.cpp#newcode163 src/gpu/gl/GrGLRenderTarget.cpp:163: // Direct GrGLRenderTarget instances are always created with CreateWrapped. ...
4 years, 8 months ago (2016-04-22 08:28:42 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1862043002/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1862043002/120001
4 years, 8 months ago (2016-04-22 08:31:58 UTC) #21
commit-bot: I haz the power
Try jobs failed on following builders: Build-Mac-Clang-x86_64-Release-Trybot on client.skia.compile (JOB_FAILED, http://build.chromium.org/p/client.skia.compile/builders/Build-Mac-Clang-x86_64-Release-Trybot/builds/2115)
4 years, 8 months ago (2016-04-22 08:33:28 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1862043002/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1862043002/140001
4 years, 8 months ago (2016-04-22 08:39:27 UTC) #26
commit-bot: I haz the power
4 years, 8 months ago (2016-04-22 08:48:34 UTC) #28
Message was sent while issue was closed.
Committed patchset #8 (id:140001) as
https://skia.googlesource.com/skia/+/2e6055b3ea14a04fcde1ac1974a70bf00b1e295b

Powered by Google App Engine
This is Rietveld 408576698