mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
fix: use alignment when allocate by linux kmd
Related-To: NEO-14082 Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
1816068765
commit
12ab2131d8
@@ -929,7 +929,7 @@ GraphicsAllocation *DrmMemoryManager::allocateMemoryByKMD(const AllocationData &
|
||||
gmmRequirements.preferCompressed = allocationData.flags.preferCompressed;
|
||||
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper();
|
||||
auto gmm = std::make_unique<Gmm>(gmmHelper, allocationData.hostPtr,
|
||||
allocationData.size, 0u, CacheSettingsHelper::getGmmUsageType(allocationData.type, allocationData.flags.uncacheable, productHelper, gmmHelper->getHardwareInfo()), systemMemoryStorageInfo, gmmRequirements);
|
||||
allocationData.size, allocationData.alignment, CacheSettingsHelper::getGmmUsageType(allocationData.type, allocationData.flags.uncacheable, productHelper, gmmHelper->getHardwareInfo()), systemMemoryStorageInfo, gmmRequirements);
|
||||
size_t bufferSize = allocationData.size;
|
||||
auto alignment = allocationData.alignment;
|
||||
if (bufferSize >= 2 * MemoryConstants::megaByte) {
|
||||
|
||||
@@ -2080,6 +2080,29 @@ HWTEST_TEMPLATED_F(DrmMemoryManagerTest, GivenShareableEnabledWhenAskedToCreateG
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmMemoryManagerTest, GivenMemoryManagerWhenAllocateByKmdThenAlignmentIsCorrect) {
|
||||
mock->ioctlHelper.reset(new MockIoctlHelper(*mock));
|
||||
mock->queryMemoryInfo();
|
||||
|
||||
auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper<ProductHelper>();
|
||||
if (debugManager.flags.UseGemCreateExtInAllocateMemoryByKMD.get() == 0 ||
|
||||
!productHelper.useGemCreateExtInAllocateMemoryByKMD()) {
|
||||
mock->ioctlExpected.gemCreate = 1;
|
||||
} else {
|
||||
mock->ioctlExpected.gemCreateExt = 1;
|
||||
}
|
||||
mock->ioctlExpected.gemWait = 1;
|
||||
mock->ioctlExpected.gemClose = 1;
|
||||
|
||||
allocationData.size = MemoryConstants::pageSize;
|
||||
allocationData.alignment = 8388608;
|
||||
auto allocation = memoryManager->allocateMemoryByKMD(allocationData);
|
||||
auto gmm = allocation->getDefaultGmm();
|
||||
EXPECT_EQ(gmm->resourceParams.BaseAlignment, allocationData.alignment);
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmMemoryManagerTest, givenAllocateMemoryByKMDWhenPreferCompressedThenCompressionEnabled) {
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.RenderCompressedBuffersEnabled.set(true);
|
||||
|
||||
Reference in New Issue
Block a user