mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-18 22:08:53 +08:00
Update header with structures for AUB services.
This commit updates the structures and adds getters/setters to AUB services. Change-Id: I14ce251b68f233428458958565c2d52551661747
This commit is contained in:
committed by
sys_ocldev
parent
b59a5f1910
commit
cf5b5aecec
@@ -30,6 +30,17 @@
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
|
||||
inline void setMisalignedUint64(uint64_t *address, const uint64_t value) {
|
||||
uint32_t *addressBits = reinterpret_cast<uint32_t *>(address);
|
||||
addressBits[0] = static_cast<uint32_t>(value);
|
||||
addressBits[1] = static_cast<uint32_t>(value >> 32);
|
||||
}
|
||||
|
||||
inline uint64_t getMisalignedUint64(const uint64_t *address) {
|
||||
const uint32_t *addressBits = reinterpret_cast<const uint32_t *>(address);
|
||||
return static_cast<uint64_t>(static_cast<uint64_t>(addressBits[1]) << 32) | addressBits[0];
|
||||
}
|
||||
|
||||
struct AubCmdHdr {
|
||||
uint32_t DwordLength : 16,
|
||||
SubOp : 7,
|
||||
@@ -58,6 +69,12 @@ struct AubCmdDumpBmpHd {
|
||||
UseFullFormat : 1,
|
||||
Reserved_1 : 25;
|
||||
uint32_t DirectoryHandle;
|
||||
uint64_t getBaseAddr() const {
|
||||
return getMisalignedUint64(&this->BaseAddr);
|
||||
}
|
||||
void setBaseAddr(const uint64_t baseAddr) {
|
||||
setMisalignedUint64(&this->BaseAddr, baseAddr);
|
||||
}
|
||||
};
|
||||
static_assert(44 == sizeof(AubCmdDumpBmpHd), "Invalid size for AubCmdDumpBmpHd");
|
||||
|
||||
@@ -84,6 +101,30 @@ struct AubCaptureBinaryDumpHD {
|
||||
uint32_t ReservedDW1;
|
||||
uint32_t ReservedDW2;
|
||||
char OutputFile[4];
|
||||
uint64_t getBaseAddr() const {
|
||||
return getMisalignedUint64(&this->BaseAddr);
|
||||
}
|
||||
void setBaseAddr(const uint64_t baseAddr) {
|
||||
setMisalignedUint64(&this->BaseAddr, baseAddr);
|
||||
}
|
||||
uint64_t getWidth() const {
|
||||
return getMisalignedUint64(&this->Width);
|
||||
}
|
||||
void setWidth(const uint64_t width) {
|
||||
setMisalignedUint64(&this->Width, width);
|
||||
}
|
||||
uint64_t getHeight() const {
|
||||
return getMisalignedUint64(&this->Height);
|
||||
}
|
||||
void setHeight(const uint64_t height) {
|
||||
setMisalignedUint64(&this->Height, height);
|
||||
}
|
||||
uint64_t getPitch() const {
|
||||
return getMisalignedUint64(&this->Pitch);
|
||||
}
|
||||
void setPitch(const uint64_t pitch) {
|
||||
setMisalignedUint64(&this->Pitch, pitch);
|
||||
}
|
||||
};
|
||||
static_assert(56 == sizeof(AubCaptureBinaryDumpHD), "Invalid size for AubCaptureBinaryDumpHD");
|
||||
|
||||
|
||||
@@ -131,6 +131,7 @@ struct AubFileStream : public AubStream {
|
||||
void writeGTT(uint32_t offset, uint64_t entry) override;
|
||||
void writeMMIO(uint32_t offset, uint32_t value) override;
|
||||
void registerPoll(uint32_t registerOffset, uint32_t mask, uint32_t value, bool pollNotEqual, uint32_t timeoutAction) override;
|
||||
MOCKABLE_VIRTUAL void write(const char *data, size_t size);
|
||||
MOCKABLE_VIRTUAL void expectMemory(uint64_t physAddress, const void *memory, size_t size);
|
||||
MOCKABLE_VIRTUAL bool addComment(const char *message);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -1303,6 +1303,12 @@ struct CmdServicesMemTraceDumpCompress {
|
||||
};
|
||||
};
|
||||
uint64_t surfaceAddress;
|
||||
uint64_t getSurfaceAddress() const {
|
||||
return getMisalignedUint64(&this->surfaceAddress);
|
||||
}
|
||||
void setSurfaceAddress(const uint64_t surfaceAddress) {
|
||||
setMisalignedUint64(&this->surfaceAddress, surfaceAddress);
|
||||
}
|
||||
int getSurfaceAddressLength() const {
|
||||
return 2 - (1) + 1;
|
||||
}
|
||||
@@ -1339,8 +1345,8 @@ struct CmdServicesMemTraceDumpCompress {
|
||||
uint32_t blockHeight : 8;
|
||||
uint32_t blockDepth : 8;
|
||||
uint32_t mode : 1;
|
||||
uint32_t algorithm : 2;
|
||||
uint32_t : 5;
|
||||
uint32_t algorithm : 3;
|
||||
uint32_t : 4;
|
||||
};
|
||||
uint32_t tileWidth;
|
||||
uint32_t tileHeight;
|
||||
@@ -1349,6 +1355,16 @@ struct CmdServicesMemTraceDumpCompress {
|
||||
uint32_t clearColorGreen;
|
||||
uint32_t clearColorBlue;
|
||||
uint32_t clearColorAlpha;
|
||||
struct {
|
||||
uint32_t gttType : 2;
|
||||
uint32_t clearColorType : 1;
|
||||
uint32_t : 29;
|
||||
};
|
||||
uint32_t directoryHandle;
|
||||
uint64_t clearColorAddress;
|
||||
int getClearColorAddressLength() const {
|
||||
return 24 - (23) + 1;
|
||||
}
|
||||
int32_t getPacketSize() const {
|
||||
return dwordCount + 1;
|
||||
}
|
||||
@@ -1375,57 +1391,65 @@ struct CmdServicesMemTraceDumpCompress {
|
||||
static uint32_t type() { return 0x7; }
|
||||
static uint32_t opcode() { return 0x2e; }
|
||||
static uint32_t subOpcode() { return 0x10; }
|
||||
struct DumpTypeValues {
|
||||
enum { Bmp32 = 2,
|
||||
Tre = 3,
|
||||
Bmp = 0,
|
||||
Bin = 1,
|
||||
Png = 4 };
|
||||
};
|
||||
struct AlgorithmValues {
|
||||
enum { Lossless = 2,
|
||||
Msaa = 3,
|
||||
Astc = 1,
|
||||
Media = 0 };
|
||||
};
|
||||
struct TiledResourceModeValues {
|
||||
enum { TrmodeYs = 2,
|
||||
TrmodeYf = 1,
|
||||
TrmodeNone = 0 };
|
||||
struct GttTypeValues {
|
||||
enum { Ppgtt = 1,
|
||||
Ggtt = 0 };
|
||||
};
|
||||
struct SurfaceTilingTypeValues {
|
||||
enum { YmajorS = 4,
|
||||
Ymajor = 3,
|
||||
Xmajor = 2,
|
||||
YmajorF = 5,
|
||||
Linear = 0,
|
||||
Xmajor = 2,
|
||||
Wmajor = 1 };
|
||||
Wmajor = 1,
|
||||
Ymajor = 3 };
|
||||
};
|
||||
struct ModeValues {
|
||||
enum { Horizontal = 1,
|
||||
Vertical = 0 };
|
||||
};
|
||||
struct ClearColorTypeValues {
|
||||
enum { Immediate = 0,
|
||||
Address = 1 };
|
||||
};
|
||||
struct SurfaceTypeValues {
|
||||
enum {
|
||||
SurftypeBuffer = 4,
|
||||
SurftypeStrbuf = 5,
|
||||
SurftypeNull = 6,
|
||||
SurftypeCube = 3,
|
||||
SurftypeStrbuf = 5,
|
||||
SurftypeBuffer = 4,
|
||||
Surftype3D = 2,
|
||||
Surftype2D = 1,
|
||||
Surftype1D = 0
|
||||
Surftype1D = 0,
|
||||
SurftypeNull = 6
|
||||
};
|
||||
};
|
||||
struct ModeValues {
|
||||
enum { Vertical = 0,
|
||||
Horizontal = 1 };
|
||||
struct AlgorithmValues {
|
||||
enum { Uncompressed = 4,
|
||||
Astc = 1,
|
||||
Lossless = 2,
|
||||
Media = 0,
|
||||
Msaa = 3 };
|
||||
};
|
||||
struct AuxSurfaceTilingTypeValues {
|
||||
enum { YmajorS = 4,
|
||||
Ymajor = 3,
|
||||
Xmajor = 2,
|
||||
YmajorF = 5,
|
||||
Linear = 0,
|
||||
Xmajor = 2,
|
||||
Wmajor = 1 };
|
||||
Wmajor = 1,
|
||||
Ymajor = 3 };
|
||||
};
|
||||
struct DumpTypeValues {
|
||||
enum { Bin = 1,
|
||||
Png = 4,
|
||||
Bmp = 0,
|
||||
Bmp32 = 2,
|
||||
Tre = 3 };
|
||||
};
|
||||
struct TiledResourceModeValues {
|
||||
enum { TrmodeNone = 0,
|
||||
TrmodeYf = 1,
|
||||
TrmodeYs = 2 };
|
||||
};
|
||||
};
|
||||
|
||||
#ifndef WIN32
|
||||
#pragma pack()
|
||||
#else
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -80,6 +80,10 @@ void AubFileStream::close() {
|
||||
fileHandle.close();
|
||||
}
|
||||
|
||||
void AubFileStream::write(const char *data, size_t size) {
|
||||
fileHandle.write(data, size);
|
||||
}
|
||||
|
||||
bool AubFileStream::init(uint32_t stepping, uint32_t device) {
|
||||
CmdServicesMemTraceVersion header;
|
||||
memset(&header, 0, sizeof(header));
|
||||
@@ -102,7 +106,7 @@ bool AubFileStream::init(uint32_t stepping, uint32_t device) {
|
||||
header.commandLine[2] = 'O';
|
||||
header.commandLine[3] = 0;
|
||||
|
||||
fileHandle.write(reinterpret_cast<char *>(&header), sizeof(header));
|
||||
write(reinterpret_cast<char *>(&header), sizeof(header));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -110,13 +114,13 @@ void AubFileStream::writeMemory(uint64_t physAddress, const void *memory, size_t
|
||||
writeMemoryWriteHeader(physAddress, size, addressSpace, hint);
|
||||
|
||||
// Copy the contents from source to destination.
|
||||
fileHandle.write(reinterpret_cast<const char *>(memory), size);
|
||||
write(reinterpret_cast<const char *>(memory), size);
|
||||
|
||||
auto sizeRemainder = size % sizeof(uint32_t);
|
||||
if (sizeRemainder) {
|
||||
//if input size is not 4 byte aligned, write extra zeros to AUB
|
||||
uint32_t zero = 0;
|
||||
fileHandle.write(reinterpret_cast<char *>(&zero), sizeof(uint32_t) - sizeRemainder);
|
||||
write(reinterpret_cast<char *>(&zero), sizeof(uint32_t) - sizeRemainder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +140,7 @@ void AubFileStream::writeMemoryWriteHeader(uint64_t physAddress, size_t size, ui
|
||||
header.addressSpace = addressSpace;
|
||||
header.dataSizeInBytes = static_cast<uint32_t>(size);
|
||||
|
||||
fileHandle.write(reinterpret_cast<const char *>(&header), sizeMemoryWriteHeader);
|
||||
write(reinterpret_cast<const char *>(&header), sizeMemoryWriteHeader);
|
||||
}
|
||||
|
||||
void AubFileStream::writeGTT(uint32_t gttOffset, uint64_t entry) {
|
||||
@@ -144,7 +148,7 @@ void AubFileStream::writeGTT(uint32_t gttOffset, uint64_t entry) {
|
||||
}
|
||||
|
||||
void AubFileStream::writePTE(uint64_t physAddress, uint64_t entry) {
|
||||
fileHandle.write(reinterpret_cast<char *>(&entry), sizeof(entry));
|
||||
write(reinterpret_cast<char *>(&entry), sizeof(entry));
|
||||
}
|
||||
|
||||
void AubFileStream::writeMMIO(uint32_t offset, uint32_t value) {
|
||||
@@ -160,7 +164,7 @@ void AubFileStream::writeMMIO(uint32_t offset, uint32_t value) {
|
||||
header.writeMaskHigh = 0x00000000;
|
||||
header.data[0] = value;
|
||||
|
||||
fileHandle.write(reinterpret_cast<char *>(&header), sizeof(header));
|
||||
write(reinterpret_cast<char *>(&header), sizeof(header));
|
||||
}
|
||||
|
||||
void AubFileStream::registerPoll(uint32_t registerOffset, uint32_t mask, uint32_t value, bool pollNotEqual, uint32_t timeoutAction) {
|
||||
@@ -177,7 +181,7 @@ void AubFileStream::registerPoll(uint32_t registerOffset, uint32_t mask, uint32_
|
||||
header.data[0] = value;
|
||||
header.dwordCount = (sizeof(header) / sizeof(uint32_t)) - 1;
|
||||
|
||||
fileHandle.write(reinterpret_cast<char *>(&header), sizeof(header));
|
||||
write(reinterpret_cast<char *>(&header), sizeof(header));
|
||||
}
|
||||
|
||||
void AubFileStream::expectMemory(uint64_t physAddress, const void *memory, size_t sizeRemaining) {
|
||||
@@ -209,10 +213,10 @@ void AubFileStream::expectMemory(uint64_t physAddress, const void *memory, size_
|
||||
header.dataSizeInBytes = static_cast<uint32_t>(sizeThisIteration);
|
||||
|
||||
// Write the header
|
||||
fileHandle.write(reinterpret_cast<char *>(&header), headerSize);
|
||||
write(reinterpret_cast<char *>(&header), headerSize);
|
||||
|
||||
// Copy the contents from source to destination.
|
||||
fileHandle.write(reinterpret_cast<const char *>(memory), sizeThisIteration);
|
||||
write(reinterpret_cast<const char *>(memory), sizeThisIteration);
|
||||
|
||||
sizeRemaining -= sizeThisIteration;
|
||||
memory = (uint8_t *)memory + sizeThisIteration;
|
||||
@@ -222,13 +226,13 @@ void AubFileStream::expectMemory(uint64_t physAddress, const void *memory, size_
|
||||
if (remainder) {
|
||||
//if size is not 4 byte aligned, write extra zeros to AUB
|
||||
uint32_t zero = 0;
|
||||
fileHandle.write(reinterpret_cast<char *>(&zero), sizeof(uint32_t) - remainder);
|
||||
write(reinterpret_cast<char *>(&zero), sizeof(uint32_t) - remainder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AubFileStream::createContext(const AubPpgttContextCreate &cmd) {
|
||||
fileHandle.write(reinterpret_cast<const char *>(&cmd), sizeof(cmd));
|
||||
write(reinterpret_cast<const char *>(&cmd), sizeof(cmd));
|
||||
}
|
||||
|
||||
bool AubFileStream::addComment(const char *message) {
|
||||
@@ -243,13 +247,13 @@ bool AubFileStream::addComment(const char *message) {
|
||||
auto dwordLen = ((messageLen + sizeof(uint32_t) - 1) & ~(sizeof(uint32_t) - 1)) / sizeof(uint32_t);
|
||||
cmd.dwordCount = static_cast<uint32_t>(dwordLen + 1);
|
||||
|
||||
fileHandle.write(reinterpret_cast<char *>(&cmd), sizeof(cmd) - sizeof(cmd.comment));
|
||||
fileHandle.write(message, messageLen);
|
||||
write(reinterpret_cast<char *>(&cmd), sizeof(cmd) - sizeof(cmd.comment));
|
||||
write(message, messageLen);
|
||||
auto remainder = messageLen & (sizeof(uint32_t) - 1);
|
||||
if (remainder) {
|
||||
//if size is not 4 byte aligned, write extra zeros to AUB
|
||||
uint32_t zero = 0;
|
||||
fileHandle.write(reinterpret_cast<char *>(&zero), sizeof(uint32_t) - remainder);
|
||||
write(reinterpret_cast<char *>(&zero), sizeof(uint32_t) - remainder);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -59,8 +59,6 @@ DECLARE_DEBUG_VARIABLE(int32_t, SetCommandStreamReceiver, 0, "Set command stream
|
||||
DECLARE_DEBUG_VARIABLE(std::string, TbxServer, std::string("127.0.0.1"), "TCP-IP address of TBX server")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, TbxPort, 4321, "TCP-IP port of TBX server")
|
||||
DECLARE_DEBUG_VARIABLE(std::string, ProductFamilyOverride, std::string("unk"), "Specify product for use in AUB/TBX")
|
||||
DECLARE_DEBUG_VARIABLE(bool, DisableAUBBufferDump, false, "Avoid dumping buffers in AUB files")
|
||||
DECLARE_DEBUG_VARIABLE(bool, DisableAUBImageDump, false, "Avoid dumping images in AUB files")
|
||||
DECLARE_DEBUG_VARIABLE(bool, FlattenBatchBufferForAUBDump, false, "Dump multi-level batch buffers to AUB as single, flat batch buffer")
|
||||
DECLARE_DEBUG_VARIABLE(bool, AddPatchInfoCommentsForAUBDump, false, "Dump comments containing allocations and patching information")
|
||||
/*FEATURE FLAGS*/
|
||||
|
||||
@@ -61,6 +61,27 @@ struct MockAubFileStream : public AUBCommandStreamReceiver::AubFileStream {
|
||||
MOCK_METHOD1(addComment, bool(const char *message));
|
||||
};
|
||||
|
||||
TEST_F(AubCommandStreamReceiverTests, givenStructureWhenMisalignedUint64ThenUseSetterGetterFunctionsToSetGetValue) {
|
||||
const uint64_t value = 0x0123456789ABCDEFu;
|
||||
AubMemDump::AubCaptureBinaryDumpHD aubCaptureBinaryDumpHD{};
|
||||
aubCaptureBinaryDumpHD.setBaseAddr(value);
|
||||
EXPECT_EQ(value, aubCaptureBinaryDumpHD.getBaseAddr());
|
||||
aubCaptureBinaryDumpHD.setWidth(value);
|
||||
EXPECT_EQ(value, aubCaptureBinaryDumpHD.getWidth());
|
||||
aubCaptureBinaryDumpHD.setHeight(value);
|
||||
EXPECT_EQ(value, aubCaptureBinaryDumpHD.getHeight());
|
||||
aubCaptureBinaryDumpHD.setPitch(value);
|
||||
EXPECT_EQ(value, aubCaptureBinaryDumpHD.getPitch());
|
||||
|
||||
AubMemDump::AubCmdDumpBmpHd aubCmdDumpBmpHd{};
|
||||
aubCmdDumpBmpHd.setBaseAddr(value);
|
||||
EXPECT_EQ(value, aubCmdDumpBmpHd.getBaseAddr());
|
||||
|
||||
AubMemDump::CmdServicesMemTraceDumpCompress cmdServicesMemTraceDumpCompress{};
|
||||
cmdServicesMemTraceDumpCompress.setSurfaceAddress(value);
|
||||
EXPECT_EQ(value, cmdServicesMemTraceDumpCompress.getSurfaceAddress());
|
||||
}
|
||||
|
||||
TEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenItIsCreatedWithWrongGfxCoreFamilyThenNullPointerShouldBeReturned) {
|
||||
HardwareInfo hwInfo = *platformDevices[0];
|
||||
GFXCORE_FAMILY family = hwInfo.pPlatform->eRenderCoreFamily;
|
||||
|
||||
@@ -55,8 +55,6 @@ UseMaxSimdSizeToDeduceMaxWorkgroupSize = false
|
||||
EnableComputeWorkSizeSquared = false
|
||||
TrackParentEvents = false
|
||||
PrintLWSSizes = false
|
||||
DisableAUBBufferDump = false
|
||||
DisableAUBImageDump = false
|
||||
UseNoRingFlushesKmdMode = false
|
||||
OverrideThreadArbitrationPolicy = -1
|
||||
PrintDriverDiagnostics = -1
|
||||
|
||||
Reference in New Issue
Block a user