agc: support one-word NOP reservations and share packet sizing

This commit is contained in:
nmzik committed 2026-10-09 14:02:06 +02:00
1 parent 3ae5a9b70a
commit 4c8fc53a85
5 files changed
+49 -20

No files matched your search

+3 -16
View File
@@ -1730,7 +1730,7 @@ int KYTY_SYSV_ABI AgcDriverRegisterWorkloadStream(uint32_t stream_id, const void
}
uint32_t* KYTY_SYSV_ABI AgcCbNop(CommandBuffer* buf, uint32_t size_in_dwords) {
if (buf == nullptr || size_in_dwords < 2) {
if (buf == nullptr || size_in_dwords == 0) {
return nullptr;
}
@@ -1741,9 +1741,6 @@ uint32_t* KYTY_SYSV_ABI AgcCbNop(CommandBuffer* buf, uint32_t size_in_dwords) {
}
cmd[0] = KYTY_PM4(size_in_dwords, Pm4::IT_NOP, Pm4::R_ZERO);
if (size_in_dwords > 1) {
memset(cmd + 1, 0, static_cast<size_t>(size_in_dwords - 1) * 4);
}
return cmd;
}
@@ -3678,12 +3675,7 @@ int KYTY_SYSV_ABI AgcDmaDataPatchSetSrcAddressOrOffsetOrImmediate(
}
uint32_t KYTY_SYSV_ABI AgcGetPacketSize(uint32_t* packet) {
const auto cmd_id = packet[0];
if ((cmd_id & 0x3fffff00u) == 0x3fff1000u) {
return 1;
}
return KYTY_PM4_LEN(cmd_id);
return Pm4::PacketSizeDw(packet[0]);
}
int KYTY_SYSV_ABI AgcSetPacketPredication(uint32_t* packet, uint32_t predication) {
@@ -3725,12 +3717,7 @@ int KYTY_SYSV_ABI AgcSetRangePredication(uint32_t* start, const volatile uint32_
const auto cmd_id = packet[0];
packet[0] = (cmd_id & ~1u) | predication_bit;
auto size = KYTY_PM4_LEN(cmd_id);
if ((cmd_id & 0x3fffff00u) == 0x3fff1000u) {
size = 1;
}
packet_va += size * sizeof(uint32_t);
packet_va += Pm4::PacketSizeDw(cmd_id) * sizeof(uint32_t);
packet = reinterpret_cast<uint32_t*>(packet_va);
}