Skip to content

Commit

Permalink
kevent: fix graphics core events
Browse files Browse the repository at this point in the history
  • Loading branch information
DHrpcs3 committed Nov 25, 2024
1 parent e0650ef commit 28ceb74
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 11 deletions.
10 changes: 4 additions & 6 deletions orbis-kernel/src/sys/sys_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,6 @@ static SysResult keventChange(KQueue *kq, KEvent &change, Thread *thread) {
nodeIt->triggered = true;
nodeIt->event.data |= 1000ull << 16; // clock

kq->cv.notify_all(kq->mtx);
} else if (change.filter == kEvFiltGraphicsCore && change.ident == 0x41) {
// hp3d idle
nodeIt->triggered = true;
kq->cv.notify_all(kq->mtx);
} else if (g_context.fwType == FwType::Ps5 &&
change.filter == kEvFiltGraphicsCore && change.ident == 0) {
Expand Down Expand Up @@ -316,8 +312,10 @@ orbis::SysResult orbis::sys_kevent(Thread *thread, sint fd,
if (note.enabled && note.triggered) {
result.push_back(note.event);

if (note.event.filter == kEvFiltDisplay &&
note.event.ident >> 48 != 0x6301) {
if (note.event.filter == kEvFiltDisplay) {
note.triggered = false;
} else if (note.event.filter == kEvFiltGraphicsCore &&
note.event.ident != 0x84) {
note.triggered = false;
}

Expand Down
26 changes: 22 additions & 4 deletions rpcsx/gpu/Pipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,15 @@ bool ComputePipe::releaseMem(Ring &ring) {
}

if (intSel) {
orbis::g_context.deviceEventEmitter->emit(orbis::kEvFiltGraphicsCore, 0,
kGcEventCompute0RelMem + index);
orbis::g_context.deviceEventEmitter->emit(
orbis::kEvFiltGraphicsCore,
[=, this](orbis::KNote *note) -> std::optional<std::int64_t> {
if (note->event.ident == kGcEventCompute0RelMem + index) {
return dataLo | (static_cast<std::uint64_t>(dataHi) << 32);
}

return {};
});
}

return true;
Expand Down Expand Up @@ -1364,8 +1371,19 @@ bool GraphicsPipe::eventWriteEop(Ring &ring) {
}

if (intSel != 0) {
orbis::g_context.deviceEventEmitter->emit(orbis::kEvFiltGraphicsCore, 0,
kGcEventGfxEop);
orbis::g_context.deviceEventEmitter->emit(
orbis::kEvFiltGraphicsCore,
[=](orbis::KNote *note) -> std::optional<std::int64_t> {
if (note->event.ident == kGcEventGfxEop) {
return dataLo | (static_cast<std::uint64_t>(dataHi) << 32);
}

if (note->event.ident == kGcEventGfxEop + 1) { // hp3d
return dataLo | (static_cast<std::uint64_t>(dataHi) << 32);
}

return {};
});
}

if (intSel == 2 && dataSel == 2) {
Expand Down
14 changes: 13 additions & 1 deletion rpcsx/iodev/dce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,19 @@ static orbis::ErrorCode dce_ioctl(orbis::File *file, std::uint64_t request,
} else if (args->id == 0x1e) {
// TODO
return {};
} else if (args->id != 1) { // used during open/close
} else if (args->id == 1) {

// Mode set
orbis::g_context.deviceEventEmitter->emit(
orbis::kEvFiltDisplay,
[](orbis::KNote *note) -> std::optional<orbis::intptr_t> {
if ((note->event.ident >> 48) == 0x64) {
return 0;
}
return {};
});

} else { // used during open/close
ORBIS_LOG_NOTICE("dce: UNIMPLEMENTED FlipControl", args->id, args->arg2,
args->ptr, args->size);

Expand Down

0 comments on commit 28ceb74

Please sign in to comment.