diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-11-05 01:44:11 +0100 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2022-10-06 21:00:51 +0200 |
commit | af35dbcf633d35450b333eb33334b3dd1bc050a1 (patch) | |
tree | 94e721b8a23f9659d616f70157574d6826263070 /src/core/hle/service/nvdrv/devices/nvhost_ctrl.h | |
parent | NVDRV: Implement new NvMap (diff) | |
download | yuzu-af35dbcf633d35450b333eb33334b3dd1bc050a1.tar yuzu-af35dbcf633d35450b333eb33334b3dd1bc050a1.tar.gz yuzu-af35dbcf633d35450b333eb33334b3dd1bc050a1.tar.bz2 yuzu-af35dbcf633d35450b333eb33334b3dd1bc050a1.tar.lz yuzu-af35dbcf633d35450b333eb33334b3dd1bc050a1.tar.xz yuzu-af35dbcf633d35450b333eb33334b3dd1bc050a1.tar.zst yuzu-af35dbcf633d35450b333eb33334b3dd1bc050a1.zip |
Diffstat (limited to 'src/core/hle/service/nvdrv/devices/nvhost_ctrl.h')
-rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_ctrl.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h index 9fd46ea5f..f2fc5d047 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h @@ -53,7 +53,49 @@ public: }; static_assert(sizeof(SyncpointEventValue) == sizeof(u32)); + void SignalNvEvent(u32 syncpoint_id, u32 value); + private: + struct InternalEvent { + // Mask representing registered events + + // Each kernel event associated to an NV event + Kernel::KEvent* kevent{}; + // The status of the current NVEvent + std::atomic<EventState> status{}; + + // Tells the NVEvent that it has failed. + u32 fails{}; + // When an NVEvent is waiting on GPU interrupt, this is the sync_point + // associated with it. + u32 assigned_syncpt{}; + // This is the value of the GPU interrupt for which the NVEvent is waiting + // for. + u32 assigned_value{}; + + // Tells if an NVEvent is registered or not + bool registered{}; + + bool IsBeingUsed() { + const auto current_status = status.load(std::memory_order_acquire); + return current_status == EventState::Waiting || + current_status == EventState::Cancelling || + current_status == EventState::Signalling; + } + }; + + std::unique_lock<std::mutex> NvEventsLock(); + + void CreateNvEvent(u32 event_id); + + void FreeNvEvent(u32 event_id); + + u32 FindFreeNvEvent(u32 syncpoint_id); + + std::array<InternalEvent, MaxNvEvents> events{}; + std::mutex events_mutex; + u64 events_mask{}; + struct IocSyncptReadParams { u32_le id{}; u32_le value{}; |