diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-07-21 10:50:36 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2017-07-27 16:07:24 -0400 |
commit | adf27835a583470707debc55554b638dd85cb8a9 (patch) | |
tree | b62d322399c91ea2d54b6a1067e1f2110fb76fd9 | |
parent | bed8d1c840f0b3ddefc5c27a983a1d587cf873e9 (diff) |
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: 2889caa92321 ("drm/i915: Eliminate lots of iterations over the execobjects array")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101635
Signed-off-by: Chris 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.uk
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 1f727d9e725a408ef58d159c20fb2e51818ff153)
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_execbuffer.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 8125bb1c745e..d70ac429106f 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -1775,7 +1775,7 @@ out: | |||
1775 | } | 1775 | } |
1776 | } | 1776 | } |
1777 | 1777 | ||
1778 | return err ?: have_copy; | 1778 | return err; |
1779 | } | 1779 | } |
1780 | 1780 | ||
1781 | static int eb_relocate(struct i915_execbuffer *eb) | 1781 | static int eb_relocate(struct i915_execbuffer *eb) |
@@ -2209,7 +2209,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, | |||
2209 | goto err_unlock; | 2209 | goto err_unlock; |
2210 | 2210 | ||
2211 | err = eb_relocate(&eb); | 2211 | err = eb_relocate(&eb); |
2212 | if (err) | 2212 | if (err) { |
2213 | /* | 2213 | /* |
2214 | * If the user expects the execobject.offset and | 2214 | * If the user expects the execobject.offset and |
2215 | * reloc.presumed_offset to be an exact match, | 2215 | * reloc.presumed_offset to be an exact match, |
@@ -2218,8 +2218,8 @@ i915_gem_do_execbuffer(struct drm_device *dev, | |||
2218 | * relocation. | 2218 | * relocation. |
2219 | */ | 2219 | */ |
2220 | args->flags &= ~__EXEC_HAS_RELOC; | 2220 | args->flags &= ~__EXEC_HAS_RELOC; |
2221 | if (err < 0) | ||
2222 | goto err_vma; | 2221 | goto err_vma; |
2222 | } | ||
2223 | 2223 | ||
2224 | if (unlikely(eb.batch->exec_entry->flags & EXEC_OBJECT_WRITE)) { | 2224 | if (unlikely(eb.batch->exec_entry->flags & EXEC_OBJECT_WRITE)) { |
2225 | DRM_DEBUG("Attempting to use self-modifying batch buffer\n"); | 2225 | DRM_DEBUG("Attempting to use self-modifying batch buffer\n"); |