sync_file.h 2.8 KB

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