gpu: decode RELEASE_MEM directly from the driver's native packet

This commit is contained in:
nmzik committed 2026-10-23 21:11:07 +02:00
1 parent 227f12ee4b
commit bf5dd62eea
10 files changed
+121 -356

No files matched your search

+10 -16
View File
@@ -2027,7 +2027,7 @@ uint32_t* KYTY_SYSV_ABI AgcCbReleaseMem(CommandBuffer* buf, uint8_t action, uint
const uint32_t packet_action = static_cast<uint32_t>(action) & 0x3fu;
const uint32_t packet_event_index = (action >= 0x2fu ? 6u : 5u);
cmd[0] = KYTY_PM4(8, Pm4::IT_NOP, Pm4::R_RELEASE_MEM);
cmd[0] = KYTY_PM4(8, Pm4::IT_RELEASE_MEM, 0);
cmd[1] = packet_action | (packet_event_index << 8u) | ((packet_gcr_cntl & 0xfffu) << 12u) |
((static_cast<uint32_t>(cache_policy) & 0x3u) << 25u);
cmd[2] = ((static_cast<uint32_t>(dst) & 0x3u) << 16u) |
@@ -3772,24 +3772,21 @@ int KYTY_SYSV_ABI AgcQueueEndOfPipeActionPatchAddress(uint32_t* cmd,
const volatile Label* address) {
PRINT_NAME();
// Not sure
AgcTrace("\t cmd = 0x%016" PRIx64 "\n"
"\t address = 0x%016" PRIx64 "\n",
reinterpret_cast<uint64_t>(cmd), reinterpret_cast<uint64_t>(address));
EXIT_NOT_IMPLEMENTED(cmd == nullptr);
auto vaddr = reinterpret_cast<uint64_t>(address);
auto op = (cmd[0] >> 8u) & 0xffu;
if (((cmd[0] >> 8u) & 0xffu) != Pm4::IT_RELEASE_MEM) {
return GRAPHICS5_ERROR_INVALID_PACKET;
}
if ((op == Pm4::IT_NOP && KYTY_PM4_R(cmd[0]) == Pm4::R_RELEASE_MEM) ||
op == Pm4::IT_RELEASE_MEM) {
cmd[3] = static_cast<uint32_t>(vaddr & 0xffffffffu);
cmd[4] = static_cast<uint32_t>((vaddr >> 32u) & 0xffffffffu);
} else {
EXIT("unsupported queueEndOfPipeAction packet for address patch: 0x%08" PRIx32 "\n",
cmd[0]);
// A kSendIntCtx release has no address.
if (((cmd[2] >> 24u) & 0x7u) != 4u) {
const auto vaddr = reinterpret_cast<uint64_t>(address);
cmd[3] = (cmd[3] & 0x3u) | (static_cast<uint32_t>(vaddr) & ~0x3u);
cmd[4] = static_cast<uint32_t>(vaddr >> 32u);
}
return OK;
@@ -3804,10 +3801,7 @@ int KYTY_SYSV_ABI AgcQueueEndOfPipeActionPatchData(uint32_t* cmd, uint64_t data)
EXIT_NOT_IMPLEMENTED(cmd == nullptr);
const auto op = (cmd[0] >> 8u) & 0xffu;
const bool is_release_mem = op == Pm4::IT_RELEASE_MEM ||
(op == Pm4::IT_NOP && KYTY_PM4_R(cmd[0]) == Pm4::R_RELEASE_MEM);
if (!is_release_mem) {
if (((cmd[0] >> 8u) & 0xffu) != Pm4::IT_RELEASE_MEM) {
return GRAPHICS5_ERROR_INVALID_PACKET;
}