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

+1 -25
View File
@@ -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()));
});
}
+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);
+4
View File
@@ -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 {
+1 -1
View File
@@ -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