Compare commits

..

2 Commits

Author SHA1 Message Date
lizzie
935c88c6ef fix license 2025-12-22 03:49:37 +01:00
lizzie
17df2400e2 [host_memory] remove unused fastmem fallback path
basically nobody ever used that path, we instead soft-crash upon not being able to allocate **backing** storage, we do still attempt to allocate a virtual base through, but if backing storage fails for any reason whatsoever, we pretty much cant run the emulator anyways

Signed-off-by: lizzie <lizzie@eden-emu.dev>
2025-12-22 03:49:37 +01:00
11 changed files with 20 additions and 64 deletions

View File

@@ -18,7 +18,6 @@ plugins {
id("androidx.navigation.safeargs.kotlin")
id("org.jlleitschuh.gradle.ktlint") version "11.4.0"
id("com.github.triplet.play") version "3.8.6"
id("idea")
}
/**
@@ -28,8 +27,6 @@ plugins {
*/
val autoVersion = (((System.currentTimeMillis() / 1000) - 1451606400) / 10).toInt()
val edenDir = project(":Eden").projectDir
@Suppress("UnstableApiUsage")
android {
namespace = "org.yuzu.yuzu_emu"
@@ -244,17 +241,11 @@ android {
externalNativeBuild {
cmake {
version = "3.22.1"
path = file("${edenDir}/CMakeLists.txt")
path = file("../../../CMakeLists.txt")
}
}
}
idea {
module {
// Inclusion to exclude build/ dir from non-Android
excludeDirs.add(file("${edenDir}/build"))
}
}
tasks.register<Delete>("ktlintReset", fun Delete.() {
delete(File(layout.buildDirectory.toString() + File.separator + "intermediates/ktLint"))
@@ -355,7 +346,7 @@ fun getGitVersion(): String {
}
afterEvaluate {
val artifactsDir = layout.projectDirectory.dir("${edenDir}/artifacts")
val artifactsDir = layout.projectDirectory.dir("../../../artifacts")
val outputsDir = layout.buildDirectory.dir("outputs").get()
android.applicationVariants.forEach { variant ->

View File

@@ -28,7 +28,6 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting {
SYNC_MEMORY_OPERATIONS("sync_memory_operations"),
BUFFER_REORDER_DISABLE("disable_buffer_reorder"),
RENDERER_DEBUG("debug"),
RENDERER_PATCH_OLD_QCOM_DRIVERS("patch_old_qcom_drivers"),
RENDERER_VERTEX_INPUT_DYNAMIC_STATE("vertex_input_dynamic_state"),
RENDERER_PROVOKING_VERTEX("provoking_vertex"),
RENDERER_DESCRIPTOR_INDEXING("descriptor_indexing"),

View File

@@ -766,13 +766,6 @@ abstract class SettingsItem(
descriptionId = R.string.renderer_debug_description
)
)
put(
SwitchSetting(
BooleanSetting.RENDERER_PATCH_OLD_QCOM_DRIVERS,
titleId = R.string.patch_old_qcom_drivers,
descriptionId = R.string.patch_old_qcom_drivers_description
)
)
put(
SwitchSetting(
BooleanSetting.USE_AUTO_STUB,

View File

@@ -1161,7 +1161,6 @@ class SettingsFragmentPresenter(
add(HeaderSetting(R.string.gpu))
add(IntSetting.RENDERER_BACKEND.key)
add(BooleanSetting.RENDERER_DEBUG.key)
add(BooleanSetting.RENDERER_PATCH_OLD_QCOM_DRIVERS.key)
add(HeaderSetting(R.string.cpu))
add(IntSetting.CPU_BACKEND.key)

View File

@@ -524,8 +524,6 @@
<string name="renderer_api">API</string>
<string name="renderer_debug">Graphics debugging</string>
<string name="renderer_debug_description">Sets the graphics API to a slow debugging mode.</string>
<string name="patch_old_qcom_drivers">Enable BCn Textures</string>
<string name="patch_old_qcom_drivers_description">Enable patch support for BCn texture formats on Adreno Drivers when not support natively. (Disable to fix fetching drivers and random crashes on old Android versions)</string>
<string name="fastmem">Fastmem</string>
<string name="log">Logging</string>

View File

@@ -1,6 +1,3 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
@@ -22,6 +19,3 @@ dependencyResolutionManagement {
}
include(":app")
include("Eden")
project(":Eden").projectDir = file("../..")

View File

@@ -68,8 +68,8 @@ static int memfd_create(const char* name, unsigned int flags) {
namespace Common {
constexpr size_t PageAlignment = 0x1000;
constexpr size_t HugePageSize = 0x200000;
[[maybe_unused]] constexpr size_t PageAlignment = 0x1000;
[[maybe_unused]] constexpr size_t HugePageSize = 0x200000;
#ifdef _WIN32
@@ -692,30 +692,16 @@ private:
#endif // ^^^ POSIX ^^^
HostMemory::HostMemory(size_t backing_size_, size_t virtual_size_)
: backing_size(backing_size_), virtual_size(virtual_size_) {
try {
// Try to allocate a fastmem arena.
// The implementation will fail with std::bad_alloc on errors.
impl =
std::make_unique<HostMemory::Impl>(AlignUp(backing_size, PageAlignment),
AlignUp(virtual_size, PageAlignment) + HugePageSize);
backing_base = impl->backing_base;
virtual_base = impl->virtual_base;
if (virtual_base) {
// Ensure the virtual base is aligned to the L2 block size.
virtual_base = reinterpret_cast<u8*>(
Common::AlignUp(reinterpret_cast<uintptr_t>(virtual_base), HugePageSize));
virtual_base_offset = virtual_base - impl->virtual_base;
}
} catch (const std::bad_alloc&) {
LOG_CRITICAL(HW_Memory,
"Fastmem unavailable, falling back to VirtualBuffer for memory allocation");
fallback_buffer = std::make_unique<Common::VirtualBuffer<u8>>(backing_size);
backing_base = fallback_buffer->data();
virtual_base = nullptr;
HostMemory::HostMemory(size_t backing_size_, size_t virtual_size_) : backing_size(backing_size_), virtual_size(virtual_size_) {
// Try to allocate a fastmem arena.
// The implementation will fail with std::bad_alloc on errors.
impl = std::make_unique<HostMemory::Impl>(AlignUp(backing_size, PageAlignment), AlignUp(virtual_size, PageAlignment) + HugePageSize);
backing_base = impl->backing_base;
virtual_base = impl->virtual_base;
if (virtual_base) {
// Ensure the virtual base is aligned to the L2 block size.
virtual_base = reinterpret_cast<u8*>(Common::AlignUp(uintptr_t(virtual_base), HugePageSize));
virtual_base_offset = virtual_base - impl->virtual_base;
}
}

View File

@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -79,9 +82,6 @@ private:
u8* backing_base{};
u8* virtual_base{};
size_t virtual_base_offset{};
// Fallback if fastmem is not supported on this platform
std::unique_ptr<Common::VirtualBuffer<u8>> fallback_buffer;
};
} // namespace Common

View File

@@ -546,9 +546,6 @@ struct Values {
true,
false,
&sample_shading};
#ifdef ANDROID
SwitchableSetting<bool> patch_old_qcom_drivers{linkage, true, "patch_old_qcom_drivers", Category::RendererDebug};
#endif
Setting<bool> renderer_debug{linkage, false, "debug", Category::RendererDebug};
Setting<bool> renderer_shader_feedback{linkage, false, "shader_feedback",

View File

@@ -134,4 +134,4 @@ target_include_directories(dynarmic_tests PRIVATE . ../src)
target_compile_options(dynarmic_tests PRIVATE ${DYNARMIC_CXX_FLAGS})
target_compile_definitions(dynarmic_tests PRIVATE FMT_USE_USER_DEFINED_LITERALS=1)
add_test(NAME dynarmic_tests COMMAND dynarmic_tests --durations yes)
add_test(dynarmic_tests dynarmic_tests --durations yes)

View File

@@ -503,13 +503,12 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
#if defined(ANDROID) && defined(ARCHITECTURE_arm64)
// Patch the driver to enable BCn textures.
const bool patch_old_qcom_drivers = Settings::values.patch_old_qcom_drivers.GetValue();
const auto major = (properties.properties.driverVersion >> 24) << 2;
const auto minor = (properties.properties.driverVersion >> 12) & 0xFFFU;
const auto vendor = properties.properties.vendorID;
const auto patch_status = adrenotools_get_bcn_type(major, minor, vendor);
if (patch_status == ADRENOTOOLS_BCN_PATCH && patch_old_qcom_drivers) {
if (patch_status == ADRENOTOOLS_BCN_PATCH) {
LOG_INFO(Render_Vulkan, "Patching Adreno driver to support BCn texture formats");
if (adrenotools_patch_bcn(
reinterpret_cast<void*>(dld.vkGetPhysicalDeviceFormatProperties))) {
@@ -520,7 +519,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
} else if (patch_status == ADRENOTOOLS_BCN_BLOB) {
LOG_INFO(Render_Vulkan, "Adreno driver supports BCn textures without patches");
} else {
LOG_WARNING(Render_Vulkan, "Adreno driver not patched to enable BCn textures");
LOG_WARNING(Render_Vulkan, "Adreno driver can't be patched to enable BCn textures");
}
#endif
}