[PATCH] drm/amdgpu: fix amdgpu_bo_gpu_accessible()

Huang Rui ray.huang at amd.com
Fri Jul 14 00:49:56 UTC 2017


On Thu, Jul 13, 2017 at 06:22:50PM +0800, Christian König wrote:
> From: Christian König <christian.koenig at amd.com>
> 
> The test was relaxed a bit to much.
> 
> Signed-off-by: Christian König <christian.koenig at amd.com>

Nice catch, yes, we need take care the case that no gtt is bound.

Acked-by: Huang Rui <ray.huang at amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/
> amdgpu/amdgpu_object.h
> index 3824851..833b172 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> @@ -120,7 +120,11 @@ static inline u64 amdgpu_bo_mmap_offset(struct amdgpu_bo
> *bo)
>   */
>  static inline bool amdgpu_bo_gpu_accessible(struct amdgpu_bo *bo)
>  {
> -       return bo->tbo.mem.mem_type != TTM_PL_SYSTEM;
> +       switch (bo->tbo.mem.mem_type) {
> +       case TTM_PL_TT: return amdgpu_ttm_is_bound(bo->tbo.ttm);
> +       case TTM_PL_VRAM: return true;
> +       default: return false;
> +       }
>  }
>  
>  int amdgpu_bo_create(struct amdgpu_device *adev,
> --
> 2.7.4
> 


More information about the amd-gfx mailing list