mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 21:18:24 +08:00
Use drm tip kernel headers as default 1/2
Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
a3c3fe18ce
commit
8fdfc3b053
@@ -40,6 +40,7 @@ set(IGDRCL_SRCS_tests_os_interface_linux
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_time_test.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_linux_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/self_lib_lin.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}local_memory_helper_default_tests.cpp
|
||||
)
|
||||
if(I915_LOCAL_MEM_EXP)
|
||||
list(APPEND IGDRCL_SRCS_tests_os_interface_linux
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_mock_exp.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
@@ -228,7 +229,9 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenGettingMemoryRegionClassAndInstan
|
||||
EXPECT_EQ(32 * GB, regionSize);
|
||||
}
|
||||
|
||||
TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemWithExtensionsThenReturnCorrectValues) {
|
||||
using MemoryInfoTest = ::testing::Test;
|
||||
|
||||
HWTEST2_F(MemoryInfoTest, givenMemoryInfoWithRegionsWhenCreatingGemWithExtensionsThenReturnCorrectValues, NonDefaultIoctlsSupported) {
|
||||
drm_i915_memory_region_info regionInfo[2] = {};
|
||||
regionInfo[0].region = {I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
regionInfo[0].probed_size = 8 * GB;
|
||||
@@ -249,7 +252,7 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemWithExtensionsThenRetu
|
||||
EXPECT_EQ(1024u, drm->createExt.size);
|
||||
}
|
||||
|
||||
TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemExtWithSingleRegionThenReturnCorrectValues) {
|
||||
HWTEST2_F(MemoryInfoTest, givenMemoryInfoWithRegionsWhenCreatingGemExtWithSingleRegionThenReturnCorrectValues, NonDefaultIoctlsSupported) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.EnableLocalMemory.set(1);
|
||||
drm_i915_memory_region_info regionInfo[2] = {};
|
||||
|
||||
@@ -130,7 +130,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenDrmWhenRetrieveMmapOffsetForBufferO
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerLocalMemoryTest, givenDrmMemoryManagerWhenCreateBufferObjectInMemoryRegionIsCalledThenBufferObjectWithAGivenGpuAddressAndSizeIsCreatedAndAllocatedInASpecifiedMemoryRegion) {
|
||||
HWTEST2_F(DrmMemoryManagerLocalMemoryTest, givenDrmMemoryManagerWhenCreateBufferObjectInMemoryRegionIsCalledThenBufferObjectWithAGivenGpuAddressAndSizeIsCreatedAndAllocatedInASpecifiedMemoryRegion, NonDefaultIoctlsSupported) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.EnableLocalMemory.set(1);
|
||||
drm_i915_memory_region_info regionInfo[2] = {};
|
||||
@@ -162,7 +162,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenDrmMemoryManagerWhenCreateBufferObj
|
||||
EXPECT_EQ(size, bo->peekSize());
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerLocalMemoryTest, givenMultiRootDeviceEnvironmentAndMemoryInfoWhenCreateMultiGraphicsAllocationThenImportAndExportIoctlAreUsed) {
|
||||
HWTEST2_F(DrmMemoryManagerLocalMemoryTest, givenMultiRootDeviceEnvironmentAndMemoryInfoWhenCreateMultiGraphicsAllocationThenImportAndExportIoctlAreUsed, NonDefaultIoctlsSupported) {
|
||||
uint32_t rootDevicesNumber = 3u;
|
||||
MultiGraphicsAllocation multiGraphics(rootDevicesNumber);
|
||||
std::vector<uint32_t> rootDeviceIndices;
|
||||
@@ -340,7 +340,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMultiRootDeviceEnvironmentAndNoMemo
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(osInterface);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerLocalMemoryTest, givenMemoryInfoWhenAllocateWithAlignmentThenGemCreateExtIsUsed) {
|
||||
HWTEST2_F(DrmMemoryManagerLocalMemoryTest, givenMemoryInfoWhenAllocateWithAlignmentThenGemCreateExtIsUsed, NonDefaultIoctlsSupported) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.EnableBOMmapCreate.set(-1);
|
||||
|
||||
@@ -514,7 +514,7 @@ TEST_F(DrmMemoryManagerLocalMemoryMemoryBankTest, givenDeviceMemoryWhenGraphicsA
|
||||
EXPECT_TRUE(memoryManager->memoryBankIsOne);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerLocalMemoryTest, givenCpuAccessRequiredWhenAllocatingInDevicePoolThenAllocationIsLocked) {
|
||||
HWTEST2_F(DrmMemoryManagerLocalMemoryTest, givenCpuAccessRequiredWhenAllocatingInDevicePoolThenAllocationIsLocked, NonDefaultIoctlsSupported) {
|
||||
MemoryManager::AllocationStatus status = MemoryManager::AllocationStatus::Success;
|
||||
AllocationData allocData;
|
||||
allocData.allFlags = 0;
|
||||
@@ -536,7 +536,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenCpuAccessRequiredWhenAllocatingInDe
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerLocalMemoryTest, givenWriteCombinedAllocationWhenAllocatingInDevicePoolThenAllocationIsLockedAndLockedPtrIsUsedAsGpuAddress) {
|
||||
HWTEST2_F(DrmMemoryManagerLocalMemoryTest, givenWriteCombinedAllocationWhenAllocatingInDevicePoolThenAllocationIsLockedAndLockedPtrIsUsedAsGpuAddress, NonDefaultIoctlsSupported) {
|
||||
MemoryManager::AllocationStatus status = MemoryManager::AllocationStatus::Success;
|
||||
AllocationData allocData{};
|
||||
allocData.size = MemoryConstants::pageSize;
|
||||
@@ -571,7 +571,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenWriteCombinedAllocationWhenAllocati
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerLocalMemoryTest, givenSupportedTypeWhenAllocatingInDevicePoolThenSuccessStatusAndNonNullPtrIsReturned) {
|
||||
HWTEST2_F(DrmMemoryManagerLocalMemoryTest, givenSupportedTypeWhenAllocatingInDevicePoolThenSuccessStatusAndNonNullPtrIsReturned, NonDefaultIoctlsSupported) {
|
||||
MemoryManager::AllocationStatus status = MemoryManager::AllocationStatus::Success;
|
||||
AllocationData allocData;
|
||||
allocData.allFlags = 0;
|
||||
@@ -670,7 +670,7 @@ TEST_F(DrmMemoryManagerLocalMemoryWithCustomMockTest, givenDrmMemoryManagerWithL
|
||||
|
||||
using DrmMemoryManagerFailInjectionTest = Test<DrmMemoryManagerFixtureExp>;
|
||||
|
||||
TEST_F(DrmMemoryManagerFailInjectionTest, givenEnabledLocalMemoryWhenNewFailsThenAllocateInDevicePoolReturnsStatusErrorAndNullallocation) {
|
||||
HWTEST2_F(DrmMemoryManagerFailInjectionTest, givenEnabledLocalMemoryWhenNewFailsThenAllocateInDevicePoolReturnsStatusErrorAndNullallocation, NonDefaultIoctlsSupported) {
|
||||
mock->ioctl_expected.total = -1; //don't care
|
||||
class MockGfxPartition : public GfxPartition {
|
||||
public:
|
||||
@@ -749,7 +749,7 @@ struct DrmMemoryManagerToTestCopyMemoryToAllocation : public DrmMemoryManager {
|
||||
size_t lockedLocalMemorySize = 0;
|
||||
};
|
||||
|
||||
TEST_F(DrmMemoryManagerCopyMemoryToAllocationTest, givenDrmMemoryManagerWhenCopyMemoryToAllocationReturnsSuccessThenAllocationIsFilledWithCorrectData) {
|
||||
HWTEST2_F(DrmMemoryManagerCopyMemoryToAllocationTest, givenDrmMemoryManagerWhenCopyMemoryToAllocationReturnsSuccessThenAllocationIsFilledWithCorrectData, NonDefaultIoctlsSupported) {
|
||||
size_t offset = 3;
|
||||
size_t sourceAllocationSize = MemoryConstants::pageSize;
|
||||
size_t destinationAllocationSize = sourceAllocationSize + offset;
|
||||
@@ -776,7 +776,7 @@ TEST_F(DrmMemoryManagerCopyMemoryToAllocationTest, givenDrmMemoryManagerWhenCopy
|
||||
drmMemoryManger.freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerCopyMemoryToAllocationTest, givenDrmMemoryManagerWhenCopyMemoryToAllocationFailsToLockResourceThenItReturnsFalse) {
|
||||
HWTEST2_F(DrmMemoryManagerCopyMemoryToAllocationTest, givenDrmMemoryManagerWhenCopyMemoryToAllocationFailsToLockResourceThenItReturnsFalse, NonDefaultIoctlsSupported) {
|
||||
DrmMemoryManagerToTestCopyMemoryToAllocation drmMemoryManger(*executionEnvironment, true, 0);
|
||||
std::vector<uint8_t> dataToCopy(MemoryConstants::pageSize, 1u);
|
||||
|
||||
@@ -818,7 +818,7 @@ TEST_F(DrmMemoryManagerCopyMemoryToAllocationTest, givenDrmMemoryManagerWhenCopy
|
||||
|
||||
using DrmMemoryManagerTestExp = Test<DrmMemoryManagerFixtureExp>;
|
||||
|
||||
TEST_F(DrmMemoryManagerTestExp, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryThenCallIoctlGemMapOffsetAndReturnLockedPtr) {
|
||||
HWTEST2_F(DrmMemoryManagerTestExp, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryThenCallIoctlGemMapOffsetAndReturnLockedPtr, NonDefaultIoctlsSupported) {
|
||||
mockExp->ioctlExp_expected.gemCreateExt = 1;
|
||||
mockExp->ioctl_expected.gemWait = 1;
|
||||
mockExp->ioctl_expected.gemClose = 1;
|
||||
@@ -942,7 +942,7 @@ TEST_F(DrmMemoryManagerTestExp, givenDrmMemoryManagerWhenGetLocalMemorySizeIsCal
|
||||
EXPECT_EQ(0u, memoryManager.getLocalMemorySize(0u, 0xF));
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerLocalMemoryTest, givenGraphicsAllocationInDevicePoolIsAllocatedForImage1DWhenTheSizeReturnedFromGmmIsUnalignedThenCreateBufferObjectWithSizeAlignedTo64KB) {
|
||||
HWTEST2_F(DrmMemoryManagerLocalMemoryTest, givenGraphicsAllocationInDevicePoolIsAllocatedForImage1DWhenTheSizeReturnedFromGmmIsUnalignedThenCreateBufferObjectWithSizeAlignedTo64KB, NonDefaultIoctlsSupported) {
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image1D;
|
||||
imgDesc.imageWidth = 100;
|
||||
@@ -986,7 +986,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenGraphicsAllocationInDevicePoolIsAll
|
||||
|
||||
static uint32_t munmapCalledCount = 0u;
|
||||
|
||||
TEST_F(DrmMemoryManagerLocalMemoryTest, givenAlignmentAndSizeWhenMmapReturnsUnalignedPointerThenCreateAllocWithAlignmentUnmapTwoUnalignedPart) {
|
||||
HWTEST2_F(DrmMemoryManagerLocalMemoryTest, givenAlignmentAndSizeWhenMmapReturnsUnalignedPointerThenCreateAllocWithAlignmentUnmapTwoUnalignedPart, NonDefaultIoctlsSupported) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.EnableBOMmapCreate.set(-1);
|
||||
|
||||
@@ -1023,7 +1023,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenAlignmentAndSizeWhenMmapReturnsUnal
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerLocalMemoryTest, givenAlignmentAndSizeWhenMmapReturnsAlignedThenCreateAllocWithAlignmentUnmapOneUnalignedPart) {
|
||||
HWTEST2_F(DrmMemoryManagerLocalMemoryTest, givenAlignmentAndSizeWhenMmapReturnsAlignedThenCreateAllocWithAlignmentUnmapOneUnalignedPart, NonDefaultIoctlsSupported) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.EnableBOMmapCreate.set(-1);
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "shared/test/common/libult/linux/drm_mock.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test_traits_common.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
@@ -112,3 +113,13 @@ class DrmMockExp : public DrmMock {
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
struct NonDefaultIoctlsSupported {
|
||||
template <PRODUCT_FAMILY productFamily>
|
||||
static constexpr bool isMatched() {
|
||||
if (productFamily == IGFX_DG1) {
|
||||
return true;
|
||||
}
|
||||
return TestTraits<NEO::ToGfxCoreFamily<productFamily>::get()>::isUsingNonDefaultIoctls;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/os_interface/linux/local_memory_helper.h"
|
||||
#include "shared/source/os_interface/linux/memory_info_impl.h"
|
||||
#include "shared/test/common/libult/linux/drm_mock.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
TEST(LocalMemoryHelperTestsDefault, givenUnsupportedPlatformWhenCreateGemExtThenReturnErrorNumber) {
|
||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
auto drm = std::make_unique<DrmMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
|
||||
drm_i915_memory_region_info regionInfo[2] = {};
|
||||
regionInfo[0].region = {I915_MEMORY_CLASS_SYSTEM, 0};
|
||||
regionInfo[0].probed_size = 8 * GB;
|
||||
regionInfo[1].region = {I915_MEMORY_CLASS_DEVICE, 0};
|
||||
regionInfo[1].probed_size = 16 * GB;
|
||||
|
||||
auto localMemHelper = LocalMemoryHelper::get(IGFX_UNKNOWN);
|
||||
uint32_t handle = 0;
|
||||
auto ret = localMemHelper->createGemExt(drm.get(), ®ionInfo[1], 1, 1024, handle);
|
||||
|
||||
EXPECT_EQ(-1u, ret);
|
||||
}
|
||||
|
||||
TEST(LocalMemoryHelperTestsDefault, givenUnsupportedPlatformWhenTranslateIfRequiredReturnSameData) {
|
||||
auto *data = new uint8_t{};
|
||||
auto localMemHelper = LocalMemoryHelper::get(IGFX_UNKNOWN);
|
||||
auto ret = localMemHelper->translateIfRequired(data, 1);
|
||||
EXPECT_EQ(ret.get(), data);
|
||||
}
|
||||
@@ -45,6 +45,9 @@ set(NEO_CORE_OS_INTERFACE_LINUX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_device_id_linux.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kmd_notify_properties_linux.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/linux_inc.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/local_memory_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/local_memory_helper.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}local_memory_helper_default.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/engine_info.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}engine_info_impl.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/flags${BRANCH_DIR_SUFFIX}drm_query_flags.h
|
||||
@@ -100,8 +103,6 @@ if(I915_LOCAL_MEM_EXP)
|
||||
${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}/local_memory_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/local_memory_helper.cpp
|
||||
)
|
||||
else()
|
||||
list(APPEND NEO_CORE_OS_INTERFACE_LINUX
|
||||
|
||||
@@ -8,7 +8,14 @@
|
||||
#include "shared/source/os_interface/linux/local_memory_helper.h"
|
||||
|
||||
namespace NEO {
|
||||
extern LocalMemoryHelper *localMemoryHelperFactory[IGFX_MAX_PRODUCT];
|
||||
|
||||
static EnableProductLocalMemoryHelper<IGFX_DG1> enableLocalMemHelperDG1;
|
||||
struct EnableProductLocalMemoryHelperDg1 {
|
||||
EnableProductLocalMemoryHelperDg1() {
|
||||
LocalMemoryHelper *plocalMemHelper = LocalMemoryHelperImpl<IGFX_DG1>::get();
|
||||
localMemoryHelperFactory[IGFX_DG1] = plocalMemHelper;
|
||||
}
|
||||
};
|
||||
|
||||
static EnableProductLocalMemoryHelperDg1 enableLocalMemoryHelperDg1;
|
||||
} // namespace NEO
|
||||
|
||||
@@ -8,7 +8,14 @@
|
||||
#include "shared/source/os_interface/linux/local_memory_helper.h"
|
||||
|
||||
namespace NEO {
|
||||
extern LocalMemoryHelper *localMemoryHelperFactory[IGFX_MAX_PRODUCT];
|
||||
|
||||
static EnableProductLocalMemoryHelper<IGFX_XE_HP_SDV> enableLocalMemHelperXeHpSdv;
|
||||
struct EnableProductLocalMemoryHelperXeHpSdv {
|
||||
EnableProductLocalMemoryHelperXeHpSdv() {
|
||||
LocalMemoryHelper *plocalMemHelper = LocalMemoryHelperImpl<IGFX_XE_HP_SDV>::get();
|
||||
localMemoryHelperFactory[IGFX_XE_HP_SDV] = plocalMemHelper;
|
||||
}
|
||||
};
|
||||
|
||||
static EnableProductLocalMemoryHelperXeHpSdv enableLocalMemoryHelperXeHpSdv;
|
||||
} // namespace NEO
|
||||
|
||||
@@ -13,6 +13,14 @@ namespace NEO {
|
||||
|
||||
LocalMemoryHelper *localMemoryHelperFactory[IGFX_MAX_PRODUCT] = {};
|
||||
|
||||
LocalMemoryHelper *LocalMemoryHelper::get(PRODUCT_FAMILY product) {
|
||||
auto localMemHelper = localMemoryHelperFactory[product];
|
||||
if (!localMemHelper) {
|
||||
return LocalMemoryHelperDefault::get();
|
||||
}
|
||||
return localMemHelper;
|
||||
}
|
||||
|
||||
uint32_t LocalMemoryHelper::ioctl(Drm *drm, unsigned long request, void *arg) {
|
||||
return drm->ioctl(request, arg);
|
||||
}
|
||||
|
||||
@@ -20,14 +20,9 @@ extern LocalMemoryHelper *localMemoryHelperFactory[IGFX_MAX_PRODUCT];
|
||||
|
||||
class LocalMemoryHelper {
|
||||
public:
|
||||
static LocalMemoryHelper *get(PRODUCT_FAMILY product) {
|
||||
auto localMemHelper = localMemoryHelperFactory[product];
|
||||
if (!localMemHelper) {
|
||||
return localMemoryHelperFactory[IGFX_DG1];
|
||||
}
|
||||
return localMemHelper;
|
||||
}
|
||||
static LocalMemoryHelper *get(PRODUCT_FAMILY product);
|
||||
static uint32_t ioctl(Drm *drm, unsigned long request, void *arg);
|
||||
|
||||
virtual uint32_t createGemExt(Drm *drm, void *data, uint32_t dataSize, size_t allocSize, uint32_t &handle) = 0;
|
||||
virtual std::unique_ptr<uint8_t[]> translateIfRequired(uint8_t *dataQuery, int32_t length) = 0;
|
||||
};
|
||||
@@ -43,11 +38,14 @@ class LocalMemoryHelperImpl : public LocalMemoryHelper {
|
||||
std::unique_ptr<uint8_t[]> translateIfRequired(uint8_t *dataQuery, int32_t length) override;
|
||||
};
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
struct EnableProductLocalMemoryHelper {
|
||||
EnableProductLocalMemoryHelper() {
|
||||
LocalMemoryHelper *plocalMemHelper = LocalMemoryHelperImpl<gfxProduct>::get();
|
||||
localMemoryHelperFactory[gfxProduct] = plocalMemHelper;
|
||||
class LocalMemoryHelperDefault : public LocalMemoryHelper {
|
||||
public:
|
||||
static LocalMemoryHelper *get() {
|
||||
static LocalMemoryHelperDefault instance;
|
||||
return &instance;
|
||||
}
|
||||
uint32_t createGemExt(Drm *drm, void *data, uint32_t dataSize, size_t allocSize, uint32_t &handle) override;
|
||||
std::unique_ptr<uint8_t[]> translateIfRequired(uint8_t *dataQuery, int32_t length) override;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/debug_helpers.h"
|
||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||
#include "shared/source/os_interface/linux/local_memory_helper.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
uint32_t LocalMemoryHelperDefault::createGemExt(Drm *drm, void *data, uint32_t dataSize, size_t allocSize, uint32_t &handle) {
|
||||
DEBUG_BREAK_IF(true);
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::unique_ptr<uint8_t[]> LocalMemoryHelperDefault::translateIfRequired(uint8_t *dataQuery, int32_t length) {
|
||||
DEBUG_BREAK_IF(true);
|
||||
return std::unique_ptr<uint8_t[]>(dataQuery);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
@@ -7,9 +7,6 @@
|
||||
|
||||
#include "shared/source/os_interface/linux/memory_info_impl.h"
|
||||
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/os_interface/linux/local_memory_helper.h"
|
||||
|
||||
#include "drm/i915_drm.h"
|
||||
|
||||
namespace NEO {
|
||||
@@ -23,11 +20,6 @@ MemoryInfoImpl::MemoryInfoImpl(const drm_i915_memory_region_info *regionInfo, si
|
||||
});
|
||||
}
|
||||
|
||||
uint32_t MemoryInfoImpl::createGemExt(Drm *drm, void *data, uint32_t dataSize, size_t allocSize, uint32_t &handle) {
|
||||
auto pHwInfo = drm->getRootDeviceEnvironment().getHardwareInfo();
|
||||
return LocalMemoryHelper::get(pHwInfo->platform.eProductFamily)->createGemExt(drm, data, dataSize, allocSize, handle);
|
||||
}
|
||||
|
||||
void MemoryInfoImpl::assignRegionsFromDistances(const void *distanceInfosPtr, size_t size) {
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "shared/source/helpers/debug_helpers.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||
#include "shared/source/os_interface/linux/local_memory_helper.h"
|
||||
#include "shared/source/os_interface/linux/memory_info.h"
|
||||
|
||||
#include "drm/i915_drm.h"
|
||||
@@ -30,7 +31,10 @@ class MemoryInfoImpl : public MemoryInfo {
|
||||
|
||||
void assignRegionsFromDistances(const void *distanceInfosPtr, size_t size);
|
||||
|
||||
uint32_t createGemExt(Drm *drm, void *data, uint32_t dataSize, size_t allocSize, uint32_t &handle) override;
|
||||
uint32_t createGemExt(Drm *drm, void *data, uint32_t dataSize, size_t allocSize, uint32_t &handle) override {
|
||||
auto pHwInfo = drm->getRootDeviceEnvironment().getHardwareInfo();
|
||||
return LocalMemoryHelper::get(pHwInfo->platform.eProductFamily)->createGemExt(drm, data, dataSize, allocSize, handle);
|
||||
}
|
||||
|
||||
drm_i915_gem_memory_class_instance getMemoryRegionClassAndInstance(uint32_t memoryBank, const HardwareInfo &hwInfo) {
|
||||
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
|
||||
@@ -14,4 +14,5 @@ struct TestTraits<IGFX_GEN11_CORE> {
|
||||
static constexpr bool programOnlyChangedFieldsInComputeStateMode = true;
|
||||
static constexpr bool iohInSbaSupported = true;
|
||||
static constexpr bool auxTranslationSupported = false;
|
||||
static constexpr bool isUsingNonDefaultIoctls = false;
|
||||
};
|
||||
|
||||
@@ -14,4 +14,5 @@ struct TestTraits<IGFX_GEN12LP_CORE> {
|
||||
static constexpr bool programOnlyChangedFieldsInComputeStateMode = true;
|
||||
static constexpr bool iohInSbaSupported = true;
|
||||
static constexpr bool auxTranslationSupported = true;
|
||||
static constexpr bool isUsingNonDefaultIoctls = false;
|
||||
};
|
||||
|
||||
@@ -13,4 +13,5 @@ struct TestTraits<IGFX_GEN8_CORE> {
|
||||
static constexpr bool auxBuiltinsSupported = false;
|
||||
static constexpr bool programOnlyChangedFieldsInComputeStateMode = true;
|
||||
static constexpr bool iohInSbaSupported = true;
|
||||
static constexpr bool isUsingNonDefaultIoctls = false;
|
||||
};
|
||||
|
||||
@@ -13,4 +13,5 @@ struct TestTraits<IGFX_GEN9_CORE> {
|
||||
static constexpr bool auxBuiltinsSupported = false;
|
||||
static constexpr bool programOnlyChangedFieldsInComputeStateMode = true;
|
||||
static constexpr bool iohInSbaSupported = true;
|
||||
static constexpr bool isUsingNonDefaultIoctls = false;
|
||||
};
|
||||
|
||||
@@ -20,4 +20,5 @@ struct TestTraits<IGFX_XE_HP_CORE> {
|
||||
static constexpr bool programOnlyChangedFieldsInComputeStateMode = false;
|
||||
static constexpr bool iohInSbaSupported = false;
|
||||
static constexpr bool auxTranslationSupported = true;
|
||||
static constexpr bool isUsingNonDefaultIoctls = true;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user