From 8d5463ef28f25fbe3d3a3b7e2c740b6a84ec72c9 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Wed, 19 Jan 2022 20:23:10 +0000 Subject: [PATCH] Drop engine base class usage from GPFIFO This class does nothing since we made stopped GPFIFO submits from using virtual functions so it can be dropped. --- app/src/main/cpp/skyline/soc/gm20b/channel.cpp | 4 ---- app/src/main/cpp/skyline/soc/gm20b/channel.h | 4 ---- app/src/main/cpp/skyline/soc/gm20b/engines/gpfifo.cpp | 8 ++++---- app/src/main/cpp/skyline/soc/gm20b/engines/gpfifo.h | 7 ++++--- app/src/main/cpp/skyline/soc/gm20b/gpfifo.cpp | 4 ++-- 5 files changed, 10 insertions(+), 17 deletions(-) diff --git a/app/src/main/cpp/skyline/soc/gm20b/channel.cpp b/app/src/main/cpp/skyline/soc/gm20b/channel.cpp index 73622af4..b19350f7 100644 --- a/app/src/main/cpp/skyline/soc/gm20b/channel.cpp +++ b/app/src/main/cpp/skyline/soc/gm20b/channel.cpp @@ -6,11 +6,7 @@ namespace skyline::soc::gm20b { ChannelContext::ChannelContext(const DeviceState &state, std::shared_ptr asCtx, size_t numEntries) : - fermi2D(state), - keplerMemory(state), maxwell3D(std::make_unique(state, *this, executor)), - maxwellCompute(state), - maxwellDma(state), gpfifo(state, *this, numEntries), executor(state), asCtx(std::move(asCtx)){} diff --git a/app/src/main/cpp/skyline/soc/gm20b/channel.h b/app/src/main/cpp/skyline/soc/gm20b/channel.h index e6d9b4db..36c83291 100644 --- a/app/src/main/cpp/skyline/soc/gm20b/channel.h +++ b/app/src/main/cpp/skyline/soc/gm20b/channel.h @@ -21,11 +21,7 @@ namespace skyline::soc::gm20b { struct ChannelContext { std::shared_ptr asCtx; gpu::interconnect::CommandExecutor executor; - engine::Engine fermi2D; std::unique_ptr maxwell3D; //!< TODO: fix this once graphics context is moved into a cpp file - engine::Engine maxwellCompute; - engine::Engine maxwellDma; - engine::Engine keplerMemory; ChannelGpfifo gpfifo; ChannelContext(const DeviceState &state, std::shared_ptr asCtx, size_t numEntries); diff --git a/app/src/main/cpp/skyline/soc/gm20b/engines/gpfifo.cpp b/app/src/main/cpp/skyline/soc/gm20b/engines/gpfifo.cpp index 28d567a3..cc35a2f0 100644 --- a/app/src/main/cpp/skyline/soc/gm20b/engines/gpfifo.cpp +++ b/app/src/main/cpp/skyline/soc/gm20b/engines/gpfifo.cpp @@ -6,9 +6,9 @@ #include "gpfifo.h" namespace skyline::soc::gm20b::engine { - GPFIFO::GPFIFO(const DeviceState &state, ChannelContext &channelCtx) : Engine(state), channelCtx(channelCtx) {} + GPFIFO::GPFIFO(host1x::SyncpointSet &syncpoints, ChannelContext &channelCtx) : syncpoints(syncpoints), channelCtx(channelCtx) {} - void GPFIFO::CallMethod(u32 method, u32 argument, bool lastCall) { + void GPFIFO::CallMethod(u32 method, u32 argument) { Logger::Debug("Called method in GPFIFO: 0x{:X} args: 0x{:X}", method, argument); registers.raw[method] = argument; @@ -29,12 +29,12 @@ namespace skyline::soc::gm20b::engine { if (action.operation == Registers::SyncpointOperation::Incr) { Logger::Debug("Increment syncpoint: {}", +action.index); channelCtx.executor.Execute(); - state.soc->host1x.syncpoints.at(action.index).Increment(); + syncpoints.at(action.index).Increment(); } else if (action.operation == Registers::SyncpointOperation::Wait) { Logger::Debug("Wait syncpoint: {}, thresh: {}", +action.index, registers.syncpoint.payload); // Wait forever for another channel to increment - state.soc->host1x.syncpoints.at(action.index).Wait(registers.syncpoint.payload, std::chrono::steady_clock::duration::max()); + syncpoints.at(action.index).Wait(registers.syncpoint.payload, std::chrono::steady_clock::duration::max()); } }) } diff --git a/app/src/main/cpp/skyline/soc/gm20b/engines/gpfifo.h b/app/src/main/cpp/skyline/soc/gm20b/engines/gpfifo.h index 9febd253..c3889862 100644 --- a/app/src/main/cpp/skyline/soc/gm20b/engines/gpfifo.h +++ b/app/src/main/cpp/skyline/soc/gm20b/engines/gpfifo.h @@ -14,7 +14,7 @@ namespace skyline::soc::gm20b::engine { * @brief The GPFIFO engine handles managing macros and semaphores * @url https://github.com/NVIDIA/open-gpu-doc/blob/ab27fc22db5de0d02a4cabe08e555663b62db4d4/manuals/volta/gv100/dev_pbdma.ref.txt */ - class GPFIFO : public Engine { + class GPFIFO { public: static constexpr u32 RegisterCount{0x40}; //!< The number of GPFIFO registers @@ -168,11 +168,12 @@ namespace skyline::soc::gm20b::engine { static_assert(sizeof(Registers) == (RegisterCount * sizeof(u32))); #pragma pack(pop) + host1x::SyncpointSet &syncpoints; ChannelContext &channelCtx; public: - GPFIFO(const DeviceState &state, ChannelContext &channelCtx); + GPFIFO(host1x::SyncpointSet &syncpoints, ChannelContext &channelCtx); - void CallMethod(u32 method, u32 argument, bool lastCall); + void CallMethod(u32 method, u32 argument); }; } diff --git a/app/src/main/cpp/skyline/soc/gm20b/gpfifo.cpp b/app/src/main/cpp/skyline/soc/gm20b/gpfifo.cpp index aa7295e0..35406818 100644 --- a/app/src/main/cpp/skyline/soc/gm20b/gpfifo.cpp +++ b/app/src/main/cpp/skyline/soc/gm20b/gpfifo.cpp @@ -61,7 +61,7 @@ namespace skyline::soc::gm20b { ChannelGpfifo::ChannelGpfifo(const DeviceState &state, ChannelContext &channelCtx, size_t numEntries) : state(state), - gpfifoEngine(state, channelCtx), + gpfifoEngine(state.soc->host1x.syncpoints, channelCtx), channelCtx(channelCtx), gpEntries(numEntries), thread(std::thread(&ChannelGpfifo::Run, this)) {} @@ -76,7 +76,7 @@ namespace skyline::soc::gm20b { Logger::Debug("Called GPU method - method: 0x{:X} argument: 0x{:X} subchannel: 0x{:X} last: {}", method, argument, subChannel, lastCall); if (method < engine::GPFIFO::RegisterCount) { - gpfifoEngine.CallMethod(method, argument, lastCall); + gpfifoEngine.CallMethod(method, argument); } else { switch (subChannel) { case ThreeDSubChannel: