From 34692ab826abc8f8faa61bdb2280b742424528f1 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sat, 7 Dec 2013 15:14:29 -0500 Subject: Remove unnecessary Src/ folders --- .../VideoBackends/Software/SWCommandProcessor.cpp | 446 +++++++++++++++++++++ 1 file changed, 446 insertions(+) create mode 100644 Source/Core/VideoBackends/Software/SWCommandProcessor.cpp (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp new file mode 100644 index 0000000000..06876a2035 --- /dev/null +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -0,0 +1,446 @@ +// Copyright 2013 Dolphin Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include "Common.h" +#include "Thread.h" +#include "Atomic.h" +#include "ConfigManager.h" +#include "Core.h" +#include "CoreTiming.h" +#include "HW/Memmap.h" +#include "HW/ProcessorInterface.h" + +#include "VideoBackend.h" +#include "SWCommandProcessor.h" +#include "ChunkFile.h" +#include "MathUtil.h" +#include "OpcodeDecoder.h" + + +namespace SWCommandProcessor +{ + +enum +{ + GATHER_PIPE_SIZE = 32, + INT_CAUSE_CP = 0x800 +}; + +// STATE_TO_SAVE +// variables + +const int commandBufferSize = 1024 * 1024; +const int maxCommandBufferWrite = commandBufferSize - GATHER_PIPE_SIZE; +u8 commandBuffer[commandBufferSize]; +u32 readPos; +u32 writePos; +int et_UpdateInterrupts; +volatile bool interruptSet; +volatile bool interruptWaiting; + +CPReg cpreg; // shared between gfx and emulator thread + +void DoState(PointerWrap &p) +{ + p.DoPOD(cpreg); + p.DoArray(commandBuffer, commandBufferSize); + p.Do(readPos); + p.Do(writePos); + p.Do(et_UpdateInterrupts); + p.Do(interruptSet); + p.Do(interruptWaiting); + + // Is this right? + p.DoArray(g_pVideoData,writePos); +} + +// does it matter that there is no synchronization between threads during writes? +inline void WriteLow (u32& _reg, u16 lowbits) {_reg = (_reg & 0xFFFF0000) | lowbits;} +inline void WriteHigh(u32& _reg, u16 highbits) {_reg = (_reg & 0x0000FFFF) | ((u32)highbits << 16);} + +inline u16 ReadLow (u32 _reg) {return (u16)(_reg & 0xFFFF);} +inline u16 ReadHigh (u32 _reg) {return (u16)(_reg >> 16);} + + +void UpdateInterrupts_Wrapper(u64 userdata, int cyclesLate) +{ + UpdateInterrupts(userdata); +} + +inline bool AtBreakpoint() +{ + return cpreg.ctrl.BPEnable && (cpreg.readptr == cpreg.breakpt); +} + +void Init() +{ + cpreg.status.Hex = 0; + cpreg.status.CommandIdle = 1; + cpreg.status.ReadIdle = 1; + + cpreg.ctrl.Hex = 0; + cpreg.clear.Hex = 0; + + cpreg.bboxleft = 0; + cpreg.bboxtop = 0; + cpreg.bboxright = 0; + cpreg.bboxbottom = 0; + + cpreg.token = 0; + + et_UpdateInterrupts = CoreTiming::RegisterEvent("UpdateInterrupts", UpdateInterrupts_Wrapper); + + // internal buffer position + readPos = 0; + writePos = 0; + + interruptSet = false; + interruptWaiting = false; + + g_pVideoData = 0; + g_bSkipCurrentFrame = false; +} + +void Shutdown() +{ +} + +void RunGpu() +{ + if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread) + { + // We are going to do FP math on the main thread so have to save the current state + FPURoundMode::SaveSIMDState(); + FPURoundMode::LoadDefaultSIMDState(); + + // run the opcode decoder + do + { + RunBuffer(); + } while (cpreg.ctrl.GPReadEnable && !AtBreakpoint() && cpreg.readptr != cpreg.writeptr); + + FPURoundMode::LoadSIMDState(); + } +} + +void Read16(u16& _rReturnValue, const u32 _Address) +{ + u32 regAddr = (_Address & 0xFFF) >> 1; + + DEBUG_LOG(COMMANDPROCESSOR, "(r): 0x%08x : 0x%08x", _Address, ((u16*)&cpreg)[regAddr]); + + if (regAddr < 0x20) + _rReturnValue = ((u16*)&cpreg)[regAddr]; + else + _rReturnValue = 0; +} + +void Write16(const u16 _Value, const u32 _Address) +{ + INFO_LOG(COMMANDPROCESSOR, "(write16): 0x%04x @ 0x%08x",_Value,_Address); + + switch (_Address & 0xFFF) + { + case STATUS_REGISTER: + { + ERROR_LOG(COMMANDPROCESSOR,"\t write to STATUS_REGISTER : %04x", _Value); + } + break; + + case CTRL_REGISTER: + { + cpreg.ctrl.Hex = _Value; + + DEBUG_LOG(COMMANDPROCESSOR,"\t write to CTRL_REGISTER : %04x", _Value); + DEBUG_LOG(COMMANDPROCESSOR, "\t GPREAD %s | CPULINK %s | BP %s || BPIntEnable %s | OvF %s | UndF %s" + , cpreg.ctrl.GPReadEnable ? "ON" : "OFF" + , cpreg.ctrl.GPLinkEnable ? "ON" : "OFF" + , cpreg.ctrl.BPEnable ? "ON" : "OFF" + , cpreg.ctrl.BreakPointIntEnable ? "ON" : "OFF" + , cpreg.ctrl.FifoOverflowIntEnable ? "ON" : "OFF" + , cpreg.ctrl.FifoUnderflowIntEnable ? "ON" : "OFF" + ); + } + break; + + case CLEAR_REGISTER: + { + UCPClearReg tmpClear(_Value); + + if (tmpClear.ClearFifoOverflow) + cpreg.status.OverflowHiWatermark = 0; + if (tmpClear.ClearFifoUnderflow) + cpreg.status.UnderflowLoWatermark = 0; + + INFO_LOG(COMMANDPROCESSOR,"\t write to CLEAR_REGISTER : %04x",_Value); + } + break; + + // Fifo Registers + case FIFO_TOKEN_REGISTER: + cpreg.token = _Value; + DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_TOKEN_REGISTER : %04x", _Value); + break; + + case FIFO_BASE_LO: + WriteLow ((u32 &)cpreg.fifobase, _Value & 0xFFE0); + DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_BASE_LO. FIFO base is : %08x", cpreg.fifobase); + break; + case FIFO_BASE_HI: + WriteHigh((u32 &)cpreg.fifobase, _Value); + DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_BASE_HI. FIFO base is : %08x", cpreg.fifobase); + break; + case FIFO_END_LO: + WriteLow ((u32 &)cpreg.fifoend, _Value & 0xFFE0); + DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_END_LO. FIFO end is : %08x", cpreg.fifoend); + break; + case FIFO_END_HI: + WriteHigh((u32 &)cpreg.fifoend, _Value); + DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_END_HI. FIFO end is : %08x", cpreg.fifoend); + break; + + case FIFO_WRITE_POINTER_LO: + WriteLow ((u32 &)cpreg.writeptr, _Value & 0xFFE0); + DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_WRITE_POINTER_LO. write ptr is : %08x", cpreg.writeptr); + break; + case FIFO_WRITE_POINTER_HI: + WriteHigh ((u32 &)cpreg.writeptr, _Value); + DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_WRITE_POINTER_HI. write ptr is : %08x", cpreg.writeptr); + break; + case FIFO_READ_POINTER_LO: + WriteLow ((u32 &)cpreg.readptr, _Value & 0xFFE0); + DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_READ_POINTER_LO. read ptr is : %08x", cpreg.readptr); + break; + case FIFO_READ_POINTER_HI: + WriteHigh ((u32 &)cpreg.readptr, _Value); + DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_READ_POINTER_HI. read ptr is : %08x", cpreg.readptr); + break; + + case FIFO_HI_WATERMARK_LO: + WriteLow ((u32 &)cpreg.hiwatermark, _Value); + DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_HI_WATERMARK_LO. hiwatermark is : %08x", cpreg.hiwatermark); + break; + case FIFO_HI_WATERMARK_HI: + WriteHigh ((u32 &)cpreg.hiwatermark, _Value); + DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_HI_WATERMARK_HI. hiwatermark is : %08x", cpreg.hiwatermark); + break; + case FIFO_LO_WATERMARK_LO: + WriteLow ((u32 &)cpreg.lowatermark, _Value); + DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_LO_WATERMARK_LO. lowatermark is : %08x", cpreg.lowatermark); + break; + case FIFO_LO_WATERMARK_HI: + WriteHigh ((u32 &)cpreg.lowatermark, _Value); + DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_LO_WATERMARK_HI. lowatermark is : %08x", cpreg.lowatermark); + break; + + case FIFO_BP_LO: + WriteLow ((u32 &)cpreg.breakpt, _Value & 0xFFE0); + DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_BP_LO. breakpoint is : %08x", cpreg.breakpt); + break; + case FIFO_BP_HI: + WriteHigh ((u32 &)cpreg.breakpt, _Value); + DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_BP_HI. breakpoint is : %08x", cpreg.breakpt); + break; + + case FIFO_RW_DISTANCE_LO: + WriteLow ((u32 &)cpreg.rwdistance, _Value & 0xFFE0); + DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_RW_DISTANCE_LO. rwdistance is : %08x", cpreg.rwdistance); + break; + case FIFO_RW_DISTANCE_HI: + WriteHigh ((u32 &)cpreg.rwdistance, _Value); + DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_RW_DISTANCE_HI. rwdistance is : %08x", cpreg.rwdistance); + break; + } + + RunGpu(); +} + +void Read32(u32& _rReturnValue, const u32 _Address) +{ + _rReturnValue = 0; + _dbg_assert_msg_(COMMANDPROCESSOR, 0, "Read32 from CommandProcessor at 0x%08x", _Address); +} + +void Write32(const u32 _Data, const u32 _Address) +{ + _dbg_assert_msg_(COMMANDPROCESSOR, 0, "Write32 at CommandProcessor at 0x%08x", _Address); +} + +void STACKALIGN GatherPipeBursted() +{ + if (cpreg.ctrl.GPLinkEnable) + { + DEBUG_LOG(COMMANDPROCESSOR,"\t WGP burst. write thru : %08x", cpreg.writeptr); + + if (cpreg.writeptr == cpreg.fifoend) + cpreg.writeptr = cpreg.fifobase; + else + cpreg.writeptr += GATHER_PIPE_SIZE; + + Common::AtomicAdd(cpreg.rwdistance, GATHER_PIPE_SIZE); + } + + RunGpu(); +} + +void UpdateInterrupts(u64 userdata) +{ + if (userdata) + { + interruptSet = true; + INFO_LOG(COMMANDPROCESSOR,"Interrupt set"); + ProcessorInterface::SetInterrupt(INT_CAUSE_CP, true); + } + else + { + interruptSet = false; + INFO_LOG(COMMANDPROCESSOR,"Interrupt cleared"); + ProcessorInterface::SetInterrupt(INT_CAUSE_CP, false); + } + interruptWaiting = false; +} + +void UpdateInterruptsFromVideoBackend(u64 userdata) +{ + CoreTiming::ScheduleEvent_Threadsafe(0, et_UpdateInterrupts, userdata); +} + +void ReadFifo() +{ + bool canRead = cpreg.readptr != cpreg.writeptr && writePos < (int)maxCommandBufferWrite; + bool atBreakpoint = AtBreakpoint(); + + if (canRead && !atBreakpoint) + { + // read from fifo + u8 *ptr = Memory::GetPointer(cpreg.readptr); + int bytesRead = 0; + + do + { + // copy to buffer + memcpy(&commandBuffer[writePos], ptr, GATHER_PIPE_SIZE); + writePos += GATHER_PIPE_SIZE; + bytesRead += GATHER_PIPE_SIZE; + + if (cpreg.readptr == cpreg.fifoend) + { + cpreg.readptr = cpreg.fifobase; + ptr = Memory::GetPointer(cpreg.readptr); + } + else + { + cpreg.readptr += GATHER_PIPE_SIZE; + ptr += GATHER_PIPE_SIZE; + } + + canRead = cpreg.readptr != cpreg.writeptr && writePos < (int)maxCommandBufferWrite; + atBreakpoint = AtBreakpoint(); + } while (canRead && !atBreakpoint); + + Common::AtomicAdd(cpreg.rwdistance, -bytesRead); + } +} + +void SetStatus() +{ + // overflow check + if (cpreg.rwdistance > cpreg.hiwatermark) + cpreg.status.OverflowHiWatermark = 1; + + // underflow check + if (cpreg.rwdistance < cpreg.lowatermark) + cpreg.status.UnderflowLoWatermark = 1; + + // breakpoint + if (cpreg.ctrl.BPEnable) + { + if (cpreg.breakpt == cpreg.readptr) + { + if (!cpreg.status.Breakpoint) + INFO_LOG(COMMANDPROCESSOR, "Hit breakpoint at %x", cpreg.readptr); + cpreg.status.Breakpoint = 1; + } + } + else + { + if (cpreg.status.Breakpoint) + INFO_LOG(COMMANDPROCESSOR, "Cleared breakpoint at %x", cpreg.readptr); + cpreg.status.Breakpoint = 0; + } + + cpreg.status.ReadIdle = cpreg.readptr == cpreg.writeptr; + + bool bpInt = cpreg.status.Breakpoint && cpreg.ctrl.BreakPointIntEnable; + bool ovfInt = cpreg.status.OverflowHiWatermark && cpreg.ctrl.FifoOverflowIntEnable; + bool undfInt = cpreg.status.UnderflowLoWatermark && cpreg.ctrl.FifoUnderflowIntEnable; + + bool interrupt = bpInt || ovfInt || undfInt; + + if (interrupt != interruptSet && !interruptWaiting) + { + u64 userdata = interrupt?1:0; + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread) + { + interruptWaiting = true; + SWCommandProcessor::UpdateInterruptsFromVideoBackend(userdata); + } + else + { + SWCommandProcessor::UpdateInterrupts(userdata); + } + } +} + +bool RunBuffer() +{ + // fifo is read 32 bytes at a time + // read fifo data to internal buffer + if (cpreg.ctrl.GPReadEnable) + ReadFifo(); + + SetStatus(); + + _dbg_assert_(COMMANDPROCESSOR, writePos >= readPos); + + g_pVideoData = &commandBuffer[readPos]; + + u32 availableBytes = writePos - readPos; + + while (OpcodeDecoder::CommandRunnable(availableBytes)) + { + cpreg.status.CommandIdle = 0; + + OpcodeDecoder::Run(availableBytes); + + // if data was read by the opcode decoder then the video data pointer changed + readPos = (u32)(g_pVideoData - &commandBuffer[0]); + _dbg_assert_(VIDEO, writePos >= readPos); + availableBytes = writePos - readPos; + } + + cpreg.status.CommandIdle = 1; + + bool ranDecoder = false; + + // move data remaining in the command buffer + if (readPos > 0) + { + memmove(&commandBuffer[0], &commandBuffer[readPos], availableBytes); + writePos -= readPos; + readPos = 0; + + ranDecoder = true; + } + + return ranDecoder; +} + +void SetRendering(bool enabled) +{ + g_bSkipCurrentFrame = !enabled; +} + +} // end of namespace SWCommandProcessor + -- cgit v1.2.3 From f8f14c83a393b6fac61d2420b56f9ce65ea8f034 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Tue, 4 Feb 2014 01:09:57 +0100 Subject: MMIO: Port the SW CP/PE MMIOs to the new interface. Migration is now complete. --- .../VideoBackends/Software/SWCommandProcessor.cpp | 173 +++++++-------------- 1 file changed, 52 insertions(+), 121 deletions(-) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index 06876a2035..e2f402a040 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -9,6 +9,7 @@ #include "Core.h" #include "CoreTiming.h" #include "HW/Memmap.h" +#include "HW/MMIO.h" #include "HW/ProcessorInterface.h" #include "VideoBackend.h" @@ -124,147 +125,77 @@ void RunGpu() } } -void Read16(u16& _rReturnValue, const u32 _Address) -{ - u32 regAddr = (_Address & 0xFFF) >> 1; - - DEBUG_LOG(COMMANDPROCESSOR, "(r): 0x%08x : 0x%08x", _Address, ((u16*)&cpreg)[regAddr]); - - if (regAddr < 0x20) - _rReturnValue = ((u16*)&cpreg)[regAddr]; - else - _rReturnValue = 0; -} - -void Write16(const u16 _Value, const u32 _Address) +void RegisterMMIO(MMIO::Mapping* mmio, u32 base) { - INFO_LOG(COMMANDPROCESSOR, "(write16): 0x%04x @ 0x%08x",_Value,_Address); + // Directly map reads and writes to the cpreg structure. + for (size_t i = 0; i < sizeof (cpreg) / sizeof (u16); ++i) + { + u16* ptr = ((u16*)&cpreg) + i; + mmio->Register(base | (i * 2), + MMIO::DirectRead(ptr), + MMIO::DirectWrite(ptr) + ); + } - switch (_Address & 0xFFF) + // Bleh. Apparently SWCommandProcessor does not know about regs 0x40 to + // 0x64... + for (size_t i = 0x40; i < 0x64; ++i) { - case STATUS_REGISTER: - { - ERROR_LOG(COMMANDPROCESSOR,"\t write to STATUS_REGISTER : %04x", _Value); - } - break; + mmio->Register(base | i, + MMIO::Constant(0), + MMIO::Nop() + ); + } - case CTRL_REGISTER: - { - cpreg.ctrl.Hex = _Value; - - DEBUG_LOG(COMMANDPROCESSOR,"\t write to CTRL_REGISTER : %04x", _Value); - DEBUG_LOG(COMMANDPROCESSOR, "\t GPREAD %s | CPULINK %s | BP %s || BPIntEnable %s | OvF %s | UndF %s" - , cpreg.ctrl.GPReadEnable ? "ON" : "OFF" - , cpreg.ctrl.GPLinkEnable ? "ON" : "OFF" - , cpreg.ctrl.BPEnable ? "ON" : "OFF" - , cpreg.ctrl.BreakPointIntEnable ? "ON" : "OFF" - , cpreg.ctrl.FifoOverflowIntEnable ? "ON" : "OFF" - , cpreg.ctrl.FifoUnderflowIntEnable ? "ON" : "OFF" - ); - } - break; + // The low part of MMIO regs for FIFO addresses needs to be aligned to 32 + // bytes. + u32 fifo_addr_lo_regs[] = { + FIFO_BASE_LO, FIFO_END_LO, FIFO_WRITE_POINTER_LO, + FIFO_READ_POINTER_LO, FIFO_BP_LO, FIFO_RW_DISTANCE_LO, + }; + for (u32 reg : fifo_addr_lo_regs) + { + mmio->RegisterWrite(base | reg, + MMIO::DirectWrite(((u16*)&cpreg) + (reg / 2), 0xFFE0) + ); + } - case CLEAR_REGISTER: - { - UCPClearReg tmpClear(_Value); + // The clear register needs to perform some more complicated operations on + // writes. + mmio->RegisterWrite(base | CLEAR_REGISTER, + MMIO::ComplexWrite([](u32, u16 val) { + UCPClearReg tmpClear(val); if (tmpClear.ClearFifoOverflow) cpreg.status.OverflowHiWatermark = 0; if (tmpClear.ClearFifoUnderflow) cpreg.status.UnderflowLoWatermark = 0; + }) + ); +} - INFO_LOG(COMMANDPROCESSOR,"\t write to CLEAR_REGISTER : %04x",_Value); - } - break; - - // Fifo Registers - case FIFO_TOKEN_REGISTER: - cpreg.token = _Value; - DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_TOKEN_REGISTER : %04x", _Value); - break; - - case FIFO_BASE_LO: - WriteLow ((u32 &)cpreg.fifobase, _Value & 0xFFE0); - DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_BASE_LO. FIFO base is : %08x", cpreg.fifobase); - break; - case FIFO_BASE_HI: - WriteHigh((u32 &)cpreg.fifobase, _Value); - DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_BASE_HI. FIFO base is : %08x", cpreg.fifobase); - break; - case FIFO_END_LO: - WriteLow ((u32 &)cpreg.fifoend, _Value & 0xFFE0); - DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_END_LO. FIFO end is : %08x", cpreg.fifoend); - break; - case FIFO_END_HI: - WriteHigh((u32 &)cpreg.fifoend, _Value); - DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_END_HI. FIFO end is : %08x", cpreg.fifoend); - break; - - case FIFO_WRITE_POINTER_LO: - WriteLow ((u32 &)cpreg.writeptr, _Value & 0xFFE0); - DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_WRITE_POINTER_LO. write ptr is : %08x", cpreg.writeptr); - break; - case FIFO_WRITE_POINTER_HI: - WriteHigh ((u32 &)cpreg.writeptr, _Value); - DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_WRITE_POINTER_HI. write ptr is : %08x", cpreg.writeptr); - break; - case FIFO_READ_POINTER_LO: - WriteLow ((u32 &)cpreg.readptr, _Value & 0xFFE0); - DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_READ_POINTER_LO. read ptr is : %08x", cpreg.readptr); - break; - case FIFO_READ_POINTER_HI: - WriteHigh ((u32 &)cpreg.readptr, _Value); - DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_READ_POINTER_HI. read ptr is : %08x", cpreg.readptr); - break; - - case FIFO_HI_WATERMARK_LO: - WriteLow ((u32 &)cpreg.hiwatermark, _Value); - DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_HI_WATERMARK_LO. hiwatermark is : %08x", cpreg.hiwatermark); - break; - case FIFO_HI_WATERMARK_HI: - WriteHigh ((u32 &)cpreg.hiwatermark, _Value); - DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_HI_WATERMARK_HI. hiwatermark is : %08x", cpreg.hiwatermark); - break; - case FIFO_LO_WATERMARK_LO: - WriteLow ((u32 &)cpreg.lowatermark, _Value); - DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_LO_WATERMARK_LO. lowatermark is : %08x", cpreg.lowatermark); - break; - case FIFO_LO_WATERMARK_HI: - WriteHigh ((u32 &)cpreg.lowatermark, _Value); - DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_LO_WATERMARK_HI. lowatermark is : %08x", cpreg.lowatermark); - break; - - case FIFO_BP_LO: - WriteLow ((u32 &)cpreg.breakpt, _Value & 0xFFE0); - DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_BP_LO. breakpoint is : %08x", cpreg.breakpt); - break; - case FIFO_BP_HI: - WriteHigh ((u32 &)cpreg.breakpt, _Value); - DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_BP_HI. breakpoint is : %08x", cpreg.breakpt); - break; - - case FIFO_RW_DISTANCE_LO: - WriteLow ((u32 &)cpreg.rwdistance, _Value & 0xFFE0); - DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_RW_DISTANCE_LO. rwdistance is : %08x", cpreg.rwdistance); - break; - case FIFO_RW_DISTANCE_HI: - WriteHigh ((u32 &)cpreg.rwdistance, _Value); - DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_RW_DISTANCE_HI. rwdistance is : %08x", cpreg.rwdistance); - break; - } +void Read16(u16& _rReturnValue, const u32 _Address) +{ + // HACK: Remove this function when the new MMIO interface is used. + Memory::mmio_mapping->Read(_Address, _rReturnValue); +} - RunGpu(); +void Write16(const u16 _Value, const u32 _Address) +{ + // HACK: Remove this function when the new MMIO interface is used. + Memory::mmio_mapping->Write(_Address, _Value); } void Read32(u32& _rReturnValue, const u32 _Address) { - _rReturnValue = 0; - _dbg_assert_msg_(COMMANDPROCESSOR, 0, "Read32 from CommandProcessor at 0x%08x", _Address); + // HACK: Remove this function when the new MMIO interface is used. + Memory::mmio_mapping->Read(_Address, _rReturnValue); } void Write32(const u32 _Data, const u32 _Address) { - _dbg_assert_msg_(COMMANDPROCESSOR, 0, "Write32 at CommandProcessor at 0x%08x", _Address); + // HACK: Remove this function when the new MMIO interface is used. + Memory::mmio_mapping->Write(_Address, _Data); } void STACKALIGN GatherPipeBursted() -- cgit v1.2.3 From 92f8d93e969abf942002439ef583d2a25acad019 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sat, 15 Feb 2014 03:23:35 +0100 Subject: Remove the old MMIO access "interface". --- .../VideoBackends/Software/SWCommandProcessor.cpp | 24 ---------------------- 1 file changed, 24 deletions(-) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index e2f402a040..450ce5712a 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -174,30 +174,6 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) ); } -void Read16(u16& _rReturnValue, const u32 _Address) -{ - // HACK: Remove this function when the new MMIO interface is used. - Memory::mmio_mapping->Read(_Address, _rReturnValue); -} - -void Write16(const u16 _Value, const u32 _Address) -{ - // HACK: Remove this function when the new MMIO interface is used. - Memory::mmio_mapping->Write(_Address, _Value); -} - -void Read32(u32& _rReturnValue, const u32 _Address) -{ - // HACK: Remove this function when the new MMIO interface is used. - Memory::mmio_mapping->Read(_Address, _rReturnValue); -} - -void Write32(const u32 _Data, const u32 _Address) -{ - // HACK: Remove this function when the new MMIO interface is used. - Memory::mmio_mapping->Write(_Address, _Data); -} - void STACKALIGN GatherPipeBursted() { if (cpreg.ctrl.GPLinkEnable) -- cgit v1.2.3 From 2afe2152712981e21d6bda6f029292ed2b1cf91e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 17 Feb 2014 05:18:15 -0500 Subject: Convert all includes to relative paths. --- .../VideoBackends/Software/SWCommandProcessor.cpp | 31 +++++++++++----------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index 450ce5712a..bf37b47b8e 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -2,21 +2,22 @@ // Licensed under GPLv2 // Refer to the license.txt file included. -#include "Common.h" -#include "Thread.h" -#include "Atomic.h" -#include "ConfigManager.h" -#include "Core.h" -#include "CoreTiming.h" -#include "HW/Memmap.h" -#include "HW/MMIO.h" -#include "HW/ProcessorInterface.h" - -#include "VideoBackend.h" -#include "SWCommandProcessor.h" -#include "ChunkFile.h" -#include "MathUtil.h" -#include "OpcodeDecoder.h" +#include "Common/Atomic.h" +#include "Common/ChunkFile.h" +#include "Common/Common.h" +#include "Common/MathUtil.h" +#include "Common/Thread.h" + +#include "Core/ConfigManager.h" +#include "Core/Core.h" +#include "Core/CoreTiming.h" +#include "Core/HW/Memmap.h" +#include "Core/HW/MMIO.h" +#include "Core/HW/ProcessorInterface.h" + +#include "VideoBackends/Software/OpcodeDecoder.h" +#include "VideoBackends/Software/SWCommandProcessor.h" +#include "VideoBackends/Software/VideoBackend.h" namespace SWCommandProcessor -- cgit v1.2.3 From 83b7bb64aa5e1ee6b18eaa5d08c17bb5b6c57048 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Thu, 20 Feb 2014 04:11:52 +0100 Subject: Make Common/ mostly IWYU clean (and fix errors in rest of the project detected by this change). --- Source/Core/VideoBackends/Software/SWCommandProcessor.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index bf37b47b8e..d8288adc1a 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -5,6 +5,7 @@ #include "Common/Atomic.h" #include "Common/ChunkFile.h" #include "Common/Common.h" +#include "Common/FPURoundMode.h" #include "Common/MathUtil.h" #include "Common/Thread.h" -- cgit v1.2.3 From d802d392811be44d34ae9cd23f616db93e54c50f Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sun, 9 Mar 2014 21:14:26 +0100 Subject: clang-modernize -use-nullptr and s/\bNULL\b/nullptr/g for *.cpp/h/mm files not compiled on my machine --- Source/Core/VideoBackends/Software/SWCommandProcessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index d8288adc1a..8329024e3a 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -101,7 +101,7 @@ void Init() interruptSet = false; interruptWaiting = false; - g_pVideoData = 0; + g_pVideoData = nullptr; g_bSkipCurrentFrame = false; } -- cgit v1.2.3 From 8bf3ffc76f54ab8b392a3922b1fedfb8f8cd76fd Mon Sep 17 00:00:00 2001 From: magumagu Date: Mon, 16 Jun 2014 13:17:32 -0700 Subject: VideoSoftware: remove duplicated CommandProcessor structures. --- Source/Core/VideoBackends/Software/SWCommandProcessor.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index 8329024e3a..d310a5584d 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -152,8 +152,12 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) // The low part of MMIO regs for FIFO addresses needs to be aligned to 32 // bytes. u32 fifo_addr_lo_regs[] = { - FIFO_BASE_LO, FIFO_END_LO, FIFO_WRITE_POINTER_LO, - FIFO_READ_POINTER_LO, FIFO_BP_LO, FIFO_RW_DISTANCE_LO, + CommandProcessor::FIFO_BASE_LO, + CommandProcessor::FIFO_END_LO, + CommandProcessor::FIFO_WRITE_POINTER_LO, + CommandProcessor::FIFO_READ_POINTER_LO, + CommandProcessor::FIFO_BP_LO, + CommandProcessor::FIFO_RW_DISTANCE_LO, }; for (u32 reg : fifo_addr_lo_regs) { @@ -164,7 +168,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) // The clear register needs to perform some more complicated operations on // writes. - mmio->RegisterWrite(base | CLEAR_REGISTER, + mmio->RegisterWrite(base | CommandProcessor::CLEAR_REGISTER, MMIO::ComplexWrite([](u32, u16 val) { UCPClearReg tmpClear(val); @@ -281,7 +285,7 @@ void SetStatus() cpreg.status.ReadIdle = cpreg.readptr == cpreg.writeptr; - bool bpInt = cpreg.status.Breakpoint && cpreg.ctrl.BreakPointIntEnable; + bool bpInt = cpreg.status.Breakpoint && cpreg.ctrl.BPInt; bool ovfInt = cpreg.status.OverflowHiWatermark && cpreg.ctrl.FifoOverflowIntEnable; bool undfInt = cpreg.status.UnderflowLoWatermark && cpreg.ctrl.FifoUnderflowIntEnable; -- cgit v1.2.3 From 22e1aa5bb4a159d6d66a321f978917614aa36331 Mon Sep 17 00:00:00 2001 From: degasus Date: Tue, 8 Jul 2014 14:29:26 +0200 Subject: mark all local functions as static --- Source/Core/VideoBackends/Software/SWCommandProcessor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index d310a5584d..ed8115f1ab 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -66,7 +66,7 @@ inline u16 ReadLow (u32 _reg) {return (u16)(_reg & 0xFFFF);} inline u16 ReadHigh (u32 _reg) {return (u16)(_reg >> 16);} -void UpdateInterrupts_Wrapper(u64 userdata, int cyclesLate) +static void UpdateInterrupts_Wrapper(u64 userdata, int cyclesLate) { UpdateInterrupts(userdata); } @@ -219,7 +219,7 @@ void UpdateInterruptsFromVideoBackend(u64 userdata) CoreTiming::ScheduleEvent_Threadsafe(0, et_UpdateInterrupts, userdata); } -void ReadFifo() +static void ReadFifo() { bool canRead = cpreg.readptr != cpreg.writeptr && writePos < (int)maxCommandBufferWrite; bool atBreakpoint = AtBreakpoint(); @@ -256,7 +256,7 @@ void ReadFifo() } } -void SetStatus() +static void SetStatus() { // overflow check if (cpreg.rwdistance > cpreg.hiwatermark) -- cgit v1.2.3 From 6d3f249dcc746cc7845ef88ddb8ce3bcc9221aca Mon Sep 17 00:00:00 2001 From: degasus Date: Tue, 8 Jul 2014 15:58:25 +0200 Subject: mark all local variables as static --- .../Core/VideoBackends/Software/SWCommandProcessor.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index ed8115f1ab..1a2dcc0cbf 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -33,14 +33,14 @@ enum // STATE_TO_SAVE // variables -const int commandBufferSize = 1024 * 1024; -const int maxCommandBufferWrite = commandBufferSize - GATHER_PIPE_SIZE; -u8 commandBuffer[commandBufferSize]; -u32 readPos; -u32 writePos; -int et_UpdateInterrupts; -volatile bool interruptSet; -volatile bool interruptWaiting; +static const int commandBufferSize = 1024 * 1024; +static const int maxCommandBufferWrite = commandBufferSize - GATHER_PIPE_SIZE; +static u8 commandBuffer[commandBufferSize]; +static u32 readPos; +static u32 writePos; +static int et_UpdateInterrupts; +static volatile bool interruptSet; +static volatile bool interruptWaiting; CPReg cpreg; // shared between gfx and emulator thread -- cgit v1.2.3 From 81ed17be53e7fed93147dc0d334a6c1d45f4e3c8 Mon Sep 17 00:00:00 2001 From: degasus Date: Tue, 8 Jul 2014 16:49:33 +0200 Subject: avoid the extern keyword in .cpp files --- Source/Core/VideoBackends/Software/SWCommandProcessor.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index 1a2dcc0cbf..3b80b9ddbf 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -20,6 +20,8 @@ #include "VideoBackends/Software/SWCommandProcessor.h" #include "VideoBackends/Software/VideoBackend.h" +#include "VideoCommon/DataReader.h" +#include "VideoCommon/Fifo.h" namespace SWCommandProcessor { -- cgit v1.2.3 From 7e79806efcd5c5e41efea89fa385b480ac1882f5 Mon Sep 17 00:00:00 2001 From: degasus Date: Tue, 8 Jul 2014 22:37:58 +0200 Subject: remove unused globals Also change globals into statics which are only used in one file --- Source/Core/VideoBackends/Software/SWCommandProcessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index 3b80b9ddbf..4f4790ed72 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -44,7 +44,7 @@ static int et_UpdateInterrupts; static volatile bool interruptSet; static volatile bool interruptWaiting; -CPReg cpreg; // shared between gfx and emulator thread +static CPReg cpreg; // shared between gfx and emulator thread void DoState(PointerWrap &p) { -- cgit v1.2.3 From 4129cdeb4d1e3969aba64cf2dad25b3864eedccb Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 10 Aug 2014 21:51:05 -0400 Subject: Software: Apply static to some functions --- .../VideoBackends/Software/SWCommandProcessor.cpp | 23 ++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index 4f4790ed72..32bc5de486 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -61,19 +61,30 @@ void DoState(PointerWrap &p) } // does it matter that there is no synchronization between threads during writes? -inline void WriteLow (u32& _reg, u16 lowbits) {_reg = (_reg & 0xFFFF0000) | lowbits;} -inline void WriteHigh(u32& _reg, u16 highbits) {_reg = (_reg & 0x0000FFFF) | ((u32)highbits << 16);} - -inline u16 ReadLow (u32 _reg) {return (u16)(_reg & 0xFFFF);} -inline u16 ReadHigh (u32 _reg) {return (u16)(_reg >> 16);} +static inline void WriteLow (u32& _reg, u16 lowbits) +{ + _reg = (_reg & 0xFFFF0000) | lowbits; +} +static inline void WriteHigh(u32& _reg, u16 highbits) +{ + _reg = (_reg & 0x0000FFFF) | ((u32)highbits << 16); +} +static inline u16 ReadLow(u32 _reg) +{ + return (u16)(_reg & 0xFFFF); +} +static inline u16 ReadHigh(u32 _reg) +{ + return (u16)(_reg >> 16); +} static void UpdateInterrupts_Wrapper(u64 userdata, int cyclesLate) { UpdateInterrupts(userdata); } -inline bool AtBreakpoint() +static inline bool AtBreakpoint() { return cpreg.ctrl.BPEnable && (cpreg.readptr == cpreg.breakpt); } -- cgit v1.2.3 From fd1606597904d7c5fe50dc8d611cedc13e184645 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Tue, 19 Aug 2014 20:17:29 -0700 Subject: msvc: resolve all warnings in VideoBackends/Software. --- Source/Core/VideoBackends/Software/SWCommandProcessor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index 32bc5de486..63b85794ce 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -143,7 +143,7 @@ void RunGpu() void RegisterMMIO(MMIO::Mapping* mmio, u32 base) { // Directly map reads and writes to the cpreg structure. - for (size_t i = 0; i < sizeof (cpreg) / sizeof (u16); ++i) + for (u32 i = 0; i < sizeof (cpreg) / sizeof (u16); ++i) { u16* ptr = ((u16*)&cpreg) + i; mmio->Register(base | (i * 2), @@ -154,7 +154,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) // Bleh. Apparently SWCommandProcessor does not know about regs 0x40 to // 0x64... - for (size_t i = 0x40; i < 0x64; ++i) + for (u32 i = 0x40; i < 0x64; ++i) { mmio->Register(base | i, MMIO::Constant(0), -- cgit v1.2.3 From e0f35e0e59983bad2c3ccad061ef9c80d8152c64 Mon Sep 17 00:00:00 2001 From: comex Date: Sat, 23 Aug 2014 15:26:59 -0400 Subject: Remove unused declarations. --- .../VideoBackends/Software/SWCommandProcessor.cpp | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index 63b85794ce..b205c112ea 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -60,25 +60,6 @@ void DoState(PointerWrap &p) p.DoArray(g_pVideoData,writePos); } -// does it matter that there is no synchronization between threads during writes? -static inline void WriteLow (u32& _reg, u16 lowbits) -{ - _reg = (_reg & 0xFFFF0000) | lowbits; -} -static inline void WriteHigh(u32& _reg, u16 highbits) -{ - _reg = (_reg & 0x0000FFFF) | ((u32)highbits << 16); -} - -static inline u16 ReadLow(u32 _reg) -{ - return (u16)(_reg & 0xFFFF); -} -static inline u16 ReadHigh(u32 _reg) -{ - return (u16)(_reg >> 16); -} - static void UpdateInterrupts_Wrapper(u64 userdata, int cyclesLate) { UpdateInterrupts(userdata); -- cgit v1.2.3 From fbc64984ca7de7db10b1a8a4f49002f260c93569 Mon Sep 17 00:00:00 2001 From: Rohit Nirmal Date: Sun, 7 Sep 2014 20:06:58 -0500 Subject: Include CommonTypes.h instead of Common.h. --- Source/Core/VideoBackends/Software/SWCommandProcessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index b205c112ea..5f227d4b5c 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -4,7 +4,7 @@ #include "Common/Atomic.h" #include "Common/ChunkFile.h" -#include "Common/Common.h" +#include "Common/CommonTypes.h" #include "Common/FPURoundMode.h" #include "Common/MathUtil.h" #include "Common/Thread.h" -- cgit v1.2.3 From 0ae9e398c8e0f808eb4da6cc6f5e3cd553e975a1 Mon Sep 17 00:00:00 2001 From: comex Date: Tue, 26 Aug 2014 13:37:32 -0400 Subject: Rejigger some FIFO buffer variables to be more rational. videoBuffer -> s_video_buffer size -> s_video_buffer_write_ptr g_pVideoData -> g_video_buffer_read_ptr (impl moved to Fifo.cpp) This eradicates the wonderful use of 'size' as a global name, and makes it clear that s_video_buffer_write_ptr and g_video_buffer_read_ptr are the two ends of the FIFO buffer s_video_buffer. Oh, and remove a useless namespace {}. --- Source/Core/VideoBackends/Software/SWCommandProcessor.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index 5f227d4b5c..56832eb786 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -57,7 +57,7 @@ void DoState(PointerWrap &p) p.Do(interruptWaiting); // Is this right? - p.DoArray(g_pVideoData,writePos); + p.DoArray(g_video_buffer_read_ptr,writePos); } static void UpdateInterrupts_Wrapper(u64 userdata, int cyclesLate) @@ -95,7 +95,7 @@ void Init() interruptSet = false; interruptWaiting = false; - g_pVideoData = nullptr; + g_video_buffer_read_ptr = nullptr; g_bSkipCurrentFrame = false; } @@ -311,7 +311,7 @@ bool RunBuffer() _dbg_assert_(COMMANDPROCESSOR, writePos >= readPos); - g_pVideoData = &commandBuffer[readPos]; + g_video_buffer_read_ptr = &commandBuffer[readPos]; u32 availableBytes = writePos - readPos; @@ -322,7 +322,7 @@ bool RunBuffer() OpcodeDecoder::Run(availableBytes); // if data was read by the opcode decoder then the video data pointer changed - readPos = (u32)(g_pVideoData - &commandBuffer[0]); + readPos = (u32)(g_video_buffer_read_ptr - &commandBuffer[0]); _dbg_assert_(VIDEO, writePos >= readPos); availableBytes = writePos - readPos; } -- cgit v1.2.3 From 2eebdff01ba260a5d517a0b208ede697e4d67323 Mon Sep 17 00:00:00 2001 From: comex Date: Tue, 30 Sep 2014 01:22:57 -0400 Subject: Remove useless STACKALIGN macro. It only ever did anything on 32-bit OS X. Anyway, it wasn't even on the right functions, and these days ABI_PushRegistersAndAdjustStack should handle maintaining the ABI correctly. --- Source/Core/VideoBackends/Software/SWCommandProcessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index 56832eb786..5b3af7f78a 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -174,7 +174,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) ); } -void STACKALIGN GatherPipeBursted() +void GatherPipeBursted() { if (cpreg.ctrl.GPLinkEnable) { -- cgit v1.2.3 From 50de4238bb1bbceb4797821d8ec428ab1d075aaa Mon Sep 17 00:00:00 2001 From: degasus Date: Sat, 29 Nov 2014 03:39:24 +0100 Subject: VertexLoader: Move the old Datareader function into VertexLoader --- Source/Core/VideoBackends/Software/SWCommandProcessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index 5b3af7f78a..9c7ff303b7 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -20,8 +20,8 @@ #include "VideoBackends/Software/SWCommandProcessor.h" #include "VideoBackends/Software/VideoBackend.h" -#include "VideoCommon/DataReader.h" #include "VideoCommon/Fifo.h" +#include "VideoCommon/VertexLoaderUtils.h" namespace SWCommandProcessor { -- cgit v1.2.3 From 26a3eaf95906b047170a6871371fb6201d90d81b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 14 May 2015 12:33:19 -0400 Subject: Software: Convert most volatile variables to atomics --- .../VideoBackends/Software/SWCommandProcessor.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index 9c7ff303b7..39f772894e 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 // Refer to the license.txt file included. +#include #include "Common/Atomic.h" #include "Common/ChunkFile.h" #include "Common/CommonTypes.h" @@ -41,8 +42,8 @@ static u8 commandBuffer[commandBufferSize]; static u32 readPos; static u32 writePos; static int et_UpdateInterrupts; -static volatile bool interruptSet; -static volatile bool interruptWaiting; +static std::atomic interruptSet; +static std::atomic interruptWaiting; static CPReg cpreg; // shared between gfx and emulator thread @@ -92,8 +93,8 @@ void Init() readPos = 0; writePos = 0; - interruptSet = false; - interruptWaiting = false; + interruptSet.store(false); + interruptWaiting.store(false); g_video_buffer_read_ptr = nullptr; g_bSkipCurrentFrame = false; @@ -195,17 +196,17 @@ void UpdateInterrupts(u64 userdata) { if (userdata) { - interruptSet = true; + interruptSet.store(true); INFO_LOG(COMMANDPROCESSOR,"Interrupt set"); ProcessorInterface::SetInterrupt(INT_CAUSE_CP, true); } else { - interruptSet = false; + interruptSet.store(false); INFO_LOG(COMMANDPROCESSOR,"Interrupt cleared"); ProcessorInterface::SetInterrupt(INT_CAUSE_CP, false); } - interruptWaiting = false; + interruptWaiting.store(false); } void UpdateInterruptsFromVideoBackend(u64 userdata) @@ -285,12 +286,12 @@ static void SetStatus() bool interrupt = bpInt || ovfInt || undfInt; - if (interrupt != interruptSet && !interruptWaiting) + if (interrupt != interruptSet.load() && !interruptWaiting.load()) { u64 userdata = interrupt?1:0; if (SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread) { - interruptWaiting = true; + interruptWaiting.store(true); SWCommandProcessor::UpdateInterruptsFromVideoBackend(userdata); } else -- cgit v1.2.3 From cefcb0ace9d363b3679b4e93bcc9ec05f1e5f4f8 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Mon, 18 May 2015 01:08:10 +0200 Subject: Update license headers to GPLv2+ --- Source/Core/VideoBackends/Software/SWCommandProcessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index 39f772894e..4fb151f6cc 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -1,5 +1,5 @@ // Copyright 2013 Dolphin Emulator Project -// Licensed under GPLv2 +// Licensed under GPLv2+ // Refer to the license.txt file included. #include -- cgit v1.2.3 From 30ebb2459eb97ba544547183854775df8460b475 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sun, 24 May 2015 06:55:12 +0200 Subject: Set copyright year to when a file was created --- Source/Core/VideoBackends/Software/SWCommandProcessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoBackends/Software/SWCommandProcessor.cpp') diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp index 4fb151f6cc..d60e488e5c 100644 --- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp +++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp @@ -1,4 +1,4 @@ -// Copyright 2013 Dolphin Emulator Project +// Copyright 2009 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. -- cgit v1.2.3