mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Pass maxOsContextCount to GraphicsAllocation
Change-Id: I4f327866433fe9b0cc0a6191336b54a9d2282702 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
dcb5353200
commit
6870104a1a
@ -661,7 +661,7 @@ bool AUBCommandStreamReceiverHw<GfxFamily>::writeMemory(GraphicsAllocation &gfxA
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool AUBCommandStreamReceiverHw<GfxFamily>::writeMemory(AllocationView &allocationView) {
|
||||
GraphicsAllocation gfxAllocation(this->rootDeviceIndex, GraphicsAllocation::AllocationType::UNKNOWN, reinterpret_cast<void *>(allocationView.first), allocationView.first, 0llu, allocationView.second, MemoryPool::MemoryNull);
|
||||
GraphicsAllocation gfxAllocation(this->rootDeviceIndex, GraphicsAllocation::AllocationType::UNKNOWN, reinterpret_cast<void *>(allocationView.first), allocationView.first, 0llu, allocationView.second, MemoryPool::MemoryNull, 0u);
|
||||
return writeMemory(gfxAllocation);
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,8 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocate32BitGraphicsMemoryImpl(con
|
||||
uint64_t offset = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(allocationData.hostPtr) & MemoryConstants::pageMask);
|
||||
MemoryAllocation *memAlloc = new MemoryAllocation(
|
||||
allocationData.rootDeviceIndex, allocationData.type, nullptr, const_cast<void *>(allocationData.hostPtr),
|
||||
GmmHelper::canonize(gpuVirtualAddress + offset), allocationData.size, counter, MemoryPool::System4KBPagesWith32BitGpuAddressing, false, false);
|
||||
GmmHelper::canonize(gpuVirtualAddress + offset), allocationData.size,
|
||||
counter, MemoryPool::System4KBPagesWith32BitGpuAddressing, false, false, maxOsContextCount);
|
||||
|
||||
memAlloc->set32BitAllocation(true);
|
||||
memAlloc->setGpuBaseAddress(GmmHelper::canonize(gfxPartition->getHeapBase(heap)));
|
||||
@ -147,7 +148,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocate32BitGraphicsMemoryImpl(con
|
||||
if (ptrAlloc != nullptr) {
|
||||
memoryAllocation = new MemoryAllocation(allocationData.rootDeviceIndex, allocationData.type, ptrAlloc, ptrAlloc, GmmHelper::canonize(gpuAddress),
|
||||
allocationData.size, counter, MemoryPool::System4KBPagesWith32BitGpuAddressing,
|
||||
false, allocationData.flags.flushL3);
|
||||
false, allocationData.flags.flushL3, maxOsContextCount);
|
||||
|
||||
memoryAllocation->set32BitAllocation(true);
|
||||
memoryAllocation->setGpuBaseAddress(GmmHelper::canonize(gfxPartition->getHeapBase(heap)));
|
||||
@ -342,7 +343,7 @@ MemoryAllocation *OsAgnosticMemoryManager::createMemoryAllocation(GraphicsAlloca
|
||||
bool flushL3Required, bool requireSpecificBitness) {
|
||||
if (!isLimitedRange(rootDeviceIndex)) {
|
||||
return new MemoryAllocation(rootDeviceIndex, allocationType, driverAllocatedCpuPointer, pMem, gpuAddress, memSize,
|
||||
count, pool, uncacheable, flushL3Required);
|
||||
count, pool, uncacheable, flushL3Required, maxOsContextCount);
|
||||
}
|
||||
|
||||
size_t alignedSize = alignSizeWholePage(pMem, memSize);
|
||||
@ -353,7 +354,7 @@ MemoryAllocation *OsAgnosticMemoryManager::createMemoryAllocation(GraphicsAlloca
|
||||
uint64_t limitedGpuAddress = gfxPartition->heapAllocate(heap, alignedSize);
|
||||
|
||||
auto memoryAllocation = new MemoryAllocation(rootDeviceIndex, allocationType, driverAllocatedCpuPointer, pMem, limitedGpuAddress, memSize,
|
||||
count, pool, uncacheable, flushL3Required);
|
||||
count, pool, uncacheable, flushL3Required, maxOsContextCount);
|
||||
|
||||
if (heap == HeapIndex::HEAP_EXTERNAL) {
|
||||
memoryAllocation->setGpuBaseAddress(GmmHelper::canonize(gfxPartition->getHeapBase(heap)));
|
||||
|
@ -21,29 +21,29 @@ class MemoryAllocation : public GraphicsAllocation {
|
||||
void setSharedHandle(osHandle handle) { sharingInfo.sharedHandle = handle; }
|
||||
|
||||
MemoryAllocation(uint32_t rootDeviceIndex, AllocationType allocationType, void *cpuPtrIn, uint64_t gpuAddress, uint64_t baseAddress, size_t sizeIn,
|
||||
MemoryPool::Type pool)
|
||||
: MemoryAllocation(rootDeviceIndex, 1, allocationType, cpuPtrIn, gpuAddress, baseAddress, sizeIn, pool) {}
|
||||
MemoryPool::Type pool, size_t maxOsContextCount)
|
||||
: MemoryAllocation(rootDeviceIndex, 1, allocationType, cpuPtrIn, gpuAddress, baseAddress, sizeIn, pool, maxOsContextCount) {}
|
||||
|
||||
MemoryAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *cpuPtrIn, uint64_t gpuAddress, uint64_t baseAddress, size_t sizeIn,
|
||||
MemoryPool::Type pool)
|
||||
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, cpuPtrIn, gpuAddress, baseAddress, sizeIn, pool),
|
||||
MemoryPool::Type pool, size_t maxOsContextCount)
|
||||
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, cpuPtrIn, gpuAddress, baseAddress, sizeIn, pool, maxOsContextCount),
|
||||
id(0), uncacheable(false) {}
|
||||
|
||||
MemoryAllocation(uint32_t rootDeviceIndex, AllocationType allocationType, void *cpuPtrIn, size_t sizeIn, osHandle sharedHandleIn, MemoryPool::Type pool)
|
||||
: MemoryAllocation(rootDeviceIndex, 1, allocationType, cpuPtrIn, sizeIn, sharedHandleIn, pool) {}
|
||||
MemoryAllocation(uint32_t rootDeviceIndex, AllocationType allocationType, void *cpuPtrIn, size_t sizeIn, osHandle sharedHandleIn, MemoryPool::Type pool, size_t maxOsContextCount)
|
||||
: MemoryAllocation(rootDeviceIndex, 1, allocationType, cpuPtrIn, sizeIn, sharedHandleIn, pool, maxOsContextCount) {}
|
||||
|
||||
MemoryAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *cpuPtrIn, size_t sizeIn, osHandle sharedHandleIn, MemoryPool::Type pool)
|
||||
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, cpuPtrIn, sizeIn, sharedHandleIn, pool),
|
||||
MemoryAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *cpuPtrIn, size_t sizeIn, osHandle sharedHandleIn, MemoryPool::Type pool, size_t maxOsContextCount)
|
||||
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, cpuPtrIn, sizeIn, sharedHandleIn, pool, maxOsContextCount),
|
||||
id(0), uncacheable(false) {}
|
||||
|
||||
MemoryAllocation(uint32_t rootDeviceIndex, AllocationType allocationType, void *driverAllocatedCpuPointer, void *pMem, uint64_t gpuAddress, size_t memSize,
|
||||
uint64_t count, MemoryPool::Type pool, bool uncacheable, bool flushL3Required)
|
||||
uint64_t count, MemoryPool::Type pool, bool uncacheable, bool flushL3Required, size_t maxOsContextCount)
|
||||
: MemoryAllocation(rootDeviceIndex, 1, allocationType, driverAllocatedCpuPointer, pMem, gpuAddress, memSize,
|
||||
count, pool, uncacheable, flushL3Required) {}
|
||||
count, pool, uncacheable, flushL3Required, maxOsContextCount) {}
|
||||
|
||||
MemoryAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *driverAllocatedCpuPointer, void *pMem, uint64_t gpuAddress, size_t memSize,
|
||||
uint64_t count, MemoryPool::Type pool, bool uncacheable, bool flushL3Required)
|
||||
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, pMem, gpuAddress, 0u, memSize, pool),
|
||||
uint64_t count, MemoryPool::Type pool, bool uncacheable, bool flushL3Required, size_t maxOsContextCount)
|
||||
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, pMem, gpuAddress, 0u, memSize, pool, maxOsContextCount),
|
||||
id(count), uncacheable(uncacheable) {
|
||||
|
||||
this->driverAllocatedCpuPointer = driverAllocatedCpuPointer;
|
||||
|
@ -23,7 +23,8 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryInDevicePool(
|
||||
return nullptr;
|
||||
}
|
||||
uint64_t gpuAddress = reinterpret_cast<uint64_t>(allocationData.hostPtr);
|
||||
allocation = new MemoryAllocation(allocationData.rootDeviceIndex, allocationData.type, cpuAllocation, cpuAllocation, gpuAddress, allocationData.size, counter++, MemoryPool::LocalMemory, false, false);
|
||||
allocation = new MemoryAllocation(allocationData.rootDeviceIndex, allocationData.type, cpuAllocation,
|
||||
cpuAllocation, gpuAddress, allocationData.size, counter++, MemoryPool::LocalMemory, false, false, maxOsContextCount);
|
||||
} else {
|
||||
allocation = allocateGraphicsMemory(allocationData);
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ HWTEST_F(AUBReadBuffer, reserveCanonicalGpuAddress) {
|
||||
0xFFFF800400001000,
|
||||
0xFFFF800400001000,
|
||||
sizeof(srcMemory),
|
||||
MemoryPool::MemoryNull);
|
||||
MemoryPool::MemoryNull, MemoryManager::maxOsContextCount);
|
||||
std::unique_ptr<Buffer> srcBuffer(Buffer::createBufferHw(
|
||||
&context,
|
||||
MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice()),
|
||||
|
@ -513,7 +513,8 @@ struct CreateAllocationForHostSurfaceTest : public ::testing::Test {
|
||||
TEST_F(CreateAllocationForHostSurfaceTest, givenTemporaryAllocationWhenCreateAllocationForHostSurfaceThenReuseTemporaryAllocationWhenSizeAndAddressMatch) {
|
||||
auto hostPtr = reinterpret_cast<void *>(0x1234);
|
||||
size_t size = 100;
|
||||
auto temporaryAllocation = std::make_unique<MemoryAllocation>(0, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, hostPtr, size, 0, MemoryPool::System4KBPages);
|
||||
auto temporaryAllocation = std::make_unique<MemoryAllocation>(0,
|
||||
GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, hostPtr, size, 0, MemoryPool::System4KBPages, mockMaxOsContextCount);
|
||||
auto allocationPtr = temporaryAllocation.get();
|
||||
temporaryAllocation->updateTaskCount(0u, 0u);
|
||||
commandStreamReceiver->getInternalAllocationStorage()->storeAllocation(std::move(temporaryAllocation), TEMPORARY_ALLOCATION);
|
||||
|
@ -709,12 +709,12 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, WhenGettingBindingTableStateTh
|
||||
|
||||
// setup global memory
|
||||
char globalBuffer[16];
|
||||
GraphicsAllocation gfxGlobalAlloc(0, GraphicsAllocation::AllocationType::UNKNOWN, globalBuffer, castToUint64(globalBuffer), 0llu, sizeof(globalBuffer), MemoryPool::MemoryNull);
|
||||
GraphicsAllocation gfxGlobalAlloc(0, GraphicsAllocation::AllocationType::UNKNOWN, globalBuffer, castToUint64(globalBuffer), 0llu, sizeof(globalBuffer), MemoryPool::MemoryNull, mockMaxOsContextCount);
|
||||
program.setGlobalSurface(&gfxGlobalAlloc);
|
||||
|
||||
// setup constant memory
|
||||
char constBuffer[16];
|
||||
GraphicsAllocation gfxConstAlloc(0, GraphicsAllocation::AllocationType::UNKNOWN, constBuffer, castToUint64(constBuffer), 0llu, sizeof(constBuffer), MemoryPool::MemoryNull);
|
||||
GraphicsAllocation gfxConstAlloc(0, GraphicsAllocation::AllocationType::UNKNOWN, constBuffer, castToUint64(constBuffer), 0llu, sizeof(constBuffer), MemoryPool::MemoryNull, mockMaxOsContextCount);
|
||||
program.setConstantSurface(&gfxConstAlloc);
|
||||
|
||||
// create kernel
|
||||
|
@ -411,7 +411,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenAllocationProvidedThenU
|
||||
uint64_t gpuAddr = 0x4000u;
|
||||
size_t allocSize = size;
|
||||
length.Length = static_cast<uint32_t>(allocSize - 1);
|
||||
GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull);
|
||||
GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 0u);
|
||||
allocation.setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), false));
|
||||
SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER;
|
||||
helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, true, false);
|
||||
@ -448,7 +448,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmAndAllocationCompres
|
||||
void *cpuAddr = reinterpret_cast<void *>(0x4000);
|
||||
uint64_t gpuAddr = 0x4000u;
|
||||
size_t allocSize = size;
|
||||
GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull);
|
||||
GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 0u);
|
||||
allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), false));
|
||||
allocation.getDefaultGmm()->isRenderCompressed = true;
|
||||
SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER;
|
||||
@ -480,7 +480,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmCompressionEnabledAn
|
||||
void *cpuAddr = reinterpret_cast<void *>(0x4000);
|
||||
uint64_t gpuAddr = 0x4000u;
|
||||
size_t allocSize = size;
|
||||
GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull);
|
||||
GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 1);
|
||||
allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), false));
|
||||
allocation.getDefaultGmm()->isRenderCompressed = true;
|
||||
SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER;
|
||||
@ -512,7 +512,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmCompressionDisabledA
|
||||
void *cpuAddr = reinterpret_cast<void *>(0x4000);
|
||||
uint64_t gpuAddr = 0x4000u;
|
||||
size_t allocSize = size;
|
||||
GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull);
|
||||
GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 1);
|
||||
allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), false));
|
||||
SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER;
|
||||
helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, false, false);
|
||||
@ -543,7 +543,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmAndAllocationCompres
|
||||
void *cpuAddr = reinterpret_cast<void *>(0x4000);
|
||||
uint64_t gpuAddr = 0x4000u;
|
||||
size_t allocSize = size;
|
||||
GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull);
|
||||
GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 1u);
|
||||
allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), false));
|
||||
allocation.getDefaultGmm()->isRenderCompressed = true;
|
||||
SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER;
|
||||
|
@ -944,7 +944,7 @@ TEST_F(KernelGlobalSurfaceTest, givenNDRangeKernelWhenKernelIsCreatedThenGlobalS
|
||||
|
||||
char buffer[16];
|
||||
|
||||
GraphicsAllocation gfxAlloc(0, GraphicsAllocation::AllocationType::UNKNOWN, buffer, (uint64_t)buffer - 8u, 8, MemoryPool::MemoryNull);
|
||||
GraphicsAllocation gfxAlloc(0, GraphicsAllocation::AllocationType::UNKNOWN, buffer, (uint64_t)buffer - 8u, 8, MemoryPool::MemoryNull, 0u);
|
||||
uint64_t bufferAddress = gfxAlloc.getGpuAddress();
|
||||
|
||||
// create kernel
|
||||
@ -1116,7 +1116,7 @@ TEST_F(KernelConstantSurfaceTest, givenNDRangeKernelWhenKernelIsCreatedThenConst
|
||||
|
||||
char buffer[16];
|
||||
|
||||
GraphicsAllocation gfxAlloc(0, GraphicsAllocation::AllocationType::UNKNOWN, buffer, (uint64_t)buffer - 8u, 8, MemoryPool::MemoryNull);
|
||||
GraphicsAllocation gfxAlloc(0, GraphicsAllocation::AllocationType::UNKNOWN, buffer, (uint64_t)buffer - 8u, 8, MemoryPool::MemoryNull, 0u);
|
||||
uint64_t bufferAddress = gfxAlloc.getGpuAddress();
|
||||
|
||||
// create kernel
|
||||
|
@ -12,16 +12,16 @@
|
||||
using namespace NEO;
|
||||
|
||||
TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenIsCreatedThenAllInspectionIdsAreSetToZero) {
|
||||
MockGraphicsAllocation graphicsAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0u, 0u, 0, MemoryPool::MemoryNull);
|
||||
for (auto i = 0u; i < MemoryManager::maxOsContextCount; i++) {
|
||||
MockGraphicsAllocation graphicsAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0u, 0u, 0, MemoryPool::MemoryNull, mockMaxOsContextCount);
|
||||
for (auto i = 0u; i < mockMaxOsContextCount; i++) {
|
||||
EXPECT_EQ(0u, graphicsAllocation.getInspectionId(i));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenIsCreatedThenTaskCountsAreInitializedProperly) {
|
||||
GraphicsAllocation graphicsAllocation1(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0u, 0u, 0, MemoryPool::MemoryNull);
|
||||
GraphicsAllocation graphicsAllocation2(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0u, 0u, 0, MemoryPool::MemoryNull);
|
||||
for (auto i = 0u; i < MemoryManager::maxOsContextCount; i++) {
|
||||
GraphicsAllocation graphicsAllocation1(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0u, 0u, 0, MemoryPool::MemoryNull, mockMaxOsContextCount);
|
||||
GraphicsAllocation graphicsAllocation2(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0u, 0u, 0, MemoryPool::MemoryNull, mockMaxOsContextCount);
|
||||
for (auto i = 0u; i < mockMaxOsContextCount; i++) {
|
||||
EXPECT_EQ(MockGraphicsAllocation::objectNotUsed, graphicsAllocation1.getTaskCount(i));
|
||||
EXPECT_EQ(MockGraphicsAllocation::objectNotUsed, graphicsAllocation2.getTaskCount(i));
|
||||
EXPECT_EQ(MockGraphicsAllocation::objectNotResident, graphicsAllocation1.getResidencyTaskCount(i));
|
||||
@ -39,13 +39,13 @@ TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenUpdatedTaskCountThenOnly
|
||||
MockGraphicsAllocation graphicsAllocation;
|
||||
graphicsAllocation.updateTaskCount(1u, 0u);
|
||||
EXPECT_EQ(1u, graphicsAllocation.getTaskCount(0u));
|
||||
for (auto i = 1u; i < MemoryManager::maxOsContextCount; i++) {
|
||||
for (auto i = 1u; i < mockMaxOsContextCount; i++) {
|
||||
EXPECT_EQ(MockGraphicsAllocation::objectNotUsed, graphicsAllocation.getTaskCount(i));
|
||||
}
|
||||
graphicsAllocation.updateTaskCount(2u, 1u);
|
||||
EXPECT_EQ(1u, graphicsAllocation.getTaskCount(0u));
|
||||
EXPECT_EQ(2u, graphicsAllocation.getTaskCount(1u));
|
||||
for (auto i = 2u; i < MemoryManager::maxOsContextCount; i++) {
|
||||
for (auto i = 2u; i < mockMaxOsContextCount; i++) {
|
||||
EXPECT_EQ(MockGraphicsAllocation::objectNotUsed, graphicsAllocation.getTaskCount(i));
|
||||
}
|
||||
}
|
||||
@ -173,7 +173,7 @@ TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenQueryingUsedPageSizeThen
|
||||
MemoryPool::SystemCpuInaccessible};
|
||||
|
||||
for (auto pool : page4kPools) {
|
||||
MockGraphicsAllocation graphicsAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0u, 0u, (osHandle)1, pool);
|
||||
MockGraphicsAllocation graphicsAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0u, 0u, (osHandle)1, pool, mockMaxOsContextCount);
|
||||
|
||||
EXPECT_EQ(MemoryConstants::pageSize, graphicsAllocation.getUsedPageSize());
|
||||
}
|
||||
@ -183,7 +183,7 @@ TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenQueryingUsedPageSizeThen
|
||||
MemoryPool::LocalMemory};
|
||||
|
||||
for (auto pool : page64kPools) {
|
||||
MockGraphicsAllocation graphicsAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0u, 0u, 0, pool);
|
||||
MockGraphicsAllocation graphicsAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0u, 0u, 0, pool, mockMaxOsContextCount);
|
||||
|
||||
EXPECT_EQ(MemoryConstants::pageSize64k, graphicsAllocation.getUsedPageSize());
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ TEST(GraphicsAllocationTest, GivenNonSharedResourceHandleWhenAllocationIsCreated
|
||||
void *cpuPtr = (void *)0x30000;
|
||||
size_t size = 0x1000;
|
||||
osHandle sharedHandle = Sharing::nonSharedResource;
|
||||
GraphicsAllocation gfxAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, cpuPtr, size, sharedHandle, MemoryPool::MemoryNull);
|
||||
GraphicsAllocation gfxAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, cpuPtr, size, sharedHandle, MemoryPool::MemoryNull, 0u);
|
||||
uint64_t expectedGpuAddr = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(gfxAllocation.getUnderlyingBuffer()));
|
||||
|
||||
EXPECT_EQ(expectedGpuAddr, gfxAllocation.getGpuAddress());
|
||||
@ -134,7 +134,7 @@ TEST(GraphicsAllocationTest, WhenGettingAddressesThenAddressesAreCorrect) {
|
||||
uint64_t gpuBaseAddr = 0x10000;
|
||||
size_t size = 0x1000;
|
||||
|
||||
GraphicsAllocation gfxAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, cpuPtr, gpuAddr, gpuBaseAddr, size, MemoryPool::MemoryNull);
|
||||
GraphicsAllocation gfxAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, cpuPtr, gpuAddr, gpuBaseAddr, size, MemoryPool::MemoryNull, 0u);
|
||||
|
||||
EXPECT_EQ(gpuAddr, gfxAllocation.getGpuAddress());
|
||||
|
||||
@ -151,7 +151,7 @@ TEST(GraphicsAllocationTest, WhenGettingGpuAddressToPatchThenOffsetIsCorrect) {
|
||||
uint64_t gpuBaseAddr = 0x10000;
|
||||
size_t size = 0x1000;
|
||||
|
||||
GraphicsAllocation gfxAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, cpuPtr, gpuAddr, gpuBaseAddr, size, MemoryPool::MemoryNull);
|
||||
GraphicsAllocation gfxAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, cpuPtr, gpuAddr, gpuBaseAddr, size, MemoryPool::MemoryNull, 0u);
|
||||
|
||||
EXPECT_EQ(gpuAddr - gpuBaseAddr, gfxAllocation.getGpuAddressToPatch());
|
||||
}
|
||||
@ -162,7 +162,7 @@ TEST(GraphicsAllocationTest, WhenSetSizeThenUnderlyingBufferSizeIsSet) {
|
||||
uint64_t gpuBaseAddr = 0x10000;
|
||||
size_t size = 0x2000;
|
||||
|
||||
GraphicsAllocation gfxAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, cpuPtr, gpuAddr, gpuBaseAddr, size, MemoryPool::MemoryNull);
|
||||
GraphicsAllocation gfxAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, cpuPtr, gpuAddr, gpuBaseAddr, size, MemoryPool::MemoryNull, 0u);
|
||||
EXPECT_EQ(size, gfxAllocation.getUnderlyingBufferSize());
|
||||
|
||||
size = 0x3000;
|
||||
@ -1719,7 +1719,7 @@ TEST(GraphicsAllocation, givenSharedHandleBasedConstructorWhenGraphicsAllocation
|
||||
void *addressWithTrailingBitSet = reinterpret_cast<void *>(address);
|
||||
uint64_t expectedGpuAddress = 0xf0000000;
|
||||
osHandle sharedHandle{};
|
||||
GraphicsAllocation graphicsAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, addressWithTrailingBitSet, 1u, sharedHandle, MemoryPool::MemoryNull);
|
||||
GraphicsAllocation graphicsAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, addressWithTrailingBitSet, 1u, sharedHandle, MemoryPool::MemoryNull, 0u);
|
||||
EXPECT_EQ(expectedGpuAddress, graphicsAllocation.getGpuAddress());
|
||||
}
|
||||
|
||||
@ -2133,13 +2133,13 @@ TEST(HeapSelectorTest, givenLimitedAddressSpaceWhenSelectingHeapForNullAllocatio
|
||||
|
||||
TEST(MemoryAllocationTest, givenAllocationTypeWhenPassedToMemoryAllocationConstructorThenAllocationTypeIsStored) {
|
||||
MemoryAllocation allocation{0, GraphicsAllocation::AllocationType::COMMAND_BUFFER, nullptr, nullptr, 0, 0, 0,
|
||||
MemoryPool::MemoryNull, false, false};
|
||||
MemoryPool::MemoryNull, false, false, mockMaxOsContextCount};
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::COMMAND_BUFFER, allocation.getAllocationType());
|
||||
}
|
||||
|
||||
TEST(MemoryAllocationTest, givenMemoryPoolWhenPassedToMemoryAllocationConstructorThenMemoryPoolIsStored) {
|
||||
MemoryAllocation allocation{0, GraphicsAllocation::AllocationType::COMMAND_BUFFER, nullptr, nullptr, 0, 0, 0,
|
||||
MemoryPool::System64KBPages, false, false};
|
||||
MemoryPool::System64KBPages, false, false, mockMaxOsContextCount};
|
||||
EXPECT_EQ(MemoryPool::System64KBPages, allocation.getMemoryPool());
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@ namespace NEO {
|
||||
|
||||
constexpr uint32_t mockRootDeviceIndex = 0u;
|
||||
constexpr DeviceBitfield mockDeviceBitfield(0b1);
|
||||
constexpr size_t mockMaxOsContextCount = 3u;
|
||||
|
||||
class MockGraphicsAllocation : public MemoryAllocation {
|
||||
public:
|
||||
@ -25,16 +26,16 @@ class MockGraphicsAllocation : public MemoryAllocation {
|
||||
using MemoryAllocation::usageInfos;
|
||||
|
||||
MockGraphicsAllocation()
|
||||
: MemoryAllocation(0, AllocationType::UNKNOWN, nullptr, 0u, 0, MemoryPool::MemoryNull) {}
|
||||
: MemoryAllocation(0, AllocationType::UNKNOWN, nullptr, 0u, 0, MemoryPool::MemoryNull, mockMaxOsContextCount) {}
|
||||
|
||||
MockGraphicsAllocation(void *buffer, size_t sizeIn)
|
||||
: MemoryAllocation(0, AllocationType::UNKNOWN, buffer, castToUint64(buffer), 0llu, sizeIn, MemoryPool::MemoryNull) {}
|
||||
: MemoryAllocation(0, AllocationType::UNKNOWN, buffer, castToUint64(buffer), 0llu, sizeIn, MemoryPool::MemoryNull, mockMaxOsContextCount) {}
|
||||
|
||||
MockGraphicsAllocation(void *buffer, uint64_t gpuAddr, size_t sizeIn)
|
||||
: MemoryAllocation(0, AllocationType::UNKNOWN, buffer, gpuAddr, 0llu, sizeIn, MemoryPool::MemoryNull) {}
|
||||
: MemoryAllocation(0, AllocationType::UNKNOWN, buffer, gpuAddr, 0llu, sizeIn, MemoryPool::MemoryNull, mockMaxOsContextCount) {}
|
||||
|
||||
MockGraphicsAllocation(uint32_t rootDeviceIndex, void *buffer, size_t sizeIn)
|
||||
: MemoryAllocation(rootDeviceIndex, AllocationType::UNKNOWN, buffer, castToUint64(buffer), 0llu, sizeIn, MemoryPool::MemoryNull) {}
|
||||
: MemoryAllocation(rootDeviceIndex, AllocationType::UNKNOWN, buffer, castToUint64(buffer), 0llu, sizeIn, MemoryPool::MemoryNull, mockMaxOsContextCount) {}
|
||||
|
||||
void resetInspectionIds() {
|
||||
for (auto &usageInfo : usageInfos) {
|
||||
|
@ -31,7 +31,7 @@ MockSipKernel::MockSipKernel(SipKernelType type, Program *sipProgram) : SipKerne
|
||||
MemoryConstants::pageSize * 10u,
|
||||
0u,
|
||||
MemoryConstants::pageSize,
|
||||
MemoryPool::System4KBPages);
|
||||
MemoryPool::System4KBPages, 3u);
|
||||
}
|
||||
|
||||
MockSipKernel::MockSipKernel() : SipKernel(SipKernelType::Csr, nullptr) {
|
||||
@ -42,7 +42,7 @@ MockSipKernel::MockSipKernel() : SipKernel(SipKernelType::Csr, nullptr) {
|
||||
MemoryConstants::pageSize * 10u,
|
||||
0u,
|
||||
MemoryConstants::pageSize,
|
||||
MemoryPool::System4KBPages);
|
||||
MemoryPool::System4KBPages, 3u);
|
||||
this->program = new MockProgram(this->executionEnvironment, nullptr, false, nullptr);
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ TEST_F(TagAllocatorTest, givenInputTagCountWhenCreatingAllocatorThenRequestedNum
|
||||
using MockMemoryManager::MockMemoryManager;
|
||||
GraphicsAllocation *allocateGraphicsMemoryWithAlignment(const AllocationData &allocationData) override {
|
||||
return new MemoryAllocation(0, TimestampPacketStorage::getAllocationType(), nullptr, nullptr, 0, MemoryConstants::pageSize,
|
||||
1, MemoryPool::System4KBPages, false, false);
|
||||
1, MemoryPool::System4KBPages, false, false, mockMaxOsContextCount);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,7 @@ void GraphicsAllocation::setAllocationType(AllocationType allocationType) {
|
||||
}
|
||||
|
||||
GraphicsAllocation::GraphicsAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *cpuPtrIn, uint64_t gpuAddress,
|
||||
uint64_t baseAddress, size_t sizeIn, MemoryPool::Type pool)
|
||||
uint64_t baseAddress, size_t sizeIn, MemoryPool::Type pool, size_t maxOsContextCount)
|
||||
: rootDeviceIndex(rootDeviceIndex),
|
||||
gpuBaseAddress(baseAddress),
|
||||
gpuAddress(gpuAddress),
|
||||
@ -27,19 +27,19 @@ GraphicsAllocation::GraphicsAllocation(uint32_t rootDeviceIndex, size_t numGmms,
|
||||
cpuPtr(cpuPtrIn),
|
||||
memoryPool(pool),
|
||||
allocationType(allocationType),
|
||||
usageInfos(MemoryManager::maxOsContextCount) {
|
||||
usageInfos(maxOsContextCount) {
|
||||
gmms.resize(numGmms);
|
||||
}
|
||||
|
||||
GraphicsAllocation::GraphicsAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *cpuPtrIn, size_t sizeIn,
|
||||
osHandle sharedHandleIn, MemoryPool::Type pool)
|
||||
osHandle sharedHandleIn, MemoryPool::Type pool, size_t maxOsContextCount)
|
||||
: rootDeviceIndex(rootDeviceIndex),
|
||||
gpuAddress(castToUint64(cpuPtrIn)),
|
||||
size(sizeIn),
|
||||
cpuPtr(cpuPtrIn),
|
||||
memoryPool(pool),
|
||||
allocationType(allocationType),
|
||||
usageInfos(MemoryManager::maxOsContextCount) {
|
||||
usageInfos(maxOsContextCount) {
|
||||
sharingInfo.sharedHandle = sharedHandleIn;
|
||||
gmms.resize(numGmms);
|
||||
}
|
||||
|
@ -101,18 +101,18 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
||||
GraphicsAllocation(const GraphicsAllocation &) = delete;
|
||||
|
||||
GraphicsAllocation(uint32_t rootDeviceIndex, AllocationType allocationType, void *cpuPtrIn,
|
||||
uint64_t gpuAddress, uint64_t baseAddress, size_t sizeIn, MemoryPool::Type pool)
|
||||
: GraphicsAllocation(rootDeviceIndex, 1, allocationType, cpuPtrIn, gpuAddress, baseAddress, sizeIn, pool) {}
|
||||
uint64_t gpuAddress, uint64_t baseAddress, size_t sizeIn, MemoryPool::Type pool, size_t maxOsContextCount)
|
||||
: GraphicsAllocation(rootDeviceIndex, 1, allocationType, cpuPtrIn, gpuAddress, baseAddress, sizeIn, pool, maxOsContextCount) {}
|
||||
|
||||
GraphicsAllocation(uint32_t rootDeviceIndex, AllocationType allocationType, void *cpuPtrIn,
|
||||
size_t sizeIn, osHandle sharedHandleIn, MemoryPool::Type pool)
|
||||
: GraphicsAllocation(rootDeviceIndex, 1, allocationType, cpuPtrIn, sizeIn, sharedHandleIn, pool) {}
|
||||
size_t sizeIn, osHandle sharedHandleIn, MemoryPool::Type pool, size_t maxOsContextCount)
|
||||
: GraphicsAllocation(rootDeviceIndex, 1, allocationType, cpuPtrIn, sizeIn, sharedHandleIn, pool, maxOsContextCount) {}
|
||||
|
||||
GraphicsAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *cpuPtrIn,
|
||||
uint64_t gpuAddress, uint64_t baseAddress, size_t sizeIn, MemoryPool::Type pool);
|
||||
uint64_t gpuAddress, uint64_t baseAddress, size_t sizeIn, MemoryPool::Type pool, size_t maxOsContextCount);
|
||||
|
||||
GraphicsAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *cpuPtrIn,
|
||||
size_t sizeIn, osHandle sharedHandleIn, MemoryPool::Type pool);
|
||||
size_t sizeIn, osHandle sharedHandleIn, MemoryPool::Type pool, size_t maxOsContextCount);
|
||||
|
||||
uint32_t getRootDeviceIndex() const { return rootDeviceIndex; }
|
||||
void *getUnderlyingBuffer() const { return cpuPtr; }
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||
#include "shared/source/memory_manager/memory_manager.h"
|
||||
|
||||
namespace NEO {
|
||||
class BufferObject;
|
||||
@ -24,7 +25,7 @@ class DrmAllocation : public GraphicsAllocation {
|
||||
: DrmAllocation(rootDeviceIndex, 1, allocationType, bo, ptrIn, sizeIn, sharedHandle, pool) {}
|
||||
|
||||
DrmAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, BufferObject *bo, void *ptrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool::Type pool)
|
||||
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, ptrIn, sizeIn, sharedHandle, pool),
|
||||
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, ptrIn, sizeIn, sharedHandle, pool, MemoryManager::maxOsContextCount),
|
||||
bufferObjects({{bo}}) {
|
||||
}
|
||||
|
||||
@ -32,7 +33,7 @@ class DrmAllocation : public GraphicsAllocation {
|
||||
: DrmAllocation(rootDeviceIndex, 1, allocationType, bo, ptrIn, gpuAddress, sizeIn, pool) {}
|
||||
|
||||
DrmAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, BufferObject *bo, void *ptrIn, uint64_t gpuAddress, size_t sizeIn, MemoryPool::Type pool)
|
||||
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, ptrIn, gpuAddress, 0, sizeIn, pool),
|
||||
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, ptrIn, gpuAddress, 0, sizeIn, pool, MemoryManager::maxOsContextCount),
|
||||
bufferObjects({{bo}}) {
|
||||
}
|
||||
|
||||
@ -40,7 +41,7 @@ class DrmAllocation : public GraphicsAllocation {
|
||||
: DrmAllocation(rootDeviceIndex, 1, allocationType, bos, ptrIn, gpuAddress, sizeIn, pool) {}
|
||||
|
||||
DrmAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, BufferObjects &bos, void *ptrIn, uint64_t gpuAddress, size_t sizeIn, MemoryPool::Type pool)
|
||||
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, ptrIn, gpuAddress, 0, sizeIn, pool),
|
||||
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, ptrIn, gpuAddress, 0, sizeIn, pool, MemoryManager::maxOsContextCount),
|
||||
bufferObjects(bos) {
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,8 @@ class WddmAllocation : public GraphicsAllocation {
|
||||
|
||||
WddmAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *cpuPtrIn, size_t sizeIn,
|
||||
void *reservedAddr, MemoryPool::Type pool, uint32_t shareable, size_t maxOsContextCount)
|
||||
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, cpuPtrIn, castToUint64(cpuPtrIn), 0llu, sizeIn, pool), shareable(shareable), residency(maxOsContextCount), trimCandidateListPositions(maxOsContextCount, trimListUnusedPosition) {
|
||||
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, cpuPtrIn, castToUint64(cpuPtrIn), 0llu, sizeIn, pool, maxOsContextCount),
|
||||
shareable(shareable), residency(maxOsContextCount), trimCandidateListPositions(maxOsContextCount, trimListUnusedPosition) {
|
||||
reservedAddressRangeInfo.addressPtr = reservedAddr;
|
||||
reservedAddressRangeInfo.rangeSize = sizeIn;
|
||||
handles.resize(gmms.size());
|
||||
@ -42,7 +43,8 @@ class WddmAllocation : public GraphicsAllocation {
|
||||
|
||||
WddmAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *cpuPtrIn, size_t sizeIn,
|
||||
osHandle sharedHandle, MemoryPool::Type pool, size_t maxOsContextCount)
|
||||
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, cpuPtrIn, sizeIn, sharedHandle, pool), residency(maxOsContextCount), trimCandidateListPositions(maxOsContextCount, trimListUnusedPosition) {
|
||||
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, cpuPtrIn, sizeIn, sharedHandle, pool, maxOsContextCount),
|
||||
residency(maxOsContextCount), trimCandidateListPositions(maxOsContextCount, trimListUnusedPosition) {
|
||||
handles.resize(gmms.size());
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ HWTEST_F(CommandEncodeStatesTest, givenCreatedSurfaceStateBufferWhenAllocationPr
|
||||
uint64_t gpuAddr = 0x4000u;
|
||||
size_t allocSize = size;
|
||||
length.Length = static_cast<uint32_t>(allocSize - 1);
|
||||
GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull);
|
||||
GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 1);
|
||||
EncodeSurfaceState<FamilyType>::encodeBuffer(stateBuffer, gpuAddr, allocSize, 1,
|
||||
RENDER_SURFACE_STATE::COHERENCY_TYPE_IA_COHERENT);
|
||||
EXPECT_EQ(length.SurfaceState.Depth + 1u, state->getDepth());
|
||||
|
@ -131,7 +131,7 @@ HWTEST_F(BlitTests, givenMemoryWhenFillPatternWithBlitThenCommandIsProgrammed) {
|
||||
LinearStream stream(streamBuffer, sizeof(streamBuffer));
|
||||
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
|
||||
MemoryPool::System4KBPages);
|
||||
MemoryPool::System4KBPages, mockMaxOsContextCount);
|
||||
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, pattern, sizeof(uint32_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
@ -148,7 +148,7 @@ HWTEST_F(BlitTests, givenMemorySizeBiggerThanMaxWidthButLessThanTwiceMaxWidthWhe
|
||||
LinearStream stream(streamBuffer, sizeof(streamBuffer));
|
||||
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||
reinterpret_cast<void *>(0x1234), 0x1000, 0, (2 * BlitterConstants::maxBlitWidth) - 1,
|
||||
MemoryPool::System4KBPages);
|
||||
MemoryPool::System4KBPages, mockMaxOsContextCount);
|
||||
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, pattern, sizeof(uint32_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
@ -169,7 +169,7 @@ HWTEST_F(BlitTests, givenMemorySizeTwiceBiggerThanMaxWidthWhenFillPatternWithBli
|
||||
LinearStream stream(streamBuffer, sizeof(streamBuffer));
|
||||
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||
reinterpret_cast<void *>(0x1234), 0x1000, 0, (2 * BlitterConstants::maxBlitWidth),
|
||||
MemoryPool::System4KBPages);
|
||||
MemoryPool::System4KBPages, mockMaxOsContextCount);
|
||||
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, pattern, sizeof(uint32_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
@ -192,7 +192,7 @@ HWTEST2_F(BlitTests, givenMemoryWhenFillPatternSizeIs4BytesThen32BitMaskISSetCor
|
||||
LinearStream stream(streamBuffer, sizeof(streamBuffer));
|
||||
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
|
||||
MemoryPool::System4KBPages);
|
||||
MemoryPool::System4KBPages, mockMaxOsContextCount);
|
||||
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, &pattern, sizeof(uint32_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
|
@ -16,7 +16,7 @@ struct IndirectHeapTest : public ::testing::Test {
|
||||
class MyMockGraphicsAllocation : public GraphicsAllocation {
|
||||
public:
|
||||
MyMockGraphicsAllocation(void *ptr, size_t size)
|
||||
: GraphicsAllocation(0, AllocationType::UNKNOWN, ptr, castToUint64(ptr), 0, size, MemoryPool::System4KBPages) {}
|
||||
: GraphicsAllocation(0, AllocationType::UNKNOWN, ptr, castToUint64(ptr), 0, size, MemoryPool::System4KBPages, 1) {}
|
||||
};
|
||||
|
||||
uint8_t buffer[256];
|
||||
|
@ -19,7 +19,7 @@ struct MockMultiGraphicsAllocation : public MultiGraphicsAllocation {
|
||||
TEST(MultiGraphicsAllocationTest, whenCreatingMultiGraphicsAllocationThenTheAllocationIsObtainableAsADefault) {
|
||||
GraphicsAllocation graphicsAllocation(1, // rootDeviceIndex
|
||||
GraphicsAllocation::AllocationType::BUFFER,
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages);
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages, 0);
|
||||
|
||||
MockMultiGraphicsAllocation multiGraphicsAllocation(1);
|
||||
EXPECT_EQ(2u, multiGraphicsAllocation.graphicsAllocations.size());
|
||||
@ -35,10 +35,10 @@ TEST(MultiGraphicsAllocationTest, whenCreatingMultiGraphicsAllocationThenTheAllo
|
||||
TEST(MultiGraphicsAllocationTest, givenMultiGraphicsAllocationWhenAddingMultipleGraphicsAllocationsThenTheyAreObtainableByRootDeviceIndex) {
|
||||
GraphicsAllocation graphicsAllocation0(0, // rootDeviceIndex
|
||||
GraphicsAllocation::AllocationType::BUFFER,
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages);
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages, 0);
|
||||
GraphicsAllocation graphicsAllocation1(1, // rootDeviceIndex
|
||||
GraphicsAllocation::AllocationType::BUFFER,
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages);
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages, 0);
|
||||
|
||||
MockMultiGraphicsAllocation multiGraphicsAllocation(1);
|
||||
|
||||
@ -54,7 +54,7 @@ TEST(MultiGraphicsAllocationTest, givenMultiGraphicsAllocationWhenGettingAllocat
|
||||
auto expectedAllocationType = GraphicsAllocation::AllocationType::BUFFER;
|
||||
GraphicsAllocation graphicsAllocation(1, // rootDeviceIndex
|
||||
expectedAllocationType,
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages);
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages, 0);
|
||||
|
||||
MockMultiGraphicsAllocation multiGraphicsAllocation(1);
|
||||
multiGraphicsAllocation.addAllocation(&graphicsAllocation);
|
||||
@ -67,7 +67,7 @@ TEST(MultiGraphicsAllocationTest, givenMultiGraphicsAllocationWhenGettingCoheren
|
||||
auto expectedAllocationType = GraphicsAllocation::AllocationType::BUFFER;
|
||||
GraphicsAllocation graphicsAllocation(1, // rootDeviceIndex
|
||||
expectedAllocationType,
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages);
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages, 0);
|
||||
|
||||
MockMultiGraphicsAllocation multiGraphicsAllocation(1);
|
||||
multiGraphicsAllocation.addAllocation(&graphicsAllocation);
|
||||
@ -88,7 +88,7 @@ TEST(MultiGraphicsAllocationTest, givenMultiGraphicsAllocationwhenRemovingGraphi
|
||||
uint32_t rootDeviceIndex = 1u;
|
||||
GraphicsAllocation graphicsAllocation(rootDeviceIndex,
|
||||
GraphicsAllocation::AllocationType::BUFFER,
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages);
|
||||
nullptr, 0, 0, MemoryPool::System4KBPages, 0);
|
||||
|
||||
MockMultiGraphicsAllocation multiGraphicsAllocation(rootDeviceIndex);
|
||||
EXPECT_EQ(2u, multiGraphicsAllocation.graphicsAllocations.size());
|
||||
|
Reference in New Issue
Block a user