[TEST] Adjustment AHB to tiled-gpu-v2 state

This commit is contained in:
CamilleLaVey 2026-08-07 15:54:08 -04:00
parent 42636ba127
commit 4a3a2c0a11
5 changed files with 49 additions and 121 deletions

View file

@ -214,10 +214,10 @@ HostMemoryImport::HostMemoryImport(const Device &device_, void *base, size_t siz
size)) {
return;
}
if (device.IsTiler()) {
if (!hardware_buffers.empty()) {
LOG_INFO(Render_Vulkan,
"Unified memory disabled, hardware buffer import is the only path supported "
"by tiler drivers");
"Unified memory disabled, guest memory is backed by hardware buffers that "
"could not be imported");
return;
}
if (ImportHostPointer(base, size)) {
@ -241,8 +241,7 @@ bool HostMemoryImport::ImportHostPointer(void *base, size_t size) {
return false;
}
using namespace Common::Literals;
constexpr VkDeviceSize DesktopWindowSize = 4_GiB;
VkDeviceSize candidate_window = DesktopWindowSize;
VkDeviceSize candidate_window = 1_GiB;
const u64 max_buffer_size = device.GetMaxBufferSize();
if (max_buffer_size != 0 && max_buffer_size < candidate_window) {
candidate_window = max_buffer_size;
@ -306,11 +305,9 @@ bool HostMemoryImport::ImportHostPointer(void *base, size_t size) {
logical.DestroyBufferRaw(new_buffer);
break;
}
constexpr VkDeviceSize MaxHeapFractionDenominator = 2;
const u32 heap_index = memory_props.memoryTypes[*type_index].heapIndex;
const VkDeviceSize heap_size = memory_props.memoryHeaps[heap_index].size;
const VkDeviceSize heap_import_limit = heap_size / MaxHeapFractionDenominator;
if (imported_size + window_len > heap_import_limit) {
if (imported_size + window_len > heap_size / 2) {
LOG_INFO(Render_Vulkan,
"Stopping guest memory import at {} MiB to leave room on heap {} of {} MiB",
imported_size >> 20, heap_index, heap_size >> 20);
@ -363,14 +360,7 @@ bool HostMemoryImport::ImportHardwareBuffers(
!device.IsExtExternalMemoryAhbSupported()) {
return false;
}
using namespace Common::Literals;
u64 max_allocation_size = device.GetMaxMemoryAllocationSize();
if (device.IsTiler()) {
constexpr u64 TilerAllocationLimit = 1_GiB;
max_allocation_size = max_allocation_size != 0
? (std::min)(max_allocation_size, TilerAllocationLimit)
: TilerAllocationLimit;
}
const u64 max_allocation_size = device.GetMaxMemoryAllocationSize();
if (max_allocation_size != 0 && hardware_buffer_window > max_allocation_size) {
LOG_WARNING(Render_Vulkan,
"Hardware buffer windows of {} MiB exceed the {} MiB allocation limit",