[PATCH v2] drm/amdgpu: use pre-calculated bo size
Nirmoy
nirmodas at amd.com
Tue Apr 13 20:58:32 UTC 2021
On 4/13/21 10:50 PM, Nirmoy Das wrote:
> Use bo->tbo.base.size instead of bo->tbo.mem.num_pages << PAGE_SHIFT.
Ignore this please, pressed send-email too quick!
>
> Signed-off-by: Nirmoy Das <nirmoy.das 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);
> --
> 2.30.2
>
More information about the amd-gfx
mailing list