From e24165537312723e2900831dd6e7415b8d85278c Mon Sep 17 00:00:00 2001 From: Gustavo Padovan Date: Fri, 5 Aug 2016 10:39:38 -0300 Subject: dma-buf/sync_file: only enable fence signalling on poll() Signalling doesn't need to be enabled at sync_file creation, it is only required if userspace waiting the fence to signal through poll(). Thus we delay fence_add_callback() until poll is called. It only adds the callback the first time poll() is called. This avoid re-adding the same callback multiple times. v2: rebase and update to work with new fence support for sync_file v3: use atomic operation to set enabled and protect fence_add_callback() v4: use user bit from fence flags (comment from Chris Wilson) v5: use ternary if on poll return (comment from Chris Wilson) Signed-off-by: Gustavo Padovan Reviewed-by: Chris Wilson Signed-off-by: Sumit Semwal [sumits: remove unused var status] Link: http://patchwork.freedesktop.org/patch/msgid/1470404378-27961-1-git-send-email-gustavo@padovan.org --- include/linux/sync_file.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/linux/sync_file.h') diff --git a/include/linux/sync_file.h b/include/linux/sync_file.h index f7de5a0b3d12..aa17ccfc2f57 100644 --- a/include/linux/sync_file.h +++ b/include/linux/sync_file.h @@ -45,6 +45,8 @@ struct sync_file { struct fence_cb cb; }; +#define POLL_ENABLED FENCE_FLAG_USER_BITS + struct sync_file *sync_file_create(struct fence *fence); struct fence *sync_file_get_fence(int fd); -- cgit v1.2.3