mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
NVServices: Make NVEvents Automatic according to documentation.
This commit is contained in:
parent
b6844bec60
commit
0335a25d1f
4 changed files with 13 additions and 7 deletions
|
@ -142,7 +142,6 @@ u32 nvhost_ctrl::IocCtrlEventRegister(const std::vector<u8>& input, std::vector<
|
||||||
return NvResult::BadParameter;
|
return NvResult::BadParameter;
|
||||||
}
|
}
|
||||||
events_interface.RegisterEvent(event_id);
|
events_interface.RegisterEvent(event_id);
|
||||||
events_interface.events[event_id].writable->Signal();
|
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +170,11 @@ u32 nvhost_ctrl::IocCtrlEventSignal(const std::vector<u8>& input, std::vector<u8
|
||||||
return NvResult::BadParameter;
|
return NvResult::BadParameter;
|
||||||
}
|
}
|
||||||
if (events_interface.status[event_id] == EventState::Waiting) {
|
if (events_interface.status[event_id] == EventState::Waiting) {
|
||||||
events_interface.LiberateEvent(event_id);
|
auto& gpu = system.GPU();
|
||||||
|
if (gpu.CancelSyncptInterrupt(events_interface.assigned_syncpt[event_id],
|
||||||
|
events_interface.assigned_value[event_id])) {
|
||||||
|
events_interface.LiberateEvent(event_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,8 @@ Module::Module(Core::System& system) {
|
||||||
auto& kernel = system.Kernel();
|
auto& kernel = system.Kernel();
|
||||||
for (u32 i = 0; i < MaxNvEvents; i++) {
|
for (u32 i = 0; i < MaxNvEvents; i++) {
|
||||||
std::string event_label = fmt::format("NVDRV::NvEvent_{}", i);
|
std::string event_label = fmt::format("NVDRV::NvEvent_{}", i);
|
||||||
events_interface.events[i] =
|
events_interface.events[i] = Kernel::WritableEvent::CreateEventPair(
|
||||||
Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, event_label);
|
kernel, Kernel::ResetType::Automatic, event_label);
|
||||||
events_interface.status[i] = EventState::Free;
|
events_interface.status[i] = EventState::Free;
|
||||||
events_interface.registered[i] = false;
|
events_interface.registered[i] = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,15 +97,18 @@ void GPU::RegisterSyncptInterrupt(const u32 syncpoint_id, const u32 value) {
|
||||||
syncpt_interrupts[syncpoint_id].emplace_back(value);
|
syncpt_interrupts[syncpoint_id].emplace_back(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPU::CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value) {
|
bool GPU::CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value) {
|
||||||
|
sync_mutex.lock();
|
||||||
auto it = syncpt_interrupts[syncpoint_id].begin();
|
auto it = syncpt_interrupts[syncpoint_id].begin();
|
||||||
while (it != syncpt_interrupts[syncpoint_id].end()) {
|
while (it != syncpt_interrupts[syncpoint_id].end()) {
|
||||||
if (value == *it) {
|
if (value == *it) {
|
||||||
it = syncpt_interrupts[syncpoint_id].erase(it);
|
it = syncpt_interrupts[syncpoint_id].erase(it);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
sync_mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 RenderTargetBytesPerPixel(RenderTargetFormat format) {
|
u32 RenderTargetBytesPerPixel(RenderTargetFormat format) {
|
||||||
|
|
|
@ -174,7 +174,7 @@ public:
|
||||||
|
|
||||||
void RegisterSyncptInterrupt(const u32 syncpoint_id, const u32 value);
|
void RegisterSyncptInterrupt(const u32 syncpoint_id, const u32 value);
|
||||||
|
|
||||||
void CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value);
|
bool CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value);
|
||||||
|
|
||||||
void Guard(bool guard_set) {
|
void Guard(bool guard_set) {
|
||||||
if (guard_set) {
|
if (guard_set) {
|
||||||
|
|
Loading…
Reference in a new issue