Browse Source

Forcing hardware handling for decode formats on Android

flatopsfixes23485
CamilleLaVey 2 months ago
parent
commit
88555a17be
  1. 9
      src/common/android/id_cache.cpp
  2. 4
      src/common/settings.h

9
src/common/android/id_cache.cpp

@ -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");

4
src/common/settings.h

@ -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

Loading…
Cancel
Save