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 048dba4f3..367f30517 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h | |||
| @@ -1464,19 +1464,27 @@ typename BufferCache<P>::OverlapResult BufferCache<P>::ResolveOverlaps(VAddr cpu | |||
| 1464 | overlap_ids.push_back(overlap_id); | 1464 | overlap_ids.push_back(overlap_id); |
| 1465 | overlap.Pick(); | 1465 | overlap.Pick(); |
| 1466 | const VAddr overlap_cpu_addr = overlap.CpuAddr(); | 1466 | const VAddr overlap_cpu_addr = overlap.CpuAddr(); |
| 1467 | if (overlap_cpu_addr < begin) { | 1467 | const bool expands_left = overlap_cpu_addr < begin; |
| 1468 | if (expands_left) { | ||
| 1468 | cpu_addr = begin = overlap_cpu_addr; | 1469 | cpu_addr = begin = overlap_cpu_addr; |
| 1469 | } | 1470 | } |
| 1470 | end = std::max(end, overlap_cpu_addr + overlap.SizeBytes()); | 1471 | const VAddr overlap_end = overlap_cpu_addr + overlap.SizeBytes(); |
| 1471 | 1472 | const bool expands_right = overlap_end > end; | |
| 1473 | if (overlap_end > end) { | ||
| 1474 | end = overlap_end; | ||
| 1475 | } | ||
| 1472 | stream_score += overlap.StreamScore(); | 1476 | stream_score += overlap.StreamScore(); |
| 1473 | if (stream_score > STREAM_LEAP_THRESHOLD && !has_stream_leap) { | 1477 | if (stream_score > STREAM_LEAP_THRESHOLD && !has_stream_leap) { |
| 1474 | // When this memory region has been joined a bunch of times, we assume it's being used | 1478 | // When this memory region has been joined a bunch of times, we assume it's being used |
| 1475 | // as a stream buffer. Increase the size to skip constantly recreating buffers. | 1479 | // as a stream buffer. Increase the size to skip constantly recreating buffers. |
| 1476 | has_stream_leap = true; | 1480 | has_stream_leap = true; |
| 1477 | begin -= PAGE_SIZE * 256; | 1481 | if (expands_right) { |
| 1478 | cpu_addr = begin; | 1482 | begin -= PAGE_SIZE * 256; |
| 1479 | end += PAGE_SIZE * 256; | 1483 | cpu_addr = begin; |
| 1484 | } | ||
| 1485 | if (expands_left) { | ||
| 1486 | end += PAGE_SIZE * 256; | ||
| 1487 | } | ||
| 1480 | } | 1488 | } |
| 1481 | } | 1489 | } |
| 1482 | return OverlapResult{ | 1490 | return OverlapResult{ |