feature: add device caps query ioctl

Related-To: NEO-13039

Signed-off-by: Radoslaw Jablonski <radoslaw.jablonski@intel.com>
This commit is contained in:
Radoslaw Jablonski
2025-05-14 22:08:12 +00:00
committed by Compute-Runtime-Automation
parent e2228201ce
commit 2762166a7b
4 changed files with 21 additions and 0 deletions

View File

@@ -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<std::vector<uint32_t>> queryDeviceCaps() { return nullptr; }
virtual bool isTimestampsRefreshEnabled() { return false; }
virtual uint32_t getNumProcesses() const { return 1; }

View File

@@ -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;

View File

@@ -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<MockExecutionEnvironment>();
auto drm = std::make_unique<DrmTipMock>(*executionEnvironment->rootDeviceEnvironments[0]);
IoctlHelperUpstream ioctlHelper{*drm};
EXPECT_EQ(ioctlHelper.queryDeviceCaps(), nullptr);
}

View File

@@ -2588,6 +2588,14 @@ TEST_F(IoctlHelperXeTest, givenIoctlWhenQueryDeviceParamsIsCalledThenFalseIsRetu
EXPECT_FALSE(xeIoctlHelper->queryDeviceParams(&moduleId, &serverType));
}
TEST_F(IoctlHelperXeTest, givenPrelimWhenQueryDeviceCapsIsCalledThenNullptrIsReturned) {
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
EXPECT_EQ(xeIoctlHelper->queryDeviceCaps(), nullptr);
}
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingSetVmPrefetchThenVmBindIsCalled) {
DebugManagerStateRestore restorer;
debugManager.flags.EnableLocalMemory.set(1);