nouveau_fence.h revision 264ce192b3e7f45d0adb37bfbab2b01a3fbe6c30
1#ifndef __NOUVEAU_FENCE_H__
2#define __NOUVEAU_FENCE_H__
3
4struct nouveau_drm;
5
6struct nouveau_fence {
7	struct list_head head;
8	struct kref kref;
9
10	bool sysmem;
11
12	struct nouveau_channel *channel;
13	unsigned long timeout;
14	u32 sequence;
15};
16
17int  nouveau_fence_new(struct nouveau_channel *, bool sysmem,
18		       struct nouveau_fence **);
19struct nouveau_fence *
20nouveau_fence_ref(struct nouveau_fence *);
21void nouveau_fence_unref(struct nouveau_fence **);
22
23int  nouveau_fence_emit(struct nouveau_fence *, struct nouveau_channel *);
24bool nouveau_fence_done(struct nouveau_fence *);
25int  nouveau_fence_wait(struct nouveau_fence *, bool lazy, bool intr);
26int  nouveau_fence_sync(struct nouveau_fence *, struct nouveau_channel *);
27
28struct nouveau_fence_chan {
29	struct list_head pending;
30	struct list_head flip;
31
32	int  (*emit)(struct nouveau_fence *);
33	int  (*sync)(struct nouveau_fence *, struct nouveau_channel *,
34		     struct nouveau_channel *);
35	u32  (*read)(struct nouveau_channel *);
36	int  (*emit32)(struct nouveau_channel *, u64, u32);
37	int  (*sync32)(struct nouveau_channel *, u64, u32);
38
39	spinlock_t lock;
40	u32 sequence;
41};
42
43struct nouveau_fence_priv {
44	void (*dtor)(struct nouveau_drm *);
45	bool (*suspend)(struct nouveau_drm *);
46	void (*resume)(struct nouveau_drm *);
47	int  (*context_new)(struct nouveau_channel *);
48	void (*context_del)(struct nouveau_channel *);
49
50	wait_queue_head_t waiting;
51	bool uevent;
52};
53
54#define nouveau_fence(drm) ((struct nouveau_fence_priv *)(drm)->fence)
55
56void nouveau_fence_context_new(struct nouveau_fence_chan *);
57void nouveau_fence_context_del(struct nouveau_fence_chan *);
58
59int nv04_fence_create(struct nouveau_drm *);
60int nv04_fence_mthd(struct nouveau_channel *, u32, u32, u32);
61
62int  nv10_fence_emit(struct nouveau_fence *);
63int  nv17_fence_sync(struct nouveau_fence *, struct nouveau_channel *,
64		     struct nouveau_channel *);
65u32  nv10_fence_read(struct nouveau_channel *);
66void nv10_fence_context_del(struct nouveau_channel *);
67void nv10_fence_destroy(struct nouveau_drm *);
68int  nv10_fence_create(struct nouveau_drm *);
69
70int  nv17_fence_create(struct nouveau_drm *);
71void nv17_fence_resume(struct nouveau_drm *drm);
72
73int nv50_fence_create(struct nouveau_drm *);
74int nv84_fence_create(struct nouveau_drm *);
75int nvc0_fence_create(struct nouveau_drm *);
76
77int nouveau_flip_complete(void *chan);
78
79struct nv84_fence_chan {
80	struct nouveau_fence_chan base;
81	struct nouveau_vma vma;
82	struct nouveau_vma vma_gart;
83	struct nouveau_vma dispc_vma[4];
84};
85
86struct nv84_fence_priv {
87	struct nouveau_fence_priv base;
88	struct nouveau_bo *bo;
89	struct nouveau_bo *bo_gart;
90	u32 *suspend;
91};
92
93u64  nv84_fence_crtc(struct nouveau_channel *, int);
94int  nv84_fence_context_new(struct nouveau_channel *);
95
96#endif
97