summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2021-07-14 18:25:33 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2021-07-14 18:25:33 +0200
commita0eb3f8a3ee511e29ee362687d5f7e2df2e281f5 (patch)
treefbdc97b3829c4f8f030fd72693540e2246e26f1a /src/video_core
parentDMAEngine: Revert flushing from Pitch to BlpockLinear. (diff)
downloadyuzu-a0eb3f8a3ee511e29ee362687d5f7e2df2e281f5.tar
yuzu-a0eb3f8a3ee511e29ee362687d5f7e2df2e281f5.tar.gz
yuzu-a0eb3f8a3ee511e29ee362687d5f7e2df2e281f5.tar.bz2
yuzu-a0eb3f8a3ee511e29ee362687d5f7e2df2e281f5.tar.lz
yuzu-a0eb3f8a3ee511e29ee362687d5f7e2df2e281f5.tar.xz
yuzu-a0eb3f8a3ee511e29ee362687d5f7e2df2e281f5.tar.zst
yuzu-a0eb3f8a3ee511e29ee362687d5f7e2df2e281f5.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/buffer_cache/buffer_cache.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h
index 4def8f076..9399bcfea 100644
--- a/src/video_core/buffer_cache/buffer_cache.h
+++ b/src/video_core/buffer_cache/buffer_cache.h
@@ -172,7 +172,7 @@ public:
[[nodiscard]] bool IsRegionGpuModified(VAddr addr, size_t size);
/// Return true when a region is registered on the cache
- [[nodiscard]] bool IsRegionRegistered(VAddr addr, size_t size);
+ [[nodiscard]] bool IsRegionRegistered(VAddr addr, size_t size) const;
/// Return true when a CPU region is modified from the CPU
[[nodiscard]] bool IsRegionCpuModified(VAddr addr, size_t size);
@@ -503,6 +503,11 @@ bool BufferCache<P>::DMACopy(GPUVAddr src_address, GPUVAddr dest_address, u64 am
auto& src_buffer = slot_buffers[buffer_a];
auto& dest_buffer = slot_buffers[buffer_b];
SynchronizeBuffer(src_buffer, *cpu_src_address, static_cast<u32>(amount));
+ const VAddr aligned_dst = Common::AlignUp(*cpu_dest_address, 64);
+ const u64 diff = aligned_dst - *cpu_dest_address;
+ const u64 new_amount = diff > amount ? 0 : amount - diff;
+ dest_buffer.UnmarkRegionAsCpuModified(aligned_dst, Common::AlignDown(new_amount, 64));
+ SynchronizeBuffer(dest_buffer, *cpu_dest_address, static_cast<u32>(amount));
std::array copies{BufferCopy{
.src_offset = src_buffer.Offset(*cpu_src_address),
.dst_offset = dest_buffer.Offset(*cpu_dest_address),
@@ -526,11 +531,7 @@ bool BufferCache<P>::DMACopy(GPUVAddr src_address, GPUVAddr dest_address, u64 am
common_ranges.add(add_interval);
}
- if (dest_buffer.HasCachedWrites()) {
- dest_buffer.FlushCachedWrites();
- }
runtime.CopyBuffer(dest_buffer, src_buffer, copies);
- dest_buffer.UnmarkRegionAsCpuModified(*cpu_dest_address, amount);
if (atleast_1_download) {
dest_buffer.MarkRegionAsGpuModified(*cpu_dest_address, amount);
}
@@ -827,7 +828,7 @@ bool BufferCache<P>::IsRegionGpuModified(VAddr addr, size_t size) {
}
template <class P>
-bool BufferCache<P>::IsRegionRegistered(VAddr addr, size_t size) {
+bool BufferCache<P>::IsRegionRegistered(VAddr addr, size_t size) const {
const VAddr end_addr = addr + size;
const u64 page_end = Common::DivCeil(end_addr, PAGE_SIZE);
for (u64 page = addr >> PAGE_BITS; page < page_end;) {