Skip to content

Commit 071750e

Browse files
committed
drm/i915: Disable EXEC_OBJECT_ASYNC when doing relocations
If we write a relocation into the buffer, we require our own implicit synchronisation added after the start of the execbuf, outside of the user's control. As we may end up clflushing, or doing the patch itself on the GPU, asynchronously we need to look at the implicit serialisation on obj->resv and hence need to disable EXEC_OBJECT_ASYNC for this object. If the user does trigger a stall for relocations, we make sure the stall is complete enough so that the batch is not submitted before we complete those relocations. Fixes: 77ae995 ("drm/i915: Enable userspace to opt-out of implicit fencing") Signed-off-by: Chris Wilson <[email protected]> Cc: Joonas Lahtinen <[email protected]> Cc: Jason Ekstrand <[email protected]> Reviewed-by: Joonas Lahtinen <[email protected]>
1 parent 507d977 commit 071750e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/gpu/drm/i915/i915_gem_execbuffer.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,16 @@ eb_relocate_entry(struct i915_vma *vma,
699699
return -EINVAL;
700700
}
701701

702+
/*
703+
* If we write into the object, we need to force the synchronisation
704+
* barrier, either with an asynchronous clflush or if we executed the
705+
* patching using the GPU (though that should be serialised by the
706+
* timeline). To be completely sure, and since we are required to
707+
* do relocations we are already stalling, disable the user's opt
708+
* of our synchronisation.
709+
*/
710+
vma->exec_entry->flags &= ~EXEC_OBJECT_ASYNC;
711+
702712
ret = relocate_entry(vma->obj, reloc, &eb->reloc_cache, target_offset);
703713
if (ret)
704714
return ret;

0 commit comments

Comments
 (0)