Skip to content

Commit 251e8c5

Browse files
robclarkrodrigovivi
authored andcommitted
drm/i915: Move fd_install after last use of fence
Because eb_composite_fence_create() drops the fence_array reference after creation of the sync_file, only the sync_file holds a ref to the fence. But fd_install() makes that reference visable to userspace, so it must be the last thing we do with the fence. Signed-off-by: Rob Clark <[email protected]> Fixes: 00dae4d ("drm/i915: Implement SINGLE_TIMELINE with a syncobj (v4)") Cc: <[email protected]> # v5.15+ [tursulin: Added stable tag.] Reviewed-by: Tvrtko Ursulin <[email protected]> Signed-off-by: Tvrtko Ursulin <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 960dafa) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent 039a72c commit 251e8c5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3483,6 +3483,13 @@ i915_gem_do_execbuffer(struct drm_device *dev,
34833483
eb.composite_fence :
34843484
&eb.requests[0]->fence);
34853485

3486+
if (unlikely(eb.gem_context->syncobj)) {
3487+
drm_syncobj_replace_fence(eb.gem_context->syncobj,
3488+
eb.composite_fence ?
3489+
eb.composite_fence :
3490+
&eb.requests[0]->fence);
3491+
}
3492+
34863493
if (out_fence) {
34873494
if (err == 0) {
34883495
fd_install(out_fence_fd, out_fence->file);
@@ -3494,13 +3501,6 @@ i915_gem_do_execbuffer(struct drm_device *dev,
34943501
}
34953502
}
34963503

3497-
if (unlikely(eb.gem_context->syncobj)) {
3498-
drm_syncobj_replace_fence(eb.gem_context->syncobj,
3499-
eb.composite_fence ?
3500-
eb.composite_fence :
3501-
&eb.requests[0]->fence);
3502-
}
3503-
35043504
if (!out_fence && eb.composite_fence)
35053505
dma_fence_put(eb.composite_fence);
35063506

0 commit comments

Comments
 (0)