Revert "Return same fd handle on multiple calls to peekHandle"

This reverts commit 5c48e027b9.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2022-10-13 12:37:54 +02:00
committed by Compute-Runtime-Automation
parent 71149b29c5
commit 5094b279f6
6 changed files with 4 additions and 72 deletions

View File

@@ -38,19 +38,11 @@ std::string DrmAllocation::getAllocationInfoString() const {
}
uint64_t DrmAllocation::peekInternalHandle(MemoryManager *memoryManager) {
if (handles[0] != std::numeric_limits<uint32_t>::max()) {
return handles[0];
}
handles[0] = static_cast<uint64_t>((static_cast<DrmMemoryManager *>(memoryManager))->obtainFdFromHandle(getBO()->peekHandle(), this->rootDeviceIndex));
return handles[0];
return static_cast<uint64_t>((static_cast<DrmMemoryManager *>(memoryManager))->obtainFdFromHandle(getBO()->peekHandle(), this->rootDeviceIndex));
}
uint64_t DrmAllocation::peekInternalHandle(MemoryManager *memoryManager, uint32_t handleId) {
if (handles[handleId] != std::numeric_limits<uint32_t>::max()) {
return handles[handleId];
}
handles[handleId] = static_cast<uint64_t>((static_cast<DrmMemoryManager *>(memoryManager))->obtainFdFromHandle(getBufferObjectToModify(handleId)->peekHandle(), this->rootDeviceIndex));
return handles[handleId];
return static_cast<uint64_t>((static_cast<DrmMemoryManager *>(memoryManager))->obtainFdFromHandle(getBufferObjectToModify(handleId)->peekHandle(), this->rootDeviceIndex));
}
void DrmAllocation::setCachePolicy(CachePolicy memType) {

View File

@@ -40,7 +40,6 @@ class DrmAllocation : public GraphicsAllocation {
DrmAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, BufferObject *bo, void *ptrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool pool, uint64_t canonizedGpuAddress)
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, ptrIn, sizeIn, sharedHandle, pool, MemoryManager::maxOsContextCount, canonizedGpuAddress), bufferObjects(EngineLimits::maxHandleCount) {
bufferObjects[0] = bo;
handles.resize(EngineLimits::maxHandleCount, std::numeric_limits<uint32_t>::max());
}
DrmAllocation(uint32_t rootDeviceIndex, AllocationType allocationType, BufferObject *bo, void *ptrIn, uint64_t canonizedGpuAddress, size_t sizeIn, MemoryPool pool)
@@ -49,7 +48,6 @@ class DrmAllocation : public GraphicsAllocation {
DrmAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, BufferObject *bo, void *ptrIn, uint64_t canonizedGpuAddress, size_t sizeIn, MemoryPool pool)
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, ptrIn, canonizedGpuAddress, 0, sizeIn, pool, MemoryManager::maxOsContextCount), bufferObjects(EngineLimits::maxHandleCount) {
bufferObjects[0] = bo;
handles.resize(EngineLimits::maxHandleCount, std::numeric_limits<uint32_t>::max());
}
DrmAllocation(uint32_t rootDeviceIndex, AllocationType allocationType, BufferObjects &bos, void *ptrIn, uint64_t canonizedGpuAddress, size_t sizeIn, MemoryPool pool)
@@ -58,7 +56,6 @@ class DrmAllocation : public GraphicsAllocation {
DrmAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, BufferObjects &bos, void *ptrIn, uint64_t canonizedGpuAddress, size_t sizeIn, MemoryPool pool)
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, ptrIn, canonizedGpuAddress, 0, sizeIn, pool, MemoryManager::maxOsContextCount),
bufferObjects(bos) {
handles.resize(EngineLimits::maxHandleCount, std::numeric_limits<uint32_t>::max());
}
~DrmAllocation() override;
@@ -122,7 +119,6 @@ class DrmAllocation : public GraphicsAllocation {
MemAdviseFlags enabledMemAdviseFlags{};
StackVec<MemoryToUnmap, 1> memoryToUnmap;
uint32_t numHandles = 0u;
std::vector<uint64_t> handles;
void *mmapPtr = nullptr;
size_t mmapSize = 0u;