mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Enable MemoryInfo for platforms without local mem
Query for memory regions on all platforms. Fix createPaddedAllocation when input allocation was made by KMD Resolves: NEO-6472 Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
3599e7aeda
commit
962d98a2d8
@@ -705,11 +705,25 @@ GraphicsAllocation *DrmMemoryManager::createPaddedAllocation(GraphicsAllocation
|
||||
auto rootDeviceIndex = inputGraphicsAllocation->getRootDeviceIndex();
|
||||
gpuRange = acquireGpuRange(sizeWithPadding, rootDeviceIndex, HeapIndex::HEAP_STANDARD);
|
||||
|
||||
auto srcPtr = inputGraphicsAllocation->getUnderlyingBuffer();
|
||||
void *srcPtr = nullptr;
|
||||
auto drmInputAllocation = static_cast<DrmAllocation *>(inputGraphicsAllocation);
|
||||
if (drmInputAllocation->getMmapPtr()) {
|
||||
auto bo = drmInputAllocation->getBO();
|
||||
drm_i915_gem_mmap mmap_arg = {};
|
||||
mmap_arg.handle = bo->peekHandle();
|
||||
mmap_arg.size = bo->peekSize();
|
||||
if (getDrm(rootDeviceIndex).ioctl(DRM_IOCTL_I915_GEM_MMAP, &mmap_arg) != 0) {
|
||||
return nullptr;
|
||||
}
|
||||
srcPtr = addrToPtr(mmap_arg.addr_ptr);
|
||||
inputGraphicsAllocation->lock(srcPtr);
|
||||
} else {
|
||||
srcPtr = inputGraphicsAllocation->getUnderlyingBuffer();
|
||||
}
|
||||
auto srcSize = inputGraphicsAllocation->getUnderlyingBufferSize();
|
||||
auto alignedSrcSize = alignUp(srcSize, MemoryConstants::pageSize);
|
||||
auto alignedPtr = (uintptr_t)alignDown(srcPtr, MemoryConstants::pageSize);
|
||||
auto offset = (uintptr_t)srcPtr - alignedPtr;
|
||||
auto alignedPtr = reinterpret_cast<uintptr_t>(alignDown(srcPtr, MemoryConstants::pageSize));
|
||||
auto offset = ptrDiff(srcPtr, alignedPtr);
|
||||
|
||||
std::unique_ptr<BufferObject, BufferObject::Deleter> bo(allocUserptr(alignedPtr, alignedSrcSize, 0, rootDeviceIndex));
|
||||
if (!bo) {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
#include "shared/source/os_interface/linux/cache_info_impl.h"
|
||||
#include "shared/source/os_interface/linux/drm_engine_mapper.h"
|
||||
@@ -49,12 +48,6 @@ std::unique_ptr<uint8_t[]> Drm::getMemoryRegions() {
|
||||
}
|
||||
|
||||
bool Drm::queryMemoryInfo() {
|
||||
auto pHwInfo = getRootDeviceEnvironment().getHardwareInfo();
|
||||
auto isLocalMemSupported = HwHelper::get(pHwInfo->platform.eRenderCoreFamily).getEnableLocalMemory(*pHwInfo);
|
||||
if (!isLocalMemSupported) {
|
||||
return true;
|
||||
}
|
||||
|
||||
auto length = 0;
|
||||
auto dataQuery = this->query(DRM_I915_QUERY_MEMORY_REGIONS, DrmQueryItemFlags::empty, length);
|
||||
if (dataQuery) {
|
||||
|
||||
Reference in New Issue
Block a user