diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/dma_pusher.cpp | 17 | ||||
| -rw-r--r-- | src/video_core/dma_pusher.h | 8 |
2 files changed, 16 insertions, 9 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 | |||
| 91 | void 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 | ||
| 149 | void DmaPusher::SetState(const CommandHeader& command_header) { | 152 | void DmaPusher::SetState(const CommandHeader& command_header) { |
diff --git a/src/video_core/dma_pusher.h b/src/video_core/dma_pusher.h index 938f0f11c..6f00de937 100644 --- a/src/video_core/dma_pusher.h +++ b/src/video_core/dma_pusher.h | |||
| @@ -4,11 +4,13 @@ | |||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <array> | 6 | #include <array> |
| 7 | #include <span> | ||
| 7 | #include <vector> | 8 | #include <vector> |
| 8 | #include <queue> | 9 | #include <queue> |
| 9 | 10 | ||
| 10 | #include "common/bit_field.h" | 11 | #include "common/bit_field.h" |
| 11 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 13 | #include "common/scratch_buffer.h" | ||
| 12 | #include "video_core/engines/engine_interface.h" | 14 | #include "video_core/engines/engine_interface.h" |
| 13 | #include "video_core/engines/puller.h" | 15 | #include "video_core/engines/puller.h" |
| 14 | 16 | ||
| @@ -136,13 +138,15 @@ private: | |||
| 136 | static constexpr u32 non_puller_methods = 0x40; | 138 | static constexpr u32 non_puller_methods = 0x40; |
| 137 | static constexpr u32 max_subchannels = 8; | 139 | static constexpr u32 max_subchannels = 8; |
| 138 | bool Step(); | 140 | bool Step(); |
| 141 | void ProcessCommands(std::span<const CommandHeader> commands); | ||
| 139 | 142 | ||
| 140 | void SetState(const CommandHeader& command_header); | 143 | void SetState(const CommandHeader& command_header); |
| 141 | 144 | ||
| 142 | void CallMethod(u32 argument) const; | 145 | void CallMethod(u32 argument) const; |
| 143 | void CallMultiMethod(const u32* base_start, u32 num_methods) const; | 146 | void CallMultiMethod(const u32* base_start, u32 num_methods) const; |
| 144 | 147 | ||
| 145 | std::vector<CommandHeader> command_headers; ///< Buffer for list of commands fetched at once | 148 | Common::ScratchBuffer<CommandHeader> |
| 149 | command_headers; ///< Buffer for list of commands fetched at once | ||
| 146 | 150 | ||
| 147 | std::queue<CommandList> dma_pushbuffer; ///< Queue of command lists to be processed | 151 | std::queue<CommandList> dma_pushbuffer; ///< Queue of command lists to be processed |
| 148 | std::size_t dma_pushbuffer_subindex{}; ///< Index within a command list within the pushbuffer | 152 | std::size_t dma_pushbuffer_subindex{}; ///< Index within a command list within the pushbuffer |
| @@ -159,7 +163,7 @@ private: | |||
| 159 | DmaState dma_state{}; | 163 | DmaState dma_state{}; |
| 160 | bool dma_increment_once{}; | 164 | bool dma_increment_once{}; |
| 161 | 165 | ||
| 162 | bool ib_enable{true}; ///< IB mode enabled | 166 | const bool ib_enable{true}; ///< IB mode enabled |
| 163 | 167 | ||
| 164 | std::array<Engines::EngineInterface*, max_subchannels> subchannels{}; | 168 | std::array<Engines::EngineInterface*, max_subchannels> subchannels{}; |
| 165 | 169 | ||