mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +08:00
Rename LocalMemoryHelper to IoctlHelper
Related-To: NEO-6472 This helper class is not used only for local memory. IoctlHelper is more appropriate. Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
816e12ed4f
commit
ce5f9c2214
@@ -34,7 +34,7 @@ set(IGDRCL_SRCS_tests_os_interface_linux
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_linux_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_linux_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_linux_tests.h
|
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_linux_tests.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/linux_create_command_queue_with_properties_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/linux_create_command_queue_with_properties_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}local_memory_helper_default_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}ioctl_helper_default_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_os_time_linux.h
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_os_time_linux.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_performance_counters_linux.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_performance_counters_linux.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_performance_counters_linux.h
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_performance_counters_linux.h
|
||||||
@@ -53,14 +53,14 @@ endif()
|
|||||||
|
|
||||||
if(TESTS_DG1 AND "${BRANCH_TYPE}" STREQUAL "")
|
if(TESTS_DG1 AND "${BRANCH_TYPE}" STREQUAL "")
|
||||||
list(APPEND IGDRCL_SRCS_tests_os_interface_linux
|
list(APPEND IGDRCL_SRCS_tests_os_interface_linux
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/local_memory_helper_tests_dg1.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_tests_dg1.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_mock_prod_dg1.h
|
${CMAKE_CURRENT_SOURCE_DIR}/drm_mock_prod_dg1.h
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(TESTS_XE_HP_SDV AND "${BRANCH_TYPE}" STREQUAL "")
|
if(TESTS_XE_HP_SDV AND "${BRANCH_TYPE}" STREQUAL "")
|
||||||
list(APPEND IGDRCL_SRCS_tests_os_interface_linux
|
list(APPEND IGDRCL_SRCS_tests_os_interface_linux
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/local_memory_helper_tests_xe_hp_sdv.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_tests_xe_hp_sdv.cpp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "shared/source/execution_environment/execution_environment.h"
|
#include "shared/source/execution_environment/execution_environment.h"
|
||||||
#include "shared/source/os_interface/linux/local_memory_helper.h"
|
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
||||||
#include "shared/source/os_interface/linux/memory_info.h"
|
#include "shared/source/os_interface/linux/memory_info.h"
|
||||||
#include "shared/test/common/libult/linux/drm_mock.h"
|
#include "shared/test/common/libult/linux/drm_mock.h"
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
using namespace NEO;
|
using namespace NEO;
|
||||||
|
|
||||||
TEST(LocalMemoryHelperTestsDefault, givenUnsupportedPlatformWhenCreateGemExtThenReturnErrorNumber) {
|
TEST(IoctlHelperTestsDefault, givenUnsupportedPlatformWhenCreateGemExtThenReturnErrorNumber) {
|
||||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||||
auto drm = std::make_unique<DrmMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
auto drm = std::make_unique<DrmMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||||
@@ -25,16 +25,16 @@ TEST(LocalMemoryHelperTestsDefault, givenUnsupportedPlatformWhenCreateGemExtThen
|
|||||||
regionInfo[1].region = {I915_MEMORY_CLASS_DEVICE, 0};
|
regionInfo[1].region = {I915_MEMORY_CLASS_DEVICE, 0};
|
||||||
regionInfo[1].probed_size = 16 * GB;
|
regionInfo[1].probed_size = 16 * GB;
|
||||||
|
|
||||||
auto localMemHelper = LocalMemoryHelper::get(IGFX_UNKNOWN);
|
auto ioctlHelper = IoctlHelper::get(IGFX_UNKNOWN);
|
||||||
uint32_t handle = 0;
|
uint32_t handle = 0;
|
||||||
auto ret = localMemHelper->createGemExt(drm.get(), ®ionInfo[1], 1, 1024, handle);
|
auto ret = ioctlHelper->createGemExt(drm.get(), ®ionInfo[1], 1, 1024, handle);
|
||||||
|
|
||||||
EXPECT_EQ(-1u, ret);
|
EXPECT_EQ(-1u, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(LocalMemoryHelperTestsDefault, givenUnsupportedPlatformWhenTranslateIfRequiredReturnSameData) {
|
TEST(IoctlHelperTestsDefault, givenUnsupportedPlatformWhenTranslateIfRequiredReturnSameData) {
|
||||||
auto *data = new uint8_t{};
|
auto *data = new uint8_t{};
|
||||||
auto localMemHelper = LocalMemoryHelper::get(IGFX_UNKNOWN);
|
auto ioctlHelper = IoctlHelper::get(IGFX_UNKNOWN);
|
||||||
auto ret = localMemHelper->translateIfRequired(data, 1);
|
auto ret = ioctlHelper->translateIfRequired(data, 1);
|
||||||
EXPECT_EQ(ret.get(), data);
|
EXPECT_EQ(ret.get(), data);
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "shared/source/execution_environment/execution_environment.h"
|
#include "shared/source/execution_environment/execution_environment.h"
|
||||||
#include "shared/source/os_interface/linux/local_memory_helper.h"
|
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
||||||
#include "shared/source/os_interface/linux/memory_info.h"
|
#include "shared/source/os_interface/linux/memory_info.h"
|
||||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||||
#include "shared/test/common/helpers/default_hw_info.h"
|
#include "shared/test/common/helpers/default_hw_info.h"
|
||||||
@@ -17,9 +17,9 @@
|
|||||||
|
|
||||||
using namespace NEO;
|
using namespace NEO;
|
||||||
|
|
||||||
using LocalMemoryHelperTestsDg1 = ::testing::Test;
|
using IoctlHelperTestsDg1 = ::testing::Test;
|
||||||
|
|
||||||
DG1TEST_F(LocalMemoryHelperTestsDg1, givenDg1WhenCreateGemExtThenReturnCorrectValue) {
|
DG1TEST_F(IoctlHelperTestsDg1, givenDg1WhenCreateGemExtThenReturnCorrectValue) {
|
||||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||||
auto drm = std::make_unique<DrmTipMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
auto drm = std::make_unique<DrmTipMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||||
@@ -30,9 +30,9 @@ DG1TEST_F(LocalMemoryHelperTestsDg1, givenDg1WhenCreateGemExtThenReturnCorrectVa
|
|||||||
regionInfo[1].region = {I915_MEMORY_CLASS_DEVICE, 0};
|
regionInfo[1].region = {I915_MEMORY_CLASS_DEVICE, 0};
|
||||||
regionInfo[1].probed_size = 16 * GB;
|
regionInfo[1].probed_size = 16 * GB;
|
||||||
|
|
||||||
auto localMemHelper = LocalMemoryHelper::get(defaultHwInfo->platform.eProductFamily);
|
auto ioctlHelper = IoctlHelper::get(defaultHwInfo->platform.eProductFamily);
|
||||||
uint32_t handle = 0;
|
uint32_t handle = 0;
|
||||||
auto ret = localMemHelper->createGemExt(drm.get(), ®ionInfo[1], 1, 1024, handle);
|
auto ret = ioctlHelper->createGemExt(drm.get(), ®ionInfo[1], 1, 1024, handle);
|
||||||
|
|
||||||
EXPECT_EQ(0u, ret);
|
EXPECT_EQ(0u, ret);
|
||||||
EXPECT_EQ(1u, handle);
|
EXPECT_EQ(1u, handle);
|
||||||
@@ -41,7 +41,7 @@ DG1TEST_F(LocalMemoryHelperTestsDg1, givenDg1WhenCreateGemExtThenReturnCorrectVa
|
|||||||
EXPECT_EQ(I915_MEMORY_CLASS_DEVICE, drm->memRegions.memory_class);
|
EXPECT_EQ(I915_MEMORY_CLASS_DEVICE, drm->memRegions.memory_class);
|
||||||
}
|
}
|
||||||
|
|
||||||
DG1TEST_F(LocalMemoryHelperTestsDg1, givenDg1WithDrmTipWhenCreateGemExtWithDebugFlagThenPrintDebugInfo) {
|
DG1TEST_F(IoctlHelperTestsDg1, givenDg1WithDrmTipWhenCreateGemExtWithDebugFlagThenPrintDebugInfo) {
|
||||||
DebugManagerStateRestore stateRestore;
|
DebugManagerStateRestore stateRestore;
|
||||||
DebugManager.flags.PrintBOCreateDestroyResult.set(true);
|
DebugManager.flags.PrintBOCreateDestroyResult.set(true);
|
||||||
|
|
||||||
@@ -53,10 +53,10 @@ DG1TEST_F(LocalMemoryHelperTestsDg1, givenDg1WithDrmTipWhenCreateGemExtWithDebug
|
|||||||
regionInfo[1].region = {I915_MEMORY_CLASS_DEVICE, 0};
|
regionInfo[1].region = {I915_MEMORY_CLASS_DEVICE, 0};
|
||||||
|
|
||||||
testing::internal::CaptureStdout();
|
testing::internal::CaptureStdout();
|
||||||
auto localMemHelper = LocalMemoryHelper::get(defaultHwInfo->platform.eProductFamily);
|
auto ioctlHelper = IoctlHelper::get(defaultHwInfo->platform.eProductFamily);
|
||||||
uint32_t handle = 0;
|
uint32_t handle = 0;
|
||||||
|
|
||||||
auto ret = localMemHelper->createGemExt(drm.get(), ®ionInfo[1], 1, 1024, handle);
|
auto ret = ioctlHelper->createGemExt(drm.get(), ®ionInfo[1], 1, 1024, handle);
|
||||||
|
|
||||||
std::string output = testing::internal::GetCapturedStdout();
|
std::string output = testing::internal::GetCapturedStdout();
|
||||||
std::string expectedOutput("Performing GEM_CREATE_EXT with { size: 1024, memory class: 1, memory instance: 0 }\nGEM_CREATE_EXT with EXT_MEMORY_REGIONS has returned: 0 BO-1 with size: 1024\n");
|
std::string expectedOutput("Performing GEM_CREATE_EXT with { size: 1024, memory class: 1, memory instance: 0 }\nGEM_CREATE_EXT with EXT_MEMORY_REGIONS has returned: 0 BO-1 with size: 1024\n");
|
||||||
@@ -65,7 +65,7 @@ DG1TEST_F(LocalMemoryHelperTestsDg1, givenDg1WithDrmTipWhenCreateGemExtWithDebug
|
|||||||
EXPECT_EQ(0u, ret);
|
EXPECT_EQ(0u, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
DG1TEST_F(LocalMemoryHelperTestsDg1, givenDg1WhenCreateGemExtWithDebugFlagThenPrintDebugInfo) {
|
DG1TEST_F(IoctlHelperTestsDg1, givenDg1WhenCreateGemExtWithDebugFlagThenPrintDebugInfo) {
|
||||||
DebugManagerStateRestore stateRestore;
|
DebugManagerStateRestore stateRestore;
|
||||||
DebugManager.flags.PrintBOCreateDestroyResult.set(true);
|
DebugManager.flags.PrintBOCreateDestroyResult.set(true);
|
||||||
|
|
||||||
@@ -77,10 +77,10 @@ DG1TEST_F(LocalMemoryHelperTestsDg1, givenDg1WhenCreateGemExtWithDebugFlagThenPr
|
|||||||
regionInfo[1].region = {I915_MEMORY_CLASS_DEVICE, 0};
|
regionInfo[1].region = {I915_MEMORY_CLASS_DEVICE, 0};
|
||||||
|
|
||||||
testing::internal::CaptureStdout();
|
testing::internal::CaptureStdout();
|
||||||
auto localMemHelper = LocalMemoryHelper::get(defaultHwInfo->platform.eProductFamily);
|
auto ioctlHelper = IoctlHelper::get(defaultHwInfo->platform.eProductFamily);
|
||||||
uint32_t handle = 0;
|
uint32_t handle = 0;
|
||||||
|
|
||||||
auto ret = localMemHelper->createGemExt(drm.get(), ®ionInfo[1], 1, 1024, handle);
|
auto ret = ioctlHelper->createGemExt(drm.get(), ®ionInfo[1], 1, 1024, handle);
|
||||||
|
|
||||||
std::string output = testing::internal::GetCapturedStdout();
|
std::string output = testing::internal::GetCapturedStdout();
|
||||||
std::string expectedOutput("Performing GEM_CREATE_EXT with { size: 1024, memory class: 1, memory instance: 0 }\nGEM_CREATE_EXT with EXT_SETPARAM has returned: 0 BO-1 with size: 1024\n");
|
std::string expectedOutput("Performing GEM_CREATE_EXT with { size: 1024, memory class: 1, memory instance: 0 }\nGEM_CREATE_EXT with EXT_SETPARAM has returned: 0 BO-1 with size: 1024\n");
|
||||||
@@ -89,7 +89,7 @@ DG1TEST_F(LocalMemoryHelperTestsDg1, givenDg1WhenCreateGemExtWithDebugFlagThenPr
|
|||||||
EXPECT_EQ(0u, ret);
|
EXPECT_EQ(0u, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
DG1TEST_F(LocalMemoryHelperTestsDg1, givenDg1AndMemoryRegionQuerySupportedWhenQueryingMemoryInfoThenMemoryInfoIsCreatedWithRegions) {
|
DG1TEST_F(IoctlHelperTestsDg1, givenDg1AndMemoryRegionQuerySupportedWhenQueryingMemoryInfoThenMemoryInfoIsCreatedWithRegions) {
|
||||||
DebugManagerStateRestore restorer;
|
DebugManagerStateRestore restorer;
|
||||||
DebugManager.flags.EnableLocalMemory.set(1);
|
DebugManager.flags.EnableLocalMemory.set(1);
|
||||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "shared/source/execution_environment/execution_environment.h"
|
#include "shared/source/execution_environment/execution_environment.h"
|
||||||
#include "shared/source/os_interface/linux/local_memory_helper.h"
|
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
||||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||||
#include "shared/test/common/helpers/default_hw_info.h"
|
#include "shared/test/common/helpers/default_hw_info.h"
|
||||||
|
|
||||||
@@ -15,9 +15,9 @@
|
|||||||
|
|
||||||
using namespace NEO;
|
using namespace NEO;
|
||||||
|
|
||||||
using LocalMemoryHelperTestsXeHpSdv = ::testing::Test;
|
using IoctlHelperTestsXeHpSdv = ::testing::Test;
|
||||||
|
|
||||||
XEHPTEST_F(LocalMemoryHelperTestsXeHpSdv, givenXeHpSdvWhenCreateGemExtThenReturnCorrectValue) {
|
XEHPTEST_F(IoctlHelperTestsXeHpSdv, givenXeHpSdvWhenCreateGemExtThenReturnCorrectValue) {
|
||||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||||
auto drm = std::make_unique<DrmTipMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
auto drm = std::make_unique<DrmTipMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||||
@@ -28,9 +28,9 @@ XEHPTEST_F(LocalMemoryHelperTestsXeHpSdv, givenXeHpSdvWhenCreateGemExtThenReturn
|
|||||||
regionInfo[1].region = {I915_MEMORY_CLASS_DEVICE, 0};
|
regionInfo[1].region = {I915_MEMORY_CLASS_DEVICE, 0};
|
||||||
regionInfo[1].probed_size = 16 * GB;
|
regionInfo[1].probed_size = 16 * GB;
|
||||||
|
|
||||||
auto localMemHelper = LocalMemoryHelper::get(defaultHwInfo->platform.eProductFamily);
|
auto ioctlHelper = IoctlHelper::get(defaultHwInfo->platform.eProductFamily);
|
||||||
uint32_t handle = 0;
|
uint32_t handle = 0;
|
||||||
auto ret = localMemHelper->createGemExt(drm.get(), ®ionInfo[1], 1, 1024, handle);
|
auto ret = ioctlHelper->createGemExt(drm.get(), ®ionInfo[1], 1, 1024, handle);
|
||||||
|
|
||||||
EXPECT_EQ(0u, ret);
|
EXPECT_EQ(0u, ret);
|
||||||
EXPECT_EQ(1u, handle);
|
EXPECT_EQ(1u, handle);
|
||||||
@@ -39,7 +39,7 @@ XEHPTEST_F(LocalMemoryHelperTestsXeHpSdv, givenXeHpSdvWhenCreateGemExtThenReturn
|
|||||||
EXPECT_EQ(I915_MEMORY_CLASS_DEVICE, drm->memRegions.memory_class);
|
EXPECT_EQ(I915_MEMORY_CLASS_DEVICE, drm->memRegions.memory_class);
|
||||||
}
|
}
|
||||||
|
|
||||||
XEHPTEST_F(LocalMemoryHelperTestsXeHpSdv, givenXeHpSdvWhenCreateGemExtWithDebugFlagThenPrintDebugInfo) {
|
XEHPTEST_F(IoctlHelperTestsXeHpSdv, givenXeHpSdvWhenCreateGemExtWithDebugFlagThenPrintDebugInfo) {
|
||||||
DebugManagerStateRestore stateRestore;
|
DebugManagerStateRestore stateRestore;
|
||||||
DebugManager.flags.PrintBOCreateDestroyResult.set(true);
|
DebugManager.flags.PrintBOCreateDestroyResult.set(true);
|
||||||
|
|
||||||
@@ -52,9 +52,9 @@ XEHPTEST_F(LocalMemoryHelperTestsXeHpSdv, givenXeHpSdvWhenCreateGemExtWithDebugF
|
|||||||
regionInfo[1].region = {I915_MEMORY_CLASS_DEVICE, 0};
|
regionInfo[1].region = {I915_MEMORY_CLASS_DEVICE, 0};
|
||||||
|
|
||||||
testing::internal::CaptureStdout();
|
testing::internal::CaptureStdout();
|
||||||
auto localMemHelper = LocalMemoryHelper::get(defaultHwInfo->platform.eProductFamily);
|
auto ioctlHelper = IoctlHelper::get(defaultHwInfo->platform.eProductFamily);
|
||||||
uint32_t handle = 0;
|
uint32_t handle = 0;
|
||||||
localMemHelper->createGemExt(drm.get(), ®ionInfo[1], 1, 1024, handle);
|
ioctlHelper->createGemExt(drm.get(), ®ionInfo[1], 1, 1024, handle);
|
||||||
|
|
||||||
std::string output = testing::internal::GetCapturedStdout();
|
std::string output = testing::internal::GetCapturedStdout();
|
||||||
std::string expectedOutput("Performing GEM_CREATE_EXT with { size: 1024, memory class: 1, memory instance: 0 }\nGEM_CREATE_EXT with EXT_MEMORY_REGIONS has returned: 0 BO-1 with size: 1024\n");
|
std::string expectedOutput("Performing GEM_CREATE_EXT with { size: 1024, memory class: 1, memory instance: 0 }\nGEM_CREATE_EXT with EXT_MEMORY_REGIONS has returned: 0 BO-1 with size: 1024\n");
|
||||||
@@ -83,7 +83,7 @@ macro(macro_for_each_platform)
|
|||||||
if(EXISTS ${SRC_FILE})
|
if(EXISTS ${SRC_FILE})
|
||||||
list(APPEND ${CORE_TYPE}_SRC_LINK_BASE ${SRC_FILE})
|
list(APPEND ${CORE_TYPE}_SRC_LINK_BASE ${SRC_FILE})
|
||||||
endif()
|
endif()
|
||||||
set(SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR}/os_interface/linux/local${BRANCH_DIR_SUFFIX}${PLATFORM_IT_LOWER}/enable_local_memory_helper_${PLATFORM_IT_LOWER}.cpp)
|
set(SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR}/os_interface/linux/local${BRANCH_DIR_SUFFIX}${PLATFORM_IT_LOWER}/enable_ioctl_helper_${PLATFORM_IT_LOWER}.cpp)
|
||||||
if(EXISTS ${SRC_FILE})
|
if(EXISTS ${SRC_FILE})
|
||||||
list(APPEND ${CORE_TYPE}_SRC_LINK_LINUX ${SRC_FILE})
|
list(APPEND ${CORE_TYPE}_SRC_LINK_LINUX ${SRC_FILE})
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ set(NEO_CORE_OS_INTERFACE_LINUX
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_device_id_linux.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/hw_device_id_linux.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/kmd_notify_properties_linux.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/kmd_notify_properties_linux.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/linux_inc.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/linux_inc.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/local_memory_helper.h
|
${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/local_memory_helper.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}local_memory_helper_default.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}ioctl_helper_default.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/engine_info.h
|
${CMAKE_CURRENT_SOURCE_DIR}/engine_info.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}engine_info_impl.h
|
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}engine_info_impl.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/flags${BRANCH_DIR_SUFFIX}drm_query_flags.h
|
${CMAKE_CURRENT_SOURCE_DIR}/flags${BRANCH_DIR_SUFFIX}drm_query_flags.h
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
namespace IoctlHelper {
|
namespace IoctlToStringHelper {
|
||||||
std::string getIoctlParamString(int param) {
|
std::string getIoctlParamString(int param) {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case I915_PARAM_CHIPSET_ID:
|
case I915_PARAM_CHIPSET_ID:
|
||||||
@@ -189,7 +189,7 @@ std::string getIoctlString(unsigned long request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace IoctlHelper
|
} // namespace IoctlToStringHelper
|
||||||
|
|
||||||
Drm::Drm(std::unique_ptr<HwDeviceIdDrm> &&hwDeviceIdIn, RootDeviceEnvironment &rootDeviceEnvironment)
|
Drm::Drm(std::unique_ptr<HwDeviceIdDrm> &&hwDeviceIdIn, RootDeviceEnvironment &rootDeviceEnvironment)
|
||||||
: DriverModel(DriverModelType::DRM),
|
: DriverModel(DriverModelType::DRM),
|
||||||
@@ -210,7 +210,7 @@ int Drm::ioctl(unsigned long request, void *arg) {
|
|||||||
auto printIoctl = DebugManager.flags.PrintIoctlEntries.get();
|
auto printIoctl = DebugManager.flags.PrintIoctlEntries.get();
|
||||||
|
|
||||||
if (printIoctl) {
|
if (printIoctl) {
|
||||||
printf("IOCTL %s called\n", IoctlHelper::getIoctlString(request).c_str());
|
printf("IOCTL %s called\n", IoctlToStringHelper::getIoctlString(request).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (measureTime) {
|
if (measureTime) {
|
||||||
@@ -239,7 +239,7 @@ int Drm::ioctl(unsigned long request, void *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (printIoctl) {
|
if (printIoctl) {
|
||||||
printf("IOCTL %s returns %d, errno %d(%s)\n", IoctlHelper::getIoctlString(request).c_str(), ret, returnedErrno, strerror(returnedErrno));
|
printf("IOCTL %s returns %d, errno %d(%s)\n", IoctlToStringHelper::getIoctlString(request).c_str(), ret, returnedErrno, strerror(returnedErrno));
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (ret == -1 && (returnedErrno == EINTR || returnedErrno == EAGAIN || returnedErrno == EBUSY));
|
} while (ret == -1 && (returnedErrno == EINTR || returnedErrno == EAGAIN || returnedErrno == EBUSY));
|
||||||
@@ -255,7 +255,7 @@ int Drm::getParamIoctl(int param, int *dstValue) {
|
|||||||
int retVal = ioctl(DRM_IOCTL_I915_GETPARAM, &getParam);
|
int retVal = ioctl(DRM_IOCTL_I915_GETPARAM, &getParam);
|
||||||
if (DebugManager.flags.PrintIoctlEntries.get()) {
|
if (DebugManager.flags.PrintIoctlEntries.get()) {
|
||||||
printf("DRM_IOCTL_I915_GETPARAM: param: %s, output value: %d, retCode:% d\n",
|
printf("DRM_IOCTL_I915_GETPARAM: param: %s, output value: %d, retCode:% d\n",
|
||||||
IoctlHelper::getIoctlParamString(param).c_str(),
|
IoctlToStringHelper::getIoctlParamString(param).c_str(),
|
||||||
*getParam.value,
|
*getParam.value,
|
||||||
retVal);
|
retVal);
|
||||||
}
|
}
|
||||||
@@ -645,7 +645,7 @@ void Drm::printIoctlStatistics() {
|
|||||||
printf("%41s %15s %10s %20s %20s %20s", "Request", "Total time(ns)", "Count", "Avg time per ioctl", "Min", "Max\n");
|
printf("%41s %15s %10s %20s %20s %20s", "Request", "Total time(ns)", "Count", "Avg time per ioctl", "Min", "Max\n");
|
||||||
for (const auto &ioctlData : this->ioctlStatistics) {
|
for (const auto &ioctlData : this->ioctlStatistics) {
|
||||||
printf("%41s %15llu %10lu %20f %20lld %20lld\n",
|
printf("%41s %15llu %10lu %20f %20lld %20lld\n",
|
||||||
IoctlHelper::getIoctlString(ioctlData.first).c_str(),
|
IoctlToStringHelper::getIoctlString(ioctlData.first).c_str(),
|
||||||
ioctlData.second.totalTime,
|
ioctlData.second.totalTime,
|
||||||
static_cast<unsigned long>(ioctlData.second.count),
|
static_cast<unsigned long>(ioctlData.second.count),
|
||||||
ioctlData.second.totalTime / static_cast<double>(ioctlData.second.count),
|
ioctlData.second.totalTime / static_cast<double>(ioctlData.second.count),
|
||||||
|
|||||||
@@ -57,12 +57,12 @@ struct DeviceDescriptor { // NOLINT(clang-analyzer-optin.performance.Padding)
|
|||||||
|
|
||||||
extern const DeviceDescriptor deviceDescriptorTable[];
|
extern const DeviceDescriptor deviceDescriptorTable[];
|
||||||
|
|
||||||
namespace IoctlHelper {
|
namespace IoctlToStringHelper {
|
||||||
std::string getIoctlParamString(int param);
|
std::string getIoctlParamString(int param);
|
||||||
std::string getIoctlParamStringRemaining(int param);
|
std::string getIoctlParamStringRemaining(int param);
|
||||||
std::string getIoctlString(unsigned long request);
|
std::string getIoctlString(unsigned long request);
|
||||||
std::string getIoctlStringRemaining(unsigned long request);
|
std::string getIoctlStringRemaining(unsigned long request);
|
||||||
} // namespace IoctlHelper
|
} // namespace IoctlToStringHelper
|
||||||
|
|
||||||
class Drm : public DriverModel {
|
class Drm : public DriverModel {
|
||||||
friend DeviceFactory;
|
friend DeviceFactory;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include "shared/source/os_interface/linux/cache_info_impl.h"
|
#include "shared/source/os_interface/linux/cache_info_impl.h"
|
||||||
#include "shared/source/os_interface/linux/drm_engine_mapper.h"
|
#include "shared/source/os_interface/linux/drm_engine_mapper.h"
|
||||||
#include "shared/source/os_interface/linux/engine_info_impl.h"
|
#include "shared/source/os_interface/linux/engine_info_impl.h"
|
||||||
#include "shared/source/os_interface/linux/local_memory_helper.h"
|
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
||||||
#include "shared/source/os_interface/linux/memory_info.h"
|
#include "shared/source/os_interface/linux/memory_info.h"
|
||||||
#include "shared/source/os_interface/linux/sys_calls.h"
|
#include "shared/source/os_interface/linux/sys_calls.h"
|
||||||
#include "shared/source/os_interface/linux/system_info.h"
|
#include "shared/source/os_interface/linux/system_info.h"
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
namespace IoctlHelper {
|
namespace IoctlToStringHelper {
|
||||||
std::string getIoctlStringRemaining(unsigned long request) {
|
std::string getIoctlStringRemaining(unsigned long request) {
|
||||||
return std::to_string(request);
|
return std::to_string(request);
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ std::string getIoctlStringRemaining(unsigned long request) {
|
|||||||
std::string getIoctlParamStringRemaining(int param) {
|
std::string getIoctlParamStringRemaining(int param) {
|
||||||
return std::to_string(param);
|
return std::to_string(param);
|
||||||
}
|
}
|
||||||
} // namespace IoctlHelper
|
} // namespace IoctlToStringHelper
|
||||||
|
|
||||||
bool Drm::queryEngineInfo(bool isSysmanEnabled) {
|
bool Drm::queryEngineInfo(bool isSysmanEnabled) {
|
||||||
auto length = 0;
|
auto length = 0;
|
||||||
@@ -58,8 +58,8 @@ bool Drm::queryMemoryInfo() {
|
|||||||
auto length = 0;
|
auto length = 0;
|
||||||
auto dataQuery = this->query(DRM_I915_QUERY_MEMORY_REGIONS, DrmQueryItemFlags::empty, length);
|
auto dataQuery = this->query(DRM_I915_QUERY_MEMORY_REGIONS, DrmQueryItemFlags::empty, length);
|
||||||
if (dataQuery) {
|
if (dataQuery) {
|
||||||
auto localMemHelper = LocalMemoryHelper::get(pHwInfo->platform.eProductFamily);
|
auto ioctlHelper = IoctlHelper::get(pHwInfo->platform.eProductFamily);
|
||||||
auto data = localMemHelper->translateIfRequired(dataQuery.release(), length);
|
auto data = ioctlHelper->translateIfRequired(dataQuery.release(), length);
|
||||||
auto memRegions = reinterpret_cast<drm_i915_query_memory_regions *>(data.get());
|
auto memRegions = reinterpret_cast<drm_i915_query_memory_regions *>(data.get());
|
||||||
this->memoryInfo.reset(new MemoryInfo(memRegions->regions, memRegions->num_regions));
|
this->memoryInfo.reset(new MemoryInfo(memRegions->regions, memRegions->num_regions));
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
28
shared/source/os_interface/linux/ioctl_helper.cpp
Normal file
28
shared/source/os_interface/linux/ioctl_helper.cpp
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
||||||
|
|
||||||
|
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||||
|
|
||||||
|
namespace NEO {
|
||||||
|
|
||||||
|
IoctlHelper *ioctlHelperFactory[IGFX_MAX_PRODUCT] = {};
|
||||||
|
|
||||||
|
IoctlHelper *IoctlHelper::get(PRODUCT_FAMILY product) {
|
||||||
|
auto ioctlHelper = ioctlHelperFactory[product];
|
||||||
|
if (!ioctlHelper) {
|
||||||
|
return IoctlHelperDefault::get();
|
||||||
|
}
|
||||||
|
return ioctlHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t IoctlHelper::ioctl(Drm *drm, unsigned long request, void *arg) {
|
||||||
|
return drm->ioctl(request, arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace NEO
|
||||||
@@ -14,13 +14,13 @@
|
|||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
class Drm;
|
class Drm;
|
||||||
class LocalMemoryHelper;
|
class IoctlHelper;
|
||||||
|
|
||||||
extern LocalMemoryHelper *localMemoryHelperFactory[IGFX_MAX_PRODUCT];
|
extern IoctlHelper *ioctlHelperFactory[IGFX_MAX_PRODUCT];
|
||||||
|
|
||||||
class LocalMemoryHelper {
|
class IoctlHelper {
|
||||||
public:
|
public:
|
||||||
static LocalMemoryHelper *get(PRODUCT_FAMILY product);
|
static IoctlHelper *get(PRODUCT_FAMILY product);
|
||||||
static uint32_t ioctl(Drm *drm, unsigned long request, void *arg);
|
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 uint32_t createGemExt(Drm *drm, void *data, uint32_t dataSize, size_t allocSize, uint32_t &handle) = 0;
|
||||||
@@ -28,20 +28,20 @@ class LocalMemoryHelper {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <PRODUCT_FAMILY gfxProduct>
|
template <PRODUCT_FAMILY gfxProduct>
|
||||||
class LocalMemoryHelperImpl : public LocalMemoryHelper {
|
class IoctlHelperImpl : public IoctlHelper {
|
||||||
public:
|
public:
|
||||||
static LocalMemoryHelper *get() {
|
static IoctlHelper *get() {
|
||||||
static LocalMemoryHelperImpl<gfxProduct> instance;
|
static IoctlHelperImpl<gfxProduct> instance;
|
||||||
return &instance;
|
return &instance;
|
||||||
}
|
}
|
||||||
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;
|
||||||
std::unique_ptr<uint8_t[]> translateIfRequired(uint8_t *dataQuery, int32_t length) override;
|
std::unique_ptr<uint8_t[]> translateIfRequired(uint8_t *dataQuery, int32_t length) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LocalMemoryHelperDefault : public LocalMemoryHelper {
|
class IoctlHelperDefault : public IoctlHelper {
|
||||||
public:
|
public:
|
||||||
static LocalMemoryHelper *get() {
|
static IoctlHelper *get() {
|
||||||
static LocalMemoryHelperDefault instance;
|
static IoctlHelperDefault instance;
|
||||||
return &instance;
|
return &instance;
|
||||||
}
|
}
|
||||||
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;
|
||||||
@@ -7,16 +7,16 @@
|
|||||||
|
|
||||||
#include "shared/source/helpers/debug_helpers.h"
|
#include "shared/source/helpers/debug_helpers.h"
|
||||||
#include "shared/source/os_interface/linux/drm_neo.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/ioctl_helper.h"
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
uint32_t LocalMemoryHelperDefault::createGemExt(Drm *drm, void *data, uint32_t dataSize, size_t allocSize, uint32_t &handle) {
|
uint32_t IoctlHelperDefault::createGemExt(Drm *drm, void *data, uint32_t dataSize, size_t allocSize, uint32_t &handle) {
|
||||||
DEBUG_BREAK_IF(true);
|
DEBUG_BREAK_IF(true);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<uint8_t[]> LocalMemoryHelperDefault::translateIfRequired(uint8_t *dataQuery, int32_t length) {
|
std::unique_ptr<uint8_t[]> IoctlHelperDefault::translateIfRequired(uint8_t *dataQuery, int32_t length) {
|
||||||
DEBUG_BREAK_IF(true);
|
DEBUG_BREAK_IF(true);
|
||||||
return std::unique_ptr<uint8_t[]>(dataQuery);
|
return std::unique_ptr<uint8_t[]>(dataQuery);
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
if(SUPPORT_DG1 AND "${BRANCH_TYPE}" STREQUAL "")
|
if(SUPPORT_DG1 AND "${BRANCH_TYPE}" STREQUAL "")
|
||||||
set(NEO_CORE_OS_INTERFACE_LINUX_LOCAL_DG1
|
set(NEO_CORE_OS_INTERFACE_LINUX_LOCAL_DG1
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/local_memory_helper_dg1.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_dg1.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_tip_helper.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/drm_tip_helper.cpp
|
||||||
)
|
)
|
||||||
set_property(GLOBAL APPEND PROPERTY NEO_CORE_OS_INTERFACE_LINUX ${NEO_CORE_OS_INTERFACE_LINUX_LOCAL_DG1})
|
set_property(GLOBAL APPEND PROPERTY NEO_CORE_OS_INTERFACE_LINUX ${NEO_CORE_OS_INTERFACE_LINUX_LOCAL_DG1})
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "shared/source/os_interface/linux/local_memory_helper.h"
|
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
||||||
|
|
||||||
#include "third_party/uapi/drm/i915_drm.h"
|
#include "third_party/uapi/drm/i915_drm.h"
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ uint32_t createGemExtMemoryRegions(Drm *drm, void *data, uint32_t dataSize, size
|
|||||||
createExt.size = allocSize;
|
createExt.size = allocSize;
|
||||||
createExt.extensions = reinterpret_cast<uintptr_t>(&extRegions);
|
createExt.extensions = reinterpret_cast<uintptr_t>(&extRegions);
|
||||||
|
|
||||||
auto ret = LocalMemoryHelper::ioctl(drm, DRM_IOCTL_I915_GEM_CREATE_EXT, &createExt);
|
auto ret = IoctlHelper::ioctl(drm, DRM_IOCTL_I915_GEM_CREATE_EXT, &createExt);
|
||||||
|
|
||||||
handle = createExt.handle;
|
handle = createExt.handle;
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
||||||
|
|
||||||
|
namespace NEO {
|
||||||
|
extern IoctlHelper *ioctlHelperFactory[IGFX_MAX_PRODUCT];
|
||||||
|
|
||||||
|
struct EnableProductIoctlHelperDg1 {
|
||||||
|
EnableProductIoctlHelperDg1() {
|
||||||
|
IoctlHelper *pIoctlHelper = IoctlHelperImpl<IGFX_DG1>::get();
|
||||||
|
ioctlHelperFactory[IGFX_DG1] = pIoctlHelper;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static EnableProductIoctlHelperDg1 enableIoctlHelperDg1;
|
||||||
|
} // namespace NEO
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2021 Intel Corporation
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "shared/source/os_interface/linux/local_memory_helper.h"
|
|
||||||
|
|
||||||
namespace NEO {
|
|
||||||
extern LocalMemoryHelper *localMemoryHelperFactory[IGFX_MAX_PRODUCT];
|
|
||||||
|
|
||||||
struct EnableProductLocalMemoryHelperDg1 {
|
|
||||||
EnableProductLocalMemoryHelperDg1() {
|
|
||||||
LocalMemoryHelper *plocalMemHelper = LocalMemoryHelperImpl<IGFX_DG1>::get();
|
|
||||||
localMemoryHelperFactory[IGFX_DG1] = plocalMemHelper;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static EnableProductLocalMemoryHelperDg1 enableLocalMemoryHelperDg1;
|
|
||||||
} // namespace NEO
|
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||||
#include "shared/source/helpers/debug_helpers.h"
|
#include "shared/source/helpers/debug_helpers.h"
|
||||||
#include "shared/source/os_interface/linux/local_memory_helper.h"
|
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
||||||
|
|
||||||
#include "third_party/uapi/dg1/drm/i915_drm.h"
|
#include "third_party/uapi/dg1/drm/i915_drm.h"
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ extern bool isQueryDrmTip(uint8_t *dataQuery, int32_t length);
|
|||||||
extern std::unique_ptr<uint8_t[]> translateToDrmTip(uint8_t *dataQuery, int32_t &length);
|
extern std::unique_ptr<uint8_t[]> translateToDrmTip(uint8_t *dataQuery, int32_t &length);
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
uint32_t LocalMemoryHelperImpl<gfxProduct>::createGemExt(Drm *drm, void *data, uint32_t dataSize, size_t allocSize, uint32_t &handle) {
|
uint32_t IoctlHelperImpl<gfxProduct>::createGemExt(Drm *drm, void *data, uint32_t dataSize, size_t allocSize, uint32_t &handle) {
|
||||||
printDebugString(DebugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "Performing GEM_CREATE_EXT with { size: %lu", allocSize);
|
printDebugString(DebugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "Performing GEM_CREATE_EXT with { size: %lu", allocSize);
|
||||||
|
|
||||||
if (DebugManager.flags.PrintBOCreateDestroyResult.get()) {
|
if (DebugManager.flags.PrintBOCreateDestroyResult.get()) {
|
||||||
@@ -50,7 +50,7 @@ uint32_t LocalMemoryHelperImpl<gfxProduct>::createGemExt(Drm *drm, void *data, u
|
|||||||
createExt.size = allocSize;
|
createExt.size = allocSize;
|
||||||
createExt.extensions = reinterpret_cast<uintptr_t>(&setparamRegion);
|
createExt.extensions = reinterpret_cast<uintptr_t>(&setparamRegion);
|
||||||
|
|
||||||
auto ret = LocalMemoryHelper::ioctl(drm, DRM_IOCTL_I915_GEM_CREATE_EXT, &createExt);
|
auto ret = IoctlHelper::ioctl(drm, DRM_IOCTL_I915_GEM_CREATE_EXT, &createExt);
|
||||||
|
|
||||||
handle = createExt.handle;
|
handle = createExt.handle;
|
||||||
printDebugString(DebugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "GEM_CREATE_EXT with EXT_SETPARAM has returned: %d BO-%u with size: %lu\n", ret, createExt.handle, createExt.size);
|
printDebugString(DebugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "GEM_CREATE_EXT with EXT_SETPARAM has returned: %d BO-%u with size: %lu\n", ret, createExt.handle, createExt.size);
|
||||||
@@ -58,7 +58,7 @@ uint32_t LocalMemoryHelperImpl<gfxProduct>::createGemExt(Drm *drm, void *data, u
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
std::unique_ptr<uint8_t[]> LocalMemoryHelperImpl<gfxProduct>::translateIfRequired(uint8_t *dataQuery, int32_t length) {
|
std::unique_ptr<uint8_t[]> IoctlHelperImpl<gfxProduct>::translateIfRequired(uint8_t *dataQuery, int32_t length) {
|
||||||
if (isQueryDrmTip(dataQuery, length)) {
|
if (isQueryDrmTip(dataQuery, length)) {
|
||||||
DEBUG_BREAK_IF(true);
|
DEBUG_BREAK_IF(true);
|
||||||
return std::unique_ptr<uint8_t[]>(dataQuery);
|
return std::unique_ptr<uint8_t[]>(dataQuery);
|
||||||
@@ -67,5 +67,5 @@ std::unique_ptr<uint8_t[]> LocalMemoryHelperImpl<gfxProduct>::translateIfRequire
|
|||||||
return translateToDrmTip(data.get(), length);
|
return translateToDrmTip(data.get(), length);
|
||||||
}
|
}
|
||||||
|
|
||||||
template class LocalMemoryHelperImpl<gfxProduct>;
|
template class IoctlHelperImpl<gfxProduct>;
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
if(SUPPORT_XE_HP_SDV AND "${BRANCH_TYPE}" STREQUAL "")
|
if(SUPPORT_XE_HP_SDV AND "${BRANCH_TYPE}" STREQUAL "")
|
||||||
set(NEO_CORE_OS_INTERFACE_LINUX_LOCAL_XE_HP_SDV
|
set(NEO_CORE_OS_INTERFACE_LINUX_LOCAL_XE_HP_SDV
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/local_memory_helper_xe_hp_sdv.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_xe_hp_sdv.cpp
|
||||||
)
|
)
|
||||||
set_property(GLOBAL APPEND PROPERTY NEO_CORE_OS_INTERFACE_LINUX ${NEO_CORE_OS_INTERFACE_LINUX_LOCAL_XE_HP_SDV})
|
set_property(GLOBAL APPEND PROPERTY NEO_CORE_OS_INTERFACE_LINUX ${NEO_CORE_OS_INTERFACE_LINUX_LOCAL_XE_HP_SDV})
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
||||||
|
|
||||||
|
namespace NEO {
|
||||||
|
extern IoctlHelper *ioctlHelperFactory[IGFX_MAX_PRODUCT];
|
||||||
|
|
||||||
|
struct EnableProductIoctlHelperXeHpSdv {
|
||||||
|
EnableProductIoctlHelperXeHpSdv() {
|
||||||
|
IoctlHelper *pIoctlHelper = IoctlHelperImpl<IGFX_XE_HP_SDV>::get();
|
||||||
|
ioctlHelperFactory[IGFX_XE_HP_SDV] = pIoctlHelper;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static EnableProductIoctlHelperXeHpSdv enableIoctlHelperXeHpSdv;
|
||||||
|
} // namespace NEO
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2021 Intel Corporation
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "shared/source/os_interface/linux/local_memory_helper.h"
|
|
||||||
|
|
||||||
namespace NEO {
|
|
||||||
extern LocalMemoryHelper *localMemoryHelperFactory[IGFX_MAX_PRODUCT];
|
|
||||||
|
|
||||||
struct EnableProductLocalMemoryHelperXeHpSdv {
|
|
||||||
EnableProductLocalMemoryHelperXeHpSdv() {
|
|
||||||
LocalMemoryHelper *plocalMemHelper = LocalMemoryHelperImpl<IGFX_XE_HP_SDV>::get();
|
|
||||||
localMemoryHelperFactory[IGFX_XE_HP_SDV] = plocalMemHelper;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static EnableProductLocalMemoryHelperXeHpSdv enableLocalMemoryHelperXeHpSdv;
|
|
||||||
} // namespace NEO
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||||
#include "shared/source/os_interface/linux/local_memory_helper.h"
|
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
||||||
|
|
||||||
#include "third_party/uapi/xe_hp_sdv/drm/i915_drm.h"
|
#include "third_party/uapi/xe_hp_sdv/drm/i915_drm.h"
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ namespace NEO {
|
|||||||
constexpr static auto gfxProduct = IGFX_XE_HP_SDV;
|
constexpr static auto gfxProduct = IGFX_XE_HP_SDV;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
uint32_t LocalMemoryHelperImpl<gfxProduct>::createGemExt(Drm *drm, void *data, uint32_t dataSize, size_t allocSize, uint32_t &handle) {
|
uint32_t IoctlHelperImpl<gfxProduct>::createGemExt(Drm *drm, void *data, uint32_t dataSize, size_t allocSize, uint32_t &handle) {
|
||||||
drm_i915_gem_create_ext_memory_regions memRegions;
|
drm_i915_gem_create_ext_memory_regions memRegions;
|
||||||
memRegions.num_regions = dataSize;
|
memRegions.num_regions = dataSize;
|
||||||
memRegions.regions = reinterpret_cast<uintptr_t>(data);
|
memRegions.regions = reinterpret_cast<uintptr_t>(data);
|
||||||
@@ -44,10 +44,10 @@ uint32_t LocalMemoryHelperImpl<gfxProduct>::createGemExt(Drm *drm, void *data, u
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
std::unique_ptr<uint8_t[]> LocalMemoryHelperImpl<gfxProduct>::translateIfRequired(uint8_t *dataQuery, int32_t length) {
|
std::unique_ptr<uint8_t[]> IoctlHelperImpl<gfxProduct>::translateIfRequired(uint8_t *dataQuery, int32_t length) {
|
||||||
return std::unique_ptr<uint8_t[]>(dataQuery);
|
return std::unique_ptr<uint8_t[]>(dataQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
template class LocalMemoryHelperImpl<gfxProduct>;
|
template class IoctlHelperImpl<gfxProduct>;
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2021 Intel Corporation
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "shared/source/os_interface/linux/local_memory_helper.h"
|
|
||||||
|
|
||||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace NEO
|
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
#include "shared/source/helpers/debug_helpers.h"
|
#include "shared/source/helpers/debug_helpers.h"
|
||||||
#include "shared/source/helpers/hw_helper.h"
|
#include "shared/source/helpers/hw_helper.h"
|
||||||
#include "shared/source/os_interface/linux/drm_neo.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/ioctl_helper.h"
|
||||||
|
|
||||||
#include "drm/i915_drm.h"
|
#include "drm/i915_drm.h"
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ namespace NEO {
|
|||||||
|
|
||||||
uint32_t MemoryInfo::createGemExt(Drm *drm, void *data, uint32_t dataSize, size_t allocSize, uint32_t &handle) {
|
uint32_t MemoryInfo::createGemExt(Drm *drm, void *data, uint32_t dataSize, size_t allocSize, uint32_t &handle) {
|
||||||
auto pHwInfo = drm->getRootDeviceEnvironment().getHardwareInfo();
|
auto pHwInfo = drm->getRootDeviceEnvironment().getHardwareInfo();
|
||||||
return LocalMemoryHelper::get(pHwInfo->platform.eProductFamily)->createGemExt(drm, data, dataSize, allocSize, handle);
|
return IoctlHelper::get(pHwInfo->platform.eProductFamily)->createGemExt(drm, data, dataSize, allocSize, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
drm_i915_gem_memory_class_instance MemoryInfo::getMemoryRegionClassAndInstance(uint32_t memoryBank, const HardwareInfo &hwInfo) {
|
drm_i915_gem_memory_class_instance MemoryInfo::getMemoryRegionClassAndInstance(uint32_t memoryBank, const HardwareInfo &hwInfo) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ macro(macro_for_each_platform)
|
|||||||
if(EXISTS ${SRC_FILE})
|
if(EXISTS ${SRC_FILE})
|
||||||
list(APPEND neo_libult_common_SRCS_ENABLE_TESTED_HW ${SRC_FILE})
|
list(APPEND neo_libult_common_SRCS_ENABLE_TESTED_HW ${SRC_FILE})
|
||||||
endif()
|
endif()
|
||||||
set(SRC_FILE ${NEO_SHARED_DIRECTORY}/os_interface/linux/local${BRANCH_DIR_SUFFIX}${PLATFORM_IT_LOWER}/enable_local_memory_helper_${PLATFORM_IT_LOWER}.cpp)
|
set(SRC_FILE ${NEO_SHARED_DIRECTORY}/os_interface/linux/local${BRANCH_DIR_SUFFIX}${PLATFORM_IT_LOWER}/enable_ioctl_helper_${PLATFORM_IT_LOWER}.cpp)
|
||||||
if(EXISTS ${SRC_FILE})
|
if(EXISTS ${SRC_FILE})
|
||||||
list(APPEND neo_libult_common_SRCS_ENABLE_TESTED_HW_LINUX ${SRC_FILE})
|
list(APPEND neo_libult_common_SRCS_ENABLE_TESTED_HW_LINUX ${SRC_FILE})
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -107,13 +107,13 @@ HWTEST2_F(HwConfigTopologyQuery, WhenGettingTopologyFailsThenSetMaxValuesBasedOn
|
|||||||
|
|
||||||
TEST(DrmQueryTest, givenIoctlWhenParseToStringThenProperStringIsReturned) {
|
TEST(DrmQueryTest, givenIoctlWhenParseToStringThenProperStringIsReturned) {
|
||||||
for (auto ioctlCodeString : ioctlCodeStringMap) {
|
for (auto ioctlCodeString : ioctlCodeStringMap) {
|
||||||
EXPECT_STREQ(IoctlHelper::getIoctlString(ioctlCodeString.first).c_str(), ioctlCodeString.second);
|
EXPECT_STREQ(IoctlToStringHelper::getIoctlString(ioctlCodeString.first).c_str(), ioctlCodeString.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DrmQueryTest, givenIoctlParamWhenParseToStringThenProperStringIsReturned) {
|
TEST(DrmQueryTest, givenIoctlParamWhenParseToStringThenProperStringIsReturned) {
|
||||||
for (auto ioctlParamCodeString : ioctlParamCodeStringMap) {
|
for (auto ioctlParamCodeString : ioctlParamCodeStringMap) {
|
||||||
EXPECT_STREQ(IoctlHelper::getIoctlParamString(ioctlParamCodeString.first).c_str(), ioctlParamCodeString.second);
|
EXPECT_STREQ(IoctlToStringHelper::getIoctlParamString(ioctlParamCodeString.first).c_str(), ioctlParamCodeString.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user