Revert "Stop using pendingIO in read/writeSurfacePixels"

This reverts commit 76cf552e28.

Reason for revert: Maybe breaking some bots

Original change's description:
> Stop using pendingIO in read/writeSurfacePixels
> 
> 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.
> 
> Change-Id: I1f9edd33dcf5aa15cc5dcdf8f0e06a3b3cd88f48
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205584
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

TBR=bsalomon@google.com,robertphillips@google.com

Change-Id: If3e8cc9a6e92b98f85bc3faf2b99fba7395ec946
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206067
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2019-04-04 14:24:28 +00:00 committed by Skia Commit-Bot
parent 68cbc925ec
commit cd657f1d97

View File

@ -304,13 +304,12 @@ bool GrContextPriv::readSurfacePixels(GrSurfaceContext* src, int left, int top,
ASSERT_OWNED_PROXY_PRIV(src->asSurfaceProxy()); ASSERT_OWNED_PROXY_PRIV(src->asSurfaceProxy());
GR_CREATE_TRACE_MARKER_CONTEXT("GrContextPriv", "readSurfacePixels", fContext); GR_CREATE_TRACE_MARKER_CONTEXT("GrContextPriv", "readSurfacePixels", fContext);
GrSurfaceProxy* srcProxy = src->asSurfaceProxy();
// MDB TODO: delay this instantiation until later in the method // MDB TODO: delay this instantiation until later in the method
if (!srcProxy->instantiate(this->resourceProvider())) { if (!src->asSurfaceProxy()->instantiate(this->resourceProvider(), true)) {
return false; return false;
} }
GrSurfaceProxy* srcProxy = src->asSurfaceProxy();
GrSurface* srcSurface = srcProxy->peekSurface(); GrSurface* srcSurface = srcProxy->peekSurface();
if (!GrSurfacePriv::AdjustReadPixelParams(srcSurface->width(), srcSurface->height(), if (!GrSurfacePriv::AdjustReadPixelParams(srcSurface->width(), srcSurface->height(),
@ -451,7 +450,9 @@ bool GrContextPriv::readSurfacePixels(GrSurfaceContext* src, int left, int top,
sk_bzero(buffer, tempPixmap.computeByteSize()); sk_bzero(buffer, tempPixmap.computeByteSize());
} }
this->flush(srcProxy); if (srcSurface->surfacePriv().hasPendingWrite()) {
this->flush(nullptr); // MDB TODO: tighten this
}
if (!fContext->fGpu->readPixels(srcSurface, left, top, width, height, allowedColorType, buffer, if (!fContext->fGpu->readPixels(srcSurface, left, top, width, height, allowedColorType, buffer,
rowBytes)) { rowBytes)) {
@ -492,11 +493,11 @@ bool GrContextPriv::writeSurfacePixels(GrSurfaceContext* dst, int left, int top,
return false; return false;
} }
GrSurfaceProxy* dstProxy = dst->asSurfaceProxy(); if (!dst->asSurfaceProxy()->instantiate(this->resourceProvider(), true)) {
if (!dstProxy->instantiate(this->resourceProvider())) {
return false; return false;
} }
GrSurfaceProxy* dstProxy = dst->asSurfaceProxy();
GrSurface* dstSurface = dstProxy->peekSurface(); GrSurface* dstSurface = dstProxy->peekSurface();
if (!GrSurfacePriv::AdjustWritePixelParams(dstSurface->width(), dstSurface->height(), if (!GrSurfacePriv::AdjustWritePixelParams(dstSurface->width(), dstSurface->height(),
@ -579,13 +580,10 @@ bool GrContextPriv::writeSurfacePixels(GrSurfaceContext* dst, int left, int top,
dst->asRenderTargetContext()->fillRectToRect( dst->asRenderTargetContext()->fillRectToRect(
GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(), GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::MakeXYWH(left, top, width, height), SkRect::MakeWH(width, height)); SkRect::MakeXYWH(left, top, width, height), SkRect::MakeWH(width, height));
return true;
} else { } else {
if (!dst->copy(tempProxy.get(), SkIRect::MakeWH(width, height), {left, top})) { return dst->copy(tempProxy.get(), SkIRect::MakeWH(width, height), {left, top});
return false;
}
} }
return true;
} }
bool convert = premul || needColorConversion; bool convert = premul || needColorConversion;
@ -647,7 +645,9 @@ bool GrContextPriv::writeSurfacePixels(GrSurfaceContext* dst, int left, int top,
top = dstSurface->height() - top - height; top = dstSurface->height() - top - height;
} }
this->flush(dstProxy); if (dstSurface->surfacePriv().hasPendingIO()) {
this->flush(nullptr); // MDB TODO: tighten this
}
return this->getGpu()->writePixels(dstSurface, left, top, width, height, srcColorType, buffer, return this->getGpu()->writePixels(dstSurface, left, top, width, height, srcColorType, buffer,
rowBytes); rowBytes);