Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Sync File validation framework and debug infomation
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_H
0014 #define _LINUX_SYNC_H
0015 
0016 #include <linux/list.h>
0017 #include <linux/rbtree.h>
0018 #include <linux/spinlock.h>
0019 #include <linux/dma-fence.h>
0020 
0021 #include <linux/sync_file.h>
0022 #include <uapi/linux/sync_file.h>
0023 
0024 /**
0025  * struct sync_timeline - sync object
0026  * @kref:       reference count on fence.
0027  * @name:       name of the sync_timeline. Useful for debugging
0028  * @lock:       lock protecting @pt_list and @value
0029  * @pt_tree:        rbtree of active (unsignaled/errored) sync_pts
0030  * @pt_list:        list of active (unsignaled/errored) sync_pts
0031  * @sync_timeline_list: membership in global sync_timeline_list
0032  */
0033 struct sync_timeline {
0034     struct kref     kref;
0035     char            name[32];
0036 
0037     /* protected by lock */
0038     u64         context;
0039     int         value;
0040 
0041     struct rb_root      pt_tree;
0042     struct list_head    pt_list;
0043     spinlock_t      lock;
0044 
0045     struct list_head    sync_timeline_list;
0046 };
0047 
0048 static inline struct sync_timeline *dma_fence_parent(struct dma_fence *fence)
0049 {
0050     return container_of(fence->lock, struct sync_timeline, lock);
0051 }
0052 
0053 /**
0054  * struct sync_pt - sync_pt object
0055  * @base: base fence object
0056  * @link: link on the sync timeline's list
0057  * @node: node in the sync timeline's tree
0058  */
0059 struct sync_pt {
0060     struct dma_fence base;
0061     struct list_head link;
0062     struct rb_node node;
0063 };
0064 
0065 extern const struct file_operations sw_sync_debugfs_fops;
0066 
0067 void sync_timeline_debug_add(struct sync_timeline *obj);
0068 void sync_timeline_debug_remove(struct sync_timeline *obj);
0069 void sync_file_debug_add(struct sync_file *fence);
0070 void sync_file_debug_remove(struct sync_file *fence);
0071 
0072 #endif /* _LINUX_SYNC_H */