Commit adf27835 authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter

drm/i915: Only skip updating execobject.offset after error

I was being overly paranoid in not updating the execobject.offset after
performing the fallback copy where we set reloc.presumed_offset to -1.
The thinking was to ensure that a subsequent NORELOC execbuf would be
forced to process the invalid relocations. However this is overkill so
long as we *only* update the execobject.offset following a successful
update of the relocation value witin the batch. If we have to repeat the
execbuf due to a later interruption, then we may skip the relocations on
the second pass (honouring NORELOC) since the execobject.offset match
the actual offsets (even though reloc.presumed_offset is garbage).

Subsequent calls to execbuf with NORELOC should themselves ensure that
the reloc.presumed_offset have been corrected in case of future
migration.

Reporting back the actual execobject.offset, even when
reloc.presumed_offset is garbage, ensures that reuse of those objects
use the latest information to avoid relocations.

Fixes: 2889caa9 ("drm/i915: Eliminate lots of iterations over the execobjects array")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101635Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170721145037.25105-4-chris@chris-wilson.co.ukReviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 1f727d9e)
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent bed8d1c8
...@@ -1775,7 +1775,7 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb) ...@@ -1775,7 +1775,7 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb)
} }
} }
return err ?: have_copy; return err;
} }
static int eb_relocate(struct i915_execbuffer *eb) static int eb_relocate(struct i915_execbuffer *eb)
...@@ -2209,7 +2209,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, ...@@ -2209,7 +2209,7 @@ i915_gem_do_execbuffer(struct drm_device *dev,
goto err_unlock; goto err_unlock;
err = eb_relocate(&eb); err = eb_relocate(&eb);
if (err) if (err) {
/* /*
* If the user expects the execobject.offset and * If the user expects the execobject.offset and
* reloc.presumed_offset to be an exact match, * reloc.presumed_offset to be an exact match,
...@@ -2218,8 +2218,8 @@ i915_gem_do_execbuffer(struct drm_device *dev, ...@@ -2218,8 +2218,8 @@ i915_gem_do_execbuffer(struct drm_device *dev,
* relocation. * relocation.
*/ */
args->flags &= ~__EXEC_HAS_RELOC; args->flags &= ~__EXEC_HAS_RELOC;
if (err < 0)
goto err_vma; goto err_vma;
}
if (unlikely(eb.batch->exec_entry->flags & EXEC_OBJECT_WRITE)) { if (unlikely(eb.batch->exec_entry->flags & EXEC_OBJECT_WRITE)) {
DRM_DEBUG("Attempting to use self-modifying batch buffer\n"); DRM_DEBUG("Attempting to use self-modifying batch buffer\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment