Android: Allow custom Vulkan drivers on Mali too

Custom drivers that target Mali's kbase kernel interface exist now, and
AdrenoTools can load them the same way it loads Turnip. Offer the driver
manager when /dev/mali0 exists, not just /dev/kgsl-3d0, like Dolphin does
(dolphin-emu/dolphin#14958).

The manager is now called "Custom driver manager", and the Turnip flags
are only shown on Adreno.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-31 16:44:27 +01:00
1 parent 840e2e3dc8
commit 60b053d7be
4 files changed
+45 -32

No files matched your search

+39 -6
View File
@@ -20,6 +20,31 @@
#include "UI/OnScreenDisplay.h"
#include "UI/MiscScreens.h"
#if PPSSPP_PLATFORM(ANDROID)
#include <unistd.h>
#include <android/api-level.h>
// 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);