[Impeller] disable Vulkan on known bad exynos SoCs. (#163236)
The common theme in: * https://github.com/flutter/flutter/issues/160854 * https://github.com/flutter/flutter/issues/160804 * https://github.com/flutter/flutter/issues/158091 Is that the Samsung exynos chipset has problems with AHB imports. Unfortunately some of the reported bugs are hard crashes/. While I couldn't reproduce the crash itself, it does indicate to me that attempting to feature detect if AHB imports work is probably too risky (and potentially slow, as we'd have to do a read back). While the Vulkan drivers otherwise work, the deivces in question are not able to reliably import AHBs which prevents platform views from working. This may not fix all issues as there could be different SoC models that also have problems. I considered removing 29 support as well, but there are a large number of APi 29 devices that work fine.
This commit is contained in:
parent
539c5b93af
commit
128caa701f
@ -6,6 +6,7 @@
|
||||
|
||||
#include <android/log.h>
|
||||
#include <sys/system_properties.h>
|
||||
#include <cstring>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -48,6 +49,23 @@ namespace {
|
||||
|
||||
fml::jni::ScopedJavaGlobalRef<jclass>* g_flutter_jni_class = nullptr;
|
||||
|
||||
/// These are SoCs that crash when using AHB imports.
|
||||
static constexpr const char* kBLC[] = {
|
||||
// Most Exynos Series SoC
|
||||
"exynos7870", //
|
||||
"exynos7880", //
|
||||
"exynos7872", //
|
||||
"exynos7884", //
|
||||
"exynos7885", //
|
||||
"exynos8890", //
|
||||
"exynos8895", //
|
||||
"exynos7904", //
|
||||
"exynos9609", //
|
||||
"exynos9610", //
|
||||
"exynos9611", //
|
||||
"exynos9810" //
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
FlutterMain::FlutterMain(const flutter::Settings& settings)
|
||||
@ -237,6 +255,18 @@ bool FlutterMain::IsDeviceEmulator(std::string_view product_model) {
|
||||
return std::string(product_model).find("gphone") != std::string::npos;
|
||||
}
|
||||
|
||||
// static
|
||||
bool FlutterMain::IsKnownBadSOC(std::string_view hardware) {
|
||||
// TODO(jonahwilliams): if the list gets too long (> 16), convert
|
||||
// to a hash map first.
|
||||
for (const auto& board : kBLC) {
|
||||
if (strcmp(board, hardware.data()) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// static
|
||||
AndroidRenderingAPI FlutterMain::SelectedRenderingAPI(
|
||||
const flutter::Settings& settings) {
|
||||
@ -280,6 +310,12 @@ AndroidRenderingAPI FlutterMain::SelectedRenderingAPI(
|
||||
return kVulkanUnsupportedFallback;
|
||||
}
|
||||
|
||||
__system_property_get("ro.product.board", product_model);
|
||||
if (IsKnownBadSOC(product_model)) {
|
||||
// Avoid using Vulkan on known bad SoCs.
|
||||
return kVulkanUnsupportedFallback;
|
||||
}
|
||||
|
||||
// Determine if Vulkan is supported by creating a Vulkan context and
|
||||
// checking if it is valid.
|
||||
impeller::ScopedValidationDisable disable_validation;
|
||||
|
@ -28,6 +28,8 @@ class FlutterMain {
|
||||
|
||||
static bool IsDeviceEmulator(std::string_view product_model);
|
||||
|
||||
static bool IsKnownBadSOC(std::string_view hardware);
|
||||
|
||||
private:
|
||||
const flutter::Settings settings_;
|
||||
DartServiceIsolate::CallbackHandle vm_service_uri_callback_ = 0;
|
||||
|
@ -42,5 +42,13 @@ TEST(AndroidPlatformView, FallsBackToGLESonEmulator) {
|
||||
EXPECT_FALSE(FlutterMain::IsDeviceEmulator(device_product));
|
||||
}
|
||||
|
||||
TEST(AndroidPlatformView, FallsBackToGLESonMostExynos) {
|
||||
std::string exynos_board = "exynos7870";
|
||||
std::string snap_board = "smg1234";
|
||||
|
||||
EXPECT_TRUE(FlutterMain::IsKnownBadSOC(exynos_board));
|
||||
EXPECT_FALSE(FlutterMain::IsKnownBadSOC(snap_board));
|
||||
}
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
|
Loading…
x
Reference in New Issue
Block a user