Commit Graph

73 Commits

Author SHA1 Message Date
Bo Anderson
9489161d0b kernel: separate host objects from regular handle range
Burnout Paradise statically expects certain thread handle values based on how many objects it knows it is allocating ahead of time.
From this, it calculates an ID by subtracting the thread handle from a base handle of what it expects the first such thread to be assigned.
The value is statically declared in the executable and is not determined automatically.

The host objects in the handle range made these thread handles higher than what the game expects.
Removing these, and allowing 0xF8000000 to be assigned, allows the thread handles to fit perfectly in the range the game expects.

It is not clear what handle range the host objects should be taking. For now though, they're 0-based rather than 0xF8000000-based.
2022-12-17 13:34:47 -05:00
chss95cs@gmail.com
8f7f7dc6ad fixed wine crash from use of NtSetEventPriorityBoost
add xe::clear_lowest_bit, use it in place of shift-andnot in some bit iteration code
make is_allocated_ and is_enabled_ volatile in xma_context
preallocate avpacket buffer in XMAContext::Setup, the reallocations of the buffer in ffmpeg were showing up on profiles
check is_enabled and is_allocated BEFORE locking an xmacontext. XMA worker was spending most of its time locking and unlocking contexts
Removed XeDMAC, dma:: namespace. It was a bad idea and I couldn't make it work in the end. Kept vastcpy and moved it to the memory namespace instead
Made the rest of global_critical_region's members static. They never needed an instance.
Removed ifdef'ed out code from ring_buffer.h
Added EventInfo struct to threading, added Event::Query to aid with implementing NtQueryEvent.
Removed vector from WaitMultiple, instead use a fixed array of 64 handles that we populate. WaitForMultipleObjects cannot handle more than 64 objects.
Remove XE_MSVC_OPTIMIZE_SMALL() use in x64_sequences, x64 backend is now always size optimized because of premake
Make global_critical_region_ static constexpr in shared_memory.h to get rid of wasteage of 8 bytes (empty class=1byte, +alignment for next member=8)
Move trace-related data to the tail of SharedMemory to keep more important data together
In IssueDraw build an array of fetch constant addresses/sizes, then pre-lock the global lock before doing requestrange for each instead of individually locking within requestrange for each of them
Consistent access specifier protected for pm4_command_processor_declare
Devirtualize WriteOneRegisterFromRing.
Move ExecutePacket and ExecutePrimaryBuffer to pm4_command_buffer_x
Remove many redundant header inclusions access xenia-gpu
Minor microoptimization of ExecutePacketType0

Add TextureCache::RequestTextures for batch invocation of LoadTexturesData

Add TextureCache::LoadTexturesData for reducing the number of times we release and reacquire the global lock.
Ideally you should hold the global lock for as little time as possible, but if you are constantly acquiring and releasing it you are actually more likely to have contention
Add already_locked param to ObjectTable::LookupObject to help with reducing lock acquire/release pairs
Add missing checks to XAudioRegisterRenderDriverClient_entry. this is unlikely to fix anything, it was just an easy thing to do
Add NtQueryEvent system call implementation. I don't actually know of any games that need it.
Instead of using std::vector + push_back in KeWaitForMultipleObjects and xeNtWaitForMultipleObjectsEx use a fixed size array of 64 and track the count. More than 64 objects is not permitted by the kernel. The repeated reallocations from push_back were appearing unusually high on the profiler, but were masked until now by waitformultipleobjects natural overhead
Pre-lock the global lock before looking up each handle for xeNtWaitForMultipleObjectsEx and KeWaitForMultipleObjects.
Pre-lock before looking up the signal and waiter in NtSignalAndWaitForSingleObjectEx
add missing checks to NtWaitForMultipleObjectsEx
Support pre-locking in XObject::GetNativeObject
2022-10-08 09:55:17 -07:00
Joel Linn
38d589d1e0 [kernel] Remove unnecessary string copy 2022-03-08 12:17:57 -06:00
Joel Linn
986dcf4f65 [Base] Check success of sync primitive creation
- Mainly use `assert`s, since failure is very rare
- Forward failure of `CreateSemaphore` to guests because it is more easy
  to trigger with invalid initial parameters.
2022-03-08 12:17:57 -06:00
Joel Linn
a86d7173e1 Refactor FourCC magic uses
- Use new fourcc_t type
- Improves compiler compatibility by removing multi chars
2021-06-02 22:28:43 -05:00
gibbed
164aa8e8ca [Kernel] Scope object type enum. 2020-11-22 20:34:07 -06:00
Silent
5bec69e983 [Kernel] Add some useful asserts 2019-11-30 20:08:30 -06:00
Triang3l
2507f1a819 [Memory] TranslateVirtual in shim and strings 2019-08-14 10:31:11 +03:00
gibbed
4970fc8673 [Kernel] Make XObject type() const. 2019-08-03 23:47:16 -05:00
gibbed
54b0e2aff6 [Kernel] Add XSymbolicLink. 2019-07-29 17:52:46 -05:00
gibbed
0d6bfc1a6b [Kernel] Rename NotifyListener to XNotifyListener to bring it in line with the naming scheme of kernel objects. 2019-07-29 13:43:13 -05:00
Margen67
896ac4a682 Update documentation.
- Convert http to https, provide archive link when possible.
- Made CPU-JIT.png more readable on dark themes;
Added a white background so there isn't black text on a black
background.
2018-11-22 09:20:09 -06:00
Ben Vanik
b02ca62388 Fixing most remaining C++ warnings in clang. 2016-01-01 18:37:33 +00:00
Ben Vanik
3ca0bff246 Avoid duplicate object handle assignment on creation. 2015-12-29 14:03:23 -08:00
Dr. Chat
ab9fac9a98 XMutant Save/Restore 2015-12-29 13:09:53 -08:00
Dr. Chat
5aff9d12ee Call XObject::WaitCallback on successful waits 2015-12-29 13:09:52 -08:00
Dr. Chat
366f91e191 XFile Save/Restore 2015-12-29 13:09:51 -08:00
Dr. Chat
d0284e943d XSemaphore Save/Restore 2015-12-29 13:09:45 -08:00
Dr. Chat
89c408965e Can't call constructors from other constructors 2015-12-29 13:09:35 -08:00
Dr. Chat
87931369e4 XObject no kernel state constructor 2015-12-29 13:09:34 -08:00
Dr. Chat
4a3773d2fb XModule Save/Restore 2015-12-29 13:09:32 -08:00
Dr. Chat
93602ed48a No need to double-retain Ke* objects, as having them in the object table is enough. 2015-12-29 13:09:32 -08:00
Dr. Chat
785824531c Fix the assert on no restore handler found 2015-12-29 13:09:20 -08:00
Dr. Chat
52ec24ea6a Stash handles rather than native pointers in Ke* objects. 2015-12-29 13:09:17 -08:00
Ben Vanik
194c13f977 REBASE: Fix vector out of range access. 2015-12-29 13:09:16 -08:00
Dr. Chat
5517518d36 XObject savestate setup (Save/Restore, tracks all handles, tracks if host object) 2015-12-29 12:35:59 -08:00
Ben Vanik
e5fbf840d2 Shuffling kernel/. 2015-09-06 18:07:52 -07:00
Ben Vanik
3c96b6fa0a DANGER DANGER. Switching to global critical region.
This changes almost all locks held by guest threads to use a single global
critical region. This emulates the behavior on the PPC of disabling
interrupts (by calls like KeRaiseIrqlToDpcLevel or masking interrupts),
and prevents deadlocks from occuring when threads are suspended or
otherwise blocked.
This has performance implications and a pass is needed to ensure the
locking is as granular as possible. It could also break everything
because it's fundamentally unsound. We'll see.
2015-09-06 09:30:54 -07:00
Ben Vanik
a92566dfc5 More style. 2015-08-07 21:29:03 -07:00
Ben Vanik
e01c2ac98d Fixing formatting. 2015-07-28 00:32:01 -07:00
Dr. Chat
997de209ec Reversed engineered X_OBJECT_HEADER a bit better 2015-07-27 18:26:07 -05:00
Dr. Chat
8e41d5a707 The kernel object table now keeps track of handle reference counts. 2015-07-22 19:34:33 -05:00
Dr. Chat
e54477d0e4 XObject::StashNative 2015-07-17 19:52:29 -05:00
Ben Vanik
a6012b73f4 Switching audio system to platform-agnostic primitives. 2015-07-14 23:13:56 -07:00
Ben Vanik
345fe60da0 Switching over kernel objects to the platform-agnostic APIs.
Possibly some regressions here.
2015-07-14 22:44:45 -07:00
Ben Vanik
c2e2b3380e Replacing X_ANSI_STRING with new style.
Progress on #297.
2015-06-27 12:16:52 -07:00
Dr. Chat
3e7870fb39 Make SetNativePointer setup the guest pointer 2015-06-12 22:46:19 -05:00
Dr. Chat
3bd5dc011c Free the object creation info on destruction 2015-06-12 21:35:49 -05:00
Dr. Chat
bdcadeffe5 XObject CreateNative 2015-06-12 21:30:32 -05:00
Dr. Chat
f96657ef7c Fixup DISPATCH_HEADER type_flags to its parts 2015-06-12 19:47:28 -05:00
Dr. Chat
864e257474 DISPATCH_HEADER -> X_DISPATCH_HEADER 2015-06-12 18:59:08 -05:00
Ben Vanik
e419d314b3 Audio now works a bit better, but is still broken :/ 2015-05-28 02:15:30 -07:00
gibbed
0b75d409d2 Somehow this assert got removed. 2015-05-27 15:06:11 -05:00
Ben Vanik
8244409501 Refactoring to enable future time scaling, coordinated clocks, etc. 2015-05-26 22:20:58 -07:00
Ben Vanik
120e09f8e7 XObject::GetObject->GetNativeObject 2015-05-25 00:52:19 -07:00
Ben Vanik
1104f8e687 Header cleanups and prep. 2015-05-25 00:51:25 -07:00
Ben Vanik
8ac1f61c64 RAII object reference, debug mutex, etc. 2015-05-25 00:51:24 -07:00
gibbed
f1d0fe909f Added an assert_not_null for native_ptr in XObject::GetObject. 2015-05-24 13:42:31 -05:00
Dr. Chat
f2ac2af8cd Change kernel state's object mutex to a recursive mutex
KernelState::IsKernelModule
2015-05-18 00:40:43 -05:00
Dr. Chat
662fa97444 XObject SetNativePointer: Added flag to disable asserts on uninitialized memory 2015-05-16 18:47:33 -05:00