VideoCommon/CommandProcessor: Pass system instance through constructor

Makes the use of the interface a little less noisy, especially given
how much of the interface depends on an instance being present.
This commit is contained in:
Lioncache
2023-12-20 09:02:53 -05:00
parent 70b7a59456
commit f97b2d472a
8 changed files with 170 additions and 174 deletions
+1 -1
View File
@@ -109,7 +109,7 @@ void GPFifoManager::UpdateGatherPipe()
processor_interface.m_fifo_cpu_write_pointer += GATHER_PIPE_SIZE;
}
system.GetCommandProcessor().GatherPipeBursted(system);
system.GetCommandProcessor().GatherPipeBursted();
}
// move back the spill bytes
+1 -1
View File
@@ -51,7 +51,7 @@ void MemoryManager::InitMMIO(bool is_wii)
{
m_mmio_mapping = std::make_unique<MMIO::Mapping>();
m_system.GetCommandProcessor().RegisterMMIO(m_system, m_mmio_mapping.get(), 0x0C000000);
m_system.GetCommandProcessor().RegisterMMIO(m_mmio_mapping.get(), 0x0C000000);
m_system.GetPixelEngine().RegisterMMIO(m_mmio_mapping.get(), 0x0C001000);
m_system.GetVideoInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0C002000);
m_system.GetProcessorInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0C003000);
+2 -2
View File
@@ -41,8 +41,8 @@ namespace Core
struct System::Impl
{
explicit Impl(System& system)
: m_audio_interface(system), m_core_timing(system), m_cpu(system), m_dsp(system),
m_dvd_interface(system), m_dvd_thread(system),
: m_audio_interface(system), m_core_timing(system), m_command_processor{system},
m_cpu(system), m_dsp(system), m_dvd_interface(system), m_dvd_thread(system),
m_expansion_interface(system), m_fifo{system}, m_gp_fifo(system), m_memory(system),
m_power_pc(system), m_mmu(system, m_memory, m_power_pc), m_processor_interface(system),
m_serial_interface(system), m_video_interface(system),
File diff suppressed because it is too large Load Diff
+14 -10
View File
@@ -160,24 +160,26 @@ u32 GetPhysicalAddressMask();
class CommandProcessorManager
{
public:
void Init(Core::System& system);
explicit CommandProcessorManager(Core::System& system);
void Init();
void DoState(PointerWrap& p);
void RegisterMMIO(Core::System& system, MMIO::Mapping* mmio, u32 base);
void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
void SetCPStatusFromGPU(Core::System& system);
void SetCPStatusFromCPU(Core::System& system);
void GatherPipeBursted(Core::System& system);
void UpdateInterrupts(Core::System& system, u64 userdata);
void UpdateInterruptsFromVideoBackend(Core::System& system, u64 userdata);
void SetCPStatusFromGPU();
void SetCPStatusFromCPU();
void GatherPipeBursted();
void UpdateInterrupts(u64 userdata);
void UpdateInterruptsFromVideoBackend(u64 userdata);
bool IsInterruptWaiting() const;
void SetCpClearRegister();
void SetCpControlRegister(Core::System& system);
void SetCpStatusRegister(Core::System& system);
void SetCpControlRegister();
void SetCpStatusRegister();
void HandleUnknownOpcode(Core::System& system, u8 cmd_byte, const u8* buffer, bool preprocess);
void HandleUnknownOpcode(u8 cmd_byte, const u8* buffer, bool preprocess);
// This one is shared between gfx thread and emulator thread.
// It is only used by the Fifo and by the CommandProcessor.
@@ -203,6 +205,8 @@ private:
Common::Flag m_interrupt_waiting;
bool m_is_fifo_error_seen = false;
Core::System& m_system;
};
} // namespace CommandProcessor
+3 -3
View File
@@ -316,7 +316,7 @@ void FifoManager::RunGpuLoop()
{
auto& command_processor = m_system.GetCommandProcessor();
auto& fifo = command_processor.GetFifo();
command_processor.SetCPStatusFromGPU(m_system);
command_processor.SetCPStatusFromGPU();
// check if we are able to run this buffer
while (!command_processor.IsInterruptWaiting() &&
@@ -356,7 +356,7 @@ void FifoManager::RunGpuLoop()
std::memory_order_relaxed);
}
command_processor.SetCPStatusFromGPU(m_system);
command_processor.SetCPStatusFromGPU();
if (m_config_sync_gpu)
{
@@ -484,7 +484,7 @@ int FifoManager::RunGpuOnCpu(int ticks)
fifo.CPReadWriteDistance.fetch_sub(GPFifo::GATHER_PIPE_SIZE, std::memory_order_relaxed);
}
command_processor.SetCPStatusFromGPU(m_system);
command_processor.SetCPStatusFromGPU();
if (reset_simd_state)
{
+1 -1
View File
@@ -220,7 +220,7 @@ public:
else
{
auto& system = Core::System::GetInstance();
system.GetCommandProcessor().HandleUnknownOpcode(system, opcode, data, is_preprocess);
system.GetCommandProcessor().HandleUnknownOpcode(opcode, data, is_preprocess);
m_cycles += 1;
}
}
+1 -1
View File
@@ -378,7 +378,7 @@ bool VideoBackendBase::InitializeShared(std::unique_ptr<AbstractGfx> gfx,
auto& system = Core::System::GetInstance();
auto& command_processor = system.GetCommandProcessor();
command_processor.Init(system);
command_processor.Init();
system.GetFifo().Init();
system.GetPixelEngine().Init(system);
BPInit();