Commit cf744e5c authored by Sergey Ulanov's avatar Sergey Ulanov Committed by Commit Bot

[Fuchsia] Synchronize image access in OutputPresenterFuchsia

Image access in OutputPresenterImages was not synchronized because
need_synchronization() was false int he images it uses.
Updated OutputPresenterFuchsia to set SCANOUT image usage bit and also
updated ExternalVkImageBacking::need_synchronization() to return true
for SCANOUT images. This ensures that image access in
OutputPresenterFuchsia properly.

Also fixed semaphore ownership handling in OutputPresenterFuchsia.

Bug: 1115692
Change-Id: Ibf375845eab2fbf320f777f45adcc98719ee239c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2353413
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Auto-Submit: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarPeng Huang <penghuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798127}
parent f99cd179
......@@ -312,7 +312,8 @@ OutputPresenterFuchsia::AllocateImages(gfx::ColorSpace color_space,
collection->Close();
// Create PresenterImageFuchsia for each buffer in the collection.
uint32_t image_usage = gpu::SHARED_IMAGE_USAGE_RASTER;
uint32_t image_usage =
gpu::SHARED_IMAGE_USAGE_RASTER | gpu::SHARED_IMAGE_USAGE_SCANOUT;
if (vulkan->enforce_protected_memory())
image_usage |= gpu::SHARED_IMAGE_USAGE_PROTECTED;
......@@ -412,6 +413,8 @@ void OutputPresenterFuchsia::SchedulePrimaryPlane(
std::vector<GrBackendSemaphore> read_begin_semaphores;
std::vector<GrBackendSemaphore> read_end_semaphores;
image_fuchsia->TakeSemaphores(&read_begin_semaphores, &read_end_semaphores);
DCHECK(!read_begin_semaphores.empty());
DCHECK(!read_end_semaphores.empty());
auto* vulkan_context_provider = dependency_->GetVulkanContextProvider();
auto* vulkan_implementation =
......@@ -423,13 +426,6 @@ void OutputPresenterFuchsia::SchedulePrimaryPlane(
read_begin_semaphores, &(next_frame_->acquire_fences));
GrSemaphoresToZxEvents(vulkan_implementation, vk_device, read_end_semaphores,
&(next_frame_->release_fences));
// Destroy |read_begin_semaphores|, but not |read_end_semaphores|, since
// SharedImageRepresentationSkia::BeginScopedReadAccess() keeps ownership of
// the end_semaphores.
for (auto& semaphore : read_begin_semaphores) {
vkDestroySemaphore(vk_device, semaphore.vkSemaphore(), nullptr);
}
}
std::vector<OutputPresenter::OverlayData>
......
......@@ -103,6 +103,11 @@ class ExternalVkImageBacking final : public ClearTrackingSharedImageBacking {
if (usage() & SHARED_IMAGE_USAGE_GLES2) {
return !use_separate_gl_texture() && (texture_ || texture_passthrough_);
}
if (usage() & SHARED_IMAGE_USAGE_SCANOUT) {
return true;
}
return false;
}
uint32_t reads_in_progress() const { return reads_in_progress_; }
......
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