Stop using pendingIO in read/writeSurfacePixels (take 2)
This changes the implementation to always flush for these operations.
Once partial DAG flushes are implemented this behavior will be better than the old method.
The following two CLs have suppressed all the failures that caused the first try to be reverted:
https://skia-review.googlesource.com/c/skia/+/206069 (Blacklist two more GMs for gltestthreading)
https://skia-review.googlesource.com/c/skia/+/206171 (Disable the TextureStripAtlasManagerColorFilterTest on MoltenVK)
TBR=bsalomon@google.com
Change-Id: Ie2d09ebcba03f9987a42038605801f7341fc72a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206177
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrContextPriv.cpp b/src/gpu/GrContextPriv.cpp
index 2b9d1e7..98820c3 100644
--- a/src/gpu/GrContextPriv.cpp
+++ b/src/gpu/GrContextPriv.cpp
@@ -304,12 +304,13 @@
ASSERT_OWNED_PROXY_PRIV(src->asSurfaceProxy());
GR_CREATE_TRACE_MARKER_CONTEXT("GrContextPriv", "readSurfacePixels", fContext);
+ GrSurfaceProxy* srcProxy = src->asSurfaceProxy();
+
// MDB TODO: delay this instantiation until later in the method
- if (!src->asSurfaceProxy()->instantiate(this->resourceProvider(), true)) {
+ if (!srcProxy->instantiate(this->resourceProvider())) {
return false;
}
- GrSurfaceProxy* srcProxy = src->asSurfaceProxy();
GrSurface* srcSurface = srcProxy->peekSurface();
if (!GrSurfacePriv::AdjustReadPixelParams(srcSurface->width(), srcSurface->height(),
@@ -450,9 +451,7 @@
sk_bzero(buffer, tempPixmap.computeByteSize());
}
- if (srcSurface->surfacePriv().hasPendingWrite()) {
- this->flush(nullptr); // MDB TODO: tighten this
- }
+ this->flush(srcProxy);
if (!fContext->fGpu->readPixels(srcSurface, left, top, width, height, allowedColorType, buffer,
rowBytes)) {
@@ -493,11 +492,11 @@
return false;
}
- if (!dst->asSurfaceProxy()->instantiate(this->resourceProvider(), true)) {
+ GrSurfaceProxy* dstProxy = dst->asSurfaceProxy();
+ if (!dstProxy->instantiate(this->resourceProvider())) {
return false;
}
- GrSurfaceProxy* dstProxy = dst->asSurfaceProxy();
GrSurface* dstSurface = dstProxy->peekSurface();
if (!GrSurfacePriv::AdjustWritePixelParams(dstSurface->width(), dstSurface->height(),
@@ -580,10 +579,13 @@
dst->asRenderTargetContext()->fillRectToRect(
GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::MakeXYWH(left, top, width, height), SkRect::MakeWH(width, height));
- return true;
} else {
- return dst->copy(tempProxy.get(), SkIRect::MakeWH(width, height), {left, top});
+ if (!dst->copy(tempProxy.get(), SkIRect::MakeWH(width, height), {left, top})) {
+ return false;
+ }
}
+
+ return true;
}
bool convert = premul || needColorConversion;
@@ -645,9 +647,7 @@
top = dstSurface->height() - top - height;
}
- if (dstSurface->surfacePriv().hasPendingIO()) {
- this->flush(nullptr); // MDB TODO: tighten this
- }
+ this->flush(dstProxy);
return this->getGpu()->writePixels(dstSurface, left, top, width, height, srcColorType, buffer,
rowBytes);