-
-
Notifications
You must be signed in to change notification settings - Fork 775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
equeue: Implement sceGnmGetEqEventType/sceKernelGetEventData #1839
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-format
CI is failing as well.
|
||
// We need to convert IRQ# to event id | ||
// Exclude ids we shouldn't care about as they aren't a valid EqEventType. | ||
if (irq == Platform::InterruptId::GpuIdle || irq == Platform::InterruptId::GfxFlip) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're not checking for the rest of idents.
auto event_type = static_cast<GnmEqEventType>(id); | ||
eq->TriggerEvent(event_type, SceKernelEvent::Filter::GraphicsCore, | ||
reinterpret_cast<void*>(event_type)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Irrelevant cast in my opinion, since you'll be casting to void*
either way.
@@ -29,7 +29,7 @@ namespace Libraries::GnmDriver { | |||
|
|||
using namespace AmdGpu; | |||
|
|||
enum GnmEventIdents : u64 { | |||
enum GnmEqEventType : u64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the name change necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say so, this is so far not used and more inline with sceGnmGetEqEventType.
src/core/libraries/kernel/equeue.cpp
Outdated
bool has_event = false; | ||
for (auto& ev : m_events) { | ||
if (ev.event.ident == event.event.ident && ev.event.filter == event.event.filter) { | ||
ev = std::move(event); | ||
has_event = true; | ||
break; | ||
} | ||
} | ||
|
||
if (!has_event) { | ||
m_events.emplace_back(std::move(event)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move back to std::ranges::find
instead of manually iterating.
src/core/libraries/kernel/equeue.h
Outdated
// Ensure not to clear event data for Eq events, as it'll be fetched by sceGnmGetEqEventType. | ||
if (event.filter != SceKernelEvent::Filter::GraphicsCore) { | ||
event.data = 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be merged IMO, proper research on kernel has to be done.
Reviews addressed. |
This PR implements
sceGnmGetEqEventType
andsceKernelGetEventData
(called from the former, based on module research).Games are normally expected to call
sceGnmGetEqEventType
to get the type of Eq/GraphicCore events returned fromsceKernelWaitEqueue
. Since this was not yet implemented, some games that would wait on aGfxEop
event before rendering would permanently softlock.Furthermore, equeue events are uniquely identified by ident and filter. Some code paths such as
AddEvent
were not checking on this.Addresses a softlock in CUSA02168 (Gran Turismo Sport), CUSA24767 (Gran Turismo 7).
Needs testing.