Commit ac1e32be authored by Jonah Chin's avatar Jonah Chin Committed by Commit Bot

Use replaceBackendTexture in non OOP-R mode for perf

Using RasterInterface's CopySubTexture() proved costly. Reverting to
replaceBackendTexture in non OOP-R mode to regain lost perf. OOP-R mode
will continue to use RasterInterface for copy-on-write.

Bug: 1082399, 1082403
Change-Id: I80e1b285e4d7c4336a706d1e5f006afd676f0b2c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2216591Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Commit-Queue: Jonah Chin <jochin@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#772079}
parent 263b3d04
...@@ -355,28 +355,17 @@ class CanvasResourceProviderSharedImage : public CanvasResourceProvider { ...@@ -355,28 +355,17 @@ class CanvasResourceProviderSharedImage : public CanvasResourceProvider {
resource_ = NewOrRecycledResource(); resource_ = NewOrRecycledResource();
DCHECK(resource_); DCHECK(resource_);
auto* raster_interface = RasterInterface(); if (use_oop_rasterization_) {
if (raster_interface) {
if (!use_oop_rasterization_)
TearDownSkSurface();
if (mode_ == SkSurface::kRetain_ContentChangeMode) { if (mode_ == SkSurface::kRetain_ContentChangeMode) {
auto old_mailbox = old_resource_shared_image->GetOrCreateGpuMailbox( auto old_mailbox = old_resource_shared_image->GetOrCreateGpuMailbox(
kOrderingBarrier); kOrderingBarrier);
auto mailbox = resource()->GetOrCreateGpuMailbox(kOrderingBarrier); auto mailbox = resource()->GetOrCreateGpuMailbox(kOrderingBarrier);
raster_interface->CopySubTexture( RasterInterface()->CopySubTexture(
old_mailbox, mailbox, GetBackingTextureTarget(), 0, 0, 0, 0, old_mailbox, mailbox, GetBackingTextureTarget(), 0, 0, 0, 0,
Size().Width(), Size().Height(), false /* unpack_flip_y */, Size().Width(), Size().Height(), false /* unpack_flip_y */,
false /* unpack_premultiply_alpha */); false /* unpack_premultiply_alpha */);
} }
// In non-OOPR mode we need to update the client side SkSurface with the
// copied texture. Recreating SkSurface here matches the GPU process
// behaviour that will happen in OOPR mode.
if (!use_oop_rasterization_) {
GetSkSurface();
}
} else { } else {
EnsureWriteAccess(); EnsureWriteAccess();
if (surface_) { if (surface_) {
...@@ -1514,11 +1503,6 @@ bool CanvasResourceProvider::HasRecordedDrawOps() const { ...@@ -1514,11 +1503,6 @@ bool CanvasResourceProvider::HasRecordedDrawOps() const {
return recorder_ && recorder_->ListHasDrawOps(); return recorder_ && recorder_->ListHasDrawOps();
} }
void CanvasResourceProvider::TearDownSkSurface() {
skia_canvas_ = nullptr;
surface_ = nullptr;
}
size_t CanvasResourceProvider::ComputeSurfaceSize() const { size_t CanvasResourceProvider::ComputeSurfaceSize() const {
if (!surface_) if (!surface_)
return 0; return 0;
......
...@@ -288,7 +288,6 @@ class PLATFORM_EXPORT CanvasResourceProvider ...@@ -288,7 +288,6 @@ class PLATFORM_EXPORT CanvasResourceProvider
cc::PaintImage MakeImageSnapshot(); cc::PaintImage MakeImageSnapshot();
virtual void RasterRecord(sk_sp<cc::PaintRecord>); virtual void RasterRecord(sk_sp<cc::PaintRecord>);
CanvasImageProvider* GetOrCreateCanvasImageProvider(); CanvasImageProvider* GetOrCreateCanvasImageProvider();
void TearDownSkSurface();
ResourceProviderType type_; ResourceProviderType type_;
mutable sk_sp<SkSurface> surface_; // mutable for lazy init mutable sk_sp<SkSurface> surface_; // mutable for lazy init
......
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