Re-add android tex storage disable for ARM only, but add GrContextOption as well.
Bug: chromium:1376457
Change-Id: I85ead46f143e1a76d0e82ee4f9c95d044912bad5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/595397
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h
index 2867529..1645618 100644
--- a/include/gpu/GrContextOptions.h
+++ b/include/gpu/GrContextOptions.h
@@ -273,6 +273,15 @@
*/
bool fAllowMSAAOnNewIntel = false;
+ /**
+ * Currently on ARM Android we disable the use of GL TexStorage because of memory regressions.
+ * However, some clients may still want to use TexStorage. For example, TexStorage support is
+ * required for creating protected textures.
+ *
+ * This flag has no impact on non GL backends.
+ */
+ bool fAlwaysUseTexStorageWhenAvailable = false;
+
#if GR_TEST_UTILS
/**
* Private options that are only meant for testing within Skia's tools.
diff --git a/src/gpu/ganesh/gl/GrGLCaps.cpp b/src/gpu/ganesh/gl/GrGLCaps.cpp
index b35376a..e2129c7 100644
--- a/src/gpu/ganesh/gl/GrGLCaps.cpp
+++ b/src/gpu/ganesh/gl/GrGLCaps.cpp
@@ -1390,6 +1390,10 @@
texStorageSupported = false;
}
+ if (formatWorkarounds.fDisableTexStorage) {
+ texStorageSupported = false;
+ }
+
// ES 2.0 requires that the internal/external formats match so we can't use sized internal
// formats for glTexImage until ES 3.0. TODO: Support sized internal formats in WebGL2.
bool texImageSupportsSizedInternalFormat =
@@ -4366,16 +4370,17 @@
#endif
#ifdef SK_BUILD_FOR_ANDROID
- // We don't usually use glTexStorage() on Android for performance reasons. (crbug.com/945506).
- // On a NVIDIA Shield TV running Android 7.0 creating a texture with glTexImage2D() with
- // internal format GL_LUMINANCE8 fails. However, it succeeds with glTexStorage2D().
+ // crbug.com/945506. Telemetry reported a memory usage regression for Android Go Chrome/WebView
+ // when using glTexStorage2D. This appears to affect OOP-R (so not just over command buffer).
+ // Update 10/2023, it looks like this may just effect chrome Android GO devices which are
+ // running on Mali-T720. It does not seem to impact Qualcomm devices. We have no tests to verify
+ // if newer ARM devices are impacted, so for now we keep this disabled on all ARM by default.
//
- // Additionally, on the Nexus 9 running Android 6.0.1 formats added by GL_EXT_texture_rg and
- // GL_EXT_texture_norm16 cause errors if they are created with glTexImage2D() with
- // an unsized internal format. We wouldn't normally do that but Chrome can limit us
- // artificially to ES2. (crbug.com/1003481)
- if (ctxInfo.vendor() == GrGLVendor::kNVIDIA) {
- formatWorkarounds->fDontDisableTexStorageOnAndroid = true;
+ // We allow the client to pass in a GrContextOption flag to say they prefer having tex storage
+ // support regadless of memory usage impacts. This is important for supporting Protected
+ // textures as they require tex storage support.
+ if (ctxInfo.vendor() == GrGLVendor::kARM && !contextOptions.fAlwaysUseTexStorageWhenAvailable) {
+ formatWorkarounds->fDisableTexStorage = true;
}
#endif
diff --git a/src/gpu/ganesh/gl/GrGLCaps.h b/src/gpu/ganesh/gl/GrGLCaps.h
index 525057a..e5ae996 100644
--- a/src/gpu/ganesh/gl/GrGLCaps.h
+++ b/src/gpu/ganesh/gl/GrGLCaps.h
@@ -515,7 +515,7 @@
bool fDisableRGBA16FTexStorageForCrBug1008003 = false;
bool fDisableBGRATextureStorageForIntelWindowsES = false;
bool fDisableLuminance16F = false;
- bool fDontDisableTexStorageOnAndroid = false;
+ bool fDisableTexStorage = false;
bool fDisallowDirectRG8ReadPixels = false;
bool fDisallowBGRA8ReadPixels = false;
bool fDisallowR8ForPowerVRSGX54x = false;