diff options
| author | 2023-03-16 11:56:51 -0400 | |
|---|---|---|
| committer | 2023-06-03 00:05:43 -0700 | |
| commit | 616cf70a801ccf7c2312118d163185a8d341e517 (patch) | |
| tree | 063170927625dfda9151bf20a5f2d44da6fc51b7 | |
| parent | android: Use Skyline's document provider (diff) | |
| download | yuzu-616cf70a801ccf7c2312118d163185a8d341e517.tar.gz yuzu-616cf70a801ccf7c2312118d163185a8d341e517.tar.xz yuzu-616cf70a801ccf7c2312118d163185a8d341e517.zip | |
build: only enable adrenotools on arm64
| -rw-r--r-- | CMakeLists.txt | 16 | ||||
| -rw-r--r-- | externals/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/android/app/build.gradle | 5 | ||||
| -rw-r--r-- | src/android/app/src/main/jni/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | src/android/app/src/main/jni/native.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_turbo_mode.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_library.cpp | 2 |
9 files changed, 33 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d25cc3a9..1771b063c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -106,12 +106,20 @@ endif() | |||
| 106 | 106 | ||
| 107 | if (YUZU_USE_BUNDLED_VCPKG) | 107 | if (YUZU_USE_BUNDLED_VCPKG) |
| 108 | if (ANDROID) | 108 | if (ANDROID) |
| 109 | set(VCPKG_TARGET_TRIPLET "arm64-android") | ||
| 110 | set(ENV{ANDROID_NDK_HOME} "${ANDROID_NDK}") | 109 | set(ENV{ANDROID_NDK_HOME} "${ANDROID_NDK}") |
| 111 | # this is to avoid CMake using the host pkg-config to find the host | ||
| 112 | # libraries when building for Android targets | ||
| 113 | set(PKG_CONFIG_EXECUTABLE "aarch64-none-linux-android-pkg-config" CACHE FILEPATH "" FORCE) | ||
| 114 | list(APPEND VCPKG_MANIFEST_FEATURES "android") | 110 | list(APPEND VCPKG_MANIFEST_FEATURES "android") |
| 111 | |||
| 112 | if (CMAKE_ANDROID_ARCH_ABI STREQUAL "arm64-v8a") | ||
| 113 | set(VCPKG_TARGET_TRIPLET "arm64-android") | ||
| 114 | # this is to avoid CMake using the host pkg-config to find the host | ||
| 115 | # libraries when building for Android targets | ||
| 116 | set(PKG_CONFIG_EXECUTABLE "aarch64-none-linux-android-pkg-config" CACHE FILEPATH "" FORCE) | ||
| 117 | elseif (CMAKE_ANDROID_ARCH_ABI STREQUAL "x86_64") | ||
| 118 | set(VCPKG_TARGET_TRIPLET "x64-android") | ||
| 119 | set(PKG_CONFIG_EXECUTABLE "x86_64-none-linux-android-pkg-config" CACHE FILEPATH "" FORCE) | ||
| 120 | else() | ||
| 121 | message(FATAL_ERROR "Unsupported Android architecture ${CMAKE_ANDROID_ARCH_ABI}") | ||
| 122 | endif() | ||
| 115 | endif() | 123 | endif() |
| 116 | 124 | ||
| 117 | if (YUZU_TESTS) | 125 | if (YUZU_TESTS) |
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 2bd7b457a..500eb21e3 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt | |||
| @@ -149,5 +149,7 @@ add_library(stb stb/stb_dxt.cpp) | |||
| 149 | target_include_directories(stb PUBLIC ./stb) | 149 | target_include_directories(stb PUBLIC ./stb) |
| 150 | 150 | ||
| 151 | if (ANDROID) | 151 | if (ANDROID) |
| 152 | add_subdirectory(libadrenotools) | 152 | if (ARCHITECTURE_arm64) |
| 153 | add_subdirectory(libadrenotools) | ||
| 154 | endif() | ||
| 153 | endif() | 155 | endif() |
diff --git a/src/android/app/build.gradle b/src/android/app/build.gradle index 8b621f5d5..7e2717b11 100644 --- a/src/android/app/build.gradle +++ b/src/android/app/build.gradle | |||
| @@ -10,7 +10,6 @@ plugins { | |||
| 10 | */ | 10 | */ |
| 11 | def autoVersion = (int) (((new Date().getTime() / 1000) - 1451606400) / 10) | 11 | def autoVersion = (int) (((new Date().getTime() / 1000) - 1451606400) / 10) |
| 12 | def buildType | 12 | def buildType |
| 13 | def abiFilter = "arm64-v8a" //, "x86" | ||
| 14 | 13 | ||
| 15 | android { | 14 | android { |
| 16 | namespace 'org.yuzu.yuzu_emu' | 15 | namespace 'org.yuzu.yuzu_emu' |
| @@ -44,7 +43,7 @@ android { | |||
| 44 | targetSdkVersion 33 | 43 | targetSdkVersion 33 |
| 45 | versionCode autoVersion | 44 | versionCode autoVersion |
| 46 | versionName getVersion() | 45 | versionName getVersion() |
| 47 | ndk.abiFilters abiFilter | 46 | ndk.abiFilters "arm64-v8a", "x86_64" |
| 48 | } | 47 | } |
| 49 | 48 | ||
| 50 | signingConfigs { | 49 | signingConfigs { |
| @@ -115,7 +114,7 @@ android { | |||
| 115 | "-DYUZU_USE_BUNDLED_VCPKG=ON", | 114 | "-DYUZU_USE_BUNDLED_VCPKG=ON", |
| 116 | "-DYUZU_USE_BUNDLED_FFMPEG=ON" | 115 | "-DYUZU_USE_BUNDLED_FFMPEG=ON" |
| 117 | 116 | ||
| 118 | abiFilters abiFilter | 117 | abiFilters "arm64-v8a", "x86_64" |
| 119 | } | 118 | } |
| 120 | } | 119 | } |
| 121 | } | 120 | } |
diff --git a/src/android/app/src/main/jni/CMakeLists.txt b/src/android/app/src/main/jni/CMakeLists.txt index f80c166f4..21c27d4ee 100644 --- a/src/android/app/src/main/jni/CMakeLists.txt +++ b/src/android/app/src/main/jni/CMakeLists.txt | |||
| @@ -13,6 +13,9 @@ add_library(yuzu-android SHARED | |||
| 13 | set_property(TARGET yuzu-android PROPERTY IMPORTED_LOCATION ${FFmpeg_LIBRARY_DIR}) | 13 | set_property(TARGET yuzu-android PROPERTY IMPORTED_LOCATION ${FFmpeg_LIBRARY_DIR}) |
| 14 | 14 | ||
| 15 | target_link_libraries(yuzu-android PRIVATE audio_core common core input_common) | 15 | target_link_libraries(yuzu-android PRIVATE audio_core common core input_common) |
| 16 | target_link_libraries(yuzu-android PRIVATE android camera2ndk EGL glad inih jnigraphics adrenotools log) | 16 | target_link_libraries(yuzu-android PRIVATE android camera2ndk EGL glad inih jnigraphics log) |
| 17 | if (ARCHITECTURE_arm64) | ||
| 18 | target_link_libraries(yuzu-android PRIVATE adrenotools) | ||
| 19 | endif() | ||
| 17 | 20 | ||
| 18 | set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} yuzu-android) | 21 | set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} yuzu-android) |
diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index 3cfbec87c..6e670e899 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp | |||
| @@ -7,7 +7,9 @@ | |||
| 7 | #include <string_view> | 7 | #include <string_view> |
| 8 | #include <dlfcn.h> | 8 | #include <dlfcn.h> |
| 9 | 9 | ||
| 10 | #ifdef ARCHITECTURE_arm64 | ||
| 10 | #include <adrenotools/driver.h> | 11 | #include <adrenotools/driver.h> |
| 12 | #endif | ||
| 11 | 13 | ||
| 12 | #include <android/api-level.h> | 14 | #include <android/api-level.h> |
| 13 | #include <android/native_window_jni.h> | 15 | #include <android/native_window_jni.h> |
| @@ -76,6 +78,7 @@ public: | |||
| 76 | void InitializeGpuDriver(const std::string& hook_lib_dir, const std::string& custom_driver_dir, | 78 | void InitializeGpuDriver(const std::string& hook_lib_dir, const std::string& custom_driver_dir, |
| 77 | const std::string& custom_driver_name, | 79 | const std::string& custom_driver_name, |
| 78 | const std::string& file_redirect_dir) { | 80 | const std::string& file_redirect_dir) { |
| 81 | #ifdef ARCHITECTURE_arm64 | ||
| 79 | void* handle{}; | 82 | void* handle{}; |
| 80 | const char* file_redirect_dir_{}; | 83 | const char* file_redirect_dir_{}; |
| 81 | int featureFlags{}; | 84 | int featureFlags{}; |
| @@ -101,6 +104,7 @@ public: | |||
| 101 | } | 104 | } |
| 102 | 105 | ||
| 103 | m_vulkan_library = std::make_shared<Common::DynamicLibrary>(handle); | 106 | m_vulkan_library = std::make_shared<Common::DynamicLibrary>(handle); |
| 107 | #endif | ||
| 104 | } | 108 | } |
| 105 | 109 | ||
| 106 | bool IsRunning() const { | 110 | bool IsRunning() const { |
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 05aa5cfe2..94e3000ba 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt | |||
| @@ -346,6 +346,6 @@ if (YUZU_ENABLE_LTO) | |||
| 346 | set_property(TARGET video_core PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) | 346 | set_property(TARGET video_core PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) |
| 347 | endif() | 347 | endif() |
| 348 | 348 | ||
| 349 | if (ANDROID) | 349 | if (ANDROID AND ARCHITECTURE_arm64) |
| 350 | target_link_libraries(video_core PRIVATE adrenotools) | 350 | target_link_libraries(video_core PRIVATE adrenotools) |
| 351 | endif() | 351 | endif() |
diff --git a/src/video_core/renderer_vulkan/vk_turbo_mode.cpp b/src/video_core/renderer_vulkan/vk_turbo_mode.cpp index 29751e6b4..22dbf272e 100644 --- a/src/video_core/renderer_vulkan/vk_turbo_mode.cpp +++ b/src/video_core/renderer_vulkan/vk_turbo_mode.cpp | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #ifdef ANDROID | 4 | #if defined(ANDROID) && defined(ARCHITECTURE_arm64) |
| 5 | #include <adrenotools/driver.h> | 5 | #include <adrenotools/driver.h> |
| 6 | #endif | 6 | #endif |
| 7 | 7 | ||
| @@ -148,7 +148,7 @@ void TurboMode::Run(std::stop_token stop_token) { | |||
| 148 | auto cmdbuf = vk::CommandBuffer{cmdbufs[0], m_device.GetDispatchLoader()}; | 148 | auto cmdbuf = vk::CommandBuffer{cmdbufs[0], m_device.GetDispatchLoader()}; |
| 149 | 149 | ||
| 150 | while (!stop_token.stop_requested()) { | 150 | while (!stop_token.stop_requested()) { |
| 151 | #ifdef ANDROID | 151 | #if defined(ANDROID) && defined(ARCHITECTURE_arm64) |
| 152 | adrenotools_set_turbo(true); | 152 | adrenotools_set_turbo(true); |
| 153 | #else | 153 | #else |
| 154 | // Reset the fence. | 154 | // Reset the fence. |
| @@ -224,7 +224,7 @@ void TurboMode::Run(std::stop_token stop_token) { | |||
| 224 | std::chrono::milliseconds{100}; | 224 | std::chrono::milliseconds{100}; |
| 225 | }); | 225 | }); |
| 226 | } | 226 | } |
| 227 | #ifdef ANDROID | 227 | #if defined(ANDROID) && defined(ARCHITECTURE_arm64) |
| 228 | adrenotools_set_turbo(false); | 228 | adrenotools_set_turbo(false); |
| 229 | #endif | 229 | #endif |
| 230 | } | 230 | } |
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 06efa1a6c..9e2dee097 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
| @@ -18,7 +18,7 @@ | |||
| 18 | #include "video_core/vulkan_common/vulkan_device.h" | 18 | #include "video_core/vulkan_common/vulkan_device.h" |
| 19 | #include "video_core/vulkan_common/vulkan_wrapper.h" | 19 | #include "video_core/vulkan_common/vulkan_wrapper.h" |
| 20 | 20 | ||
| 21 | #ifdef ANDROID | 21 | #if defined(ANDROID) && defined(ARCHITECTURE_arm64) |
| 22 | #include <adrenotools/bcenabler.h> | 22 | #include <adrenotools/bcenabler.h> |
| 23 | #endif | 23 | #endif |
| 24 | 24 | ||
| @@ -374,6 +374,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 374 | extensions.push_descriptor = false; | 374 | extensions.push_descriptor = false; |
| 375 | loaded_extensions.erase(VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); | 375 | loaded_extensions.erase(VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); |
| 376 | 376 | ||
| 377 | #ifdef ARCHITECTURE_arm64 | ||
| 377 | // Patch the driver to enable BCn textures. | 378 | // Patch the driver to enable BCn textures. |
| 378 | const auto major = (properties.properties.driverVersion >> 24) << 2; | 379 | const auto major = (properties.properties.driverVersion >> 24) << 2; |
| 379 | const auto minor = (properties.properties.driverVersion >> 12) & 0xFFFU; | 380 | const auto minor = (properties.properties.driverVersion >> 12) & 0xFFFU; |
| @@ -391,6 +392,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 391 | } else { | 392 | } else { |
| 392 | LOG_WARNING(Render_Vulkan, "Adreno driver can't be patched to enable BCn textures"); | 393 | LOG_WARNING(Render_Vulkan, "Adreno driver can't be patched to enable BCn textures"); |
| 393 | } | 394 | } |
| 395 | #endif // ARCHITECTURE_arm64 | ||
| 394 | } | 396 | } |
| 395 | 397 | ||
| 396 | const bool is_arm = driver_id == VK_DRIVER_ID_ARM_PROPRIETARY; | 398 | const bool is_arm = driver_id == VK_DRIVER_ID_ARM_PROPRIETARY; |
diff --git a/src/video_core/vulkan_common/vulkan_library.cpp b/src/video_core/vulkan_common/vulkan_library.cpp index 9a7d369f3..47f6f2a03 100644 --- a/src/video_core/vulkan_common/vulkan_library.cpp +++ b/src/video_core/vulkan_common/vulkan_library.cpp | |||
| @@ -13,7 +13,7 @@ namespace Vulkan { | |||
| 13 | std::shared_ptr<Common::DynamicLibrary> OpenLibrary( | 13 | std::shared_ptr<Common::DynamicLibrary> OpenLibrary( |
| 14 | [[maybe_unused]] Core::Frontend::GraphicsContext* context) { | 14 | [[maybe_unused]] Core::Frontend::GraphicsContext* context) { |
| 15 | LOG_DEBUG(Render_Vulkan, "Looking for a Vulkan library"); | 15 | LOG_DEBUG(Render_Vulkan, "Looking for a Vulkan library"); |
| 16 | #ifdef ANDROID | 16 | #if defined(ANDROID) && defined(ARCHITECTURE_arm64) |
| 17 | // Android manages its Vulkan driver from the frontend. | 17 | // Android manages its Vulkan driver from the frontend. |
| 18 | return context->GetDriverLibrary(); | 18 | return context->GetDriverLibrary(); |
| 19 | #else | 19 | #else |