aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/gpu_thread.h
Commit message (Collapse)AuthorAgeFilesLines
* nx2: map GPU memory before later command lists are readSssnowyyy30 hours1-1/+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: unmap GPU memory in submission orderTakoroka7 days1-1/+10
| | | | | | | | | | | 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.
* [gpu] Fix infinite hangup/freezes at shutdown/reset (#4395)lizzie2026-09-111-0/+2
| | | | | | | | | | | | | | | | | | | | | Thread may be destroyed at dtor(), but it hasn't fully shut down, so before notify shutdown, request immediate stop (effective immediately). Like the issue was that the thread didn't want to stop running, thus it would hang, it would also reference objects which were being destroyed without waiting for them to actually be destroyed So it would reference invalid data This PR tells the thread: "hey, STOP now, and DESTROY yourself" So all of that should be avoided Signed-off-by: lizzie <lizzie@eden-emu.dev> - [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. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4395 Reviewed-by: Maufeat <sahyno1996@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
* [video_core, hle] remove redundant parent references in system structs (#3908)lizzie2026-06-231-8/+7
| | | | | | | | | | 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>
* [texture_cache, buffer_cache] Added TLS handling + changed command queue for ↵lizzie2026-02-201-1/+4
| | | | | | | | | | | | | | | | | | | | GPU threading. (#3579) (Merge of #3495 + #3108) This PR works around to simplify math operations on hot pointers inside the access and requests to the cache of buffers and texture cache, removing previous logic of indirection and replaced by a PoD approach. This will ensure less CPU times spended on the same request and flow directly into another chain of the render, in the same way, command queue currently uses an internal mutex that constraints the flow of data within the GPU threads, we're moving over a single command, I verified to keep using mutexes instead of internal mutex + mutex per operation, which are resolved by themselves. In simplier words, this aims to improve performance on those games and devices where the waits for next orders on GPU commands were heavier than a single verification. Co-Authored-by: @CamilleLaVey Co-Authored-by: @Lizzie Co-authored-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3579 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* nvnflinger/gpu: implement layer stack compositionLiam2024-01-311-13/+2
|
* SMMU: Initial adaptation to video_core.Fernando Sahmkow2024-01-181-9/+9
|
* gpu_thread: Use bounded queueBehunin2023-03-031-2/+2
|
* Remove OnCommandListEndCommandBehunin2023-02-071-7/+1
| | | | Call rasterizer->ReleaseFences() directly
* general: fix compile for Apple ClangLiam2022-11-221-0/+1
|
* VideoCore: Refactor syncing.Fernando Sahmkow2022-10-061-0/+2
|
* VideoCore: implement channels on gpu caches.Fernando Sahmkow2022-10-061-4/+8
|
* gpu_thread: Use the previous MPSCQueue implementationMorph2022-07-061-2/+2
| | | | The bounded MPSCQueue implementation causes crashes in Fire Emblem Three Houses, use the previous implementation for now.
* bounded_threadsafe_queue: Use constexpr capacity and maskMorph2022-06-151-1/+1
| | | | | | | | While this is the primary change, we also: - Remove the mpsc namespace and rename Queue to MPSCQueue - Make Slot a private struct within MPSCQueue - Remove the AlignedAllocator template argument, as we use std::allocator - Replace instances of mask + 1 with capacity, and mask + 2 with capacity + 1
* gpu_thread: Move to bounded queueLevi Behunin2022-06-021-3/+3
|
* 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.
* gpu: Migrate implementation to the cpp fileameerj2021-10-031-3/+0
|
* gpu: Use std::jthread for async gpu threadameerj2021-09-151-9/+4
|
* video_core: Use a CV for blocking commands.Markus Wick2021-04-071-6/+5
| | | | There is no need for a busy loop here. Let's just use a condition variable to save some power.
* video_core/gpu_thread: Keep the write lock for allocating the fence.Markus Wick2021-04-071-1/+2
| | | | | Else the fence might get submited out-of-order into the queue, which makes testing them pointless. Overhead should be tiny as the mutex is just moved from the queue to the writing code.
* video_core/gpu_thread: Implement a ShutDown method.Markus Wick2021-04-071-2/+5
| | | | | | 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_thread: Remove Async NVDEC placeholdersameerj2021-02-281-15/+4
| | | | This commit removes early placeholders for an implementation of async nvdec. With recent changes to the source code, the placeholders are no longer accurate, and can cause a nullptr dereference due to the nature of the cdma_pusher lifetime.
* gpu: Report renderer errors with exceptionsReinUsesLisp2021-02-131-3/+5
| | | | | | 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.
* video_core: gpu: Implement synchronous mode using threaded GPU.bunnei2020-12-281-2/+3
|
* video_core: gpu: Refactor out synchronous/asynchronous GPU implementations.bunnei2020-12-281-1/+6
| | | | - We must always use a GPU thread now, even with synchronous GPU.
* video_core: Resolve more variable shadowing scenariosLioncash2020-12-041-13/+12
| | | | | | 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.
* video_core: NVDEC Implementationameerj2020-10-261-4/+15
| | | | | | | | | | | | | | This commit aims to implement the NVDEC (Nvidia Decoder) functionality, with video frame decoding being handled by the FFmpeg library. The process begins with Ioctl commands being sent to the NVDEC and VIC (Video Image Composer) emulated devices. These allocate the necessary GPU buffers for the frame data, along with providing information on the incoming video data. A Submit command then signals the GPU to process and decode the frame data. To decode the frame, the respective codec's header must be manually composed from the information provided by NVDEC, then sent with the raw frame data to the ffmpeg library. Currently, H264 and VP9 are supported, with VP9 having some minor artifacting issues related mainly to the reference frame composition in its uncompressed header. Async GPU is not properly implemented at the moment. Co-Authored-By: David <25727384+ogniK5377@users.noreply.github.com>
* GPU: Implement Flush Requests for Async mode.Fernando Sahmkow2020-04-221-2/+6
|
* OpenGL: Implement Fencing backend.Fernando Sahmkow2020-04-221-1/+6
|
* GPU: Setup Flush/Invalidate to use VAddr instead of CacheAddrFernando Sahmkow2020-04-061-9/+9
|
* Frontend/GPU: Refactor context managementJames Rowe2020-03-241-2/+5
| | | | | | | | | | | | | | | | | | | | Changes the GraphicsContext to be managed by the GPU core. This eliminates the need for the frontends to fool around with tricky MakeCurrent/DoneCurrent calls that are dependent on the settings (such as async gpu option). This also refactors out the need to use QWidget::fromWindowContainer as that caused issues with focus and input handling. Now we use a regular QWidget and just access the native windowHandle() directly. Another change is removing the debug tool setting in FrameMailbox. Instead of trying to block the frontend until a new frame is ready, the core will now take over presentation and draw directly to the window if the renderer detects that its hooked by NSight or RenderDoc Lastly, since it was in the way, I removed ScopeAcquireWindowContext and replaced it with a simple subclass in GraphicsContext that achieves the same result
* gpu_thread: Use MPSCQueue for GPU commands.bunnei2020-02-071-1/+1
| | | | - Necessary for multiple service threads.
* Core: Wait for GPU to be idle before shutting down.Fernando Sahmkow2019-10-041-0/+3
|
* GPU_Async: Correct fences, display events and more.Fernando Sahmkow2019-10-041-6/+0
| | | | | | | This commit uses guest fences on vSync event instead of an articial fake fence we had. It also corrects to keep signaling display events while loading the game as the OS is suppose to send buffers to vSync during that time.
* gpu: Change optional<reference_wrapper<T>> to T* for FramebufferConfigReinUsesLisp2019-08-211-2/+1
|
* gpu_asynch: Simplify synchronization to a simpler consumer->producer scheme.Fernando Sahmkow2019-07-051-32/+0
|
* Merge pull request #2467 from lioncash/moveHexagon122019-05-191-6/+0
|\ | | | | video_core/gpu_thread: Remove redundant copy constructor for CommandDataContainer
| * video_core/gpu_thread: Remove redundant copy constructor for ↵Lioncash2019-05-141-6/+0
| | | | | | | | | | | | | | | | | | CommandDataContainer std::move within a copy constructor (on a data member that isn't mutable) will always result in a copy. Because of that, the behavior of this copy constructor is identical to the one that would be generated automatically by the compiler, so we can remove it.
* | yuzu: Remove explicit types from locks where applicableLioncash2019-05-141-1/+1
|/ | | | | With C++17's deduction guides, the type doesn't need to be explicitly specified within locking primitives anymore.
* video_core/gpu: Create threads separately from initializationLioncash2019-04-111-2/+4
| | | | | | | | | Like with CPU emulation, we generally don't want to fire off the threads immediately after the relevant classes are initialized, we want to do this after all necessary data is done loading first. This splits the thread creation into its own interface member function to allow controlling when these threads in particular get created.
* gpu_thread: Improve synchronization by using CoreTiming.bunnei2019-04-011-40/+31
|
* general: Use deducation guides for std::lock_guard and std::unique_lockLioncash2019-04-011-6/+6
| | | | | | | Since C++17, the introduction of deduction guides for locking facilities means that we no longer need to hardcode the mutex type into the locks themselves, making it easier to switch mutex types, should it ever be necessary in the future.
* gpu_thread: Remove unused dma_pusher class member variable from ThreadManagerLioncash2019-03-271-3/+0
| | | | | | The pusher instance is only ever used in the constructor of the ThreadManager for creating the thread that the ThreadManager instance contains. Aside from that, the member is unused, so it can be removed.
* gpu: Use host address for caching instead of guest address.bunnei2019-03-141-40/+92
|
* video_core/gpu_thread: Remove unimplemented WaitForIdle function prototypeLioncash2019-03-071-3/+0
| | | | | This function didn't have a definition, so we can remove it to prevent accidentally attempting to use it.
* video_core/gpu_thread: Amend constructor initializer list orderLioncash2019-03-071-2/+2
| | | | | | | Moves the data members to satisfy the order they're declared as in the constructor initializer list. Silences a -Wreorder warning.
* gpu_thread: Fix deadlock with threading idle state check.bunnei2019-03-061-3/+4
|
* gpu: Move command processing to another thread.bunnei2019-03-061-0/+135