summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2008-05-07 14:10:04 -0700
committerEric Anholt <eric@anholt.net>2008-05-07 14:10:04 -0700
commit06e9761f94599c6378c8fa0cdbd1e1c1776bae7a (patch)
treeba61d2c4b84be6e8e32480ab031e34568df0bdfc
parent5f5f01ed91f5ad50f2b38e11740a30441ac845a4 (diff)
GEM: Wait for existing rendering to complete before writing relocation data.
This should already have been generally safe since we don't change contents and put in new relocations between execbufs, so if we were writing in a new relocation then we'd already waited rendering to complete when we moved the target of the relocation. However, doing the right thing will be required if we do buffer reuse.
-rw-r--r--linux-core/i915_gem.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/linux-core/i915_gem.c b/linux-core/i915_gem.c
index f3adf39b..1d55eaa2 100644
--- a/linux-core/i915_gem.c
+++ b/linux-core/i915_gem.c
@@ -546,9 +546,18 @@ i915_gem_reloc_and_validate_object(struct drm_gem_object *obj,
return -EINVAL;
}
+ /* If the relocation already has the right value in it, no
+ * more work needs to be done.
+ */
if (target_obj_priv->gtt_offset == reloc.presumed_offset)
continue;
+ /* Now that we're going to actually write some data in,
+ * make sure that any rendering using this buffer's contents
+ * is completed.
+ */
+ i915_gem_object_wait_rendering(obj);
+
/* Map the page containing the relocation we're going to
* perform.
*/