sync_file.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 _LINUX_SYNC_H
  12. #define _LINUX_SYNC_H
  13. #include <linux/ioctl.h>
  14. #include <linux/types.h>
  15. /**
  16. * struct sync_merge_data - SYNC_IOC_MERGE: merge two fences
  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. * Creates a new fence containing copies of the sync_pts in both
  24. * the calling fd and sync_merge_data.fd2. Returns the new fence's
  25. * fd in sync_merge_data.fence
  26. */
  27. struct sync_merge_data {
  28. char name[32];
  29. __s32 fd2;
  30. __s32 fence;
  31. __u32 flags;
  32. __u32 pad;
  33. };
  34. /**
  35. * struct sync_fence_info - detailed fence information
  36. * @obj_name: name of parent sync_timeline
  37. * @driver_name: name of driver implementing the parent
  38. * @status: status of the fence 0:active 1:signaled <0:error
  39. * @flags: fence_info flags
  40. * @timestamp_ns: timestamp of status change in nanoseconds
  41. */
  42. struct sync_fence_info {
  43. char obj_name[32];
  44. char driver_name[32];
  45. __s32 status;
  46. __u32 flags;
  47. __u64 timestamp_ns;
  48. };
  49. /**
  50. * struct sync_file_info - SYNC_IOC_FILE_INFO: get detailed information on a sync_file
  51. * @name: name of fence
  52. * @status: status of fence. 1: signaled 0:active <0:error
  53. * @flags: sync_file_info flags
  54. * @num_fences: number of fences in the sync_file
  55. * @pad: padding for 64-bit alignment, should always be zero
  56. * @sync_fence_info: pointer to array of struct &sync_fence_info with all
  57. * fences in the sync_file
  58. *
  59. * Takes a struct sync_file_info. If num_fences is 0, the field is updated
  60. * with the actual number of fences. If num_fences is > 0, the system will
  61. * use the pointer provided on sync_fence_info to return up to num_fences of
  62. * struct sync_fence_info, with detailed fence information.
  63. */
  64. struct sync_file_info {
  65. char name[32];
  66. __s32 status;
  67. __u32 flags;
  68. __u32 num_fences;
  69. __u32 pad;
  70. __u64 sync_fence_info;
  71. };
  72. #define SYNC_IOC_MAGIC '>'
  73. /*
  74. * Opcodes 0, 1 and 2 were burned during a API change to avoid users of the
  75. * old API to get weird errors when trying to handling sync_files. The API
  76. * change happened during the de-stage of the Sync Framework when there was
  77. * no upstream users available.
  78. */
  79. #define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)
  80. #define SYNC_IOC_FILE_INFO _IOWR(SYNC_IOC_MAGIC, 4, struct sync_file_info)
  81. #endif /* _LINUX_SYNC_H */