From 2762166a7b426b8e7ca2e9adb4fc94f85c423455 Mon Sep 17 00:00:00 2001 From: Radoslaw Jablonski Date: Wed, 14 May 2025 22:08:12 +0000 Subject: [PATCH] feature: add device caps query ioctl Related-To: NEO-13039 Signed-off-by: Radoslaw Jablonski --- shared/source/os_interface/linux/ioctl_helper.h | 1 + .../os_interface/linux/ioctl_helper_tests_prelim.cpp | 4 ++++ .../os_interface/linux/ioctl_helper_tests_upstream.cpp | 8 ++++++++ .../os_interface/linux/xe/ioctl_helper_xe_tests.cpp | 8 ++++++++ 4 files changed, 21 insertions(+) diff --git a/shared/source/os_interface/linux/ioctl_helper.h b/shared/source/os_interface/linux/ioctl_helper.h index 818030869d..8f0c34409b 100644 --- a/shared/source/os_interface/linux/ioctl_helper.h +++ b/shared/source/os_interface/linux/ioctl_helper.h @@ -241,6 +241,7 @@ class IoctlHelper { virtual void syncUserptrAlloc(DrmMemoryManager &memoryManager, GraphicsAllocation &allocation) { return; }; virtual bool queryDeviceParams(uint32_t *moduleId, uint16_t *serverType) { return false; } + virtual std::unique_ptr> queryDeviceCaps() { return nullptr; } virtual bool isTimestampsRefreshEnabled() { return false; } virtual uint32_t getNumProcesses() const { return 1; } diff --git a/shared/test/unit_test/os_interface/linux/ioctl_helper_tests_prelim.cpp b/shared/test/unit_test/os_interface/linux/ioctl_helper_tests_prelim.cpp index 1ba6944966..75d5aee1be 100644 --- a/shared/test/unit_test/os_interface/linux/ioctl_helper_tests_prelim.cpp +++ b/shared/test/unit_test/os_interface/linux/ioctl_helper_tests_prelim.cpp @@ -413,6 +413,10 @@ TEST_F(IoctlPrelimHelperTests, givenPrelimWhenQueryDeviceParamsIsCalledThenFalse EXPECT_FALSE(ioctlHelper.queryDeviceParams(&moduleId, &serverType)); } +TEST_F(IoctlPrelimHelperTests, givenPrelimWhenQueryDeviceCapsIsCalledThenNullptrIsReturned) { + EXPECT_EQ(ioctlHelper.queryDeviceCaps(), nullptr); +} + struct MockIoctlHelperPrelim20 : IoctlHelperPrelim20 { using IoctlHelperPrelim20::createGemExt; using IoctlHelperPrelim20::IoctlHelperPrelim20; diff --git a/shared/test/unit_test/os_interface/linux/ioctl_helper_tests_upstream.cpp b/shared/test/unit_test/os_interface/linux/ioctl_helper_tests_upstream.cpp index 38906391f4..1f7db8a34f 100644 --- a/shared/test/unit_test/os_interface/linux/ioctl_helper_tests_upstream.cpp +++ b/shared/test/unit_test/os_interface/linux/ioctl_helper_tests_upstream.cpp @@ -895,3 +895,11 @@ TEST(IoctlHelperTestsUpstream, givenUpstreamWhenQueryDeviceParamsIsCalledThenFal uint16_t serverType = 0; EXPECT_FALSE(ioctlHelper.queryDeviceParams(&moduleId, &serverType)); } + +TEST(IoctlHelperTestsUpstream, givenPrelimWhenQueryDeviceCapsIsCalledThenNullptrIsReturned) { + auto executionEnvironment = std::make_unique(); + auto drm = std::make_unique(*executionEnvironment->rootDeviceEnvironments[0]); + IoctlHelperUpstream ioctlHelper{*drm}; + + EXPECT_EQ(ioctlHelper.queryDeviceCaps(), nullptr); +} diff --git a/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp index 9b882ce49f..429e31d44c 100644 --- a/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp @@ -2588,6 +2588,14 @@ TEST_F(IoctlHelperXeTest, givenIoctlWhenQueryDeviceParamsIsCalledThenFalseIsRetu EXPECT_FALSE(xeIoctlHelper->queryDeviceParams(&moduleId, &serverType)); } +TEST_F(IoctlHelperXeTest, givenPrelimWhenQueryDeviceCapsIsCalledThenNullptrIsReturned) { + auto executionEnvironment = std::make_unique(); + auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]); + auto xeIoctlHelper = static_cast(drm->getIoctlHelper()); + + EXPECT_EQ(xeIoctlHelper->queryDeviceCaps(), nullptr); +} + TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingSetVmPrefetchThenVmBindIsCalled) { DebugManagerStateRestore restorer; debugManager.flags.EnableLocalMemory.set(1);