[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230725074611.3309115-1-cyndis@kapsi.fi>
Date: Tue, 25 Jul 2023 10:46:11 +0300
From: Mikko Perttunen <cyndis@...si.fi>
To: Sumit Semwal <sumit.semwal@...aro.org>,
Gustavo Padovan <gustavo@...ovan.org>
Cc: Mikko Perttunen <mperttunen@...dia.com>,
linux-media@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] dma_buf/sync_file: Enable signaling for fences when querying status
From: Mikko Perttunen <mperttunen@...dia.com>
dma_fence_get_status is not guaranteed to return valid information
on if the fence has been signaled or not if SW signaling has not
been enabled for the fence. To ensure valid information is reported,
enable SW signaling for fences before getting their status.
Signed-off-by: Mikko Perttunen <mperttunen@...dia.com>
---
drivers/dma-buf/sync_file.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index af57799c86ce..57f194b8477f 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -267,6 +267,7 @@ static int sync_fill_fence_info(struct dma_fence *fence,
strscpy(info->driver_name, fence->ops->get_driver_name(fence),
sizeof(info->driver_name));
+ dma_fence_enable_sw_signaling(fence);
info->status = dma_fence_get_status(fence);
while (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags) &&
!test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags))
@@ -307,6 +308,7 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
* info->num_fences.
*/
if (!info.num_fences) {
+ dma_fence_enable_sw_signaling(sync_file->fence);
info.status = dma_fence_get_status(sync_file->fence);
goto no_fences;
} else {
--
2.40.1
Powered by blists - more mailing lists