L0Debug - capture SurfaceState heaps

Related-To: NEO-7103

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2022-06-24 11:45:34 +00:00
committed by Compute-Runtime-Automation
parent 94f3e54261
commit 31dbc04f23
5 changed files with 53 additions and 7 deletions

View File

@@ -3421,6 +3421,35 @@ TEST(DrmMemoryManager, givenTrackedAllocationTypeWhenFreeingThenRegisteredHandle
EXPECT_EQ(1u, mockDrm->unregisterCalledCount);
}
TEST(DrmMemoryManager, givenEnabledResourceRegistrationWhenSshIsAllocatedThenItIsMarkedForCapture) {
auto executionEnvironment = new MockExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(1u);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto mockDrm = new DrmMockResources(*executionEnvironment->rootDeviceEnvironments[0]);
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mockDrm));
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*mockDrm, 0u);
executionEnvironment->memoryManager = std::make_unique<TestedDrmMemoryManager>(false, false, false, *executionEnvironment);
for (uint32_t i = 3; i < 3 + static_cast<uint32_t>(DrmResourceClass::MaxSize); i++) {
mockDrm->classHandles.push_back(i);
}
EXPECT_TRUE(mockDrm->resourceRegistrationEnabled());
auto device = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(executionEnvironment, 0));
CommandContainer cmdContainer;
cmdContainer.initialize(device.get(), nullptr, true);
auto *ssh = cmdContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE);
auto bo = static_cast<DrmAllocation *>(ssh->getGraphicsAllocation())->getBO();
ASSERT_NE(nullptr, bo);
EXPECT_TRUE(bo->isMarkedForCapture());
}
TEST(DrmMemoryManager, givenNullBoWhenRegisteringBindExtHandleThenEarlyReturn) {
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1u);