2
0

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>


[ROCm/ROCR-Runtime commit: 07b8c30ce8]
Este cometimento está contido em:
Felix Kuehling
2019-10-30 19:21:37 -04:00
ascendente 7b3b7de7b6
cometimento 0e79756932
2 ficheiros modificados com 6 adições e 6 eliminações
+5 -5
Ver ficheiro
@@ -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;
}
+1 -1
Ver ficheiro
@@ -39,7 +39,7 @@ class IndirectBuffer {
~IndirectBuffer(void);
// @brief Add packet to queue, all validations are done with gtest ASSERT and EXPECT
void AddPacket(const BasePacket &packet);
uint32_t *AddPacket(const BasePacket &packet);
// @returns Actual size of the indirect queue in DWords, equivalent to write pointer
unsigned int SizeInDWord() { return m_ActualSize; }
// @returns Indirect queue address