diff options
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 18 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_dma.cpp | 18 | ||||
| -rw-r--r-- | src/video_core/engines/puller.cpp | 18 |
3 files changed, 22 insertions, 32 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 632052c53..3c6e44a25 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -453,18 +453,10 @@ void Maxwell3D::ProcessFirmwareCall4() { | |||
| 453 | } | 453 | } |
| 454 | 454 | ||
| 455 | void Maxwell3D::StampQueryResult(u64 payload, bool long_query) { | 455 | void Maxwell3D::StampQueryResult(u64 payload, bool long_query) { |
| 456 | struct LongQueryResult { | ||
| 457 | u64_le value; | ||
| 458 | u64_le timestamp; | ||
| 459 | }; | ||
| 460 | static_assert(sizeof(LongQueryResult) == 16, "LongQueryResult has wrong size"); | ||
| 461 | const GPUVAddr sequence_address{regs.query.QueryAddress()}; | 456 | const GPUVAddr sequence_address{regs.query.QueryAddress()}; |
| 462 | if (long_query) { | 457 | if (long_query) { |
| 463 | // Write the 128-bit result structure in long mode. Note: We emulate an infinitely fast | 458 | memory_manager.Write<u64>(sequence_address + sizeof(u64), system.GPU().GetTicks()); |
| 464 | // GPU, this command may actually take a while to complete in real hardware due to GPU | 459 | memory_manager.Write<u64>(sequence_address, payload); |
| 465 | // wait queues. | ||
| 466 | LongQueryResult query_result{payload, system.GPU().GetTicks()}; | ||
| 467 | memory_manager.WriteBlock(sequence_address, &query_result, sizeof(query_result)); | ||
| 468 | } else { | 460 | } else { |
| 469 | memory_manager.Write<u32>(sequence_address, static_cast<u32>(payload)); | 461 | memory_manager.Write<u32>(sequence_address, static_cast<u32>(payload)); |
| 470 | } | 462 | } |
| @@ -493,10 +485,10 @@ void Maxwell3D::ProcessQueryGet() { | |||
| 493 | const GPUVAddr sequence_address{regs.query.QueryAddress()}; | 485 | const GPUVAddr sequence_address{regs.query.QueryAddress()}; |
| 494 | const u32 payload = regs.query.query_sequence; | 486 | const u32 payload = regs.query.query_sequence; |
| 495 | std::function<void()> operation([this, sequence_address, payload] { | 487 | std::function<void()> operation([this, sequence_address, payload] { |
| 496 | LongQueryResult query_result{payload, system.GPU().GetTicks()}; | 488 | memory_manager.Write<u64>(sequence_address + sizeof(u64), system.GPU().GetTicks()); |
| 497 | memory_manager.WriteBlock(sequence_address, &query_result, sizeof(query_result)); | 489 | memory_manager.Write<u64>(sequence_address, payload); |
| 498 | }); | 490 | }); |
| 499 | rasterizer->SignalFence(std::move(operation)); | 491 | rasterizer->SyncOperation(std::move(operation)); |
| 500 | } | 492 | } |
| 501 | break; | 493 | break; |
| 502 | case Regs::QueryOperation::Acquire: | 494 | case Regs::QueryOperation::Acquire: |
diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp index a12a95ce2..bcffd1862 100644 --- a/src/video_core/engines/maxwell_dma.cpp +++ b/src/video_core/engines/maxwell_dma.cpp | |||
| @@ -274,16 +274,24 @@ void MaxwellDMA::FastCopyBlockLinearToPitch() { | |||
| 274 | void MaxwellDMA::ReleaseSemaphore() { | 274 | void MaxwellDMA::ReleaseSemaphore() { |
| 275 | const auto type = regs.launch_dma.semaphore_type; | 275 | const auto type = regs.launch_dma.semaphore_type; |
| 276 | const GPUVAddr address = regs.semaphore.address; | 276 | const GPUVAddr address = regs.semaphore.address; |
| 277 | const u32 payload = regs.semaphore.payload; | ||
| 277 | switch (type) { | 278 | switch (type) { |
| 278 | case LaunchDMA::SemaphoreType::NONE: | 279 | case LaunchDMA::SemaphoreType::NONE: |
| 279 | break; | 280 | break; |
| 280 | case LaunchDMA::SemaphoreType::RELEASE_ONE_WORD_SEMAPHORE: | 281 | case LaunchDMA::SemaphoreType::RELEASE_ONE_WORD_SEMAPHORE: { |
| 281 | memory_manager.Write<u32>(address, regs.semaphore.payload); | 282 | std::function<void()> operation( |
| 283 | [this, address, payload] { memory_manager.Write<u32>(address, payload); }); | ||
| 284 | rasterizer->SignalFence(std::move(operation)); | ||
| 282 | break; | 285 | break; |
| 283 | case LaunchDMA::SemaphoreType::RELEASE_FOUR_WORD_SEMAPHORE: | 286 | } |
| 284 | memory_manager.Write<u64>(address, static_cast<u64>(regs.semaphore.payload)); | 287 | case LaunchDMA::SemaphoreType::RELEASE_FOUR_WORD_SEMAPHORE: { |
| 285 | memory_manager.Write<u64>(address + 8, system.GPU().GetTicks()); | 288 | std::function<void()> operation([this, address, payload] { |
| 289 | memory_manager.Write<u64>(address + sizeof(u64), system.GPU().GetTicks()); | ||
| 290 | memory_manager.Write<u64>(address, payload); | ||
| 291 | }); | ||
| 292 | rasterizer->SignalFence(std::move(operation)); | ||
| 286 | break; | 293 | break; |
| 294 | } | ||
| 287 | default: | 295 | default: |
| 288 | ASSERT_MSG(false, "Unknown semaphore type: {}", static_cast<u32>(type.Value())); | 296 | ASSERT_MSG(false, "Unknown semaphore type: {}", static_cast<u32>(type.Value())); |
| 289 | } | 297 | } |
diff --git a/src/video_core/engines/puller.cpp b/src/video_core/engines/puller.cpp index dd9494efa..c3ed11c13 100644 --- a/src/video_core/engines/puller.cpp +++ b/src/video_core/engines/puller.cpp | |||
| @@ -59,6 +59,7 @@ void Puller::ProcessFenceActionMethod() { | |||
| 59 | case Puller::FenceOperation::Acquire: | 59 | case Puller::FenceOperation::Acquire: |
| 60 | // UNIMPLEMENTED_MSG("Channel Scheduling pending."); | 60 | // UNIMPLEMENTED_MSG("Channel Scheduling pending."); |
| 61 | // WaitFence(regs.fence_action.syncpoint_id, regs.fence_value); | 61 | // WaitFence(regs.fence_action.syncpoint_id, regs.fence_value); |
| 62 | rasterizer->ReleaseFences(); | ||
| 62 | break; | 63 | break; |
| 63 | case Puller::FenceOperation::Increment: | 64 | case Puller::FenceOperation::Increment: |
| 64 | rasterizer->SignalSyncPoint(regs.fence_action.syncpoint_id); | 65 | rasterizer->SignalSyncPoint(regs.fence_action.syncpoint_id); |
| @@ -73,19 +74,11 @@ void Puller::ProcessSemaphoreTriggerMethod() { | |||
| 73 | const auto op = | 74 | const auto op = |
| 74 | static_cast<GpuSemaphoreOperation>(regs.semaphore_trigger & semaphoreOperationMask); | 75 | static_cast<GpuSemaphoreOperation>(regs.semaphore_trigger & semaphoreOperationMask); |
| 75 | if (op == GpuSemaphoreOperation::WriteLong) { | 76 | if (op == GpuSemaphoreOperation::WriteLong) { |
| 76 | struct Block { | ||
| 77 | u32 sequence; | ||
| 78 | u32 zeros = 0; | ||
| 79 | u64 timestamp; | ||
| 80 | }; | ||
| 81 | |||
| 82 | const GPUVAddr sequence_address{regs.semaphore_address.SemaphoreAddress()}; | 77 | const GPUVAddr sequence_address{regs.semaphore_address.SemaphoreAddress()}; |
| 83 | const u32 payload = regs.semaphore_sequence; | 78 | const u32 payload = regs.semaphore_sequence; |
| 84 | std::function<void()> operation([this, sequence_address, payload] { | 79 | std::function<void()> operation([this, sequence_address, payload] { |
| 85 | Block block{}; | 80 | memory_manager.Write<u64>(sequence_address + sizeof(u64), gpu.GetTicks()); |
| 86 | block.sequence = payload; | 81 | memory_manager.Write<u64>(sequence_address, payload); |
| 87 | block.timestamp = gpu.GetTicks(); | ||
| 88 | memory_manager.WriteBlock(sequence_address, &block, sizeof(block)); | ||
| 89 | }); | 82 | }); |
| 90 | rasterizer->SignalFence(std::move(operation)); | 83 | rasterizer->SignalFence(std::move(operation)); |
| 91 | } else { | 84 | } else { |
| @@ -98,7 +91,6 @@ void Puller::ProcessSemaphoreTriggerMethod() { | |||
| 98 | regs.acquire_mode = false; | 91 | regs.acquire_mode = false; |
| 99 | if (word != regs.acquire_value) { | 92 | if (word != regs.acquire_value) { |
| 100 | rasterizer->ReleaseFences(); | 93 | rasterizer->ReleaseFences(); |
| 101 | std::this_thread::sleep_for(std::chrono::milliseconds(1)); | ||
| 102 | continue; | 94 | continue; |
| 103 | } | 95 | } |
| 104 | } else if (op == GpuSemaphoreOperation::AcquireGequal) { | 96 | } else if (op == GpuSemaphoreOperation::AcquireGequal) { |
| @@ -106,13 +98,11 @@ void Puller::ProcessSemaphoreTriggerMethod() { | |||
| 106 | regs.acquire_mode = true; | 98 | regs.acquire_mode = true; |
| 107 | if (word < regs.acquire_value) { | 99 | if (word < regs.acquire_value) { |
| 108 | rasterizer->ReleaseFences(); | 100 | rasterizer->ReleaseFences(); |
| 109 | std::this_thread::sleep_for(std::chrono::milliseconds(1)); | ||
| 110 | continue; | 101 | continue; |
| 111 | } | 102 | } |
| 112 | } else if (op == GpuSemaphoreOperation::AcquireMask) { | 103 | } else if (op == GpuSemaphoreOperation::AcquireMask) { |
| 113 | if (word && regs.semaphore_sequence == 0) { | 104 | if (word && regs.semaphore_sequence == 0) { |
| 114 | rasterizer->ReleaseFences(); | 105 | rasterizer->ReleaseFences(); |
| 115 | std::this_thread::sleep_for(std::chrono::milliseconds(1)); | ||
| 116 | continue; | 106 | continue; |
| 117 | } | 107 | } |
| 118 | } else { | 108 | } else { |
| @@ -128,7 +118,7 @@ void Puller::ProcessSemaphoreRelease() { | |||
| 128 | std::function<void()> operation([this, sequence_address, payload] { | 118 | std::function<void()> operation([this, sequence_address, payload] { |
| 129 | memory_manager.Write<u32>(sequence_address, payload); | 119 | memory_manager.Write<u32>(sequence_address, payload); |
| 130 | }); | 120 | }); |
| 131 | rasterizer->SignalFence(std::move(operation)); | 121 | rasterizer->SyncOperation(std::move(operation)); |
| 132 | } | 122 | } |
| 133 | 123 | ||
| 134 | void Puller::ProcessSemaphoreAcquire() { | 124 | void Puller::ProcessSemaphoreAcquire() { |