Add IPC events support

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
Jaime Arteaga
2021-05-24 06:14:30 +00:00
committed by Compute-Runtime-Automation
parent 3f068eeca2
commit 5e29dccddc
47 changed files with 780 additions and 146 deletions

View File

@@ -45,7 +45,7 @@ class D3DBuffer : public D3DSharing<D3D> {
GraphicsAllocation::AllocationType::SHARED_BUFFER,
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(context->getDevice(0)->getRootDeviceIndex())};
auto alloc = context->getMemoryManager()->createGraphicsAllocationFromSharedHandle(toOsHandle(sharedHandle), properties, true);
auto alloc = context->getMemoryManager()->createGraphicsAllocationFromSharedHandle(toOsHandle(sharedHandle), properties, true, false);
auto d3dBufferObj = new D3DBuffer<D3D>(context, d3dBuffer, bufferStaging, sharedResource);

View File

@@ -88,7 +88,7 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(rootDeviceIndex));
alloc = context->getMemoryManager()->createGraphicsAllocationFromSharedHandle(toOsHandle(surfaceInfo->shared_handle), allocProperties,
false);
false, false);
updateImgInfoAndDesc(alloc->getDefaultGmm(), imgInfo, imagePlane, 0u);
} else {
lockable = !(surfaceDesc.Usage & D3DResourceFlags::USAGE_RENDERTARGET) || imagePlane != ImagePlane::NO_PLANE;

View File

@@ -90,7 +90,7 @@ Image *D3DTexture<D3D>::create2d(Context *context, D3DTexture2d *d3dTexture, cl_
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(rootDeviceIndex));
if (memoryManager->verifyHandle(toOsHandle(sharedHandle), rootDeviceIndex, false)) {
alloc = memoryManager->createGraphicsAllocationFromSharedHandle(toOsHandle(sharedHandle), allocProperties, false);
alloc = memoryManager->createGraphicsAllocationFromSharedHandle(toOsHandle(sharedHandle), allocProperties, false, false);
} else {
err.set(CL_INVALID_D3D11_RESOURCE_KHR);
return nullptr;
@@ -181,7 +181,7 @@ Image *D3DTexture<D3D>::create3d(Context *context, D3DTexture3d *d3dTexture, cl_
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(rootDeviceIndex));
if (memoryManager->verifyHandle(toOsHandle(sharedHandle), rootDeviceIndex, false)) {
alloc = memoryManager->createGraphicsAllocationFromSharedHandle(toOsHandle(sharedHandle), allocProperties, false);
alloc = memoryManager->createGraphicsAllocationFromSharedHandle(toOsHandle(sharedHandle), allocProperties, false, false);
} else {
err.set(CL_INVALID_D3D11_RESOURCE_KHR);
return nullptr;

View File

@@ -151,7 +151,7 @@ GraphicsAllocation *GlBuffer::createGraphicsAllocation(Context *context, unsigne
context->getDeviceBitfieldForAllocation(context->getDevice(0)->getRootDeviceIndex())};
// couldn't find allocation for reuse - create new
graphicsAllocation =
context->getMemoryManager()->createGraphicsAllocationFromSharedHandle(bufferInfo.globalShareHandle, properties, true);
context->getMemoryManager()->createGraphicsAllocationFromSharedHandle(bufferInfo.globalShareHandle, properties, true, false);
}
if (!graphicsAllocation) {

View File

@@ -56,7 +56,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl
GraphicsAllocation::AllocationType::SHARED_IMAGE,
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(context->getDevice(0)->getRootDeviceIndex()));
auto alloc = memoryManager->createGraphicsAllocationFromSharedHandle(texInfo.globalShareHandle, allocProperties, false);
auto alloc = memoryManager->createGraphicsAllocationFromSharedHandle(texInfo.globalShareHandle, allocProperties, false, false);
if (alloc == nullptr) {
errorCode.set(CL_INVALID_GL_OBJECT);
@@ -125,7 +125,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl
GraphicsAllocation *mcsAlloc = nullptr;
if (texInfo.globalShareHandleMCS) {
AllocationProperties allocProperties(context->getDevice(0)->getRootDeviceIndex(), 0, GraphicsAllocation::AllocationType::MCS, context->getDeviceBitfieldForAllocation(context->getDevice(0)->getRootDeviceIndex()));
mcsAlloc = memoryManager->createGraphicsAllocationFromSharedHandle(texInfo.globalShareHandleMCS, allocProperties, false);
mcsAlloc = memoryManager->createGraphicsAllocationFromSharedHandle(texInfo.globalShareHandleMCS, allocProperties, false, false);
if (texInfo.pGmmResInfoMCS) {
DEBUG_BREAK_IF(mcsAlloc->getDefaultGmm() != nullptr);
mcsAlloc->setDefaultGmm(new Gmm(clientContext, texInfo.pGmmResInfoMCS));

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2020 Intel Corporation
* Copyright (C) 2019-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -46,7 +46,7 @@ GraphicsAllocation *UnifiedSharing::createGraphicsAllocation(Context *context, U
allocationType,
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(context->getDevice(0)->getRootDeviceIndex())};
return memoryManager->createGraphicsAllocationFromSharedHandle(toOsHandle(description.handle), properties, false);
return memoryManager->createGraphicsAllocationFromSharedHandle(toOsHandle(description.handle), properties, false, false);
}
default:
return nullptr;

View File

@@ -116,7 +116,7 @@ Image *VASurface::createSharedVaSurface(Context *context, VASharingFunctions *sh
imgInfo, GraphicsAllocation::AllocationType::SHARED_IMAGE,
context->getDeviceBitfieldForAllocation(context->getDevice(0)->getRootDeviceIndex()));
auto alloc = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
auto alloc = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false, false);
memoryManager->closeSharedHandle(alloc);

View File

@@ -72,7 +72,7 @@ struct ComputeModeRequirements : public ::testing::Test {
device->resetCommandStreamReceiver(csr);
AllocationProperties properties(device->getRootDeviceIndex(), false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, {});
alloc = device->getMemoryManager()->createGraphicsAllocationFromSharedHandle((osHandle)123, properties, false);
alloc = device->getMemoryManager()->createGraphicsAllocationFromSharedHandle((osHandle)123, properties, false, false);
}
void TearDown() override {

View File

@@ -33,8 +33,8 @@ IDXGIAdapter *MockD3DSharingFunctions<D3DTypesHelper::D3D9>::getDxgiDescAdapterR
class MockMM : public OsAgnosticMemoryManager {
public:
MockMM(const ExecutionEnvironment &executionEnvironment) : OsAgnosticMemoryManager(const_cast<ExecutionEnvironment &>(executionEnvironment)){};
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness) override {
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(handle, properties, requireSpecificBitness);
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation) override {
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(handle, properties, requireSpecificBitness, isHostIpcAllocation);
alloc->setDefaultGmm(forceGmm);
gmmOwnershipPassed = true;
return alloc;
@@ -42,7 +42,7 @@ class MockMM : public OsAgnosticMemoryManager {
GraphicsAllocation *allocateGraphicsMemoryForImage(const AllocationData &allocationData) override {
auto gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), *allocationData.imgInfo, StorageInfo{});
AllocationProperties properties(allocationData.rootDeviceIndex, nullptr, false, GraphicsAllocation::AllocationType::SHARED_IMAGE, false, {});
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(1, properties, false);
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(1, properties, false, false);
alloc->setDefaultGmm(forceGmm);
gmmOwnershipPassed = true;
return alloc;

View File

@@ -1325,7 +1325,7 @@ TEST_F(DeviceGetCapsTest, givenFlagEnabled64kbPagesWhenCallConstructorMemoryMana
MockMemoryManager(ExecutionEnvironment &executionEnvironment) : MemoryManager(executionEnvironment) {}
void addAllocationToHostPtrManager(GraphicsAllocation *memory) override{};
void removeAllocationFromHostPtrManager(GraphicsAllocation *memory) override{};
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness) override { return nullptr; };
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation) override { return nullptr; };
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex) override { return nullptr; };
AllocationStatus populateOsHandles(OsHandleStorage &handleStorage, uint32_t rootDeviceIndex) override { return AllocationStatus::Success; };
void cleanOsHandles(OsHandleStorage &handleStorage, uint32_t rootDeviceIndex) override{};

View File

@@ -46,11 +46,11 @@ class D3DTests : public PlatformFixture, public ::testing::Test {
public:
using OsAgnosticMemoryManager::OsAgnosticMemoryManager;
bool failAlloc = false;
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness) override {
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation) override {
if (failAlloc) {
return nullptr;
}
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(handle, properties, requireSpecificBitness);
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(handle, properties, requireSpecificBitness, isHostIpcAllocation);
alloc->setDefaultGmm(forceGmm);
gmmOwnershipPassed = true;
return alloc;
@@ -60,7 +60,7 @@ class D3DTests : public PlatformFixture, public ::testing::Test {
return nullptr;
}
AllocationProperties properties(rootDeviceIndex, true, 0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, false, false, 0);
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(toOsHandle(handle), properties, false);
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(toOsHandle(handle), properties, false, false);
alloc->setDefaultGmm(forceGmm);
gmmOwnershipPassed = true;
return alloc;

View File

@@ -47,7 +47,7 @@ struct Gen12LpCoherencyRequirements : public ::testing::Test {
device->resetCommandStreamReceiver(csr);
AllocationProperties properties(device->getRootDeviceIndex(), false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, {});
alloc = device->getMemoryManager()->createGraphicsAllocationFromSharedHandle((osHandle)123, properties, false);
alloc = device->getMemoryManager()->createGraphicsAllocationFromSharedHandle((osHandle)123, properties, false, false);
}
void TearDown() override {

View File

@@ -44,12 +44,12 @@ TEST_P(MemoryManagerMultiDeviceTest, givenRootDeviceIndexSpecifiedWhenAllocateGr
EXPECT_EQ(rootDeviceIndex, gfxAllocation->getRootDeviceIndex());
memoryManager->freeGraphicsMemory(gfxAllocation);
gfxAllocation = memoryManager->createGraphicsAllocationFromSharedHandle((osHandle)0u, properties, false);
gfxAllocation = memoryManager->createGraphicsAllocationFromSharedHandle((osHandle)0u, properties, false, false);
ASSERT_NE(gfxAllocation, nullptr);
EXPECT_EQ(rootDeviceIndex, gfxAllocation->getRootDeviceIndex());
memoryManager->freeGraphicsMemory(gfxAllocation);
gfxAllocation = memoryManager->createGraphicsAllocationFromSharedHandle((osHandle)0u, properties, true);
gfxAllocation = memoryManager->createGraphicsAllocationFromSharedHandle((osHandle)0u, properties, true, false);
ASSERT_NE(gfxAllocation, nullptr);
EXPECT_EQ(rootDeviceIndex, gfxAllocation->getRootDeviceIndex());
memoryManager->freeGraphicsMemory(gfxAllocation);

View File

@@ -1064,7 +1064,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenCreateGraphicsAllocat
osHandle handle = 1;
auto size = 4096u;
AllocationProperties properties(mockRootDeviceIndex, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, mockDeviceBitfield);
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, false);
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, false, false);
EXPECT_NE(nullptr, sharedAllocation);
EXPECT_FALSE(sharedAllocation->isCoherent());
EXPECT_NE(nullptr, sharedAllocation->getUnderlyingBuffer());
@@ -1083,7 +1083,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenCreateGraphicsAllocat
EXPECT_EQ(properties.subDevicesBitfield, mockDeviceBitfield);
EXPECT_EQ(properties.rootDeviceIndex, 0u);
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, false);
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, false, false);
EXPECT_NE(nullptr, sharedAllocation);
EXPECT_EQ(0u, sharedAllocation->getRootDeviceIndex());
EXPECT_FALSE(sharedAllocation->isCoherent());
@@ -1100,7 +1100,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenCreateGraphicsAllocat
osHandle handle = 1;
auto size = 4096u;
AllocationProperties properties(mockRootDeviceIndex, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, mockDeviceBitfield);
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, true);
auto sharedAllocation = memoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, true, false);
EXPECT_NE(nullptr, sharedAllocation);
EXPECT_TRUE(sharedAllocation->is32BitAllocation());
EXPECT_FALSE(sharedAllocation->isCoherent());

View File

@@ -231,7 +231,7 @@ class FailMemoryManager : public MockMemoryManager {
GraphicsAllocation *allocate32BitGraphicsMemoryImpl(const AllocationData &allocationData, bool useLocalMemory) override {
return nullptr;
}
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness) override {
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation) override {
return nullptr;
}
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex) override {

View File

@@ -54,7 +54,7 @@ TEST(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSharedAllocationIsCreatedFro
auto createFunction = [&]() {
size_t indexFree = index++;
AllocationProperties properties(0, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, {});
createdAllocations[indexFree] = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
createdAllocations[indexFree] = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false, false);
EXPECT_NE(nullptr, createdAllocations[indexFree]);
EXPECT_GE(1u, memoryManager->peekSharedBosSize());
allocateCount++;
@@ -123,7 +123,7 @@ TEST(DrmMemoryManagerTest, givenMultipleThreadsWhenSharedAllocationIsCreatedThen
auto createFunction = [&]() {
size_t indexFree = index++;
AllocationProperties properties(0, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, {});
createdAllocations[indexFree] = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
createdAllocations[indexFree] = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false, false);
EXPECT_NE(nullptr, createdAllocations[indexFree]);
std::this_thread::yield();

View File

@@ -201,6 +201,8 @@ class DrmMockCustom : public Drm {
int errnoValue = 0;
bool returnIoctlExtraErrorValue = false;
int ioctl(unsigned long request, void *arg) override {
auto ext = ioctl_res_ext.load();
@@ -311,7 +313,10 @@ class DrmMockCustom : public Drm {
} break;
default:
ioctlExtra(request, arg);
int res = ioctlExtra(request, arg);
if (returnIoctlExtraErrorValue) {
return res;
}
}
if (ext->no != -1 && ext->no == ioctl_cnt.total.load()) {

View File

@@ -333,6 +333,85 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMultiRootDeviceEnvironmentAndMemory
executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(osInterface);
}
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;
size_t size = 4096u;
AllocationProperties properties(rootDeviceIndex, false, size, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false, {});
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false, true);
ASSERT_NE(nullptr, graphicsAllocation);
EXPECT_EQ(this->mock->inputFd, (int)handle);
EXPECT_EQ(this->mock->setTilingHandle, 0u);
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, givenMultiRootDeviceEnvironmentAndMemoryInfoWhenCreateMultiGraphicsAllocationAndImportFailsThenNullptrIsReturned) {
uint32_t rootDevicesNumber = 1u;
uint32_t rootDeviceIndex = 0u;
MultiGraphicsAllocation multiGraphics(rootDevicesNumber);
std::vector<uint32_t> rootDeviceIndices;
auto osInterface = executionEnvironment->rootDeviceEnvironments[0]->osInterface.release();
executionEnvironment->prepareRootDeviceEnvironments(rootDevicesNumber);
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(defaultHwInfo.get());
auto mock = new DrmMockDg1(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]);
drm_i915_memory_region_info regionInfo[2] = {};
regionInfo[0].region = {I915_MEMORY_CLASS_SYSTEM, 0};
regionInfo[1].region = {I915_MEMORY_CLASS_DEVICE, 0};
mock->memoryInfo.reset(new MemoryInfoImpl(regionInfo, 2));
mock->ioctlCallsCount = 0;
mock->fdToHandleRetVal = -1;
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->osInterface = std::make_unique<OSInterface>();
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mock));
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*mock, 0u);
rootDeviceIndices.push_back(rootDeviceIndex);
auto memoryManager = std::make_unique<TestedDrmMemoryManager>(true, false, false, *executionEnvironment);
size_t size = 4096u;
AllocationProperties properties(rootDeviceIndex, true, size, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false, {});
auto ptr = memoryManager->createUSMHostAllocationFromSharedHandle(1, properties);
EXPECT_EQ(ptr, nullptr);
executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(osInterface);
}
TEST_F(DrmMemoryManagerLocalMemoryTest, givenMultiRootDeviceEnvironmentAndNoMemoryInfoWhenCreateMultiGraphicsAllocationThenOldPathIsUsed) {
uint32_t rootDevicesNumber = 3u;
MultiGraphicsAllocation multiGraphics(rootDevicesNumber);
@@ -361,6 +440,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMultiRootDeviceEnvironmentAndNoMemo
auto ptr = memoryManager->createMultiGraphicsAllocationInSystemMemoryPool(rootDeviceIndices, properties, multiGraphics);
EXPECT_NE(ptr, nullptr);
EXPECT_EQ(static_cast<DrmAllocation *>(multiGraphics.getDefaultGraphicsAllocation())->getMmapPtr(), nullptr);
for (uint32_t i = 0; i < rootDevicesNumber; i++) {
EXPECT_NE(multiGraphics.getGraphicsAllocation(i), nullptr);

View File

@@ -603,7 +603,7 @@ TEST_F(DrmMemoryManagerTest, GivenAllocationWhenClosingSharedHandleThenSucceeds)
size_t size = 4096u;
AllocationProperties properties(rootDeviceIndex, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, {});
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false, false);
EXPECT_EQ(handle, graphicsAllocation->peekSharedHandle());
memoryManager->closeSharedHandle(graphicsAllocation);
@@ -2021,7 +2021,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndOsHandleWhenCreateIsCalledT
size_t size = 4096u;
AllocationProperties properties(rootDeviceIndex, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, {});
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false, false);
ASSERT_NE(nullptr, graphicsAllocation);
EXPECT_NE(nullptr, graphicsAllocation->getUnderlyingBuffer());
@@ -2051,7 +2051,7 @@ TEST_F(DrmMemoryManagerWithLocalMemoryTest, givenDrmMemoryManagerWithLocalMemory
size_t size = 4096u;
AllocationProperties properties(rootDeviceIndex, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, {});
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false, false);
ASSERT_NE(nullptr, graphicsAllocation);
EXPECT_NE(nullptr, graphicsAllocation->getUnderlyingBuffer());
@@ -2086,7 +2086,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndOsHandleWhenCreateIsCalledA
AllocationProperties properties(rootDeviceIndex, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0u);
ASSERT_TRUE(properties.subDevicesBitfield.none());
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false, false);
ASSERT_NE(nullptr, graphicsAllocation);
EXPECT_EQ(rootDeviceIndex, graphicsAllocation->getRootDeviceIndex());
@@ -2135,7 +2135,7 @@ TEST_F(DrmMemoryManagerTest, givenOsHandleWithNonTiledObjectWhenCreateFromShared
AllocationProperties properties(rootDeviceIndex, false, imgInfo, GraphicsAllocation::AllocationType::SHARED_IMAGE, context.getDevice(0)->getDeviceBitfield());
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false, false);
ASSERT_NE(nullptr, graphicsAllocation);
EXPECT_EQ(boHandle, mock->getTilingHandleIn);
EXPECT_EQ(GraphicsAllocation::AllocationType::SHARED_IMAGE, graphicsAllocation->getAllocationType());
@@ -2177,7 +2177,7 @@ TEST_F(DrmMemoryManagerTest, givenOsHandleWithTileYObjectWhenCreateFromSharedHan
AllocationProperties properties(rootDeviceIndex, false, imgInfo, GraphicsAllocation::AllocationType::SHARED_IMAGE, context.getDevice(0)->getDeviceBitfield());
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false, false);
ASSERT_NE(nullptr, graphicsAllocation);
EXPECT_EQ(boHandle, mock->getTilingHandleIn);
EXPECT_EQ(GraphicsAllocation::AllocationType::SHARED_IMAGE, graphicsAllocation->getAllocationType());
@@ -2219,7 +2219,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenCreateFromSharedHandleFail
AllocationProperties properties(rootDeviceIndex, false, imgInfo, GraphicsAllocation::AllocationType::SHARED_IMAGE, context.getDevice(0)->getDeviceBitfield());
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false, false);
ASSERT_NE(nullptr, graphicsAllocation);
EXPECT_EQ(boHandle, mock->getTilingHandleIn);
EXPECT_EQ(GraphicsAllocation::AllocationType::SHARED_IMAGE, graphicsAllocation->getAllocationType());
@@ -2237,7 +2237,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndOsHandleWhenAllocationFails
InjectedFunction method = [this, &handle](size_t failureIndex) {
AllocationProperties properties(rootDeviceIndex, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, mockDeviceBitfield);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false, false);
if (MemoryManagement::nonfailingAllocation == failureIndex) {
EXPECT_NE(nullptr, graphicsAllocation);
memoryManager->freeGraphicsMemory(graphicsAllocation);
@@ -2271,7 +2271,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndThreeOsHandlesWhenReuseCrea
AllocationProperties properties(rootDeviceIndex, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, mockDeviceBitfield);
graphicsAllocations[i] = memoryManager->createGraphicsAllocationFromSharedHandle(handles[i], properties, false);
graphicsAllocations[i] = memoryManager->createGraphicsAllocationFromSharedHandle(handles[i], properties, false, false);
//Clang-tidy false positive WA
if (graphicsAllocations[i] == nullptr) {
ASSERT_FALSE(true);
@@ -2312,7 +2312,7 @@ TEST_F(DrmMemoryManagerTest, given32BitAddressingWhenBufferFromSharedHandleAndBi
AllocationProperties properties(rootDeviceIndex, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, mockDeviceBitfield);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, true);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, true, false);
auto drmAllocation = static_cast<DrmAllocation *>(graphicsAllocation);
EXPECT_TRUE(graphicsAllocation->is32BitAllocation());
EXPECT_EQ(1, lseekCalledCount);
@@ -2329,7 +2329,7 @@ TEST_F(DrmMemoryManagerTest, given32BitAddressingWhenBufferFromSharedHandleIsCre
osHandle handle = 1u;
this->mock->outputHandle = 2u;
AllocationProperties properties(rootDeviceIndex, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, mockDeviceBitfield);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false, false);
auto drmAllocation = static_cast<DrmAllocation *>(graphicsAllocation);
EXPECT_FALSE(graphicsAllocation->is32BitAllocation());
@@ -2349,7 +2349,7 @@ TEST_F(DrmMemoryManagerTest, givenLimitedRangeAllocatorWhenBufferFromSharedHandl
osHandle handle = 1u;
this->mock->outputHandle = 2u;
AllocationProperties properties(rootDeviceIndex, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, mockDeviceBitfield);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false, false);
EXPECT_FALSE(graphicsAllocation->is32BitAllocation());
auto drmAllocation = static_cast<DrmAllocation *>(graphicsAllocation);
@@ -2367,7 +2367,7 @@ TEST_F(DrmMemoryManagerTest, givenNon32BitAddressingWhenBufferFromSharedHandleIs
osHandle handle = 1u;
this->mock->outputHandle = 2u;
AllocationProperties properties(rootDeviceIndex, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, mockDeviceBitfield);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, true);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, true, false);
auto drmAllocation = static_cast<DrmAllocation *>(graphicsAllocation);
EXPECT_FALSE(graphicsAllocation->is32BitAllocation());
EXPECT_EQ(1, lseekCalledCount);
@@ -2383,7 +2383,7 @@ TEST_F(DrmMemoryManagerTest, givenSharedHandleWhenAllocationIsCreatedAndIoctlPri
osHandle handle = 1u;
this->mock->outputHandle = 2u;
AllocationProperties properties(rootDeviceIndex, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, mockDeviceBitfield);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false, false);
EXPECT_EQ(nullptr, graphicsAllocation);
memoryManager->freeGraphicsMemory(graphicsAllocation);
}
@@ -2396,8 +2396,8 @@ TEST_F(DrmMemoryManagerTest, givenTwoGraphicsAllocationsThatShareTheSameBufferOb
osHandle sharedHandle = 1u;
AllocationProperties properties(rootDeviceIndex, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, mockDeviceBitfield);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
auto graphicsAllocation2 = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false, false);
auto graphicsAllocation2 = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false, false);
testedCsr->makeResident(*graphicsAllocation);
testedCsr->makeResident(*graphicsAllocation2);
@@ -2419,9 +2419,9 @@ TEST_F(DrmMemoryManagerTest, givenTwoGraphicsAllocationsThatDoesnShareTheSameBuf
osHandle sharedHandle = 1u;
AllocationProperties properties(rootDeviceIndex, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, {});
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false, false);
mock->outputHandle++;
auto graphicsAllocation2 = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
auto graphicsAllocation2 = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false, false);
testedCsr->makeResident(*graphicsAllocation);
testedCsr->makeResident(*graphicsAllocation2);
@@ -2701,7 +2701,7 @@ TEST_F(DrmMemoryManagerTest, givenSharedAllocationWithSmallerThenRealSizeWhenCre
osHandle sharedHandle = 1u;
AllocationProperties properties(rootDeviceIndex, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, {});
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false);
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false, false);
EXPECT_NE(nullptr, graphicsAllocation->getUnderlyingBuffer());
EXPECT_EQ(realSize, graphicsAllocation->getUnderlyingBufferSize());
@@ -3166,7 +3166,7 @@ TEST_F(DrmMemoryManagerBasic, givenMemoryManagerWhenCreateAllocationFromHandleIs
executionEnvironment));
auto osHandle = 1u;
AllocationProperties properties(rootDeviceIndex, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, {});
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false, false);
EXPECT_NE(nullptr, allocation);
EXPECT_EQ(MemoryPool::SystemCpuInaccessible, allocation->getMemoryPool());
memoryManager->freeGraphicsMemory(allocation);
@@ -3993,7 +3993,7 @@ TEST(DrmMemoryManagerFreeGraphicsMemoryUnreferenceTest, givenDrmMemoryManagerAnd
osHandle handle = 1u;
AllocationProperties properties(rootDeviceIndex, false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, {});
auto allocation = gmockDrmMemoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, false);
auto allocation = gmockDrmMemoryManager.createGraphicsAllocationFromSharedHandle(handle, properties, false, false);
ASSERT_NE(nullptr, allocation);
EXPECT_CALL(gmockDrmMemoryManager, unreference(::testing::_, false)).Times(1);

View File

@@ -479,7 +479,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationF
MemoryManagerCreate<WddmMemoryManager> mm(false, false, *executionEnvironment);
AllocationProperties properties(0, false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, {});
auto graphicsAllocation = mm.createGraphicsAllocationFromSharedHandle(ALLOCATION_HANDLE, properties, false);
auto graphicsAllocation = mm.createGraphicsAllocationFromSharedHandle(ALLOCATION_HANDLE, properties, false, false);
auto wddmAllocation = (WddmAllocation *)graphicsAllocation;
ASSERT_NE(nullptr, wddmAllocation);
@@ -516,7 +516,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationF
MemoryManagerCreate<WddmMemoryManager> mm(false, false, *executionEnvironment);
AllocationProperties properties(0, false, 4096, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, {});
auto graphicsAllocation = mm.createGraphicsAllocationFromSharedHandle(ALLOCATION_HANDLE, properties, false);
auto graphicsAllocation = mm.createGraphicsAllocationFromSharedHandle(ALLOCATION_HANDLE, properties, false, false);
auto wddmAllocation = (WddmAllocation *)graphicsAllocation;
ASSERT_NE(nullptr, wddmAllocation);

View File

@@ -263,7 +263,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenCreateAllocationFromHa
gdi->getOpenResourceArgOut().pOpenAllocationInfo = &allocationInfo;
AllocationProperties properties(0, false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false, false);
EXPECT_NE(nullptr, allocation);
EXPECT_EQ(MemoryPool::SystemCpuInaccessible, allocation->getMemoryPool());
memoryManager->freeGraphicsMemory(allocation);
@@ -288,7 +288,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenAllocationPropertiesWhenCreateAllocatio
AllocationProperties *propertiesArray[2] = {&propertiesBuffer, &propertiesImage};
for (auto properties : propertiesArray) {
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, *properties, false);
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, *properties, false, false);
EXPECT_NE(nullptr, allocation);
EXPECT_EQ(properties->allocationType, allocation->getAllocationType());
memoryManager->freeGraphicsMemory(allocation);
@@ -313,7 +313,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenCreateAllocationFromHandleAndMapCallFail
AllocationProperties properties(0, false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false, false);
EXPECT_EQ(nullptr, allocation);
EXPECT_EQ(1u, memoryManager->freeGraphicsMemoryImplCalled);
}
@@ -550,7 +550,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIs
AllocationProperties properties(0, false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, mockDeviceBitfield);
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false, false);
auto wddmAlloc = static_cast<WddmAllocation *>(gpuAllocation);
ASSERT_NE(nullptr, gpuAllocation);
EXPECT_EQ(RESOURCE_HANDLE, wddmAlloc->resourceHandle);
@@ -572,7 +572,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenAllocationCreatedFromSharedHandleIsDestr
AllocationProperties properties(0, false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(1, properties, false);
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(1, properties, false, false);
EXPECT_NE(nullptr, allocation);
memoryManager->setDeferredDeleter(nullptr);
@@ -627,7 +627,7 @@ TEST_F(WddmMemoryManagerTest, GivenForce32bitAddressingAndRequireSpecificBitness
AllocationProperties properties(0, false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, true);
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, true, false);
ASSERT_NE(nullptr, gpuAllocation);
if constexpr (is64bit) {
EXPECT_TRUE(gpuAllocation->is32BitAllocation());
@@ -649,7 +649,7 @@ TEST_F(WddmMemoryManagerTest, GivenForce32bitAddressingAndNotRequiredSpecificBit
memoryManager->setForce32BitAllocations(true);
AllocationProperties properties(0, false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false, false);
ASSERT_NE(nullptr, gpuAllocation);
EXPECT_FALSE(gpuAllocation->is32BitAllocation());
@@ -669,7 +669,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenFreeAllocFromSharedHandl
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
AllocationProperties properties(0, false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
auto gpuAllocation = (WddmAllocation *)memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
auto gpuAllocation = (WddmAllocation *)memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false, false);
EXPECT_NE(nullptr, gpuAllocation);
auto expectedDestroyHandle = gpuAllocation->resourceHandle;
EXPECT_NE(0u, expectedDestroyHandle);
@@ -691,7 +691,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerSizeZeroWhenCreateFromShared
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
AllocationProperties properties(0, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false, false);
ASSERT_NE(nullptr, gpuAllocation);
EXPECT_EQ(size, gpuAllocation->getUnderlyingBufferSize());
memoryManager->freeGraphicsMemory(gpuAllocation);
@@ -764,7 +764,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleFa
wddm->failOpenSharedHandle = true;
AllocationProperties properties(0, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false);
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, properties, false, false);
EXPECT_EQ(nullptr, gpuAllocation);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2020 Intel Corporation
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -29,8 +29,8 @@ class CreateFromGlTexture : public ::testing::Test {
TempMM() : OsAgnosticMemoryManager(*(new MockExecutionEnvironment(defaultHwInfo.get()))) {
mockExecutionEnvironment.reset(&executionEnvironment);
}
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness) override {
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(handle, properties, requireSpecificBitness);
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation) override {
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(handle, properties, requireSpecificBitness, isHostIpcAllocation);
if (handle == CreateFromGlTexture::mcsHandle) {
alloc->setDefaultGmm(forceMcsGmm);
} else {

View File

@@ -40,7 +40,7 @@ struct GlReusedBufferTests : public ::testing::Test {
class FailingMemoryManager : public MockMemoryManager {
public:
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness) override {
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation) override {
return nullptr;
}
};

View File

@@ -99,7 +99,7 @@ TEST_F(glSharingTests, givenMockGlWhenGlBufferIsCreatedThenMemObjectHasGlHandler
class FailingMemoryManager : public MockMemoryManager {
public:
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness) override {
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation) override {
return nullptr;
}
};

View File

@@ -27,8 +27,8 @@ class GlSharingTextureTests : public ::testing::Test {
class TempMM : public MockMemoryManager {
public:
using MockMemoryManager::MockMemoryManager;
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness) override {
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(handle, properties, requireSpecificBitness);
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation) override {
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(handle, properties, requireSpecificBitness, isHostIpcAllocation);
if (useForcedGmm) {
alloc->setDefaultGmm(forceGmm.get());
}
@@ -114,7 +114,7 @@ TEST_F(GlSharingTextureTests, givenMockGlWhen1dGlTextureIsCreatedThenMemObjectHa
class FailingMemoryManager : public MockMemoryManager {
public:
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness) override {
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation) override {
return nullptr;
}
};

View File

@@ -168,7 +168,7 @@ struct UnifiedSharingCreateAllocationTests : UnifiedSharingTestsWithMemoryManage
this->handle = toOsHandle(handle);
return nullptr;
}
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness) override {
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation) override {
this->createFromSharedHandleCalled = true;
this->handle = handle;
this->properties = std::make_unique<AllocationProperties>(properties);