Make transferability a per-format flag in GrGLCaps

Add workaround for 16 bit unorm on freedreno

Make sure callsites are checking for transfer alignment
of 0 to indicate unsupported.

Bug: skia:11876
Change-Id: Ia1c22a430f675fc57724f220f5dee5b23f325f3c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/421317
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrSurfaceContext.cpp b/src/gpu/GrSurfaceContext.cpp
index 6a6fd2d..c1ad2e8 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/GrSurfaceContext.cpp
@@ -967,7 +967,16 @@
 
     auto texMatrix = SkMatrix::Translate(x, y);
 
-    bool doSynchronousRead = !this->caps()->transferFromSurfaceToBufferSupport();
+    auto [readCT, offsetAlignment] =
+            this->caps()->supportedReadPixelsColorType(yFC->colorInfo().colorType(),
+                                                       yFC->asSurfaceProxy()->backendFormat(),
+                                                       GrColorType::kAlpha_8);
+    if (readCT == GrColorType::kUnknown) {
+        callback(callbackContext, nullptr);
+        return;
+    }
+    bool doSynchronousRead = !this->caps()->transferFromSurfaceToBufferSupport() ||
+                             !offsetAlignment;
     PixelTransferResult yTransfer, uTransfer, vTransfer;
 
     // This matrix generates (r,g,b,a) = (0, 0, 0, y)