diff options
| author | 2023-05-29 00:35:51 +0100 | |
|---|---|---|
| committer | 2023-07-02 23:09:48 +0100 | |
| commit | 6f7cb69c94bef0795f054d881e061745f69d1eda (patch) | |
| tree | cc0bec2fed92a5645886dde773add00c84d8b9f4 /src/video_core/dma_pusher.cpp | |
| parent | Merge pull request #10998 from Morph1984/qt-stop-messing-with-me (diff) | |
| download | yuzu-6f7cb69c94bef0795f054d881e061745f69d1eda.tar.gz yuzu-6f7cb69c94bef0795f054d881e061745f69d1eda.tar.xz yuzu-6f7cb69c94bef0795f054d881e061745f69d1eda.zip | |
Use spans over guest memory where possible instead of copying data.
Diffstat (limited to 'src/video_core/dma_pusher.cpp')
| -rw-r--r-- | src/video_core/dma_pusher.cpp | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/video_core/dma_pusher.cpp b/src/video_core/dma_pusher.cpp index 551929824..9f1b340a9 100644 --- a/src/video_core/dma_pusher.cpp +++ b/src/video_core/dma_pusher.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include "common/microprofile.h" | 5 | #include "common/microprofile.h" |
| 6 | #include "common/settings.h" | 6 | #include "common/settings.h" |
| 7 | #include "core/core.h" | 7 | #include "core/core.h" |
| 8 | #include "core/memory.h" | ||
| 8 | #include "video_core/dma_pusher.h" | 9 | #include "video_core/dma_pusher.h" |
| 9 | #include "video_core/engines/maxwell_3d.h" | 10 | #include "video_core/engines/maxwell_3d.h" |
| 10 | #include "video_core/gpu.h" | 11 | #include "video_core/gpu.h" |
| @@ -12,6 +13,8 @@ | |||
| 12 | 13 | ||
| 13 | namespace Tegra { | 14 | namespace Tegra { |
| 14 | 15 | ||
| 16 | constexpr u32 MacroRegistersStart = 0xE00; | ||
| 17 | |||
| 15 | DmaPusher::DmaPusher(Core::System& system_, GPU& gpu_, MemoryManager& memory_manager_, | 18 | DmaPusher::DmaPusher(Core::System& system_, GPU& gpu_, MemoryManager& memory_manager_, |
| 16 | Control::ChannelState& channel_state_) | 19 | Control::ChannelState& channel_state_) |
| 17 | : gpu{gpu_}, system{system_}, memory_manager{memory_manager_}, puller{gpu_, memory_manager_, | 20 | : gpu{gpu_}, system{system_}, memory_manager{memory_manager_}, puller{gpu_, memory_manager_, |
| @@ -74,25 +77,16 @@ bool DmaPusher::Step() { | |||
| 74 | } | 77 | } |
| 75 | 78 | ||
| 76 | // Push buffer non-empty, read a word | 79 | // Push buffer non-empty, read a word |
| 77 | command_headers.resize_destructive(command_list_header.size); | 80 | if (dma_state.method >= MacroRegistersStart) { |
| 78 | constexpr u32 MacroRegistersStart = 0xE00; | ||
| 79 | if (dma_state.method < MacroRegistersStart) { | ||
| 80 | if (Settings::IsGPULevelHigh()) { | ||
| 81 | memory_manager.ReadBlock(dma_state.dma_get, command_headers.data(), | ||
| 82 | command_list_header.size * sizeof(u32)); | ||
| 83 | } else { | ||
| 84 | memory_manager.ReadBlockUnsafe(dma_state.dma_get, command_headers.data(), | ||
| 85 | command_list_header.size * sizeof(u32)); | ||
| 86 | } | ||
| 87 | } else { | ||
| 88 | const size_t copy_size = command_list_header.size * sizeof(u32); | ||
| 89 | if (subchannels[dma_state.subchannel]) { | 81 | if (subchannels[dma_state.subchannel]) { |
| 90 | subchannels[dma_state.subchannel]->current_dirty = | 82 | subchannels[dma_state.subchannel]->current_dirty = memory_manager.IsMemoryDirty( |
| 91 | memory_manager.IsMemoryDirty(dma_state.dma_get, copy_size); | 83 | dma_state.dma_get, command_list_header.size * sizeof(u32)); |
| 92 | } | 84 | } |
| 93 | memory_manager.ReadBlockUnsafe(dma_state.dma_get, command_headers.data(), copy_size); | ||
| 94 | } | 85 | } |
| 95 | ProcessCommands(command_headers); | 86 | Core::Memory::GpuGuestMemory<Tegra::CommandHeader, |
| 87 | Core::Memory::GuestMemoryFlags::UnsafeRead> | ||
| 88 | headers(memory_manager, dma_state.dma_get, command_list_header.size, &command_headers); | ||
| 89 | ProcessCommands(headers); | ||
| 96 | } | 90 | } |
| 97 | 91 | ||
| 98 | return true; | 92 | return true; |