diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-10-30 11:35:05 +0200 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2022-10-06 21:00:51 +0200 |
commit | ac104a24d11c5875e25daee5dd405ee9fe5f3a21 (patch) | |
tree | e25f2ebf312e60536573bf33ca1d72c982e359bb | |
parent | NvHost: Fix some regressions and correct signaling on timeout. (diff) | |
download | yuzu-ac104a24d11c5875e25daee5dd405ee9fe5f3a21.tar yuzu-ac104a24d11c5875e25daee5dd405ee9fe5f3a21.tar.gz yuzu-ac104a24d11c5875e25daee5dd405ee9fe5f3a21.tar.bz2 yuzu-ac104a24d11c5875e25daee5dd405ee9fe5f3a21.tar.lz yuzu-ac104a24d11c5875e25daee5dd405ee9fe5f3a21.tar.xz yuzu-ac104a24d11c5875e25daee5dd405ee9fe5f3a21.tar.zst yuzu-ac104a24d11c5875e25daee5dd405ee9fe5f3a21.zip |
-rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | 15 | ||||
-rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.h | 2 |
2 files changed, 7 insertions, 10 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index a3c11ad8a..bfe1faf48 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp @@ -91,7 +91,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(), ¶ms, sizeof(params)); - events_interface.failed[event_id] = false; + events_interface.fails[event_id] = 0; return NvResult::Success; } @@ -99,29 +99,26 @@ 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(), ¶ms, sizeof(params)); - events_interface.failed[event_id] = false; + events_interface.fails[event_id] = 0; return NvResult::Success; } - auto& event = events_interface.events[event_id]; auto& gpu = system.GPU(); - const u32 current_syncpoint_value = event.fence.value; - const s32 diff = current_syncpoint_value - params.threshold; - const u32 target_value = params.value; + const u32 target_value = syncpoint_manager.GetSyncpointMax(params.syncpt_id); if (!is_async) { params.value = 0; } const auto check_failing = [&]() { - if (events_interface.failed[event_id]) { + if (events_interface.fails[event_id] > 1) { { auto lk = system.StallProcesses(); gpu.WaitFence(params.syncpt_id, target_value); system.UnstallProcesses(); } std::memcpy(output.data(), ¶ms, sizeof(params)); - events_interface.failed[event_id] = false; + events_interface.fails[event_id] = 0; return true; } return false; @@ -207,7 +204,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; + events_interface.fails[event_id]++; 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 c929e5106..4c4aa7dab 100644 --- a/src/core/hle/service/nvdrv/nvdrv.h +++ b/src/core/hle/service/nvdrv/nvdrv.h @@ -50,7 +50,7 @@ struct EventInterface { // 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{}; + std::array<u32, MaxNvEvents> fails{}; // When an NVEvent is waiting on GPU interrupt, this is the sync_point // associated with it. std::array<u32, MaxNvEvents> assigned_syncpt{}; |