summaryrefslogtreecommitdiff
path: root/src/video_core/dma_pusher.cpp
diff options
context:
space:
mode:
authorGravatar ameerj2022-12-07 00:45:06 -0500
committerGravatar ameerj2022-12-19 18:08:04 -0500
commit61e4f2d931449e60d8d720862997ac565fce6634 (patch)
tree9bb7071fdf11dbe8a86d25c7f819c66d5dc127f4 /src/video_core/dma_pusher.cpp
parentbuffer_cache: Use Common::ScratchBuffer for ImmediateBuffer usage (diff)
downloadyuzu-61e4f2d931449e60d8d720862997ac565fce6634.tar.gz
yuzu-61e4f2d931449e60d8d720862997ac565fce6634.tar.xz
yuzu-61e4f2d931449e60d8d720862997ac565fce6634.zip
dma_pusher: Rework command_headers usage
Uses ScratchBuffer and avoids overwriting the command_headers buffer with the prefetch_command_list
Diffstat (limited to 'src/video_core/dma_pusher.cpp')
-rw-r--r--src/video_core/dma_pusher.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/video_core/dma_pusher.cpp b/src/video_core/dma_pusher.cpp
index 9835e3ac1..d1f541bf5 100644
--- a/src/video_core/dma_pusher.cpp
+++ b/src/video_core/dma_pusher.cpp
@@ -56,7 +56,7 @@ bool DmaPusher::Step() {
56 56
57 if (command_list.prefetch_command_list.size()) { 57 if (command_list.prefetch_command_list.size()) {
58 // Prefetched command list from nvdrv, used for things like synchronization 58 // Prefetched command list from nvdrv, used for things like synchronization
59 command_headers = std::move(command_list.prefetch_command_list); 59 ProcessCommands(command_list.prefetch_command_list);
60 dma_pushbuffer.pop(); 60 dma_pushbuffer.pop();
61 } else { 61 } else {
62 const CommandListHeader command_list_header{ 62 const CommandListHeader command_list_header{
@@ -82,16 +82,21 @@ bool DmaPusher::Step() {
82 memory_manager.ReadBlockUnsafe(dma_get, command_headers.data(), 82 memory_manager.ReadBlockUnsafe(dma_get, command_headers.data(),
83 command_list_header.size * sizeof(u32)); 83 command_list_header.size * sizeof(u32));
84 } 84 }
85 ProcessCommands(command_headers);
85 } 86 }
86 for (std::size_t index = 0; index < command_headers.size();) { 87
87 const CommandHeader& command_header = command_headers[index]; 88 return true;
89}
90
91void DmaPusher::ProcessCommands(std::span<const CommandHeader> commands) {
92 for (std::size_t index = 0; index < commands.size();) {
93 const CommandHeader& command_header = commands[index];
88 94
89 if (dma_state.method_count) { 95 if (dma_state.method_count) {
90 // Data word of methods command 96 // Data word of methods command
91 if (dma_state.non_incrementing) { 97 if (dma_state.non_incrementing) {
92 const u32 max_write = static_cast<u32>( 98 const u32 max_write = static_cast<u32>(
93 std::min<std::size_t>(index + dma_state.method_count, command_headers.size()) - 99 std::min<std::size_t>(index + dma_state.method_count, commands.size()) - index);
94 index);
95 CallMultiMethod(&command_header.argument, max_write); 100 CallMultiMethod(&command_header.argument, max_write);
96 dma_state.method_count -= max_write; 101 dma_state.method_count -= max_write;
97 dma_state.is_last_call = true; 102 dma_state.is_last_call = true;
@@ -142,8 +147,6 @@ bool DmaPusher::Step() {
142 } 147 }
143 index++; 148 index++;
144 } 149 }
145
146 return true;
147} 150}
148 151
149void DmaPusher::SetState(const CommandHeader& command_header) { 152void DmaPusher::SetState(const CommandHeader& command_header) {