diff --git a/shared/source/os_interface/linux/drm_memory_manager.cpp b/shared/source/os_interface/linux/drm_memory_manager.cpp index 82800642ca..080610f28e 100644 --- a/shared/source/os_interface/linux/drm_memory_manager.cpp +++ b/shared/source/os_interface/linux/drm_memory_manager.cpp @@ -964,6 +964,9 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o return nullptr; } + auto handle = static_cast(bo->getHandle()); + ioctlHelper->fillBindInfoForIpcHandle(handle, size); + auto getHeapIndex = [&] { if (requireSpecificBitness && this->force32bitAllocations) { return HeapIndex::HEAP_EXTERNAL; diff --git a/shared/source/os_interface/linux/ioctl_helper.cpp b/shared/source/os_interface/linux/ioctl_helper.cpp index 6db176c2f6..615d225cc8 100644 --- a/shared/source/os_interface/linux/ioctl_helper.cpp +++ b/shared/source/os_interface/linux/ioctl_helper.cpp @@ -557,6 +557,8 @@ std::unique_ptr IoctlHelper::createEngineInfo(bool isSysmanEnabled) return std::make_unique(&drm, tileCount, distanceInfos, queryItems, engines); } +void IoctlHelper::fillBindInfoForIpcHandle(uint32_t handle, size_t size) {} + uint32_t IoctlHelper::createGem(uint64_t size, uint32_t memoryBanks) { GemCreate gemCreate = {}; gemCreate.size = size; diff --git a/shared/source/os_interface/linux/ioctl_helper.h b/shared/source/os_interface/linux/ioctl_helper.h index dd611b2ee5..170bc38a6d 100644 --- a/shared/source/os_interface/linux/ioctl_helper.h +++ b/shared/source/os_interface/linux/ioctl_helper.h @@ -158,6 +158,7 @@ class IoctlHelper { virtual std::unique_ptr createEngineInfo(bool isSysmanEnabled); virtual bool getTopologyDataAndMap(const HardwareInfo &hwInfo, DrmQueryTopologyData &topologyData, TopologyMap &topologyMap); bool translateTopologyInfo(const QueryTopologyInfo *queryTopologyInfo, DrmQueryTopologyData &topologyData, TopologyMapping &mapping); + virtual void fillBindInfoForIpcHandle(uint32_t handle, size_t size); protected: Drm &drm; diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp b/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp index cc5a43bd0c..39d47d1c08 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp @@ -1480,4 +1480,9 @@ bool IoctlHelperXe::getGemTiling(void *setTiling) { return true; } +void IoctlHelperXe::fillBindInfoForIpcHandle(uint32_t handle, size_t size) { + xeLog(" -> IoctlHelperXe::%s s=0x%lx h=0x%x\n", __FUNCTION__, size, handle); + updateBindInfo(handle, 0, size); +} + } // namespace NEO diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe.h b/shared/source/os_interface/linux/xe/ioctl_helper_xe.h index b4b517a685..6e8cc69a63 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe.h +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe.h @@ -106,6 +106,7 @@ class IoctlHelperXe : public IoctlHelper { std::unique_ptr createMemoryInfo() override; void getTopologyData(uint32_t nTiles, std::vector> geomDss[2], std::vector> computeDss[2], std::vector> euDss[2], DrmQueryTopologyData &topologyData, bool &isComputeDssEmpty); void getTopologyMap(uint32_t nTiles, std::vector> dssInfo[2], TopologyMap &topologyMap); + void fillBindInfoForIpcHandle(uint32_t handle, size_t size) override; private: template 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 027b4105d3..b7711c84a8 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 @@ -1601,3 +1601,15 @@ TEST(IoctlHelperXeTest, whenXeShowBindTableIsCalledThenBindLogsArePrinted) { )"; EXPECT_STREQ(expectedOutput.c_str(), output.c_str()); } + +TEST(IoctlHelperXeTest, whenFillBindInfoForIpcHandleIsCalledThenBindInfoIsCorrect) { + auto executionEnvironment = std::make_unique(); + DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]}; + auto xeIoctlHelper = std::make_unique(drm); + uint32_t handle = 100; + size_t size = 1024u; + xeIoctlHelper->fillBindInfoForIpcHandle(handle, size); + auto bindInfo = xeIoctlHelper->bindInfo[0]; + EXPECT_EQ(bindInfo.handle, handle); + EXPECT_EQ(bindInfo.size, size); +}