1
1
Fork 0
forked from suyu/suyu

Merge pull request #7930 from asLody/dma-semaphore

MaxwellDMA: Implement semaphore operations
This commit is contained in:
Fernando S 2022-03-07 21:53:38 +01:00 committed by GitHub
commit 58b52f4884
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View file

@ -53,7 +53,6 @@ void MaxwellDMA::Launch() {
// TODO(Subv): Perform more research and implement all features of this engine. // TODO(Subv): Perform more research and implement all features of this engine.
const LaunchDMA& launch = regs.launch_dma; const LaunchDMA& launch = regs.launch_dma;
ASSERT(launch.semaphore_type == LaunchDMA::SemaphoreType::NONE);
ASSERT(launch.interrupt_type == LaunchDMA::InterruptType::NONE); ASSERT(launch.interrupt_type == LaunchDMA::InterruptType::NONE);
ASSERT(launch.data_transfer_type == LaunchDMA::DataTransferType::NON_PIPELINED); ASSERT(launch.data_transfer_type == LaunchDMA::DataTransferType::NON_PIPELINED);
ASSERT(regs.dst_params.origin.x == 0); ASSERT(regs.dst_params.origin.x == 0);
@ -79,6 +78,7 @@ void MaxwellDMA::Launch() {
CopyPitchToBlockLinear(); CopyPitchToBlockLinear();
} }
} }
ReleaseSemaphore();
} }
void MaxwellDMA::CopyPitchToPitch() { void MaxwellDMA::CopyPitchToPitch() {
@ -244,4 +244,22 @@ void MaxwellDMA::FastCopyBlockLinearToPitch() {
memory_manager.WriteBlock(regs.offset_out, write_buffer.data(), dst_size); memory_manager.WriteBlock(regs.offset_out, write_buffer.data(), dst_size);
} }
void MaxwellDMA::ReleaseSemaphore() {
const auto type = regs.launch_dma.semaphore_type;
const GPUVAddr address = regs.semaphore.address;
switch (type) {
case LaunchDMA::SemaphoreType::NONE:
break;
case LaunchDMA::SemaphoreType::RELEASE_ONE_WORD_SEMAPHORE:
memory_manager.Write<u32>(address, regs.semaphore.payload);
break;
case LaunchDMA::SemaphoreType::RELEASE_FOUR_WORD_SEMAPHORE:
memory_manager.Write<u64>(address, static_cast<u64>(regs.semaphore.payload));
memory_manager.Write<u64>(address + 8, system.GPU().GetTicks());
break;
default:
UNREACHABLE_MSG("Unknown semaphore type: {}", static_cast<u32>(type.Value()));
}
}
} // namespace Tegra::Engines } // namespace Tegra::Engines

View file

@ -224,6 +224,8 @@ private:
void FastCopyBlockLinearToPitch(); void FastCopyBlockLinearToPitch();
void ReleaseSemaphore();
Core::System& system; Core::System& system;
MemoryManager& memory_manager; MemoryManager& memory_manager;