mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
Add multiStorageResource flag to AllocationProperties
Related-To: NEO-3242 Change-Id: If31adaead389acd3bef6af1931b91396c43b305e Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
04e893d31f
commit
329d940285
@@ -368,7 +368,7 @@ AllocationsList &CommandStreamReceiver::getAllocationsForReuse() { return intern
|
|||||||
|
|
||||||
bool CommandStreamReceiver::createAllocationForHostSurface(HostPtrSurface &surface, bool requiresL3Flush) {
|
bool CommandStreamReceiver::createAllocationForHostSurface(HostPtrSurface &surface, bool requiresL3Flush) {
|
||||||
auto memoryManager = getMemoryManager();
|
auto memoryManager = getMemoryManager();
|
||||||
AllocationProperties properties{false, surface.getSurfaceSize(), GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR};
|
AllocationProperties properties{false, surface.getSurfaceSize(), GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = requiresL3Flush;
|
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = requiresL3Flush;
|
||||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, surface.getMemoryPointer());
|
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, surface.getMemoryPointer());
|
||||||
if (allocation == nullptr && surface.peekIsPtrCopyAllowed()) {
|
if (allocation == nullptr && surface.peekIsPtrCopyAllowed()) {
|
||||||
|
|||||||
@@ -90,6 +90,10 @@ void Context::overrideSpecialQueueAndDecrementRefCount(CommandQueue *commandQueu
|
|||||||
this->decRefInternal();
|
this->decRefInternal();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool Context::areMultiStorageAllocationsPreffered() {
|
||||||
|
return this->contextType != ContextType::CONTEXT_TYPE_SPECIALIZED;
|
||||||
|
}
|
||||||
|
|
||||||
bool Context::createImpl(const cl_context_properties *properties,
|
bool Context::createImpl(const cl_context_properties *properties,
|
||||||
const DeviceVector &inputDevices,
|
const DeviceVector &inputDevices,
|
||||||
void(CL_CALLBACK *funcNotify)(const char *, const void *, size_t, void *),
|
void(CL_CALLBACK *funcNotify)(const char *, const void *, size_t, void *),
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ class Context : public BaseObject<_cl_context> {
|
|||||||
|
|
||||||
bool getInteropUserSyncEnabled() { return interopUserSync; }
|
bool getInteropUserSyncEnabled() { return interopUserSync; }
|
||||||
void setInteropUserSyncEnabled(bool enabled) { interopUserSync = enabled; }
|
void setInteropUserSyncEnabled(bool enabled) { interopUserSync = enabled; }
|
||||||
|
bool areMultiStorageAllocationsPreffered();
|
||||||
|
|
||||||
ContextType peekContextType() { return this->contextType; }
|
ContextType peekContextType() { return this->contextType; }
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ bool Device::createDeviceImpl() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AllocationProperties Device::getAllocationPropertiesForPreemption() const {
|
AllocationProperties Device::getAllocationPropertiesForPreemption() const {
|
||||||
AllocationProperties properties{true, getHardwareInfo().capabilityTable.requiredPreemptionSurfaceSize, GraphicsAllocation::AllocationType::PREEMPTION};
|
AllocationProperties properties{true, getHardwareInfo().capabilityTable.requiredPreemptionSurfaceSize, GraphicsAllocation::AllocationType::PREEMPTION, false};
|
||||||
properties.flags.uncacheable = getWaTable()->waCSRUncachable;
|
properties.flags.uncacheable = getWaTable()->waCSRUncachable;
|
||||||
properties.alignment = 256 * MemoryConstants::kiloByte;
|
properties.alignment = 256 * MemoryConstants::kiloByte;
|
||||||
return properties;
|
return properties;
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ Buffer *Buffer::create(Context *context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!memory) {
|
if (!memory) {
|
||||||
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(properties, allocateMemory, size, allocationType);
|
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(properties, allocateMemory, size, allocationType, context->areMultiStorageAllocationsPreffered());
|
||||||
memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties, hostPtr);
|
memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties, hostPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +227,7 @@ Buffer *Buffer::create(Context *context,
|
|||||||
allocationType = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
|
allocationType = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
|
||||||
zeroCopyAllowed = false;
|
zeroCopyAllowed = false;
|
||||||
copyMemoryFromHostPtr = true;
|
copyMemoryFromHostPtr = true;
|
||||||
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(properties, true, size, allocationType);
|
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(properties, true, size, allocationType, context->areMultiStorageAllocationsPreffered());
|
||||||
memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties);
|
memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -264,12 +264,12 @@ Image *Image::create(Context *context,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gmm = new Gmm(imgInfo, StorageInfo{});
|
gmm = new Gmm(imgInfo, StorageInfo{});
|
||||||
memory = memoryManager->allocateGraphicsMemoryWithProperties({false, imgInfo.size, GraphicsAllocation::AllocationType::SHARED_CONTEXT_IMAGE}, hostPtr);
|
memory = memoryManager->allocateGraphicsMemoryWithProperties({false, imgInfo.size, GraphicsAllocation::AllocationType::SHARED_CONTEXT_IMAGE, false}, hostPtr);
|
||||||
memory->setDefaultGmm(gmm);
|
memory->setDefaultGmm(gmm);
|
||||||
zeroCopy = true;
|
zeroCopy = true;
|
||||||
}
|
}
|
||||||
if (memory) {
|
if (memory) {
|
||||||
AllocationProperties properties{false, hostPtrMinSize, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR};
|
AllocationProperties properties{false, hostPtrMinSize, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = true;
|
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = true;
|
||||||
mapAllocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
mapAllocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ void *MemObj::getBasePtrForMap() {
|
|||||||
} else {
|
} else {
|
||||||
auto memory = memoryManager->allocateSystemMemory(getSize(), MemoryConstants::pageSize);
|
auto memory = memoryManager->allocateSystemMemory(getSize(), MemoryConstants::pageSize);
|
||||||
setAllocatedMapPtr(memory);
|
setAllocatedMapPtr(memory);
|
||||||
AllocationProperties properties{false, getSize(), GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR};
|
AllocationProperties properties{false, getSize(), GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, memory);
|
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, memory);
|
||||||
setMapAllocation(allocation);
|
setMapAllocation(allocation);
|
||||||
return getAllocatedMapPtr();
|
return getAllocatedMapPtr();
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ class MemObjHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static AllocationProperties getAllocationProperties(MemoryProperties memoryProperties, bool allocateMemory,
|
static AllocationProperties getAllocationProperties(MemoryProperties memoryProperties, bool allocateMemory,
|
||||||
size_t size, GraphicsAllocation::AllocationType type) {
|
size_t size, GraphicsAllocation::AllocationType type, bool multiStorageResource) {
|
||||||
AllocationProperties allocationProperties(allocateMemory, size, type);
|
AllocationProperties allocationProperties(allocateMemory, size, type, multiStorageResource);
|
||||||
fillPoliciesInProperties(allocationProperties, memoryProperties);
|
fillPoliciesInProperties(allocationProperties, memoryProperties);
|
||||||
return allocationProperties;
|
return allocationProperties;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ Pipe *Pipe::create(Context *context,
|
|||||||
while (true) {
|
while (true) {
|
||||||
auto size = static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace);
|
auto size = static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace);
|
||||||
AllocationProperties allocProperties =
|
AllocationProperties allocProperties =
|
||||||
MemObjHelper::getAllocationProperties(memoryProperties, true, size, GraphicsAllocation::AllocationType::PIPE);
|
MemObjHelper::getAllocationProperties(memoryProperties, true, size, GraphicsAllocation::AllocationType::PIPE, false);
|
||||||
GraphicsAllocation *memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties);
|
GraphicsAllocation *memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties);
|
||||||
if (!memory) {
|
if (!memory) {
|
||||||
errcodeRet = CL_OUT_OF_HOST_MEMORY;
|
errcodeRet = CL_OUT_OF_HOST_MEMORY;
|
||||||
|
|||||||
@@ -30,22 +30,26 @@ struct AllocationProperties {
|
|||||||
GraphicsAllocation::AllocationType allocationType = GraphicsAllocation::AllocationType::UNKNOWN;
|
GraphicsAllocation::AllocationType allocationType = GraphicsAllocation::AllocationType::UNKNOWN;
|
||||||
ImageInfo *imgInfo = nullptr;
|
ImageInfo *imgInfo = nullptr;
|
||||||
uint32_t deviceIndex = AllocationProperties::noDeviceSpecified;
|
uint32_t deviceIndex = AllocationProperties::noDeviceSpecified;
|
||||||
|
bool multiStorageResource = false;
|
||||||
|
|
||||||
AllocationProperties(size_t size,
|
AllocationProperties(size_t size,
|
||||||
GraphicsAllocation::AllocationType allocationType)
|
GraphicsAllocation::AllocationType allocationType)
|
||||||
: AllocationProperties(true, size, allocationType) {}
|
: AllocationProperties(true, size, allocationType, false) {}
|
||||||
|
|
||||||
AllocationProperties(bool allocateMemory,
|
AllocationProperties(bool allocateMemory,
|
||||||
ImageInfo &imgInfo,
|
ImageInfo &imgInfo,
|
||||||
GraphicsAllocation::AllocationType allocationType)
|
GraphicsAllocation::AllocationType allocationType)
|
||||||
: AllocationProperties(allocateMemory, 0u, allocationType) {
|
: AllocationProperties(allocateMemory, 0u, allocationType, false) {
|
||||||
this->imgInfo = &imgInfo;
|
this->imgInfo = &imgInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
AllocationProperties(bool allocateMemory,
|
AllocationProperties(bool allocateMemory,
|
||||||
size_t size,
|
size_t size,
|
||||||
GraphicsAllocation::AllocationType allocationType)
|
GraphicsAllocation::AllocationType allocationType,
|
||||||
: AllocationProperties(allocateMemory, size, allocationType, false, AllocationProperties::noDeviceSpecified) {}
|
bool isMultiStorageAllocation)
|
||||||
|
: AllocationProperties(allocateMemory, size, allocationType, false, AllocationProperties::noDeviceSpecified) {
|
||||||
|
this->multiStorageResource = isMultiStorageAllocation;
|
||||||
|
}
|
||||||
|
|
||||||
AllocationProperties(bool allocateMemory,
|
AllocationProperties(bool allocateMemory,
|
||||||
size_t size,
|
size_t size,
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ void *SVMAllocsManager::createSVMAlloc(size_t size, const SvmAllocationPropertie
|
|||||||
|
|
||||||
void *SVMAllocsManager::createUnifiedMemoryAllocation(size_t size, const UnifiedMemoryProperties svmProperties) {
|
void *SVMAllocsManager::createUnifiedMemoryAllocation(size_t size, const UnifiedMemoryProperties svmProperties) {
|
||||||
size_t alignedSize = alignUp<size_t>(size, MemoryConstants::pageSize64k);
|
size_t alignedSize = alignUp<size_t>(size, MemoryConstants::pageSize64k);
|
||||||
AllocationProperties unifiedMemoryProperties{true, alignedSize, GraphicsAllocation::AllocationType::BUFFER};
|
AllocationProperties unifiedMemoryProperties{true, alignedSize, GraphicsAllocation::AllocationType::BUFFER, false};
|
||||||
GraphicsAllocation *unifiedMemoryAllocation = memoryManager->allocateGraphicsMemoryWithProperties(unifiedMemoryProperties);
|
GraphicsAllocation *unifiedMemoryAllocation = memoryManager->allocateGraphicsMemoryWithProperties(unifiedMemoryProperties);
|
||||||
|
|
||||||
SvmAllocationData allocData;
|
SvmAllocationData allocData;
|
||||||
@@ -126,7 +126,7 @@ void SVMAllocsManager::freeSVMAlloc(void *ptr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void *SVMAllocsManager::createZeroCopySvmAllocation(size_t size, const SvmAllocationProperties &svmProperties) {
|
void *SVMAllocsManager::createZeroCopySvmAllocation(size_t size, const SvmAllocationProperties &svmProperties) {
|
||||||
AllocationProperties properties{true, size, GraphicsAllocation::AllocationType::SVM_ZERO_COPY};
|
AllocationProperties properties{true, size, GraphicsAllocation::AllocationType::SVM_ZERO_COPY, false};
|
||||||
MemObjHelper::fillCachePolicyInProperties(properties, false, svmProperties.readOnly, false);
|
MemObjHelper::fillCachePolicyInProperties(properties, false, svmProperties.readOnly, false);
|
||||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
|
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
|
||||||
if (!allocation) {
|
if (!allocation) {
|
||||||
@@ -145,7 +145,7 @@ void *SVMAllocsManager::createZeroCopySvmAllocation(size_t size, const SvmAlloca
|
|||||||
|
|
||||||
void *SVMAllocsManager::createSvmAllocationWithDeviceStorage(size_t size, const SvmAllocationProperties &svmProperties) {
|
void *SVMAllocsManager::createSvmAllocationWithDeviceStorage(size_t size, const SvmAllocationProperties &svmProperties) {
|
||||||
size_t alignedSize = alignUp<size_t>(size, 2 * MemoryConstants::megaByte);
|
size_t alignedSize = alignUp<size_t>(size, 2 * MemoryConstants::megaByte);
|
||||||
AllocationProperties cpuProperties{true, alignedSize, GraphicsAllocation::AllocationType::SVM_CPU};
|
AllocationProperties cpuProperties{true, alignedSize, GraphicsAllocation::AllocationType::SVM_CPU, false};
|
||||||
cpuProperties.alignment = 2 * MemoryConstants::megaByte;
|
cpuProperties.alignment = 2 * MemoryConstants::megaByte;
|
||||||
MemObjHelper::fillCachePolicyInProperties(cpuProperties, false, svmProperties.readOnly, false);
|
MemObjHelper::fillCachePolicyInProperties(cpuProperties, false, svmProperties.readOnly, false);
|
||||||
GraphicsAllocation *allocationCpu = memoryManager->allocateGraphicsMemoryWithProperties(cpuProperties);
|
GraphicsAllocation *allocationCpu = memoryManager->allocateGraphicsMemoryWithProperties(cpuProperties);
|
||||||
@@ -156,7 +156,7 @@ void *SVMAllocsManager::createSvmAllocationWithDeviceStorage(size_t size, const
|
|||||||
allocationCpu->setCoherent(svmProperties.coherent);
|
allocationCpu->setCoherent(svmProperties.coherent);
|
||||||
void *svmPtr = allocationCpu->getUnderlyingBuffer();
|
void *svmPtr = allocationCpu->getUnderlyingBuffer();
|
||||||
|
|
||||||
AllocationProperties gpuProperties{false, alignedSize, GraphicsAllocation::AllocationType::SVM_GPU};
|
AllocationProperties gpuProperties{false, alignedSize, GraphicsAllocation::AllocationType::SVM_GPU, false};
|
||||||
gpuProperties.alignment = 2 * MemoryConstants::megaByte;
|
gpuProperties.alignment = 2 * MemoryConstants::megaByte;
|
||||||
MemObjHelper::fillCachePolicyInProperties(gpuProperties, false, svmProperties.readOnly, false);
|
MemObjHelper::fillCachePolicyInProperties(gpuProperties, false, svmProperties.readOnly, false);
|
||||||
GraphicsAllocation *allocationGpu = memoryManager->allocateGraphicsMemoryWithProperties(gpuProperties, svmPtr);
|
GraphicsAllocation *allocationGpu = memoryManager->allocateGraphicsMemoryWithProperties(gpuProperties, svmPtr);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class D3DBuffer : public D3DSharing<D3D> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sharingFcns->getSharedHandle(bufferStaging, &sharedHandle);
|
sharingFcns->getSharedHandle(bufferStaging, &sharedHandle);
|
||||||
AllocationProperties properties = {false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER};
|
AllocationProperties properties = {false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false};
|
||||||
auto alloc = context->getMemoryManager()->createGraphicsAllocationFromSharedHandle((osHandle)((UINT_PTR)sharedHandle), properties, true);
|
auto alloc = context->getMemoryManager()->createGraphicsAllocationFromSharedHandle((osHandle)((UINT_PTR)sharedHandle), properties, true);
|
||||||
|
|
||||||
auto d3dBufferObj = new D3DBuffer<D3D>(context, d3dBuffer, bufferStaging, sharedResource);
|
auto d3dBufferObj = new D3DBuffer<D3D>(context, d3dBuffer, bufferStaging, sharedResource);
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo
|
|||||||
GraphicsAllocation *alloc = nullptr;
|
GraphicsAllocation *alloc = nullptr;
|
||||||
if (surfaceInfo->shared_handle) {
|
if (surfaceInfo->shared_handle) {
|
||||||
isSharedResource = true;
|
isSharedResource = true;
|
||||||
AllocationProperties allocProperties(false, 0u, GraphicsAllocation::AllocationType::SHARED_IMAGE);
|
AllocationProperties allocProperties(false, 0u, GraphicsAllocation::AllocationType::SHARED_IMAGE, false);
|
||||||
alloc = context->getMemoryManager()->createGraphicsAllocationFromSharedHandle((osHandle)((UINT_PTR)surfaceInfo->shared_handle), allocProperties,
|
alloc = context->getMemoryManager()->createGraphicsAllocationFromSharedHandle((osHandle)((UINT_PTR)surfaceInfo->shared_handle), allocProperties,
|
||||||
false);
|
false);
|
||||||
updateImgInfo(alloc->getDefaultGmm(), imgInfo, imgDesc, oclPlane, 0u);
|
updateImgInfo(alloc->getDefaultGmm(), imgInfo, imgDesc, oclPlane, 0u);
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ Image *D3DTexture<D3D>::create2d(Context *context, D3DTexture2d *d3dTexture, cl_
|
|||||||
alloc = context->getMemoryManager()->createGraphicsAllocationFromNTHandle(sharedHandle);
|
alloc = context->getMemoryManager()->createGraphicsAllocationFromNTHandle(sharedHandle);
|
||||||
} else {
|
} else {
|
||||||
sharingFcns->getSharedHandle(textureStaging, &sharedHandle);
|
sharingFcns->getSharedHandle(textureStaging, &sharedHandle);
|
||||||
AllocationProperties allocProperties(nullptr, false, GraphicsAllocation::AllocationType::SHARED_IMAGE);
|
AllocationProperties allocProperties(nullptr, false, GraphicsAllocation::AllocationType::SHARED_IMAGE, false);
|
||||||
alloc = context->getMemoryManager()->createGraphicsAllocationFromSharedHandle((osHandle)((UINT_PTR)sharedHandle), allocProperties, false);
|
alloc = context->getMemoryManager()->createGraphicsAllocationFromSharedHandle((osHandle)((UINT_PTR)sharedHandle), allocProperties, false);
|
||||||
}
|
}
|
||||||
DEBUG_BREAK_IF(!alloc);
|
DEBUG_BREAK_IF(!alloc);
|
||||||
@@ -126,7 +126,7 @@ Image *D3DTexture<D3D>::create3d(Context *context, D3DTexture3d *d3dTexture, cl_
|
|||||||
alloc = context->getMemoryManager()->createGraphicsAllocationFromNTHandle(sharedHandle);
|
alloc = context->getMemoryManager()->createGraphicsAllocationFromNTHandle(sharedHandle);
|
||||||
} else {
|
} else {
|
||||||
sharingFcns->getSharedHandle(textureStaging, &sharedHandle);
|
sharingFcns->getSharedHandle(textureStaging, &sharedHandle);
|
||||||
AllocationProperties allocProperties(nullptr, false, GraphicsAllocation::AllocationType::SHARED_IMAGE);
|
AllocationProperties allocProperties(nullptr, false, GraphicsAllocation::AllocationType::SHARED_IMAGE, false);
|
||||||
alloc = context->getMemoryManager()->createGraphicsAllocationFromSharedHandle((osHandle)((UINT_PTR)sharedHandle), allocProperties, false);
|
alloc = context->getMemoryManager()->createGraphicsAllocationFromSharedHandle((osHandle)((UINT_PTR)sharedHandle), allocProperties, false);
|
||||||
}
|
}
|
||||||
DEBUG_BREAK_IF(!alloc);
|
DEBUG_BREAK_IF(!alloc);
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ GraphicsAllocation *GlBuffer::createGraphicsAllocation(Context *context, unsigne
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!graphicsAllocation) {
|
if (!graphicsAllocation) {
|
||||||
AllocationProperties properties = {false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER};
|
AllocationProperties properties = {false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false};
|
||||||
// couldn't find allocation for reuse - create new
|
// couldn't find allocation for reuse - create new
|
||||||
graphicsAllocation =
|
graphicsAllocation =
|
||||||
context->getMemoryManager()->createGraphicsAllocationFromSharedHandle(bufferInfo.globalShareHandle, properties, true);
|
context->getMemoryManager()->createGraphicsAllocationFromSharedHandle(bufferInfo.globalShareHandle, properties, true);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl
|
|||||||
|
|
||||||
errorCode.set(CL_SUCCESS);
|
errorCode.set(CL_SUCCESS);
|
||||||
|
|
||||||
AllocationProperties allocProperties(false, 0u, GraphicsAllocation::AllocationType::SHARED_IMAGE);
|
AllocationProperties allocProperties(false, 0u, GraphicsAllocation::AllocationType::SHARED_IMAGE, false);
|
||||||
auto alloc = memoryManager->createGraphicsAllocationFromSharedHandle(texInfo.globalShareHandle, allocProperties, false);
|
auto alloc = memoryManager->createGraphicsAllocationFromSharedHandle(texInfo.globalShareHandle, allocProperties, false);
|
||||||
|
|
||||||
if (alloc == nullptr) {
|
if (alloc == nullptr) {
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ HWTEST_F(EnqueueKernelTest, givenReducedAddressSpaceGraphicsAllocationForHostPtr
|
|||||||
auto memoryManager = mockCsr->getMemoryManager();
|
auto memoryManager = mockCsr->getMemoryManager();
|
||||||
uint32_t hostPtr[10]{};
|
uint32_t hostPtr[10]{};
|
||||||
|
|
||||||
AllocationProperties properties{false, 1, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR};
|
AllocationProperties properties{false, 1, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = true;
|
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = true;
|
||||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
||||||
MockKernelWithInternals mockKernel(*device, context);
|
MockKernelWithInternals mockKernel(*device, context);
|
||||||
@@ -400,7 +400,7 @@ HWTEST_F(EnqueueKernelTest, givenReducedAddressSpaceGraphicsAllocationForHostPtr
|
|||||||
auto memoryManager = mockCsr->getMemoryManager();
|
auto memoryManager = mockCsr->getMemoryManager();
|
||||||
uint32_t hostPtr[10]{};
|
uint32_t hostPtr[10]{};
|
||||||
|
|
||||||
AllocationProperties properties{false, 1, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR};
|
AllocationProperties properties{false, 1, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = false;
|
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = false;
|
||||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
||||||
MockKernelWithInternals mockKernel(*device, context);
|
MockKernelWithInternals mockKernel(*device, context);
|
||||||
@@ -425,7 +425,7 @@ HWTEST_F(EnqueueKernelTest, givenFullAddressSpaceGraphicsAllocationWhenEnqueueKe
|
|||||||
auto memoryManager = mockCsr->getMemoryManager();
|
auto memoryManager = mockCsr->getMemoryManager();
|
||||||
uint32_t hostPtr[10]{};
|
uint32_t hostPtr[10]{};
|
||||||
|
|
||||||
AllocationProperties properties{false, 1, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR};
|
AllocationProperties properties{false, 1, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = false;
|
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = false;
|
||||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
||||||
MockKernelWithInternals mockKernel(*device, context);
|
MockKernelWithInternals mockKernel(*device, context);
|
||||||
|
|||||||
@@ -361,3 +361,14 @@ TEST(DefaultContext, givenDefaultContextWhenItIsQueriedForTypeThenDefaultTypeIsR
|
|||||||
MockContext context;
|
MockContext context;
|
||||||
EXPECT_EQ(ContextType::CONTEXT_TYPE_DEFAULT, context.peekContextType());
|
EXPECT_EQ(ContextType::CONTEXT_TYPE_DEFAULT, context.peekContextType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Context, givenContextWhenCheckIfAllocationsAreMultiStorageThenReturnProperValueAccordingToContextType) {
|
||||||
|
MockContext context;
|
||||||
|
EXPECT_TRUE(context.areMultiStorageAllocationsPreffered());
|
||||||
|
|
||||||
|
context.setContextType(ContextType::CONTEXT_TYPE_SPECIALIZED);
|
||||||
|
EXPECT_FALSE(context.areMultiStorageAllocationsPreffered());
|
||||||
|
|
||||||
|
context.setContextType(ContextType::CONTEXT_TYPE_UNRESTRICTIVE);
|
||||||
|
EXPECT_TRUE(context.areMultiStorageAllocationsPreffered());
|
||||||
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class D3D9Tests : public PlatformFixture, public ::testing::Test {
|
|||||||
}
|
}
|
||||||
GraphicsAllocation *allocateGraphicsMemoryForImage(const AllocationData &allocationData) override {
|
GraphicsAllocation *allocateGraphicsMemoryForImage(const AllocationData &allocationData) override {
|
||||||
auto gmm = std::make_unique<Gmm>(*allocationData.imgInfo, StorageInfo{});
|
auto gmm = std::make_unique<Gmm>(*allocationData.imgInfo, StorageInfo{});
|
||||||
AllocationProperties properties(nullptr, false, GraphicsAllocation::AllocationType::SHARED_IMAGE);
|
AllocationProperties properties(nullptr, false, GraphicsAllocation::AllocationType::SHARED_IMAGE, false);
|
||||||
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(1, properties, false);
|
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(1, properties, false);
|
||||||
alloc->setDefaultGmm(forceGmm);
|
alloc->setDefaultGmm(forceGmm);
|
||||||
gmmOwnershipPassed = true;
|
gmmOwnershipPassed = true;
|
||||||
|
|||||||
@@ -47,31 +47,31 @@ TEST(MemoryManagerTest, givenAllowed32BitAndFroce32BitWhenGraphicsAllocationInDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(AllocationFlagsTest, givenAllocateMemoryFlagWhenGetAllocationFlagsIsCalledThenAllocateFlagIsCorrectlySet) {
|
TEST(AllocationFlagsTest, givenAllocateMemoryFlagWhenGetAllocationFlagsIsCalledThenAllocateFlagIsCorrectlySet) {
|
||||||
auto allocationProperties = MemObjHelper::getAllocationProperties({}, true, 0, GraphicsAllocation::AllocationType::BUFFER);
|
auto allocationProperties = MemObjHelper::getAllocationProperties({}, true, 0, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||||
EXPECT_TRUE(allocationProperties.flags.allocateMemory);
|
EXPECT_TRUE(allocationProperties.flags.allocateMemory);
|
||||||
|
|
||||||
allocationProperties = MemObjHelper::getAllocationProperties({}, false, 0, GraphicsAllocation::AllocationType::BUFFER);
|
allocationProperties = MemObjHelper::getAllocationProperties({}, false, 0, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||||
EXPECT_FALSE(allocationProperties.flags.allocateMemory);
|
EXPECT_FALSE(allocationProperties.flags.allocateMemory);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(UncacheableFlagsTest, givenUncachedResourceFlagWhenGetAllocationFlagsIsCalledThenUncacheableFlagIsCorrectlySet) {
|
TEST(UncacheableFlagsTest, givenUncachedResourceFlagWhenGetAllocationFlagsIsCalledThenUncacheableFlagIsCorrectlySet) {
|
||||||
MemoryProperties memoryProperties;
|
MemoryProperties memoryProperties;
|
||||||
memoryProperties.flags_intel = CL_MEM_LOCALLY_UNCACHED_RESOURCE;
|
memoryProperties.flags_intel = CL_MEM_LOCALLY_UNCACHED_RESOURCE;
|
||||||
auto allocationFlags = MemObjHelper::getAllocationProperties(memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER);
|
auto allocationFlags = MemObjHelper::getAllocationProperties(memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||||
EXPECT_TRUE(allocationFlags.flags.uncacheable);
|
EXPECT_TRUE(allocationFlags.flags.uncacheable);
|
||||||
|
|
||||||
memoryProperties.flags_intel = 0;
|
memoryProperties.flags_intel = 0;
|
||||||
allocationFlags = MemObjHelper::getAllocationProperties(memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER);
|
allocationFlags = MemObjHelper::getAllocationProperties(memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||||
EXPECT_FALSE(allocationFlags.flags.uncacheable);
|
EXPECT_FALSE(allocationFlags.flags.uncacheable);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(AllocationFlagsTest, givenReadOnlyResourceFlagWhenGetAllocationFlagsIsCalledThenFlushL3FlagsAreCorrectlySet) {
|
TEST(AllocationFlagsTest, givenReadOnlyResourceFlagWhenGetAllocationFlagsIsCalledThenFlushL3FlagsAreCorrectlySet) {
|
||||||
auto allocationFlags =
|
auto allocationFlags =
|
||||||
MemObjHelper::getAllocationProperties(CL_MEM_READ_ONLY, true, 0, GraphicsAllocation::AllocationType::BUFFER);
|
MemObjHelper::getAllocationProperties(CL_MEM_READ_ONLY, true, 0, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||||
EXPECT_FALSE(allocationFlags.flags.flushL3RequiredForRead);
|
EXPECT_FALSE(allocationFlags.flags.flushL3RequiredForRead);
|
||||||
EXPECT_FALSE(allocationFlags.flags.flushL3RequiredForWrite);
|
EXPECT_FALSE(allocationFlags.flags.flushL3RequiredForWrite);
|
||||||
|
|
||||||
allocationFlags = MemObjHelper::getAllocationProperties(0, true, 0, GraphicsAllocation::AllocationType::BUFFER);
|
allocationFlags = MemObjHelper::getAllocationProperties(0, true, 0, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||||
EXPECT_TRUE(allocationFlags.flags.flushL3RequiredForRead);
|
EXPECT_TRUE(allocationFlags.flags.flushL3RequiredForRead);
|
||||||
EXPECT_TRUE(allocationFlags.flags.flushL3RequiredForWrite);
|
EXPECT_TRUE(allocationFlags.flags.flushL3RequiredForWrite);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class MemoryManagerGetAlloctionDataTest : public testing::TestWithParam<Graphics
|
|||||||
|
|
||||||
TEST(MemoryManagerGetAlloctionDataTest, givenHostMemoryAllocationTypeAndAllocateMemoryFlagAndNullptrWhenAllocationDataIsQueriedThenCorrectFlagsAndSizeAreSet) {
|
TEST(MemoryManagerGetAlloctionDataTest, givenHostMemoryAllocationTypeAndAllocateMemoryFlagAndNullptrWhenAllocationDataIsQueriedThenCorrectFlagsAndSizeAreSet) {
|
||||||
AllocationData allocData;
|
AllocationData allocData;
|
||||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false);
|
||||||
MockMemoryManager mockMemoryManager;
|
MockMemoryManager mockMemoryManager;
|
||||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ TEST(MemoryManagerGetAlloctionDataTest, givenHostMemoryAllocationTypeAndAllocate
|
|||||||
|
|
||||||
TEST(MemoryManagerGetAlloctionDataTest, givenNonHostMemoryAllocatoinTypeWhenAllocationDataIsQueriedThenUseSystemMemoryFlagsIsNotSet) {
|
TEST(MemoryManagerGetAlloctionDataTest, givenNonHostMemoryAllocatoinTypeWhenAllocationDataIsQueriedThenUseSystemMemoryFlagsIsNotSet) {
|
||||||
AllocationData allocData;
|
AllocationData allocData;
|
||||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER);
|
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||||
|
|
||||||
MockMemoryManager mockMemoryManager;
|
MockMemoryManager mockMemoryManager;
|
||||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||||
@@ -47,7 +47,7 @@ TEST(MemoryManagerGetAlloctionDataTest, givenNonHostMemoryAllocatoinTypeWhenAllo
|
|||||||
TEST(MemoryManagerGetAlloctionDataTest, givenAllocateMemoryFlagTrueWhenHostPtrIsNotNullThenAllocationDataHasHostPtrNulled) {
|
TEST(MemoryManagerGetAlloctionDataTest, givenAllocateMemoryFlagTrueWhenHostPtrIsNotNullThenAllocationDataHasHostPtrNulled) {
|
||||||
AllocationData allocData;
|
AllocationData allocData;
|
||||||
char memory = 0;
|
char memory = 0;
|
||||||
AllocationProperties properties(true, sizeof(memory), GraphicsAllocation::AllocationType::BUFFER);
|
AllocationProperties properties(true, sizeof(memory), GraphicsAllocation::AllocationType::BUFFER, false);
|
||||||
|
|
||||||
MockMemoryManager mockMemoryManager;
|
MockMemoryManager mockMemoryManager;
|
||||||
MockMemoryManager::getAllocationData(allocData, properties, &memory, mockMemoryManager.createStorageInfoFromProperties(properties));
|
MockMemoryManager::getAllocationData(allocData, properties, &memory, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||||
@@ -58,7 +58,7 @@ TEST(MemoryManagerGetAlloctionDataTest, givenAllocateMemoryFlagTrueWhenHostPtrIs
|
|||||||
|
|
||||||
TEST(MemoryManagerGetAlloctionDataTest, givenBufferTypeWhenAllocationDataIsQueriedThenForcePinFlagIsSet) {
|
TEST(MemoryManagerGetAlloctionDataTest, givenBufferTypeWhenAllocationDataIsQueriedThenForcePinFlagIsSet) {
|
||||||
AllocationData allocData;
|
AllocationData allocData;
|
||||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER);
|
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||||
|
|
||||||
MockMemoryManager mockMemoryManager;
|
MockMemoryManager mockMemoryManager;
|
||||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||||
@@ -68,7 +68,7 @@ TEST(MemoryManagerGetAlloctionDataTest, givenBufferTypeWhenAllocationDataIsQueri
|
|||||||
|
|
||||||
TEST(MemoryManagerGetAlloctionDataTest, givenBufferHostMemoryTypeWhenAllocationDataIsQueriedThenForcePinFlagIsSet) {
|
TEST(MemoryManagerGetAlloctionDataTest, givenBufferHostMemoryTypeWhenAllocationDataIsQueriedThenForcePinFlagIsSet) {
|
||||||
AllocationData allocData;
|
AllocationData allocData;
|
||||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false);
|
||||||
|
|
||||||
MockMemoryManager mockMemoryManager;
|
MockMemoryManager mockMemoryManager;
|
||||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||||
@@ -78,7 +78,7 @@ TEST(MemoryManagerGetAlloctionDataTest, givenBufferHostMemoryTypeWhenAllocationD
|
|||||||
|
|
||||||
TEST(MemoryManagerGetAlloctionDataTest, givenBufferCompressedTypeWhenAllocationDataIsQueriedThenForcePinFlagIsSet) {
|
TEST(MemoryManagerGetAlloctionDataTest, givenBufferCompressedTypeWhenAllocationDataIsQueriedThenForcePinFlagIsSet) {
|
||||||
AllocationData allocData;
|
AllocationData allocData;
|
||||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
|
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, false);
|
||||||
|
|
||||||
MockMemoryManager mockMemoryManager;
|
MockMemoryManager mockMemoryManager;
|
||||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||||
@@ -88,7 +88,7 @@ TEST(MemoryManagerGetAlloctionDataTest, givenBufferCompressedTypeWhenAllocationD
|
|||||||
|
|
||||||
TEST(MemoryManagerGetAlloctionDataTest, givenDefaultAllocationFlagsWhenAllocationDataIsQueriedThenAllocateMemoryIsFalse) {
|
TEST(MemoryManagerGetAlloctionDataTest, givenDefaultAllocationFlagsWhenAllocationDataIsQueriedThenAllocateMemoryIsFalse) {
|
||||||
AllocationData allocData;
|
AllocationData allocData;
|
||||||
AllocationProperties properties(false, 0, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
|
AllocationProperties properties(false, 0, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, false);
|
||||||
char memory;
|
char memory;
|
||||||
MockMemoryManager mockMemoryManager;
|
MockMemoryManager mockMemoryManager;
|
||||||
MockMemoryManager::getAllocationData(allocData, properties, &memory, mockMemoryManager.createStorageInfoFromProperties(properties));
|
MockMemoryManager::getAllocationData(allocData, properties, &memory, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||||
@@ -101,7 +101,7 @@ typedef MemoryManagerGetAlloctionDataTest MemoryManagerGetAlloctionData32BitAnd6
|
|||||||
TEST_P(MemoryManagerGetAlloctionData32BitAnd64kbPagesAllowedTest, givenAllocationTypesWith32BitAnd64kbPagesAllowedWhenAllocationDataIsQueriedThenProperFlagsAreSet) {
|
TEST_P(MemoryManagerGetAlloctionData32BitAnd64kbPagesAllowedTest, givenAllocationTypesWith32BitAnd64kbPagesAllowedWhenAllocationDataIsQueriedThenProperFlagsAreSet) {
|
||||||
AllocationData allocData;
|
AllocationData allocData;
|
||||||
auto allocType = GetParam();
|
auto allocType = GetParam();
|
||||||
AllocationProperties properties(true, 0, allocType);
|
AllocationProperties properties(true, 0, allocType, false);
|
||||||
|
|
||||||
MockMemoryManager mockMemoryManager;
|
MockMemoryManager mockMemoryManager;
|
||||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||||
@@ -114,7 +114,7 @@ TEST_P(MemoryManagerGetAlloctionData32BitAnd64kbPagesAllowedTest, givenAllocatio
|
|||||||
TEST_P(MemoryManagerGetAlloctionData32BitAnd64kbPagesAllowedTest, given64kbAllowedAllocationTypeWhenAllocatingThenPreferRenderCompressionOnlyForSpecificTypes) {
|
TEST_P(MemoryManagerGetAlloctionData32BitAnd64kbPagesAllowedTest, given64kbAllowedAllocationTypeWhenAllocatingThenPreferRenderCompressionOnlyForSpecificTypes) {
|
||||||
auto allocType = GetParam();
|
auto allocType = GetParam();
|
||||||
AllocationData allocData;
|
AllocationData allocData;
|
||||||
AllocationProperties properties(true, 10, allocType);
|
AllocationProperties properties(true, 10, allocType, false);
|
||||||
|
|
||||||
MockMemoryManager mockMemoryManager(true, false);
|
MockMemoryManager mockMemoryManager(true, false);
|
||||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||||
@@ -133,7 +133,7 @@ typedef MemoryManagerGetAlloctionDataTest MemoryManagerGetAlloctionData32BitAnd6
|
|||||||
TEST_P(MemoryManagerGetAlloctionData32BitAnd64kbPagesNotAllowedTest, givenAllocationTypesWith32BitAnd64kbPagesDisallowedWhenAllocationDataIsQueriedThenFlagsAreNotSet) {
|
TEST_P(MemoryManagerGetAlloctionData32BitAnd64kbPagesNotAllowedTest, givenAllocationTypesWith32BitAnd64kbPagesDisallowedWhenAllocationDataIsQueriedThenFlagsAreNotSet) {
|
||||||
AllocationData allocData;
|
AllocationData allocData;
|
||||||
auto allocType = GetParam();
|
auto allocType = GetParam();
|
||||||
AllocationProperties properties(true, 0, allocType);
|
AllocationProperties properties(true, 0, allocType, false);
|
||||||
|
|
||||||
MockMemoryManager mockMemoryManager;
|
MockMemoryManager mockMemoryManager;
|
||||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||||
@@ -174,7 +174,7 @@ TEST(MemoryManagerTest, givenForced32BitSetWhenGraphicsMemoryFor32BitAllowedType
|
|||||||
memoryManager.setForce32BitAllocations(true);
|
memoryManager.setForce32BitAllocations(true);
|
||||||
|
|
||||||
AllocationData allocData;
|
AllocationData allocData;
|
||||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER);
|
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||||
|
|
||||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ TEST(MemoryManagerTest, givenForced32BitEnabledWhenGraphicsMemoryWihtoutAllow32B
|
|||||||
memoryManager.setForce32BitAllocations(true);
|
memoryManager.setForce32BitAllocations(true);
|
||||||
|
|
||||||
AllocationData allocData;
|
AllocationData allocData;
|
||||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER);
|
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||||
|
|
||||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
||||||
allocData.flags.allow32Bit = false;
|
allocData.flags.allow32Bit = false;
|
||||||
@@ -215,7 +215,7 @@ TEST(MemoryManagerTest, givenForced32BitDisabledWhenGraphicsMemoryWith32BitFlagF
|
|||||||
memoryManager.setForce32BitAllocations(false);
|
memoryManager.setForce32BitAllocations(false);
|
||||||
|
|
||||||
AllocationData allocData;
|
AllocationData allocData;
|
||||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER);
|
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||||
|
|
||||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
||||||
|
|
||||||
@@ -230,7 +230,7 @@ TEST(MemoryManagerTest, givenEnabled64kbPagesWhenGraphicsMemoryMustBeHostMemoryA
|
|||||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||||
MockMemoryManager memoryManager(true, false, executionEnvironment);
|
MockMemoryManager memoryManager(true, false, executionEnvironment);
|
||||||
AllocationData allocData;
|
AllocationData allocData;
|
||||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false);
|
||||||
|
|
||||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
||||||
|
|
||||||
@@ -248,7 +248,7 @@ TEST(MemoryManagerTest, givenEnabled64kbPagesWhenGraphicsMemoryWithoutAllow64kbP
|
|||||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||||
MockMemoryManager memoryManager(true, false, executionEnvironment);
|
MockMemoryManager memoryManager(true, false, executionEnvironment);
|
||||||
AllocationData allocData;
|
AllocationData allocData;
|
||||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER);
|
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER, false);
|
||||||
|
|
||||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
||||||
allocData.flags.allow64kbPages = false;
|
allocData.flags.allow64kbPages = false;
|
||||||
@@ -265,7 +265,7 @@ TEST(MemoryManagerTest, givenDisabled64kbPagesWhenGraphicsMemoryMustBeHostMemory
|
|||||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||||
MockMemoryManager memoryManager(false, false, executionEnvironment);
|
MockMemoryManager memoryManager(false, false, executionEnvironment);
|
||||||
AllocationData allocData;
|
AllocationData allocData;
|
||||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false);
|
||||||
|
|
||||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
||||||
|
|
||||||
@@ -284,7 +284,7 @@ TEST(MemoryManagerTest, givenForced32BitAndEnabled64kbPagesWhenGraphicsMemoryMus
|
|||||||
memoryManager.setForce32BitAllocations(true);
|
memoryManager.setForce32BitAllocations(true);
|
||||||
|
|
||||||
AllocationData allocData;
|
AllocationData allocData;
|
||||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false);
|
||||||
|
|
||||||
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
MockMemoryManager::getAllocationData(allocData, properties, nullptr, memoryManager.createStorageInfoFromProperties(properties));
|
||||||
|
|
||||||
@@ -303,7 +303,7 @@ TEST(MemoryManagerTest, givenEnabled64kbPagesWhenGraphicsMemoryIsAllocatedWithHo
|
|||||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||||
MockMemoryManager memoryManager(true, false, executionEnvironment);
|
MockMemoryManager memoryManager(true, false, executionEnvironment);
|
||||||
AllocationData allocData;
|
AllocationData allocData;
|
||||||
AllocationProperties properties(false, 1, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
AllocationProperties properties(false, 1, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false);
|
||||||
|
|
||||||
char memory[1];
|
char memory[1];
|
||||||
MockMemoryManager::getAllocationData(allocData, properties, &memory, memoryManager.createStorageInfoFromProperties(properties));
|
MockMemoryManager::getAllocationData(allocData, properties, &memory, memoryManager.createStorageInfoFromProperties(properties));
|
||||||
@@ -528,7 +528,7 @@ TEST(MemoryManagerTest, givenExternalHostMemoryWhenGetAllocationDataIsCalledThen
|
|||||||
AllocationData allocData;
|
AllocationData allocData;
|
||||||
auto hostPtr = reinterpret_cast<void *>(0x1234);
|
auto hostPtr = reinterpret_cast<void *>(0x1234);
|
||||||
MockMemoryManager mockMemoryManager;
|
MockMemoryManager mockMemoryManager;
|
||||||
AllocationProperties properties{false, 1, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR};
|
AllocationProperties properties{false, 1, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||||
MockMemoryManager::getAllocationData(allocData, properties, hostPtr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
MockMemoryManager::getAllocationData(allocData, properties, hostPtr, mockMemoryManager.createStorageInfoFromProperties(properties));
|
||||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||||
EXPECT_FALSE(allocData.flags.allocateMemory);
|
EXPECT_FALSE(allocData.flags.allocateMemory);
|
||||||
|
|||||||
@@ -401,7 +401,7 @@ TEST_F(MemoryAllocatorTest, givenMemoryManagerWhenAskedFor32bitAllocationWithPtr
|
|||||||
TEST_F(MemoryAllocatorTest, givenAllocationWithFragmentsWhenCallingFreeGraphicsMemoryThenDoNotCallHandleFenceCompletion) {
|
TEST_F(MemoryAllocatorTest, givenAllocationWithFragmentsWhenCallingFreeGraphicsMemoryThenDoNotCallHandleFenceCompletion) {
|
||||||
auto size = 3u * MemoryConstants::pageSize;
|
auto size = 3u * MemoryConstants::pageSize;
|
||||||
auto *ptr = reinterpret_cast<void *>(0xbeef1);
|
auto *ptr = reinterpret_cast<void *>(0xbeef1);
|
||||||
AllocationProperties properties{false, size, GraphicsAllocation::AllocationType::BUFFER};
|
AllocationProperties properties{false, size, GraphicsAllocation::AllocationType::BUFFER, false};
|
||||||
|
|
||||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, ptr);
|
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, ptr);
|
||||||
EXPECT_EQ(3u, allocation->fragmentsStorage.fragmentCount);
|
EXPECT_EQ(3u, allocation->fragmentsStorage.fragmentCount);
|
||||||
@@ -790,7 +790,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenCreateGraphicsAllocat
|
|||||||
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
|
MemoryManagerCreate<OsAgnosticMemoryManager> memoryManager(false, false, executionEnvironment);
|
||||||
osHandle handle = 1;
|
osHandle handle = 1;
|
||||||
auto size = 4096u;
|
auto size = 4096u;
|
||||||
AllocationProperties properties(false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||||
EXPECT_NE(nullptr, sharedAllocation);
|
EXPECT_NE(nullptr, sharedAllocation);
|
||||||
EXPECT_FALSE(sharedAllocation->isCoherent());
|
EXPECT_FALSE(sharedAllocation->isCoherent());
|
||||||
@@ -1066,7 +1066,7 @@ TEST_P(OsAgnosticMemoryManagerWithParams, givenReducedGpuAddressSpaceWhenAllocat
|
|||||||
}
|
}
|
||||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||||
auto hostPtr = reinterpret_cast<const void *>(0x5001);
|
auto hostPtr = reinterpret_cast<const void *>(0x5001);
|
||||||
AllocationProperties properties{false, 13, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR};
|
AllocationProperties properties{false, 13, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = requiresL3Flush;
|
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = requiresL3Flush;
|
||||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
||||||
EXPECT_NE(nullptr, allocation);
|
EXPECT_NE(nullptr, allocation);
|
||||||
@@ -1085,7 +1085,7 @@ TEST_P(OsAgnosticMemoryManagerWithParams, givenFullGpuAddressSpaceWhenAllocateGr
|
|||||||
}
|
}
|
||||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||||
auto hostPtr = reinterpret_cast<const void *>(0x5001);
|
auto hostPtr = reinterpret_cast<const void *>(0x5001);
|
||||||
AllocationProperties properties{false, 13, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR};
|
AllocationProperties properties{false, 13, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = requiresL3Flush;
|
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = requiresL3Flush;
|
||||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
||||||
EXPECT_NE(nullptr, allocation);
|
EXPECT_NE(nullptr, allocation);
|
||||||
@@ -1109,7 +1109,7 @@ TEST_P(OsAgnosticMemoryManagerWithParams, givenDisabledHostPtrTrackingWhenAlloca
|
|||||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||||
auto hostPtr = reinterpret_cast<const void *>(0x5001);
|
auto hostPtr = reinterpret_cast<const void *>(0x5001);
|
||||||
|
|
||||||
AllocationProperties properties{false, 13, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR};
|
AllocationProperties properties{false, 13, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, false};
|
||||||
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = requiresL3Flush;
|
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = requiresL3Flush;
|
||||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(properties, hostPtr);
|
||||||
EXPECT_NE(nullptr, allocation);
|
EXPECT_NE(nullptr, allocation);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace NEO {
|
|||||||
struct MockAllocationProperties : public AllocationProperties {
|
struct MockAllocationProperties : public AllocationProperties {
|
||||||
MockAllocationProperties(size_t size, GraphicsAllocation::AllocationType allocationType) : AllocationProperties(size, allocationType) {}
|
MockAllocationProperties(size_t size, GraphicsAllocation::AllocationType allocationType) : AllocationProperties(size, allocationType) {}
|
||||||
MockAllocationProperties(size_t size) : AllocationProperties(size, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY) {}
|
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) : AllocationProperties(allocateMemory, size, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, false) {}
|
||||||
MockAllocationProperties(bool allocateMemory, size_t size, GraphicsAllocation::AllocationType allocationType) : AllocationProperties(allocateMemory, size, allocationType) {}
|
MockAllocationProperties(bool allocateMemory, size_t size, GraphicsAllocation::AllocationType allocationType) : AllocationProperties(allocateMemory, size, allocationType, false) {}
|
||||||
};
|
};
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ TEST(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSharedAllocationIsCreatedFro
|
|||||||
|
|
||||||
auto createFunction = [&]() {
|
auto createFunction = [&]() {
|
||||||
size_t indexFree = index++;
|
size_t indexFree = index++;
|
||||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
createdAllocations[indexFree] = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
createdAllocations[indexFree] = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||||
EXPECT_NE(nullptr, createdAllocations[indexFree]);
|
EXPECT_NE(nullptr, createdAllocations[indexFree]);
|
||||||
};
|
};
|
||||||
@@ -114,7 +114,7 @@ TEST(DrmMemoryManagerTest, givenMultipleThreadsWhenSharedAllocationIsCreatedThen
|
|||||||
|
|
||||||
auto createFunction = [&]() {
|
auto createFunction = [&]() {
|
||||||
size_t indexFree = index++;
|
size_t indexFree = index++;
|
||||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
createdAllocations[indexFree] = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
createdAllocations[indexFree] = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||||
EXPECT_NE(nullptr, createdAllocations[indexFree]);
|
EXPECT_NE(nullptr, createdAllocations[indexFree]);
|
||||||
|
|
||||||
|
|||||||
@@ -1626,7 +1626,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndOsHandleWhenCreateIsCalledT
|
|||||||
osHandle handle = 1u;
|
osHandle handle = 1u;
|
||||||
this->mock->outputHandle = 2u;
|
this->mock->outputHandle = 2u;
|
||||||
size_t size = 4096u;
|
size_t size = 4096u;
|
||||||
AllocationProperties properties(false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
|
|
||||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||||
ASSERT_NE(nullptr, graphicsAllocation);
|
ASSERT_NE(nullptr, graphicsAllocation);
|
||||||
@@ -1739,7 +1739,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndOsHandleWhenAllocationFails
|
|||||||
osHandle handle = 1u;
|
osHandle handle = 1u;
|
||||||
|
|
||||||
InjectedFunction method = [this, &handle](size_t failureIndex) {
|
InjectedFunction method = [this, &handle](size_t failureIndex) {
|
||||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
|
|
||||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||||
if (nonfailingAllocation == failureIndex) {
|
if (nonfailingAllocation == failureIndex) {
|
||||||
@@ -1774,7 +1774,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndThreeOsHandlesWhenReuseCrea
|
|||||||
if (i == 2)
|
if (i == 2)
|
||||||
this->mock->outputHandle = 3u;
|
this->mock->outputHandle = 3u;
|
||||||
|
|
||||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
|
|
||||||
graphicsAllocations[i] = memoryManager->createGraphicsAllocationFromSharedHandle(handles[i], properties, false);
|
graphicsAllocations[i] = memoryManager->createGraphicsAllocationFromSharedHandle(handles[i], properties, false);
|
||||||
//Clang-tidy false positive WA
|
//Clang-tidy false positive WA
|
||||||
@@ -1817,7 +1817,7 @@ TEST_F(DrmMemoryManagerTest, given32BitAddressingWhenBufferFromSharedHandleAndBi
|
|||||||
osHandle handle = 1u;
|
osHandle handle = 1u;
|
||||||
this->mock->outputHandle = 2u;
|
this->mock->outputHandle = 2u;
|
||||||
|
|
||||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
|
|
||||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, true);
|
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, true);
|
||||||
auto drmAllocation = static_cast<DrmAllocation *>(graphicsAllocation);
|
auto drmAllocation = static_cast<DrmAllocation *>(graphicsAllocation);
|
||||||
@@ -1837,7 +1837,7 @@ TEST_F(DrmMemoryManagerTest, given32BitAddressingWhenBufferFromSharedHandleIsCre
|
|||||||
memoryManager->setForce32BitAllocations(true);
|
memoryManager->setForce32BitAllocations(true);
|
||||||
osHandle handle = 1u;
|
osHandle handle = 1u;
|
||||||
this->mock->outputHandle = 2u;
|
this->mock->outputHandle = 2u;
|
||||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||||
auto drmAllocation = static_cast<DrmAllocation *>(graphicsAllocation);
|
auto drmAllocation = static_cast<DrmAllocation *>(graphicsAllocation);
|
||||||
|
|
||||||
@@ -1866,7 +1866,7 @@ TEST_F(DrmMemoryManagerTest, givenLimitedRangeAllocatorWhenBufferFromSharedHandl
|
|||||||
memoryManager->forceLimitedRangeAllocator(0xFFFFFFFFF);
|
memoryManager->forceLimitedRangeAllocator(0xFFFFFFFFF);
|
||||||
osHandle handle = 1u;
|
osHandle handle = 1u;
|
||||||
this->mock->outputHandle = 2u;
|
this->mock->outputHandle = 2u;
|
||||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||||
EXPECT_FALSE(graphicsAllocation->is32BitAllocation());
|
EXPECT_FALSE(graphicsAllocation->is32BitAllocation());
|
||||||
auto drmAllocation = static_cast<DrmAllocation *>(graphicsAllocation);
|
auto drmAllocation = static_cast<DrmAllocation *>(graphicsAllocation);
|
||||||
@@ -1883,7 +1883,7 @@ TEST_F(DrmMemoryManagerTest, givenNon32BitAddressingWhenBufferFromSharedHandleIs
|
|||||||
memoryManager->setForce32BitAllocations(false);
|
memoryManager->setForce32BitAllocations(false);
|
||||||
osHandle handle = 1u;
|
osHandle handle = 1u;
|
||||||
this->mock->outputHandle = 2u;
|
this->mock->outputHandle = 2u;
|
||||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, true);
|
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, true);
|
||||||
auto drmAllocation = static_cast<DrmAllocation *>(graphicsAllocation);
|
auto drmAllocation = static_cast<DrmAllocation *>(graphicsAllocation);
|
||||||
EXPECT_FALSE(graphicsAllocation->is32BitAllocation());
|
EXPECT_FALSE(graphicsAllocation->is32BitAllocation());
|
||||||
@@ -1910,7 +1910,7 @@ TEST_F(DrmMemoryManagerTest, givenSharedHandleWhenAllocationIsCreatedAndIoctlPri
|
|||||||
|
|
||||||
osHandle handle = 1u;
|
osHandle handle = 1u;
|
||||||
this->mock->outputHandle = 2u;
|
this->mock->outputHandle = 2u;
|
||||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||||
EXPECT_EQ(nullptr, graphicsAllocation);
|
EXPECT_EQ(nullptr, graphicsAllocation);
|
||||||
memoryManager->freeGraphicsMemory(graphicsAllocation);
|
memoryManager->freeGraphicsMemory(graphicsAllocation);
|
||||||
@@ -1922,7 +1922,7 @@ TEST_F(DrmMemoryManagerTest, givenTwoGraphicsAllocationsThatShareTheSameBufferOb
|
|||||||
mock->ioctl_expected.gemWait = 2;
|
mock->ioctl_expected.gemWait = 2;
|
||||||
|
|
||||||
osHandle sharedHandle = 1u;
|
osHandle sharedHandle = 1u;
|
||||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
|
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
|
||||||
auto graphicsAllocation2 = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
|
auto graphicsAllocation2 = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
|
||||||
|
|
||||||
@@ -1949,7 +1949,7 @@ TEST_F(DrmMemoryManagerTest, givenTwoGraphicsAllocationsThatDoesnShareTheSameBuf
|
|||||||
mock->ioctl_expected.gemWait = 2;
|
mock->ioctl_expected.gemWait = 2;
|
||||||
|
|
||||||
osHandle sharedHandle = 1u;
|
osHandle sharedHandle = 1u;
|
||||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
|
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
|
||||||
mock->outputHandle++;
|
mock->outputHandle++;
|
||||||
auto graphicsAllocation2 = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
|
auto graphicsAllocation2 = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
|
||||||
@@ -2203,7 +2203,7 @@ TEST_F(DrmMemoryManagerTest, givenSharedAllocationWithSmallerThenRealSizeWhenCre
|
|||||||
mock->ioctl_expected.gemWait = 1;
|
mock->ioctl_expected.gemWait = 1;
|
||||||
mock->ioctl_expected.gemClose = 1;
|
mock->ioctl_expected.gemClose = 1;
|
||||||
osHandle sharedHandle = 1u;
|
osHandle sharedHandle = 1u;
|
||||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
|
|
||||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
|
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
|
||||||
|
|
||||||
@@ -2635,7 +2635,7 @@ TEST_F(DrmMemoryManagerBasic, givenMemoryManagerWhenCreateAllocationFromHandleIs
|
|||||||
true,
|
true,
|
||||||
executionEnvironment));
|
executionEnvironment));
|
||||||
auto osHandle = 1u;
|
auto osHandle = 1u;
|
||||||
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
||||||
EXPECT_NE(nullptr, allocation);
|
EXPECT_NE(nullptr, allocation);
|
||||||
EXPECT_EQ(MemoryPool::SystemCpuInaccessible, allocation->getMemoryPool());
|
EXPECT_EQ(MemoryPool::SystemCpuInaccessible, allocation->getMemoryPool());
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationF
|
|||||||
EXPECT_EQ(0u, status);
|
EXPECT_EQ(0u, status);
|
||||||
|
|
||||||
MemoryManagerCreate<WddmMemoryManager> mm(false, false, *executionEnvironment);
|
MemoryManagerCreate<WddmMemoryManager> mm(false, false, *executionEnvironment);
|
||||||
AllocationProperties properties(false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
|
|
||||||
auto graphicsAllocation = mm.createGraphicsAllocationFromSharedHandle(ALLOCATION_HANDLE, properties, false);
|
auto graphicsAllocation = mm.createGraphicsAllocationFromSharedHandle(ALLOCATION_HANDLE, properties, false);
|
||||||
auto wddmAllocation = (WddmAllocation *)graphicsAllocation;
|
auto wddmAllocation = (WddmAllocation *)graphicsAllocation;
|
||||||
@@ -404,7 +404,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationF
|
|||||||
EXPECT_EQ(0u, status);
|
EXPECT_EQ(0u, status);
|
||||||
|
|
||||||
MemoryManagerCreate<WddmMemoryManager> mm(false, false, *executionEnvironment);
|
MemoryManagerCreate<WddmMemoryManager> mm(false, false, *executionEnvironment);
|
||||||
AllocationProperties properties(false, 4096, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, 4096, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
|
|
||||||
auto graphicsAllocation = mm.createGraphicsAllocationFromSharedHandle(ALLOCATION_HANDLE, properties, false);
|
auto graphicsAllocation = mm.createGraphicsAllocationFromSharedHandle(ALLOCATION_HANDLE, properties, false);
|
||||||
auto wddmAllocation = (WddmAllocation *)graphicsAllocation;
|
auto wddmAllocation = (WddmAllocation *)graphicsAllocation;
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenCreateAllocationFromHa
|
|||||||
|
|
||||||
gdi->getOpenResourceArgOut().pOpenAllocationInfo = &allocationInfo;
|
gdi->getOpenResourceArgOut().pOpenAllocationInfo = &allocationInfo;
|
||||||
|
|
||||||
AllocationProperties properties(false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
||||||
EXPECT_NE(nullptr, allocation);
|
EXPECT_NE(nullptr, allocation);
|
||||||
EXPECT_EQ(MemoryPool::SystemCpuInaccessible, allocation->getMemoryPool());
|
EXPECT_EQ(MemoryPool::SystemCpuInaccessible, allocation->getMemoryPool());
|
||||||
@@ -232,8 +232,8 @@ TEST_F(WddmMemoryManagerSimpleTest, givenAllocationPropertiesWhenCreateAllocatio
|
|||||||
|
|
||||||
gdi->getOpenResourceArgOut().pOpenAllocationInfo = &allocationInfo;
|
gdi->getOpenResourceArgOut().pOpenAllocationInfo = &allocationInfo;
|
||||||
|
|
||||||
AllocationProperties propertiesBuffer(false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties propertiesBuffer(false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
AllocationProperties propertiesImage(false, 0, GraphicsAllocation::AllocationType::SHARED_IMAGE);
|
AllocationProperties propertiesImage(false, 0, GraphicsAllocation::AllocationType::SHARED_IMAGE, false);
|
||||||
|
|
||||||
AllocationProperties *properties[2] = {&propertiesBuffer, &propertiesImage};
|
AllocationProperties *properties[2] = {&propertiesBuffer, &propertiesImage};
|
||||||
|
|
||||||
@@ -261,7 +261,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenCreateAllocationFromHandleAndMapCallFail
|
|||||||
gdi->getOpenResourceArgOut().pOpenAllocationInfo = &allocationInfo;
|
gdi->getOpenResourceArgOut().pOpenAllocationInfo = &allocationInfo;
|
||||||
EXPECT_EQ(0u, memoryManager->freeGraphicsMemoryImplCalled);
|
EXPECT_EQ(0u, memoryManager->freeGraphicsMemoryImplCalled);
|
||||||
|
|
||||||
AllocationProperties properties(false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
|
|
||||||
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
||||||
EXPECT_EQ(nullptr, allocation);
|
EXPECT_EQ(nullptr, allocation);
|
||||||
@@ -456,7 +456,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIs
|
|||||||
std::unique_ptr<Gmm> gmm(new Gmm(pSysMem, 4096u, false));
|
std::unique_ptr<Gmm> gmm(new Gmm(pSysMem, 4096u, false));
|
||||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||||
|
|
||||||
AllocationProperties properties(false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
|
|
||||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
||||||
auto wddmAlloc = static_cast<WddmAllocation *>(gpuAllocation);
|
auto wddmAlloc = static_cast<WddmAllocation *>(gpuAllocation);
|
||||||
@@ -507,7 +507,7 @@ TEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleReturns32BitAllocW
|
|||||||
|
|
||||||
memoryManager->setForce32BitAllocations(true);
|
memoryManager->setForce32BitAllocations(true);
|
||||||
|
|
||||||
AllocationProperties properties(false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
|
|
||||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, true);
|
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, true);
|
||||||
ASSERT_NE(nullptr, gpuAllocation);
|
ASSERT_NE(nullptr, gpuAllocation);
|
||||||
@@ -530,7 +530,7 @@ TEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleDoesNotReturn32Bit
|
|||||||
|
|
||||||
memoryManager->setForce32BitAllocations(true);
|
memoryManager->setForce32BitAllocations(true);
|
||||||
|
|
||||||
AllocationProperties properties(false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
||||||
ASSERT_NE(nullptr, gpuAllocation);
|
ASSERT_NE(nullptr, gpuAllocation);
|
||||||
|
|
||||||
@@ -550,7 +550,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenFreeAllocFromSharedHandl
|
|||||||
std::unique_ptr<Gmm> gmm(new Gmm(pSysMem, 4096u, false));
|
std::unique_ptr<Gmm> gmm(new Gmm(pSysMem, 4096u, false));
|
||||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||||
|
|
||||||
AllocationProperties properties(false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
auto gpuAllocation = (WddmAllocation *)memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
auto gpuAllocation = (WddmAllocation *)memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
||||||
EXPECT_NE(nullptr, gpuAllocation);
|
EXPECT_NE(nullptr, gpuAllocation);
|
||||||
auto expectedDestroyHandle = gpuAllocation->resourceHandle;
|
auto expectedDestroyHandle = gpuAllocation->resourceHandle;
|
||||||
@@ -572,7 +572,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerSizeZeroWhenCreateFromShared
|
|||||||
std::unique_ptr<Gmm> gmm(new Gmm(pSysMem, size, false));
|
std::unique_ptr<Gmm> gmm(new Gmm(pSysMem, size, false));
|
||||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||||
|
|
||||||
AllocationProperties properties(false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
||||||
ASSERT_NE(nullptr, gpuAllocation);
|
ASSERT_NE(nullptr, gpuAllocation);
|
||||||
EXPECT_EQ(size, gpuAllocation->getUnderlyingBufferSize());
|
EXPECT_EQ(size, gpuAllocation->getUnderlyingBufferSize());
|
||||||
@@ -589,7 +589,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleFa
|
|||||||
|
|
||||||
wddm->failOpenSharedHandle = true;
|
wddm->failOpenSharedHandle = true;
|
||||||
|
|
||||||
AllocationProperties properties(false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
AllocationProperties properties(false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false);
|
||||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
|
||||||
EXPECT_EQ(nullptr, gpuAllocation);
|
EXPECT_EQ(nullptr, gpuAllocation);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user