Add IPC events support (2/N)
Fix shared allocation on multi DG1 systems Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
parent
fdb67afded
commit
ddf75b8d23
|
@ -335,26 +335,6 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMultiRootDeviceEnvironmentAndMemory
|
|||
|
||||
using DrmMemoryManagerUsmSharedHandleTest = DrmMemoryManagerLocalMemoryTest;
|
||||
|
||||
TEST_F(DrmMemoryManagerUsmSharedHandleTest, givenDrmMemoryManagerAndOsHandleWhenCreateIsCalledWithTagBufferAllocationTypeThenGraphicsAllocationIsReturned) {
|
||||
osHandle handle = 1u;
|
||||
this->mock->outputHandle = 2u;
|
||||
size_t size = 4096u;
|
||||
AllocationProperties properties(rootDeviceIndex, false, size, GraphicsAllocation::AllocationType::TAG_BUFFER, false, {});
|
||||
|
||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false, true);
|
||||
ASSERT_NE(nullptr, graphicsAllocation);
|
||||
|
||||
EXPECT_EQ(this->mock->inputFd, (int)handle);
|
||||
|
||||
DrmAllocation *drmAllocation = static_cast<DrmAllocation *>(graphicsAllocation);
|
||||
auto bo = drmAllocation->getBO();
|
||||
EXPECT_EQ(bo->peekHandle(), (int)this->mock->outputHandle);
|
||||
EXPECT_EQ(1u, bo->getRefCount());
|
||||
EXPECT_EQ(size, bo->peekSize());
|
||||
|
||||
memoryManager->freeGraphicsMemory(graphicsAllocation);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerUsmSharedHandleTest, givenDrmMemoryManagerAndOsHandleWhenCreateIsCalledWithBufferHostMemoryAllocationTypeThenGraphicsAllocationIsReturned) {
|
||||
osHandle handle = 1u;
|
||||
this->mock->outputHandle = 2u;
|
||||
|
@ -405,7 +385,7 @@ TEST_F(DrmMemoryManagerUsmSharedHandleTest, givenMultiRootDeviceEnvironmentAndMe
|
|||
size_t size = 4096u;
|
||||
AllocationProperties properties(rootDeviceIndex, true, size, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false, {});
|
||||
|
||||
auto ptr = memoryManager->createUSMHostAllocationFromSharedHandle(1, properties);
|
||||
auto ptr = memoryManager->createUSMHostAllocationFromSharedHandle(1, properties, false);
|
||||
|
||||
EXPECT_EQ(ptr, nullptr);
|
||||
|
||||
|
|
|
@ -593,7 +593,7 @@ BufferObject *DrmMemoryManager::findAndReferenceSharedBufferObject(int boHandle)
|
|||
|
||||
GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation) {
|
||||
if (isHostIpcAllocation) {
|
||||
return createUSMHostAllocationFromSharedHandle(handle, properties);
|
||||
return createUSMHostAllocationFromSharedHandle(handle, properties, false);
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> lock(mtx);
|
||||
|
@ -774,7 +774,7 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromExistingStorag
|
|||
properties.gpuAddress = castToUint64(ptr);
|
||||
|
||||
auto internalHandle = defaultAlloc->peekInternalHandle(this);
|
||||
return createUSMHostAllocationFromSharedHandle(static_cast<osHandle>(internalHandle), properties);
|
||||
return createUSMHostAllocationFromSharedHandle(static_cast<osHandle>(internalHandle), properties, true);
|
||||
} else {
|
||||
return allocateGraphicsMemoryWithProperties(properties, ptr);
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ class DrmMemoryManager : public MemoryManager {
|
|||
|
||||
static std::unique_ptr<MemoryManager> create(ExecutionEnvironment &executionEnvironment);
|
||||
|
||||
DrmAllocation *createUSMHostAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties);
|
||||
DrmAllocation *createUSMHostAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool hasMappedPtr);
|
||||
|
||||
protected:
|
||||
BufferObject *findAndReferenceSharedBufferObject(int boHandle);
|
||||
|
|
|
@ -17,7 +17,7 @@ BufferObject *DrmMemoryManager::createBufferObjectInMemoryRegion(Drm *drm, uint6
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
DrmAllocation *DrmMemoryManager::createUSMHostAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties) {
|
||||
DrmAllocation *DrmMemoryManager::createUSMHostAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool hasMappedPtr) {
|
||||
drm_prime_handle openFd = {0, 0, 0};
|
||||
openFd.fd = handle;
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ GraphicsAllocation *DrmMemoryManager::createSharedUnifiedMemoryAllocation(const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
DrmAllocation *DrmMemoryManager::createUSMHostAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties) {
|
||||
DrmAllocation *DrmMemoryManager::createUSMHostAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool hasMappedPtr) {
|
||||
drm_prime_handle openFd = {0, 0, 0};
|
||||
openFd.fd = handle;
|
||||
|
||||
|
|
Loading…
Reference in New Issue