aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_object.c18
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_object.h16
2 files changed, 19 insertions, 15 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 93573586e2de..67de19c46ddb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -737,3 +737,21 @@ void amdgpu_bo_fence(struct amdgpu_bo *bo, struct fence *fence,
737 else 737 else
738 reservation_object_add_excl_fence(resv, fence); 738 reservation_object_add_excl_fence(resv, fence);
739} 739}
740
741/**
742 * amdgpu_bo_gpu_offset - return GPU offset of bo
743 * @bo: amdgpu object for which we query the offset
744 *
745 * Returns current GPU offset of the object.
746 *
747 * Note: object should either be pinned or reserved when calling this
748 * function, it might be useful to add check for this for debugging.
749 */
750u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo)
751{
752 WARN_ON_ONCE(bo->tbo.mem.mem_type == TTM_PL_SYSTEM);
753 WARN_ON_ONCE(!ww_mutex_is_locked(&bo->tbo.resv->lock) &&
754 !bo->pin_count);
755
756 return bo->tbo.offset;
757}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
index ae188a88082d..d650b42279e5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
@@ -85,21 +85,6 @@ static inline void amdgpu_bo_unreserve(struct amdgpu_bo *bo)
85 ttm_bo_unreserve(&bo->tbo); 85 ttm_bo_unreserve(&bo->tbo);
86} 86}
87 87
88/**
89 * amdgpu_bo_gpu_offset - return GPU offset of bo
90 * @bo: amdgpu object for which we query the offset
91 *
92 * Returns current GPU offset of the object.
93 *
94 * Note: object should either be pinned or reserved when calling this
95 * function, it might be useful to add check for this for debugging.
96 */
97static inline u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo)
98{
99 WARN_ON_ONCE(bo->tbo.mem.mem_type == TTM_PL_SYSTEM);
100 return bo->tbo.offset;
101}
102
103static inline unsigned long amdgpu_bo_size(struct amdgpu_bo *bo) 88static inline unsigned long amdgpu_bo_size(struct amdgpu_bo *bo)
104{ 89{
105 return bo->tbo.num_pages << PAGE_SHIFT; 90 return bo->tbo.num_pages << PAGE_SHIFT;
@@ -169,6 +154,7 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
169int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo); 154int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo);
170void amdgpu_bo_fence(struct amdgpu_bo *bo, struct fence *fence, 155void amdgpu_bo_fence(struct amdgpu_bo *bo, struct fence *fence,
171 bool shared); 156 bool shared);
157u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo);
172 158
173/* 159/*
174 * sub allocation 160 * sub allocation