Commit 568b4fff authored by Aaron Krajeski's avatar Aaron Krajeski Committed by Commit Bot

Copy sub texture, even in non OOP-R

Has become a straightforward revert of this commit.
https://chromium-review.googlesource.com/c/chromium/src/+/2216591

For as yet unknown reasons, not using CopySubTexture can cause rapid
flickering between pixellated and non-pixellated rendering. Considering
this is negatively effecting many users right now, it may be worth
pushing this change through as a quick fix.

Bug: 1134799
Change-Id: Ia25b312f3755063b1fdeaa39be5057b7654b7548
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2450842Reviewed-by: default avatarJonah Chin <jochin@microsoft.com>
Reviewed-by: default avatarJuanmi Huertas <juanmihd@chromium.org>
Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Commit-Queue: Aaron Krajeski <aaronhk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815697}
parent fb3e5af0
...@@ -444,17 +444,27 @@ class CanvasResourceProviderSharedImage : public CanvasResourceProvider { ...@@ -444,17 +444,27 @@ class CanvasResourceProviderSharedImage : public CanvasResourceProvider {
resource_ = NewOrRecycledResource(); resource_ = NewOrRecycledResource();
DCHECK(resource_); DCHECK(resource_);
if (use_oop_rasterization_) { auto* raster_interface = RasterInterface();
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);
RasterInterface()->CopySubTexture( raster_interface->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_) {
...@@ -1492,6 +1502,11 @@ bool CanvasResourceProvider::HasRecordedDrawOps() const { ...@@ -1492,6 +1502,11 @@ 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;
......
...@@ -265,6 +265,7 @@ class PLATFORM_EXPORT CanvasResourceProvider ...@@ -265,6 +265,7 @@ 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