Remove GrInternalSurfaceFlags::kNoPendingIO as it is no longer needed

Since explicit allocation is always enabled now, the resource allocator explicitly manages reuse of GrSurfaces and this flag isn't used/needed.

Change-Id: I5703bf4624e21f9aff9da76575f4ef757b1d2589
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210140
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 321fc36..dc417f0 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -498,8 +498,7 @@
         // MDB TODO: We're going to fill this proxy with an ASAP upload (which is out of order wrt
         // to ops), so it can't have any pending IO.
         proxy = proxyProvider->createProxy(format, desc, kTopLeft_GrSurfaceOrigin,
-                                           SkBackingFit::kApprox, SkBudgeted::kYes,
-                                           GrInternalSurfaceFlags::kNoPendingIO);
+                                           SkBackingFit::kApprox, SkBudgeted::kYes);
 
         auto uploader = skstd::make_unique<GrTDeferredProxyUploader<ClipMaskData>>(reducedClip);
         GrTDeferredProxyUploader<ClipMaskData>* uploaderRaw = uploader.get();
diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp
index b3752ca..df55380 100644
--- a/src/gpu/GrDrawOpAtlas.cpp
+++ b/src/gpu/GrDrawOpAtlas.cpp
@@ -531,7 +531,7 @@
 
     for (uint32_t i = 0; i < this->maxPages(); ++i) {
         fProxies[i] = proxyProvider->createProxy(fFormat, desc, kTopLeft_GrSurfaceOrigin,
-                SkBackingFit::kExact, SkBudgeted::kYes, GrInternalSurfaceFlags::kNoPendingIO);
+                                                 SkBackingFit::kExact, SkBudgeted::kYes);
         if (!fProxies[i]) {
             return false;
         }
diff --git a/src/gpu/GrOnFlushResourceProvider.cpp b/src/gpu/GrOnFlushResourceProvider.cpp
index 3f9ba44..f84f2fe 100644
--- a/src/gpu/GrOnFlushResourceProvider.cpp
+++ b/src/gpu/GrOnFlushResourceProvider.cpp
@@ -65,7 +65,6 @@
 
 bool GrOnFlushResourceProvider::instatiateProxy(GrSurfaceProxy* proxy) {
     SkASSERT(proxy->priv().ignoredByResourceAllocator());
-    SkASSERT(proxy->priv().requiresNoPendingIO());
 
     // TODO: this class should probably just get a GrDirectContext
     auto direct = fDrawingMgr->getContext()->priv().asDirectContext();
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 7d641be..95dc735 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -247,7 +247,6 @@
             surfaceFlags |= GrInternalSurfaceFlags::kMixedSampled;
         }
     }
-    surfaceFlags |= GrInternalSurfaceFlags::kNoPendingIO;
 
     GrSurfaceDesc desc;
     desc.fWidth = srcImage->width();
@@ -257,17 +256,13 @@
     desc.fConfig = config;
 
     sk_sp<GrTextureProxy> proxy = this->createLazyProxy(
-            [desc, budgeted, srcImage, fit, surfaceFlags](GrResourceProvider* resourceProvider) {
+            [desc, budgeted, srcImage, fit](GrResourceProvider* resourceProvider) {
                 SkPixmap pixMap;
                 SkAssertResult(srcImage->peekPixels(&pixMap));
                 GrMipLevel mipLevel = { pixMap.addr(), pixMap.rowBytes() };
 
-                auto resourceProviderFlags = GrResourceProvider::Flags::kNone;
-                if (surfaceFlags & GrInternalSurfaceFlags::kNoPendingIO) {
-                    resourceProviderFlags |= GrResourceProvider::Flags::kNoPendingIO;
-                }
                 return LazyInstantiationResult(resourceProvider->createTexture(
-                        desc, budgeted, fit, mipLevel, resourceProviderFlags));
+                        desc, budgeted, fit, mipLevel, GrResourceProvider::Flags::kNoPendingIO));
             },
             format, desc, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo, surfaceFlags, fit, budgeted);
 
@@ -753,7 +748,7 @@
         LazyInstantiateCallback&& callback, const GrBackendFormat& format, Renderable renderable,
         GrSurfaceOrigin origin, GrPixelConfig config, const GrCaps& caps, int sampleCnt) {
     GrSurfaceDesc desc;
-    GrInternalSurfaceFlags surfaceFlags = GrInternalSurfaceFlags::kNoPendingIO;
+    GrInternalSurfaceFlags surfaceFlags = GrInternalSurfaceFlags::kNone;
     if (Renderable::kYes == renderable) {
         desc.fFlags = kRenderTarget_GrSurfaceFlag;
         if (sampleCnt > 1 && caps.usesMixedSamples()) {
diff --git a/src/gpu/GrRenderTargetProxy.cpp b/src/gpu/GrRenderTargetProxy.cpp
index 195ac52..bd453c8 100644
--- a/src/gpu/GrRenderTargetProxy.cpp
+++ b/src/gpu/GrRenderTargetProxy.cpp
@@ -62,15 +62,14 @@
     return this->glRTFBOIDIs0() ? 0 : caps.maxWindowRectangles();
 }
 
-bool GrRenderTargetProxy::instantiate(GrResourceProvider* resourceProvider,
-                                      bool dontForceNoPendingIO) {
+bool GrRenderTargetProxy::instantiate(GrResourceProvider* resourceProvider) {
     if (LazyState::kNot != this->lazyInstantiationState()) {
         return false;
     }
     static constexpr GrSurfaceDescFlags kDescFlags = kRenderTarget_GrSurfaceFlag;
 
     if (!this->instantiateImpl(resourceProvider, fSampleCnt, fNeedsStencil, kDescFlags,
-                               GrMipMapped::kNo, nullptr, dontForceNoPendingIO)) {
+                               GrMipMapped::kNo, nullptr)) {
         return false;
     }
     SkASSERT(fTarget->asRenderTarget());
@@ -82,7 +81,7 @@
     static constexpr GrSurfaceDescFlags kDescFlags = kRenderTarget_GrSurfaceFlag;
 
     sk_sp<GrSurface> surface = this->createSurfaceImpl(resourceProvider, fSampleCnt, fNeedsStencil,
-                                                       kDescFlags, GrMipMapped::kNo, true);
+                                                       kDescFlags, GrMipMapped::kNo);
     if (!surface) {
         return nullptr;
     }
diff --git a/src/gpu/GrResourceAllocator.cpp b/src/gpu/GrResourceAllocator.cpp
index dd18426..c6fa4fc 100644
--- a/src/gpu/GrResourceAllocator.cpp
+++ b/src/gpu/GrResourceAllocator.cpp
@@ -298,8 +298,8 @@
 
     proxy->priv().computeScratchKey(&key);
 
-    auto filter = [&] (const GrSurface* s) {
-        return !proxy->priv().requiresNoPendingIO() || !s->surfacePriv().hasPendingIO();
+    auto filter = [] (const GrSurface* s) {
+        return true;
     };
     sk_sp<GrSurface> surface(fFreePool.findAndRemove(key, filter));
     if (surface) {
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index a6efaab..c522e78 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -107,18 +107,10 @@
         return nullptr;
     }
 
-    // TODO: http://skbug.com/8422: Although this fixes http://skbug.com/8351, it seems like these
-    // should just participate in the normal allocation process and not need the pending IO flag.
-    auto surfaceFlags = GrInternalSurfaceFlags::kNone;
-    if (!context->priv().proxyProvider()->renderingDirectly()) {
-        // In DDL mode, this texture proxy will be instantiated at flush time, therfore it cannot
-        // have pending IO.
-        surfaceFlags |= GrInternalSurfaceFlags::kNoPendingIO;
-    }
     auto clearFlag = kNone_GrSurfaceFlags;
     if (context->priv().caps()->shouldInitializeTextures() && fit == SkBackingFit::kApprox) {
         clearFlag = kPerformInitialClear_GrSurfaceFlag;
     }
     return context->priv().proxyProvider()->createTextureProxy(
-            std::move(img), clearFlag, 1, SkBudgeted::kYes, fit, surfaceFlags);
+            std::move(img), clearFlag, 1, SkBudgeted::kYes, fit);
 }
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index f0f33ad..8ee9b6f 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -187,10 +187,8 @@
     const GrBackendFormat format =
             context->priv().caps()->getBackendFormatFromColorType(kAlpha_8_SkColorType);
 
-    // MDB TODO: We're going to fill this proxy with an ASAP upload (which is out of order wrt to
-    // ops), so it can't have any pending IO.
-    return proxyProvider->createProxy(format, desc, kTopLeft_GrSurfaceOrigin, fit, SkBudgeted::kYes,
-                                      GrInternalSurfaceFlags::kNoPendingIO);
+    return proxyProvider->createProxy(format, desc, kTopLeft_GrSurfaceOrigin, fit,
+                                      SkBudgeted::kYes);
 }
 
 namespace {
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index 8a94797..f459e02 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -127,8 +127,7 @@
 sk_sp<GrSurface> GrSurfaceProxy::createSurfaceImpl(GrResourceProvider* resourceProvider,
                                                    int sampleCnt, bool needsStencil,
                                                    GrSurfaceDescFlags descFlags,
-                                                   GrMipMapped mipMapped,
-                                                   bool forceNoPendingIO) const {
+                                                   GrMipMapped mipMapped) const {
     SkASSERT(GrSurfaceProxy::LazyState::kNot == this->lazyInstantiationState());
     SkASSERT(!fTarget);
     GrSurfaceDesc desc;
@@ -141,12 +140,9 @@
     desc.fConfig = fConfig;
     desc.fSampleCnt = sampleCnt;
 
-    GrResourceProvider::Flags resourceProviderFlags = GrResourceProvider::Flags::kNone;
-    if ((fSurfaceFlags & GrInternalSurfaceFlags::kNoPendingIO) || forceNoPendingIO) {
-        // The explicit resource allocator requires that any resources it pulls out of the
-        // cache have no pending IO.
-        resourceProviderFlags = GrResourceProvider::Flags::kNoPendingIO;
-    }
+    // The explicit resource allocator requires that any resources it pulls out of the
+    // cache have no pending IO.
+    GrResourceProvider::Flags resourceProviderFlags = GrResourceProvider::Flags::kNoPendingIO;
 
     sk_sp<GrSurface> surface;
     if (GrMipMapped::kYes == mipMapped) {
@@ -228,8 +224,7 @@
 
 bool GrSurfaceProxy::instantiateImpl(GrResourceProvider* resourceProvider, int sampleCnt,
                                      bool needsStencil, GrSurfaceDescFlags descFlags,
-                                     GrMipMapped mipMapped, const GrUniqueKey* uniqueKey,
-                                     bool dontForceNoPendingIO) {
+                                     GrMipMapped mipMapped, const GrUniqueKey* uniqueKey) {
     SkASSERT(LazyState::kNot == this->lazyInstantiationState());
     if (fTarget) {
         if (uniqueKey && uniqueKey->isValid()) {
@@ -239,7 +234,7 @@
     }
 
     sk_sp<GrSurface> surface = this->createSurfaceImpl(resourceProvider, sampleCnt, needsStencil,
-                                                       descFlags, mipMapped, !dontForceNoPendingIO);
+                                                       descFlags, mipMapped);
     if (!surface) {
         return false;
     }
@@ -499,11 +494,6 @@
 void GrSurfaceProxy::validateSurface(const GrSurface* surface) {
     SkASSERT(surface->config() == fConfig);
 
-    // Assert the flags are the same except for kNoPendingIO which is not passed onto the GrSurface.
-    GrInternalSurfaceFlags proxyFlags = fSurfaceFlags & ~GrInternalSurfaceFlags::kNoPendingIO;
-    GrInternalSurfaceFlags surfaceFlags = surface->surfacePriv().flags();
-    SkASSERT((proxyFlags & GrInternalSurfaceFlags::kSurfaceMask) ==
-             (surfaceFlags & GrInternalSurfaceFlags::kSurfaceMask));
     this->onValidateSurface(surface);
 }
 #endif
diff --git a/src/gpu/GrSurfaceProxyPriv.h b/src/gpu/GrSurfaceProxyPriv.h
index 7307083..2b89376 100644
--- a/src/gpu/GrSurfaceProxyPriv.h
+++ b/src/gpu/GrSurfaceProxyPriv.h
@@ -36,10 +36,6 @@
     // Assign this proxy the provided GrSurface as its backing surface
     void assign(sk_sp<GrSurface> surface) { fProxy->assign(std::move(surface)); }
 
-    bool requiresNoPendingIO() const {
-        return fProxy->fSurfaceFlags & GrInternalSurfaceFlags::kNoPendingIO;
-    }
-
     // Don't abuse this call!!!!!!!
     bool isExact() const { return SkBackingFit::kExact == fProxy->fFit; }
 
diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp
index dea0ac9..e0c0b47 100644
--- a/src/gpu/GrTextureProxy.cpp
+++ b/src/gpu/GrTextureProxy.cpp
@@ -76,15 +76,13 @@
     }
 }
 
-bool GrTextureProxy::instantiate(GrResourceProvider* resourceProvider,
-                                 bool dontForceNoPendingIO) {
+bool GrTextureProxy::instantiate(GrResourceProvider* resourceProvider) {
     if (LazyState::kNot != this->lazyInstantiationState()) {
         return false;
     }
     if (!this->instantiateImpl(resourceProvider, 1, /* needsStencil = */ false,
                                kNone_GrSurfaceFlags, fMipMapped,
-                               fUniqueKey.isValid() ? &fUniqueKey : nullptr,
-                               dontForceNoPendingIO)) {
+                               fUniqueKey.isValid() ? &fUniqueKey : nullptr)) {
         return false;
     }
 
@@ -97,7 +95,7 @@
     sk_sp<GrSurface> surface = this->createSurfaceImpl(resourceProvider, 1,
                                                        /* needsStencil = */ false,
                                                        kNone_GrSurfaceFlags,
-                                                       fMipMapped, true);
+                                                       fMipMapped);
     if (!surface) {
         return nullptr;
     }
diff --git a/src/gpu/GrTextureRenderTargetProxy.cpp b/src/gpu/GrTextureRenderTargetProxy.cpp
index b717cce..7bf9002 100644
--- a/src/gpu/GrTextureRenderTargetProxy.cpp
+++ b/src/gpu/GrTextureRenderTargetProxy.cpp
@@ -75,8 +75,7 @@
                                   !this->priv().isExact());
 }
 
-bool GrTextureRenderTargetProxy::instantiate(GrResourceProvider* resourceProvider,
-                                             bool dontForceNoPendingIO) {
+bool GrTextureRenderTargetProxy::instantiate(GrResourceProvider* resourceProvider) {
     if (LazyState::kNot != this->lazyInstantiationState()) {
         return false;
     }
@@ -85,8 +84,7 @@
     const GrUniqueKey& key = this->getUniqueKey();
 
     if (!this->instantiateImpl(resourceProvider, this->numStencilSamples(), this->needsStencil(),
-                               kDescFlags, this->mipMapped(), key.isValid() ? &key : nullptr,
-                               dontForceNoPendingIO)) {
+                               kDescFlags, this->mipMapped(), key.isValid() ? &key : nullptr)) {
         return false;
     }
     if (key.isValid()) {
@@ -105,7 +103,7 @@
 
     sk_sp<GrSurface> surface = this->createSurfaceImpl(resourceProvider, this->numStencilSamples(),
                                                        this->needsStencil(), kDescFlags,
-                                                       this->mipMapped(), true);
+                                                       this->mipMapped());
     if (!surface) {
         return nullptr;
     }
diff --git a/src/gpu/GrTextureRenderTargetProxy.h b/src/gpu/GrTextureRenderTargetProxy.h
index 87b9c91..852309b 100644
--- a/src/gpu/GrTextureRenderTargetProxy.h
+++ b/src/gpu/GrTextureRenderTargetProxy.h
@@ -40,7 +40,7 @@
     // Wrapped version
     GrTextureRenderTargetProxy(sk_sp<GrSurface>, GrSurfaceOrigin);
 
-    bool instantiate(GrResourceProvider*, bool dontForceNoPendingIO = false) override;
+    bool instantiate(GrResourceProvider*) override;
     sk_sp<GrSurface> createSurface(GrResourceProvider*) const override;
 
     size_t onUninstantiatedGpuMemorySize() const override;