Forcing hardware handling for decode formats on Android

This commit is contained in:
CamilleLaVey 2025-11-06 15:55:10 -04:00
parent 9600f99b1a
commit 88555a17be
2 changed files with 12 additions and 1 deletions

View file

@ -10,6 +10,8 @@
#include "video_core/rasterizer_interface.h"
#include "common/android/multiplayer/multiplayer.h"
#include <network/network.h>
#include "common/settings.h"
#include "common/logging/log.h"
static JavaVM *s_java_vm;
@ -524,6 +526,13 @@ namespace Common::Android {
s_patch_title_id_field = env->GetFieldID(patch_class, "titleId", "Ljava/lang/String;");
env->DeleteLocalRef(patch_class);
// Prefer hardware decoding on Android by default, forcing this setting will
// make the native side attempt GPU decoding first. If the platform lacks a usable
// FFmpeg HW device, FFmpeg will fall back to CPU automatically.
Settings::values.nvdec_emulation.SetValue(Settings::NvdecEmulation::Gpu);
LOG_INFO(HW_GPU, "Android JNI_OnLoad: forced nvdec_emulation = GPU");
const jclass double_class = env->FindClass("java/lang/Double");
s_double_class = reinterpret_cast<jclass>(env->NewGlobalRef(double_class));
s_double_constructor = env->GetMethodID(double_class, "<init>", "(D)V");

View file

@ -349,7 +349,9 @@ struct Values {
linkage, true, "use_asynchronous_gpu_emulation", Category::Renderer};
SwitchableSetting<AstcDecodeMode, true> accelerate_astc{linkage,
#ifdef ANDROID
AstcDecodeMode::Cpu,
// Most modern Android devices have native ASTC support
// and benefit from GPU decoding. Default to GPU there.
AstcDecodeMode::Gpu,
#else
AstcDecodeMode::Gpu,
#endif