Skip to content

Commit 7b1d692

Browse files
mlankhorstjlahtine-intel
authored andcommitted
drm/i915: Use i915_gem_object_ggtt_pin_ww for reloc_iomap
When removing short term pins, I've changed the the batch buffer pinning for relocation to use __i915_vma_pin, because i915_gem_object_ggtt_pin_ww was destroying the old vma. This caused regressions, because the functions are not identical. Fix the regressions by calling i915_gem_object_ggtt_pin_ww() again on ggtt-only platforms, but only if the batch can be pinned without being moved. Fixes: b5cfe6f ("drm/i915: Remove short-term pins from execbuf, v6.") Cc: Matthew Auld <[email protected]> Reported-by: Mateusz Jończyk <[email protected]> Tested-by: Hans de Goede <[email protected]> Signed-off-by: Maarten Lankhorst <[email protected]> Acked-by: Matthew Auld <[email protected]> Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/5806 Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 451374e) Signed-off-by: Joonas Lahtinen <[email protected]>
1 parent 89e96d8 commit 7b1d692

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,14 +1252,12 @@ static void *reloc_iomap(struct i915_vma *batch,
12521252
* Only attempt to pin the batch buffer to ggtt if the current batch
12531253
* is not inside ggtt, or the batch buffer is not misplaced.
12541254
*/
1255-
if (!i915_is_ggtt(batch->vm)) {
1255+
if (!i915_is_ggtt(batch->vm) ||
1256+
!i915_vma_misplaced(batch, 0, 0, PIN_MAPPABLE)) {
12561257
vma = i915_gem_object_ggtt_pin_ww(obj, &eb->ww, NULL, 0, 0,
12571258
PIN_MAPPABLE |
12581259
PIN_NONBLOCK /* NOWARN */ |
12591260
PIN_NOEVICT);
1260-
} else if (i915_vma_is_map_and_fenceable(batch)) {
1261-
__i915_vma_pin(batch);
1262-
vma = batch;
12631261
}
12641262

12651263
if (vma == ERR_PTR(-EDEADLK))

0 commit comments

Comments
 (0)