Rename i915 dg1 specific files to exp
Related-To: NEO-6149 Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
parent
068832d178
commit
e8cb4f2634
|
@ -341,6 +341,7 @@ endif()
|
|||
|
||||
if(SUPPORT_DG1 AND "${BRANCH_TYPE}" STREQUAL "")
|
||||
get_filename_component(I915_INCLUDES_DIR "${NEO_SOURCE_DIR}/third_party/uapi/dg1" ABSOLUTE)
|
||||
set(I915_LOCAL_MEM_EXP TRUE)
|
||||
else()
|
||||
get_filename_component(I915_INCLUDES_DIR "${NEO_SOURCE_DIR}/third_party${BRANCH_DIR_SUFFIX}uapi" ABSOLUTE)
|
||||
endif()
|
||||
|
|
|
@ -45,9 +45,9 @@ set(IGDRCL_SRCS_tests_os_interface_linux
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_linux_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/self_lib_lin.cpp
|
||||
)
|
||||
if(SUPPORT_DG1 AND "${BRANCH_TYPE}" STREQUAL "")
|
||||
if(I915_LOCAL_MEM_EXP)
|
||||
list(APPEND IGDRCL_SRCS_tests_os_interface_linux
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_info_tests_dg1.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_info_tests_exp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_manager_localmem_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_mock_drm_tip.cpp
|
||||
)
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
#pragma once
|
||||
#include "opencl/test/unit_test/os_interface/linux/device_command_stream_fixture.h"
|
||||
|
||||
class DrmMockCustomDg1 : public DrmMockCustom {
|
||||
class DrmMockCustomExp : public DrmMockCustom {
|
||||
public:
|
||||
using Drm::memoryInfo;
|
||||
|
||||
class IoctlsDg1 {
|
||||
class IoctlsExp {
|
||||
public:
|
||||
void reset() {
|
||||
gemCreateExt = 0;
|
||||
|
@ -22,13 +22,13 @@ class DrmMockCustomDg1 : public DrmMockCustom {
|
|||
std::atomic<int32_t> gemMmapOffset;
|
||||
};
|
||||
|
||||
IoctlsDg1 ioctlDg1_cnt;
|
||||
IoctlsDg1 ioctlDg1_expected;
|
||||
IoctlsExp ioctlExp_cnt;
|
||||
IoctlsExp ioctlExp_expected;
|
||||
|
||||
void testIoctlsDg1() {
|
||||
void testIoctlsExp() {
|
||||
#define NEO_IOCTL_EXPECT_EQ(PARAM) \
|
||||
if (this->ioctlDg1_expected.PARAM >= 0) { \
|
||||
EXPECT_EQ(this->ioctlDg1_expected.PARAM, this->ioctlDg1_cnt.PARAM); \
|
||||
if (this->ioctlExp_expected.PARAM >= 0) { \
|
||||
EXPECT_EQ(this->ioctlExp_expected.PARAM, this->ioctlExp_cnt.PARAM); \
|
||||
}
|
||||
NEO_IOCTL_EXPECT_EQ(gemMmapOffset);
|
||||
#undef NEO_IOCTL_EXPECT_EQ
|
||||
|
@ -54,7 +54,7 @@ class DrmMockCustomDg1 : public DrmMockCustom {
|
|||
createExtSize = createExtParams->size;
|
||||
createExtHandle = createExtParams->handle;
|
||||
createExtExtensions = createExtParams->extensions;
|
||||
ioctlDg1_cnt.gemCreateExt++;
|
||||
ioctlExp_cnt.gemCreateExt++;
|
||||
} break;
|
||||
case DRM_IOCTL_I915_GEM_MMAP_OFFSET: {
|
||||
auto mmapOffsetParams = reinterpret_cast<drm_i915_gem_mmap_offset *>(arg);
|
||||
|
@ -62,7 +62,7 @@ class DrmMockCustomDg1 : public DrmMockCustom {
|
|||
mmapOffsetPad = mmapOffsetParams->pad;
|
||||
mmapOffsetOffset = mmapOffsetParams->offset;
|
||||
mmapOffsetFlags = mmapOffsetParams->flags;
|
||||
ioctlDg1_cnt.gemMmapOffset++;
|
||||
ioctlExp_cnt.gemMmapOffset++;
|
||||
if (failOnMmapOffset == true) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -80,8 +80,8 @@ class DrmMockCustomDg1 : public DrmMockCustom {
|
|||
|
||||
int ioctlGemCreateExt(unsigned long request, void *arg);
|
||||
|
||||
DrmMockCustomDg1() : DrmMockCustom() {
|
||||
ioctlDg1_cnt.reset();
|
||||
ioctlDg1_expected.reset();
|
||||
DrmMockCustomExp() : DrmMockCustom() {
|
||||
ioctlExp_cnt.reset();
|
||||
ioctlExp_expected.reset();
|
||||
}
|
||||
};
|
|
@ -11,7 +11,7 @@
|
|||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_mock_dg1.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_mock_exp.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
@ -22,7 +22,7 @@ TEST(MemoryInfo, givenMemoryRegionQuerySupportedWhenQueryingMemoryInfoThenMemory
|
|||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
|
||||
for (auto onDrmTip : {false, true}) {
|
||||
auto drm = std::make_unique<DrmMockDg1>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto drm = std::make_unique<DrmMockExp>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
ASSERT_NE(nullptr, drm);
|
||||
|
||||
drm->queryMemoryRegionOnDrmTip = onDrmTip;
|
||||
|
@ -40,7 +40,7 @@ TEST(MemoryInfo, givenMemoryRegionQuerySupportedWhenQueryingMemoryInfoThenMemory
|
|||
TEST(MemoryInfo, givenMemoryRegionQueryNotSupportedWhenQueryingMemoryInfoThenMemoryInfoIsNotCreated) {
|
||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
auto drm = std::make_unique<DrmMockDg1>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto drm = std::make_unique<DrmMockExp>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
ASSERT_NE(nullptr, drm);
|
||||
|
||||
drm->i915QuerySuccessCount = 0;
|
||||
|
@ -53,7 +53,7 @@ TEST(MemoryInfo, givenMemoryRegionQueryNotSupportedWhenQueryingMemoryInfoThenMem
|
|||
TEST(MemoryInfo, givenMemoryRegionQueryWhenQueryingFailsThenMemoryInfoIsNotCreated) {
|
||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
auto drm = std::make_unique<DrmMockDg1>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto drm = std::make_unique<DrmMockExp>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
ASSERT_NE(nullptr, drm);
|
||||
|
||||
drm->queryMemoryRegionInfoSuccessCount = 0;
|
||||
|
@ -61,14 +61,14 @@ TEST(MemoryInfo, givenMemoryRegionQueryWhenQueryingFailsThenMemoryInfoIsNotCreat
|
|||
EXPECT_EQ(nullptr, drm->getMemoryInfo());
|
||||
EXPECT_EQ(1u, drm->ioctlCallsCount);
|
||||
|
||||
drm = std::make_unique<DrmMockDg1>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
drm = std::make_unique<DrmMockExp>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
ASSERT_NE(nullptr, drm);
|
||||
drm->i915QuerySuccessCount = 1;
|
||||
drm->queryMemoryInfo();
|
||||
EXPECT_EQ(nullptr, drm->getMemoryInfo());
|
||||
EXPECT_EQ(2u, drm->ioctlCallsCount);
|
||||
|
||||
drm = std::make_unique<DrmMockDg1>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
drm = std::make_unique<DrmMockExp>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
ASSERT_NE(nullptr, drm);
|
||||
drm->queryMemoryRegionInfoSuccessCount = 1;
|
||||
drm->queryMemoryInfo();
|
||||
|
@ -236,7 +236,7 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemWithExtensionsThenRetu
|
|||
|
||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
auto drm = std::make_unique<DrmMockDg1>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto drm = std::make_unique<DrmMockExp>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto memoryInfo = std::make_unique<MemoryInfoImpl>(regionInfo, 2);
|
||||
ASSERT_NE(nullptr, memoryInfo);
|
||||
|
||||
|
@ -262,7 +262,7 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemExtWithSingleRegionThe
|
|||
|
||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
auto drm = std::make_unique<DrmMockDg1>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto drm = std::make_unique<DrmMockExp>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
uint32_t handle = 0;
|
||||
auto ret = memoryInfo->createGemExtWithSingleRegion(drm.get(), 1, 1024, handle);
|
||||
EXPECT_EQ(1u, handle);
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests_dg1.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_mock_dg1.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests_exp.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_mock_exp.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_mock_memory_info.h"
|
||||
#include "test.h"
|
||||
|
||||
|
@ -31,14 +31,14 @@ BufferObject *createBufferObjectInMemoryRegion(Drm *drm, uint64_t gpuAddress, si
|
|||
|
||||
class DrmMemoryManagerLocalMemoryTest : public ::testing::Test {
|
||||
public:
|
||||
DrmMockDg1 *mock;
|
||||
DrmMockExp *mock;
|
||||
|
||||
void SetUp() override {
|
||||
const bool localMemoryEnabled = true;
|
||||
executionEnvironment = new ExecutionEnvironment;
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(defaultHwInfo.get());
|
||||
mock = new DrmMockDg1(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]);
|
||||
mock = new DrmMockExp(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]);
|
||||
mock->memoryInfo.reset(new MockMemoryInfo());
|
||||
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mock));
|
||||
|
@ -66,14 +66,14 @@ class DrmMemoryManagerLocalMemoryTest : public ::testing::Test {
|
|||
|
||||
class DrmMemoryManagerLocalMemoryWithCustomMockTest : public ::testing::Test {
|
||||
public:
|
||||
DrmMockCustomDg1 *mock;
|
||||
DrmMockCustomExp *mock;
|
||||
|
||||
void SetUp() override {
|
||||
const bool localMemoryEnabled = true;
|
||||
executionEnvironment = new ExecutionEnvironment;
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
|
||||
mock = new DrmMockCustomDg1();
|
||||
mock = new DrmMockCustomExp();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mock));
|
||||
|
||||
|
@ -206,7 +206,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMultiRootDeviceEnvironmentAndMemory
|
|||
executionEnvironment->prepareRootDeviceEnvironments(rootDevicesNumber);
|
||||
for (uint32_t i = 0; i < rootDevicesNumber; i++) {
|
||||
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get());
|
||||
auto mock = new DrmMockDg1(*executionEnvironment->rootDeviceEnvironments[i]);
|
||||
auto mock = new DrmMockExp(*executionEnvironment->rootDeviceEnvironments[i]);
|
||||
|
||||
drm_i915_memory_region_info regionInfo[2] = {};
|
||||
regionInfo[0].region = {I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
|
@ -225,7 +225,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMultiRootDeviceEnvironmentAndMemory
|
|||
size_t size = 4096u;
|
||||
AllocationProperties properties(rootDeviceIndex, true, size, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false, {});
|
||||
|
||||
static_cast<DrmMockDg1 *>(executionEnvironment->rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Drm>())->outputFd = 7;
|
||||
static_cast<DrmMockExp *>(executionEnvironment->rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Drm>())->outputFd = 7;
|
||||
|
||||
auto ptr = memoryManager->createMultiGraphicsAllocationInSystemMemoryPool(rootDeviceIndices, properties, multiGraphics);
|
||||
|
||||
|
@ -233,7 +233,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMultiRootDeviceEnvironmentAndMemory
|
|||
EXPECT_NE(static_cast<DrmAllocation *>(multiGraphics.getDefaultGraphicsAllocation())->getMmapPtr(), nullptr);
|
||||
for (uint32_t i = 0; i < rootDevicesNumber; i++) {
|
||||
if (i != 0) {
|
||||
EXPECT_EQ(static_cast<DrmMockDg1 *>(executionEnvironment->rootDeviceEnvironments[i]->osInterface->getDriverModel()->as<Drm>())->inputFd, 7);
|
||||
EXPECT_EQ(static_cast<DrmMockExp *>(executionEnvironment->rootDeviceEnvironments[i]->osInterface->getDriverModel()->as<Drm>())->inputFd, 7);
|
||||
}
|
||||
EXPECT_NE(multiGraphics.getGraphicsAllocation(i), nullptr);
|
||||
memoryManager->freeGraphicsMemory(multiGraphics.getGraphicsAllocation(i));
|
||||
|
@ -251,7 +251,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMultiRootDeviceEnvironmentAndMemory
|
|||
executionEnvironment->prepareRootDeviceEnvironments(rootDevicesNumber);
|
||||
for (uint32_t i = 0; i < rootDevicesNumber; i++) {
|
||||
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get());
|
||||
auto mock = new DrmMockDg1(*executionEnvironment->rootDeviceEnvironments[i]);
|
||||
auto mock = new DrmMockExp(*executionEnvironment->rootDeviceEnvironments[i]);
|
||||
|
||||
drm_i915_memory_region_info regionInfo[2] = {};
|
||||
regionInfo[0].region = {I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
|
@ -310,7 +310,7 @@ TEST_F(DrmMemoryManagerUsmSharedHandleTest, givenMultiRootDeviceEnvironmentAndMe
|
|||
|
||||
executionEnvironment->prepareRootDeviceEnvironments(rootDevicesNumber);
|
||||
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(defaultHwInfo.get());
|
||||
auto mock = new DrmMockDg1(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]);
|
||||
auto mock = new DrmMockExp(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]);
|
||||
|
||||
drm_i915_memory_region_info regionInfo[2] = {};
|
||||
regionInfo[0].region = {I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
|
@ -346,7 +346,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMultiRootDeviceEnvironmentAndNoMemo
|
|||
executionEnvironment->prepareRootDeviceEnvironments(rootDevicesNumber);
|
||||
for (uint32_t i = 0; i < rootDevicesNumber; i++) {
|
||||
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get());
|
||||
auto mock = new DrmMockDg1(*executionEnvironment->rootDeviceEnvironments[i]);
|
||||
auto mock = new DrmMockExp(*executionEnvironment->rootDeviceEnvironments[i]);
|
||||
|
||||
mock->memoryInfo.reset(nullptr);
|
||||
mock->ioctlCallsCount = 0;
|
||||
|
@ -521,14 +521,14 @@ class DrmMemoryManagerLocalMemoryMemoryBankMock : public TestedDrmMemoryManager
|
|||
|
||||
class DrmMemoryManagerLocalMemoryMemoryBankTest : public ::testing::Test {
|
||||
public:
|
||||
DrmMockDg1 *mock;
|
||||
DrmMockExp *mock;
|
||||
|
||||
void SetUp() override {
|
||||
const bool localMemoryEnabled = true;
|
||||
executionEnvironment = new ExecutionEnvironment;
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(defaultHwInfo.get());
|
||||
mock = new DrmMockDg1(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]);
|
||||
mock = new DrmMockExp(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]);
|
||||
mock->memoryInfo.reset(new MockMemoryInfo());
|
||||
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mock));
|
||||
|
@ -1216,7 +1216,7 @@ TEST_F(DrmMemoryManagerLocalMemoryWithCustomMockTest, givenDrmMemoryManagerWithL
|
|||
EXPECT_EQ(nullptr, bo.peekLockedAddress());
|
||||
}
|
||||
|
||||
using DrmMemoryManagerFailInjectionTest = Test<DrmMemoryManagerFixtureDg1>;
|
||||
using DrmMemoryManagerFailInjectionTest = Test<DrmMemoryManagerFixtureExp>;
|
||||
|
||||
TEST_F(DrmMemoryManagerFailInjectionTest, givenEnabledLocalMemoryWhenNewFailsThenAllocateInDevicePoolReturnsStatusErrorAndNullallocation) {
|
||||
mock->ioctl_expected.total = -1; //don't care
|
||||
|
@ -1362,14 +1362,14 @@ TEST_F(DrmMemoryManagerCopyMemoryToAllocationTest, givenDrmMemoryManagerWhenCopy
|
|||
drmMemoryManger.freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
using DrmMemoryManagerTestDg1 = Test<DrmMemoryManagerFixtureDg1>;
|
||||
using DrmMemoryManagerTestExp = Test<DrmMemoryManagerFixtureExp>;
|
||||
|
||||
TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryThenCallIoctlGemMapOffsetAndReturnLockedPtr) {
|
||||
mockDg1->ioctlDg1_expected.gemCreateExt = 1;
|
||||
mockDg1->ioctl_expected.gemWait = 1;
|
||||
mockDg1->ioctl_expected.gemClose = 1;
|
||||
mockDg1->ioctlDg1_expected.gemMmapOffset = 1;
|
||||
mockDg1->memoryInfo.reset(new MockMemoryInfo());
|
||||
TEST_F(DrmMemoryManagerTestExp, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryThenCallIoctlGemMapOffsetAndReturnLockedPtr) {
|
||||
mockExp->ioctlExp_expected.gemCreateExt = 1;
|
||||
mockExp->ioctl_expected.gemWait = 1;
|
||||
mockExp->ioctl_expected.gemClose = 1;
|
||||
mockExp->ioctlExp_expected.gemMmapOffset = 1;
|
||||
mockExp->memoryInfo.reset(new MockMemoryInfo());
|
||||
|
||||
AllocationData allocData;
|
||||
allocData.allFlags = 0;
|
||||
|
@ -1389,10 +1389,10 @@ TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAll
|
|||
auto drmAllocation = static_cast<DrmAllocation *>(allocation);
|
||||
EXPECT_NE(nullptr, drmAllocation->getBO()->peekLockedAddress());
|
||||
|
||||
EXPECT_EQ(static_cast<uint32_t>(drmAllocation->getBO()->peekHandle()), mockDg1->mmapOffsetHandle);
|
||||
EXPECT_EQ(0u, mockDg1->mmapOffsetPad);
|
||||
EXPECT_EQ(0u, mockDg1->mmapOffsetOffset);
|
||||
EXPECT_EQ(4u, mockDg1->mmapOffsetFlags);
|
||||
EXPECT_EQ(static_cast<uint32_t>(drmAllocation->getBO()->peekHandle()), mockExp->mmapOffsetHandle);
|
||||
EXPECT_EQ(0u, mockExp->mmapOffsetPad);
|
||||
EXPECT_EQ(0u, mockExp->mmapOffsetOffset);
|
||||
EXPECT_EQ(4u, mockExp->mmapOffsetFlags);
|
||||
|
||||
memoryManager->unlockResource(allocation);
|
||||
EXPECT_EQ(nullptr, drmAllocation->getBO()->peekLockedAddress());
|
||||
|
@ -1400,12 +1400,12 @@ TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAll
|
|||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryButFailsOnMmapThenReturnNullPtr) {
|
||||
mockDg1->ioctlDg1_expected.gemMmapOffset = 2;
|
||||
this->ioctlResExt = {mockDg1->ioctl_cnt.total, -1};
|
||||
mockDg1->ioctl_res_ext = &ioctlResExt;
|
||||
TEST_F(DrmMemoryManagerTestExp, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryButFailsOnMmapThenReturnNullPtr) {
|
||||
mockExp->ioctlExp_expected.gemMmapOffset = 2;
|
||||
this->ioctlResExt = {mockExp->ioctl_cnt.total, -1};
|
||||
mockExp->ioctl_res_ext = &ioctlResExt;
|
||||
|
||||
BufferObject bo(mockDg1, 1, 0, 0);
|
||||
BufferObject bo(mockExp, 1, 0, 0);
|
||||
DrmAllocation drmAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, &bo, nullptr, 0u, 0u, MemoryPool::LocalMemory);
|
||||
EXPECT_NE(nullptr, drmAllocation.getBO());
|
||||
|
||||
|
@ -1413,15 +1413,15 @@ TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAll
|
|||
EXPECT_EQ(nullptr, ptr);
|
||||
|
||||
memoryManager->unlockResource(&drmAllocation);
|
||||
mockDg1->ioctl_res_ext = &mockDg1->NONE;
|
||||
mockExp->ioctl_res_ext = &mockExp->NONE;
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryButFailsOnIoctlMmapFunctionOffsetThenReturnNullPtr) {
|
||||
mockDg1->ioctlDg1_expected.gemMmapOffset = 2;
|
||||
mockDg1->returnIoctlExtraErrorValue = true;
|
||||
mockDg1->failOnMmapOffset = true;
|
||||
TEST_F(DrmMemoryManagerTestExp, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryButFailsOnIoctlMmapFunctionOffsetThenReturnNullPtr) {
|
||||
mockExp->ioctlExp_expected.gemMmapOffset = 2;
|
||||
mockExp->returnIoctlExtraErrorValue = true;
|
||||
mockExp->failOnMmapOffset = true;
|
||||
|
||||
BufferObject bo(mockDg1, 1, 0, 0);
|
||||
BufferObject bo(mockExp, 1, 0, 0);
|
||||
DrmAllocation drmAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, &bo, nullptr, 0u, 0u, MemoryPool::LocalMemory);
|
||||
EXPECT_NE(nullptr, drmAllocation.getBO());
|
||||
|
||||
|
@ -1429,10 +1429,10 @@ TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAll
|
|||
EXPECT_EQ(nullptr, ptr);
|
||||
|
||||
memoryManager->unlockResource(&drmAllocation);
|
||||
mockDg1->ioctl_res_ext = &mockDg1->NONE;
|
||||
mockExp->ioctl_res_ext = &mockExp->NONE;
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryButBufferObjectIsNullThenReturnNullPtr) {
|
||||
TEST_F(DrmMemoryManagerTestExp, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryButBufferObjectIsNullThenReturnNullPtr) {
|
||||
DrmAllocation drmAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, nullptr, 0u, 0u, MemoryPool::LocalMemory);
|
||||
|
||||
auto ptr = memoryManager->lockResource(&drmAllocation);
|
||||
|
@ -1441,7 +1441,7 @@ TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAll
|
|||
memoryManager->unlockResource(&drmAllocation);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenGetLocalMemorySizeIsCalledForMemoryInfoThenReturnMemoryRegionSize) {
|
||||
TEST_F(DrmMemoryManagerTestExp, givenDrmMemoryManagerWhenGetLocalMemorySizeIsCalledForMemoryInfoThenReturnMemoryRegionSize) {
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
|
||||
auto drm = new DrmMock(*executionEnvironment.rootDeviceEnvironments[0]);
|
||||
|
@ -1454,7 +1454,7 @@ TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenGetLocalMemorySizeIsCal
|
|||
EXPECT_EQ(memoryInfo->getMemoryRegionSize(MemoryBanks::getBankForLocalMemory(0)), memoryManager.getLocalMemorySize(0u, 0xF));
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenGetLocalMemorySizeIsCalledForMemoryInfoAndInvalidDeviceBitfieldThenReturnZero) {
|
||||
TEST_F(DrmMemoryManagerTestExp, givenDrmMemoryManagerWhenGetLocalMemorySizeIsCalledForMemoryInfoAndInvalidDeviceBitfieldThenReturnZero) {
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
|
||||
auto drm = new DrmMock(*executionEnvironment.rootDeviceEnvironments[0]);
|
||||
|
@ -1467,7 +1467,7 @@ TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenGetLocalMemorySizeIsCal
|
|||
EXPECT_EQ(0u, memoryManager.getLocalMemorySize(0u, 0u));
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTestDg1, givenDrmMemoryManagerWhenGetLocalMemorySizeIsCalledButMemoryInfoIsNotAvailableThenSizeZeroIsReturned) {
|
||||
TEST_F(DrmMemoryManagerTestExp, givenDrmMemoryManagerWhenGetLocalMemorySizeIsCalledButMemoryInfoIsNotAvailableThenSizeZeroIsReturned) {
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
|
||||
auto drm = new DrmMock(*executionEnvironment.rootDeviceEnvironments[0]);
|
||||
|
|
|
@ -9,26 +9,26 @@
|
|||
#include "shared/test/common/helpers/ult_hw_config.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
|
||||
#include "opencl/test/unit_test/os_interface/linux/device_command_stream_fixture_dg1.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/device_command_stream_fixture_exp.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class DrmMemoryManagerFixtureDg1 : public DrmMemoryManagerFixture {
|
||||
class DrmMemoryManagerFixtureExp : public DrmMemoryManagerFixture {
|
||||
public:
|
||||
DrmMockCustomDg1 *mockDg1;
|
||||
DrmMockCustomExp *mockExp;
|
||||
|
||||
void SetUp() override {
|
||||
backup = std::make_unique<VariableBackup<UltHwConfig>>(&ultHwConfig);
|
||||
ultHwConfig.csrBaseCallCreatePreemption = false;
|
||||
|
||||
MemoryManagementFixture::SetUp();
|
||||
mockDg1 = new DrmMockCustomDg1;
|
||||
DrmMemoryManagerFixture::SetUp(mockDg1, true);
|
||||
mockExp = new DrmMockCustomExp;
|
||||
DrmMemoryManagerFixture::SetUp(mockExp, true);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
mockDg1->testIoctlsDg1();
|
||||
mockExp->testIoctlsExp();
|
||||
DrmMemoryManagerFixture::TearDown();
|
||||
}
|
||||
std::unique_ptr<VariableBackup<UltHwConfig>> backup;
|
|
@ -5,14 +5,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/os_interface/linux/device_command_stream_fixture_dg1.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_mock_dg1.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/device_command_stream_fixture_exp.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_mock_exp.h"
|
||||
|
||||
// clang-format off
|
||||
#include "shared/source/os_interface/linux/drm_tip.h"
|
||||
// clang-format on
|
||||
|
||||
void DrmMockDg1::handleQueryItemOnDrmTip(drm_i915_query_item *queryItem) {
|
||||
void DrmMockExp::handleQueryItemOnDrmTip(drm_i915_query_item *queryItem) {
|
||||
switch (queryItem->query_id) {
|
||||
case DRM_I915_QUERY_MEMORY_REGIONS:
|
||||
if (queryMemoryRegionInfoSuccessCount == 0) {
|
||||
|
@ -41,13 +41,13 @@ void DrmMockDg1::handleQueryItemOnDrmTip(drm_i915_query_item *queryItem) {
|
|||
}
|
||||
}
|
||||
|
||||
int DrmMockCustomDg1::ioctlGemCreateExt(unsigned long request, void *arg) {
|
||||
int DrmMockCustomExp::ioctlGemCreateExt(unsigned long request, void *arg) {
|
||||
if (request == DRM_IOCTL_I915_GEM_CREATE_EXT) {
|
||||
auto createExtParams = reinterpret_cast<DRM_TIP::drm_i915_gem_create_ext *>(arg);
|
||||
createExtSize = createExtParams->size;
|
||||
createExtHandle = createExtParams->handle;
|
||||
createExtExtensions = createExtParams->extensions;
|
||||
ioctlDg1_cnt.gemCreateExt++;
|
||||
ioctlExp_cnt.gemCreateExt++;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
|
||||
using namespace NEO;
|
||||
|
||||
class DrmMockDg1 : public DrmMock {
|
||||
class DrmMockExp : public DrmMock {
|
||||
public:
|
||||
DrmMockDg1(RootDeviceEnvironment &rootDeviceEnvironment) : DrmMockDg1(rootDeviceEnvironment, defaultHwInfo.get()) {}
|
||||
DrmMockDg1(RootDeviceEnvironment &rootDeviceEnvironment, const HardwareInfo *inputHwInfo) : DrmMock(rootDeviceEnvironment) {
|
||||
DrmMockExp(RootDeviceEnvironment &rootDeviceEnvironment) : DrmMockExp(rootDeviceEnvironment, defaultHwInfo.get()) {}
|
||||
DrmMockExp(RootDeviceEnvironment &rootDeviceEnvironment, const HardwareInfo *inputHwInfo) : DrmMock(rootDeviceEnvironment) {
|
||||
rootDeviceEnvironment.setHwInfo(inputHwInfo);
|
||||
}
|
||||
|
|
@ -91,11 +91,11 @@ else()
|
|||
)
|
||||
endif()
|
||||
|
||||
if(SUPPORT_DG1 AND "${BRANCH_TYPE}" STREQUAL "")
|
||||
if(I915_LOCAL_MEM_EXP)
|
||||
list(APPEND NEO_CORE_OS_INTERFACE_LINUX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_manager_local_memory_dg1.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_manager_create_multi_host_allocation_dg1.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_query_dg1.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_manager_local_memory_exp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_manager_create_multi_host_allocation_exp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_query_exp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_tip.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/memory_info_impl.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gem_create_ext_memory_regions.cpp
|
||||
|
|
Loading…
Reference in New Issue