Commit d7fdb0ae authored by Gustavo Padovan's avatar Gustavo Padovan Committed by Greg Kroah-Hartman

staging/android: rename sync_fence to sync_file

sync_file has a more close meaning to what a sync_fence really, a struct
that represent a file that can be used by userspace to get information on
a fence, or wait for it to be signaled.
Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a44eb74c
This diff is collapsed.
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
struct sync_timeline; struct sync_timeline;
struct sync_pt; struct sync_pt;
struct sync_fence; struct sync_file;
/** /**
* struct sync_timeline_ops - sync object implementation ops * struct sync_timeline_ops - sync object implementation ops
...@@ -108,36 +108,36 @@ static inline struct sync_timeline *sync_pt_parent(struct sync_pt *pt) ...@@ -108,36 +108,36 @@ static inline struct sync_timeline *sync_pt_parent(struct sync_pt *pt)
child_list_lock); child_list_lock);
} }
struct sync_fence_cb { struct sync_file_cb {
struct fence_cb cb; struct fence_cb cb;
struct fence *sync_pt; struct fence *sync_pt;
struct sync_fence *fence; struct sync_file *sync_file;
}; };
/** /**
* struct sync_fence - sync fence * struct sync_file - sync file to export to the userspace
* @file: file representing this fence * @file: file representing this fence
* @kref: reference count on fence. * @kref: reference count on fence.
* @name: name of sync_fence. Useful for debugging * @name: name of sync_file. Useful for debugging
* @sync_fence_list: membership in global fence list * @sync_file_list: membership in global file list
* @num_fences number of sync_pts in the fence * @num_fences number of sync_pts in the fence
* @wq: wait queue for fence signaling * @wq: wait queue for fence signaling
* @status: 0: signaled, >0:active, <0: error * @status: 0: signaled, >0:active, <0: error
* @cbs: sync_pts callback information * @cbs: sync_pts callback information
*/ */
struct sync_fence { struct sync_file {
struct file *file; struct file *file;
struct kref kref; struct kref kref;
char name[32]; char name[32];
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
struct list_head sync_fence_list; struct list_head sync_file_list;
#endif #endif
int num_fences; int num_fences;
wait_queue_head_t wq; wait_queue_head_t wq;
atomic_t status; atomic_t status;
struct sync_fence_cb cbs[]; struct sync_file_cb cbs[];
}; };
/* /*
...@@ -199,95 +199,95 @@ struct sync_pt *sync_pt_create(struct sync_timeline *parent, int size); ...@@ -199,95 +199,95 @@ struct sync_pt *sync_pt_create(struct sync_timeline *parent, int size);
void sync_pt_free(struct sync_pt *pt); void sync_pt_free(struct sync_pt *pt);
/** /**
* sync_fence_create() - creates a sync fence * sync_file_create() - creates a sync file
* @name: name of fence to create * @name: name of file to create
* @pt: sync_pt to add to the fence * @pt: sync_pt to add to the file
* *
* Creates a fence containg @pt. Once this is called, the fence takes * Creates a sync_file containg @pt. Once this is called, the sync_file takes
* ownership of @pt. * ownership of @pt.
*/ */
struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt); struct sync_file *sync_file_create(const char *name, struct sync_pt *pt);
/** /**
* sync_fence_create_dma() - creates a sync fence from dma-fence * sync_file_create_dma() - creates a sync file from dma-fence
* @name: name of fence to create * @name: name of file to create
* @pt: dma-fence to add to the fence * @pt: dma-fence to add to the file
* *
* Creates a fence containg @pt. Once this is called, the fence takes * Creates a sync_file containg @pt. Once this is called, the fence takes
* ownership of @pt. * ownership of @pt.
*/ */
struct sync_fence *sync_fence_create_dma(const char *name, struct fence *pt); struct sync_file *sync_file_create_dma(const char *name, struct fence *pt);
/* /*
* API for sync_fence consumers * API for sync_file consumers
*/ */
/** /**
* sync_fence_merge() - merge two fences * sync_file_merge() - merge two sync_files
* @name: name of new fence * @name: name of new fence
* @a: fence a * @a: sync_file a
* @b: fence b * @b: sync_file b
* *
* Creates a new fence which contains copies of all the sync_pts in both * Creates a new sync_file which contains copies of all the sync_pts in both
* @a and @b. @a and @b remain valid, independent fences. Returns the * @a and @b. @a and @b remain valid, independent sync_file. Returns the
* new merged fence or NULL in case of error. * new merged sync_file or NULL in case of error.
*/ */
struct sync_fence *sync_fence_merge(const char *name, struct sync_file *sync_file_merge(const char *name,
struct sync_fence *a, struct sync_fence *b); struct sync_file *a, struct sync_file *b);
/** /**
* sync_fence_fdget() - get a fence from an fd * sync_file_fdget() - get a sync_file from an fd
* @fd: fd referencing a fence * @fd: fd referencing a fence
* *
* Ensures @fd references a valid fence, increments the refcount of the backing * Ensures @fd references a valid sync_file, increments the refcount of the
* file, and returns the fence. Returns the fence or NULL in case of error. * backing file. Returns the sync_file or NULL in case of error.
*/ */
struct sync_fence *sync_fence_fdget(int fd); struct sync_file *sync_file_fdget(int fd);
/** /**
* sync_fence_put() - puts a reference of a sync fence * sync_file_put() - puts a reference of a sync_file
* @fence: fence to put * @sync_file: sync_file to put
* *
* Puts a reference on @fence. If this is the last reference, the fence and * Puts a reference on @sync_fence. If this is the last reference, the
* all it's sync_pts will be freed * sync_fil and all it's sync_pts will be freed
*/ */
void sync_fence_put(struct sync_fence *fence); void sync_file_put(struct sync_file *sync_file);
/** /**
* sync_fence_install() - installs a fence into a file descriptor * sync_file_install() - installs a sync_file into a file descriptor
* @fence: fence to install * @sync_file: sync_file to install
* @fd: file descriptor in which to install the fence * @fd: file descriptor in which to install the fence
* *
* Installs @fence into @fd. @fd's should be acquired through * Installs @sync_file into @fd. @fd's should be acquired through
* get_unused_fd_flags(O_CLOEXEC). * get_unused_fd_flags(O_CLOEXEC).
*/ */
void sync_fence_install(struct sync_fence *fence, int fd); void sync_file_install(struct sync_file *sync_file, int fd);
/** /**
* sync_fence_wait() - wait on fence * sync_file_wait() - wait on sync file
* @fence: fence to wait on * @sync_file: file to wait on
* @tiemout: timeout in ms * @tiemout: timeout in ms
* *
* Wait for @fence to be signaled or have an error. Waits indefinitely * Wait for @sync_file to be signaled or have an error. Waits indefinitely
* if @timeout < 0. * if @timeout < 0.
* *
* Returns 0 if fence signaled, > 0 if it is still active and <0 on error * Returns 0 if fence signaled, > 0 if it is still active and <0 on error
*/ */
int sync_fence_wait(struct sync_fence *fence, long timeout); int sync_file_wait(struct sync_file *sync_file, long timeout);
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
void sync_timeline_debug_add(struct sync_timeline *obj); void sync_timeline_debug_add(struct sync_timeline *obj);
void sync_timeline_debug_remove(struct sync_timeline *obj); void sync_timeline_debug_remove(struct sync_timeline *obj);
void sync_fence_debug_add(struct sync_fence *fence); void sync_file_debug_add(struct sync_file *fence);
void sync_fence_debug_remove(struct sync_fence *fence); void sync_file_debug_remove(struct sync_file *fence);
void sync_dump(void); void sync_dump(void);
#else #else
# define sync_timeline_debug_add(obj) # define sync_timeline_debug_add(obj)
# define sync_timeline_debug_remove(obj) # define sync_timeline_debug_remove(obj)
# define sync_fence_debug_add(fence) # define sync_file_debug_add(fence)
# define sync_fence_debug_remove(fence) # define sync_file_debug_remove(fence)
# define sync_dump() # define sync_dump()
#endif #endif
......
...@@ -35,8 +35,8 @@ static struct dentry *dbgfs; ...@@ -35,8 +35,8 @@ static struct dentry *dbgfs;
static LIST_HEAD(sync_timeline_list_head); static LIST_HEAD(sync_timeline_list_head);
static DEFINE_SPINLOCK(sync_timeline_list_lock); static DEFINE_SPINLOCK(sync_timeline_list_lock);
static LIST_HEAD(sync_fence_list_head); static LIST_HEAD(sync_file_list_head);
static DEFINE_SPINLOCK(sync_fence_list_lock); static DEFINE_SPINLOCK(sync_file_list_lock);
void sync_timeline_debug_add(struct sync_timeline *obj) void sync_timeline_debug_add(struct sync_timeline *obj)
{ {
...@@ -56,22 +56,22 @@ void sync_timeline_debug_remove(struct sync_timeline *obj) ...@@ -56,22 +56,22 @@ void sync_timeline_debug_remove(struct sync_timeline *obj)
spin_unlock_irqrestore(&sync_timeline_list_lock, flags); spin_unlock_irqrestore(&sync_timeline_list_lock, flags);
} }
void sync_fence_debug_add(struct sync_fence *fence) void sync_file_debug_add(struct sync_file *sync_file)
{ {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&sync_fence_list_lock, flags); spin_lock_irqsave(&sync_file_list_lock, flags);
list_add_tail(&fence->sync_fence_list, &sync_fence_list_head); list_add_tail(&sync_file->sync_file_list, &sync_file_list_head);
spin_unlock_irqrestore(&sync_fence_list_lock, flags); spin_unlock_irqrestore(&sync_file_list_lock, flags);
} }
void sync_fence_debug_remove(struct sync_fence *fence) void sync_file_debug_remove(struct sync_file *sync_file)
{ {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&sync_fence_list_lock, flags); spin_lock_irqsave(&sync_file_list_lock, flags);
list_del(&fence->sync_fence_list); list_del(&sync_file->sync_file_list);
spin_unlock_irqrestore(&sync_fence_list_lock, flags); spin_unlock_irqrestore(&sync_file_list_lock, flags);
} }
static const char *sync_status_str(int status) static const char *sync_status_str(int status)
...@@ -152,16 +152,17 @@ static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj) ...@@ -152,16 +152,17 @@ static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj)
spin_unlock_irqrestore(&obj->child_list_lock, flags); spin_unlock_irqrestore(&obj->child_list_lock, flags);
} }
static void sync_print_fence(struct seq_file *s, struct sync_fence *fence) static void sync_print_sync_file(struct seq_file *s,
{ struct sync_file *sync_file)
{
int i; int i;
seq_printf(s, "[%p] %s: %s\n", fence, fence->name, seq_printf(s, "[%p] %s: %s\n", sync_file, sync_file->name,
sync_status_str(atomic_read(&fence->status))); sync_status_str(atomic_read(&sync_file->status)));
for (i = 0; i < fence->num_fences; ++i) for (i = 0; i < sync_file->num_fences; ++i)
sync_print_pt(s, fence->cbs[i].sync_pt, true); sync_print_pt(s, sync_file->cbs[i].sync_pt, true);
} }
static int sync_debugfs_show(struct seq_file *s, void *unused) static int sync_debugfs_show(struct seq_file *s, void *unused)
{ {
...@@ -183,15 +184,15 @@ static int sync_debugfs_show(struct seq_file *s, void *unused) ...@@ -183,15 +184,15 @@ static int sync_debugfs_show(struct seq_file *s, void *unused)
seq_puts(s, "fences:\n--------------\n"); seq_puts(s, "fences:\n--------------\n");
spin_lock_irqsave(&sync_fence_list_lock, flags); spin_lock_irqsave(&sync_file_list_lock, flags);
list_for_each(pos, &sync_fence_list_head) { list_for_each(pos, &sync_file_list_head) {
struct sync_fence *fence = struct sync_file *sync_file =
container_of(pos, struct sync_fence, sync_fence_list); container_of(pos, struct sync_file, sync_file_list);
sync_print_fence(s, fence); sync_print_sync_file(s, sync_file);
seq_puts(s, "\n"); seq_puts(s, "\n");
} }
spin_unlock_irqrestore(&sync_fence_list_lock, flags); spin_unlock_irqrestore(&sync_file_list_lock, flags);
return 0; return 0;
} }
...@@ -244,7 +245,7 @@ static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj, ...@@ -244,7 +245,7 @@ static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj,
int fd = get_unused_fd_flags(O_CLOEXEC); int fd = get_unused_fd_flags(O_CLOEXEC);
int err; int err;
struct sync_pt *pt; struct sync_pt *pt;
struct sync_fence *fence; struct sync_file *sync_file;
struct sw_sync_create_fence_data data; struct sw_sync_create_fence_data data;
if (fd < 0) if (fd < 0)
...@@ -262,8 +263,8 @@ static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj, ...@@ -262,8 +263,8 @@ static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj,
} }
data.name[sizeof(data.name) - 1] = '\0'; data.name[sizeof(data.name) - 1] = '\0';
fence = sync_fence_create(data.name, pt); sync_file = sync_file_create(data.name, pt);
if (!fence) { if (!sync_file) {
sync_pt_free(pt); sync_pt_free(pt);
err = -ENOMEM; err = -ENOMEM;
goto err; goto err;
...@@ -271,12 +272,12 @@ static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj, ...@@ -271,12 +272,12 @@ static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj,
data.fence = fd; data.fence = fd;
if (copy_to_user((void __user *)arg, &data, sizeof(data))) { if (copy_to_user((void __user *)arg, &data, sizeof(data))) {
sync_fence_put(fence); sync_file_put(sync_file);
err = -EFAULT; err = -EFAULT;
goto err; goto err;
} }
sync_fence_install(fence, fd); sync_file_install(sync_file, fd);
return 0; return 0;
......
...@@ -33,19 +33,19 @@ TRACE_EVENT(sync_timeline, ...@@ -33,19 +33,19 @@ TRACE_EVENT(sync_timeline,
); );
TRACE_EVENT(sync_wait, TRACE_EVENT(sync_wait,
TP_PROTO(struct sync_fence *fence, int begin), TP_PROTO(struct sync_file *sync_file, int begin),
TP_ARGS(fence, begin), TP_ARGS(sync_file, begin),
TP_STRUCT__entry( TP_STRUCT__entry(
__string(name, fence->name) __string(name, sync_file->name)
__field(s32, status) __field(s32, status)
__field(u32, begin) __field(u32, begin)
), ),
TP_fast_assign( TP_fast_assign(
__assign_str(name, fence->name); __assign_str(name, sync_file->name);
__entry->status = atomic_read(&fence->status); __entry->status = atomic_read(&sync_file->status);
__entry->begin = begin; __entry->begin = begin;
), ),
......
...@@ -46,15 +46,15 @@ struct sync_pt_info { ...@@ -46,15 +46,15 @@ struct sync_pt_info {
}; };
/** /**
* struct sync_fence_info_data - data returned from fence info ioctl * struct sync_file_info_data - data returned from fence info ioctl
* @len: ioctl caller writes the size of the buffer its passing in. * @len: ioctl caller writes the size of the buffer its passing in.
* ioctl returns length of sync_fence_data returned to userspace * ioctl returns length of sync_file_info_data returned to
* including pt_info. * userspace including pt_info.
* @name: name of fence * @name: name of fence
* @status: status of fence. 1: signaled 0:active <0:error * @status: status of fence. 1: signaled 0:active <0:error
* @pt_info: a sync_pt_info struct for every sync_pt in the fence * @pt_info: a sync_pt_info struct for every sync_pt in the fence
*/ */
struct sync_fence_info_data { struct sync_file_info_data {
__u32 len; __u32 len;
char name[32]; char name[32];
__s32 status; __s32 status;
...@@ -83,15 +83,15 @@ struct sync_fence_info_data { ...@@ -83,15 +83,15 @@ struct sync_fence_info_data {
/** /**
* DOC: SYNC_IOC_FENCE_INFO - get detailed information on a fence * DOC: SYNC_IOC_FENCE_INFO - get detailed information on a fence
* *
* Takes a struct sync_fence_info_data with extra space allocated for pt_info. * Takes a struct sync_file_info_data with extra space allocated for pt_info.
* Caller should write the size of the buffer into len. On return, len is * Caller should write the size of the buffer into len. On return, len is
* updated to reflect the total size of the sync_fence_info_data including * updated to reflect the total size of the sync_file_info_data including
* pt_info. * pt_info.
* *
* pt_info is a buffer containing sync_pt_infos for every sync_pt in the fence. * pt_info is a buffer containing sync_pt_infos for every sync_pt in the fence.
* To iterate over the sync_pt_infos, use the sync_pt_info.len field. * To iterate over the sync_pt_infos, use the sync_pt_info.len field.
*/ */
#define SYNC_IOC_FENCE_INFO _IOWR(SYNC_IOC_MAGIC, 2,\ #define SYNC_IOC_FENCE_INFO _IOWR(SYNC_IOC_MAGIC, 2,\
struct sync_fence_info_data) struct sync_file_info_data)
#endif /* _UAPI_LINUX_SYNC_H */ #endif /* _UAPI_LINUX_SYNC_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment