Skip to content

Commit

Permalink
Defer releasing VulkanSurface
Browse files Browse the repository at this point in the history
For resizing, we will defer releasing the old VulkanSwapChian with
VulkanFenceHelper. In some cases, we may release VulkanSurface before
releasing an old VulkanSwapChain. It cause use-after-release problem.
Fix the problem, by also releasing VulkanSurface with VulkanFenceHelper
as well.

(cherry picked from commit 736d6c8)

Bug: 1395542
Change-Id: Iefdb29e4224dc539c4b2c23323314ae5fcd02433
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4081750
Commit-Queue: Peng Huang <penghuang@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Auto-Submit: Peng Huang <penghuang@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1079797}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4089608
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/5359@{#1142}
Cr-Branched-From: 27d3765-refs/heads/main@{#1058933}
  • Loading branch information
phuang authored and Chromium LUCI CQ committed Dec 9, 2022
1 parent 3301003 commit e2d1110
Showing 1 changed file with 4 additions and 7 deletions.
Expand Up @@ -15,6 +15,7 @@
#include "gpu/command_buffer/service/memory_tracking.h"
#include "gpu/config/gpu_finch_features.h"
#include "gpu/ipc/common/gpu_surface_lookup.h"
#include "gpu/vulkan/vulkan_fence_helper.h"
#include "gpu/vulkan/vulkan_function_pointers.h"
#include "gpu/vulkan/vulkan_implementation.h"
#include "gpu/vulkan/vulkan_surface.h"
Expand Down Expand Up @@ -68,13 +69,9 @@ SkiaOutputDeviceVulkan::~SkiaOutputDeviceVulkan() {
if (UNLIKELY(!vulkan_surface_))
return;

{
base::ScopedBlockingCall scoped_blocking_call(
FROM_HERE, base::BlockingType::MAY_BLOCK);
vkQueueWaitIdle(context_provider_->GetDeviceQueue()->GetVulkanQueue());
}

vulkan_surface_->Destroy();
auto* fence_helper = context_provider_->GetDeviceQueue()->GetFenceHelper();
fence_helper->EnqueueVulkanObjectCleanupForSubmittedWork(
std::move(vulkan_surface_));
}

#if BUILDFLAG(IS_WIN)
Expand Down

0 comments on commit e2d1110

Please sign in to comment.