diff options
| author | John Peterson <jpeterson57@gmail.com> | 2009-06-15 04:30:02 +0000 |
|---|---|---|
| committer | John Peterson <jpeterson57@gmail.com> | 2009-06-15 04:30:02 +0000 |
| commit | 5c04af50a406fe8d81ed5dbd83a691b96d34838d (patch) | |
| tree | ca5c19b3a09d460e03353395430b8e320eca383f /Source/Core/VideoCommon/Src/Fifo.cpp | |
| parent | 3295ec38eb5a314a2a8e3dd18d2e0f4c832f2304 (diff) | |
Attempt to calculate actual refresh rate (i.e. a CPU-GPU synced Mhz), no real success. Anybody have any ideas?
Is there no indication from the game when the screen refresh should occur? No, not what I could find, we currently calculate the refresh rate and m_VBeamPos from the CPU ticks progress. That works perfectly if the CPU and GPU is perfectly synced as in the single core and no-idle skipping mode. So I guess it's possible that the game doesn't indicate when the screen should be refreshed, but rather that the hardware calculate that from the CPU ticks progress. That leaves us with a problem in the dual core and idle skipping modes to calculate a CPU-GPU synced CPU ticks progress.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3447 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/VideoCommon/Src/Fifo.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Src/Fifo.cpp | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/Source/Core/VideoCommon/Src/Fifo.cpp b/Source/Core/VideoCommon/Src/Fifo.cpp index b70a3a2c41..14f6a14061 100644 --- a/Source/Core/VideoCommon/Src/Fifo.cpp +++ b/Source/Core/VideoCommon/Src/Fifo.cpp @@ -76,26 +76,6 @@ u8* FAKE_GetFifoEndPtr() return &videoBuffer[size]; } -// The loop in EnterLoop sends data through this function. -// TODO: Possibly inline it? This one is exported so it will likely not be inlined at all. -void Video_SendFifoData(u8* _uData, u32 len) -{ - if (size + len >= FIFO_SIZE) - { - int pos = (int)(g_pVideoData - videoBuffer); - if (size - pos > pos) - { - PanicAlert("FIFO out of bounds (sz = %i, at %08x)", size, pos); - } - memmove(&videoBuffer[0], &videoBuffer[pos], size - pos); - size -= pos; - g_pVideoData = FAKE_GetFifoStartPtr(); - } - memcpy(videoBuffer + size, _uData, len); - size += len; - OpcodeDecoder_Run(); -} - // Executed from another thread, no the graphics thread! // Basically, all it does is set a flag so that the loop will eventually exit, then // waits for the event to be set, which happens when the loop does exit. @@ -124,7 +104,35 @@ void Fifo_ExitLoopNonBlocking() { fifoStateRun = false; } -// +////////////////////////////////////////////////////////////////////////////////////////// +// Description: Fifo_EnterLoop() sends data through this function. +// TODO: Possibly inline it? This one is exported so it will likely not be inlined at all. +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ +void Video_SendFifoData(u8* _uData, u32 len) +{ + if (size + len >= FIFO_SIZE) + { + int pos = (int)(g_pVideoData - videoBuffer); + if (size - pos > pos) + { + PanicAlert("FIFO out of bounds (sz = %i, at %08x)", size, pos); + } + memmove(&videoBuffer[0], &videoBuffer[pos], size - pos); + size -= pos; + g_pVideoData = FAKE_GetFifoStartPtr(); + } + // Copy new video instructions to videoBuffer for future use in rendering the new picture + memcpy(videoBuffer + size, _uData, len); + size += len; + OpcodeDecoder_Run(); +} +////////////////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////////////////// +// Description: Main FIFO update loop +// Purpose: Keep the Core HW updated about the CPU-GPU distance +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ void Fifo_EnterLoop(const SVideoInitialize &video_initialize) { fifoStateRun = true; @@ -160,7 +168,7 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize) video_initialize.pPeekMessages(); peek_counter = 0; } - // read the data and send it to the VideoPlugin + // Create pointer to video data and send it to the VideoPlugin u32 readPtr = _fifo.CPReadPointer; u8 *uData = video_initialize.pGetMemoryPointer(readPtr); @@ -204,6 +212,7 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize) readPtr += distToSend; #endif } + // Execute new instructions found in uData Video_SendFifoData(uData, distToSend); Common::SyncInterlockedExchange((LONG*)&_fifo.CPReadPointer, readPtr); Common::SyncInterlockedExchangeAdd((LONG*)&_fifo.CPReadWriteDistance, -distToSend); @@ -217,3 +226,4 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize) fifo_exit_event.SetTimer(); #endif } +//////////////////////////////////////////////////////////////////////////////////////////
\ No newline at end of file |
