mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-27 00:20:58 +07:00
e241655373
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 <gustavo.padovan@collabora.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org> [sumits: remove unused var status] Link: http://patchwork.freedesktop.org/patch/msgid/1470404378-27961-1-git-send-email-gustavo@padovan.org
54 lines
1.3 KiB
C
54 lines
1.3 KiB
C
/*
|
|
* include/linux/sync_file.h
|
|
*
|
|
* Copyright (C) 2012 Google, Inc.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
*/
|
|
|
|
#ifndef _LINUX_SYNC_FILE_H
|
|
#define _LINUX_SYNC_FILE_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/kref.h>
|
|
#include <linux/ktime.h>
|
|
#include <linux/list.h>
|
|
#include <linux/spinlock.h>
|
|
#include <linux/fence.h>
|
|
#include <linux/fence-array.h>
|
|
|
|
/**
|
|
* struct sync_file - sync file to export to the userspace
|
|
* @file: file representing this fence
|
|
* @kref: reference count on fence.
|
|
* @name: name of sync_file. Useful for debugging
|
|
* @sync_file_list: membership in global file list
|
|
* @wq: wait queue for fence signaling
|
|
* @fence: fence with the fences in the sync_file
|
|
* @cb: fence callback information
|
|
*/
|
|
struct sync_file {
|
|
struct file *file;
|
|
struct kref kref;
|
|
char name[32];
|
|
#ifdef CONFIG_DEBUG_FS
|
|
struct list_head sync_file_list;
|
|
#endif
|
|
|
|
wait_queue_head_t wq;
|
|
|
|
struct fence *fence;
|
|
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);
|
|
|
|
#endif /* _LINUX_SYNC_H */
|