diff options
Diffstat (limited to '')
| -rw-r--r-- | src/video_core/buffer_cache/buffer_cache.h | 20 |
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{ |