diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_object.h')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h index 546f77cb7882..3bee13344065 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | |||
@@ -196,6 +196,27 @@ static inline bool amdgpu_bo_gpu_accessible(struct amdgpu_bo *bo) | |||
196 | } | 196 | } |
197 | 197 | ||
198 | /** | 198 | /** |
199 | * amdgpu_bo_in_cpu_visible_vram - check if BO is (partly) in visible VRAM | ||
200 | */ | ||
201 | static inline bool amdgpu_bo_in_cpu_visible_vram(struct amdgpu_bo *bo) | ||
202 | { | ||
203 | struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); | ||
204 | unsigned fpfn = adev->gmc.visible_vram_size >> PAGE_SHIFT; | ||
205 | struct drm_mm_node *node = bo->tbo.mem.mm_node; | ||
206 | unsigned long pages_left; | ||
207 | |||
208 | if (bo->tbo.mem.mem_type != TTM_PL_VRAM) | ||
209 | return false; | ||
210 | |||
211 | for (pages_left = bo->tbo.mem.num_pages; pages_left; | ||
212 | pages_left -= node->size, node++) | ||
213 | if (node->start < fpfn) | ||
214 | return true; | ||
215 | |||
216 | return false; | ||
217 | } | ||
218 | |||
219 | /** | ||
199 | * amdgpu_bo_explicit_sync - return whether the bo is explicitly synced | 220 | * amdgpu_bo_explicit_sync - return whether the bo is explicitly synced |
200 | */ | 221 | */ |
201 | static inline bool amdgpu_bo_explicit_sync(struct amdgpu_bo *bo) | 222 | static inline bool amdgpu_bo_explicit_sync(struct amdgpu_bo *bo) |