Merge pull request #11334 from AdmiralCurtiss/globals-fifo

VideoCommon/Fifo: Refactor to class, move to Core::System.
This commit is contained in:
Mai authored and GitHub committed 2022-12-10 19:13:23 +00:00
commit 54e01c660e
18 files changed
+390 -319

No files matched your search

+12 -6
View File
@@ -277,7 +277,9 @@ void Stop() // - Hammertime!
// Dump left over jobs
HostDispatchJobs();
Fifo::EmulatorState(false);
auto& system = Core::System::GetInstance();
system.GetFifo().EmulatorState(false);
INFO_LOG_FMT(CONSOLE, "Stop [Main Thread]\t\t---- Shutting down ----");
@@ -285,7 +287,7 @@ void Stop() // - Hammertime!
INFO_LOG_FMT(CONSOLE, "{}", StopMessage(true, "Stop CPU"));
CPU::Stop();
if (Core::System::GetInstance().IsDualCoreMode())
if (system.IsDualCoreMode())
{
// Video_EnterLoop() should now exit so that EmuThread()
// will continue concurrently with the rest of the commands
@@ -597,7 +599,7 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
wiifs_guard.Dismiss();
// This adds the SyncGPU handler to CoreTiming, so now CoreTiming::Advance might block.
Fifo::Prepare();
system.GetFifo().Prepare(system);
// Setup our core
if (Config::Get(Config::MAIN_CPU_CORE) != PowerPC::CPUCore::Interpreter)
@@ -622,7 +624,7 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
s_cpu_thread = std::thread(cpuThreadFunc, savestate_path, delete_savestate);
// become the GPU thread
Fifo::RunGpuLoop();
system.GetFifo().RunGpuLoop(system);
// We have now exited the Video Loop
INFO_LOG_FMT(CONSOLE, "{}", StopMessage(false, "Video Loop Ended"));
@@ -766,7 +768,8 @@ static bool PauseAndLock(bool do_lock, bool unpause_on_unlock)
// video has to come after CPU, because CPU thread can wait for video thread
// (s_efbAccessRequested).
Fifo::PauseAndLock(do_lock, false);
auto& system = Core::System::GetInstance();
system.GetFifo().PauseAndLock(system, do_lock, false);
ResetRumble();
@@ -1029,7 +1032,10 @@ void UpdateWantDeterminism(bool initial)
const auto ios = IOS::HLE::GetIOS();
if (ios)
ios->UpdateWantDeterminism(new_want_determinism);
Fifo::UpdateWantDeterminism(new_want_determinism);
auto& system = Core::System::GetInstance();
system.GetFifo().UpdateWantDeterminism(system, new_want_determinism);
// We need to clear the cache because some parts of the JIT depend on want_determinism,
// e.g. use of FMA.
JitInterface::ClearCache();
+2 -1
View File
@@ -354,7 +354,8 @@ void CoreTimingManager::Idle()
// When the FIFO is processing data we must not advance because in this way
// the VI will be desynchronized. So, We are waiting until the FIFO finish and
// while we process only the events required by the FIFO.
Fifo::FlushGpu();
auto& system = Core::System::GetInstance();
system.GetFifo().FlushGpu(system);
}
PowerPC::UpdatePerformanceMonitor(PowerPC::ppcState.downcount, 0, 0);
+2 -1
View File
@@ -191,7 +191,8 @@ void Run()
static void RunAdjacentSystems(bool running)
{
// NOTE: We're assuming these will not try to call Break or EnableStepping.
Fifo::EmulatorState(running);
auto& system = Core::System::GetInstance();
system.GetFifo().EmulatorState(running);
// Core is responsible for shutting down the sound stream.
if (s_state != State::PowerDown)
AudioCommon::SetSoundStreamRunning(Core::System::GetInstance(), running);
+1 -1
View File
@@ -173,7 +173,7 @@ void PatchEngineCallback(Core::System& system, u64 userdata, s64 cycles_late)
void ThrottleCallback(Core::System& system, u64 deadline, s64 cyclesLate)
{
// Allow the GPU thread to sleep. Setting this flag here limits the wakeups to 1 kHz.
Fifo::GpuMaySleep();
system.GetFifo().GpuMaySleep();
const u64 time = Common::Timer::NowUs();
+7
View File
@@ -19,6 +19,7 @@
#include "Core/HW/Sram.h"
#include "Core/HW/VideoInterface.h"
#include "VideoCommon/CommandProcessor.h"
#include "VideoCommon/Fifo.h"
namespace Core
{
@@ -35,6 +36,7 @@ struct System::Impl
DVDInterface::DVDInterfaceState m_dvd_interface_state;
DVDThread::DVDThreadState m_dvd_thread_state;
ExpansionInterface::ExpansionInterfaceState m_expansion_interface_state;
Fifo::FifoManager m_fifo;
Memory::MemoryManager m_memory;
MemoryInterface::MemoryInterfaceState m_memory_interface_state;
SerialInterface::SerialInterfaceState m_serial_interface_state;
@@ -120,6 +122,11 @@ ExpansionInterface::ExpansionInterfaceState& System::GetExpansionInterfaceState(
return m_impl->m_expansion_interface_state;
}
Fifo::FifoManager& System::GetFifo() const
{
return m_impl->m_fifo;
}
Memory::MemoryManager& System::GetMemory() const
{
return m_impl->m_memory;
+5
View File
@@ -36,6 +36,10 @@ namespace ExpansionInterface
{
class ExpansionInterfaceState;
};
namespace Fifo
{
class FifoManager;
}
namespace Memory
{
class MemoryManager;
@@ -94,6 +98,7 @@ public:
DVDInterface::DVDInterfaceState& GetDVDInterfaceState() const;
DVDThread::DVDThreadState& GetDVDThreadState() const;
ExpansionInterface::ExpansionInterfaceState& GetExpansionInterfaceState() const;
Fifo::FifoManager& GetFifo() const;
Memory::MemoryManager& GetMemory() const;
MemoryInterface::MemoryInterfaceState& GetMemoryInterfaceState() const;
SerialInterface::SerialInterfaceState& GetSerialInterfaceState() const;