diff --git a/UI/DeveloperSettingsPages.cpp b/UI/DeveloperSettingsPages.cpp index 424f20a920..a41d51d472 100644 --- a/UI/DeveloperSettingsPages.cpp +++ b/UI/DeveloperSettingsPages.cpp @@ -51,30 +51,6 @@ #include "UI/MiscViews.h" #include "UI/SettingsPage.h" -#if PPSSPP_PLATFORM(ANDROID) - -static bool CheckKgslPresent() { - constexpr auto KgslPath{ "/dev/kgsl-3d0" }; - - return access(KgslPath, F_OK) == 0; -} - -static bool SupportsCustomDriver() { - return android_get_device_api_level() >= 28 && CheckKgslPresent(); -} - -#else - -static bool SupportsCustomDriver() { -#ifdef _DEBUG - return false; // change to true to debug driver installation on other platforms. DO NOT commit as true. -#else - return false; -#endif -} - -#endif - static std::string PostShaderTranslateName(std::string_view value) { const ShaderInfo *info = GetPostShaderInfo(value); if (info) { @@ -539,7 +515,7 @@ static void BuildGraphicsPage(SettingsPage *page) { } if (GetGPUBackend() == GPUBackend::VULKAN && SupportsCustomDriver()) { - page->Choice({ I18NCat::GRAPHICS, "AdrenoTools driver manager" }).OpensScreen().OnClick([host](UI::EventParams &e) { + page->Choice({ I18NCat::GRAPHICS, "Custom driver manager" }).OpensScreen().OnClick([host](UI::EventParams &e) { host->PageScreenManager()->push(new DriverManagerScreen(host->PageGamePath())); }); } diff --git a/UI/DriverManagerScreen.cpp b/UI/DriverManagerScreen.cpp index 91007188c0..bec893ce5b 100644 --- a/UI/DriverManagerScreen.cpp +++ b/UI/DriverManagerScreen.cpp @@ -20,6 +20,31 @@ #include "UI/OnScreenDisplay.h" #include "UI/MiscScreens.h" +#if PPSSPP_PLATFORM(ANDROID) +#include +#include + +// Adreno +static bool CheckKgslPresent() { + return access("/dev/kgsl-3d0", F_OK) == 0; +} + +// Mali +static bool CheckKbasePresent() { + return access("/dev/mali0", F_OK) == 0; +} +#endif + +bool SupportsCustomDriver() { +#if PPSSPP_PLATFORM(ANDROID) + return android_get_device_api_level() >= 28 && (CheckKgslPresent() || CheckKbasePresent()); +#elif defined(_DEBUG) + return false; // change to true to debug driver installation on other platforms. DO NOT commit as true. +#else + return false; +#endif +} + static Path GetDriverPath() { if (g_Config.internalDataDirectory.empty()) { Path curDir = File::GetCurDirectory(); @@ -168,17 +193,25 @@ void DriverManagerScreen::CreateDriverTab(UI::ViewGroup *drivers) { ChoiceGroupList *groups = drivers->Add(new ChoiceGroupList()); - ChoiceGroup *driverManagerGroup = groups->Add(new ChoiceGroup(gr->T("AdrenoTools driver manager"))); + ChoiceGroup *driverManagerGroup = groups->Add(new ChoiceGroup(gr->T("Custom driver manager"))); auto customDriverInstallChoice = driverManagerGroup->Add(new Choice(gr->T("Install custom driver..."))); driverManagerGroup->Add(new Choice(di->T("More info")))->OnClick.Add([=](UI::EventParams &e) { System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/docs/reference/custom-drivers/"); }); - ChoiceGroup *adrenoEnvVarGroup = groups->Add(new ChoiceGroup(gr->T("Turnip driver flags"))); - int count = 0; - const AdrenoEnvVarDef *adrenoEnvVarDefs = GetAdrenoEnvVarDefs(&count); - for (int i = 0; i < count; i++) { - adrenoEnvVarGroup->Add(new BitCheckBox(&g_Config.iAdrenoEnvVars, (int)adrenoEnvVarDefs[i].var, adrenoEnvVarDefs[i].name)); + // Turnip is Adreno-only. Keep the flags visible off Android, for debugging the screen. +#if PPSSPP_PLATFORM(ANDROID) + const bool showTurnipFlags = CheckKgslPresent(); +#else + const bool showTurnipFlags = true; +#endif + if (showTurnipFlags) { + ChoiceGroup *adrenoEnvVarGroup = groups->Add(new ChoiceGroup(gr->T("Turnip driver flags"))); + int count = 0; + const AdrenoEnvVarDef *adrenoEnvVarDefs = GetAdrenoEnvVarDefs(&count); + for (int i = 0; i < count; i++) { + adrenoEnvVarGroup->Add(new BitCheckBox(&g_Config.iAdrenoEnvVars, (int)adrenoEnvVarDefs[i].var, adrenoEnvVarDefs[i].name)); + } } customDriverInstallChoice->OnClick.Handle(this, &DriverManagerScreen::OnCustomDriverInstall); diff --git a/UI/DriverManagerScreen.h b/UI/DriverManagerScreen.h index 5efb5c6583..ba8731e924 100644 --- a/UI/DriverManagerScreen.h +++ b/UI/DriverManagerScreen.h @@ -6,6 +6,10 @@ #include "UI/BaseScreens.h" #include "UI/TabbedDialogScreen.h" +// Whether custom Vulkan drivers can be loaded through AdrenoTools. Works on Adreno (KGSL) +// and on Mali (kbase), for drivers that target those kernel interfaces. +bool SupportsCustomDriver(); + // Per-game settings screen - enables you to configure graphic options, control options, etc // per game. class DriverManagerScreen : public UITabbedBaseDialogScreen { diff --git a/assets/lang/en_US.ini b/assets/lang/en_US.ini index d5959bdcdf..f3cc476359 100644 --- a/assets/lang/en_US.ini +++ b/assets/lang/en_US.ini @@ -791,7 +791,6 @@ Watch video = Watch video 10x PSP = 10× PSP 16x = 16× Add postprocessing shader = Add postprocessing shader -AdrenoTools driver manager = AdrenoTools driver manager Aggressive = Aggressive Allow exclusive fullscreen = Allow exclusive fullscreen Alternative Speed = Alternative speed (in %, 0 = unlimited) @@ -815,6 +814,7 @@ Buffer graphics commands = Buffer graphics commands Copy to texture = Copy to texture CPU texture upscaler (slow) = Upscale type Current GPU driver = Current GPU driver +Custom driver manager = Custom driver manager Default = Default Default GPU driver = Default GPU driver Disable culling = Disable culling