Commit graph

32 commits

Author SHA1 Message Date
squidbus 14f7dc3527
cache: Invalidate pages for file reads. (#1726)
* cache: Invalidate pages for file reads.

* texture_cache: Simplify invalidate intersection check.

* vk_rasterizer: Make aware of mapped memory ranges.

* buffer_cache: Remove redundant page calculations.

Called functions will convert to page numbers/addresses themselves.

* file_system: Simplify memory invalidation and add a few missed cases.
2024-12-11 21:11:24 +02:00
Daniel R. fea2593ab4
The way to Unity, pt.3 (#1681)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
2024-12-08 18:30:33 +02:00
Vinicius Rangel 0835dc71b3
More devtools stuff (#1637)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
* devtools: memory map viewer

* devtools: batch highlight only for non-group viewer

* devtools: fix not showing entire user data

* devtools: shader debug viewer

* devtools: add more reg naming
2024-12-01 19:34:29 +01:00
TheTurtle c4506da0ae
kernel: Rewrite pthread emulation (#1440)
* libkernel: Cleanup some function places

* kernel: Refactor thread functions

* kernel: It builds

* kernel: Fix a bunch of bugs, kernel thread heap

* kernel: File cleanup pt1

* File cleanup pt2

* File cleanup pt3

* File cleanup pt4

* kernel: Add missing funcs

* kernel: Add basic exceptions for linux

* gnmdriver: Add workload functions

* kernel: Fix new pthreads code on macOS. (#1441)

* kernel: Downgrade edeadlk to log

* gnmdriver: Add sceGnmSubmitCommandBuffersForWorkload

* exception: Add context register population for macOS. (#1444)

* kernel: Pthread rewrite touchups for Windows

* kernel: Multiplatform thread implementation

* mutex: Remove spamming log

* pthread_spec: Make assert into a log

* pthread_spec: Zero initialize array

* Attempt to fix non-Windows builds

* hotfix: change incorrect NID for scePthreadAttrSetaffinity

* scePthreadAttrSetaffinity implementation

* Attempt to fix Linux

* windows: Address a bunch of address space problems

* address_space: Fix unmap of region surrounded by placeholders

* libs: Reduce logging

* pthread: Implement condvar with waitable atomics and sleepqueue

* sleepq: Separate and make faster

* time: Remove delay execution

* Causes high cpu usage in Tohou Luna Nights

* kernel: Cleanup files again

* pthread: Add missing include

* semaphore: Use binary_semaphore instead of condvar

* Seems more reliable

* libraries/sysmodule: log module on `sceSysmoduleIsLoaded`

* libraries/kernel: implement `scePthreadSetPrio`

---------

Co-authored-by: squidbus <175574877+squidbus@users.noreply.github.com>
Co-authored-by: Daniel R. <47796739+polybiusproxy@users.noreply.github.com>
2024-11-21 22:59:38 +02:00
TheTurtle 87f8fea4de
renderer_vulkan: Commize and adjust buffer bindings (#1412)
* shader_recompiler: Implement finite cmp class

* shader_recompiler: Implement more opcodes

* renderer_vulkan: Commonize buffer binding

* liverpool: More dma data impl

* fix

* copy_shader: Handle additional instructions from Knack

* translator: Add V_CMPX_GE_I32
2024-10-19 15:30:58 +03:00
Daniel R. 7c00ac637a
core: Fix mmap being unable to map GPU memory 2024-10-12 16:35:12 +02:00
Daniel R. 80bf46da4c
core/memory: Pooled memory implementation (#1085)
Some checks failed
Build and Release / reuse (push) Has been cancelled
Build and Release / clang-format (push) Has been cancelled
Build and Release / get-info (push) Has been cancelled
Build and Release / windows-sdl (push) Has been cancelled
Build and Release / windows-qt (push) Has been cancelled
Build and Release / macos-sdl (push) Has been cancelled
Build and Release / macos-qt (push) Has been cancelled
Build and Release / linux-sdl (push) Has been cancelled
Build and Release / linux-qt (push) Has been cancelled
Build and Release / pre-release (push) Has been cancelled
2024-09-29 10:28:41 +03:00
Daniel R. 8c8a6ccddd
core/memory: Fix sceKernelMTypeProtect setting VMA type (#1037)
* I hate programming and will furiously smash my monitor if I ever see another oversight of this caliber ever again in my goddamn life

* Merge both protect functions together
2024-09-23 18:49:57 +02:00
menaman123 b9c6093717
Implemented sceKernelMTypeProtect and sceKernelMProtect (#387)
* Fixed ORBIS_KERNEL_MAP_OP_TYPE_PROTECT for batchmap2

* Fix merge

* Changed 4 to ORBIS_KERNEL_MAP_OP_TYPE_PROTECT

* Removed MProtect from AddressSpace

* Added Mtyprotect and moved Mprotect to ORBIS_KERNEL_MAP_OP_PROTECT

* Changed Protect for Windows

* reverted the previous function

* Fixed Mtypeprotect and MProtect

* ''

* ''

* Took out logs stopping build

* clang-format issues

* Fixed the order of mtypeprotect and mprotect in batchmap2

* ''

* update branch

* ''

* Fixed nits

* ''

* Update submodules to latest commits

* ''

* reverted ffmpeg

* ''

* Fixed the nits

* ''

* ''

* ''

* ''

* ''

* Fix clang formatting, DEBUG_ASSERT, and extra spacing

* Fix build issues

* Revert "Fix build issues"

This reverts commit 9185f96ec9.

* ''

* ''

* ''

* Changes for MemoryProt Format

* ''

* ''

* ''
2024-09-04 23:36:23 +03:00
Stephen Miller 04fbd7b9e7 Clang 2024-09-02 10:04:56 -05:00
Stephen Miller 9a772aa2f5 Clang fix 2024-09-02 10:03:39 -05:00
Stephen Miller f8d71b59d9 Fix MemoryManager::VirtualQuery header
The headers for these functions were technically not the same as the actual function definition. This didn't cause any emulation issues, but caused some weird issues with my IDE.
2024-09-02 09:30:32 -05:00
Paris Oplopoios f514fdfd18
Replace recursive_mutex with mutex (#708)
* Replace recursive_mutex with mutex

* Move mutex lock outside of ObtainBuffer
2024-09-01 22:20:22 +03:00
squidbus 905d49fd96
memory: Fixes for direct memory allocation. (#615)
* memory: Size direct memory based on requested flexible memory.

* memory: Guard against OrbisProcParam without an OrbisKernelMemParam.

* memory: Account for alignment in direct memory suitability checks and add more debugging.
2024-08-28 13:42:53 +03:00
Borchev 18f1799280
Add partial unmap support (#322)
* Add partial unmap support

* undo accidental whitespace removal

* Fix assertions

* Adjust Reserve and Free functions for partial unmapping
2024-08-13 09:05:30 +03:00
TheTurtle 381ba8c7a5
video_core: Implement guest buffer manager (#373)
* video_core: Introduce buffer cache

* video_core: Use multi level page table for caches

* renderer_vulkan: Remove unused stream buffer

* fix build

* oops forgot optimize off
2024-08-08 15:02:10 +03:00
georgemoralis c1d01709be
kernel: Implement sceKernelSetVirtualRangeName (#338)
* Fix in searchFree should fix #337

* clang format fix

* sceKernelSetVirtualRangeName implementation

* improved vaddr conversion

* updated VirtualQuery to include name too

* unmap also removed name thanks @red_prig

* fixed copy...
2024-07-29 19:08:06 +03:00
TheTurtle a2cd1669b6
memory: Cleanups and refactors (#324)
* memory: Various fixes

* Added (Partial) sceKernelBatchMap/sceKernelBatchMap2

* memory: Rename and implement batch unmap

* memory: Remove uneeded assert

* memory: Commonize free search routine

* memory: Contains check is inclusive

* memory: Address some alignment issues

* clang format

---------

Co-authored-by: raziel1000 <ckraziel@gmail.com>
2024-07-25 23:01:12 +03:00
georgemoralis 36ec7a1a43
Merge pull request #312 from Borchev/main
Add sceKernelGetDirectMemoryType, update sceKernelReserveVirtualRange
2024-07-21 22:52:50 +03:00
squidbus b3d97dcd89 Make sure system managed memory is in correct location on macOS. 2024-07-21 22:36:12 +03:00
squidbus 66fa29059c Add initial macOS support. 2024-07-21 22:36:12 +03:00
Borchev f556f85279 Add sceKernelGetDirectMemoryType and update sceKernelReserveVirtualRange to search for free region when virtual_addr==0 2024-07-21 11:29:24 -07:00
Daniel R 914aa10875
Misc implementations and fixes. (#250)
* Implement `sceKernelFtruncate` and `sceKernelUnlink`.

* Remove unused variable.

* Implement `sceKernelReserveVirtualRange`, misc fixes

* Fix `sceKernelReserveVirtualRange`.

* Add TODO on reserve

* Replace comment with assert.

* Add missing copyright header

* Add `UNREACHABLE` for `IOFile::Unlink`.

* Move NT API initialization out of the header

* Fix bug where files were always mapped as read only.

* `clang-format`
2024-07-11 15:35:58 +03:00
IndecisiveTurtle 2506a285f4 kernel: Implement some functions 2024-06-22 18:09:03 +03:00
TheTurtle c5d1d579b1
core: Many things (#194)
* video_core: Add a few missed things

* libkernel: More proper memory mapped files

* memory: Fix tessellation buffer mapping

* Cuphead work

* sceKernelPollSema fix

* clang format

* fixed ngs2 lle loading and rtc lib

* draft pthreads keys implementation

* fixed return codes

* return error code if sceKernelLoadStartModule module is invalid

* re-enabled system modules and disable debug in libs.h

* Improve linux support

* fix windows build

* kernel: Rework keys

---------

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
2024-06-15 14:36:07 +03:00
raphaelthegreat fc887bf3f5 core: Rework memory manager 2024-06-10 02:13:44 +03:00
psucien edaeee194d libs: gnmdriver: get tessellation ring factor address 2024-06-08 01:19:52 +02:00
TheTurtle 728249f58d
core: Properly implement TLS (#164)
* core: Split module code from linker

* linker: Properly implement thread local storage

* kernel: Fix a few memory functions

* kernel: Implement module loading

* Now it's easy to do anyway with new module rework
2024-06-05 22:08:18 +03:00
raphaelthegreat dd91456b48 video_core: Moar shader instruction 2024-05-30 18:17:54 +03:00
TheTurtle 8dfa5782b2
video_core: Add constant buffer support (#147) 2024-05-26 15:51:35 +03:00
TheTurtle 3c90b8ac00
video_core: Bringup some basic functionality (#145)
* video_core: Remove hack in rasterizer

* The hack was to skip the first draw as the display buffer had not been created yet and the texture cache couldn't create one itself. With this patch it now can, using the color buffer parameters from registers

* shader_recompiler: Implement attribute loads/stores

* video_core: Add basic vertex, index buffer handling and pipeline caching

* externals: Make xxhash lowercase
2024-05-25 15:33:15 +03:00
TheTurtle 55855b4195
core: Implement new memory manager (#133)
* core: Implement new memory manager

* ci: Attempt to fix linux build

* code: Fix a few build errors
2024-05-16 15:55:50 +03:00