Subversion Repositories Kolibri OS

Rev

Rev 1321 | Rev 1428 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1321 Rev 1404
Line 57... Line 57...
57
 * @bo:		bo structure
57
 * @bo:		bo structure
58
 * @no_wait:		don't sleep while trying to reserve (return -EBUSY)
58
 * @no_wait:		don't sleep while trying to reserve (return -EBUSY)
59
 *
59
 *
60
 * Returns:
60
 * Returns:
61
 * -EBUSY: buffer is busy and @no_wait is true
61
 * -EBUSY: buffer is busy and @no_wait is true
62
 * -ERESTART: A wait for the buffer to become unreserved was interrupted by
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.
63
 * a signal. Release all buffer reservations and return to user-space.
64
     */
64
 */
65
static inline int radeon_bo_reserve(struct radeon_bo *bo, bool no_wait)
-
 
66
{
-
 
67
	int r;
-
 
68
 
-
 
69
retry:
-
 
70
	r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0);
-
 
71
	if (unlikely(r != 0)) {
-
 
72
		if (r == -ERESTART)
-
 
73
			goto retry;
-
 
74
		dev_err(bo->rdev->dev, "%p reserve failed\n", bo);
-
 
75
		return r;
-
 
76
	}
-
 
77
	return 0;
-
 
78
}
-
 
Line 79... Line 65...
79
 
65
 
80
static inline void radeon_bo_unreserve(struct radeon_bo *bo)
66
static inline void radeon_bo_unreserve(struct radeon_bo *bo)
81
{
67
{
82
	ttm_bo_unreserve(&bo->tbo);
68
	ttm_bo_unreserve(&bo->tbo);
Line 123... Line 109...
123
static inline int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type,
109
static inline int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type,
124
					bool no_wait)
110
					bool no_wait)
125
{
111
{
126
	int r;
112
	int r;
Line 127... Line -...
127
 
-
 
128
retry:
113
 
129
	r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0);
114
	r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0);
130
	if (unlikely(r != 0)) {
115
	if (unlikely(r != 0)) {
131
		if (r == -ERESTART)
-
 
132
			goto retry;
116
		if (r != -ERESTARTSYS)
133
		dev_err(bo->rdev->dev, "%p reserve failed for wait\n", bo);
117
		dev_err(bo->rdev->dev, "%p reserve failed for wait\n", bo);
134
		return r;
118
		return r;
135
	}
119
	}
136
	spin_lock(&bo->tbo.lock);
120
	spin_lock(&bo->tbo.lock);
137
	if (mem_type)
121
	if (mem_type)
138
		*mem_type = bo->tbo.mem.mem_type;
122
		*mem_type = bo->tbo.mem.mem_type;
139
	if (bo->tbo.sync_obj)
123
	if (bo->tbo.sync_obj)
140
		r = ttm_bo_wait(&bo->tbo, true, true, no_wait);
124
		r = ttm_bo_wait(&bo->tbo, true, true, no_wait);
141
	spin_unlock(&bo->tbo.lock);
125
	spin_unlock(&bo->tbo.lock);
142
	ttm_bo_unreserve(&bo->tbo);
-
 
143
	if (unlikely(r == -ERESTART))
-
 
144
		goto retry;
126
	ttm_bo_unreserve(&bo->tbo);
145
	return r;
127
	return r;
Line 146... Line 128...
146
}
128
}
147
 
129