Make prepareSurfaceForExternalIO always flush

This probably isn't a huge change from current behavior but, short-term, could introduce some additional flushes.

The long-term plan is to update the drawing manager to perform partial flushes (i.e., flush only the portion of the DAG required for the target proxy) at which point performance should actually be better than the current situation (in which the entire DAG is flushed if there is any pendingIO on the target proxy).

Change-Id: I3270474344c7f982f97cf5087b2c85691bdc31d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205000
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 93bdf67..bf17d6c 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -481,19 +481,13 @@
         return GrSemaphoresSubmitted::kNo; // Can't flush while DDL recording
     }
 
-    auto resourceProvider = direct->priv().resourceProvider();
-
-    GrSemaphoresSubmitted result = GrSemaphoresSubmitted::kNo;
-    if (proxy->priv().hasPendingIO() || numSemaphores ||
-        SkToBool(flags & SkSurface::kSyncCpu_FlushFlag)) {
-        result = this->flush(proxy, access, flags, numSemaphores, backendSemaphores);
-        if (!proxy->isInstantiated()) {
-            return result;
-        }
-    } else {
-        if (!proxy->instantiate(resourceProvider)) {
-            return result;
-        }
+    // TODO: It is important to upgrade the drawingmanager to just flushing the
+    // portion of the DAG required by 'proxy' in order to restore some of the
+    // semantics of this method.
+    GrSemaphoresSubmitted result = this->flush(proxy, access, flags, numSemaphores,
+                                               backendSemaphores);
+    if (!proxy->isInstantiated()) {
+        return result;
     }
 
     GrSurface* surface = proxy->peekSurface();