@@ -469,6 +469,28 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllo
469469 memoryManager->freeGraphicsMemory (fillPatternAllocation);
470470}
471471
472+ TEST_F (WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllocationsForResidencyThenCommandBufferAllocationsShouldBeKmDafLocked) {
473+ GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties (MockAllocationProperties{MemoryConstants::pageSize});
474+ ASSERT_NE (nullptr , commandBuffer);
475+ LinearStream cs (commandBuffer);
476+ BatchBuffer batchBuffer{cs.getGraphicsAllocation (), 0 , 0 , nullptr , false , false , QueueThrottle::MEDIUM, cs.getUsed (), &cs};
477+
478+ auto commandBufferAllocation = memoryManager->allocateGraphicsMemoryWithProperties (MockAllocationProperties{MemoryConstants::pageSize});
479+ ASSERT_NE (nullptr , commandBufferAllocation);
480+ commandBufferAllocation->setAllocationType (GraphicsAllocation::AllocationType::COMMAND_BUFFER);
481+ ResidencyContainer allocationsForResidency = {commandBufferAllocation};
482+
483+ wddm->setKmDafEnabled (true );
484+ csr->flush (batchBuffer, allocationsForResidency);
485+
486+ EXPECT_EQ (1u , wddm->kmDafLockResult .called );
487+ EXPECT_EQ (1u , wddm->kmDafLockResult .lockedAllocations .size ());
488+ EXPECT_EQ (commandBufferAllocation, wddm->kmDafLockResult .lockedAllocations [0 ]);
489+
490+ memoryManager->freeGraphicsMemory (commandBuffer);
491+ memoryManager->freeGraphicsMemory (commandBufferAllocation);
492+ }
493+
472494TEST_F (WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllocationsForResidencyThenNonLinearStreamAllocationShouldNotBeKmDafLocked) {
473495 GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties (MockAllocationProperties{MemoryConstants::pageSize});
474496 ASSERT_NE (nullptr , commandBuffer);
0 commit comments