aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_object.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_object.h')
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.h42
1 files changed, 3 insertions, 39 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h
index a057a8e5a6e6..c6c8e43e6d9a 100644
--- a/drivers/gpu/drm/radeon/radeon_object.h
+++ b/drivers/gpu/drm/radeon/radeon_object.h
@@ -52,28 +52,7 @@ static inline unsigned radeon_mem_type_to_domain(u32 mem_type)
52 return 0; 52 return 0;
53} 53}
54 54
55/** 55int radeon_bo_reserve(struct radeon_bo *bo, bool no_wait);
56 * radeon_bo_reserve - reserve bo
57 * @bo: bo structure
58 * @no_wait: don't sleep while trying to reserve (return -EBUSY)
59 *
60 * Returns:
61 * -EBUSY: buffer is busy and @no_wait is true
62 * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by
63 * a signal. Release all buffer reservations and return to user-space.
64 */
65static inline int radeon_bo_reserve(struct radeon_bo *bo, bool no_wait)
66{
67 int r;
68
69 r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0);
70 if (unlikely(r != 0)) {
71 if (r != -ERESTARTSYS)
72 dev_err(bo->rdev->dev, "%p reserve failed\n", bo);
73 return r;
74 }
75 return 0;
76}
77 56
78static inline void radeon_bo_unreserve(struct radeon_bo *bo) 57static inline void radeon_bo_unreserve(struct radeon_bo *bo)
79{ 58{
@@ -118,23 +97,8 @@ static inline u64 radeon_bo_mmap_offset(struct radeon_bo *bo)
118 return bo->tbo.addr_space_offset; 97 return bo->tbo.addr_space_offset;
119} 98}
120 99
121static inline int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type, 100extern int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type,
122 bool no_wait, enum ttm_buffer_usage usage) 101 bool no_wait, enum ttm_buffer_usage usage);
123{
124 int r;
125
126 r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0);
127 if (unlikely(r != 0))
128 return r;
129 spin_lock(&bo->tbo.bdev->fence_lock);
130 if (mem_type)
131 *mem_type = bo->tbo.mem.mem_type;
132 if (bo->tbo.sync_obj)
133 r = ttm_bo_wait(&bo->tbo, true, true, no_wait, usage);
134 spin_unlock(&bo->tbo.bdev->fence_lock);
135 ttm_bo_unreserve(&bo->tbo);
136 return r;
137}
138 102
139extern int radeon_bo_create(struct radeon_device *rdev, 103extern int radeon_bo_create(struct radeon_device *rdev,
140 unsigned long size, int byte_align, 104 unsigned long size, int byte_align,