summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/CommandProcessor.cpp
AgeCommit message (Collapse)Author
2019-05-31VideoCommon: Constrain the array_base registersbooto
The array_base registers as part of CP state do not seem to incorporate the upper bits in the physical address they try to access.
2019-05-11CommandProcessor: Don't reset the video buffer when FIFO distance is changedStenzek
This prevents partially-processed commands from being lost when switching buffers.
2019-04-26VideoCommon: Do not reset the gather pipe (WPAR buffer) as this does not ↵iwubcode
reflect what actually happens on real hardware. On hardware, there's no way for the GPU to signal to reset the WPAR buffer. Instead, the WPAR buffer will be reset automatically upon receiving 32 bytes or when spr[WPAR] is written
2018-07-12CP: some bits in some of the HI registers cannot be setbooto
The mask is slightly different for Wii and GCN so we need to work it out at runtime.
2018-03-14Assert: Uppercase assertion macrosLioncash
Macros should be all upper-cased. This is also kind of a wart that's been sticking out for quite a while now (we avoid prefixing underscores).
2017-11-13Call Do for every member of SCPFifoStruct individuallyJosJuice
We need this because VS currently doesn't consider std::is_trivially_copyable<typename std::remove_volatile<SCPFifoStruct>::type>::value to be true and because no compiler should consider it to be true if we replace the volatiles with atomics.
2017-01-27CommandProcessor: Limit scope of ugly SCPFifoStruct.degasus
It's only used as an interface between two classes. So no need to declare it in the backend export header.
2016-10-02Merge pull request #4245 from aldelaro5/logs-levels-changesMat M
Lots of Logs levels changes (also enable INFO level in every build)
2016-10-01Reorganise a ton of logs levelaldelaro5
Most of this commits changes performance decreasing logs from info to debug and also cleans up innacurate levels.
2016-09-17Fifo: Use SyncGPU timings for single core.degasus
2016-09-03Core: Change CoreTiming event key from int to EventType*EmptyChaos
Replace 'int' keys with something that carries type information. Performance is neutral.
2016-08-18Fifo: Make SyncGPUReason an enum classLioncash
2016-08-11CoreTiming: Merge ScheduleEvent variants into one functionJosJuice
Now Core::IsCPUThread() only gets called once when using the AnyThread variant. Also, I think the enum approach makes calling code clearer.
2016-08-10Use Common::Flag and Common::Event when possibleLéo Lam
Replaces old and simple usages of std::atomic<bool> with Common::Flag (which was introduced after the initial usage), so it's clear that the variable is a flag and because Common::Flag is well tested. This also replaces the ready logic in WiimoteReal with Common::Event since it was basically just unnecessarily reimplementing Common::Event.
2016-08-10PixelEngine: Drop write-only variables.degasus
2016-06-26VideoBackends: Merge Initialize and Shutdown functions.degasus
2016-06-26CoreTiming: Drop ProcessFifoWaitEvents.degasus
globalTimer is only written in Advance, so this function has no function.
2016-06-24Reformat all the things. Have fun with merge conflicts.Pierre Bourdon
2016-04-10Alternative fix: promote cycleslate to an s64 everywhere.Scott Mansell
Also changed a few functions to be static.
2016-01-25Fifo: Make g_use_deterministic_gpu_thread a TU-local variableLioncash
2016-01-17VideoCommon: Header cleanupLioncash
Also remedies places where the video backends and core rely on things being indirectly included.
2016-01-12Fifo: Create a "Fifo" namespace.degasus
2015-06-12Options: merge SCoreStartupParameter into SConfigdegasus
2015-06-08Fifo: Rewrite SyncGpudegasus
The new implementation has 3 options: SyncGpuMaxDistance SyncGpuMinDistance SyncGpuOverclock The MaxDistance controlls how many CPU cycles the CPU is allowed to be in front of the GPU. Too low values will slow down extremly, too high values are as unsynchronized and half of the games will crash. The -MinDistance (negative) set how many cycles the GPU is allowed to be in front of the CPU. As we are used to emulate an infinitiv fast GPU, this may be set to any high (negative) number. The last parameter is to hack a faster (>1.0) or slower(<1.0) GPU. As we don't emulate GPU timing very well (eg skip the timings of the pixel stage completely), an overclock factor of ~0.5 is often much more accurate than 1.0
2015-05-30Fifo: Extract syncing loopdegasus
It's now a new helper function within common.
2015-05-27CommandProcessor: Replace volatile usages with atomicsLioncash
Also remove said variables from being globals.
2015-05-25Set copyright year to when a file was createdTillmann Karras
2015-05-25Update license headers to GPLv2+Tillmann Karras
2015-04-06Fifo: only sleep once within every ms of emulated timedegasus
2015-04-06Fifo: rewrite sync on idle skipping hackdegasus
Now it's done without a busy loop
2015-04-06Fifo: Replace busy loop with condition variabledegasus
2014-12-27Remove AtBreakpoint() from ReadIdle. Fixes Rogue Squadron 2 withoutJustin Chadwick
Breaking Gladius
2014-11-19Added an exception check when the game is close to overflowing. Fixes the ↵skidau
fifo overflow that occurs in Battalion Wars 2. Changed the CPEnd loop check to an exact match.
2014-11-19Update CPStatus before processing the FIFO events and force an exception ↵skidau
check on interrupts. Added more information into the FIFO unknown opcode error message.
2014-11-19Separated out the CPU and GPU thread path to avoid clobbering.skidau
Removed the Eternal Darkness check as it is no longer required. Fixes issue 7835.
2014-09-30Remove useless STACKALIGN macro.comex
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.
2014-09-29Merge pull request #1144 from skidau/fifo-linkedskidau
Moved the linking of the FIFO CPWritePointer near where CPWritePointer gets updated
2014-09-28Add the 'desynced GPU thread' mode.comex
It's a relatively big commit (less big with -w), but it's hard to test any of this separately... The basic problem is that in netplay or movies, the state of the CPU must be deterministic, including when the game receives notification that the GPU has processed FIFO data. Dual core mode notifies the game whenever the GPU thread actually gets around to doing the work, so it isn't deterministic. Single core mode is because it notifies the game 'instantly' (after processing the data synchronously), but it's too slow for many systems and games. My old dc-netplay branch worked as follows: everything worked as normal except the state of the CP registers was a lie, and the CPU thread only delivered results when idle detection triggered (waiting for the GPU if they weren't ready at that point). Usually, a game is idle iff all the work for the frame has been done, except for a small amount of work depending on the GPU result, so neither the CPU or the GPU waiting on the other affected performance much. However, it's possible that the game could be waiting for some earlier interrupt, and any of several games which, for whatever reason, never went into a detectable idle (even when I tried to improve the detection) would never receive results at all. (The current method should have better compatibility, but it also has slightly higher overhead and breaks some other things, so I want to reimplement this, hopefully with less impact on the code, in the future.) With this commit, the basic idea is that the CPU thread acts as if the work has been done instantly, like single core mode, but actually hands it off asynchronously to the GPU thread (after backing up some data that the game might change in memory before it's actually done). Since the work isn't done, any feedback from the GPU to the CPU, such as real XFB/EFB copies (virtual are OK), EFB pokes, performance queries, etc. is broken; but most games work with these options disabled, and there is no need to try to detect what the CPU thread is doing. Technically: when the flag g_use_deterministic_gpu_thread (currently stuck on) is on, the CPU thread calls RunGpu like in single core mode. This function synchronously copies the data from the FIFO to the internal video buffer and updates the CP registers, interrupts, etc. However, instead of the regular ReadDataFromFifo followed by running the opcode decoder, it runs ReadDataFromFifoOnCPU -> OpcodeDecoder_Preprocess, which relatively quickly scans through the FIFO data, detects SetFinish calls etc., which are immediately fired, and saves certain associated data from memory (e.g. display lists) in AuxBuffers (a parallel stream to the main FIFO, which is a bit slow at the moment), before handing the data off to the GPU thread to actually render. That makes up the bulk of this commit. In various circumstances, including the aforementioned EFB pokes and performance queries as well as swap requests (i.e. the end of a frame - we don't want the CPU potentially pumping out frames too quickly and the GPU falling behind*), SyncGPU is called to wait for actual completion. The overhead mainly comes from OpcodeDecoder_Preprocess (which is, again, synchronous), as well as the actual copying. Currently, display lists and such are escrowed from main memory even though they usually won't change over the course of a frame, and textures are not even though they might, resulting in a small chance of graphical glitches. When the texture locking (i.e. fault on write) code lands, I can make this all correct and maybe a little faster. * This suggests an alternate determinism method of just delaying results until a short time before the end of each frame. For all I know this might mostly work - I haven't tried it - but if any significant work hinges on the competion of render to texture etc., the frame will be missed.
2014-09-22Moved the linking of the FIFO CPWritePointer near where CPWritePointer gets ↵skidau
updated. The CPWritePointer was getting updated while it was in-flight causing Pac-man Party to flicker. Fixes issue 5223.
2014-09-08Include CommonTypes.h instead of Common.h.Rohit Nirmal
2014-08-26Refactor SetCpStatus into two functions for from-GPU and from-CPU mode ↵comex
rather than a boolean parameter. This shouldn't affect functionality. I'm not sure if the breakpoint distinction is actually necessary (my commit messages from the old dc-netplay last year claim that breakpoints are broken anyway, but I don't remember why), but I don't actually need to change this part of the code (yet), so I'll stick with the trimmings change for now.
2014-08-25CommandProcessor: mark some functions as staticTillmann Karras
2014-07-11mark all local variables as staticdegasus
2014-07-11mark all local functions as staticdegasus
2014-06-01Video backends: remove dead code.magumagu
2014-03-11Fixes spacing for "for", "while", "switch" and "if"Matthew Parlane
Also moved && and || to ends of lines instead of start. Fixed misc vertical alignments and some { needed newlining.
2014-02-20Fix more header sorting issues in VideoCommon/ (now check-includes clean).Pierre Bourdon
2014-02-18Dolphin now builds on Linux with only Source/Core as include dirPierre Bourdon
2014-02-17Second and final pass of clearing out tabs.Lioncash
2014-02-16Fix some vertical alignmentsLioncash
ie. uses spaces for alignment.