Commit Graph

53 Commits

Author SHA1 Message Date
Gliniak
40f6b5b3ac [Kernel] Improvements to host and guest objects handling 2023-01-06 09:13:21 +01:00
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
Triang3l
e720e0a540 [Code] Remove game names from code comments (most of at least) 2021-09-05 21:27:40 +03:00
gibbed
b18f73b949 [Kernel] Add make_object template. 2021-06-30 03:39:22 -05: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
Gliniak
7fd1991074 [Kernel/Object] Added base to object handle 2020-08-29 15:17:31 +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
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
948aa2400d Formatting all code. Too gnarly to rebase properly. 2015-12-29 13:13:34 -08:00
Dr. Chat
68f9949829 Make XObject::GetWaitHandle a protected function 2015-12-29 13:09:55 -08:00
Dr. Chat
5aff9d12ee Call XObject::WaitCallback on successful waits 2015-12-29 13:09:52 -08:00
Dr. Chat
87931369e4 XObject no kernel state constructor 2015-12-29 13:09:34 -08:00
Dr. Chat
7e88e54cbe XObject::host_object -> XObject::is_host_object 2015-12-29 13:09:23 -08:00
Dr. Chat
52ec24ea6a Stash handles rather than native pointers in Ke* objects. 2015-12-29 13:09:17 -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
Dr. Chat
ed85346f3b XObject Save/Restore 2015-12-29 12:32:50 -08:00
sephiroth99
ab2ef82d55 xobject: remove accept method of object_ref class
The removed method was causing an error in clang ("call to non-static member
function without an object argument"). As it was not used, simply remove
it.
2015-09-22 07:43:08 -07:00
Ben Vanik
8b0d4fb51c Linux tweaks. 2015-08-18 14:18:00 -07:00
Ben Vanik
0686227d23 Style fixes. 2015-08-08 16:40:14 -07:00
Ben Vanik
a92566dfc5 More style. 2015-08-07 21:29:03 -07:00
Ben Vanik
14beb27ebc xb style. 2015-08-07 07:56:57 -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
7ceaf678e0 Minor XObject function changes 2015-07-21 22:07:55 -05:00
Dr. Chat
e54477d0e4 XObject::StashNative 2015-07-17 19:52:29 -05: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
Ben Vanik
fb1f4906d9 xb format --all (we are now format clean). Buildbot will yell at you. 2015-06-22 22:26:51 -07:00
Dr. Chat
bdcadeffe5 XObject CreateNative 2015-06-12 21:30:32 -05:00
Dr. Chat
a0a8b7ec37 Add X_OBJECT_HEADER and X_OBJECT_CREATE_INFORMATION 2015-06-12 19:48:24 -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
120e09f8e7 XObject::GetObject->GetNativeObject 2015-05-25 00:52:19 -07:00
Ben Vanik
fff1a7c132 Switching std::thread to XThread and hosting in object_refs. 2015-05-25 00:51:26 -07:00
Ben Vanik
1104f8e687 Header cleanups and prep. 2015-05-25 00:51:25 -07:00
Dr. Chat
662fa97444 XObject SetNativePointer: Added flag to disable asserts on uninitialized memory 2015-05-16 18:47:33 -05:00
Ben Vanik
8d4f54e240 Thread state updates. 2015-05-16 01:45:56 -07:00
Ben Vanik
ec84a688e9 Starting to properly attribute virtual vs. physical memory accesses. 2015-03-29 11:11:35 -07:00
Ben Vanik
90e489527a Enough of ObOpenObjectByName to handle basic usage + asserts for others.
Fixes #143.
2015-02-11 09:42:12 -08:00
Ben Vanik
00e4a4fe1b Fix #include format. 2015-01-31 22:49:47 -08:00
Ben Vanik
1c4dcd5e0e clang-format on most of kernel/ 2014-08-17 13:13:03 -07:00
Ben Vanik
bca49bed4b Removing xe_mutex_t. 2014-08-16 00:56:50 -07:00
Ben Vanik
19149bbba6 Stubbed out enumeration. 2014-08-02 21:37:11 -07:00
Ben Vanik
9b78dd977b Migrating atomic ops to std::atomic where possible and poly. 2014-07-12 17:48:54 -07:00
Ben Vanik
cfe7b2127d Timers. Probably. 2014-01-07 21:55:32 -08:00
Ben Vanik
5019f350f8 Mutants. 2014-01-07 18:32:55 -08:00
Ben Vanik
40ca0bcb76 NtSignalAndWaitForSingleObjectEx (untested). 2014-01-07 00:28:48 -08:00