[PATCH 1/2] drm/amdgpu: use pre-calculated bo size

Christian König ckoenig.leichtzumerken at gmail.com
Wed Apr 14 06:52:58 UTC 2021


Am 13.04.21 um 22:57 schrieb Nirmoy Das:
> Use bo->tbo.base.size instead of calculating it from num_pages.

Those don't clash with the two I've send out yesterday, don't they?

>
> Signed-off-by: Nirmoy Das <nirmoy.das at amd.com>

Reviewed-by: Christian König <christian.koenig at amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 1345f7eba011..74ecc0c1863f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -1371,7 +1371,7 @@ vm_fault_t amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
>   	if (bo->mem.mem_type != TTM_PL_VRAM)
>   		return 0;
>   
> -	size = bo->mem.num_pages << PAGE_SHIFT;
> +	size = bo->base.size;
>   	offset = bo->mem.start << PAGE_SHIFT;
>   	if ((offset + size) <= adev->gmc.visible_vram_size)
>   		return 0;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 936b3cfdde55..26deace78539 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -2048,7 +2048,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo,
>   			return r;
>   	}
>   
> -	num_bytes = bo->tbo.mem.num_pages << PAGE_SHIFT;
> +	num_bytes = bo->tbo.base.size;
>   	num_loops = 0;
>   
>   	amdgpu_res_first(&bo->tbo.mem, 0, num_bytes, &cursor);



More information about the amd-gfx mailing list