Revert "Don't release vk memory allocator until context is deleted."
This reverts commit 11afa63693
.
Reason for revert: breaking perf bots
Original change's description:
> Don't release vk memory allocator until context is deleted.
>
> Bug: chromium:1081806
>
> Change-Id: I0a7a92408a3f2119e6b70d8eef6aa4f2d1982d4b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297357
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,bsalomon@google.com
Change-Id: I48d200cb72eb30c119359e89c5a9123213e62a5e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1081806
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297457
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
f8d68fe7d4
commit
c35c073c80
@ -61,10 +61,7 @@ public:
|
||||
|
||||
/**
|
||||
* The Vulkan context (VkQueue, VkDevice, VkInstance) must be kept alive until the returned
|
||||
* GrContext is destroyed. This also means that any objects created with this GrContext (e.g.
|
||||
* SkSurfaces, SkImages, etc.) must also be released as they may hold refs on the GrContext.
|
||||
* Once all these objects and the GrContext are released, then it is safe to delete the vulkan
|
||||
* objects.
|
||||
* GrContext is first destroyed or abandoned.
|
||||
*/
|
||||
static sk_sp<GrContext> MakeVulkan(const GrVkBackendContext&, const GrContextOptions&);
|
||||
static sk_sp<GrContext> MakeVulkan(const GrVkBackendContext&);
|
||||
@ -136,10 +133,7 @@ public:
|
||||
* API calls may crash.
|
||||
*
|
||||
* For Vulkan, even if the device becomes lost, the VkQueue, VkDevice, or VkInstance used to
|
||||
* create the GrContext must be kept alive even after abandoning the context. Those objects must
|
||||
* live for the lifetime of the GrContext object itself. The reason for this is so that
|
||||
* we can continue to delete any outstanding GrBackendTextures/RenderTargets which must be
|
||||
* cleaned up even in a device lost state.
|
||||
* create the GrContext must be alive before calling abandonContext.
|
||||
*/
|
||||
void abandonContext() override;
|
||||
|
||||
|
@ -59,7 +59,6 @@ GrContext::~GrContext() {
|
||||
if (this->drawingManager()) {
|
||||
this->drawingManager()->cleanup();
|
||||
}
|
||||
fMappedBufferManager.reset();
|
||||
delete fResourceProvider;
|
||||
delete fResourceCache;
|
||||
}
|
||||
|
@ -286,11 +286,9 @@ void GrVkGpu::destroyResources() {
|
||||
GrVkGpu::~GrVkGpu() {
|
||||
if (!fDisconnected) {
|
||||
this->destroyResources();
|
||||
fMemoryAllocator.reset();
|
||||
}
|
||||
delete fCompiler;
|
||||
// We don't delete the memory allocator until the very end of the GrVkGpu lifetime so that
|
||||
// clients can continue to delete backend textures even after a context has been abandoned.
|
||||
fMemoryAllocator.reset();
|
||||
}
|
||||
|
||||
|
||||
@ -298,6 +296,7 @@ void GrVkGpu::disconnect(DisconnectType type) {
|
||||
INHERITED::disconnect(type);
|
||||
if (!fDisconnected) {
|
||||
this->destroyResources();
|
||||
fMemoryAllocator.reset();
|
||||
|
||||
fSemaphoresToWaitOn.reset();
|
||||
fSemaphoresToSignal.reset();
|
||||
|
@ -1035,12 +1035,9 @@ DEF_GPUTEST(AsyncReadPixelsContextShutdown, reporter, options) {
|
||||
// Vulkan context abandoning without resource release has issues outside of the scope of
|
||||
// this test.
|
||||
if (type == sk_gpu_test::GrContextFactory::kVulkan_ContextType &&
|
||||
(sequence == ShutdownSequence::kFreeResult_ReleaseAndAbandon_DestroyContext ||
|
||||
sequence == ShutdownSequence::kFreeResult_Abandon_DestroyContext ||
|
||||
sequence == ShutdownSequence::kReleaseAndAbandon_FreeResult_DestroyContext ||
|
||||
sequence == ShutdownSequence::kReleaseAndAbandon_DestroyContext_FreeResult ||
|
||||
sequence == ShutdownSequence::kAbandon_FreeResult_DestroyContext ||
|
||||
sequence == ShutdownSequence::kAbandon_DestroyContext_FreeResult)) {
|
||||
(sequence == ShutdownSequence::kAbandon_FreeResult_DestroyContext ||
|
||||
sequence == ShutdownSequence::kAbandon_DestroyContext_FreeResult ||
|
||||
sequence == ShutdownSequence::kFreeResult_Abandon_DestroyContext)) {
|
||||
continue;
|
||||
}
|
||||
for (bool yuv : {false, true}) {
|
||||
@ -1078,10 +1075,6 @@ DEF_GPUTEST(AsyncReadPixelsContextShutdown, reporter, options) {
|
||||
sk_gpu_test::GrContextFactory::ContextTypeName(type), yuv);
|
||||
continue;
|
||||
}
|
||||
// For vulkan we need to release all refs to the GrContext before trying to destroy
|
||||
// the test context. The surface here is holding a ref.
|
||||
surf.reset();
|
||||
|
||||
// The real test is that we don't crash, get Vulkan validation errors, etc, during
|
||||
// this shutdown sequence.
|
||||
switch (sequence) {
|
||||
|
Loading…
Reference in New Issue
Block a user