Skip to content

Commit

Permalink
Update skia flush call to latest API.
Browse files Browse the repository at this point in the history
This removes the need to set kNone for the backend access on each flush
as well as add some uses of the default flush() call instead of passing
in empty GrFlushInfo.

Change-Id: I65717f8f7b5d51d6a6c18f9a3e548b5b335bda49
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2276171
Reviewed-by: Peng Huang <penghuang@chromium.org>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Cr-Commit-Position: refs/heads/master@{#783958}
  • Loading branch information
egdaniel authored and Commit Bot committed Jun 30, 2020
1 parent 75ef8e4 commit 5f9b778
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 21 deletions.
4 changes: 1 addition & 3 deletions components/viz/service/display_embedder/output_presenter.cc
Expand Up @@ -85,12 +85,10 @@ void OutputPresenter::Image::EndWriteSkia() {
DCHECK(scoped_skia_write_access_);
if (!end_semaphores_.empty()) {
GrFlushInfo flush_info = {
.fFlags = kNone_GrFlushFlags,
.fNumSemaphores = end_semaphores_.size(),
.fSignalSemaphores = end_semaphores_.data(),
};
scoped_skia_write_access_->surface()->flush(
SkSurface::BackendSurfaceAccess::kNoAccess, flush_info);
scoped_skia_write_access_->surface()->flush(flush_info);
DCHECK(scoped_skia_write_access_->surface()->getContext());
scoped_skia_write_access_->surface()->getContext()->submit();
}
Expand Down
Expand Up @@ -972,7 +972,6 @@ bool SkiaOutputSurfaceImplOnGpu::FinishPaintCurrentFrame(
end_paint_semaphores.end());

GrFlushInfo flush_info = {
.fFlags = kNone_GrFlushFlags,
.fNumSemaphores = end_semaphores.size(),
.fSignalSemaphores = end_semaphores.data(),
};
Expand Down Expand Up @@ -1131,14 +1130,12 @@ void SkiaOutputSurfaceImplOnGpu::FinishPaintRenderPass(
destroy_after_swap_.emplace_back(std::move(ddl));

GrFlushInfo flush_info = {
.fFlags = kNone_GrFlushFlags,
.fNumSemaphores = end_semaphores.size(),
.fSignalSemaphores = end_semaphores.data(),
};
gpu::AddVulkanCleanupTaskForSkiaFlush(vulkan_context_provider_,
&flush_info);
auto result = offscreen.surface()->flush(
SkSurface::BackendSurfaceAccess::kNoAccess, flush_info);
auto result = offscreen.surface()->flush(flush_info);
if (result != GrSemaphoresSubmitted::kYes &&
!(begin_semaphores.empty() && end_semaphores.empty())) {
// TODO(penghuang): handle vulkan device lost.
Expand Down Expand Up @@ -1248,11 +1245,11 @@ bool SkiaOutputSurfaceImplOnGpu::CopyOutput(
surface->getCanvas()->drawPaint(paint);
gl::ScopedProgressReporter scoped_progress_reporter(
context_state_->progress_reporter());
surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, {});
surface->flush();
}

if (use_gl_renderer_copier_) {
surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, {});
surface->flush();

GLuint gl_id = 0;
GLenum internal_format = supports_alpha_ ? GL_RGBA : GL_RGB;
Expand Down
14 changes: 3 additions & 11 deletions gpu/command_buffer/service/raster_decoder.cc
Expand Up @@ -848,7 +848,6 @@ void RasterDecoderImpl::Destroy(bool have_context) {
// Make sure we flush any pending skia work on this context.
if (sk_surface_) {
GrFlushInfo flush_info = {
.fFlags = kNone_GrFlushFlags,
.fNumSemaphores = end_semaphores_.size(),
.fSignalSemaphores = end_semaphores_.data(),
};
Expand Down Expand Up @@ -2215,14 +2214,12 @@ void RasterDecoderImpl::DoCopySubTextureINTERNALSkia(
// so the begin_semaphores can be released, and end_semaphores can be
// signalled.
GrFlushInfo flush_info = {
.fFlags = kNone_GrFlushFlags,
.fNumSemaphores = end_semaphores.size(),
.fSignalSemaphores = end_semaphores.data(),
};
gpu::AddVulkanCleanupTaskForSkiaFlush(
shared_context_state_->vk_context_provider(), &flush_info);
auto result = dest_scoped_access->surface()->flush(
SkSurface::BackendSurfaceAccess::kNoAccess, flush_info);
auto result = dest_scoped_access->surface()->flush(flush_info);
// If the |end_semaphores| is empty, we can deferred the queue submission.
if (!end_semaphores.empty()) {
DCHECK_EQ(result, GrSemaphoresSubmitted::kYes);
Expand Down Expand Up @@ -2349,14 +2346,12 @@ void RasterDecoderImpl::DoWritePixelsINTERNAL(GLint x_offset,
}

GrFlushInfo flush_info = {
.fFlags = kNone_GrFlushFlags,
.fNumSemaphores = end_semaphores.size(),
.fSignalSemaphores = end_semaphores.data(),
};
gpu::AddVulkanCleanupTaskForSkiaFlush(
shared_context_state_->vk_context_provider(), &flush_info);
auto result = dest_scoped_access->surface()->flush(
SkSurface::BackendSurfaceAccess::kNoAccess, flush_info);
auto result = dest_scoped_access->surface()->flush(flush_info);
if (!end_semaphores.empty()) {
DCHECK_EQ(result, GrSemaphoresSubmitted::kYes);
gr_context()->submit();
Expand Down Expand Up @@ -2543,14 +2538,12 @@ void RasterDecoderImpl::DoConvertYUVMailboxesToRGBINTERNAL(
// so the begin_semaphores can be released, and end_semaphores can be
// signalled.
GrFlushInfo flush_info = {
.fFlags = kNone_GrFlushFlags,
.fNumSemaphores = end_semaphores.size(),
.fSignalSemaphores = end_semaphores.data(),
};
gpu::AddVulkanCleanupTaskForSkiaFlush(
shared_context_state_->vk_context_provider(), &flush_info);
auto result = dest_scoped_access->surface()->flush(
SkSurface::BackendSurfaceAccess::kNoAccess, flush_info);
auto result = dest_scoped_access->surface()->flush(flush_info);
if (!end_semaphores.empty()) {
DCHECK_EQ(result, GrSemaphoresSubmitted::kYes);
gr_context()->submit();
Expand Down Expand Up @@ -2883,7 +2876,6 @@ void RasterDecoderImpl::DoEndRasterCHROMIUM() {
gl::ScopedProgressReporter report_progress(
shared_context_state_->progress_reporter());
GrFlushInfo flush_info = {
.fFlags = kNone_GrFlushFlags,
.fNumSemaphores = end_semaphores_.size(),
.fSignalSemaphores = end_semaphores_.data(),
};
Expand Down
1 change: 0 additions & 1 deletion gpu/vulkan/demo/vulkan_demo.cc
Expand Up @@ -199,7 +199,6 @@ void VulkanDemo::RenderFrame() {
GrBackendSemaphore semaphore;
semaphore.initVulkan(scoped_write_->GetEndSemaphore());
GrFlushInfo flush_info = {
.fFlags = kNone_GrFlushFlags,
.fNumSemaphores = 1,
.fSignalSemaphores = &semaphore,
};
Expand Down

0 comments on commit 5f9b778

Please sign in to comment.