pvr_sync.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* SPDX-License-Identifier: GPL-2.0-only OR MIT */
  2. /* Copyright (c) 2023 Imagination Technologies Ltd. */
  3. #ifndef PVR_SYNC_H
  4. #define PVR_SYNC_H
  5. #include <uapi/drm/pvr_drm.h>
  6. /* Forward declaration from <linux/xarray.h>. */
  7. struct xarray;
  8. /* Forward declaration from <drm/drm_file.h>. */
  9. struct drm_file;
  10. /* Forward declaration from <drm/gpu_scheduler.h>. */
  11. struct drm_sched_job;
  12. /* Forward declaration from "pvr_device.h". */
  13. struct pvr_file;
  14. /**
  15. * struct pvr_sync_signal - Object encoding a syncobj signal operation
  16. *
  17. * The job submission logic collects all signal operations in an array of
  18. * pvr_sync_signal objects. This array also serves as a cache to get the
  19. * latest dma_fence when multiple jobs are submitted at once, and one job
  20. * signals a syncobj point that's later waited on by a subsequent job.
  21. */
  22. struct pvr_sync_signal {
  23. /** @handle: Handle of the syncobj to signal. */
  24. u32 handle;
  25. /**
  26. * @point: Point to signal in the syncobj.
  27. *
  28. * Only relevant for timeline syncobjs.
  29. */
  30. u64 point;
  31. /** @syncobj: Syncobj retrieved from the handle. */
  32. struct drm_syncobj *syncobj;
  33. /**
  34. * @chain: Chain object used to link the new fence with the
  35. * existing timeline syncobj.
  36. *
  37. * Should be zero when manipulating a regular syncobj.
  38. */
  39. struct dma_fence_chain *chain;
  40. /**
  41. * @fence: New fence object to attach to the syncobj.
  42. *
  43. * This pointer starts with the current fence bound to
  44. * the <handle,point> pair.
  45. */
  46. struct dma_fence *fence;
  47. };
  48. void
  49. pvr_sync_signal_array_cleanup(struct xarray *array);
  50. int
  51. pvr_sync_signal_array_collect_ops(struct xarray *array,
  52. struct drm_file *file,
  53. u32 sync_op_count,
  54. const struct drm_pvr_sync_op *sync_ops);
  55. int
  56. pvr_sync_signal_array_update_fences(struct xarray *array,
  57. u32 sync_op_count,
  58. const struct drm_pvr_sync_op *sync_ops,
  59. struct dma_fence *done_fence);
  60. void
  61. pvr_sync_signal_array_push_fences(struct xarray *array);
  62. int
  63. pvr_sync_add_deps_to_job(struct pvr_file *pvr_file, struct drm_sched_job *job,
  64. u32 sync_op_count,
  65. const struct drm_pvr_sync_op *sync_ops,
  66. struct xarray *signal_array);
  67. #endif /* PVR_SYNC_H */