diff options
Diffstat (limited to 'include/drm')
| -rw-r--r-- | include/drm/ttm/ttm_bo_driver.h | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 5d8aabe68f6c..a5183da3ef92 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
| @@ -788,7 +788,7 @@ extern void ttm_bo_del_sub_from_lru(struct ttm_buffer_object *bo); | |||
| 788 | extern void ttm_bo_add_to_lru(struct ttm_buffer_object *bo); | 788 | extern void ttm_bo_add_to_lru(struct ttm_buffer_object *bo); |
| 789 | 789 | ||
| 790 | /** | 790 | /** |
| 791 | * ttm_bo_reserve_nolru: | 791 | * __ttm_bo_reserve: |
| 792 | * | 792 | * |
| 793 | * @bo: A pointer to a struct ttm_buffer_object. | 793 | * @bo: A pointer to a struct ttm_buffer_object. |
| 794 | * @interruptible: Sleep interruptible if waiting. | 794 | * @interruptible: Sleep interruptible if waiting. |
| @@ -809,10 +809,10 @@ extern void ttm_bo_add_to_lru(struct ttm_buffer_object *bo); | |||
| 809 | * -EALREADY: Bo already reserved using @ticket. This error code will only | 809 | * -EALREADY: Bo already reserved using @ticket. This error code will only |
| 810 | * be returned if @use_ticket is set to true. | 810 | * be returned if @use_ticket is set to true. |
| 811 | */ | 811 | */ |
| 812 | static inline int ttm_bo_reserve_nolru(struct ttm_buffer_object *bo, | 812 | static inline int __ttm_bo_reserve(struct ttm_buffer_object *bo, |
| 813 | bool interruptible, | 813 | bool interruptible, |
| 814 | bool no_wait, bool use_ticket, | 814 | bool no_wait, bool use_ticket, |
| 815 | struct ww_acquire_ctx *ticket) | 815 | struct ww_acquire_ctx *ticket) |
| 816 | { | 816 | { |
| 817 | int ret = 0; | 817 | int ret = 0; |
| 818 | 818 | ||
| @@ -888,8 +888,7 @@ static inline int ttm_bo_reserve(struct ttm_buffer_object *bo, | |||
| 888 | 888 | ||
| 889 | WARN_ON(!atomic_read(&bo->kref.refcount)); | 889 | WARN_ON(!atomic_read(&bo->kref.refcount)); |
| 890 | 890 | ||
| 891 | ret = ttm_bo_reserve_nolru(bo, interruptible, no_wait, use_ticket, | 891 | ret = __ttm_bo_reserve(bo, interruptible, no_wait, use_ticket, ticket); |
| 892 | ticket); | ||
| 893 | if (likely(ret == 0)) | 892 | if (likely(ret == 0)) |
| 894 | ttm_bo_del_sub_from_lru(bo); | 893 | ttm_bo_del_sub_from_lru(bo); |
| 895 | 894 | ||
| @@ -929,20 +928,14 @@ static inline int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo, | |||
| 929 | } | 928 | } |
| 930 | 929 | ||
| 931 | /** | 930 | /** |
| 932 | * ttm_bo_unreserve_ticket | 931 | * __ttm_bo_unreserve |
| 933 | * @bo: A pointer to a struct ttm_buffer_object. | 932 | * @bo: A pointer to a struct ttm_buffer_object. |
| 934 | * @ticket: ww_acquire_ctx used for reserving | ||
| 935 | * | 933 | * |
| 936 | * Unreserve a previous reservation of @bo made with @ticket. | 934 | * Unreserve a previous reservation of @bo where the buffer object is |
| 935 | * already on lru lists. | ||
| 937 | */ | 936 | */ |
| 938 | static inline void ttm_bo_unreserve_ticket(struct ttm_buffer_object *bo, | 937 | static inline void __ttm_bo_unreserve(struct ttm_buffer_object *bo) |
| 939 | struct ww_acquire_ctx *t) | ||
| 940 | { | 938 | { |
| 941 | if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) { | ||
| 942 | spin_lock(&bo->glob->lru_lock); | ||
| 943 | ttm_bo_add_to_lru(bo); | ||
| 944 | spin_unlock(&bo->glob->lru_lock); | ||
| 945 | } | ||
| 946 | ww_mutex_unlock(&bo->resv->lock); | 939 | ww_mutex_unlock(&bo->resv->lock); |
| 947 | } | 940 | } |
| 948 | 941 | ||
| @@ -955,7 +948,25 @@ static inline void ttm_bo_unreserve_ticket(struct ttm_buffer_object *bo, | |||
| 955 | */ | 948 | */ |
| 956 | static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo) | 949 | static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo) |
| 957 | { | 950 | { |
| 958 | ttm_bo_unreserve_ticket(bo, NULL); | 951 | if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) { |
| 952 | spin_lock(&bo->glob->lru_lock); | ||
| 953 | ttm_bo_add_to_lru(bo); | ||
| 954 | spin_unlock(&bo->glob->lru_lock); | ||
| 955 | } | ||
| 956 | __ttm_bo_unreserve(bo); | ||
| 957 | } | ||
| 958 | |||
| 959 | /** | ||
| 960 | * ttm_bo_unreserve_ticket | ||
| 961 | * @bo: A pointer to a struct ttm_buffer_object. | ||
| 962 | * @ticket: ww_acquire_ctx used for reserving | ||
| 963 | * | ||
| 964 | * Unreserve a previous reservation of @bo made with @ticket. | ||
| 965 | */ | ||
| 966 | static inline void ttm_bo_unreserve_ticket(struct ttm_buffer_object *bo, | ||
| 967 | struct ww_acquire_ctx *t) | ||
| 968 | { | ||
| 969 | ttm_bo_unreserve(bo); | ||
| 959 | } | 970 | } |
| 960 | 971 | ||
| 961 | /* | 972 | /* |
