Change flushing policy in GrContextPriv::writeSurfacePixels

Together with the following Chrome-side CL, this patch fixes Skia's flushing behavior for platforms that prefer flushes over VRAM use (i.e., ANGLE) and for platforms that don't (e.g., Android).

https://chromium-review.googlesource.com/c/chromium/src/+/1582181 (Remove additional FlushSkia in CanvasResourceProvider::WritePixels)

Here are the perf numbers on Android and Windows for the putImageData performance test:

                              Android (Nexus 5x)   Windows (i.e., ANGLE)
Current Chrome                        112.9             512.1
Chrome w/ 1582181                     131.9             334.8
Chrome w/ 1582181 and this CL         133.6             589.4

So, after both CLs have landed, Android will be faster while Windows will, roughly, remain the same.

Note, on ChromiumPerf the swing for the Nexus 5x is from 126.8 to 153.6 (so, a larger delta than I'm seeing here).

Bug: 942538, 953720
Change-Id: Iead6388e7a378240f87363e9a342d36a63f4c7f8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210062
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
1 file changed