mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-27 07:44:16 +08:00
Refactor duplicate Linux code.
Related-To: NEO-3008 Change-Id: Ia920fc9e4b948fb73fe6c6abc7d2c35f1814dc85 Signed-off-by: Piotr Fusik <piotr.fusik@intel.com>
This commit is contained in:
@@ -176,8 +176,7 @@ NEO::BufferObject *DrmMemoryManager::allocUserptr(uintptr_t address, size_t size
|
||||
|
||||
void DrmMemoryManager::emitPinningRequest(BufferObject *bo, const AllocationData &allocationData) const {
|
||||
if (forcePinEnabled && pinBB != nullptr && allocationData.flags.forcePin && allocationData.size >= this->pinThreshold) {
|
||||
auto &osContextLinux = static_cast<OsContextLinux &>(getDefaultCommandStreamReceiver(0)->getOsContext());
|
||||
pinBB->pin(&bo, 1, osContextLinux.getDrmContextId());
|
||||
pinBB->pin(&bo, 1, getDefaultDrmContextId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,8 +599,7 @@ MemoryManager::AllocationStatus DrmMemoryManager::populateOsHandles(OsHandleStor
|
||||
}
|
||||
|
||||
if (validateHostPtrMemory) {
|
||||
auto &osContextLinux = static_cast<OsContextLinux &>(getDefaultCommandStreamReceiver(0)->getOsContext());
|
||||
int result = pinBB->pin(allocatedBos, numberOfBosAllocated, osContextLinux.getDrmContextId());
|
||||
int result = pinBB->pin(allocatedBos, numberOfBosAllocated, getDefaultDrmContextId());
|
||||
|
||||
if (result == EFAULT) {
|
||||
for (uint32_t i = 0; i < numberOfBosAllocated; i++) {
|
||||
@@ -723,4 +721,9 @@ int DrmMemoryManager::obtainFdFromHandle(int boHandle) {
|
||||
|
||||
return openFd.fd;
|
||||
}
|
||||
|
||||
uint32_t DrmMemoryManager::getDefaultDrmContextId() const {
|
||||
auto &osContextLinux = static_cast<OsContextLinux &>(getDefaultCommandStreamReceiver(0)->getOsContext());
|
||||
return osContextLinux.getDrmContextIds()[0];
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user