mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 17:00:59 +08:00
Remove allocation type UNDECIDED
Resolves: NEO-2733 Change-Id: If6102ca04f557feeedaf702fa0d9f63c79017fe4 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
0c6823afd6
commit
6e97a69a2b
@@ -73,7 +73,6 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
||||
SVM_ZERO_COPY,
|
||||
TAG_BUFFER,
|
||||
TIMESTAMP_PACKET_TAG_BUFFER,
|
||||
UNDECIDED,
|
||||
};
|
||||
|
||||
virtual ~GraphicsAllocation();
|
||||
|
||||
@@ -208,6 +208,7 @@ OsContext *MemoryManager::createAndRegisterOsContext(CommandStreamReceiver *comm
|
||||
bool MemoryManager::getAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const StorageInfo storageInfo,
|
||||
const void *hostPtr) {
|
||||
UNRECOVERABLE_IF(hostPtr == nullptr && !properties.flags.allocateMemory);
|
||||
UNRECOVERABLE_IF(properties.allocationType == GraphicsAllocation::AllocationType::UNKNOWN);
|
||||
|
||||
bool allow64KbPages = false;
|
||||
bool allow32Bit = false;
|
||||
@@ -261,7 +262,6 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
||||
case GraphicsAllocation::AllocationType::SVM_CPU:
|
||||
case GraphicsAllocation::AllocationType::SVM_GPU:
|
||||
case GraphicsAllocation::AllocationType::SVM_ZERO_COPY:
|
||||
case GraphicsAllocation::AllocationType::UNDECIDED:
|
||||
mayRequireL3Flush = true;
|
||||
default:
|
||||
break;
|
||||
@@ -284,7 +284,6 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
||||
case GraphicsAllocation::AllocationType::SVM_ZERO_COPY:
|
||||
case GraphicsAllocation::AllocationType::TAG_BUFFER:
|
||||
case GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY:
|
||||
case GraphicsAllocation::AllocationType::UNDECIDED:
|
||||
allocationData.flags.useSystemMemory = true;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -373,8 +373,6 @@ const char *DebugSettingsManager<DebugLevel>::getAllocationTypeString(GraphicsAl
|
||||
return "TAG_BUFFER";
|
||||
case GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER:
|
||||
return "TIMESTAMP_PACKET_TAG_BUFFER";
|
||||
case GraphicsAllocation::AllocationType::UNDECIDED:
|
||||
return "UNDECIDED";
|
||||
case GraphicsAllocation::AllocationType::UNKNOWN:
|
||||
return "UNKNOWN";
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class D3DTests : public PlatformFixture, public ::testing::Test {
|
||||
return alloc;
|
||||
}
|
||||
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle) override {
|
||||
AllocationProperties properties(0, GraphicsAllocation::AllocationType::UNDECIDED);
|
||||
AllocationProperties properties(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY);
|
||||
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle((osHandle)((UINT_PTR)handle), properties, false);
|
||||
alloc->setDefaultGmm(forceGmm);
|
||||
gmmOwnershipPassed = true;
|
||||
|
||||
@@ -356,12 +356,6 @@ TEST(MemoryManagerTest, givenSvmAllocationTypeWhenGetAllocationDataIsCalledThen6
|
||||
EXPECT_FALSE(allocData.flags.allow32Bit);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenUndecidedTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager::getAllocationData(allocData, {1, GraphicsAllocation::AllocationType::UNDECIDED}, {}, nullptr);
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenTagBufferTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager::getAllocationData(allocData, {1, GraphicsAllocation::AllocationType::TAG_BUFFER}, {}, nullptr);
|
||||
|
||||
@@ -396,7 +396,7 @@ TEST_F(MemoryAllocatorTest, givenMemoryManagerWhenAskedFor32bitAllocationWithPtr
|
||||
TEST_F(MemoryAllocatorTest, givenAllocationWithFragmentsWhenCallingFreeGraphicsMemoryThenDoNotCallHandleFenceCompletion) {
|
||||
auto size = 3u * MemoryConstants::pageSize;
|
||||
auto *ptr = reinterpret_cast<void *>(0xbeef1);
|
||||
AllocationProperties properties{false, size, GraphicsAllocation::AllocationType::UNDECIDED};
|
||||
AllocationProperties properties{false, size, GraphicsAllocation::AllocationType::BUFFER};
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, ptr);
|
||||
EXPECT_EQ(3u, allocation->fragmentsStorage.fragmentCount);
|
||||
@@ -1647,7 +1647,7 @@ TEST(MemoryManagerTest, givenMemoryManagerWhenAllocationWasNotUnlockedThenItIsUn
|
||||
|
||||
TEST(MemoryManagerTest, givenAllocationTypesThatMayNeedL3FlushWhenCallingGetAllocationDataThenFlushL3FlagIsCorrectlySet) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(1, GraphicsAllocation::AllocationType::UNDECIDED);
|
||||
AllocationProperties properties(1, GraphicsAllocation::AllocationType::UNKNOWN);
|
||||
properties.flags.flushL3RequiredForRead = 1;
|
||||
properties.flags.flushL3RequiredForWrite = 1;
|
||||
|
||||
@@ -1657,8 +1657,8 @@ TEST(MemoryManagerTest, givenAllocationTypesThatMayNeedL3FlushWhenCallingGetAllo
|
||||
GraphicsAllocation::AllocationType::GLOBAL_SURFACE, GraphicsAllocation::AllocationType::IMAGE,
|
||||
GraphicsAllocation::AllocationType::PIPE, GraphicsAllocation::AllocationType::SHARED_IMAGE,
|
||||
GraphicsAllocation::AllocationType::SHARED_BUFFER, GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY,
|
||||
GraphicsAllocation::AllocationType::SVM_ZERO_COPY, GraphicsAllocation::AllocationType::UNDECIDED,
|
||||
GraphicsAllocation::AllocationType::SVM_GPU, GraphicsAllocation::AllocationType::SVM_CPU};
|
||||
GraphicsAllocation::AllocationType::SVM_ZERO_COPY, GraphicsAllocation::AllocationType::SVM_GPU,
|
||||
GraphicsAllocation::AllocationType::SVM_CPU};
|
||||
|
||||
for (auto allocationType : allocationTypesThatMayNeedL3Flush) {
|
||||
properties.allocationType = allocationType;
|
||||
|
||||
@@ -12,8 +12,8 @@ namespace NEO {
|
||||
struct MockAllocationProperties : public AllocationProperties {
|
||||
public:
|
||||
MockAllocationProperties(size_t size, GraphicsAllocation::AllocationType allocationType) : AllocationProperties(size, allocationType) {}
|
||||
MockAllocationProperties(size_t size) : AllocationProperties(size, GraphicsAllocation::AllocationType::UNDECIDED) {}
|
||||
MockAllocationProperties(bool allocateMemory, size_t size) : AllocationProperties(allocateMemory, size, GraphicsAllocation::AllocationType::UNDECIDED) {}
|
||||
MockAllocationProperties(size_t size) : AllocationProperties(size, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY) {}
|
||||
MockAllocationProperties(bool allocateMemory, size_t size) : AllocationProperties(allocateMemory, size, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY) {}
|
||||
MockAllocationProperties(bool allocateMemory, size_t size, GraphicsAllocation::AllocationType allocationType) : AllocationProperties(allocateMemory, size, allocationType) {}
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -925,7 +925,6 @@ AllocationTypeTestCase allocationTypeValues[] = {
|
||||
{GraphicsAllocation::AllocationType::SVM_ZERO_COPY, "SVM_ZERO_COPY"},
|
||||
{GraphicsAllocation::AllocationType::TAG_BUFFER, "TAG_BUFFER"},
|
||||
{GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER, "TIMESTAMP_PACKET_TAG_BUFFER"},
|
||||
{GraphicsAllocation::AllocationType::UNDECIDED, "UNDECIDED"},
|
||||
{GraphicsAllocation::AllocationType::UNKNOWN, "UNKNOWN"}};
|
||||
|
||||
class AllocationTypeLogging : public ::testing::TestWithParam<AllocationTypeTestCase> {};
|
||||
|
||||
@@ -116,7 +116,7 @@ TEST_F(DrmCommandStreamTest, makeResident) {
|
||||
.Times(0);
|
||||
EXPECT_CALL(*mock, ioctl(DRM_IOCTL_I915_GEM_WAIT, ::testing::_))
|
||||
.Times(0);
|
||||
DrmAllocation graphicsAllocation(GraphicsAllocation::AllocationType::UNDECIDED, nullptr, nullptr, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
DrmAllocation graphicsAllocation(GraphicsAllocation::AllocationType::UNKNOWN, nullptr, nullptr, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
csr->makeResident(graphicsAllocation);
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ TEST_F(DrmCommandStreamTest, makeResidentTwiceTheSame) {
|
||||
EXPECT_CALL(*mock, ioctl(DRM_IOCTL_I915_GEM_WAIT, ::testing::_))
|
||||
.Times(0);
|
||||
|
||||
DrmAllocation graphicsAllocation(GraphicsAllocation::AllocationType::UNDECIDED, nullptr, nullptr, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
DrmAllocation graphicsAllocation(GraphicsAllocation::AllocationType::UNKNOWN, nullptr, nullptr, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
|
||||
csr->makeResident(graphicsAllocation);
|
||||
csr->makeResident(graphicsAllocation);
|
||||
@@ -146,7 +146,7 @@ TEST_F(DrmCommandStreamTest, makeResidentSizeZero) {
|
||||
EXPECT_CALL(*mock, ioctl(DRM_IOCTL_I915_GEM_WAIT, ::testing::_))
|
||||
.Times(0);
|
||||
|
||||
DrmAllocation graphicsAllocation(GraphicsAllocation::AllocationType::UNDECIDED, nullptr, nullptr, 0, MemoryPool::MemoryNull, 1u, false);
|
||||
DrmAllocation graphicsAllocation(GraphicsAllocation::AllocationType::UNKNOWN, nullptr, nullptr, 0, MemoryPool::MemoryNull, 1u, false);
|
||||
|
||||
csr->makeResident(graphicsAllocation);
|
||||
}
|
||||
@@ -161,8 +161,8 @@ TEST_F(DrmCommandStreamTest, makeResidentResized) {
|
||||
EXPECT_CALL(*mock, ioctl(DRM_IOCTL_I915_GEM_WAIT, ::testing::_))
|
||||
.Times(0);
|
||||
|
||||
DrmAllocation graphicsAllocation(GraphicsAllocation::AllocationType::UNDECIDED, nullptr, nullptr, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
DrmAllocation graphicsAllocation2(GraphicsAllocation::AllocationType::UNDECIDED, nullptr, nullptr, 8192, MemoryPool::MemoryNull, 1u, false);
|
||||
DrmAllocation graphicsAllocation(GraphicsAllocation::AllocationType::UNKNOWN, nullptr, nullptr, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
DrmAllocation graphicsAllocation2(GraphicsAllocation::AllocationType::UNKNOWN, nullptr, nullptr, 8192, MemoryPool::MemoryNull, 1u, false);
|
||||
|
||||
csr->makeResident(graphicsAllocation);
|
||||
csr->makeResident(graphicsAllocation2);
|
||||
@@ -468,8 +468,8 @@ TEST_F(DrmCommandStreamTest, FlushCheckFlags) {
|
||||
.Times(1)
|
||||
.WillRepeatedly(::testing::Return(0));
|
||||
|
||||
DrmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, nullptr, (void *)0x7FFFFFFF, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
DrmAllocation allocation2(GraphicsAllocation::AllocationType::UNDECIDED, nullptr, (void *)0x307FFFFFFF, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
DrmAllocation allocation(GraphicsAllocation::AllocationType::UNKNOWN, nullptr, (void *)0x7FFFFFFF, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
DrmAllocation allocation2(GraphicsAllocation::AllocationType::UNKNOWN, nullptr, (void *)0x307FFFFFFF, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
csr->makeResident(allocation);
|
||||
csr->makeResident(allocation2);
|
||||
csr->addBatchBufferEnd(cs, nullptr);
|
||||
@@ -502,7 +502,7 @@ TEST_F(DrmCommandStreamTest, CheckDrmFree) {
|
||||
EXPECT_CALL(*mock, ioctl(DRM_IOCTL_I915_GEM_WAIT, ::testing::_))
|
||||
.Times(2);
|
||||
|
||||
DrmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, nullptr, nullptr, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
DrmAllocation allocation(GraphicsAllocation::AllocationType::UNKNOWN, nullptr, nullptr, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
|
||||
csr->makeResident(allocation);
|
||||
csr->addBatchBufferEnd(cs, nullptr);
|
||||
@@ -543,7 +543,7 @@ TEST_F(DrmCommandStreamTest, CheckDrmFreeCloseFailed) {
|
||||
.WillOnce(::testing::Return(-1));
|
||||
EXPECT_CALL(*mock, ioctl(DRM_IOCTL_I915_GEM_WAIT, ::testing::_))
|
||||
.Times(2);
|
||||
DrmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, nullptr, nullptr, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
DrmAllocation allocation(GraphicsAllocation::AllocationType::UNKNOWN, nullptr, nullptr, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
|
||||
csr->makeResident(allocation);
|
||||
csr->addBatchBufferEnd(cs, nullptr);
|
||||
@@ -940,7 +940,7 @@ typedef Test<DrmCommandStreamEnhancedFixture> DrmCommandStreamLeaksTest;
|
||||
|
||||
TEST_F(DrmCommandStreamLeaksTest, makeResident) {
|
||||
auto buffer = this->createBO(1024);
|
||||
auto allocation = new DrmAllocation(GraphicsAllocation::AllocationType::UNDECIDED, buffer, nullptr, buffer->peekSize(), MemoryPool::MemoryNull, 1u, false);
|
||||
auto allocation = new DrmAllocation(GraphicsAllocation::AllocationType::UNKNOWN, buffer, nullptr, buffer->peekSize(), MemoryPool::MemoryNull, 1u, false);
|
||||
EXPECT_EQ(nullptr, allocation->getUnderlyingBuffer());
|
||||
|
||||
csr->makeResident(*allocation);
|
||||
@@ -962,8 +962,8 @@ TEST_F(DrmCommandStreamLeaksTest, makeResident) {
|
||||
TEST_F(DrmCommandStreamLeaksTest, makeResidentOnly) {
|
||||
BufferObject *buffer1 = this->createBO(4096);
|
||||
BufferObject *buffer2 = this->createBO(4096);
|
||||
auto allocation1 = new DrmAllocation(GraphicsAllocation::AllocationType::UNDECIDED, buffer1, nullptr, buffer1->peekSize(), MemoryPool::MemoryNull, 1u, false);
|
||||
auto allocation2 = new DrmAllocation(GraphicsAllocation::AllocationType::UNDECIDED, buffer2, nullptr, buffer2->peekSize(), MemoryPool::MemoryNull, 1u, false);
|
||||
auto allocation1 = new DrmAllocation(GraphicsAllocation::AllocationType::UNKNOWN, buffer1, nullptr, buffer1->peekSize(), MemoryPool::MemoryNull, 1u, false);
|
||||
auto allocation2 = new DrmAllocation(GraphicsAllocation::AllocationType::UNKNOWN, buffer2, nullptr, buffer2->peekSize(), MemoryPool::MemoryNull, 1u, false);
|
||||
EXPECT_EQ(nullptr, allocation1->getUnderlyingBuffer());
|
||||
EXPECT_EQ(nullptr, allocation2->getUnderlyingBuffer());
|
||||
|
||||
@@ -990,7 +990,7 @@ TEST_F(DrmCommandStreamLeaksTest, makeResidentOnly) {
|
||||
|
||||
TEST_F(DrmCommandStreamLeaksTest, makeResidentTwice) {
|
||||
auto buffer = this->createBO(1024);
|
||||
auto allocation = new DrmAllocation(GraphicsAllocation::AllocationType::UNDECIDED, buffer, nullptr, buffer->peekSize(), MemoryPool::MemoryNull, 1u, false);
|
||||
auto allocation = new DrmAllocation(GraphicsAllocation::AllocationType::UNKNOWN, buffer, nullptr, buffer->peekSize(), MemoryPool::MemoryNull, 1u, false);
|
||||
|
||||
csr->makeResident(*allocation);
|
||||
csr->processResidency(csr->getResidencyAllocations());
|
||||
@@ -1262,7 +1262,7 @@ TEST_F(DrmCommandStreamLeaksTest, GivenTwoAllocationsWhenBackingStorageIsDiffere
|
||||
|
||||
TEST_F(DrmCommandStreamLeaksTest, makeResidentSizeZero) {
|
||||
std::unique_ptr<BufferObject> buffer(this->createBO(0));
|
||||
DrmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, buffer.get(), nullptr, buffer->peekSize(), MemoryPool::MemoryNull, 1u, false);
|
||||
DrmAllocation allocation(GraphicsAllocation::AllocationType::UNKNOWN, buffer.get(), nullptr, buffer->peekSize(), MemoryPool::MemoryNull, 1u, false);
|
||||
EXPECT_EQ(nullptr, allocation.getUnderlyingBuffer());
|
||||
EXPECT_EQ(buffer->peekSize(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
@@ -1487,7 +1487,7 @@ class DrmMockBuffer : public Buffer {
|
||||
public:
|
||||
static DrmMockBuffer *create() {
|
||||
char *data = static_cast<char *>(::alignedMalloc(128, 64));
|
||||
DrmAllocation *alloc = new (std::nothrow) DrmAllocation(GraphicsAllocation::AllocationType::UNDECIDED, nullptr, &data, sizeof(data), MemoryPool::MemoryNull, 1u, false);
|
||||
DrmAllocation *alloc = new (std::nothrow) DrmAllocation(GraphicsAllocation::AllocationType::UNKNOWN, nullptr, &data, sizeof(data), MemoryPool::MemoryNull, 1u, false);
|
||||
return new DrmMockBuffer(data, 128, alloc);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ class DrmGemCloseWorkerFixture {
|
||||
class DrmAllocationWrapper : public DrmAllocation {
|
||||
public:
|
||||
DrmAllocationWrapper(BufferObject *bo)
|
||||
: DrmAllocation(GraphicsAllocation::AllocationType::UNDECIDED, bo, nullptr, 0, MemoryPool::MemoryNull, 1u, false) {
|
||||
: DrmAllocation(GraphicsAllocation::AllocationType::UNKNOWN, bo, nullptr, 0, MemoryPool::MemoryNull, 1u, false) {
|
||||
}
|
||||
};
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
|
||||
@@ -64,7 +64,7 @@ TEST_F(DrmMemoryManagerTest, GivenGraphicsAllocationWhenAddAndRemoveAllocationTo
|
||||
void *cpuPtr = (void *)0x30000;
|
||||
size_t size = 0x1000;
|
||||
|
||||
DrmAllocation gfxAllocation(GraphicsAllocation::AllocationType::UNDECIDED, nullptr, cpuPtr, size, MemoryPool::MemoryNull, 1u, false);
|
||||
DrmAllocation gfxAllocation(GraphicsAllocation::AllocationType::UNKNOWN, nullptr, cpuPtr, size, MemoryPool::MemoryNull, 1u, false);
|
||||
memoryManager->addAllocationToHostPtrManager(&gfxAllocation);
|
||||
auto fragment = memoryManager->getHostPtrManager()->getFragment(gfxAllocation.getUnderlyingBuffer());
|
||||
EXPECT_NE(fragment, nullptr);
|
||||
@@ -462,7 +462,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmAllocationWhenHandleFenceCompletionThenCall
|
||||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.contextDestroy = 0;
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties({1024, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{1024});
|
||||
memoryManager->handleFenceCompletion(allocation);
|
||||
mock->testIoctls();
|
||||
|
||||
@@ -2014,7 +2014,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledOnNullAl
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationWithoutBufferObjectThenReturnNullPtr) {
|
||||
DrmAllocation drmAllocation(GraphicsAllocation::AllocationType::UNDECIDED, nullptr, nullptr, 0u, 0u, 1u, false);
|
||||
DrmAllocation drmAllocation(GraphicsAllocation::AllocationType::UNKNOWN, nullptr, nullptr, 0u, 0u, 1u, false);
|
||||
EXPECT_EQ(nullptr, drmAllocation.getBO());
|
||||
|
||||
auto ptr = memoryManager->lockResource(&drmAllocation);
|
||||
@@ -2033,7 +2033,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledButFails
|
||||
BufferObjectMock(Drm *drm) : BufferObject(drm, 1, true) {}
|
||||
};
|
||||
BufferObjectMock bo(&drmMock);
|
||||
DrmAllocation drmAllocation(GraphicsAllocation::AllocationType::UNDECIDED, &bo, nullptr, 0u, 0u, 1u, false);
|
||||
DrmAllocation drmAllocation(GraphicsAllocation::AllocationType::UNKNOWN, &bo, nullptr, 0u, 0u, 1u, false);
|
||||
EXPECT_NE(nullptr, drmAllocation.getBO());
|
||||
|
||||
auto ptr = memoryManager->lockResource(&drmAllocation);
|
||||
@@ -2044,7 +2044,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledButFails
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSetDomainCpuIsCalledOnAllocationWithoutBufferObjectThenReturnFalse) {
|
||||
DrmAllocation drmAllocation(GraphicsAllocation::AllocationType::UNDECIDED, nullptr, nullptr, 0u, 0u, 1u, false);
|
||||
DrmAllocation drmAllocation(GraphicsAllocation::AllocationType::UNKNOWN, nullptr, nullptr, 0u, 0u, 1u, false);
|
||||
EXPECT_EQ(nullptr, drmAllocation.getBO());
|
||||
|
||||
auto success = memoryManager->setDomainCpu(drmAllocation, false);
|
||||
@@ -2061,7 +2061,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSetDomainCpuIsCalledButFai
|
||||
BufferObjectMock(Drm *drm) : BufferObject(drm, 1, true) {}
|
||||
};
|
||||
BufferObjectMock bo(&drmMock);
|
||||
DrmAllocation drmAllocation(GraphicsAllocation::AllocationType::UNDECIDED, &bo, nullptr, 0u, 0u, 1u, false);
|
||||
DrmAllocation drmAllocation(GraphicsAllocation::AllocationType::UNKNOWN, &bo, nullptr, 0u, 0u, 1u, false);
|
||||
EXPECT_NE(nullptr, drmAllocation.getBO());
|
||||
|
||||
auto success = memoryManager->setDomainCpu(drmAllocation, false);
|
||||
@@ -2077,7 +2077,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSetDomainCpuIsCalledOnAllo
|
||||
BufferObjectMock(Drm *drm) : BufferObject(drm, 1, true) {}
|
||||
};
|
||||
BufferObjectMock bo(&drmMock);
|
||||
DrmAllocation drmAllocation(GraphicsAllocation::AllocationType::UNDECIDED, &bo, nullptr, 0u, 0u, 1u, false);
|
||||
DrmAllocation drmAllocation(GraphicsAllocation::AllocationType::UNKNOWN, &bo, nullptr, 0u, 0u, 1u, false);
|
||||
EXPECT_NE(nullptr, drmAllocation.getBO());
|
||||
|
||||
auto success = memoryManager->setDomainCpu(drmAllocation, true);
|
||||
@@ -3129,15 +3129,15 @@ TEST(DrmAllocationTest, givenAllocationTypeWhenPassedToDrmAllocationConstructorT
|
||||
DrmAllocation allocation{GraphicsAllocation::AllocationType::COMMAND_BUFFER, nullptr, nullptr, static_cast<size_t>(0), 0u, MemoryPool::MemoryNull, false};
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::COMMAND_BUFFER, allocation.getAllocationType());
|
||||
|
||||
DrmAllocation allocation2{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, nullptr, 0ULL, static_cast<size_t>(0), MemoryPool::MemoryNull, false};
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::UNDECIDED, allocation2.getAllocationType());
|
||||
DrmAllocation allocation2{GraphicsAllocation::AllocationType::UNKNOWN, nullptr, nullptr, 0ULL, static_cast<size_t>(0), MemoryPool::MemoryNull, false};
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::UNKNOWN, allocation2.getAllocationType());
|
||||
}
|
||||
|
||||
TEST(DrmAllocationTest, givenMemoryPoolWhenPassedToDrmAllocationConstructorThenMemoryPoolIsStored) {
|
||||
DrmAllocation allocation{GraphicsAllocation::AllocationType::COMMAND_BUFFER, nullptr, nullptr, static_cast<size_t>(0), 0u, MemoryPool::System64KBPages, false};
|
||||
EXPECT_EQ(MemoryPool::System64KBPages, allocation.getMemoryPool());
|
||||
|
||||
DrmAllocation allocation2{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, nullptr, 0ULL, static_cast<size_t>(0), MemoryPool::SystemCpuInaccessible, false};
|
||||
DrmAllocation allocation2{GraphicsAllocation::AllocationType::UNKNOWN, nullptr, nullptr, 0ULL, static_cast<size_t>(0), MemoryPool::SystemCpuInaccessible, false};
|
||||
EXPECT_EQ(MemoryPool::SystemCpuInaccessible, allocation2.getMemoryPool());
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace NEO {
|
||||
|
||||
class MockWddmAllocation : public WddmAllocation {
|
||||
public:
|
||||
MockWddmAllocation() : WddmAllocation(GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false), gpuPtr(gpuAddress), handle(handles[0]) {
|
||||
MockWddmAllocation() : WddmAllocation(GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0, nullptr, MemoryPool::MemoryNull, false), gpuPtr(gpuAddress), handle(handles[0]) {
|
||||
}
|
||||
using WddmAllocation::cpuPtr;
|
||||
using WddmAllocation::memoryPool;
|
||||
|
||||
@@ -79,7 +79,7 @@ TEST_F(Wddm20Tests, givenNullPageTableManagerAndRenderCompressedResourceWhenMapp
|
||||
mockGmmRes->setUnifiedAuxTranslationCapable();
|
||||
|
||||
void *fakePtr = reinterpret_cast<void *>(0x100);
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, fakePtr, 0x2100, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNKNOWN, fakePtr, 0x2100, nullptr, MemoryPool::MemoryNull, false);
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
allocation.getHandleToModify(0u) = ALLOCATION_HANDLE;
|
||||
|
||||
@@ -173,7 +173,7 @@ TEST_F(Wddm20Tests, whenInitializeWddmThenContextIsCreated) {
|
||||
|
||||
TEST_F(Wddm20Tests, allocation) {
|
||||
OsAgnosticMemoryManager mm(*executionEnvironment);
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNKNOWN, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
allocation.setDefaultGmm(gmm);
|
||||
@@ -197,7 +197,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenAllocationSmallerUnderlyingThanAlignedSiz
|
||||
size_t underlyingPages = underlyingSize / MemoryConstants::pageSize;
|
||||
size_t alignedPages = alignedSize / MemoryConstants::pageSize;
|
||||
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, ptr, 0x2100, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNKNOWN, ptr, 0x2100, nullptr, MemoryPool::MemoryNull, false);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize());
|
||||
|
||||
allocation.setDefaultGmm(gmm);
|
||||
@@ -238,7 +238,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenReserveCallWhenItIsCalledWithProperParamt
|
||||
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenWddmAllocationWhenMappingGpuVaThenUseGmmSize) {
|
||||
void *fakePtr = reinterpret_cast<void *>(0x123);
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, fakePtr, 100, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNKNOWN, fakePtr, 100, nullptr, MemoryPool::MemoryNull, false);
|
||||
std::unique_ptr<Gmm> gmm(GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize()));
|
||||
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
@@ -305,7 +305,7 @@ TEST_F(Wddm20WithMockGdiDllTests, GivenThreeOsHandlesWhenAskedForDestroyAllocati
|
||||
|
||||
TEST_F(Wddm20Tests, mapAndFreeGpuVa) {
|
||||
OsAgnosticMemoryManager mm(*executionEnvironment);
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNKNOWN, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
allocation.setDefaultGmm(gmm);
|
||||
@@ -331,7 +331,7 @@ TEST_F(Wddm20Tests, mapAndFreeGpuVa) {
|
||||
TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
|
||||
OsAgnosticMemoryManager mm(*executionEnvironment);
|
||||
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 100, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 100, nullptr, MemoryPool::MemoryNull, false);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
allocation.setDefaultGmm(gmm);
|
||||
@@ -350,7 +350,7 @@ TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
|
||||
|
||||
TEST_F(Wddm20Tests, makeResidentNonResident) {
|
||||
OsAgnosticMemoryManager mm(*executionEnvironment);
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNKNOWN, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
allocation.setDefaultGmm(gmm);
|
||||
@@ -705,7 +705,7 @@ TEST_F(Wddm20Tests, whenCreateAllocation64kFailsThenReturnFalse) {
|
||||
|
||||
void *fakePtr = reinterpret_cast<void *>(0x123);
|
||||
auto gmm = std::make_unique<Gmm>(fakePtr, 100, false);
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, fakePtr, 100, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNKNOWN, fakePtr, 100, nullptr, MemoryPool::MemoryNull, false);
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
|
||||
EXPECT_FALSE(wddm->createAllocation64k(&allocation));
|
||||
|
||||
@@ -74,27 +74,24 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenUnlockResourceIsCalledThenKmDafListen
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDafListenerNotifyMapGpuVAIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, (void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false);
|
||||
allocation.setDefaultHandle(ALLOCATION_HANDLE);
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
uint64_t gpuPtr = 0u;
|
||||
auto gmm = std::make_unique<Gmm>(nullptr, 1, false);
|
||||
|
||||
wddmWithKmDafMock->mapGpuVirtualAddress(allocation.getDefaultGmm(), allocation.getDefaultHandle(), wddmWithKmDafMock->getGfxPartition().Standard.Base, wddmWithKmDafMock->getGfxPartition().Standard.Limit, 0u, allocation.getGpuAddressToModify());
|
||||
wddmWithKmDafMock->mapGpuVirtualAddress(gmm.get(), ALLOCATION_HANDLE, wddmWithKmDafMock->getGfxPartition().Standard.Base,
|
||||
wddmWithKmDafMock->getGfxPartition().Standard.Limit, 0u, gpuPtr);
|
||||
|
||||
EXPECT_EQ(wddmWithKmDafMock->featureTable->ftrKmdDaf, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.ftrKmdDaf);
|
||||
EXPECT_EQ(wddmWithKmDafMock->getAdapter(), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hAdapter);
|
||||
EXPECT_EQ(wddmWithKmDafMock->getDevice(), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hDevice);
|
||||
EXPECT_EQ(allocation.getDefaultHandle(), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hAllocation);
|
||||
EXPECT_EQ(GmmHelper::decanonize(allocation.getGpuAddress()), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.GpuVirtualAddress);
|
||||
EXPECT_EQ(ALLOCATION_HANDLE, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hAllocation);
|
||||
EXPECT_EQ(GmmHelper::decanonize(gpuPtr), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.GpuVirtualAddress);
|
||||
EXPECT_EQ(wddmWithKmDafMock->getGdi()->escape, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.pfnEscape);
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenFreeGpuVirtualAddressIsCalledThenKmDafListenerNotifyUnmapGpuVAIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, (void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false);
|
||||
auto &gpuPtr = allocation.getGpuAddressToModify();
|
||||
gpuPtr = GPUVA;
|
||||
uint64_t gpuPtr = GPUVA;
|
||||
|
||||
wddmWithKmDafMock->freeGpuVirtualAddress(gpuPtr, allocation.getUnderlyingBufferSize());
|
||||
wddmWithKmDafMock->freeGpuVirtualAddress(gpuPtr, MemoryConstants::pageSize);
|
||||
|
||||
EXPECT_EQ(wddmWithKmDafMock->featureTable->ftrKmdDaf, wddmWithKmDafMock->getKmDafListenerMock().notifyUnmapGpuVAParametrization.ftrKmdDaf);
|
||||
EXPECT_EQ(wddmWithKmDafMock->getAdapter(), wddmWithKmDafMock->getKmDafListenerMock().notifyUnmapGpuVAParametrization.hAdapter);
|
||||
@@ -131,12 +128,11 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenEvictIsCalledThenKmDafListenerNotifyE
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, (void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false);
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
auto &handle = allocation.getHandleToModify(0u);
|
||||
auto gmm = std::make_unique<Gmm>(nullptr, 1, false);
|
||||
auto handle = 0u;
|
||||
auto ptr = reinterpret_cast<void *>(0x10000);
|
||||
|
||||
wddmWithKmDafMock->createAllocation(allocation.getAlignedCpuPtr(), gmm.get(), handle);
|
||||
wddmWithKmDafMock->createAllocation(ptr, gmm.get(), handle);
|
||||
|
||||
EXPECT_EQ(wddmWithKmDafMock->featureTable->ftrKmdDaf, wddmWithKmDafMock->getKmDafListenerMock().notifyWriteTargetParametrization.ftrKmdDaf);
|
||||
EXPECT_EQ(wddmWithKmDafMock->getAdapter(), wddmWithKmDafMock->getKmDafListenerMock().notifyWriteTargetParametrization.hAdapter);
|
||||
@@ -146,10 +142,8 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafList
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, (void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false);
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
auto &handle = allocation.getHandleToModify(0u);
|
||||
auto gmm = std::make_unique<Gmm>(nullptr, 1, false);
|
||||
auto handle = 0u;
|
||||
|
||||
wddmWithKmDafMock->createAllocation64k(gmm.get(), handle);
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ TEST(WddmMemoryManager, NonAssignable) {
|
||||
}
|
||||
|
||||
TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGettingTrimCandidatePositionThenReturnItsPositionAndUnusedPositionInOtherContexts) {
|
||||
WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false};
|
||||
MockWddmAllocation allocation;
|
||||
MockOsContext osContext(1u, 1, aub_stream::ENGINE_RCS, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false);
|
||||
allocation.setTrimCandidateListPosition(osContext.getContextId(), 700u);
|
||||
EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(0u));
|
||||
@@ -77,14 +77,14 @@ TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGetting
|
||||
}
|
||||
|
||||
TEST(WddmAllocationTest, givenAllocationCreatedWithOsContextCountOneWhenItIsCreatedThenMaxOsContextCountIsUsedInstead) {
|
||||
WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false};
|
||||
MockWddmAllocation allocation;
|
||||
allocation.setTrimCandidateListPosition(1u, 700u);
|
||||
EXPECT_EQ(700u, allocation.getTrimCandidateListPosition(1u));
|
||||
EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(0u));
|
||||
}
|
||||
|
||||
TEST(WddmAllocationTest, givenRequestedContextIdTooLargeWhenGettingTrimCandidateListPositionThenReturnUnusedPosition) {
|
||||
WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false};
|
||||
MockWddmAllocation allocation;
|
||||
EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(1u));
|
||||
EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(1000u));
|
||||
}
|
||||
@@ -92,16 +92,13 @@ TEST(WddmAllocationTest, givenRequestedContextIdTooLargeWhenGettingTrimCandidate
|
||||
TEST(WddmAllocationTest, givenAllocationTypeWhenPassedToWddmAllocationConstructorThenAllocationTypeIsStored) {
|
||||
WddmAllocation allocation{GraphicsAllocation::AllocationType::COMMAND_BUFFER, nullptr, 0, nullptr, MemoryPool::MemoryNull, false};
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::COMMAND_BUFFER, allocation.getAllocationType());
|
||||
|
||||
WddmAllocation allocation2{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, 0u, MemoryPool::MemoryNull, false};
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::UNDECIDED, allocation2.getAllocationType());
|
||||
}
|
||||
|
||||
TEST(WddmAllocationTest, givenMemoryPoolWhenPassedToWddmAllocationConstructorThenMemoryPoolIsStored) {
|
||||
WddmAllocation allocation{GraphicsAllocation::AllocationType::COMMAND_BUFFER, nullptr, 0, nullptr, MemoryPool::System64KBPages, false};
|
||||
EXPECT_EQ(MemoryPool::System64KBPages, allocation.getMemoryPool());
|
||||
|
||||
WddmAllocation allocation2{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, 0u, MemoryPool::SystemCpuInaccessible, false};
|
||||
WddmAllocation allocation2{GraphicsAllocation::AllocationType::COMMAND_BUFFER, nullptr, 0, 0u, MemoryPool::SystemCpuInaccessible, false};
|
||||
EXPECT_EQ(MemoryPool::SystemCpuInaccessible, allocation2.getMemoryPool());
|
||||
}
|
||||
|
||||
@@ -970,7 +967,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuV
|
||||
memoryManager->setDeferredDeleter(nullptr);
|
||||
setMapGpuVaFailConfigFcn(0, 1);
|
||||
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, ptr, size, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::BUFFER, ptr, size, nullptr, MemoryPool::MemoryNull, false);
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
bool ret = memoryManager->createWddmAllocation(&allocation, allocation.getAlignedCpuPtr());
|
||||
EXPECT_FALSE(ret);
|
||||
@@ -986,7 +983,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMap
|
||||
|
||||
setMapGpuVaFailConfigFcn(0, 1);
|
||||
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, ptr, size, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::BUFFER, ptr, size, nullptr, MemoryPool::MemoryNull, false);
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
bool ret = memoryManager->createWddmAllocation(&allocation, allocation.getAlignedCpuPtr());
|
||||
EXPECT_TRUE(ret);
|
||||
@@ -1002,7 +999,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstAnd
|
||||
|
||||
setMapGpuVaFailConfigFcn(0, 2);
|
||||
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, ptr, size, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation(GraphicsAllocation::AllocationType::BUFFER, ptr, size, nullptr, MemoryPool::MemoryNull, false);
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
bool ret = memoryManager->createWddmAllocation(&allocation, allocation.getAlignedCpuPtr());
|
||||
EXPECT_FALSE(ret);
|
||||
|
||||
@@ -631,9 +631,9 @@ TEST_F(WddmResidencyControllerWithGdiTest, trimToBudgetReturnsFalseWhenNumBytesT
|
||||
}
|
||||
|
||||
TEST_F(WddmResidencyControllerWithGdiTest, trimToBudgetStopsEvictingWhenNumBytesToTrimIsZero) {
|
||||
WddmAllocation allocation1(GraphicsAllocation::AllocationType::UNDECIDED, reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation2(GraphicsAllocation::AllocationType::UNDECIDED, reinterpret_cast<void *>(0x1000), 0x3000, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation3(GraphicsAllocation::AllocationType::UNDECIDED, reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation1(GraphicsAllocation::AllocationType::UNKNOWN, reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation2(GraphicsAllocation::AllocationType::UNKNOWN, reinterpret_cast<void *>(0x1000), 0x3000, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation3(GraphicsAllocation::AllocationType::UNKNOWN, reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, false);
|
||||
|
||||
allocation1.getResidencyData().resident[osContextId] = true;
|
||||
allocation1.getResidencyData().updateCompletionData(0, osContextId);
|
||||
@@ -726,8 +726,8 @@ TEST_F(WddmResidencyControllerWithGdiTest, trimToBudgetWaitsFromCpuWhenLastFence
|
||||
TEST_F(WddmResidencyControllerWithGdiAndMemoryManagerTest, trimToBudgetEvictsDoneFragmentsOnly) {
|
||||
gdi->setNonZeroNumBytesToTrimInEvict();
|
||||
void *ptr = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x1000);
|
||||
WddmAllocation allocation1(GraphicsAllocation::AllocationType::UNDECIDED, ptr, 0x1000, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation2(GraphicsAllocation::AllocationType::UNDECIDED, ptr, 0x1000, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation1(GraphicsAllocation::AllocationType::UNKNOWN, ptr, 0x1000, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation2(GraphicsAllocation::AllocationType::UNKNOWN, ptr, 0x1000, nullptr, MemoryPool::MemoryNull, false);
|
||||
|
||||
allocation1.getResidencyData().resident[osContextId] = true;
|
||||
allocation1.getResidencyData().updateCompletionData(0, osContextId);
|
||||
@@ -785,9 +785,9 @@ TEST_F(WddmResidencyControllerWithGdiTest, givenThreeAllocationsAlignedSizeBigge
|
||||
void *ptr2 = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x3000);
|
||||
void *ptr3 = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x5000);
|
||||
|
||||
WddmAllocation allocation1(GraphicsAllocation::AllocationType::UNDECIDED, ptr1, underlyingSize, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation2(GraphicsAllocation::AllocationType::UNDECIDED, ptr2, underlyingSize, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation3(GraphicsAllocation::AllocationType::UNDECIDED, ptr3, underlyingSize, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation1(GraphicsAllocation::AllocationType::UNKNOWN, ptr1, underlyingSize, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation2(GraphicsAllocation::AllocationType::UNKNOWN, ptr2, underlyingSize, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocation3(GraphicsAllocation::AllocationType::UNKNOWN, ptr3, underlyingSize, nullptr, MemoryPool::MemoryNull, false);
|
||||
|
||||
allocation1.getResidencyData().resident[osContextId] = true;
|
||||
allocation1.getResidencyData().updateCompletionData(0, osContextId);
|
||||
@@ -987,7 +987,7 @@ TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsAndTrimToB
|
||||
MockWddmAllocation allocation1;
|
||||
void *cpuPtr = reinterpret_cast<void *>(wddm->getWddmMinAddress() + 0x1000);
|
||||
size_t allocationSize = 0x1000;
|
||||
WddmAllocation allocationToTrim(GraphicsAllocation::AllocationType::UNDECIDED, cpuPtr, allocationSize, nullptr, MemoryPool::MemoryNull, false);
|
||||
WddmAllocation allocationToTrim(GraphicsAllocation::AllocationType::UNKNOWN, cpuPtr, allocationSize, nullptr, MemoryPool::MemoryNull, false);
|
||||
|
||||
allocationToTrim.getResidencyData().updateCompletionData(residencyController->getMonitoredFence().lastSubmittedFence, osContext->getContextId());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user