sync_file.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * include/linux/sync_file.h
  3. *
  4. * Copyright (C) 2012 Google, Inc.
  5. *
  6. * This program is distributed in the hope that it will be useful,
  7. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. * GNU General Public License for more details.
  10. *
  11. */
  12. #ifndef _LINUX_SYNC_FILE_H
  13. #define _LINUX_SYNC_FILE_H
  14. #include <linux/types.h>
  15. #include <linux/ktime.h>
  16. #include <linux/list.h>
  17. #include <linux/spinlock.h>
  18. #include <linux/dma-fence.h>
  19. #include <linux/dma-fence-array.h>
  20. /**
  21. * struct sync_file - sync file to export to the userspace
  22. * @file: file representing this fence
  23. * @sync_file_list: membership in global file list
  24. * @wq: wait queue for fence signaling
  25. * @flags: flags for the sync_file
  26. * @fence: fence with the fences in the sync_file
  27. * @cb: fence callback information
  28. *
  29. * flags:
  30. * POLL_ENABLED: whether userspace is currently poll()'ing or not
  31. */
  32. struct sync_file {
  33. struct file *file;
  34. /**
  35. * @user_name:
  36. *
  37. * Name of the sync file provided by userspace, for merged fences.
  38. * Otherwise generated through driver callbacks (in which case the
  39. * entire array is 0).
  40. */
  41. char user_name[32];
  42. #ifdef CONFIG_DEBUG_FS
  43. struct list_head sync_file_list;
  44. #endif
  45. wait_queue_head_t wq;
  46. unsigned long flags;
  47. struct dma_fence *fence;
  48. struct dma_fence_cb cb;
  49. };
  50. #define POLL_ENABLED 0
  51. struct sync_file *sync_file_create(struct dma_fence *fence);
  52. struct dma_fence *sync_file_get_fence(int fd);
  53. char *sync_file_get_name(struct sync_file *sync_file, char *buf, int len);
  54. #endif /* _LINUX_SYNC_H */