[PATCH 06/11] drm/amdgpu: use TTM values instead of MC values for the info queries

Alex Deucher alexdeucher at gmail.com
Thu Jul 6 16:19:35 UTC 2017


On Mon, Jul 3, 2017 at 5:44 AM, Christian König <deathsimple at vodafone.de> wrote:
> From: Christian König <christian.koenig at amd.com>
>
> Use the TTM values instead of the hardware config here.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 00ef2fc..7a8da32 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -484,7 +484,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
>                 vram_gtt.vram_size -= adev->vram_pin_size;
>                 vram_gtt.vram_cpu_accessible_size = adev->mc.visible_vram_size;
>                 vram_gtt.vram_cpu_accessible_size -= (adev->vram_pin_size - adev->invisible_pin_size);
> -               vram_gtt.gtt_size  = adev->mc.gtt_size;
> +               vram_gtt.gtt_size = adev->mman.bdev.man[TTM_PL_TT].size;
> +               vram_gtt.gtt_size *= PAGE_SIZE;
>                 vram_gtt.gtt_size -= adev->gart_pin_size;
>                 return copy_to_user(out, &vram_gtt,
>                                     min((size_t)size, sizeof(vram_gtt))) ? -EFAULT : 0;
> @@ -509,9 +510,10 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
>                 mem.cpu_accessible_vram.max_allocation =
>                         mem.cpu_accessible_vram.usable_heap_size * 3 / 4;
>
> -               mem.gtt.total_heap_size = adev->mc.gtt_size;
> -               mem.gtt.usable_heap_size =
> -                       adev->mc.gtt_size - adev->gart_pin_size;
> +               mem.gtt.total_heap_size = adev->mman.bdev.man[TTM_PL_TT].size;
> +               mem.gtt.total_heap_size *= PAGE_SIZE;
> +               mem.gtt.usable_heap_size = mem.gtt.total_heap_size
> +                       - adev->gart_pin_size;
>                 mem.gtt.heap_usage = atomic64_read(&adev->gtt_usage);
>                 mem.gtt.max_allocation = mem.gtt.usable_heap_size * 3 / 4;
>
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list