Commit Graph

14195 Commits

Author SHA1 Message Date
Eladash 7ff4509858 sys_lwcond: Fix a loose notification in cond wait 2022-08-11 12:44:40 +03:00
Eladash f2997e4c00 LV2: Fix the most annoying race ever
Timeline of the race:
1. The PPU is in SLEEP state. state = suspend.
2. lv2_obj::awake is called on the traced thread and is now in ONPROC state, state = signal.
3. lv2_obj::awake is called by another thread externally with a priority higher than our traced thread and appends it to g_pending. state = suspend + signal.
4. lv2_obj::sleep/set_priority (higering priority) is called on any thread which is in ONPROC. Causing it to enter SLEEP or RUNNING state, while the traced thread is back in queue in ONPROC. state = suspend + signal.
5. The traced thread finally calls lv2_obj::awake on itself, g_pending decrements to 0 and we a have a rescheduling event, after XOR state = 0!!! (no signal)
6. In check_state: cpu_sleep_called is now true and remains this way.
7. Another thread with a higher prioty kicks in and appends the traced thread into g_pending. state = suspend.
8. The traced thread is at cpu_thread::cpu_wait(), and that's where it's gonna spend the rest of its life.
2022-08-11 12:44:40 +03:00
Eladash 133e9d4705 CPUThread.cpp: Fix cpu_flag::pending reset 2022-08-11 11:42:16 +03:00
Eladash 501ca4bcf5 logs: Prevent potential deadlock of the main thread in stack mode
If a thread logs faster than the GUI thread can print on screen.
2022-08-11 11:42:16 +03:00
Eladash 9212942724 kernel_explorer: Add info about ppu_thread::ack_suspend
The wording is bad but unless the emulation went downhill it shouldn't print on screen repeatedly.
2022-08-11 11:42:16 +03:00
Eladash 683c1a6512 LV2: Optimize sys_ppu_thread a bit 2022-08-11 11:42:16 +03:00
Eladash 9b0d33048c Savestates/LV2: Fix race on _sys_lwcond_queue_wait saving
cpu_flag::again modification requires exclusive access.
2022-08-11 11:42:16 +03:00
Eladash bc8bf2c329 sys_cond/lwcond: Fix waiting time in the debugger for mutex lock 2022-08-11 11:42:16 +03:00
Elad Ashkenazi f0002501f7 sys_mutex/lwmutex: Regression fixes after #12378 2022-08-11 11:42:16 +03:00
Elad Ashkenazi c4cc0154be LV2: Optimizations and fixes
Fix and optimize sys_ppu_thread_yield

Fix LV2 syscalls with timeout bug. (use ppu_thread::cancel_sleep instead)

Move timeout notification out of mutex scope

Allow g_waiting timeouts to be awaked in scope
2022-08-11 11:42:16 +03:00
shinra-electric cba4c3cdc4
[macOS] Update hid_pad_handler.cpp to prevent DS4 from disconnecting (#12493)
Prevents DS4 (and possibly DS3) from disconnecting from bluetooth after 15 minutes by using hidapi's non-exclusive mode. 
The most recent version of hidapi, 0.12 from two months ago, added "macOS-specific function(s) to open device(s) in non-exclusive mode".
2022-08-11 07:14:37 +02:00
kd-11 c51d3b5465 Workaround for msvc weirdness 2022-08-09 18:32:54 +03:00
kd-11 e179adc4a0 rsx: Refactor surface cache storage 2022-08-09 18:32:54 +03:00
Elad Ashkenazi 47f3740a70
System.cpp: Replace std::filesystem usage (#12474) 2022-08-08 05:46:32 +03:00
nastys 2880370047
Update MoltenVK (#12456) 2022-08-07 20:54:31 +01:00
kd-11 61a055a1c6 Tuning 2022-08-07 22:14:49 +03:00
kd-11 64b4cfa59f rsx: Erase surface background when reloading after a pitch mismatch 2022-08-07 22:14:49 +03:00
kd-11 c799ffd223 rsx: Stubs for pitch conversion 2022-08-07 22:14:49 +03:00
Eladash 2ec039365f shared_mutex: Optimize busy-waiting by detecting waiters and try to steal the notifying bit
Add an unused has_waiters() method.
2022-08-07 20:23:54 +03:00
Eladash 26e731b487 LV2: Re-add dropped optimization by previous commit
Currently only for lock-free syscalls.
2022-08-07 20:23:54 +03:00
Eladash 34bae90820 LV2: Move nearly all notifications out of all mutex scopes including IDM 2022-08-07 20:23:54 +03:00
Eladash b55a052a22 IdManager.h: Do not lock IDM mutex if the preliminary ID check failed
Optimizes common ESRCH failures. (lambda variants only atm)
2022-08-07 20:23:54 +03:00
Eladash 011aabe9ed LV2: Make sys_mutex and sys_lwmutex lock-free, add some busy waiting in sys_mutex_lock 2022-08-07 20:23:54 +03:00
Eladash a17a6527f6 LV2: Move memory unlocking outside of mutex ownership and make it conditional 2022-08-07 20:23:54 +03:00
Eladash 122c6256ca A fix of _spurs::add_workload 2022-08-07 20:23:54 +03:00
Eladash 73aaff1b29 LV2: allocation-free synchronization syscalls
* Show waiters' ID in kernel explorer.
* Remove deque dependency from sys_sync.h
2022-08-07 20:23:54 +03:00
Eladash c7fbc16357 SPU: Postpone notifications to afterward group mutex ownership 2022-08-07 20:23:54 +03:00
Eladash bc728db15b LV2: Add busy waiting before entering atomic wait 2022-08-07 20:23:54 +03:00
Eladash 2eebbd307d LV2: Minor optimization regarding signal flag 2022-08-07 20:23:54 +03:00
Eladash dc851a729e LV2: Postpone thread notifications to afterward mutex ownership(s) 2022-08-07 20:23:54 +03:00
Eladash 6007fd630f Do not use lv2_obj::g_waiting when not needed in sys_timer_usleep 2022-08-07 20:23:54 +03:00
Megamouse cb0ecb2afb cellPngEnc 2022-08-06 10:35:10 +02:00
sguo35 84a785ea67 arm64: implement pshufb intrinsic 2022-08-05 22:53:11 +02:00
sguo35 cc1e4d2194 ppu/arm64: don't restore rsp on ppu_gateway return
Don't restore rsp on ppu_gateway return, since it can be reentrant. Also
change some registers to align with the x86 version's 32bit/64bit
usages.
2022-08-05 22:53:11 +02:00
Megamouse b2d84dcebd Qt: Add save filtered log to menu of log viewer 2022-08-05 20:50:51 +02:00
Megamouse 958d77ba52 Qt: filter log viewer when opening a file 2022-08-05 20:50:51 +02:00
Megamouse c4b38869ab Input: fix pad initialization 2022-08-05 20:16:21 +02:00
Eladash fd1968dd22 Savestates: Save SFO directory path for PSN games 2022-08-05 19:19:16 +03:00
Elad Ashkenazi 88b80ebdf5
sys_net: Fix missing locks in some syscalls (#12459) 2022-08-04 21:31:34 +03:00
kd-11 2445ab8d8e Fix RSX capture playback 2022-08-04 19:01:45 +03:00
Elad Ashkenazi 0e1931f178
sys_lwcond: Fix rare race on mode 3 signal (#12413) 2022-08-04 14:13:51 +03:00
kd-11 3e923b4993 rsx: Optimize VTX_FMT_SNORM16 decoding
- Cuts down SNORM16 overhead by ~65%
2022-08-03 23:33:31 +03:00
kd-11 8181498d86 gl: Alias UBO/SSBO slots to avoid exceeding the available number of binding slots.
- The sets are different anyway and should not overwrite each other in a proper driver.
2022-08-03 23:33:31 +03:00
kd-11 57dd611111 gl: Fix incomplete stencil view of depth-stencil texture
- Samplers must use point sampling for stencil views
2022-08-03 23:33:31 +03:00
Eladash b3162bd41c rsx/vp: Fix SNORM16 vertex decoding 2022-08-03 18:11:46 +03:00
Elad Ashkenazi cd2adbad9a Update rsx_methods.cpp 2022-08-03 17:15:59 +03:00
Elad Ashkenazi 99730ac4f9 Update rsx_methods.cpp 2022-08-03 17:15:59 +03:00
Elad Ashkenazi d2ab3383ad Update rsx_methods.cpp 2022-08-03 17:15:59 +03:00
Elad Ashkenazi 3b15a6b39e Update rsx_methods.cpp 2022-08-03 17:15:59 +03:00
Elad Ashkenazi 651e58f443 rsx: Trivial optimization 2022-08-03 17:15:59 +03:00