aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/engines/puller.cpp
Commit message (Collapse)AuthorAgeFilesLines
* video_core: don't execute command lists copied before their channel waitedSssnowyyy33 hours1-0/+2
| | | | | | | | | | | | | | | | | | cce6d44af2 executes each command list entry from a copy of its words taken at submit. Games submit command lists before writing them: the lists wait behind a semaphore acquire, and the game writes their commands just before it releases the acquire (Mario Kart World after present). The copies of those lists were stale. Pokopia stopped after its first frame on macOS: its GPU never reached the fence the game spun on (EDEN_NX2_PB_SNAPSHOT=0 made it run again). Count each channel's suspensions on an acquire and the resumes after them, and record the count with each copy. A list copied while its channel was suspended, or whose channel suspended since, reads guest memory instead. Lists submitted and run without a wait in between keep the copy. EDEN_NX2_PB_SNAPSHOT=0 still disables it altogether. Assisted-by: Claude Sonnet 5.5 (first version); Claude Opus 5.5 (bisect, suspension count, testing and commit message)
* video_core: split the GPU thread in two (EDEN_NX2_SPLIT, off by default)Takoroka5 days1-12/+46
| | | | | | | | | | | | | | | | | | | | | | | | The GPU thread (front) takes the CPU's commands, parses command lists and runs the puller; engine method calls and everything behind them (registers, draws, dispatches, the rasterizer and its caches) run in order on a second thread (back), fed through a single-producer single-consumer ring (gpu_split.h). Work the front did on back-owned state (end of command list flushes, channel binds, semaphore releases, syncpoint increments, flush/invalidate requests, presentation) is deferred into the same ring; the front waits for the back only where it needs a result from that state: semaphore acquires and MME DMA reads. EDEN_NX2_SPLIT=1 runs macros on the back. EDEN_NX2_SPLIT=2 runs the 3D and compute macros on the front against copies of the registers they read (Maxwell3D/KeplerCompute Front*), drops state writes that keep a register's value there, and sends the rest. EDEN_NX2_SPLIT_VERIFY=1 compares the copies with the back's registers every 4096 macro calls (0 differences in 40,193 checks in title 1); EDEN_NX2_SPLIT_CHECK=1 logs the stack of any other thread using the Vulkan scheduler while the back runs. Switch 2 titles, Vulkan, non-accurate GPU only. Title 1, 3D attract loop: ~44,000 draws a second on one thread, ~47,400 with EDEN_NX2_SPLIT=1, 50,000-66,500 with EDEN_NX2_SPLIT=2.
* nx2: profile engine method calls and semaphore acquires; notes 140-141Takoroka5 days1-0/+3
| | | | | | | EDEN_NX2_GPU_PROFILE now times engine method calls (the work a split GPU thread's back half would run) and counts semaphore acquires and those that wait. Title 1: method calls ~343 ms a second (6.9 million), front-half work (command parsing, macros) ~333 ms, acquires ~2,700 a second of which ~220 wait. Notes 140 (macro compiler) and 141 (draw setup).
* nx2: semaphore releases latch the acquires they satisfyTakoroka7 days1-1/+19
| | | | | | | | | | | | | | Switch 2 channels that wait for an exact semaphore value poll on the console and see every release. Eden resumes a waiting channel only between command lists and writes releases when fences signal, often several back to back, so an acquire-equal could miss its value and wait forever. Title 4's 3D queue ticks a counter that two other queues wait on value by value; under the loading after the post-customization save one of them missed a tick and the game froze (channel 4 waiting for 0x5293 with the counter at 0x5310). Pending acquires now register with Nx2SemaphoreWaiters before fences run, and every query-cache payload write and QMD add/max release latches the waiters it meets at the moment it is written.
* nx2: frame-locked input replay and quieter logsTakoroka7 days1-2/+2
| | | | | | | | | | | EDEN_NX2_KEY_RECORD records keyboard transitions as "f<frame>:code" against a global count of guest presents; EDEN_NX2_KEY_SCRIPT replays them on the same frames (or by seconds, as before), so a played session reproduces exactly. Debug aids: the PC/LR/SP of the first unmapped reads, NSO load addresses, EDEN_NX2_IPC_SUMMARY (request counts every 5 s), EDEN_NX2_FORCE_LOD0. Unmapped-access logging is rate limited and the per-draw/semaphore spam is demoted, so long sessions stay under the log size cap.
* nx2: title 4 runs past its loading screen without GPU stallsTakoroka7 days1-2/+4
| | | | | | | | | | | | | | | - Native QMD: a launch whose shader Eden can't translate still completes and fires its releases (the console never fails a launch; queues wait on them). - QMD releases with flag bit 19 are max releases: NVN2 tracks QMD completion in a word other releases also advance, so a plain write moved it backwards. - Ampere lowering: LDSM.16.M88.{1,2,4} (SHFL + LDS), IMAD with a negated uniform addend, strong LDG (bit 77), 2D TLD4 gather, RED MIN/MAX/..., AST of RZ. 210 of the 214 shaders title 4 uses after its menu now lower. - Maxwell3D: ignore constant buffer binds to slots >= 18 instead of writing past the state array. - Debug: EDEN_NX2_SEM_WATCH covers QMD and compute-macro releases and logs address spaces; EDEN_NX2_3D_METHODS logs the first write to each 3D method; constant buffer binds are logged once per stage/slot.
* nx2: get title 4 past the difficulty confirmTakoroka7 days1-2/+20
| | | | | | | | | | | | | | | - MME: implement MME_DMA_READ / MME_DMA_READ_FIFOED (Turing macros read query results into their load FIFO; the conditional-render macro at 0x142 needs it). - vi2 present waits up to 4 s for the frame fence (was 250 ms) so shader compile stalls don't let the game lap its equal-value gate semaphores. - Native QMD: fire the third release slot at word 52, which NVN2 patches for queue-to-queue syncs (compute queue releasing a gate the 3D queue waits on). - Compute class SET_REPORT_SEMAPHORE (0x6c0-0x6c3) releases. - Ampere lowering: AOFFI, any LOP3 truth table, STG RZ, LDG 0x981, IABS, I2FP rounding, IMAD negated addend, SHFL 0x989 (all 77 title-4 shaders lower). - Debug: EDEN_NX2_SEM_WATCH=<addr> traces acquires, releases, method arguments and compute macro emits for one semaphore block; EDEN_NX2_KEY_SCRIPT scripted key presses; per-submit logs moved to TRACE.
* Switch 2: suspend channels on semaphore acquires; fix pushbuffer desyncsTakoroka7 days1-7/+126
| | | | | | | | | | | | | | | | NVN2 gates command buffers with semaphores the CPU releases after writing them. Eden read past unmet SEMAPHORED acquires, so it executed stale commands and desynchronised. Channels now suspend on an unmet acquire and resume from the same word once it is met (scheduler keeps the waiting channels, the GPU thread polls them), as in changes.patch. Also: methods split across GPFIFO entries around a called command buffer are set aside and resumed; subchannel 2 defaults to inline-to-memory; unbound subchannels and out-of-range compute/DMA methods are dropped instead of crashing; 4-byte semaphore releases no longer write 16 bytes; Ampere SEM_PAYLOAD_HI/SEM_EXECUTE no longer spin as Kepler acquires; unmapped GPU reads log instead of asserting. Debug aids: EDEN_NX2_PB_CHECK (pushbuffer changed after submit), EDEN_NX2_QUERY_TRACE, a one-time pushbuffer dump.
* Switch 2: window image sizes, queue semaphores, built-in fonts, memory budgetTakoroka7 days1-0/+20
| | | | | | | | | | | | - gsv 1510 CalculateRequirements: block-linear size/alignment for window images. - nvhost-gpu: Switch 2 channel event 7 is a real (unsignalled) event. - Puller mirrors NVN2 queue semaphore releases into the page the CPU and GPU wait on (the first two-page nx2:gpu region); EDEN_NX2_METHOD_TRACE logs methods. - pl:u 2000/2010 GetBuiltInFontSharedMemory/GetBuiltInFontData serve plain TTF copies of the shared fonts. - Switch 2 processes count the alias region in their max memory, so the game's nninitStartup heap (total - 6.3 GiB) has room for its sound heap. - gdbrsp.py: interrupt, threads, selthread, hits, continue_async, sleep.
* Switch 2 GPU: syncpt server, identity GPU mappings, Ampere classes, submit ↵Takoroka7 days1-0/+29
| | | | | | | | | | | | | | | fences - gsv 204: real syncpoint shared page (values mirrored from host1x, armed waits acknowledged by a 500us poller); first handle is the writable request event. - syncpt 22/201/202: per-slot events signalled through host1x guest actions. - nx2:gpu sub 101 memory is identity-mapped (GPU VA == CPU VA) into every nvhost-as-gpu GMMU via Nx2GpuMemoryRegistry; SMMU physical range widened to 34 bits for the 10/12 GiB layouts. - Puller runs Ampere 3D/compute/copy classes on the Maxwell engines; class 0 unbinds. - Turing+ macros are skipped (Eden only has the Fermi macro ISA). - Submits with increment_value get Eden-side syncpoint increments, since NVN2 signals completion with semaphore releases only.
* [nce, fs] tico support, fix FS bug that would nuke entire 'switch' folder ↵xbzk2026-07-231-3/+14
| | | | | | | | | | | | | | | (#4086) Contains the minimal set of functionalities to allow tico installer succeed, and tico work normally EXCEPT for game launching (which me or someone else will investigate later) First three commits are from PR 4012. The other six, kinda dizzy to explain each one. All were implemented based on tico source, switchbrew and libnx. Hopefully the commit messages will do. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4086 Reviewed-by: Lizzie <lizzie@eden-emu.dev> Reviewed-by: Maufeat <sahyno1996@gmail.com>
* [video_core, hle] remove redundant parent references in system structs (#3908)lizzie2026-06-231-81/+58
| | | | | | | | | | reworked a bit to remove references of parent objects and instead pass as arguments to methods to prevent useless reloads Signed-off-by: lizzie <lizzie@eden-emu.dev> Co-authored-by: maufeat <sahyno1996@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3908 Reviewed-by: Maufeat <sahyno1996@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev>
* [common/logging] Simplify logging logic and fix issues when logging before ↵lizzie2026-03-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | system is created (#3688) - our logging code was bigger than spdlog itself, why???? just keep it simple - fix issues when logging before logging system is even started - removes the "initialized logging twice" issue - removes uneeded indirection in file logging - uses direct formatting instead of jumping hoopla-around the fmt::format() ressult - code duplication and dead code removal as usual I did explore dup2() but I think it's not worth the hassle I did try `fwopen()` but it's better if things are just kept as-is. there is a lot of noise because I removed a bunch of redundant files on logging and just put everything in one file now normally this wouldn't be a good idea, however consider: the complexity of logging; it's less than 500 lines... does it really need a whole subsystem?!?!?! ITS JUST LOGGING Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3688 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: DraVee <chimera@dravee.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [video_core/engines] implement stub NV01 timer, inline other channel engines ↵lizzie2026-03-061-20/+22
| | | | | | | | | | | (#3640) Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3640 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: DraVee <chimera@dravee.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* Query Cache: address issuesFernando Sahmkow2023-09-231-2/+4
|
* Query Cachge: Fully rework Vulkan's query cacheFernando Sahmkow2023-09-231-9/+2
|
* VideoCore: Implement DispatchIndirectFernando Sahmkow2023-08-271-5/+10
|
* engines: Remove unnecessary castsLioncash2022-11-291-3/+3
| | | | In a few cases we have some casts that can be trivially removed.
* GPU: Fix buffer cache issue, engine upload not inlining memory in multiline ↵Fernando Sahmkow2022-11-241-2/+2
| | | | and pessismistic invalidation.
* Add break for default casesKyle Kienapfel2022-11-131-0/+4
| | | | | | | | | | | Visual Studio has an option to search all files in a solution, so I did a search in there for "default:" looking for any missing break statements. I've left out default statements that return something, and that throw something, even if via ThrowInvalidType. UNREACHABLE leads towards throw R_THROW macro leads towards a return
* Maxwell3D/Puller: Fix regressions and syncing issues.Fernando Sahmkow2022-10-191-3/+2
|
* general: Format licenses as per SPDX guidelinesMorph2022-10-061-3/+2
|
* NVDRV: Further improvements.Fernando Sahmkow2022-10-061-14/+4
|
* VideoCore: Refactor fencing system.Fernando Sahmkow2022-10-061-13/+26
|
* VideoCore: Refactor syncing.Fernando Sahmkow2022-10-061-29/+36
|
* VideoCore: Extra Fixes.Fernando Sahmkow2022-10-061-1/+1
|
* VideoCore: implement channels on gpu caches.Fernando Sahmkow2022-10-061-0/+297