graphics: size the buffer and page-table constants explicitly

Names the upload/stream/download/device-local buffer sizes instead of repeating
literals, and makes the BDA page-table address width explicit.

Two of these are behaviour changes and are the ones to look at:

- DOWNLOAD_BUFFER_SIZE is raised from 32 MiB to 128 MiB. Marvel's Spider-Man:
  Miles Morales asks for a single 80 MiB download allocation, which 32 MiB
  cannot serve; the run dies with 'failed to map reusable download buffer,
  size=0x5000000'. This costs every title the larger reservation.
- CACHING_ADDRESS_BITS is 39, where the table previously covered 40 bits. That
  halves the BDA page table from 512 MiB to 256 MiB, at the cost of covering
  guest addresses only to 512 GiB. 38 bits was tried first and was too narrow -
  it produced an intermittent DMA barrier on an address just past 2^38.

The address-width reduction in particular is tuned against one title; if the
1 TiB window is load-bearing for something else, take the naming and leave the
value at 40.
This commit is contained in:
Mac
2026-08-31 23:41:14 +05:30
parent 3cd6ff0a3f
commit e77041b6f5
+8 -1
View File
@@ -29,10 +29,17 @@ class BufferCache {
public:
static constexpr uint32_t CACHING_PAGEBITS = 14;
static constexpr uint64_t CACHING_PAGESIZE = uint64_t {1} << CACHING_PAGEBITS;
static constexpr uint64_t CACHING_NUMPAGES = uint64_t {1} << (40 - CACHING_PAGEBITS);
static constexpr uint32_t CACHING_ADDRESS_BITS = 39;
static constexpr uint64_t CACHING_NUMPAGES =
uint64_t {1} << (CACHING_ADDRESS_BITS - CACHING_PAGEBITS);
static constexpr uint64_t BDA_PAGETABLE_SIZE =
CACHING_NUMPAGES * sizeof(vk::DeviceAddress);
static constexpr uint64_t UPLOAD_BUFFER_SIZE = 512ull * 1024ull * 1024ull;
static constexpr uint64_t STREAM_BUFFER_SIZE = 64ull * 1024ull * 1024ull;
static constexpr uint64_t DOWNLOAD_BUFFER_SIZE = 128ull * 1024ull * 1024ull;
static constexpr uint64_t DEVICE_LOCAL_BUFFER_SIZE = 128ull * 1024ull * 1024ull;
BufferCache(GraphicContext& graphics, CommandScheduler& scheduler, PageManager& page_manager,
TextureCache& texture_cache);
~BufferCache();