mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
Merge pull request #844 from merwie/feat/agc-get-eq-context-id
feat(agc): implement sceAgcDriverGetEqContextId
This commit is contained in:
@@ -4,5 +4,6 @@
|
||||
#include "SceTypes.hpp"
|
||||
|
||||
extern "C" int APS5_VABI sceAgcDriverGetEqEventType(const KernelEvent* ev);
|
||||
extern "C" uint32_t APS5_VABI sceAgcDriverGetEqContextId(const KernelEvent* ev);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,9 +11,16 @@
|
||||
extern "C" {
|
||||
|
||||
uint32_t APS5_VABI sceAgcDriverGetEqContextId(const KernelEvent* ev) {
|
||||
(void)ev;
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
if (ev == nullptr || reinterpret_cast<std::uintptr_t>(ev) % alignof(KernelEvent) != 0) {
|
||||
throw std::runtime_error(std::string(__func__) + ": null or misaligned event");
|
||||
}
|
||||
if (ev->filter != -14) {
|
||||
throw std::runtime_error(std::string(__func__) + ": not a graphics event");
|
||||
}
|
||||
if (ev->ident > std::numeric_limits<uint32_t>::max()) {
|
||||
throw std::runtime_error(std::string(__func__) + ": context id overflow");
|
||||
}
|
||||
return static_cast<uint32_t>(ev->ident);
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverGetEqEventType(const KernelEvent* ev) {
|
||||
|
||||
@@ -63,6 +63,15 @@ void testEvents() {
|
||||
expectFailure([&] { sceAgcDriverGetEqEventType(&event); });
|
||||
expectFailure([] { sceAgcDriverGetEqEventType(nullptr); });
|
||||
expectFailure([&] { sceAgcDriverGetEqEventType(reinterpret_cast<const KernelEvent*>(reinterpret_cast<const std::byte*>(&event) + 1)); });
|
||||
event.ident = 0x29;
|
||||
check(sceAgcDriverGetEqContextId(&event) == 0x29, "graphics event context id uses wrong field");
|
||||
event.ident = std::numeric_limits<std::uintptr_t>::max();
|
||||
expectFailure([&] { sceAgcDriverGetEqContextId(&event); });
|
||||
event.ident = 1;
|
||||
event.filter = -1;
|
||||
expectFailure([&] { sceAgcDriverGetEqContextId(&event); });
|
||||
expectFailure([] { sceAgcDriverGetEqContextId(nullptr); });
|
||||
expectFailure([&] { sceAgcDriverGetEqContextId(reinterpret_cast<const KernelEvent*>(reinterpret_cast<const std::byte*>(&event) + 1)); });
|
||||
}
|
||||
|
||||
void testValidation() {
|
||||
@@ -174,10 +183,12 @@ void testEndOfPipeInterrupts() {
|
||||
std::array<KernelEvent, 2> events{};
|
||||
check(owner->GetTriggeredEvents(events.data(), 2) == 1, "graphics end-of-pipe interrupt was not delivered to its queue only");
|
||||
check(events[0].filter == -14 && events[0].udata == &graphicsTag && events[0].data == 2 && sceAgcDriverGetEqEventType(events.data()) == 0, "graphics end-of-pipe event encoding is wrong");
|
||||
check(sceAgcDriverGetEqContextId(events.data()) == 0, "graphics end-of-pipe event reports another context");
|
||||
check(owner->GetTriggeredEvents(events.data(), 2) == 0, "delivered interrupt was not cleared");
|
||||
check(sceAgcDriverSubmitAcb(0x20, &packet) == 0, "compute interrupt submit failed");
|
||||
AgcDriverWaitIdle_nid_postfix();
|
||||
check(owner->GetTriggeredEvents(events.data(), 2) == 1 && events[0].udata == &computeTag && sceAgcDriverGetEqEventType(events.data()) == 0x20, "compute end-of-pipe interrupt missing");
|
||||
check(sceAgcDriverGetEqContextId(events.data()) == 0x20, "compute end-of-pipe event reports another context");
|
||||
words[2] = 0;
|
||||
check(sceAgcDriverSubmitDcb(&packet) == 0, "plain release submit failed");
|
||||
AgcDriverWaitIdle_nid_postfix();
|
||||
|
||||
@@ -71,6 +71,7 @@ Throughout the project, every function at every stage either **does exactly what
|
||||
- [sceUserServiceGetUserColor](../../core/libs/prx/libSceUserService/Export.cpp) (libSceUserService) - the default profile colour is assumed to be blue (0)
|
||||
- [kP2L8t3j-aM](../../core/libs/prx/libSceVideoOut/src/Output.cpp) (libSceVideoOut) - unknown name, signature
|
||||
- [LibwuIonIBw](../../core/libs/prx/libSceVideoOut/src/Output.cpp) (libSceVideoOut) - unknown name, signature
|
||||
- [sceAgcDriverGetEqContextId](../../core/libs/prx/libSceAgcDriver/Eq/src/Query.cpp) (libSceAgcDriver) - returns `ident`: an end-of-pipe interrupt is delivered only to the registration whose id equals the raising queue, so `ident` is that context's id (titles register 0 or 1 for graphics and `0x20 + 8 * pipe + queue` for compute). The console's value is not known; KytyPS5 returns the event's `data`, which it fills with the interrupt's context id, whereas `data` here is the EV_CLEAR trigger count. Other event filters throw
|
||||
- [sceAgcSetSubmitMode](../../core/libs/prx/libSceAgc/Misc/src/Suspend.cpp) (libSceAgc) - mode values unknown; only 0 is accepted
|
||||
- [User data registers](../../core/libs/prx/libSceAgcDriver/Execution/src/Driver/Diagnostics.cpp) (AGC driver) - a `SPI_SHADER_USER_DATA_*` or `COMPUTE_USER_DATA_*` register the title never wrote reads as 0 when a stage's RSRC2 count covers it, as Kyty (zeroed `UserSgprInfo`) and SharpEmu (missing registers read 0) do, and as AMD PAL and Mesa initialize them; the console's value is not confirmed
|
||||
- [SET_PREDICATION](../../core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp) (AGC driver) - boolean predication follows the AMD PM4 encoding [Mesa](https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/amd/common/sid.h) uses: operation 3 reads 64 bits and 4 reads 32 bits, and bit 8 runs predicated packets when the value is non-zero (clear: when it is zero); the bit 12 hint is ignored. The address must have its low 4 bits clear, as `sceAgcDcbSetPredication` writes it. Query predication (Z-pass, primitive count), a predicated COND_EXEC, predicated command buffer chains and flips in predicated command buffers throw
|
||||
|
||||
Reference in New Issue
Block a user