summaryrefslogtreecommitdiffstats
path: root/src/android/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/android/app')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/model/DriverViewModel.kt5
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GpuDriverHelper.kt7
-rw-r--r--src/android/app/src/main/jni/CMakeLists.txt2
-rw-r--r--src/android/app/src/main/jni/native.cpp34
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() {
fun updateDriverList() {
val selectedDriver = GpuDriverHelper.customDriverSettingData
+ val systemDriverData = GpuDriverHelper.getSystemDriverInfo()
val newDriverList = mutableListOf(
Driver(
selectedDriver == GpuDriverMetadata(),
- YuzuApplication.appContext.getString(R.string.system_gpu_driver)
+ YuzuApplication.appContext.getString(R.string.system_gpu_driver),
+ systemDriverData?.get(0) ?: "",
+ systemDriverData?.get(1) ?: ""
)
)
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 @@
package org.yuzu.yuzu_emu.utils
+import android.graphics.SurfaceTexture
import android.net.Uri
import android.os.Build
+import android.view.Surface
import java.io.File
import java.io.IOException
import org.yuzu.yuzu_emu.NativeLibrary
@@ -195,6 +197,11 @@ object GpuDriverHelper {
external fun supportsCustomDriverLoading(): Boolean
+ external fun getSystemDriverInfo(
+ surface: Surface = Surface(SurfaceTexture(true)),
+ hookLibPath: String = GpuDriverHelper.hookLibPath!!
+ ): Array<String>?
+
// Parse the custom driver metadata to retrieve the name.
val installedCustomDriverData: GpuDriverMetadata
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
set_property(TARGET yuzu-android PROPERTY IMPORTED_LOCATION ${FFmpeg_LIBRARY_DIR})
-target_link_libraries(yuzu-android PRIVATE audio_core common core input_common frontend_common)
+target_link_libraries(yuzu-android PRIVATE audio_core common core input_common frontend_common Vulkan::Headers)
target_link_libraries(yuzu-android PRIVATE android camera2ndk EGL glad jnigraphics log)
if (ARCHITECTURE_arm64)
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 958a77ac7..64627db88 100644
--- a/src/android/app/src/main/jni/native.cpp
+++ b/src/android/app/src/main/jni/native.cpp
@@ -60,6 +60,9 @@
#include "jni/id_cache.h"
#include "jni/native.h"
#include "video_core/renderer_base.h"
+#include "video_core/renderer_vulkan/renderer_vulkan.h"
+#include "video_core/vulkan_common/vulkan_instance.h"
+#include "video_core/vulkan_common/vulkan_surface.h"
#define jconst [[maybe_unused]] const auto
#define jauto [[maybe_unused]] auto
@@ -541,6 +544,37 @@ jboolean JNICALL Java_org_yuzu_yuzu_1emu_utils_GpuDriverHelper_supportsCustomDri
#endif
}
+jobjectArray Java_org_yuzu_yuzu_1emu_utils_GpuDriverHelper_getSystemDriverInfo(
+ JNIEnv* env, jobject j_obj, jobject j_surf, jstring j_hook_lib_dir) {
+ const char* file_redirect_dir_{};
+ int featureFlags{};
+ std::string hook_lib_dir = GetJString(env, j_hook_lib_dir);
+ auto handle = adrenotools_open_libvulkan(RTLD_NOW, featureFlags, nullptr, hook_lib_dir.c_str(),
+ nullptr, nullptr, file_redirect_dir_, nullptr);
+ auto driver_library = std::make_shared<Common::DynamicLibrary>(handle);
+ InputCommon::InputSubsystem input_subsystem;
+ auto m_window = std::make_unique<EmuWindow_Android>(
+ &input_subsystem, ANativeWindow_fromSurface(env, j_surf), driver_library);
+
+ Vulkan::vk::InstanceDispatch dld;
+ Vulkan::vk::Instance vk_instance = Vulkan::CreateInstance(
+ *driver_library, dld, VK_API_VERSION_1_1, Core::Frontend::WindowSystemType::Android);
+
+ auto surface = Vulkan::CreateSurface(vk_instance, m_window->GetWindowInfo());
+
+ auto device = Vulkan::CreateDevice(vk_instance, dld, *surface);
+
+ auto driver_version = device.GetDriverVersion();
+ auto version_string =
+ fmt::format("{}.{}.{}", VK_API_VERSION_MAJOR(driver_version),
+ VK_API_VERSION_MINOR(driver_version), VK_API_VERSION_PATCH(driver_version));
+
+ jobjectArray j_driver_info =
+ env->NewObjectArray(2, IDCache::GetStringClass(), ToJString(env, version_string));
+ env->SetObjectArrayElement(j_driver_info, 1, ToJString(env, device.GetDriverName()));
+ return j_driver_info;
+}
+
jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_reloadKeys(JNIEnv* env, jclass clazz) {
Core::Crypto::KeyManager::Instance().ReloadKeys();
return static_cast<jboolean>(Core::Crypto::KeyManager::Instance().AreKeysLoaded());