nouveau_fence.h 2.8 KB

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