Commit Graph

92 Commits

Author SHA1 Message Date
comex c579637eaf Run code through the advanced tool 'sed' to remove trailing whitespace. 2013-11-03 20:54:05 -05:00
Lioncash 97cd42f5c3 Remove some unnecessary includes as well as simplifying exisiting ones if possible. 2013-10-19 19:58:56 -04:00
comex 1570558789 Remove unused variable waitingForPEInterruptDisable. 2013-10-13 14:00:38 -04:00
Lioncash 8da425b008 Formatting cleanup for VideoCommon.
Block braces on new lines.

Also killed off trailing whitespace and dangling elses.

Spaced some things out to make them more readable (only in places where it looked like a bit of a clusterfuck).
2013-04-24 09:21:54 -04:00
Lioncash bab9963b00 New license header introduced for DiscIO, AudioCommon, InputCommon, VideoCommon, and Common projects. 2013-04-17 23:09:55 -04:00
Jordan Woyak 385d8e2b15 ChunkFile has allowed me to accidentally "Do" a non-POD for the last time! 2013-04-09 19:02:22 -05:00
Lioncash f432d6038e Fix some typos and correct some capitalizations in the log messages.
Makes the logging look more orderly and less spammy when spitting out things.
2013-03-31 19:13:30 -04:00
skidau 0ccaaee38c Forced the exception check only for ARAM DMA transfers.
Removed the Eternal Darkness boot hack and replaced it with an exception check.
2013-03-26 08:23:20 +11:00
skidau 1d550f4496 Forced the external exception check to occur sooner by changing the downcount.
Fixes issue 5825.
2013-03-25 00:47:44 +11:00
lioncash edd9d0e0ef Clean up more space/tab mismatches in AudioCommon, Common, and VideoCommon.
Not planning to touch Core since it's the most actively changed part of the project.
2013-03-19 21:51:12 -04:00
James Dunne f1ef51abc8 Removing `Core::IsGPUThread()` and `Core::IsCPUThread()` calls in favor of simple `bool isCPUThread` parameter value. 2013-03-15 19:42:42 -05:00
skidau 9bff8e00c8 Added preliminary support to synchronise the timing of the CPU and GPU threads. A new option has been added to the game properties for this purpose. This option may help with random freezes in Dual Core mode.
Fixes Gladius and Baten Kaitos: Eternal Wings and the Lost Ocean

Fixes issue 5150.
2013-02-16 12:51:09 +11:00
skidau 9a4e9da7c2 Set the token and finish interrupt signal from the video thread. This fixes the inconsistent state caused by lag from the scheduler. Fixes Rayman 3: Hoodlum Havoc and Shamu's Deep Sea Adventures.
Fixes issue 5401.
Fixes issue 5589.
2013-02-03 18:05:46 +11:00
skidau 867bfaa696 Changed cmdidle to match the isGpuReadingData flag. Fixes the random freezes in The Last Story. 2013-02-02 20:50:40 +11:00
skidau 1b6240f7f9 Changed cmdidle to be idle on breakpoint.
Added low watermark interrupts generated by the gather pipe.

Fixes Gladius from not booting.

Fixes issue 5518.
2013-01-25 20:04:31 +11:00
marcosvitali 20eca1bf7e Ive fixed definitely Pokemon XD in dual core mode. This game is doing something not allowed. It attach to CPU the same fifo attached to the GPU in multibuffer mode. I added a check to prevent overwrite the GPU FIFO with the CPU FIFO. If the game do that on breakpoint the solution can fail.
Fixed ReadWriteDistance calc when CPRead > CPWrite.
Added Token and Finish cause to GP Jit checking.
2012-03-18 22:54:58 -03:00
skidau dc79d68e72 Added the corresponding change from r352ab2ba4394 into JITIL.
Tidied some code.
2012-03-13 22:35:11 +11:00
marcosvitali fedf6055ce I've fixed Super Monkey Ball in some cases when the game write the WriteReadDistance need to be safe like the SafeCPRead.
This fix is not related with the previous commits, but the previous commits help me to see that because in the new scenery SMB was hanging. May be in the past also doesn't boot some times because of that.

Please Test FZero boot also. Thanks.
2012-03-11 12:40:39 -03:00
marcosvitali 104603467b This commit fix games hanging because of my prior Revision c2e6fdf09f
The external exceptions in dolphin are checking frequently but is different to real HW, so sometime the game is in a loop checking GPU STATUS, the exceptions doesn't checked, and the game hang.\
For solve this I need a trick: still waiting for the exception handler be linked but if CommandProcecsor is reading the GPStatus, resume this.

This fixed "TimeSplitters: Future Perfect" broken in the Revision c2e6fdf09f and surely others games.
2012-03-09 18:58:23 -03:00
marcosvitali 41652d6b1f I've fixed Metroid Prime 3 and 2 desync. And other games with desync because of FIFO Reset.
That happens because  FIFO_RW_DISTANCE_HI must be written first, for checking fifo.CPReadWriteDistance == 0, so some fifo resets was not managed in the right way.
I didn't test Metroid 2 desync reported in Issue 4336 but I think is the same.
About the flickering in MP2, I don't know for my is not related or yes, but you can test anyway.

Fixed Issue 3902

Well now the FIFO is 99.99% finished :)
2012-03-09 01:33:29 -03:00
marcosvitali c2e6fdf09f - I've fixed possibles random hangs in DC mode.
- I've fixed hangs in DC mode in (Simpsons, Monkey Island, Pokemon XD, etc)
- I've implemented accurate manage of Pixel Engine Interrupts, now the GPU loop is stopped when a PE Interrupt needs to be managed and resume when Pixel Engine finish,
I think now, the Fifo in DC mode is more accurate than SC mode. :)

Time to close the big fifo Issue 3694 (snif), please if you have a possible fifo issue report this like a game issue.

I was working with Skid_AU together, especially thanks for him.

Test a lot all games, and compare the performance with the master maybe this accuracy has a cost (not a lot).
I think now the fifo is very stable, overflow fixed, random hang fixed, if you have a game with a hang with this rev and not in master please report this.
2012-03-08 02:47:55 -03:00
marcosvitali b0f75f17ae This release still fixed the hangs produced by fifo overflow without sacrifice performance.
For example you can test Tutorial moves at the beginning of The last history now is fluid 30/60.
Shuffle2: I've delete the hacky line, I think is not necessary anymore. Additional some clean in CommandProcessor.
Please test The Last Story and others games affected in the previous commits and give me a feedback.
2012-03-05 02:40:10 -03:00
skidau 9e398fd418 Added an external exception check when the CPU writes to the FIFO. This allows the CPU time to service FIFO overflows. Fixes random hangs caused by FIFO overflows and desyncs like in "The Last Story" and "Battalion Wars 2". Thanks to marcosvitali for the research.
Fixes issue 5209.
Fixes issue 5150.
Fixes issue 5055.
Fixes issue 4889.
Fixes issue 4061.
Fixes issue 4010.
Fixes issue 3902.
2012-03-02 18:53:41 +11:00
NeoBrainX 2d6d73df95 [maintenance] Add a note explaining why we aren't emulating CP clear register writes.
For further reference, see also r700f5eabc752.
2012-01-21 14:58:29 +01:00
nitsuja 39613a95a8 initialize the uninitialized 2012-01-04 01:36:09 -08:00
Marcos Vitali c7ae0eb0d1 Big Fifo Commit Part2: Now the fifo is more stable than my first commit, so is time...
- ReImplementing Single Core Mode like Dual Core Mode Style.

- Stage 1: My goal is, we have the Fifo, CommandProccessor code the more clear, maintenible and documented possible. When I quit dolphin I want any developer can continue with the work only reading the code.
	
* Big Refactoring: A lot of functions was changed the names, and modularized.
Now the FifoLoop and CatchUpGPU does not exist, was replaced by RunGpu() and RunGpuLoop().
The general idea is modeling the code like the real HW. The fifo is only a buffer where the Write Gather Pipe write the commands and from the Graphic Processor read these.
* Big Clean UP a lot of obsolete code and comments was deleted, like DcFakeWachDog, "Fifo very soon hack", etc.

In the stage 2, I will refactoring more code doing emphasis in the division of CommandProcessor, Fifo, Gpu Emulation. Beside I will comment all functions and variables in the code (Don't worry I will ask for English help for this part ;) )

Please test a lot SC mode and DC mode :)
Thank you so much for testing always and the patience. I don't like broke your favorite game but... you must believe me this part is very sensible, I only try to contribute for have a better and stable dolphin emulator.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7185 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-17 04:25:21 +00:00
Glenn Rice 0ae8d33149 Some work on changing comments, log messages, and variable and function names to reflect that the plugins are not plugins anymore.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7170 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-14 02:18:03 +00:00
Marcos Vitali be193088ca - FIX RE0 GFX fifo errors :D
- This game read the CPRead pointer when the GP is processing data and after detach the fifo  and attach again an use this pointer for continue, so implement fifo.SafeCPReadPointer pointer.
- fifo.SafeCPReadPointer is updated when (FAKE_GetFifoEndPtr() - g_pVideoData) == 0) to have a pointer without GFX Commands Cut in the beginning of 32 block.
- Reset video buffer when the CPReadWriteDistance is written by the software.
- This commit is experimental please test a lot your games.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7165 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-13 15:08:37 +00:00
Marcos Vitali 1d2c936f08 - Delete FIFO CriticalSection sFifoCritical for SAVE STATES. With the skid_au last changes that is not necessary anymore.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7162 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-13 05:52:09 +00:00
Marcos Vitali 05feabdb49 - Reimplemented FifoReset in other way, only call to GPFifo::ResetGatherPipe() ResetVideoBuffer() in FIFO_RW_DISTANCE_LO when this is equal to "0"
- In the Command Processor Control Register when GPReadEnable is OFF, wait until the fifo lopp finish with thi actual 32 bytes block. This is necessary to have Safe Disabble GP Read in this way AbortFrame is performed by the software, beside this can help to have accurate GPReadEnable OFF.
Please test Metroid Prime 1/2, Guilty Gear XX, X men gc, SMG, and shuffle you can test Harry Potter Prince for WII. :)

PD: The fifo code need a clean very soon.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7158 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-13 02:21:11 +00:00
Marcos Vitali 86278642dc Experimental commit and one fix for my last commit.
I think that isFifoBusy bring better sync with VI (video interface) because the CPU emulated threads are waiting for DrawDone in BP Register. So, I do some modifications.
1) Rename "IsFifoBusy" by "isPossibleWaitingSetDrawDone"
2) Only activate isPossibleWaitingSetDrawDone when bFF_GPLinkEnable is true in fifo loop "Inmediate mode" that is because in theory this drawsync function is using in this mode.
3) Deactivate isPossibleWaitingSetDrawDone also in SetFinish in PixelEngine, beside when 32 block is finish.

Please regression in yours games thats can bring some FPS more above all with VPS frame limiter ON (Auto, 60, 50, etc).

- Fix waiting in AbortFrame(), please test mp1/mp2 is fixed again.

Good look! 

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7123 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-10 04:47:02 +00:00
Rodolfo Osvaldo Bogado 00c35451f6 second step in dlist optimizations: test the hashes only when the cpu could change the contents of the dlist, this is after it been processed, or at frame finish.
this is marcos idea so the credits go to him.
please test the broken games in my last commits to see if this solve all the issues.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7114 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-08 12:00:41 +00:00
skidau 855f97841d Paused the video thread while a save state was being created or loaded. Performed the save state operation after the fifo became idle. Saved the interrupt status of the video thread into the save state. This helps stabilise the save states in dual core mode in games like Super Mario Galaxy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7112 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-08 10:37:47 +00:00
Marcos Vitali f0adc3adb4 Speed back to dolpihn: - Revert Read16 CPRead fifo hack for fix RE0. This hack only solve RE0 but brings slowdown in games like RE Umbrella, etc. - Move isFifoBusy again in the fifo loop and use s_fifoIdleEvent for AbortFrame. Note: if you can play RE0 only deactivate PanicAlert. These opdecoding error seems harmless. Some day this wiil be fixed in right way.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7107 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-08 01:11:11 +00:00
Jordan Woyak fbaf965995 Eliminated the plugin interface. Merged DX9/DX11/OGL video plugins into Dolphin. It could still use a lot of cleanup. Lots of things are still named "plugin". Software renderer is temporarily disabled until it gets some namespaces. I only updated vs08/10, Linux/OSX builds are broken.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6996 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-01-31 01:28:32 +00:00
Marcos Vitali c0571ae9de Improve for my last commit, also reset the VideoBuffer and Forget turn on GPReadEnable. If this is not enoughs for GC games. I will replace CPReadWriteDistance = 0 for ProcessFifoAllDistance.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6974 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-01-29 21:26:46 +00:00
Marcos Vitali fb35a83d2c - Fixed Metroid Prime 2 "GFX FIFO: Unknown Opcode (0x%x).\n" This was happened because FIFO_RESET is executed, but at this moment the Write Gather Pipe is not empty. (maybe also fix the same problem reported in MP1, i dont have this game for testing)
- Reimplemented AbortFrame. Now the  Write Gather Pipe buffer is reseted and Read Write Distances is reseted before the game do it instead  the  process all GP CPRWDistance for prevent CP wrong pointers.
This fifo reset should be more accurate, efficient and smooth the FPS when happens. Please, test regresion of SMG1 and SMG2 or others games with FIFO RESETS.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6971 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-01-29 20:04:16 +00:00
Marcos Vitali be5c732254 Quick fifo commit:
* Change the process ProcessAllDistace to ClearRegister
* Fix a bug in ProcessFifoEvents() in commandProcessro (thanks Skid)
-- The last 2 items should be improve the speed lost in r6572 and maybe improve a little bit because ProcessFifoEvents() is right. (Test car selection in GxZero)
* Alliviate Fifo desyncs, In the meant time I still Researching for real solution. (This fix RE0 again and maybe others 
"FIFOs linked but out of sync" and "GFX FIFO: Unknown Opcode (0x%x).\n" games suffers these for desync.)


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6837 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-01-13 01:29:34 +00:00
Marcos Vitali 24eafcb342 More FIFO work. This is an Experimental commit, Fixed "Monopoly Wii" ("FIFOs linked but out of sync" problem in this game) Re-sync the FIFO again when this is in immediate mode. Copy CP register values to PI register. Now this games is booting and ingame :)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6682 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-29 07:12:37 +00:00
Marcos Vitali 695010520f More FIFO work, HACK Solution for extreme overflow on breakpoints.
1) What is the FIFO? The fifo is a ring queue for write (CPU) and read (GPU) the graphics commands.
2) What is the Brakpoints? The breakpoint is the FIFO mark to allow parallel work (CPU-GPU) When the GPU reached the breakpoint must stop read immediately until this Breakpoint will be removed for the CPU.
3) What is an overflow? The CPU write all room FIFO possible, and like a ring overwrite commands not processed yet.
4) ¿Why you have an overflow? In theory should not have an overflow never because the fifo has another mark (High Watermark) When the CPU Write reach this mark raise a CP interruption and the FIFO CPU WRITES should stop write until distance between READ POINTER AND WRITE POINTER will be equal to another mark (LO Watemark to prevent and overflow.
5) ¡So if impossible why you have overflows? Simple, the CP interruption is processed later and the Overflow happens. (there is a lot of theories about this)
6) ¿Why is no so simple like when CPU WRITE POINTER is near to the end of the FIFO only process pending graphics command?
Because when this happens sometimes we are in BREAKPOINT and is IMPOSIBLE process the graphics commands.

- This HACK process the pending data when CPU WRITE POINTER is 32 bytes before the end of the fifo, and if there is a Breakpoint force the situation to process the commands and prevent an overflown.
In theory you have not see "FIFO is overflown by GatherPipe nCPU thread is too fast!" anymore. But if you have a hang in game where you had this please read the NOTICE LOG in user\logs, I've added this message "FIFO is almost in overflown, BreakPoint" when the hack is activated. (I will delete this message very soon)

Good Luck!! PD: Shuffle sorry for the large commit description :P

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6662 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-27 02:55:35 +00:00
Marcos Vitali 5fd9951649 - I've implemented cache of interrupt states for PEFINISH and PETOKEN
- I've implemented calling to ProcessFifoEvents when is there is a pending event in the main queue from CP, PE & GP
- I've implemented FifoIntReset(TRUE, TRUE) in write Clear Register.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6572 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-13 07:56:54 +00:00
Marcos Vitali dde2d1a117 Before my second part, little fixes :D 1) I was wrong the games can use also BP and BP int in multi buffer mode or or at least Pokemon XD can hehehe. Pokemon is booting again but this game also need accurate AbortFrame dont care about "GFX FIFO: Unknown Opcode" in this case 2) Fixed a stupid error in UpdateInterrupts (CUT&PASTE mistake)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6570 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-13 04:44:33 +00:00
Glenn Rice 73da637a42 Rename wii wc24 system files to lower case as on the wii itself. These files are not detected on linux unless the case matches. This fixes an issue when Mario Kart Wii (and possible other games) is run with a clean user directory that renders the game unplayable.
Also fix some compiler warnings.
On linux don't install the license.txt file.  Most distributions handle license files via a package.  For example on debian based systems this gives a lintian warning.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6568 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-12 15:25:03 +00:00
NeoBrainX 3d0ec2f2f1 Remove the watermark tightness option since it's obsolete now.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6567 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-12 10:59:06 +00:00
Marcos Vitali a9ca9cfd9b BIG FIFO Commit PART 1! Sometimes you need to write everything from 0, so 10 days later Ive rewrited some parts of the FIFO in Dual Core mode. Is pending use the same code for SC mode.
- Improved the GP Register Status: now this is all the time from the fifo loop.
- Improved the Interrupts manage:
	1) Removed All UpdateInturrupts from CommandProcessor Writes and Read.
	2) now the CP interrupts are schedule from the video thread and the fifo loop waiting until this happens
	3) considering Inmediate mode for the CP interrupts
	3) Implemented Interrupt CP Cache State
	4) Implemented only Overflow interrupt in GatherPipeCheck because this need to be detected quickly.
- Implemented Overflow handling like a real HW, when Hiwatermark interrupt happens this write ClearRegister with True en HI and False in LO (FifoIntReset) after that a Control Register is writed and the FIFO is processed  to LO Watermark.
- Removed all ugly code from LO and HI watermark manage
- Removed all ugly code from BP manage
- Change >= by == in the BP clauses
- Removed speed hack (1024 chunk) for better GP Status Control.
- Commented GXSetGPFifo very soon hack
- Commented FackWatchDog hack
- Commented FIFO_RW_DISTANCE = WritePointer hack

This is the beginning and the base for the future., If this broke your favorite game my apologize, only report this and will try solve it. If you have a Overflown don't worry, I've implemented the real solution code using the Overflow Interruption only need continue working for a perfect protection. Why I did it? Because is preferable a accurate and clean fifo instead hack y fifo for improve that. Thanks to DONKO for you awesome Video Plug in and skid for the chatting. PD: I have 7-10 fps more in the star fox video. bye :P


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6554 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-11 12:42:55 +00:00
Rodolfo Osvaldo Bogado 97e3a3ea6f remove fifowait flag, is not needed now as we execute all events that need to be executed even if the cpu is waiting for the fifo.
this way fifo will not avid other thread events to bi executed.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6514 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-04 03:44:56 +00:00
Marcos Vitali 08a3b60f8c I reverted my last commit 6508. I was wrong, sorry about that. It is 3am maybe need to rest of the FIFO for while. My Apologies.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6509 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-03 06:08:12 +00:00
Marcos Vitali ad8248cedd The STATUS_REGISTER should return the actual status HI (Overflow) and LO (underflow) watermark because this register can be polled by the game.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6508 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-03 04:58:28 +00:00
Marcos Vitali 9f6dd239b6 Possible FIX to randoms hangs, this correction in the clause fifo.bFF_Breakpoint=false fix hangs in WII Music, I don't have WII sport resort, etc. Please test games with fifo hangs (FPS:0 VPS:99) in yours PC again. :D
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6507 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-03 01:29:43 +00:00
Marcos Vitali 0718e1bd77 More fifo work and the Pokemon teaching us ;)
* I've fixed concurrency problem with fifo.bFF_GPReadEnable when the breakpoint is achieved
* I modified when fifo.bFF_Breakpoint is turn off to prevent that the  interruption happens
* I reverted r6483 
* I improved the commit r6495 adding another protection when the GPRead is enabled in CTRL_REGISTER

You can test Pokemon XD in dual core mode is more estable now :P This commit could solve others hangs fifo related in DKC, Sport Resorts, etc. I dont have these games.



git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6503 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-01 03:04:36 +00:00