summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/nvdrv/nvdrv.h
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-07-01 17:10:27 +0200
committerFernandoS27 <fsahmkow27@gmail.com>2019-07-05 21:49:33 +0200
commitf3a39e0c9ce8468859da12e35a52fa088e264d28 (patch)
tree1b8213a87e7cda7ccb5be0828770415d2d78000e /src/core/hle/service/nvdrv/nvdrv.h
parentNVServices: Styling, define constructors as explicit and corrections (diff)
downloadyuzu-f3a39e0c9ce8468859da12e35a52fa088e264d28.tar
yuzu-f3a39e0c9ce8468859da12e35a52fa088e264d28.tar.gz
yuzu-f3a39e0c9ce8468859da12e35a52fa088e264d28.tar.bz2
yuzu-f3a39e0c9ce8468859da12e35a52fa088e264d28.tar.lz
yuzu-f3a39e0c9ce8468859da12e35a52fa088e264d28.tar.xz
yuzu-f3a39e0c9ce8468859da12e35a52fa088e264d28.tar.zst
yuzu-f3a39e0c9ce8468859da12e35a52fa088e264d28.zip
Diffstat (limited to 'src/core/hle/service/nvdrv/nvdrv.h')
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h
index 8f7c59a21..a339ab672 100644
--- a/src/core/hle/service/nvdrv/nvdrv.h
+++ b/src/core/hle/service/nvdrv/nvdrv.h
@@ -27,25 +27,34 @@ class nvdevice;
}
struct EventInterface {
+ // Mask representing currently busy events
u64 events_mask{};
+ // Each kernel event associated to an NV event
std::array<Kernel::EventPair, MaxNvEvents> events;
+ // The status of the current NVEvent
std::array<EventState, MaxNvEvents> status{};
+ // Tells if an NVEvent is registered or not
std::array<bool, MaxNvEvents> registered{};
+ // When an NVEvent is waiting on GPU interrupt, this is the sync_point
+ // associated with it.
std::array<u32, MaxNvEvents> assigned_syncpt{};
+ // This is the value of the GPU interrupt for which the NVEvent is waiting
+ // for.
std::array<u32, MaxNvEvents> assigned_value{};
- static constexpr u32 null_event = 0xFFFFFFFF;
- u32 GetFreeEvent() const {
+ // Constant to denote an unasigned syncpoint.
+ static constexpr u32 unassigned_syncpt = 0xFFFFFFFF;
+ std::optional<u32> GetFreeEvent() const {
u64 mask = events_mask;
for (u32 i = 0; i < MaxNvEvents; i++) {
const bool is_free = (mask & 0x1) == 0;
if (is_free) {
if (status[i] == EventState::Registered || status[i] == EventState::Free) {
- return i;
+ return {i};
}
}
mask = mask >> 1;
}
- return null_event;
+ return {};
}
void SetEventStatus(const u32 event_id, EventState new_status) {
EventState old_status = status[event_id];
@@ -57,7 +66,7 @@ struct EventInterface {
registered[event_id] = true;
}
if (new_status == EventState::Waiting || new_status == EventState::Busy) {
- events_mask |= (1 << event_id);
+ events_mask |= (1ULL << event_id);
}
}
void RegisterEvent(const u32 event_id) {
@@ -74,8 +83,8 @@ struct EventInterface {
}
void LiberateEvent(const u32 event_id) {
status[event_id] = registered[event_id] ? EventState::Registered : EventState::Free;
- events_mask &= ~(1 << event_id);
- assigned_syncpt[event_id] = 0xFFFFFFFF;
+ events_mask &= ~(1ULL << event_id);
+ assigned_syncpt[event_id] = unassigned_syncpt;
assigned_value[event_id] = 0;
}
};