Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * include/linux/sync_file.h
0003  *
0004  * Copyright (C) 2012 Google, Inc.
0005  *
0006  * This program is distributed in the hope that it will be useful,
0007  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0008  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0009  * GNU General Public License for more details.
0010  *
0011  */
0012 
0013 #ifndef _LINUX_SYNC_FILE_H
0014 #define _LINUX_SYNC_FILE_H
0015 
0016 #include <linux/types.h>
0017 #include <linux/ktime.h>
0018 #include <linux/list.h>
0019 #include <linux/spinlock.h>
0020 #include <linux/dma-fence.h>
0021 #include <linux/dma-fence-array.h>
0022 
0023 /**
0024  * struct sync_file - sync file to export to the userspace
0025  * @file:       file representing this fence
0026  * @sync_file_list: membership in global file list
0027  * @wq:         wait queue for fence signaling
0028  * @flags:      flags for the sync_file
0029  * @fence:      fence with the fences in the sync_file
0030  * @cb:         fence callback information
0031  *
0032  * flags:
0033  * POLL_ENABLED: whether userspace is currently poll()'ing or not
0034  */
0035 struct sync_file {
0036     struct file     *file;
0037     /**
0038      * @user_name:
0039      *
0040      * Name of the sync file provided by userspace, for merged fences.
0041      * Otherwise generated through driver callbacks (in which case the
0042      * entire array is 0).
0043      */
0044     char            user_name[32];
0045 #ifdef CONFIG_DEBUG_FS
0046     struct list_head    sync_file_list;
0047 #endif
0048 
0049     wait_queue_head_t   wq;
0050     unsigned long       flags;
0051 
0052     struct dma_fence    *fence;
0053     struct dma_fence_cb cb;
0054 };
0055 
0056 #define POLL_ENABLED 0
0057 
0058 struct sync_file *sync_file_create(struct dma_fence *fence);
0059 struct dma_fence *sync_file_get_fence(int fd);
0060 char *sync_file_get_name(struct sync_file *sync_file, char *buf, int len);
0061 
0062 #endif /* _LINUX_SYNC_H */