From ad25588651ea623154d8ec9f43ee1d587d0d40e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 25 Sep 2026 17:36:03 -0600 Subject: [PATCH] GPU: Allow for main RAM contention in the movie blit cost The blit rates were measured with nothing else running. In a game, threads waking up and SAS mixing on the Media Engine compete with the GE for main RAM: Star Wars: Lethal Alliance's movie blit takes 8.65ms alone and 10.3ms in the game. We don't model that load, so RAM texture fetches get a fixed 1.17x for a typical one. With it, that game's long movie plays at 30 fps as on hardware. Co-Authored-By: Claude Opus 5.5 (1M context) --- GPU/GPUCommon.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index baa96c27ca..576a7bd655 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -148,6 +148,13 @@ int GPUCommon::EstimatePerVertexCost() { return cost; } +// The blit rates were measured with nothing else running. In a game, other threads waking up and +// SAS mixing on the Media Engine compete with the GE for main RAM, making RAM texture fetches +// 10-20% slower: Star Wars: Lethal Alliance's movie blit takes 8.65ms alone and 10.3ms in the game +// (pspautotests gpu/timing/blittiming, video/mpeg/playertiming). We don't model that load, so +// assume a typical one. Clears and VRAM texture fetches don't touch main RAM and aren't affected. +static constexpr float ramTextureContention = 1.17f; + // Clears aren't charged yet. They could slow down games that spin hard on an empty screen - flip // this to try. static constexpr bool chargeClearTime = false; @@ -194,7 +201,13 @@ int GPUCommon::EstimateFillCycles(GEPrimitiveType prim, const void *verts, const } static const Rate ramRates[2] = { { 34.9f, 253.0f }, { 66.3f, 503.5f } }; static const Rate vramRates[2] = { { 8.3f, 38.3f }, { 13.0f, 76.1f } }; - rate = (Memory::IsVRAMAddress(texAddr) ? vramRates : ramRates)[is32Bit ? 1 : 0]; + if (Memory::IsVRAMAddress(texAddr)) { + rate = vramRates[is32Bit ? 1 : 0]; + } else { + rate = ramRates[is32Bit ? 1 : 0]; + rate.narrow *= ramTextureContention; + rate.wide *= ramTextureContention; + } } const int stride = dec->VertexSize();