sde_rotator_sync.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef SDE_ROTATOR_SYNC_H
  6. #define SDE_ROTATOR_SYNC_H
  7. #include <linux/types.h>
  8. #include <linux/errno.h>
  9. struct sde_rot_sync_fence;
  10. struct sde_rot_timeline;
  11. #if defined(CONFIG_SYNC_FILE)
  12. struct sde_rot_timeline *sde_rotator_create_timeline(const char *name);
  13. void sde_rotator_destroy_timeline(struct sde_rot_timeline *tl);
  14. struct sde_rot_sync_fence *sde_rotator_get_sync_fence(
  15. struct sde_rot_timeline *tl, int *fence_fd, u32 *timestamp);
  16. void sde_rotator_resync_timeline(struct sde_rot_timeline *tl);
  17. u32 sde_rotator_get_timeline_commit_ts(struct sde_rot_timeline *tl);
  18. u32 sde_rotator_get_timeline_retire_ts(struct sde_rot_timeline *tl);
  19. int sde_rotator_inc_timeline(struct sde_rot_timeline *tl, int increment);
  20. void sde_rotator_put_sync_fence(struct sde_rot_sync_fence *fence);
  21. int sde_rotator_wait_sync_fence(struct sde_rot_sync_fence *fence,
  22. long timeout);
  23. struct sde_rot_sync_fence *sde_rotator_get_fd_sync_fence(int fd);
  24. int sde_rotator_get_sync_fence_fd(struct sde_rot_sync_fence *fence);
  25. #else
  26. static inline
  27. struct sde_rot_timeline *sde_rotator_create_timeline(const char *name)
  28. {
  29. return NULL;
  30. }
  31. static inline
  32. void sde_rotator_destroy_timeline(struct sde_rot_timeline *tl)
  33. {
  34. }
  35. static inline
  36. struct sde_rot_sync_fence *sde_rotator_get_sync_fence(
  37. struct sde_rot_timeline *tl, int *fence_fd, u32 *timestamp)
  38. {
  39. return NULL;
  40. }
  41. static inline
  42. void sde_rotator_resync_timeline(struct sde_rot_timeline *tl)
  43. {
  44. }
  45. static inline
  46. int sde_rotator_inc_timeline(struct sde_rot_timeline *tl, int increment)
  47. {
  48. return 0;
  49. }
  50. static inline
  51. u32 sde_rotator_get_timeline_commit_ts(struct sde_rot_timeline *tl)
  52. {
  53. return 0;
  54. }
  55. static inline
  56. u32 sde_rotator_get_timeline_retire_ts(struct sde_rot_timeline *tl)
  57. {
  58. return 0;
  59. }
  60. static inline
  61. void sde_rotator_put_sync_fence(struct sde_rot_sync_fence *fence)
  62. {
  63. }
  64. static inline
  65. int sde_rotator_wait_sync_fence(struct sde_rot_sync_fence *fence,
  66. long timeout)
  67. {
  68. return 0;
  69. }
  70. static inline
  71. struct sde_rot_sync_fence *sde_rotator_get_fd_sync_fence(int fd)
  72. {
  73. return NULL;
  74. }
  75. static inline
  76. int sde_rotator_get_sync_fence_fd(struct sde_rot_sync_fence *fence)
  77. {
  78. return -EBADF;
  79. }
  80. #endif
  81. #endif /* SDE_ROTATOR_SYNC_H */