summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/nvdrv
diff options
context:
space:
mode:
authorFernandoS27 <fsahmkow27@gmail.com>2021-10-05 22:57:18 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2021-10-16 00:22:01 +0200
commit7dca0bc11ddcbbd38b2cc46b5fc8c0842df5f483 (patch)
treeef8f504f007d01072b8ba75d043dd94e68d75384 /src/core/hle/service/nvdrv
parentMerge pull request #7182 from Morph1984/system (diff)
downloadyuzu-7dca0bc11ddcbbd38b2cc46b5fc8c0842df5f483.tar
yuzu-7dca0bc11ddcbbd38b2cc46b5fc8c0842df5f483.tar.gz
yuzu-7dca0bc11ddcbbd38b2cc46b5fc8c0842df5f483.tar.bz2
yuzu-7dca0bc11ddcbbd38b2cc46b5fc8c0842df5f483.tar.lz
yuzu-7dca0bc11ddcbbd38b2cc46b5fc8c0842df5f483.tar.xz
yuzu-7dca0bc11ddcbbd38b2cc46b5fc8c0842df5f483.tar.zst
yuzu-7dca0bc11ddcbbd38b2cc46b5fc8c0842df5f483.zip
Diffstat (limited to 'src/core/hle/service/nvdrv')
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp11
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
index 8b4867ca7..8bbb2c06e 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
@@ -92,6 +92,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
if (syncpoint_manager.IsSyncpointExpired(params.syncpt_id, params.threshold)) {
params.value = syncpoint_manager.GetSyncpointMin(params.syncpt_id);
std::memcpy(output.data(), &params, sizeof(params));
+ events_interface.failed[event_id] = false;
return NvResult::Success;
}
@@ -99,6 +100,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
syncpoint_manager.IsSyncpointExpired(params.syncpt_id, params.threshold)) {
params.value = new_value;
std::memcpy(output.data(), &params, sizeof(params));
+ events_interface.failed[event_id] = false;
return NvResult::Success;
}
@@ -117,6 +119,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
event.event->GetWritableEvent().Signal();
params.value = current_syncpoint_value;
std::memcpy(output.data(), &params, sizeof(params));
+ events_interface.failed[event_id] = false;
return NvResult::Success;
}
const u32 target_value = current_syncpoint_value - diff;
@@ -146,6 +149,13 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
}
params.value |= event_id;
event.event->GetWritableEvent().Clear();
+ if (events_interface.failed[event_id]) {
+ lock.unlock();
+ gpu.WaitFence(params.syncpt_id, target_value);
+ std::memcpy(output.data(), &params, sizeof(params));
+ events_interface.failed[event_id] = false;
+ return NvResult::Success;
+ }
gpu.RegisterSyncptInterrupt(params.syncpt_id, target_value);
std::memcpy(output.data(), &params, sizeof(params));
return NvResult::Timeout;
@@ -201,6 +211,7 @@ NvResult nvhost_ctrl::IocCtrlClearEventWait(const std::vector<u8>& input, std::v
if (events_interface.status[event_id] == EventState::Waiting) {
events_interface.LiberateEvent(event_id);
}
+ events_interface.failed[event_id] = true;
syncpoint_manager.RefreshSyncpoint(events_interface.events[event_id].fence.id);
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h
index e2a1dde5b..a5af5b785 100644
--- a/src/core/hle/service/nvdrv/nvdrv.h
+++ b/src/core/hle/service/nvdrv/nvdrv.h
@@ -49,6 +49,8 @@ struct EventInterface {
std::array<EventState, MaxNvEvents> status{};
// Tells if an NVEvent is registered or not
std::array<bool, MaxNvEvents> registered{};
+ // Tells the NVEvent that it has failed.
+ std::array<bool, MaxNvEvents> failed{};
// When an NVEvent is waiting on GPU interrupt, this is the sync_point
// associated with it.
std::array<u32, MaxNvEvents> assigned_syncpt{};