diff options
author | dumbbell <dumbbell@FreeBSD.org> | 2013-08-25 15:29:23 +0000 |
---|---|---|
committer | dumbbell <dumbbell@FreeBSD.org> | 2013-08-25 15:29:23 +0000 |
commit | 3e5001b6b248d01f9616d8e36d55e601aa02f2b8 (patch) | |
tree | 4e433256256931752da0a21325e98b4981264615 /sys/dev/drm2 | |
parent | b01e0cf4b5b59e78b37546e7af0547766a1b536f (diff) | |
download | FreeBSD-src-3e5001b6b248d01f9616d8e36d55e601aa02f2b8.zip FreeBSD-src-3e5001b6b248d01f9616d8e36d55e601aa02f2b8.tar.gz |
drm/ttm: Fix a reversed condition and add missing locks
This allows to run OpenGL applications on at least two test machines
with the Radeon driver.
Approved by: kib@
Diffstat (limited to 'sys/dev/drm2')
-rw-r--r-- | sys/dev/drm2/ttm/ttm_bo.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/dev/drm2/ttm/ttm_bo.c b/sys/dev/drm2/ttm/ttm_bo.c index d7b1d30..3b13540 100644 --- a/sys/dev/drm2/ttm/ttm_bo.c +++ b/sys/dev/drm2/ttm/ttm_bo.c @@ -145,7 +145,7 @@ ttm_bo_wait_unreserved_locked(struct ttm_buffer_object *bo, bool interruptible) flags = 0; wmsg = "ttbowu"; } - while (!ttm_bo_is_reserved(bo)) { + while (ttm_bo_is_reserved(bo)) { ret = -msleep(bo, &bo->glob->lru_lock, flags, wmsg, 0); if (ret != 0) break; @@ -281,14 +281,15 @@ int ttm_bo_reserve(struct ttm_buffer_object *bo, int put_count = 0; int ret; + mtx_lock(&bo->glob->lru_lock); ret = ttm_bo_reserve_nolru(bo, interruptible, no_wait, use_sequence, sequence); if (likely(ret == 0)) { - mtx_lock(&glob->lru_lock); put_count = ttm_bo_del_from_lru(bo); mtx_unlock(&glob->lru_lock); ttm_bo_list_ref_sub(bo, put_count, true); - } + } else + mtx_unlock(&bo->glob->lru_lock); return ret; } @@ -333,13 +334,14 @@ int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo, struct ttm_bo_global *glob = bo->glob; int put_count, ret; + mtx_lock(&glob->lru_lock); ret = ttm_bo_reserve_slowpath_nolru(bo, interruptible, sequence); if (likely(!ret)) { - mtx_lock(&glob->lru_lock); put_count = ttm_bo_del_from_lru(bo); mtx_unlock(&glob->lru_lock); ttm_bo_list_ref_sub(bo, put_count, true); - } + } else + mtx_unlock(&glob->lru_lock); return ret; } |