Fix Linux Global Mem Size computation.

- we need to use getContextParam instead of get aperture size.

Change-Id: I83f39654019ef63eb5fc59566c013ffd5cb5ba25
This commit is contained in:
Mrozek, Michal
2018-03-15 15:54:28 +01:00
committed by sys_ocldev
parent 059104adef
commit 385fcdb7ca
3 changed files with 27 additions and 19 deletions

View File

@@ -456,11 +456,12 @@ void DrmMemoryManager::freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation)
uint64_t DrmMemoryManager::getSystemSharedMemory() {
uint64_t hostMemorySize = MemoryConstants::pageSize * (uint64_t)(sysconf(_SC_PHYS_PAGES));
drm_i915_gem_get_aperture getAperture;
auto ret = drm->ioctl(DRM_IOCTL_I915_GEM_GET_APERTURE, &getAperture);
drm_i915_gem_context_param getContextParam = {};
getContextParam.param = I915_CONTEXT_PARAM_GTT_SIZE;
auto ret = drm->ioctl(DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM, &getContextParam);
DEBUG_BREAK_IF(ret != 0);
((void)(ret));
uint64_t gpuMemorySize = getAperture.aper_size;
uint64_t gpuMemorySize = getContextParam.value;
return std::min(hostMemorySize, gpuMemorySize);
}