diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/buffer_cache/buffer_cache.h | 14 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_dma.cpp | 5 | ||||
| -rw-r--r-- | src/video_core/memory_manager.cpp | 2 |
3 files changed, 10 insertions, 11 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 9399bcfea..7373cb62d 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h | |||
| @@ -172,7 +172,7 @@ public: | |||
| 172 | [[nodiscard]] bool IsRegionGpuModified(VAddr addr, size_t size); | 172 | [[nodiscard]] bool IsRegionGpuModified(VAddr addr, size_t size); |
| 173 | 173 | ||
| 174 | /// Return true when a region is registered on the cache | 174 | /// Return true when a region is registered on the cache |
| 175 | [[nodiscard]] bool IsRegionRegistered(VAddr addr, size_t size) const; | 175 | [[nodiscard]] bool IsRegionRegistered(VAddr addr, size_t size); |
| 176 | 176 | ||
| 177 | /// Return true when a CPU region is modified from the CPU | 177 | /// Return true when a CPU region is modified from the CPU |
| 178 | [[nodiscard]] bool IsRegionCpuModified(VAddr addr, size_t size); | 178 | [[nodiscard]] bool IsRegionCpuModified(VAddr addr, size_t size); |
| @@ -503,10 +503,6 @@ bool BufferCache<P>::DMACopy(GPUVAddr src_address, GPUVAddr dest_address, u64 am | |||
| 503 | auto& src_buffer = slot_buffers[buffer_a]; | 503 | auto& src_buffer = slot_buffers[buffer_a]; |
| 504 | auto& dest_buffer = slot_buffers[buffer_b]; | 504 | auto& dest_buffer = slot_buffers[buffer_b]; |
| 505 | SynchronizeBuffer(src_buffer, *cpu_src_address, static_cast<u32>(amount)); | 505 | SynchronizeBuffer(src_buffer, *cpu_src_address, static_cast<u32>(amount)); |
| 506 | const VAddr aligned_dst = Common::AlignUp(*cpu_dest_address, 64); | ||
| 507 | const u64 diff = aligned_dst - *cpu_dest_address; | ||
| 508 | const u64 new_amount = diff > amount ? 0 : amount - diff; | ||
| 509 | dest_buffer.UnmarkRegionAsCpuModified(aligned_dst, Common::AlignDown(new_amount, 64)); | ||
| 510 | SynchronizeBuffer(dest_buffer, *cpu_dest_address, static_cast<u32>(amount)); | 506 | SynchronizeBuffer(dest_buffer, *cpu_dest_address, static_cast<u32>(amount)); |
| 511 | std::array copies{BufferCopy{ | 507 | std::array copies{BufferCopy{ |
| 512 | .src_offset = src_buffer.Offset(*cpu_src_address), | 508 | .src_offset = src_buffer.Offset(*cpu_src_address), |
| @@ -552,21 +548,19 @@ bool BufferCache<P>::DMAClear(GPUVAddr dst_address, u64 amount, u32 value) { | |||
| 552 | return false; | 548 | return false; |
| 553 | } | 549 | } |
| 554 | 550 | ||
| 555 | const IntervalType subtract_interval{*cpu_dst_address, *cpu_dst_address + amount * sizeof(u32)}; | 551 | const size_t size = amount * sizeof(u32); |
| 552 | const IntervalType subtract_interval{*cpu_dst_address, *cpu_dst_address + size}; | ||
| 556 | ClearDownload(subtract_interval); | 553 | ClearDownload(subtract_interval); |
| 557 | common_ranges.subtract(subtract_interval); | 554 | common_ranges.subtract(subtract_interval); |
| 558 | 555 | ||
| 559 | const size_t size = amount * sizeof(u32); | ||
| 560 | BufferId buffer; | 556 | BufferId buffer; |
| 561 | do { | 557 | do { |
| 562 | has_deleted_buffers = false; | 558 | has_deleted_buffers = false; |
| 563 | buffer = FindBuffer(*cpu_dst_address, static_cast<u32>(size)); | 559 | buffer = FindBuffer(*cpu_dst_address, static_cast<u32>(size)); |
| 564 | } while (has_deleted_buffers); | 560 | } while (has_deleted_buffers); |
| 565 | |||
| 566 | auto& dest_buffer = slot_buffers[buffer]; | 561 | auto& dest_buffer = slot_buffers[buffer]; |
| 567 | const u32 offset = static_cast<u32>(*cpu_dst_address - dest_buffer.CpuAddr()); | 562 | const u32 offset = static_cast<u32>(*cpu_dst_address - dest_buffer.CpuAddr()); |
| 568 | runtime.ClearBuffer(dest_buffer, offset, size, value); | 563 | runtime.ClearBuffer(dest_buffer, offset, size, value); |
| 569 | dest_buffer.UnmarkRegionAsCpuModified(*cpu_dst_address, size); | ||
| 570 | return true; | 564 | return true; |
| 571 | } | 565 | } |
| 572 | 566 | ||
| @@ -828,7 +822,7 @@ bool BufferCache<P>::IsRegionGpuModified(VAddr addr, size_t size) { | |||
| 828 | } | 822 | } |
| 829 | 823 | ||
| 830 | template <class P> | 824 | template <class P> |
| 831 | bool BufferCache<P>::IsRegionRegistered(VAddr addr, size_t size) const { | 825 | bool BufferCache<P>::IsRegionRegistered(VAddr addr, size_t size) { |
| 832 | const VAddr end_addr = addr + size; | 826 | const VAddr end_addr = addr + size; |
| 833 | const u64 page_end = Common::DivCeil(end_addr, PAGE_SIZE); | 827 | const u64 page_end = Common::DivCeil(end_addr, PAGE_SIZE); |
| 834 | for (u64 page = addr >> PAGE_BITS; page < page_end;) { | 828 | for (u64 page = addr >> PAGE_BITS; page < page_end;) { |
diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp index 0ae6692f9..c51776466 100644 --- a/src/video_core/engines/maxwell_dma.cpp +++ b/src/video_core/engines/maxwell_dma.cpp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include "common/assert.h" | 5 | #include "common/assert.h" |
| 6 | #include "common/logging/log.h" | 6 | #include "common/logging/log.h" |
| 7 | #include "common/microprofile.h" | ||
| 7 | #include "common/settings.h" | 8 | #include "common/settings.h" |
| 8 | #include "core/core.h" | 9 | #include "core/core.h" |
| 9 | #include "video_core/engines/maxwell_3d.h" | 10 | #include "video_core/engines/maxwell_3d.h" |
| @@ -12,6 +13,9 @@ | |||
| 12 | #include "video_core/renderer_base.h" | 13 | #include "video_core/renderer_base.h" |
| 13 | #include "video_core/textures/decoders.h" | 14 | #include "video_core/textures/decoders.h" |
| 14 | 15 | ||
| 16 | MICROPROFILE_DECLARE(GPU_DMAEngine); | ||
| 17 | MICROPROFILE_DEFINE(GPU_DMAEngine, "GPU", "DMA Engine", MP_RGB(224, 224, 128)); | ||
| 18 | |||
| 15 | namespace Tegra::Engines { | 19 | namespace Tegra::Engines { |
| 16 | 20 | ||
| 17 | using namespace Texture; | 21 | using namespace Texture; |
| @@ -43,6 +47,7 @@ void MaxwellDMA::CallMultiMethod(u32 method, const u32* base_start, u32 amount, | |||
| 43 | } | 47 | } |
| 44 | 48 | ||
| 45 | void MaxwellDMA::Launch() { | 49 | void MaxwellDMA::Launch() { |
| 50 | MICROPROFILE_SCOPE(GPU_DMAEngine); | ||
| 46 | LOG_TRACE(Render_OpenGL, "DMA copy 0x{:x} -> 0x{:x}", static_cast<GPUVAddr>(regs.offset_in), | 51 | LOG_TRACE(Render_OpenGL, "DMA copy 0x{:x} -> 0x{:x}", static_cast<GPUVAddr>(regs.offset_in), |
| 47 | static_cast<GPUVAddr>(regs.offset_out)); | 52 | static_cast<GPUVAddr>(regs.offset_out)); |
| 48 | 53 | ||
diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp index 2bc97ec30..d2b9d5f2b 100644 --- a/src/video_core/memory_manager.cpp +++ b/src/video_core/memory_manager.cpp | |||
| @@ -327,7 +327,7 @@ void MemoryManager::WriteBlock(GPUVAddr gpu_dest_addr, const void* src_buffer, s | |||
| 327 | 327 | ||
| 328 | // Invalidate must happen on the rasterizer interface, such that memory is always | 328 | // Invalidate must happen on the rasterizer interface, such that memory is always |
| 329 | // synchronous when it is written (even when in asynchronous GPU mode). | 329 | // synchronous when it is written (even when in asynchronous GPU mode). |
| 330 | rasterizer->UnmapMemory(dest_addr, copy_amount); | 330 | rasterizer->InvalidateRegion(dest_addr, copy_amount); |
| 331 | system.Memory().WriteBlockUnsafe(dest_addr, src_buffer, copy_amount); | 331 | system.Memory().WriteBlockUnsafe(dest_addr, src_buffer, copy_amount); |
| 332 | } | 332 | } |
| 333 | 333 | ||