}
EXPORT_SYMBOL(sync_file_merge);
-int sync_file_wait(struct sync_file *sync_file, long timeout)
-{
- long ret;
- int i;
-
- if (timeout < 0)
- timeout = MAX_SCHEDULE_TIMEOUT;
- else
- timeout = msecs_to_jiffies(timeout);
-
- trace_sync_wait(sync_file, 1);
- for (i = 0; i < sync_file->num_fences; ++i)
- trace_fence(sync_file->cbs[i].fence);
- ret = wait_event_interruptible_timeout(sync_file->wq,
- atomic_read(&sync_file->status) <= 0,
- timeout);
- trace_sync_wait(sync_file, 0);
-
- if (ret < 0) {
- return ret;
- } else if (ret == 0) {
- if (timeout) {
- pr_info("sync_file timeout on [%p] after %dms\n",
- sync_file, jiffies_to_msecs(timeout));
- sync_dump();
- }
- return -ETIME;
- }
-
- ret = atomic_read(&sync_file->status);
- if (ret) {
- pr_info("sync_file error %ld on [%p]\n", ret, sync_file);
- sync_dump();
- }
- return ret;
-}
-EXPORT_SYMBOL(sync_file_wait);
-
static const char *android_fence_get_driver_name(struct fence *fence)
{
struct sync_timeline *parent = fence_parent(fence);
return 0;
}
-static long sync_file_ioctl_wait(struct sync_file *sync_file,
- unsigned long arg)
-{
- __s32 value;
-
- if (copy_from_user(&value, (void __user *)arg, sizeof(value)))
- return -EFAULT;
-
- return sync_file_wait(sync_file, value);
-}
-
static long sync_file_ioctl_merge(struct sync_file *sync_file,
unsigned long arg)
{
struct sync_file *sync_file = file->private_data;
switch (cmd) {
- case SYNC_IOC_WAIT:
- return sync_file_ioctl_wait(sync_file, arg);
-
case SYNC_IOC_MERGE:
return sync_file_ioctl_merge(sync_file, arg);
#include <linux/ktime.h>
#include <linux/list.h>
#include <linux/spinlock.h>
-#include <linux/wait.h>
#include <linux/fence.h>
#include "uapi/sync.h"
*/
void sync_file_install(struct sync_file *sync_file, int fd);
-/**
- * sync_file_wait() - wait on sync file
- * @sync_file: file to wait on
- * @tiemout: timeout in ms
- *
- * Wait for @sync_file to be signaled or have an error. Waits indefinitely
- * if @timeout < 0.
- *
- * Returns 0 if fence signaled, > 0 if it is still active and <0 on error
- */
-int sync_file_wait(struct sync_file *sync_file, long timeout);
-
#ifdef CONFIG_DEBUG_FS
void sync_timeline_debug_add(struct sync_timeline *obj);
TP_printk("name=%s value=%s", __get_str(name), __entry->value)
);
-TRACE_EVENT(sync_wait,
- TP_PROTO(struct sync_file *sync_file, int begin),
-
- TP_ARGS(sync_file, begin),
-
- TP_STRUCT__entry(
- __string(name, sync_file->name)
- __field(s32, status)
- __field(u32, begin)
- ),
-
- TP_fast_assign(
- __assign_str(name, sync_file->name);
- __entry->status = atomic_read(&sync_file->status);
- __entry->begin = begin;
- ),
-
- TP_printk("%s name=%s state=%d", __entry->begin ? "begin" : "end",
- __get_str(name), __entry->status)
-);
-
-TRACE_EVENT(fence,
- TP_PROTO(struct fence *fence),
-
- TP_ARGS(fence),
-
- TP_STRUCT__entry(
- __string(timeline, fence->ops->get_timeline_name(fence))
- __array(char, value, 32)
- ),
-
- TP_fast_assign(
- __assign_str(timeline, fence->ops->get_timeline_name(fence));
- if (fence->ops->fence_value_str) {
- fence->ops->fence_value_str(fence, __entry->value,
- sizeof(__entry->value));
- } else {
- __entry->value[0] = '\0';
- }
- ),
-
- TP_printk("name=%s value=%s", __get_str(timeline), __entry->value)
-);
-
#endif /* if !defined(_TRACE_SYNC_H) || defined(TRACE_HEADER_MULTI_READ) */
/* This part must be outside protection */
#define SYNC_IOC_MAGIC '>'
-/**
- * DOC: SYNC_IOC_WAIT - wait for a fence to signal
- *
- * pass timeout in milliseconds. Waits indefinitely timeout < 0.
- */
-#define SYNC_IOC_WAIT _IOW(SYNC_IOC_MAGIC, 0, __s32)
-
/**
* DOC: SYNC_IOC_MERGE - merge two fences
*