Update getAllocationTypeString method

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2021-07-16 14:10:17 +00:00
committed by Compute-Runtime-Automation
parent e939e97384
commit abade55c2d
2 changed files with 24 additions and 0 deletions

View File

@ -337,6 +337,14 @@ const char *FileLogger<DebugLevel>::getAllocationTypeString(GraphicsAllocation c
return "DEBUG_MODULE_AREA";
case GraphicsAllocation::AllocationType::WORK_PARTITION_SURFACE:
return "WORK_PARTITION_SURFACE";
case GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER:
return "GPU_TIMESTAMP_DEVICE_BUFFER";
case GraphicsAllocation::AllocationType::RING_BUFFER:
return "RING_BUFFER";
case GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER:
return "SEMAPHORE_BUFFER";
case GraphicsAllocation::AllocationType::UNIFIED_SHARED_MEMORY:
return "UNIFIED_SHARED_MEMORY";
default:
return "ILLEGAL_VALUE";
}

View File

@ -926,6 +926,22 @@ TEST(AllocationTypeLoggingSingle, givenGraphicsAllocationTypeWhenConvertingToStr
EXPECT_STREQ(result, "ILLEGAL_VALUE");
}
TEST(AllocationTypeLoggingSingle, givenAllocationTypeWhenConvertingToStringThenSupportAll) {
std::string testFile = "testfile";
DebugVariables flags;
FullyEnabledFileLogger fileLogger(testFile, flags);
GraphicsAllocation graphicsAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0ull, 0ull, 0, MemoryPool::MemoryNull);
for (uint32_t i = 0; i < static_cast<uint32_t>(GraphicsAllocation::AllocationType::COUNT); i++) {
graphicsAllocation.setAllocationType(static_cast<GraphicsAllocation::AllocationType>(i));
auto result = fileLogger.getAllocationTypeString(&graphicsAllocation);
EXPECT_STRNE(result, "ILLEGAL_VALUE");
}
}
TEST(AllocationTypeLoggingSingle, givenDisabledDebugFunctionalityWhenGettingGraphicsAllocationTypeThenNullptrReturned) {
std::string testFile = "testfile";
DebugVariables flags;