Add support for tiling mode selection to VA sharing

Change-Id: I459c472a4b8d74dba70df54c9da29865672114eb
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2019-04-02 10:53:22 +02:00
committed by sys_ocldev
parent 2243fc950b
commit b13bd16665
12 changed files with 171 additions and 9 deletions

View File

@@ -21,6 +21,7 @@
#include "runtime/os_interface/32bit_memory.h"
#include "runtime/os_interface/linux/os_context_linux.h"
#include "runtime/os_interface/linux/os_interface.h"
#include "runtime/os_interface/linux/tiling_mode_helper.h"
#include "drm/i915_drm.h"
@@ -500,7 +501,7 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o
lock.unlock();
auto drmAllocation = new DrmAllocation(GraphicsAllocation::AllocationType::UNDECIDED, bo, reinterpret_cast<void *>(bo->gpuAddress), bo->size,
auto drmAllocation = new DrmAllocation(properties.allocationType, bo, reinterpret_cast<void *>(bo->gpuAddress), bo->size,
handle, MemoryPool::SystemCpuInaccessible, false);
if (requireSpecificBitness && this->force32bitAllocations) {
@@ -509,6 +510,19 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o
} else if (this->limitedGpuAddressRangeAllocator.get()) {
drmAllocation->setGpuBaseAddress(this->limitedGpuAddressRangeAllocator->getBase());
}
if (properties.imgInfo) {
drm_i915_gem_get_tiling getTiling = {0};
getTiling.handle = boHandle;
ret = this->drm->ioctl(DRM_IOCTL_I915_GEM_GET_TILING, &getTiling);
DEBUG_BREAK_IF(ret != 0);
((void)(ret));
properties.imgInfo->tilingMode = TilingModeHelper::convert(getTiling.tiling_mode);
Gmm *gmm = new Gmm(*properties.imgInfo);
drmAllocation->setDefaultGmm(gmm);
}
return drmAllocation;
}