From d64db52438650f0711042683d156adfc36c8be3a Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Thu, 13 Mar 2025 18:27:29 -0700 Subject: [PATCH] [Impeller] Enable mediatek on API 34+. (#165156) Most of the reported Mediatek issues are API 29/30, maybe up to 31. By 34 it should work, and the mokey device we have works fine with Vulkan and runs on CI. This is necessary to allow MediaTek devices to use HCPP without us having to write a new rendering surface abstraction for GL. This does _not_ enable PowerVR, which is still denylisted in the vulkan backend. --- engine/src/flutter/shell/platform/android/flutter_main.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/shell/platform/android/flutter_main.cc b/engine/src/flutter/shell/platform/android/flutter_main.cc index 8d724b934f0..6fcb6973fa8 100644 --- a/engine/src/flutter/shell/platform/android/flutter_main.cc +++ b/engine/src/flutter/shell/platform/android/flutter_main.cc @@ -32,6 +32,7 @@ namespace flutter { constexpr int kMinimumAndroidApiLevelForImpeller = 29; +constexpr int kMinimumAndroidApiLevelForMediaTekVulkan = 34; extern "C" { #if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG @@ -324,8 +325,10 @@ AndroidRenderingAPI FlutterMain::SelectedRenderingAPI( return kVulkanUnsupportedFallback; } - if (__system_property_find("ro.vendor.mediatek.platform") != nullptr) { - // Probably MediaTek. Avoid Vulkan. + if (api_level < kMinimumAndroidApiLevelForMediaTekVulkan && + __system_property_find("ro.vendor.mediatek.platform") != nullptr) { + // Probably MediaTek. Avoid Vulkan if older than 34 to work around + // crashes when importing AHB. return kVulkanUnsupportedFallback; }