diff options
Diffstat (limited to 'src')
4 files changed, 46 insertions, 2 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/DriverViewModel.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/DriverViewModel.kt index 5ed754c96..a49c887a1 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/DriverViewModel.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/DriverViewModel.kt | |||
| @@ -66,10 +66,13 @@ class DriverViewModel : ViewModel() { | |||
| 66 | 66 | ||
| 67 | fun updateDriverList() { | 67 | fun updateDriverList() { |
| 68 | val selectedDriver = GpuDriverHelper.customDriverSettingData | 68 | val selectedDriver = GpuDriverHelper.customDriverSettingData |
| 69 | val systemDriverData = GpuDriverHelper.getSystemDriverInfo() | ||
| 69 | val newDriverList = mutableListOf( | 70 | val newDriverList = mutableListOf( |
| 70 | Driver( | 71 | Driver( |
| 71 | selectedDriver == GpuDriverMetadata(), | 72 | selectedDriver == GpuDriverMetadata(), |
| 72 | YuzuApplication.appContext.getString(R.string.system_gpu_driver) | 73 | YuzuApplication.appContext.getString(R.string.system_gpu_driver), |
| 74 | systemDriverData?.get(0) ?: "", | ||
| 75 | systemDriverData?.get(1) ?: "" | ||
| 73 | ) | 76 | ) |
| 74 | ) | 77 | ) |
| 75 | driverData.forEach { | 78 | driverData.forEach { |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GpuDriverHelper.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GpuDriverHelper.kt index 81212cbee..a72dea8f1 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GpuDriverHelper.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GpuDriverHelper.kt | |||
| @@ -3,8 +3,10 @@ | |||
| 3 | 3 | ||
| 4 | package org.yuzu.yuzu_emu.utils | 4 | package org.yuzu.yuzu_emu.utils |
| 5 | 5 | ||
| 6 | import android.graphics.SurfaceTexture | ||
| 6 | import android.net.Uri | 7 | import android.net.Uri |
| 7 | import android.os.Build | 8 | import android.os.Build |
| 9 | import android.view.Surface | ||
| 8 | import java.io.File | 10 | import java.io.File |
| 9 | import java.io.IOException | 11 | import java.io.IOException |
| 10 | import org.yuzu.yuzu_emu.NativeLibrary | 12 | import org.yuzu.yuzu_emu.NativeLibrary |
| @@ -195,6 +197,11 @@ object GpuDriverHelper { | |||
| 195 | 197 | ||
| 196 | external fun supportsCustomDriverLoading(): Boolean | 198 | external fun supportsCustomDriverLoading(): Boolean |
| 197 | 199 | ||
| 200 | external fun getSystemDriverInfo( | ||
| 201 | surface: Surface = Surface(SurfaceTexture(true)), | ||
| 202 | hookLibPath: String = GpuDriverHelper.hookLibPath!! | ||
| 203 | ): Array<String>? | ||
| 204 | |||
| 198 | // Parse the custom driver metadata to retrieve the name. | 205 | // Parse the custom driver metadata to retrieve the name. |
| 199 | val installedCustomDriverData: GpuDriverMetadata | 206 | val installedCustomDriverData: GpuDriverMetadata |
| 200 | get() = GpuDriverMetadata(File(driverInstallationPath + META_JSON_FILENAME)) | 207 | get() = GpuDriverMetadata(File(driverInstallationPath + META_JSON_FILENAME)) |
diff --git a/src/android/app/src/main/jni/CMakeLists.txt b/src/android/app/src/main/jni/CMakeLists.txt index 2acc93da8..abc6055ab 100644 --- a/src/android/app/src/main/jni/CMakeLists.txt +++ b/src/android/app/src/main/jni/CMakeLists.txt | |||
| @@ -22,7 +22,7 @@ add_library(yuzu-android SHARED | |||
| 22 | 22 | ||
| 23 | set_property(TARGET yuzu-android PROPERTY IMPORTED_LOCATION ${FFmpeg_LIBRARY_DIR}) | 23 | set_property(TARGET yuzu-android PROPERTY IMPORTED_LOCATION ${FFmpeg_LIBRARY_DIR}) |
| 24 | 24 | ||
| 25 | target_link_libraries(yuzu-android PRIVATE audio_core common core input_common frontend_common) | 25 | target_link_libraries(yuzu-android PRIVATE audio_core common core input_common frontend_common Vulkan::Headers) |
| 26 | target_link_libraries(yuzu-android PRIVATE android camera2ndk EGL glad jnigraphics log) | 26 | target_link_libraries(yuzu-android PRIVATE android camera2ndk EGL glad jnigraphics log) |
| 27 | if (ARCHITECTURE_arm64) | 27 | if (ARCHITECTURE_arm64) |
| 28 | target_link_libraries(yuzu-android PRIVATE adrenotools) | 28 | target_link_libraries(yuzu-android PRIVATE adrenotools) |
diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index 3fd9a500c..28edac41c 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp | |||
| @@ -60,6 +60,9 @@ | |||
| 60 | #include "jni/id_cache.h" | 60 | #include "jni/id_cache.h" |
| 61 | #include "jni/native.h" | 61 | #include "jni/native.h" |
| 62 | #include "video_core/renderer_base.h" | 62 | #include "video_core/renderer_base.h" |
| 63 | #include "video_core/renderer_vulkan/renderer_vulkan.h" | ||
| 64 | #include "video_core/vulkan_common/vulkan_instance.h" | ||
| 65 | #include "video_core/vulkan_common/vulkan_surface.h" | ||
| 63 | 66 | ||
| 64 | #define jconst [[maybe_unused]] const auto | 67 | #define jconst [[maybe_unused]] const auto |
| 65 | #define jauto [[maybe_unused]] auto | 68 | #define jauto [[maybe_unused]] auto |
| @@ -521,6 +524,37 @@ jboolean JNICALL Java_org_yuzu_yuzu_1emu_utils_GpuDriverHelper_supportsCustomDri | |||
| 521 | #endif | 524 | #endif |
| 522 | } | 525 | } |
| 523 | 526 | ||
| 527 | jobjectArray Java_org_yuzu_yuzu_1emu_utils_GpuDriverHelper_getSystemDriverInfo( | ||
| 528 | JNIEnv* env, jobject j_obj, jobject j_surf, jstring j_hook_lib_dir) { | ||
| 529 | const char* file_redirect_dir_{}; | ||
| 530 | int featureFlags{}; | ||
| 531 | std::string hook_lib_dir = GetJString(env, j_hook_lib_dir); | ||
| 532 | auto handle = adrenotools_open_libvulkan(RTLD_NOW, featureFlags, nullptr, hook_lib_dir.c_str(), | ||
| 533 | nullptr, nullptr, file_redirect_dir_, nullptr); | ||
| 534 | auto driver_library = std::make_shared<Common::DynamicLibrary>(handle); | ||
| 535 | InputCommon::InputSubsystem input_subsystem; | ||
| 536 | auto m_window = std::make_unique<EmuWindow_Android>( | ||
| 537 | &input_subsystem, ANativeWindow_fromSurface(env, j_surf), driver_library); | ||
| 538 | |||
| 539 | Vulkan::vk::InstanceDispatch dld; | ||
| 540 | Vulkan::vk::Instance vk_instance = Vulkan::CreateInstance( | ||
| 541 | *driver_library, dld, VK_API_VERSION_1_1, Core::Frontend::WindowSystemType::Android); | ||
| 542 | |||
| 543 | auto surface = Vulkan::CreateSurface(vk_instance, m_window->GetWindowInfo()); | ||
| 544 | |||
| 545 | auto device = Vulkan::CreateDevice(vk_instance, dld, *surface); | ||
| 546 | |||
| 547 | auto driver_version = device.GetDriverVersion(); | ||
| 548 | auto version_string = | ||
| 549 | fmt::format("{}.{}.{}", VK_API_VERSION_MAJOR(driver_version), | ||
| 550 | VK_API_VERSION_MINOR(driver_version), VK_API_VERSION_PATCH(driver_version)); | ||
| 551 | |||
| 552 | jobjectArray j_driver_info = | ||
| 553 | env->NewObjectArray(2, IDCache::GetStringClass(), ToJString(env, version_string)); | ||
| 554 | env->SetObjectArrayElement(j_driver_info, 1, ToJString(env, device.GetDriverName())); | ||
| 555 | return j_driver_info; | ||
| 556 | } | ||
| 557 | |||
| 524 | jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_reloadKeys(JNIEnv* env, jclass clazz) { | 558 | jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_reloadKeys(JNIEnv* env, jclass clazz) { |
| 525 | Core::Crypto::KeyManager::Instance().ReloadKeys(); | 559 | Core::Crypto::KeyManager::Instance().ReloadKeys(); |
| 526 | return static_cast<jboolean>(Core::Crypto::KeyManager::Instance().AreKeysLoaded()); | 560 | return static_cast<jboolean>(Core::Crypto::KeyManager::Instance().AreKeysLoaded()); |