svn commit: r254878 - head/sys/dev/drm2/ttm

Jean-Sebastien Pedron dumbbell at FreeBSD.org
Sun Aug 25 15:29:24 UTC 2013


Author: dumbbell
Date: Sun Aug 25 15:29:23 2013
New Revision: 254878
URL: http://svnweb.freebsd.org/changeset/base/254878

Log:
  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@

Modified:
  head/sys/dev/drm2/ttm/ttm_bo.c

Modified: head/sys/dev/drm2/ttm/ttm_bo.c
==============================================================================
--- head/sys/dev/drm2/ttm/ttm_bo.c	Sun Aug 25 15:26:45 2013	(r254877)
+++ head/sys/dev/drm2/ttm/ttm_bo.c	Sun Aug 25 15:29:23 2013	(r254878)
@@ -145,7 +145,7 @@ ttm_bo_wait_unreserved_locked(struct ttm
 		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_obj
 	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_b
 	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;
 }
 


More information about the svn-src-all mailing list