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.
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.
*/