From: jsg Date: Tue, 14 Dec 2021 13:32:09 +0000 (+0000) Subject: drm/syncobj: Deal with signalled fences in drm_syncobj_find_fence. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=6115a8aab61c2617a33d0a21d67f50f585d4730a;p=openbsd drm/syncobj: Deal with signalled fences in drm_syncobj_find_fence. From Bas Nieuwenhuizen 2737d0bc21b6db199b4145e12b9f1745577d7944 in linux 5.10.y/5.10.85 b19926d4f3a660a8b76e5d989ffd1168e619a5c4 in mainline linux --- diff --git a/sys/dev/pci/drm/drm_syncobj.c b/sys/dev/pci/drm/drm_syncobj.c index 2d157a1fd37..f792dd15501 100644 --- a/sys/dev/pci/drm/drm_syncobj.c +++ b/sys/dev/pci/drm/drm_syncobj.c @@ -395,8 +395,17 @@ int drm_syncobj_find_fence(struct drm_file *file_private, if (*fence) { ret = dma_fence_chain_find_seqno(fence, point); - if (!ret) + if (!ret) { + /* If the requested seqno is already signaled + * drm_syncobj_find_fence may return a NULL + * fence. To make sure the recipient gets + * signalled, use a new fence instead. + */ + if (!*fence) + *fence = dma_fence_get_stub(); + goto out; + } dma_fence_put(*fence); } else { ret = -EINVAL;