[Intel-gfx] [PATCH 1/2] intel: Recount fences after rewinding relocations

Chris Wilson chris at chris-wilson.co.uk
Wed May 8 17:33:09 CEST 2013


Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59771
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 intel/intel_bufmgr_gem.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 3cf8503..6ebeec9 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1746,6 +1746,7 @@ drm_intel_gem_bo_clear_relocs(drm_intel_bo *bo, int start)
 	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
 	int i;
 	struct timespec time;
+	int fence_count;
 
 	clock_gettime(CLOCK_MONOTONIC, &time);
 
@@ -1753,13 +1754,19 @@ drm_intel_gem_bo_clear_relocs(drm_intel_bo *bo, int start)
 	/* Unreference the cleared target buffers */
 	for (i = start; i < bo_gem->reloc_count; i++) {
 		drm_intel_bo_gem *target_bo_gem = (drm_intel_bo_gem *) bo_gem->reloc_target_info[i].bo;
-		if (&target_bo_gem->bo != bo) {
-			bo_gem->reloc_tree_fences -= target_bo_gem->reloc_tree_fences;
+		if (&target_bo_gem->bo != bo)
 			drm_intel_gem_bo_unreference_locked_timed(&target_bo_gem->bo,
 								  time.tv_sec);
-		}
 	}
 	bo_gem->reloc_count = start;
+
+	fence_count = 0;
+	for (i = 0; i < bo_gem->reloc_count; i++) {
+		drm_intel_bo_gem *target_bo_gem = (drm_intel_bo_gem *) bo_gem->reloc_target_info[i].bo;
+		if (&target_bo_gem->bo != bo)
+			fence_count += target_bo_gem->reloc_tree_fences;
+	}
+	bo_gem->reloc_tree_fences = fence_count;
 }
 
 /**
-- 
1.7.10.4




More information about the Intel-gfx mailing list