caches: make critical reclamation less eager and possible in more cases

This commit is contained in:
Liam 2023-05-31 12:36:04 -04:00
parent 98db796fde
commit 865a0186b6
2 changed files with 3 additions and 3 deletions

View File

@ -35,7 +35,7 @@ BufferCache<P>::BufferCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, R
const s64 min_spacing_critical = device_local_memory - 512_MiB; const s64 min_spacing_critical = device_local_memory - 512_MiB;
const s64 mem_threshold = std::min(device_local_memory, TARGET_THRESHOLD); const s64 mem_threshold = std::min(device_local_memory, TARGET_THRESHOLD);
const s64 min_vacancy_expected = (6 * mem_threshold) / 10; const s64 min_vacancy_expected = (6 * mem_threshold) / 10;
const s64 min_vacancy_critical = (3 * mem_threshold) / 10; const s64 min_vacancy_critical = (2 * mem_threshold) / 10;
minimum_memory = static_cast<u64>( minimum_memory = static_cast<u64>(
std::max(std::min(device_local_memory - min_vacancy_expected, min_spacing_expected), std::max(std::min(device_local_memory - min_vacancy_expected, min_spacing_expected),
DEFAULT_EXPECTED_MEMORY)); DEFAULT_EXPECTED_MEMORY));

View File

@ -55,7 +55,7 @@ TextureCache<P>::TextureCache(Runtime& runtime_, Tegra::MaxwellDeviceMemoryManag
const s64 min_spacing_critical = device_local_memory - 512_MiB; const s64 min_spacing_critical = device_local_memory - 512_MiB;
const s64 mem_threshold = std::min(device_local_memory, TARGET_THRESHOLD); const s64 mem_threshold = std::min(device_local_memory, TARGET_THRESHOLD);
const s64 min_vacancy_expected = (6 * mem_threshold) / 10; const s64 min_vacancy_expected = (6 * mem_threshold) / 10;
const s64 min_vacancy_critical = (3 * mem_threshold) / 10; const s64 min_vacancy_critical = (2 * mem_threshold) / 10;
expected_memory = static_cast<u64>( expected_memory = static_cast<u64>(
std::max(std::min(device_local_memory - min_vacancy_expected, min_spacing_expected), std::max(std::min(device_local_memory - min_vacancy_expected, min_spacing_expected),
DEFAULT_EXPECTED_MEMORY)); DEFAULT_EXPECTED_MEMORY));
@ -81,7 +81,6 @@ void TextureCache<P>::RunGarbageCollector() {
if (num_iterations == 0) { if (num_iterations == 0) {
return true; return true;
} }
--num_iterations;
auto& image = slot_images[image_id]; auto& image = slot_images[image_id];
if (True(image.flags & ImageFlagBits::IsDecoding)) { if (True(image.flags & ImageFlagBits::IsDecoding)) {
// This image is still being decoded, deleting it will invalidate the slot // This image is still being decoded, deleting it will invalidate the slot
@ -96,6 +95,7 @@ void TextureCache<P>::RunGarbageCollector() {
if (!high_priority_mode && must_download) { if (!high_priority_mode && must_download) {
return false; return false;
} }
--num_iterations;
if (must_download) { if (must_download) {
auto map = runtime.DownloadStagingBuffer(image.unswizzled_size_bytes); auto map = runtime.DownloadStagingBuffer(image.unswizzled_size_bytes);
const auto copies = FullDownloadCopies(image.info); const auto copies = FullDownloadCopies(image.info);