* Kernel: Wake cores from idle directly rather than through a host thread
Right now when a core enters an idle state, leaving that idle state requires us to first signal the core's idle thread, which then signals the correct thread that we want to run on the core. This means that in a lot of cases, we're paying double for a thread to be woken from an idle state.
This PR moves this process to happen on the thread that is waking others out of idle, instead of an idle thread that needs to be woken first.
For compatibility the process has been kept as similar as possible - the process for IdleThreadLoop has been migrated to TryLeaveIdle, and is gated by a condition variable that lets it run only once at a time for each core. A core is only considered for wake from idle if idle is both active and has been signalled - the signal is consumed and the active state is cleared when the core leaves idle.
Dummy threads (just the idle thread at the moment) have been changed to have no host thread, as the work is now done by threads entering idle and signalling out of it.
This could put a bit of extra work on threads that would have triggered `_idleInterruptEvent` before, but I'd expect less work than signalling all those reset events and the OS overhead that follows. Worst case is that other threads performing these signals at the same time will have to wait for each other, but it's still going to be a very short amount of time.
Improvements are best seen in games with heavy (or very misguided) multithreading, such as Pokemon: Legends Arceus. Improvements are expected in Scarlet/Violet and TOTK, but are harder to measure.
Testing on Linux/MacOS still to be done, definitely need to test more games as this affects all of them (obviously) and any issues might be rare to encounter.
* Remove _idleThread entirely
* Use spinwait so we don't completely blast the CPU with cmpxchg
* Didn't I already do this
* Cleanup
* Implementing new features in the latest Concentus library - span-in, span-out Opus decoding (so we don't have to make temporary buffer copies), returning a more precise error code from the decoder, and automatically linking the native opus library with P/invoke if supported on the current system
* Remove stub log messages and commit package upgrade to 2.1.0
* use more correct disposal pattern
* Bump to Concentus 2.1.1
* Bump to Concentus 2.1.2
* Don't bother pulling in native opus binaries from Concentus package (using ExcludeAssets).
* Fix opus MS channel count. Explicitly disable native lib probe in OpusCodecFactory.
* Bump to package 2.2.0 which has split out the native libs, as suggested.
---------
Co-authored-by: Logan Stromberg <lostromb@microsoft.com>
* GPU: Migrate buffers on GPU project, pre-emptively flush device local mappings
Essentially retreading #4540, but it's on the GPU project now instead of the backend. This allows us to have a lot more control + knowledge of where the buffer backing has been changed and allows us to pre-emptively flush pages to host memory for quicker readback. It will allow us to do other stuff in the future, but we'll get there when we get there.
Performance greatly improved in Hyrule Warriors: Age of Calamity. Performance notably improved in TOTK (average). Performance for BOTW restored to how it was before #4911, perhaps a bit better.
- Rewrites a bunch of buffer migration stuff. Might want to tighten up how dispose stuff works.
- Fixed an issue where the copy for texture pre-flush would happen _after_ the syncpoint.
TODO: remove a page from pre-flush if it isn't flushed after a certain number of copies.
* Add copy deactivation
* Fix dependent virtual buffers
* Remove logging
* Fix format issues (maybe)
* Vulkan: Remove backing swap
* Add explicit memory access types for most buffers
* Fix typo
* Add device local force expiry, change buffer inheritance behaviour
* General cleanup, OGL fix
* BufferPreFlush comments
* BufferBackingState comments
* Add an extra precaution to BufferMigration
This is very unlikely, but it's important to cover loose ends like this.
* Address some feedback
* Docs
* Block input updates while swkbd is open in foreground mode
* Flush internal driver state before unblocking input updates
* Rename Flush to Clear and remove unnecessary attribute
* Clear the driver state only if the GamepadDriver isn't null
* Update audio renderer to REV12: Add support for splitter biquad filter
* Formatting
* Official names
* Update BiquadFilterState size + other fixes
* Update tests
* Update comment for version 2
* Size test for SplitterDestinationVersion2
* Should use Volume1 if no ramp
* Block input updates while swkbd is open in foreground mode
* Flush internal driver state before unblocking input updates
* Rename Flush to Clear and remove unnecessary attribute
* Add "Follow OS theme" option
* Update App.axaml.cs
* Add "Follow OS theme" option
* Update App.axaml.cs
* Remove `this`
* Remove annotation for nullable reference
* Change into switch expression to make it concise
* Change comments to XML docs
* Update en_US.json
* Fix icons in About dialog do not response to "auto" theme
The theme icons seemingly use Dark variant event when the OS theme is light. In addition, I added ThemeManager common to make it accessible for both App and AboutWindow
* Newline at the end
* newline moment
* Update ThemeManager.cs
* bait to switch to lf
* change to lf
* temp. revert
* Add back ThemeManager.cs common, pls pass the format check
* I found the mistake: should have put `ThemeManager.OnThemeChanged();` in try block
Finally solve the formatting check
* test formatting
* Update App.axaml.cs
* Ok i seem to forget to add version lol
* Fix info CA1816
* Truncate game title and details if they exceed DiscordRPC limit.
* Update implementation to a byte total check.
* Track if the string has actually been modified correctly.
* Allow an early function return and simplify logic.
* Better handling of large input strings and minimise loop opportunities.
* Remove unused using.
* Update to `applicationName` over `titleName`.
* Add files via upload
* Update IHidServer.cs
mistakes...
* format
how do i do it
* Update src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs
Co-authored-by: Agatem <agaatem@outlook.com>
* Update src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs
Co-authored-by: Agatem <agaatem@outlook.com>
* bruh
* Apply suggestions from code review
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
* use readuint32 instead
* second thought
* i hope it works
thanks someone higher up with the same thing
* pid
* Apply suggestions from code review
Co-authored-by: Ac_K <Acoustik666@gmail.com>
* styles i think
* Apply suggestions from code review
Co-authored-by: makigumo <makigumo@users.noreply.github.com>
---------
Co-authored-by: Agatem <agaatem@outlook.com>
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
Co-authored-by: Ac_K <Acoustik666@gmail.com>
Co-authored-by: makigumo <makigumo@users.noreply.github.com>
* Do not save window dimensions when maximized.
* Implement option to disable window size/position memory.
* Remove logging statements
* Implement menubar items for common window sizes.
* formatting fixes
* Set 720p window as a composite value.
* Remove unused using
* Fix exception paramter.
* Force restore window when a size change is requested
* Fix some resizing bugs.
* [Ava]: Fix Cursor States On Windows
It's been sometime since the last PR #5415 was made and last time i was waiting for Ava 11 to be merged before re-writing the code and along the way forgot about the PR.
Anyway this PR supersedes both #5288 and #5415, and fixes issue: #5136
* Now, the bounds for which the cursor should be detected in renderer should be accurate to any scaling / resolution, taking into account the status and the menu bar. ( This issue was partially resolved by #6450 )
* Reduced the number of times the cursor updates from per frame update to updating only when the cursor state needs to be changed.
* Fixed the issue wherein you weren't able to resize the window, because of the cursor passthrough which caused the cursor to reset from the reset icon or flicker.
* Fixed the issue caused by #6450 which caused the cursor to disappear over the submenus while cursor was set to always hide.
* Changed the cursor state to not disappear while the game is being loaded. ( Needs Feedback ).
* Removed an unused library import.
* PR feedback
* Fix excessive line breaks and whitespaces and other feedback
* Add a check before calculating cursor idle time, such that it calculates only while the cursor mode is OnIdle.
* PR Feedback
* Rework the cursor state check code block
Co-Authored-By: gdkchan <5624669+gdkchan@users.noreply.github.com>
* PR Feedback
* A simpler version of the previous implementation.
Co-Authored-By: gdkchan <5624669+gdkchan@users.noreply.github.com>
* PR Feedback
* PR Feedback
---------
Co-authored-by: gdkchan <5624669+gdkchan@users.noreply.github.com>
* Fix direct keyboard not working when connected with a controller
- Pass KeyboardDriver to NpadController.GetHLEKeyboardInput().
- Always fetch all keyboards if Direct Keyboard is turned on.
- Remove unnecessary return null.
* Get Keyboard Inputs outside of the controller loop.
- Moved GetHLEKeyboardInput outside of the controller loop.
- Made GetHLEKeyboardInput public static from public
* Removed extra newline
* Update src/Ryujinx.Input/HLE/NpadManager.cs
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
* Update src/Ryujinx.Input/HLE/NpadController.cs
Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
---------
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
The delta position of the mouse should be the difference between the current and last position. Subtracting the last deltas doesn't really make sense.
Won't implement pointer lock for first person games, but might stop some super weird behaviour with the mouse values appearing totally random.
* Add support for bindless textures from shader input (vertex buffer)
* Shader cache version bump
* Format whitespace
* Remove cache entries on pool removal, disable for OpenGL
* PR feedback
* perf: use ByteMemoryPool
* feat: KPageTableBase/KPageTable new methods to read and write `ReadOnlySequence<byte>`
* new: add IWritableBlock.Write(ulong, ReadOnlySequence<byte>) with default impl
* perf: use GetReadOnlySequence() instead of GetSpan()
* perf: make `Parcel` IDisposable, use `ByteMemoryPool` for internal allocation, and make Parcel consumers dispose of it
* remove comment about copySize
* remove unnecessary Clear()
* rebase
* add methods Ryyjinx.Common EmbeddedResources and SteamUtils
* GAL changes - change SetData() methods and ThreadedTexture commands to use IMemoryOwner<byte> instead of SpanOrArray<byte>
* Ryujinx.Graphics.Texture: change texture conversion methods to return IMemoryOwner<byte> and allocate from ByteMemoryPool
* Ryujinx.Graphics.OpenGL: update ITexture and Texture-like types with SetData() methods to take IMemoryOwner<byte> instead of SpanOrArray<byte>
* Ryujinx.Graphics.Vulkan: update ITexture and Texture-like types with SetData() methods to take IMemoryOwner<byte> instead of SpanOrArray<byte>
* Ryujinx.Graphics.Gpu: update ITexture and Texture-like types with SetData() methods to take IMemoryOwner<byte> instead of SpanOrArray<byte>
* Remove now-unused SpanOrArray<T>
* post-rebase cleanup
* PixelConverter: remove unsafe modifier on safe methods, and remove one unnecessary cast
* use ByteMemoryPool.Rent() in GetWritableRegion() impls
* fix formatting, rename `ReadRentedMemory()` to `ReadFileToRentedMemory()``
* Texture.ConvertToHostCompatibleFormat(): dispose of `result` in Astc decode branch