drm/i915: Move fd_install after last use of fence
authorjsg <jsg@openbsd.org>
Wed, 15 Feb 2023 10:28:39 +0000 (10:28 +0000)
committerjsg <jsg@openbsd.org>
Wed, 15 Feb 2023 10:28:39 +0000 (10:28 +0000)
From Rob Clark
bfa700d12274bd3509b64fd545d1046eef89d564 in linux-6.1.y/6.1.12
251e8c5b1b1fadcc387a8e618c7437d330bdac3e in mainline linux

sys/dev/pci/drm/i915/gem/i915_gem_execbuffer.c

index f897a9e..d704fa9 100644 (file)
@@ -3537,6 +3537,13 @@ err_request:
                                   eb.composite_fence :
                                   &eb.requests[0]->fence);
 
+       if (unlikely(eb.gem_context->syncobj)) {
+               drm_syncobj_replace_fence(eb.gem_context->syncobj,
+                                         eb.composite_fence ?
+                                         eb.composite_fence :
+                                         &eb.requests[0]->fence);
+       }
+
        if (out_fence) {
                if (err == 0) {
                        fd_install(out_fence_fd, out_fence->file);
@@ -3548,13 +3555,6 @@ err_request:
                }
        }
 
-       if (unlikely(eb.gem_context->syncobj)) {
-               drm_syncobj_replace_fence(eb.gem_context->syncobj,
-                                         eb.composite_fence ?
-                                         eb.composite_fence :
-                                         &eb.requests[0]->fence);
-       }
-
        if (!out_fence && eb.composite_fence)
                dma_fence_put(eb.composite_fence);