nouveau_fence.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #ifndef __NOUVEAU_FENCE_H__
  2. #define __NOUVEAU_FENCE_H__
  3. struct nouveau_drm;
  4. struct nouveau_fence {
  5. struct list_head head;
  6. struct kref kref;
  7. struct nouveau_channel *channel;
  8. unsigned long timeout;
  9. u32 sequence;
  10. void (*work)(void *priv, bool signalled);
  11. void *priv;
  12. };
  13. int nouveau_fence_new(struct nouveau_channel *, struct nouveau_fence **);
  14. struct nouveau_fence *
  15. nouveau_fence_ref(struct nouveau_fence *);
  16. void nouveau_fence_unref(struct nouveau_fence **);
  17. int nouveau_fence_emit(struct nouveau_fence *, struct nouveau_channel *);
  18. bool nouveau_fence_done(struct nouveau_fence *);
  19. int nouveau_fence_wait(struct nouveau_fence *, bool lazy, bool intr);
  20. int nouveau_fence_sync(struct nouveau_fence *, struct nouveau_channel *);
  21. struct nouveau_fence_chan {
  22. struct list_head pending;
  23. struct list_head flip;
  24. spinlock_t lock;
  25. u32 sequence;
  26. };
  27. struct nouveau_fence_priv {
  28. void (*dtor)(struct nouveau_drm *);
  29. bool (*suspend)(struct nouveau_drm *);
  30. void (*resume)(struct nouveau_drm *);
  31. int (*context_new)(struct nouveau_channel *);
  32. void (*context_del)(struct nouveau_channel *);
  33. int (*emit32)(struct nouveau_channel *, u64, u32);
  34. int (*emit)(struct nouveau_fence *);
  35. int (*sync32)(struct nouveau_channel *, u64, u32);
  36. int (*sync)(struct nouveau_fence *, struct nouveau_channel *,
  37. struct nouveau_channel *);
  38. u32 (*read)(struct nouveau_channel *);
  39. wait_queue_head_t waiting;
  40. bool uevent;
  41. };
  42. #define nouveau_fence(drm) ((struct nouveau_fence_priv *)(drm)->fence)
  43. void nouveau_fence_context_new(struct nouveau_fence_chan *);
  44. void nouveau_fence_context_del(struct nouveau_fence_chan *);
  45. int nv04_fence_create(struct nouveau_drm *);
  46. int nv04_fence_mthd(struct nouveau_channel *, u32, u32, u32);
  47. int nv10_fence_emit(struct nouveau_fence *);
  48. int nv17_fence_sync(struct nouveau_fence *, struct nouveau_channel *,
  49. struct nouveau_channel *);
  50. u32 nv10_fence_read(struct nouveau_channel *);
  51. void nv10_fence_context_del(struct nouveau_channel *);
  52. void nv10_fence_destroy(struct nouveau_drm *);
  53. int nv10_fence_create(struct nouveau_drm *);
  54. void nv17_fence_resume(struct nouveau_drm *drm);
  55. int nv50_fence_create(struct nouveau_drm *);
  56. int nv84_fence_create(struct nouveau_drm *);
  57. int nvc0_fence_create(struct nouveau_drm *);
  58. int nouveau_flip_complete(void *chan);
  59. struct nv84_fence_chan {
  60. struct nouveau_fence_chan base;
  61. struct nouveau_vma vma;
  62. struct nouveau_vma dispc_vma[4];
  63. };
  64. struct nv84_fence_priv {
  65. struct nouveau_fence_priv base;
  66. struct nouveau_bo *bo;
  67. u32 *suspend;
  68. };
  69. u64 nv84_fence_crtc(struct nouveau_channel *, int);
  70. int nv84_fence_emit(struct nouveau_fence *);
  71. int nv84_fence_sync(struct nouveau_fence *, struct nouveau_channel *,
  72. struct nouveau_channel *);
  73. u32 nv84_fence_read(struct nouveau_channel *);
  74. int nv84_fence_context_new(struct nouveau_channel *);
  75. void nv84_fence_context_del(struct nouveau_channel *);
  76. bool nv84_fence_suspend(struct nouveau_drm *);
  77. void nv84_fence_resume(struct nouveau_drm *);
  78. void nv84_fence_destroy(struct nouveau_drm *);
  79. #endif