summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2022-03-20 15:23:53 -0700
committerGravatar GitHub2022-03-20 15:23:53 -0700
commitff2e8910225134af408b8ca148ac7c1bc1b9e967 (patch)
tree3d10ea6e57caebf466badeb375ea44e1ab86f23b
parentMerge pull request #8054 from merryhime/dynarmic (diff)
parentBufferCache: Find direction of the stream buffer increase. (diff)
downloadyuzu-ff2e8910225134af408b8ca148ac7c1bc1b9e967.tar.gz
yuzu-ff2e8910225134af408b8ca148ac7c1bc1b9e967.tar.xz
yuzu-ff2e8910225134af408b8ca148ac7c1bc1b9e967.zip
Merge pull request #7812 from FernandoS27/made-straight-from-the-nut
BufferCache: Find direction of the stream buffer increase.
Diffstat (limited to '')
-rw-r--r--src/video_core/buffer_cache/buffer_cache.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h
index fa26eb8b0..6d8955ca3 100644
--- a/src/video_core/buffer_cache/buffer_cache.h
+++ b/src/video_core/buffer_cache/buffer_cache.h
@@ -1469,19 +1469,27 @@ typename BufferCache<P>::OverlapResult BufferCache<P>::ResolveOverlaps(VAddr cpu
1469 overlap_ids.push_back(overlap_id); 1469 overlap_ids.push_back(overlap_id);
1470 overlap.Pick(); 1470 overlap.Pick();
1471 const VAddr overlap_cpu_addr = overlap.CpuAddr(); 1471 const VAddr overlap_cpu_addr = overlap.CpuAddr();
1472 if (overlap_cpu_addr < begin) { 1472 const bool expands_left = overlap_cpu_addr < begin;
1473 if (expands_left) {
1473 cpu_addr = begin = overlap_cpu_addr; 1474 cpu_addr = begin = overlap_cpu_addr;
1474 } 1475 }
1475 end = std::max(end, overlap_cpu_addr + overlap.SizeBytes()); 1476 const VAddr overlap_end = overlap_cpu_addr + overlap.SizeBytes();
1476 1477 const bool expands_right = overlap_end > end;
1478 if (overlap_end > end) {
1479 end = overlap_end;
1480 }
1477 stream_score += overlap.StreamScore(); 1481 stream_score += overlap.StreamScore();
1478 if (stream_score > STREAM_LEAP_THRESHOLD && !has_stream_leap) { 1482 if (stream_score > STREAM_LEAP_THRESHOLD && !has_stream_leap) {
1479 // When this memory region has been joined a bunch of times, we assume it's being used 1483 // When this memory region has been joined a bunch of times, we assume it's being used
1480 // as a stream buffer. Increase the size to skip constantly recreating buffers. 1484 // as a stream buffer. Increase the size to skip constantly recreating buffers.
1481 has_stream_leap = true; 1485 has_stream_leap = true;
1482 begin -= PAGE_SIZE * 256; 1486 if (expands_right) {
1483 cpu_addr = begin; 1487 begin -= PAGE_SIZE * 256;
1484 end += PAGE_SIZE * 256; 1488 cpu_addr = begin;
1489 }
1490 if (expands_left) {
1491 end += PAGE_SIZE * 256;
1492 }
1485 } 1493 }
1486 } 1494 }
1487 return OverlapResult{ 1495 return OverlapResult{