sync_file
struct sync_file {
struct file *file;
char user_name[32];
#ifdef CONFIG_DEBUG_FS
struct list_head sync_file_list;
#endif
wait_queue_head_t wq;
unsigned long flags;
struct dma_fence *fence;
struct dma_fence_cb cb;
};
其中的struct dma_fence *fence有三个状态,一是初始化后的默认状态;二是使能状态(in-fence),通常在注册fence回调函数的时候被设置成这个状态;三是完成状态(out-fence)
内核demo
explicit_dma_fence_demo.c
#include <linux/module.h>
#include <linux/miscdevice.h