diff options
author | Maarten Lankhorst <maarten.lankhorst@canonical.com> | 2014-01-21 07:07:01 -0500 |
---|---|---|
committer | Maarten Lankhorst <maarten.lankhorst@canonical.com> | 2014-09-01 04:16:43 -0400 |
commit | 7040138ff85501931138970663a988f48c0666f0 (patch) | |
tree | 66152b3f394328070d4dbe409fd5fddbb5bc069e /drivers/gpu/drm/ttm | |
parent | bdaf7ddf652ef51fd363b052e320711c06f6f553 (diff) |
drm/ttm: call ttm_bo_wait while inside a reservation
This is the last remaining function that doesn't use the reservation
lock completely to fence off access to a buffer.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Diffstat (limited to 'drivers/gpu/drm/ttm')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index b992ec3c318a..4f1bc948bda0 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -503,17 +503,6 @@ static int ttm_bo_cleanup_refs_and_unlock(struct ttm_buffer_object *bo, | |||
503 | if (ret) | 503 | if (ret) |
504 | return ret; | 504 | return ret; |
505 | 505 | ||
506 | /* | ||
507 | * remove sync_obj with ttm_bo_wait, the wait should be | ||
508 | * finished, and no new wait object should have been added. | ||
509 | */ | ||
510 | spin_lock(&bdev->fence_lock); | ||
511 | ret = ttm_bo_wait(bo, false, false, true); | ||
512 | WARN_ON(ret); | ||
513 | spin_unlock(&bdev->fence_lock); | ||
514 | if (ret) | ||
515 | return ret; | ||
516 | |||
517 | spin_lock(&glob->lru_lock); | 506 | spin_lock(&glob->lru_lock); |
518 | ret = __ttm_bo_reserve(bo, false, true, false, NULL); | 507 | ret = __ttm_bo_reserve(bo, false, true, false, NULL); |
519 | 508 | ||
@@ -529,8 +518,16 @@ static int ttm_bo_cleanup_refs_and_unlock(struct ttm_buffer_object *bo, | |||
529 | spin_unlock(&glob->lru_lock); | 518 | spin_unlock(&glob->lru_lock); |
530 | return 0; | 519 | return 0; |
531 | } | 520 | } |
532 | } else | 521 | |
533 | spin_unlock(&bdev->fence_lock); | 522 | /* |
523 | * remove sync_obj with ttm_bo_wait, the wait should be | ||
524 | * finished, and no new wait object should have been added. | ||
525 | */ | ||
526 | spin_lock(&bdev->fence_lock); | ||
527 | ret = ttm_bo_wait(bo, false, false, true); | ||
528 | WARN_ON(ret); | ||
529 | } | ||
530 | spin_unlock(&bdev->fence_lock); | ||
534 | 531 | ||
535 | if (ret || unlikely(list_empty(&bo->ddestroy))) { | 532 | if (ret || unlikely(list_empty(&bo->ddestroy))) { |
536 | __ttm_bo_unreserve(bo); | 533 | __ttm_bo_unreserve(bo); |
@@ -1524,6 +1521,8 @@ int ttm_bo_wait(struct ttm_buffer_object *bo, | |||
1524 | void *sync_obj; | 1521 | void *sync_obj; |
1525 | int ret = 0; | 1522 | int ret = 0; |
1526 | 1523 | ||
1524 | lockdep_assert_held(&bo->resv->lock.base); | ||
1525 | |||
1527 | if (likely(bo->sync_obj == NULL)) | 1526 | if (likely(bo->sync_obj == NULL)) |
1528 | return 0; | 1527 | return 0; |
1529 | 1528 | ||