Commit 1d6d2076 authored by Peng Huang's avatar Peng Huang Committed by Commit Bot

ExternalVkImageBacking: fix a synchronize issue

Bug: 1004772
Change-Id: I2f00c70d86402e65e24f7e651c4a3827f7595577
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2313159Reviewed-by: default avatarVasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#790903}
parent 64a5462e
......@@ -1044,8 +1044,7 @@ void ExternalVkImageBacking::EndAccessInternal(
is_write_in_progress_ = false;
}
// synchronization is not needed if it is not the last gl access.
if (need_synchronization() && reads_in_progress_ == 0) {
if (need_synchronization()) {
DCHECK(!is_write_in_progress_);
DCHECK(external_semaphore);
if (readonly) {
......@@ -1055,6 +1054,8 @@ void ExternalVkImageBacking::EndAccessInternal(
DCHECK(read_semaphores_.empty());
write_semaphore_ = std::move(external_semaphore);
}
} else {
DCHECK(!external_semaphore);
}
}
......
......@@ -181,16 +181,6 @@ void ExternalVkImageSkiaRepresentation::EndAccess(bool readonly) {
DCHECK_NE(access_mode_, kNone);
DCHECK(backing_impl()->need_synchronization() || !end_access_semaphore_);
if (backing_impl()->need_synchronization() && end_access_semaphore_) {
// We're done with the semaphore, enqueue deferred cleanup.
// Reusing this VkSemaphore causes vulkan device lost with NVIDIA GPU for
// page content/test/data/gpu/pixel_canvas_low_latency_webgl_draw_image.html
// So we have to take the VkSemaphore from it and not reuse it.
// TODO(penghuang): reuse VkSemaphore. https://crbug.com/1107558
fence_helper()->EnqueueSemaphoreCleanupForSubmittedWork(
end_access_semaphore_.TakeVkSemaphore());
}
backing_impl()->EndAccess(readonly, std::move(end_access_semaphore_),
false /* is_gl */);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment