summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/nvdrv
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-10-02 05:10:55 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-10-03 06:35:57 +0200
commit6c0d90237371c9adbe80a26c3e4f53b35ea57a0e (patch)
treee6f143052a75856d401565fec173bf964d7ed032 /src/core/hle/service/nvdrv
parentgpu: Migrate implementation to the cpp file (diff)
downloadyuzu-6c0d90237371c9adbe80a26c3e4f53b35ea57a0e.tar
yuzu-6c0d90237371c9adbe80a26c3e4f53b35ea57a0e.tar.gz
yuzu-6c0d90237371c9adbe80a26c3e4f53b35ea57a0e.tar.bz2
yuzu-6c0d90237371c9adbe80a26c3e4f53b35ea57a0e.tar.lz
yuzu-6c0d90237371c9adbe80a26c3e4f53b35ea57a0e.tar.xz
yuzu-6c0d90237371c9adbe80a26c3e4f53b35ea57a0e.tar.zst
yuzu-6c0d90237371c9adbe80a26c3e4f53b35ea57a0e.zip
Diffstat (limited to 'src/core/hle/service/nvdrv')
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
index 775e76330..8b4867ca7 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
@@ -111,7 +111,6 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
event.event->GetWritableEvent().Signal();
return NvResult::Success;
}
- auto lock = gpu.LockSync();
const u32 current_syncpoint_value = event.fence.value;
const s32 diff = current_syncpoint_value - params.threshold;
if (diff >= 0) {
@@ -132,23 +131,24 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
}
EventState status = events_interface.status[event_id];
- if (event_id < MaxNvEvents || status == EventState::Free || status == EventState::Registered) {
- events_interface.SetEventStatus(event_id, EventState::Waiting);
- events_interface.assigned_syncpt[event_id] = params.syncpt_id;
- events_interface.assigned_value[event_id] = target_value;
- if (is_async) {
- params.value = params.syncpt_id << 4;
- } else {
- params.value = ((params.syncpt_id & 0xfff) << 16) | 0x10000000;
- }
- params.value |= event_id;
- event.event->GetWritableEvent().Clear();
- gpu.RegisterSyncptInterrupt(params.syncpt_id, target_value);
+ const bool bad_parameter = status != EventState::Free && status != EventState::Registered;
+ if (bad_parameter) {
std::memcpy(output.data(), &params, sizeof(params));
- return NvResult::Timeout;
+ return NvResult::BadParameter;
}
+ events_interface.SetEventStatus(event_id, EventState::Waiting);
+ events_interface.assigned_syncpt[event_id] = params.syncpt_id;
+ events_interface.assigned_value[event_id] = target_value;
+ if (is_async) {
+ params.value = params.syncpt_id << 4;
+ } else {
+ params.value = ((params.syncpt_id & 0xfff) << 16) | 0x10000000;
+ }
+ params.value |= event_id;
+ event.event->GetWritableEvent().Clear();
+ gpu.RegisterSyncptInterrupt(params.syncpt_id, target_value);
std::memcpy(output.data(), &params, sizeof(params));
- return NvResult::BadParameter;
+ return NvResult::Timeout;
}
NvResult nvhost_ctrl::IocCtrlEventRegister(const std::vector<u8>& input, std::vector<u8>& output) {