Commit | Line | Data |
---|---|---|
d375e7d5 BS |
1 | #ifndef __NOUVEAU_FENCE_H__ |
2 | #define __NOUVEAU_FENCE_H__ | |
3 | ||
ebb945a9 BS |
4 | struct nouveau_drm; |
5 | ||
d375e7d5 BS |
6 | struct nouveau_fence { |
7 | struct list_head head; | |
8 | struct kref kref; | |
9 | ||
10 | struct nouveau_channel *channel; | |
11 | unsigned long timeout; | |
12 | u32 sequence; | |
13 | ||
14 | void (*work)(void *priv, bool signalled); | |
15 | void *priv; | |
16 | }; | |
17 | ||
18 | int nouveau_fence_new(struct nouveau_channel *, struct nouveau_fence **); | |
19 | struct nouveau_fence * | |
20 | nouveau_fence_ref(struct nouveau_fence *); | |
21 | void nouveau_fence_unref(struct nouveau_fence **); | |
22 | ||
23 | int nouveau_fence_emit(struct nouveau_fence *, struct nouveau_channel *); | |
24 | bool nouveau_fence_done(struct nouveau_fence *); | |
25 | int nouveau_fence_wait(struct nouveau_fence *, bool lazy, bool intr); | |
26 | int nouveau_fence_sync(struct nouveau_fence *, struct nouveau_channel *); | |
d375e7d5 | 27 | |
5e120f6e BS |
28 | struct nouveau_fence_chan { |
29 | struct list_head pending; | |
f589be88 BS |
30 | struct list_head flip; |
31 | ||
5e120f6e BS |
32 | spinlock_t lock; |
33 | u32 sequence; | |
34 | }; | |
35 | ||
36 | struct nouveau_fence_priv { | |
ebb945a9 BS |
37 | void (*dtor)(struct nouveau_drm *); |
38 | bool (*suspend)(struct nouveau_drm *); | |
39 | void (*resume)(struct nouveau_drm *); | |
e193b1d4 BS |
40 | int (*context_new)(struct nouveau_channel *); |
41 | void (*context_del)(struct nouveau_channel *); | |
42 | int (*emit)(struct nouveau_fence *); | |
43 | int (*sync)(struct nouveau_fence *, struct nouveau_channel *, | |
44 | struct nouveau_channel *); | |
45 | u32 (*read)(struct nouveau_channel *); | |
5e120f6e BS |
46 | }; |
47 | ||
ebb945a9 BS |
48 | #define nouveau_fence(drm) ((struct nouveau_fence_priv *)(drm)->fence) |
49 | ||
5e120f6e BS |
50 | void nouveau_fence_context_new(struct nouveau_fence_chan *); |
51 | void nouveau_fence_context_del(struct nouveau_fence_chan *); | |
52 | ||
ebb945a9 | 53 | int nv04_fence_create(struct nouveau_drm *); |
5e120f6e BS |
54 | int nv04_fence_mthd(struct nouveau_channel *, u32, u32, u32); |
55 | ||
f589be88 BS |
56 | int nv10_fence_emit(struct nouveau_fence *); |
57 | int nv17_fence_sync(struct nouveau_fence *, struct nouveau_channel *, | |
58 | struct nouveau_channel *); | |
59 | u32 nv10_fence_read(struct nouveau_channel *); | |
60 | void nv10_fence_context_del(struct nouveau_channel *); | |
ebb945a9 BS |
61 | void nv10_fence_destroy(struct nouveau_drm *); |
62 | int nv10_fence_create(struct nouveau_drm *); | |
f589be88 | 63 | |
ebb945a9 BS |
64 | int nv50_fence_create(struct nouveau_drm *); |
65 | int nv84_fence_create(struct nouveau_drm *); | |
66 | int nvc0_fence_create(struct nouveau_drm *); | |
f589be88 BS |
67 | u64 nvc0_fence_crtc(struct nouveau_channel *, int crtc); |
68 | ||
69 | int nouveau_flip_complete(void *chan); | |
5e120f6e | 70 | |
d375e7d5 | 71 | #endif |