aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/gpu.h
Commit message (Collapse)AuthorAgeFilesLines
* nx2: map GPU memory before later command lists are readSssnowyyy31 hours1-0/+4
| | | | | | | | | | | | | | | | | | 837133792d queues the GMMU maps on the GPU thread (GPU::RunInOrder) so the service thread never waits for the texture cache. With the GPU split (Low GPU accuracy) the GPU thread defers queued functions to its back, but its front reads the command lists: it read the lists submitted after a map through GPU addresses that weren't mapped yet. Pokopia stopped after its first frame. Add GPU::MapInOrder for the GMMU maps and the sparse tile remaps. It runs in order like RunInOrder, and with the split it runs on the front after draining the back, before the front reads further command lists. The service thread still never takes the texture cache lock, and the back is idle while the map changes the caches. Unmaps and the other queued work still run on the back. Assisted-by: Claude Opus 5.5 (bisect, fix, testing and commit message)
* nx2: don't stall presents on a current-frame wait the GPU can't finishSssnowyyy31 hours1-0/+3
| | | | | | | | | | | | | | | | | 0f14696044 made PresentClientBuffer also wait for the current frame's fence whenever the previous frame's wasn't reached. Mario Kart World's GPU waits on semaphores its CPU releases only after the present returns, so in that state the current fence can't be reached until the present returns, and each such present stalled up to the 4 s deadline. Wait for the current frame by default, but give up after a few ms once a GPU channel was seen suspended on a semaphore acquire and wait for the previous frame instead. EDEN_NX2_FRAMES_AHEAD=1 always waits for the previous frame (with 0f14696044's current-frame wait when the GPU is behind), =0 always for the current one. The scheduler gains a lock-free flag so the present thread can see suspended channels. Assisted-by: Claude Sonnet 5.5 (implementation and commit message)
* Fix the P6 scratch save in R2UR/MATCH/HFMA2.RELU; GPU memory dump toolTakoroka6 days1-0/+3
| | | | | | | | | | | | | | | | | The colour cast on title 1 (magenta/cyan, then red/green, changing per course) came from the sky/atmosphere volume shader (a pixel shader drawing a 32^3 RGBA16F table slice by slice), which starts with an unguarded R2UR. R2UR, MATCH and HFMA2.RELU use P6 as scratch and saved/restored it with the uniform-guard mask, 1 << (6 - 7) for an unguarded instruction: undefined, in practice bit 31, which shifted into the opcode bits and turned the save into another instruction. They now always save and restore P6. Debugging aids used to find it: - EDEN_NX2_DUMP=<present>:<addr>:<size>,...: flush GPU memory ranges at a present (on the GPU thread) and save them next to the frame captures; nx2work/vol3d.py untiles Switch 2 3D textures from such dumps. - GPU::RunOnGpuThread. - Logs of Switch 2 3D images and descriptors.
* nx2: unmap GPU memory in submission orderTakoroka7 days1-0/+4
| | | | | | | | | | | NormalUnmapGpuMemory4K and destroying GPU memory are jobs the console's graphics server completes behind the work already submitted. Run the GMMU unmaps on the GPU thread after the command lists queued before them (GPU::RunInOrder) and signal the job's event only then, instead of unmapping and signalling at once while Eden's GPU thread may still be behind. Also EDEN_NX2_FRAMES_AHEAD (experimental): wait for the previous frame's fence at present instead of this one's.
* [video_core] buffer cache readback for nce invalidations (#4490)xbzk2026-09-301-1/+1
| | | | | | | | | | | | | | | | | | - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- This is a follow up of 4473, a fix for the next Ender Magnolia known crash, the shackled beast's vaper crash, but specific for NCE. Imma try to be short: NCE invalidation was dooming whole guest pages when it shouldn't. If the GPU buffer cache owns some bytes on a page, invalidating first discards their ownership, and the retrying CPU can then observe stale data. On Android, this was corrupting some indirect draw packets and causing huge invalid index count reach staging memory allocation. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4490 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: lizzie <lizzie@eden-emu.dev>
* [core, hle, video_core, memory] Improve multi-process, display layers, ↵Maufeat2026-08-291-0/+2
| | | | | | | | | | | | | | | | | | | | | dynamic shader cache and rework overlay (#4238) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- - Dynamic shader cache reloading capability for qlaunch - Multi-process improvements (thanks to @frank1734), instead of just using the main application we now respect caller process (also did it for HID devices while I was at it) - Layer stack masks & shared buffer screenshot for video core, added different masks (screenshot, recording, etc.) this was discovered as an issue due to how in qlaunch the transition was not right between applications. May not be perfect but also fixes screenshots while using qlaunch - Reworked overlay display management (input and visibility) - instead of random numbers as I've previously did, I decided to add an AppletZIndex enum for better readability. Also split capability of input by touch and gamepad. - etc. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4238 Reviewed-by: Samuel <lizzie@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
* [core, gpu, threads] Multithreading refactor (#4254)CamilleLaVey2026-08-081-1/+3
| | | | | | This insufferable work tries to cover some holes on previous threading implementation from yuzu's team, starting with Windows and Linux reordering of priorities (NICE), reworks previous Android's threading and cpu affinity with adpf, adjust emulated clocks/gpu for better "accuracy" with their work, bumps android minSDK for all flavors, legacy will now work with AP 29 to cover A10 - A12, standard will reach A13 as base and finally the optimized build will come with API 35, mostly targeted on devices with A15 support and newer, NDK and AGP wasn't upgraded yet. The performance cost efficiency have been improved based on device power configuration; preventing overheating if certain devices tended to fall into NICE0 (not allocated threads priority, all task ran with higher priority, 11 tasks running within the limited 2 - 7 threads available on the most common configuration 1x3x4 or 1x4x3). Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4254
* [vk, opengl] defer checks to topmost call (avoid unnecessary call) (#40)lizzie2025-07-131-1/+4
| | | | | | | Co-authored-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/40 Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* Port changes from Early Accessdarktux2025-04-041-9/+0
|
* video_core: make gpu context aware of rendering programLiam2024-02-261-1/+1
|
* nvnflinger/gpu: implement applet captureLiam2024-02-091-0/+2
|
* nvnflinger/gpu: implement layer stack compositionLiam2024-01-311-2/+2
|
* SMMU: Initial adaptation to video_core.Fernando Sahmkow2024-01-181-6/+6
|
* Memory Tracking: Optimize tracking to only use atomic writes when contested ↵Fernando Sahmkow2023-06-281-0/+4
| | | | with the host GPU
* GPU: Add Reactive flushingFernando Sahmkow2023-05-071-0/+4
|
* GPU: Implement additional render target formats.Fernando Sahmkow2022-11-241-7/+7
|
* Fermi2D: Implement Bilinear software filtering and address feedback.Fernando Sahmkow2022-11-241-2/+2
|
* Update 3D regsKelebek12022-10-071-9/+41
|
* VideoCore: Refactor fencing system.Fernando Sahmkow2022-10-061-2/+2
|
* NVDRV: Further refactors and eliminate old code.Fernando Sahmkow2022-10-061-9/+0
|
* NVDRV: Refactor Host1xFernando Sahmkow2022-10-061-6/+0
|
* VideoCore: Refactor syncing.Fernando Sahmkow2022-10-061-3/+16
|
* Texture cache: Fix the remaining issues with memory mnagement and unmapping.Fernando Sahmkow2022-10-061-0/+2
|
* VideoCore: implement channels on gpu caches.Fernando Sahmkow2022-10-061-42/+13
|
* NvHost: Remake Ctrl Implementation.Fernando Sahmkow2022-10-061-1/+1
|
* general: Convert source file copyright comments over to SPDXMorph2022-04-231-3/+2
| | | | | This formats all copyright comments according to SPDX formatting guidelines. Additionally, this resolves the remaining GPLv2 only licensed files by relicensing them to GPLv2.0-or-later.
* hle: vi: Integrate new NVFlinger and HosBinderDriverServer service.bunnei2022-03-241-0/+1
|
* gpu: Tidy up forward declarationsLioncash2022-01-251-10/+0
| | | | | Over time a few forward declarations became unnecessary, so we can remove these to tidy up the header a little bit.
* gpu: Remove obsoleted CDMAPusher() accessorsLioncash2022-01-251-6/+0
| | | | | These were obsoleted in 10cc89bfdf3b9f05f731859e7a35b0541e523f2e but were accidentally overlooked.
* gpu: Add shut down method to synchronize threads before destructionameerj2022-01-031-0/+3
|
* Revert "Merge pull request #7668 from ameerj/fence-stop-token"ameerj2022-01-031-2/+1
| | | | | This reverts commit 5a612e9217db2549ef10341359787e30d4066dbf, reversing changes made to 2e61bc3d5160b31005831bd936dfdc8ddf3722f7.
* gpu: Use std::stop_token in WaitFence for VSync threadameerj2022-01-031-1/+2
| | | | Fixes a hang that may occur when stopping emulation and the VSync thread is blocked on the syncpoint condition variable.
* Support multiple videos playingFeng Chen2021-12-021-2/+2
|
* video_core: Add S8_UINT stencil formatMorph2021-11-171-0/+1
|
* nvhost_ctrl: Refactor usage of gpu.LockSync()ameerj2021-10-031-12/+0
| | | | This seems to only be used to protect a later gpu function call. So we can move the lock into that call instead.
* gpu: Migrate implementation to the cpp fileameerj2021-10-031-190/+27
|
* gpu: Use std::jthread for async gpu threadameerj2021-09-151-3/+0
|
* video_core: gpu: WaitFence: Do not block threads during shutdown.bunnei2021-05-291-0/+2
| | | | | - Fixes a hang on shutdown when NVFlinger thread is waiting on a syncpoint that will never occur. - Commonly observed when stopping emulation in Super Mario Odyssey.
* perf_stats: Rework FPS counter to be more accurateameerj2021-05-151-0/+2
| | | | | | | | | The FPS counter was based on metrics in the nvdisp swapbuffers call. This metric would be accurate if the gpu thread/renderer were synchronous with the nvdisp service, but that's no longer the case. This commit moves the frame counting responsibility onto the concrete renderers after their frame draw calls. Resulting in more meaningful metrics. The displayed FPS is now made up of the average framerate between the previous and most recent update, in order to avoid distracting FPS counter updates when framerate is oscillating between close values. The status bar update frequency was also changed from 2 seconds to 500ms.
* nvhost_vic: Fix device closureameerj2021-04-241-2/+2
| | | | | | Implements the OnClose method of the nvhost_vic device, and removes the remnants of an older implementation. Also cleans up some of the surrounding code.
* Merge pull request #6125 from ogniK5377/nvdec-close-devbunnei2021-04-161-0/+3
|\ | | | | nvdrv: Cleanup CDMA Processor on device closure
| * nvdrv: Cleanup CDMA Processor on device closureChloe Marcec2021-03-301-0/+3
| | | | | | | | Brings us a step closer to unifying all channels to share a common interface.
* | video_core/gpu_thread: Implement a ShutDown method.Markus Wick2021-04-071-2/+2
|/ | | | | | This was implicitly done by `is_powered_on = false`, however the explicit method allows us to block until the GPU is actually gone. This should fix a race condition while removing the other subsystems while the GPU is still active.
* gpu: Report renderer errors with exceptionsReinUsesLisp2021-02-131-0/+1
| | | | | | Instead of using a two step initialization to report errors, initialize the GPU renderer and rasterizer on the constructor and report errors through std::runtime_error.
* common/common_funcs: Rename INSERT_UNION_PADDING_{BYTES,WORDS} to _NOINITReinUsesLisp2021-01-151-4/+4
| | | | INSERT_PADDING_BYTES_NOINIT is more descriptive of the underlying behavior.
* video_core: gpu: Implement synchronous mode using threaded GPU.bunnei2020-12-281-2/+2
|
* video_core: gpu: Refactor out synchronous/asynchronous GPU implementations.bunnei2020-12-281-36/+19
| | | | - We must always use a GPU thread now, even with synchronous GPU.
* video_core: Resolve more variable shadowing scenariosLioncash2020-12-041-6/+6
| | | | | | Resolves variable shadowing scenarios up to the end of the OpenGL code to make it nicer to review. The rest will be resolved in a following commit.
* gpu: Make use of [[nodiscard]] where applicableLioncash2020-11-171-31/+35
|
* General: Fix clang buildLioncash2020-11-051-1/+1
| | | | Allows building on clang to work again