diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_object.h')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h index 546f77cb7882..540e03fa159f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | |||
| @@ -33,6 +33,16 @@ | |||
| 33 | 33 | ||
| 34 | #define AMDGPU_BO_INVALID_OFFSET LONG_MAX | 34 | #define AMDGPU_BO_INVALID_OFFSET LONG_MAX |
| 35 | 35 | ||
| 36 | struct amdgpu_bo_param { | ||
| 37 | unsigned long size; | ||
| 38 | int byte_align; | ||
| 39 | u32 domain; | ||
| 40 | u32 preferred_domain; | ||
| 41 | u64 flags; | ||
| 42 | enum ttm_bo_type type; | ||
| 43 | struct reservation_object *resv; | ||
| 44 | }; | ||
| 45 | |||
| 36 | /* bo virtual addresses in a vm */ | 46 | /* bo virtual addresses in a vm */ |
| 37 | struct amdgpu_bo_va_mapping { | 47 | struct amdgpu_bo_va_mapping { |
| 38 | struct amdgpu_bo_va *bo_va; | 48 | struct amdgpu_bo_va *bo_va; |
| @@ -196,6 +206,27 @@ static inline bool amdgpu_bo_gpu_accessible(struct amdgpu_bo *bo) | |||
| 196 | } | 206 | } |
| 197 | 207 | ||
| 198 | /** | 208 | /** |
| 209 | * amdgpu_bo_in_cpu_visible_vram - check if BO is (partly) in visible VRAM | ||
| 210 | */ | ||
| 211 | static inline bool amdgpu_bo_in_cpu_visible_vram(struct amdgpu_bo *bo) | ||
| 212 | { | ||
| 213 | struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); | ||
| 214 | unsigned fpfn = adev->gmc.visible_vram_size >> PAGE_SHIFT; | ||
| 215 | struct drm_mm_node *node = bo->tbo.mem.mm_node; | ||
| 216 | unsigned long pages_left; | ||
| 217 | |||
| 218 | if (bo->tbo.mem.mem_type != TTM_PL_VRAM) | ||
| 219 | return false; | ||
| 220 | |||
| 221 | for (pages_left = bo->tbo.mem.num_pages; pages_left; | ||
| 222 | pages_left -= node->size, node++) | ||
| 223 | if (node->start < fpfn) | ||
| 224 | return true; | ||
| 225 | |||
| 226 | return false; | ||
| 227 | } | ||
| 228 | |||
| 229 | /** | ||
| 199 | * amdgpu_bo_explicit_sync - return whether the bo is explicitly synced | 230 | * amdgpu_bo_explicit_sync - return whether the bo is explicitly synced |
| 200 | */ | 231 | */ |
| 201 | static inline bool amdgpu_bo_explicit_sync(struct amdgpu_bo *bo) | 232 | static inline bool amdgpu_bo_explicit_sync(struct amdgpu_bo *bo) |
| @@ -203,10 +234,8 @@ static inline bool amdgpu_bo_explicit_sync(struct amdgpu_bo *bo) | |||
| 203 | return bo->flags & AMDGPU_GEM_CREATE_EXPLICIT_SYNC; | 234 | return bo->flags & AMDGPU_GEM_CREATE_EXPLICIT_SYNC; |
| 204 | } | 235 | } |
| 205 | 236 | ||
| 206 | int amdgpu_bo_create(struct amdgpu_device *adev, unsigned long size, | 237 | int amdgpu_bo_create(struct amdgpu_device *adev, |
| 207 | int byte_align, u32 domain, | 238 | struct amdgpu_bo_param *bp, |
| 208 | u64 flags, enum ttm_bo_type type, | ||
| 209 | struct reservation_object *resv, | ||
| 210 | struct amdgpu_bo **bo_ptr); | 239 | struct amdgpu_bo **bo_ptr); |
| 211 | int amdgpu_bo_create_reserved(struct amdgpu_device *adev, | 240 | int amdgpu_bo_create_reserved(struct amdgpu_device *adev, |
| 212 | unsigned long size, int align, | 241 | unsigned long size, int align, |
| @@ -230,6 +259,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, | |||
| 230 | int amdgpu_bo_unpin(struct amdgpu_bo *bo); | 259 | int amdgpu_bo_unpin(struct amdgpu_bo *bo); |
| 231 | int amdgpu_bo_evict_vram(struct amdgpu_device *adev); | 260 | int amdgpu_bo_evict_vram(struct amdgpu_device *adev); |
| 232 | int amdgpu_bo_init(struct amdgpu_device *adev); | 261 | int amdgpu_bo_init(struct amdgpu_device *adev); |
| 262 | int amdgpu_bo_late_init(struct amdgpu_device *adev); | ||
| 233 | void amdgpu_bo_fini(struct amdgpu_device *adev); | 263 | void amdgpu_bo_fini(struct amdgpu_device *adev); |
| 234 | int amdgpu_bo_fbdev_mmap(struct amdgpu_bo *bo, | 264 | int amdgpu_bo_fbdev_mmap(struct amdgpu_bo *bo, |
| 235 | struct vm_area_struct *vma); | 265 | struct vm_area_struct *vma); |
