Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > b1fb22ffa15a7d8d633eb47c378b338e > files > 8

libdrm-2.4.43-4.mga3.src.rpm

From 99d7a4cdfb3f300ce41011e15910a730a6eebcb1 Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris@chris-wilson.co.uk>
Date: Sun, 3 Mar 2013 10:03:48 +0000
Subject: [PATCH] Fix up fence counts

---
 intel/intel_bufmgr_gem.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index ca7f011..b761867 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1745,6 +1745,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);
 
@@ -1759,6 +1760,23 @@ drm_intel_gem_bo_clear_relocs(drm_intel_bo *bo, int start)
 		}
 	}
 	bo_gem->reloc_count = start;
+
+	fence_count = 0;
+	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)
+			fence_count += target_bo_gem->reloc_tree_fences;
+	}
+	if (fence_count != bo_gem->reloc_tree_fences) {
+		static int once;
+		if (!once) {
+			fprintf(stderr, "Fixing up fence counts; was %d, expected %d\n",
+				bo_gem->reloc_tree_fences,
+				fence_count);
+			once = 1;
+		}
+		bo_gem->reloc_tree_fences = fence_count;
+	}
 }
 
 /**
-- 
1.7.10.4