Move AllocationType enum out of GraphicsAllocation class

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2022-02-04 13:59:01 +00:00
committed by Compute-Runtime-Automation
parent fd27098194
commit 4b0d986876
262 changed files with 2075 additions and 2063 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2021 Intel Corporation
* Copyright (C) 2019-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -58,12 +58,12 @@ struct UnifiedSharingContextFixture : ::testing::Test {
template <bool validMemoryManager>
struct UnifiedSharingMockMemoryManager : MockMemoryManager {
using MockMemoryManager::MockMemoryManager;
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, GraphicsAllocation::AllocationType allocType) override {
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, AllocationType allocType) override {
if (!validMemoryManager) {
return nullptr;
}
auto graphicsAllocation = createMemoryAllocation(GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, nullptr, reinterpret_cast<void *>(1), 1,
auto graphicsAllocation = createMemoryAllocation(AllocationType::INTERNAL_HOST_MEMORY, nullptr, reinterpret_cast<void *>(1), 1,
4096u, reinterpret_cast<uint64_t>(handle), MemoryPool::SystemCpuInaccessible,
rootDeviceIndex, false, false, false);
graphicsAllocation->setSharedHandle(static_cast<osHandle>(reinterpret_cast<uint64_t>(handle)));

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2021 Intel Corporation
* Copyright (C) 2019-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -105,8 +105,8 @@ class MockHwInfoConfig : public HwInfoConfigHw<IGFX_UNKNOWN> {
};
struct MemoryManagerReturningCompressedAllocations : UnifiedSharingMockMemoryManager<true> {
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, GraphicsAllocation::AllocationType allocType) override {
auto allocation = UnifiedSharingMockMemoryManager<true>::createGraphicsAllocationFromNTHandle(handle, rootDeviceIndex, GraphicsAllocation::AllocationType::SHARED_IMAGE);
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, AllocationType allocType) override {
auto allocation = UnifiedSharingMockMemoryManager<true>::createGraphicsAllocationFromNTHandle(handle, rootDeviceIndex, AllocationType::SHARED_IMAGE);
auto gmm = allocation->getDefaultGmm();
auto mockGmmResourceInfo = std::make_unique<MockGmmResourceInfo>(gmm->gmmResourceInfo->peekGmmResourceInfo());

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2021 Intel Corporation
* Copyright (C) 2019-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -164,7 +164,7 @@ struct UnifiedSharingCreateAllocationTests : UnifiedSharingTestsWithMemoryManage
struct MemoryManagerCheckingAllocationMethod : MockMemoryManager {
using MockMemoryManager::MockMemoryManager;
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, GraphicsAllocation::AllocationType allocType) override {
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, AllocationType allocType) override {
this->createFromNTHandleCalled = true;
this->handle = toOsHandle(handle);
return nullptr;
@ -200,7 +200,7 @@ TEST_F(UnifiedSharingCreateAllocationTests, givenWindowsNtHandleWhenCreateGraphi
UnifiedSharingMemoryDescription desc{};
desc.handle = reinterpret_cast<void *>(0x1234);
desc.type = UnifiedSharingHandleType::Win32Nt;
GraphicsAllocation::AllocationType allocationType = GraphicsAllocation::AllocationType::SHARED_IMAGE;
AllocationType allocationType = AllocationType::SHARED_IMAGE;
MockSharingHandler::createGraphicsAllocation(this->context.get(), desc, allocationType);
EXPECT_TRUE(memoryManager->createFromNTHandleCalled);
@ -212,7 +212,7 @@ TEST_F(UnifiedSharingCreateAllocationTests, givenWindowsSharedHandleWhenCreateGr
UnifiedSharingMemoryDescription desc{};
desc.handle = reinterpret_cast<void *>(0x1234);
desc.type = UnifiedSharingHandleType::Win32Shared;
GraphicsAllocation::AllocationType allocationType = GraphicsAllocation::AllocationType::SHARED_IMAGE;
AllocationType allocationType = AllocationType::SHARED_IMAGE;
MockSharingHandler::createGraphicsAllocation(this->context.get(), desc, allocationType);
EXPECT_FALSE(memoryManager->createFromNTHandleCalled);
@ -226,7 +226,7 @@ TEST_F(UnifiedSharingCreateAllocationTests, givenLinuxSharedHandleWhenCreateGrap
UnifiedSharingMemoryDescription desc{};
desc.handle = reinterpret_cast<void *>(0x1234);
desc.type = UnifiedSharingHandleType::LinuxFd;
GraphicsAllocation::AllocationType allocationType = GraphicsAllocation::AllocationType::SHARED_IMAGE;
AllocationType allocationType = AllocationType::SHARED_IMAGE;
MockSharingHandler::createGraphicsAllocation(this->context.get(), desc, allocationType);
EXPECT_FALSE(memoryManager->createFromNTHandleCalled);