nouveau_fence.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 (*emit)(struct nouveau_fence *);
  34. int (*sync)(struct nouveau_fence *, struct nouveau_channel *,
  35. struct nouveau_channel *);
  36. u32 (*read)(struct nouveau_channel *);
  37. };
  38. #define nouveau_fence(drm) ((struct nouveau_fence_priv *)(drm)->fence)
  39. void nouveau_fence_context_new(struct nouveau_fence_chan *);
  40. void nouveau_fence_context_del(struct nouveau_fence_chan *);
  41. int nv04_fence_create(struct nouveau_drm *);
  42. int nv04_fence_mthd(struct nouveau_channel *, u32, u32, u32);
  43. int nv10_fence_emit(struct nouveau_fence *);
  44. int nv17_fence_sync(struct nouveau_fence *, struct nouveau_channel *,
  45. struct nouveau_channel *);
  46. u32 nv10_fence_read(struct nouveau_channel *);
  47. void nv10_fence_context_del(struct nouveau_channel *);
  48. void nv10_fence_destroy(struct nouveau_drm *);
  49. int nv10_fence_create(struct nouveau_drm *);
  50. int nv50_fence_create(struct nouveau_drm *);
  51. int nv84_fence_create(struct nouveau_drm *);
  52. int nvc0_fence_create(struct nouveau_drm *);
  53. u64 nvc0_fence_crtc(struct nouveau_channel *, int crtc);
  54. int nouveau_flip_complete(void *chan);
  55. #endif