summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-06-11 23:04:24 +0200
committerFernandoS27 <fsahmkow27@gmail.com>2019-07-05 21:49:24 +0200
commitefdeab3a1d5735a8b000241f09ba57e9b981204b (patch)
treed41e2753e353109206527eb6dfc640fb9dd3c9b0 /src/core/hle
parentnvflinger: Acquire buffers in the same order as they were queued. (diff)
downloadyuzu-efdeab3a1d5735a8b000241f09ba57e9b981204b.tar
yuzu-efdeab3a1d5735a8b000241f09ba57e9b981204b.tar.gz
yuzu-efdeab3a1d5735a8b000241f09ba57e9b981204b.tar.bz2
yuzu-efdeab3a1d5735a8b000241f09ba57e9b981204b.tar.lz
yuzu-efdeab3a1d5735a8b000241f09ba57e9b981204b.tar.xz
yuzu-efdeab3a1d5735a8b000241f09ba57e9b981204b.tar.zst
yuzu-efdeab3a1d5735a8b000241f09ba57e9b981204b.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h
index 0e8eed113..597acc9c6 100644
--- a/src/core/hle/service/nvdrv/nvdrv.h
+++ b/src/core/hle/service/nvdrv/nvdrv.h
@@ -27,16 +27,17 @@ class nvdevice;
}
struct EventsInterface {
- u64 events_mask;
+ u64 events_mask{};
std::array<Kernel::EventPair, MaxNvEvents> events;
- std::array<EventState, MaxNvEvents> status;
- std::array<bool, MaxNvEvents> registered;
- std::array<u32, MaxNvEvents> assigned_syncpt;
- std::array<u32, MaxNvEvents> assigned_value;
+ std::array<EventState, MaxNvEvents> status{};
+ std::array<bool, MaxNvEvents> registered{};
+ std::array<u32, MaxNvEvents> assigned_syncpt{};
+ std::array<u32, MaxNvEvents> assigned_value{};
u32 GetFreeEvent() {
u64 mask = events_mask;
for (u32 i = 0; i < MaxNvEvents; i++) {
- if (mask & 0x1) {
+ const bool is_free = (mask & 0x1) == 0;
+ if (is_free) {
if (status[i] == EventState::Registered || status[i] == EventState::Free) {
return i;
}
@@ -46,10 +47,16 @@ struct EventsInterface {
return 0xFFFFFFFF;
}
void SetEventStatus(const u32 event_id, EventState new_status) {
+ EventState old_status = status[event_id];
+ if (old_status == new_status)
+ return;
status[event_id] = new_status;
if (new_status == EventState::Registered) {
registered[event_id] = true;
}
+ if (new_status == EventState::Waiting || new_status == EventState::Busy) {
+ events_mask |= (1 << event_id);
+ }
}
void RegisterEvent(const u32 event_id) {
registered[event_id] = true;
@@ -65,6 +72,7 @@ struct EventsInterface {
}
void LiberateEvent(const u32 event_id) {
status[event_id] = registered[event_id] ? EventState::Registered : EventState::Free;
+ events_mask &= ~(1 << event_id);
}
};