sync_file.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Copyright (C) 2012 Google, Inc.
  3. *
  4. * This program is distributed in the hope that it will be useful,
  5. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  6. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  7. * GNU General Public License for more details.
  8. *
  9. */
  10. #ifndef _UAPI_LINUX_SYNC_H
  11. #define _UAPI_LINUX_SYNC_H
  12. #include <linux/ioctl.h>
  13. #include <linux/types.h>
  14. /**
  15. * struct sync_merge_data - data passed to merge ioctl
  16. * @name: name of new fence
  17. * @fd2: file descriptor of second fence
  18. * @fence: returns the fd of the new fence to userspace
  19. * @flags: merge_data flags
  20. * @pad: padding for 64-bit alignment, should always be zero
  21. */
  22. struct sync_merge_data {
  23. char name[32];
  24. __s32 fd2;
  25. __s32 fence;
  26. __u32 flags;
  27. __u32 pad;
  28. };
  29. /**
  30. * struct sync_fence_info - detailed fence information
  31. * @obj_name: name of parent sync_timeline
  32. * @driver_name: name of driver implementing the parent
  33. * @status: status of the fence 0:active 1:signaled <0:error
  34. * @flags: fence_info flags
  35. * @timestamp_ns: timestamp of status change in nanoseconds
  36. */
  37. struct sync_fence_info {
  38. char obj_name[32];
  39. char driver_name[32];
  40. __s32 status;
  41. __u32 flags;
  42. __u64 timestamp_ns;
  43. };
  44. /**
  45. * struct sync_file_info - data returned from fence info ioctl
  46. * @name: name of fence
  47. * @status: status of fence. 1: signaled 0:active <0:error
  48. * @flags: sync_file_info flags
  49. * @num_fences number of fences in the sync_file
  50. * @pad: padding for 64-bit alignment, should always be zero
  51. * @sync_fence_info: pointer to array of structs sync_fence_info with all
  52. * fences in the sync_file
  53. */
  54. struct sync_file_info {
  55. char name[32];
  56. __s32 status;
  57. __u32 flags;
  58. __u32 num_fences;
  59. __u32 pad;
  60. __u64 sync_fence_info;
  61. };
  62. #define SYNC_IOC_MAGIC '>'
  63. /**
  64. * Opcodes 0, 1 and 2 were burned during a API change to avoid users of the
  65. * old API to get weird errors when trying to handling sync_files. The API
  66. * change happened during the de-stage of the Sync Framework when there was
  67. * no upstream users available.
  68. */
  69. /**
  70. * DOC: SYNC_IOC_MERGE - merge two fences
  71. *
  72. * Takes a struct sync_merge_data. Creates a new fence containing copies of
  73. * the sync_pts in both the calling fd and sync_merge_data.fd2. Returns the
  74. * new fence's fd in sync_merge_data.fence
  75. */
  76. #define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)
  77. /**
  78. * DOC: SYNC_IOC_FILE_INFO - get detailed information on a sync_file
  79. *
  80. * Takes a struct sync_file_info. If num_fences is 0, the field is updated
  81. * with the actual number of fences. If num_fences is > 0, the system will
  82. * use the pointer provided on sync_fence_info to return up to num_fences of
  83. * struct sync_fence_info, with detailed fence information.
  84. */
  85. #define SYNC_IOC_FILE_INFO _IOWR(SYNC_IOC_MAGIC, 4, struct sync_file_info)
  86. #endif /* _UAPI_LINUX_SYNC_H */