nouveau_fence.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. bool sysmem;
  8. struct nouveau_channel *channel;
  9. unsigned long timeout;
  10. u32 sequence;
  11. };
  12. int nouveau_fence_new(struct nouveau_channel *, bool sysmem,
  13. 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. int (*emit)(struct nouveau_fence *);
  25. int (*sync)(struct nouveau_fence *, struct nouveau_channel *,
  26. struct nouveau_channel *);
  27. u32 (*read)(struct nouveau_channel *);
  28. int (*emit32)(struct nouveau_channel *, u64, u32);
  29. int (*sync32)(struct nouveau_channel *, u64, u32);
  30. spinlock_t lock;
  31. u32 sequence;
  32. };
  33. struct nouveau_fence_priv {
  34. void (*dtor)(struct nouveau_drm *);
  35. bool (*suspend)(struct nouveau_drm *);
  36. void (*resume)(struct nouveau_drm *);
  37. int (*context_new)(struct nouveau_channel *);
  38. void (*context_del)(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. int nv17_fence_create(struct nouveau_drm *);
  55. void nv17_fence_resume(struct nouveau_drm *drm);
  56. int nv50_fence_create(struct nouveau_drm *);
  57. int nv84_fence_create(struct nouveau_drm *);
  58. int nvc0_fence_create(struct nouveau_drm *);
  59. int nouveau_flip_complete(void *chan);
  60. struct nv84_fence_chan {
  61. struct nouveau_fence_chan base;
  62. struct nouveau_vma vma;
  63. struct nouveau_vma vma_gart;
  64. struct nouveau_vma dispc_vma[4];
  65. };
  66. struct nv84_fence_priv {
  67. struct nouveau_fence_priv base;
  68. struct nouveau_bo *bo;
  69. struct nouveau_bo *bo_gart;
  70. u32 *suspend;
  71. };
  72. u64 nv84_fence_crtc(struct nouveau_channel *, int);
  73. int nv84_fence_context_new(struct nouveau_channel *);
  74. #endif