DMAPusher: Propagate multimethod writes into the engines.

This commit is contained in:
Fernando Sahmkow 2020-04-20 02:16:56 -04:00
parent eb26e9e711
commit 3fedcc2f6e
14 changed files with 163 additions and 13 deletions

View file

@ -71,16 +71,22 @@ bool DmaPusher::Step() {
gpu.MemoryManager().ReadBlockUnsafe(dma_get, command_headers.data(),
command_list_header.size * sizeof(u32));
for (const CommandHeader& command_header : command_headers) {
for (std::size_t index = 0; index < command_headers.size();) {
const CommandHeader& command_header = command_headers[index];
// now, see if we're in the middle of a command
if (dma_state.length_pending) {
// Second word of long non-inc methods command - method count
dma_state.length_pending = 0;
dma_state.method_count = command_header.method_count_;
} else if (dma_state.method_count) {
if (dma_state.method_count) {
// Data word of methods command
CallMethod(command_header.argument);
if (dma_state.non_incrementing) {
const u32 max_write = static_cast<u32>(
std::min<std::size_t>(index + dma_state.method_count, command_headers.size()) -
index);
CallMultiMethod(&command_header.argument, max_write);
dma_state.method_count -= max_write;
index += max_write;
continue;
} else {
CallMethod(command_header.argument);
}
if (!dma_state.non_incrementing) {
dma_state.method++;
@ -120,6 +126,7 @@ bool DmaPusher::Step() {
break;
}
}
index++;
}
if (!non_main) {
@ -140,4 +147,9 @@ void DmaPusher::CallMethod(u32 argument) const {
gpu.CallMethod({dma_state.method, argument, dma_state.subchannel, dma_state.method_count});
}
void DmaPusher::CallMultiMethod(const u32* base_start, u32 num_methods) const {
gpu.CallMultiMethod(dma_state.method, dma_state.subchannel, base_start, num_methods,
dma_state.method_count);
}
} // namespace Tegra