nouveau_fence.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #ifndef __NOUVEAU_FENCE_H__
  2. #define __NOUVEAU_FENCE_H__
  3. #include <linux/fence.h>
  4. #include <nvif/notify.h>
  5. struct nouveau_drm;
  6. struct nouveau_bo;
  7. struct nouveau_fence {
  8. struct fence base;
  9. struct list_head head;
  10. bool sysmem;
  11. struct nouveau_channel __rcu *channel;
  12. unsigned long timeout;
  13. };
  14. int nouveau_fence_new(struct nouveau_channel *, bool sysmem,
  15. 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. void nouveau_fence_work(struct fence *, void (*)(void *), void *);
  20. int nouveau_fence_wait(struct nouveau_fence *, bool lazy, bool intr);
  21. int nouveau_fence_sync(struct nouveau_bo *, struct nouveau_channel *, bool exclusive, bool intr);
  22. struct nouveau_fence_chan {
  23. spinlock_t lock;
  24. struct kref fence_ref;
  25. struct list_head pending;
  26. struct list_head flip;
  27. int (*emit)(struct nouveau_fence *);
  28. int (*sync)(struct nouveau_fence *, struct nouveau_channel *,
  29. struct nouveau_channel *);
  30. u32 (*read)(struct nouveau_channel *);
  31. int (*emit32)(struct nouveau_channel *, u64, u32);
  32. int (*sync32)(struct nouveau_channel *, u64, u32);
  33. u32 sequence;
  34. u32 context;
  35. char name[32];
  36. struct nvif_notify notify;
  37. int notify_ref, dead;
  38. };
  39. struct nouveau_fence_priv {
  40. void (*dtor)(struct nouveau_drm *);
  41. bool (*suspend)(struct nouveau_drm *);
  42. void (*resume)(struct nouveau_drm *);
  43. int (*context_new)(struct nouveau_channel *);
  44. void (*context_del)(struct nouveau_channel *);
  45. u32 contexts, context_base;
  46. bool uevent;
  47. };
  48. #define nouveau_fence(drm) ((struct nouveau_fence_priv *)(drm)->fence)
  49. void nouveau_fence_context_new(struct nouveau_channel *, struct nouveau_fence_chan *);
  50. void nouveau_fence_context_del(struct nouveau_fence_chan *);
  51. void nouveau_fence_context_free(struct nouveau_fence_chan *);
  52. int nv04_fence_create(struct nouveau_drm *);
  53. int nv04_fence_mthd(struct nouveau_channel *, u32, u32, u32);
  54. int nv10_fence_emit(struct nouveau_fence *);
  55. int nv17_fence_sync(struct nouveau_fence *, struct nouveau_channel *,
  56. struct nouveau_channel *);
  57. u32 nv10_fence_read(struct nouveau_channel *);
  58. void nv10_fence_context_del(struct nouveau_channel *);
  59. void nv10_fence_destroy(struct nouveau_drm *);
  60. int nv10_fence_create(struct nouveau_drm *);
  61. int nv17_fence_create(struct nouveau_drm *);
  62. void nv17_fence_resume(struct nouveau_drm *drm);
  63. int nv50_fence_create(struct nouveau_drm *);
  64. int nv84_fence_create(struct nouveau_drm *);
  65. int nvc0_fence_create(struct nouveau_drm *);
  66. int nouveau_flip_complete(struct nvif_notify *);
  67. struct nv84_fence_chan {
  68. struct nouveau_fence_chan base;
  69. struct nvkm_vma vma;
  70. struct nvkm_vma vma_gart;
  71. struct nvkm_vma dispc_vma[4];
  72. };
  73. struct nv84_fence_priv {
  74. struct nouveau_fence_priv base;
  75. struct nouveau_bo *bo;
  76. struct nouveau_bo *bo_gart;
  77. u32 *suspend;
  78. struct mutex mutex;
  79. };
  80. u64 nv84_fence_crtc(struct nouveau_channel *, int);
  81. int nv84_fence_context_new(struct nouveau_channel *);
  82. #endif