aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu
diff options
context:
space:
mode:
authorJunwei Zhang <Jerry.Zhang@amd.com>2016-09-20 22:33:26 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-10-25 14:38:13 -0400
commitcfa32556e58d8a353666fb007f708a4955c6711c (patch)
tree87d10b8d7cfcfc6454b68c9c6a007d1517ebd0fc /drivers/gpu/drm/amd/amdgpu
parent9f6163e7e342bd150efd01aa51432a2e73039762 (diff)
drm/amd/amdgpu: add info about vram and gtt max allocation size
Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 67b6274e25c8..09b94901faec 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -421,6 +421,24 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
421 min((size_t)size, sizeof(vram_gtt_total))) 421 min((size_t)size, sizeof(vram_gtt_total)))
422 ? -EFAULT : 0; 422 ? -EFAULT : 0;
423 } 423 }
424 case AMDGPU_INFO_VRAM_GTT_MAX: {
425 struct drm_amdgpu_info_vram_gtt_max vram_gtt_max;
426 u64 max_size;
427
428 max_size = adev->mc.real_vram_size - adev->vram_pin_size;
429 vram_gtt_max.vram_max_size = max_size * 3 / 4;
430
431 max_size = adev->mc.visible_vram_size - (adev->vram_pin_size -
432 adev->invisible_pin_size);
433 vram_gtt_max.vram_cpu_accessible_max_size = max_size * 3 / 4;
434
435 max_size = adev->mc.gtt_size - adev->gart_pin_size;
436 vram_gtt_max.gtt_max_size = max_size * 3 / 4;
437
438 return copy_to_user(out, &vram_gtt_max,
439 min((size_t)size, sizeof(vram_gtt_max)))
440 ? -EFAULT : 0;
441 }
424 case AMDGPU_INFO_READ_MMR_REG: { 442 case AMDGPU_INFO_READ_MMR_REG: {
425 unsigned n, alloc_size; 443 unsigned n, alloc_size;
426 uint32_t *regs; 444 uint32_t *regs;