summaryrefslogtreecommitdiff
path: root/src/video_core/dma_pusher.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/dma_pusher.cpp')
-rw-r--r--src/video_core/dma_pusher.cpp56
1 files changed, 33 insertions, 23 deletions
diff --git a/src/video_core/dma_pusher.cpp b/src/video_core/dma_pusher.cpp
index f2f96ac33..9c49c6153 100644
--- a/src/video_core/dma_pusher.cpp
+++ b/src/video_core/dma_pusher.cpp
@@ -45,32 +45,42 @@ bool DmaPusher::Step() {
45 return false; 45 return false;
46 } 46 }
47 47
48 const CommandList& command_list{dma_pushbuffer.front()}; 48 CommandList& command_list{dma_pushbuffer.front()};
49 ASSERT_OR_EXECUTE(!command_list.empty(), { 49
50 // Somehow the command_list is empty, in order to avoid a crash 50 ASSERT_OR_EXECUTE(
51 // We ignore it and assume its size is 0. 51 command_list.command_lists.size() || command_list.prefetch_command_list.size(), {
52 // Somehow the command_list is empty, in order to avoid a crash
53 // We ignore it and assume its size is 0.
54 dma_pushbuffer.pop();
55 dma_pushbuffer_subindex = 0;
56 return true;
57 });
58
59 if (command_list.prefetch_command_list.size()) {
60 // Prefetched command list from nvdrv, used for things like synchronization
61 command_headers = std::move(command_list.prefetch_command_list);
52 dma_pushbuffer.pop(); 62 dma_pushbuffer.pop();
53 dma_pushbuffer_subindex = 0; 63 } else {
54 return true; 64 const CommandListHeader command_list_header{
55 }); 65 command_list.command_lists[dma_pushbuffer_subindex]};
56 const CommandListHeader command_list_header{command_list[dma_pushbuffer_subindex++]}; 66 const u64 next_hash = command_list.command_list_hashes[dma_pushbuffer_subindex++];
57 const GPUVAddr dma_get = command_list_header.addr; 67 const GPUVAddr dma_get = command_list_header.addr;
58 68
59 if (dma_pushbuffer_subindex >= command_list.size()) { 69 if (dma_pushbuffer_subindex >= command_list.command_lists.size()) {
60 // We've gone through the current list, remove it from the queue 70 // We've gone through the current list, remove it from the queue
61 dma_pushbuffer.pop(); 71 dma_pushbuffer.pop();
62 dma_pushbuffer_subindex = 0; 72 dma_pushbuffer_subindex = 0;
63 } 73 }
64
65 if (command_list_header.size == 0) {
66 return true;
67 }
68 74
69 // Push buffer non-empty, read a word 75 if (command_list_header.size == 0) {
70 command_headers.resize(command_list_header.size); 76 return true;
71 gpu.MemoryManager().ReadBlockUnsafe(dma_get, command_headers.data(), 77 }
72 command_list_header.size * sizeof(u32));
73 78
79 // Push buffer non-empty, read a word
80 command_headers.resize(command_list_header.size);
81 gpu.MemoryManager().ReadBlockUnsafe(dma_get, command_headers.data(),
82 command_list_header.size * sizeof(u32));
83 }
74 for (std::size_t index = 0; index < command_headers.size();) { 84 for (std::size_t index = 0; index < command_headers.size();) {
75 const CommandHeader& command_header = command_headers[index]; 85 const CommandHeader& command_header = command_headers[index];
76 86