|
|
|
@ -45,32 +45,42 @@ bool DmaPusher::Step() { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
const CommandList& command_list{dma_pushbuffer.front()}; |
|
|
|
ASSERT_OR_EXECUTE(!command_list.empty(), { |
|
|
|
// Somehow the command_list is empty, in order to avoid a crash
|
|
|
|
// We ignore it and assume its size is 0.
|
|
|
|
CommandList& command_list{dma_pushbuffer.front()}; |
|
|
|
|
|
|
|
ASSERT_OR_EXECUTE( |
|
|
|
command_list.command_lists.size() || command_list.prefetch_command_list.size(), { |
|
|
|
// Somehow the command_list is empty, in order to avoid a crash
|
|
|
|
// We ignore it and assume its size is 0.
|
|
|
|
dma_pushbuffer.pop(); |
|
|
|
dma_pushbuffer_subindex = 0; |
|
|
|
return true; |
|
|
|
}); |
|
|
|
|
|
|
|
if (command_list.prefetch_command_list.size()) { |
|
|
|
// Prefetched command list from nvdrv, used for things like synchronization
|
|
|
|
command_headers = std::move(command_list.prefetch_command_list); |
|
|
|
dma_pushbuffer.pop(); |
|
|
|
dma_pushbuffer_subindex = 0; |
|
|
|
return true; |
|
|
|
}); |
|
|
|
const CommandListHeader command_list_header{command_list[dma_pushbuffer_subindex++]}; |
|
|
|
const GPUVAddr dma_get = command_list_header.addr; |
|
|
|
|
|
|
|
if (dma_pushbuffer_subindex >= command_list.size()) { |
|
|
|
// We've gone through the current list, remove it from the queue
|
|
|
|
dma_pushbuffer.pop(); |
|
|
|
dma_pushbuffer_subindex = 0; |
|
|
|
} |
|
|
|
|
|
|
|
if (command_list_header.size == 0) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
} else { |
|
|
|
const CommandListHeader command_list_header{ |
|
|
|
command_list.command_lists[dma_pushbuffer_subindex]}; |
|
|
|
const u64 next_hash = command_list.command_list_hashes[dma_pushbuffer_subindex++]; |
|
|
|
const GPUVAddr dma_get = command_list_header.addr; |
|
|
|
|
|
|
|
if (dma_pushbuffer_subindex >= command_list.command_lists.size()) { |
|
|
|
// We've gone through the current list, remove it from the queue
|
|
|
|
dma_pushbuffer.pop(); |
|
|
|
dma_pushbuffer_subindex = 0; |
|
|
|
} |
|
|
|
|
|
|
|
// Push buffer non-empty, read a word
|
|
|
|
command_headers.resize(command_list_header.size); |
|
|
|
gpu.MemoryManager().ReadBlockUnsafe(dma_get, command_headers.data(), |
|
|
|
command_list_header.size * sizeof(u32)); |
|
|
|
if (command_list_header.size == 0) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
// Push buffer non-empty, read a word
|
|
|
|
command_headers.resize(command_list_header.size); |
|
|
|
gpu.MemoryManager().ReadBlockUnsafe(dma_get, command_headers.data(), |
|
|
|
command_list_header.size * sizeof(u32)); |
|
|
|
} |
|
|
|
for (std::size_t index = 0; index < command_headers.size();) { |
|
|
|
const CommandHeader& command_header = command_headers[index]; |
|
|
|
|
|
|
|
|