aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2010-05-06 11:02:24 -0400
committerDave Airlie <airlied@redhat.com>2010-05-18 04:21:48 -0400
commitca2af92311eee95820f3b48c35045e5f56bc1477 (patch)
tree2c343da47e494d2d04dff9601fa789cef02289e5 /drivers/gpu/drm
parent01434b4bfba17626fe93a602e540f0004694d9df (diff)
drm/radeon/kms: fix lock ordering in ring, ib handling
Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/radeon/radeon_ring.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c
index 6cc42591abd8..261e98a276db 100644
--- a/drivers/gpu/drm/radeon/radeon_ring.c
+++ b/drivers/gpu/drm/radeon/radeon_ring.c
@@ -219,24 +219,26 @@ int radeon_ib_pool_init(struct radeon_device *rdev)
219void radeon_ib_pool_fini(struct radeon_device *rdev) 219void radeon_ib_pool_fini(struct radeon_device *rdev)
220{ 220{
221 int r; 221 int r;
222 struct radeon_bo *robj;
222 223
223 if (!rdev->ib_pool.ready) { 224 if (!rdev->ib_pool.ready) {
224 return; 225 return;
225 } 226 }
226 mutex_lock(&rdev->ib_pool.mutex); 227 mutex_lock(&rdev->ib_pool.mutex);
227 radeon_ib_bogus_cleanup(rdev); 228 radeon_ib_bogus_cleanup(rdev);
229 robj = rdev->ib_pool.robj;
230 rdev->ib_pool.robj = NULL;
231 mutex_unlock(&rdev->ib_pool.mutex);
228 232
229 if (rdev->ib_pool.robj) { 233 if (robj) {
230 r = radeon_bo_reserve(rdev->ib_pool.robj, false); 234 r = radeon_bo_reserve(robj, false);
231 if (likely(r == 0)) { 235 if (likely(r == 0)) {
232 radeon_bo_kunmap(rdev->ib_pool.robj); 236 radeon_bo_kunmap(robj);
233 radeon_bo_unpin(rdev->ib_pool.robj); 237 radeon_bo_unpin(robj);
234 radeon_bo_unreserve(rdev->ib_pool.robj); 238 radeon_bo_unreserve(robj);
235 } 239 }
236 radeon_bo_unref(&rdev->ib_pool.robj); 240 radeon_bo_unref(&robj);
237 rdev->ib_pool.robj = NULL;
238 } 241 }
239 mutex_unlock(&rdev->ib_pool.mutex);
240} 242}
241 243
242 244
@@ -359,20 +361,23 @@ int radeon_ring_init(struct radeon_device *rdev, unsigned ring_size)
359void radeon_ring_fini(struct radeon_device *rdev) 361void radeon_ring_fini(struct radeon_device *rdev)
360{ 362{
361 int r; 363 int r;
364 struct radeon_bo *ring_obj;
362 365
363 mutex_lock(&rdev->cp.mutex); 366 mutex_lock(&rdev->cp.mutex);
364 if (rdev->cp.ring_obj) { 367 ring_obj = rdev->cp.ring_obj;
365 r = radeon_bo_reserve(rdev->cp.ring_obj, false); 368 rdev->cp.ring = NULL;
369 rdev->cp.ring_obj = NULL;
370 mutex_unlock(&rdev->cp.mutex);
371
372 if (ring_obj) {
373 r = radeon_bo_reserve(ring_obj, false);
366 if (likely(r == 0)) { 374 if (likely(r == 0)) {
367 radeon_bo_kunmap(rdev->cp.ring_obj); 375 radeon_bo_kunmap(ring_obj);
368 radeon_bo_unpin(rdev->cp.ring_obj); 376 radeon_bo_unpin(ring_obj);
369 radeon_bo_unreserve(rdev->cp.ring_obj); 377 radeon_bo_unreserve(ring_obj);
370 } 378 }
371 radeon_bo_unref(&rdev->cp.ring_obj); 379 radeon_bo_unref(&ring_obj);
372 rdev->cp.ring = NULL;
373 rdev->cp.ring_obj = NULL;
374 } 380 }
375 mutex_unlock(&rdev->cp.mutex);
376} 381}
377 382
378 383