kfdtest: Return address of packet from IndirectBuffer::AddPacket

This can be used for allocating space in the IB for write-back data
in a NOP-packet with a payload.

Change-Id: I6202b89a455a65326366a15291789004dfdcc0b9
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
このコミットが含まれているのは:
Felix Kuehling
2019-10-30 19:21:37 -04:00
コミット 07b8c30ce8
2個のファイルの変更、6行の追加、6行の削除
+5 -5
ファイルの表示
@@ -37,16 +37,16 @@ IndirectBuffer::~IndirectBuffer(void) {
delete m_IndirectBuf;
}
void IndirectBuffer::AddPacket(const BasePacket &packet) {
ASSERT_EQ(packet.PacketType(), m_PacketTypeAllowed) << "Cannot add a packet since packet type doesn't match queue";
uint32_t *IndirectBuffer::AddPacket(const BasePacket &packet) {
EXPECT_EQ(packet.PacketType(), m_PacketTypeAllowed) << "Cannot add a packet since packet type doesn't match queue";
unsigned int writePtr = m_ActualSize;
ASSERT_GE(m_MaxSize, packet.SizeInDWords() + writePtr) << "Cannot add a packet, not enough room";
EXPECT_GE(m_MaxSize, packet.SizeInDWords() + writePtr) << "Cannot add a packet, not enough room";
memcpy(m_IndirectBuf->As<unsigned int*>() + writePtr , packet.GetPacket(), packet.SizeInBytes());
m_ActualSize += packet.SizeInDWords();
m_NumOfPackets++;
return m_IndirectBuf->As<HSAuint32 *>() + writePtr;
}