summaryrefslogtreecommitdiff
path: root/intel
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-05-08 16:30:44 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-11-21 10:15:52 +0100
commitec65f8d71eb3eb065c7cadf4153138435ac3b388 (patch)
treefeb47251916d00d396b967130dbb40617802b751 /intel
parent4f44ecc6beeaac5064871d41dcc4693b8e313859 (diff)
intel: Avoid overcounting fences when emitting self-referential relocs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'intel')
-rw-r--r--intel/intel_bufmgr_gem.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index b3e9dbad..14e92c95 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1812,6 +1812,14 @@ do_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
assert(offset <= bo->size - 4);
assert((write_domain & (write_domain - 1)) == 0);
+ /* An object needing a fence is a tiled buffer, so it won't have
+ * relocs to other buffers.
+ */
+ if (need_fence) {
+ assert(target_bo_gem->reloc_count == 0);
+ target_bo_gem->reloc_tree_fences = 1;
+ }
+
/* Make sure that we're not adding a reloc to something whose size has
* already been accounted for.
*/
@@ -1819,13 +1827,8 @@ do_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
if (target_bo_gem != bo_gem) {
target_bo_gem->used_as_reloc_target = true;
bo_gem->reloc_tree_size += target_bo_gem->reloc_tree_size;
+ bo_gem->reloc_tree_fences += target_bo_gem->reloc_tree_fences;
}
- /* An object needing a fence is a tiled buffer, so it won't have
- * relocs to other buffers.
- */
- if (need_fence)
- target_bo_gem->reloc_tree_fences = 1;
- bo_gem->reloc_tree_fences += target_bo_gem->reloc_tree_fences;
bo_gem->relocs[bo_gem->reloc_count].offset = offset;
bo_gem->relocs[bo_gem->reloc_count].delta = target_offset;