drm/ttm: flip the switch, and convert to dma_fence
[deliverable/linux.git] / drivers / gpu / drm / nouveau / nouveau_fence.h
1 #ifndef __NOUVEAU_FENCE_H__
2 #define __NOUVEAU_FENCE_H__
3
4 #include <linux/fence.h>
5 #include <nvif/notify.h>
6
7 struct nouveau_drm;
8 struct nouveau_bo;
9
10 struct nouveau_fence {
11 struct fence base;
12
13 struct list_head head;
14
15 bool sysmem;
16
17 struct nouveau_channel *channel;
18 unsigned long timeout;
19 };
20
21 int nouveau_fence_new(struct nouveau_channel *, bool sysmem,
22 struct nouveau_fence **);
23 struct nouveau_fence *
24 nouveau_fence_ref(struct nouveau_fence *);
25 void nouveau_fence_unref(struct nouveau_fence **);
26
27 int nouveau_fence_emit(struct nouveau_fence *, struct nouveau_channel *);
28 bool nouveau_fence_done(struct nouveau_fence *);
29 void nouveau_fence_work(struct fence *, void (*)(void *), void *);
30 int nouveau_fence_wait(struct nouveau_fence *, bool lazy, bool intr);
31 int nouveau_fence_sync(struct nouveau_bo *, struct nouveau_channel *);
32
33 struct nouveau_fence_chan {
34 spinlock_t lock;
35 struct list_head pending;
36 struct list_head flip;
37
38 int (*emit)(struct nouveau_fence *);
39 int (*sync)(struct nouveau_fence *, struct nouveau_channel *,
40 struct nouveau_channel *);
41 u32 (*read)(struct nouveau_channel *);
42 int (*emit32)(struct nouveau_channel *, u64, u32);
43 int (*sync32)(struct nouveau_channel *, u64, u32);
44
45 u32 sequence;
46 u32 context;
47 char name[24];
48
49 struct nvif_notify notify;
50 int notify_ref;
51 };
52
53 struct nouveau_fence_priv {
54 void (*dtor)(struct nouveau_drm *);
55 bool (*suspend)(struct nouveau_drm *);
56 void (*resume)(struct nouveau_drm *);
57 int (*context_new)(struct nouveau_channel *);
58 void (*context_del)(struct nouveau_channel *);
59
60 u32 contexts, context_base;
61 bool uevent;
62 };
63
64 #define nouveau_fence(drm) ((struct nouveau_fence_priv *)(drm)->fence)
65
66 void nouveau_fence_context_new(struct nouveau_channel *, struct nouveau_fence_chan *);
67 void nouveau_fence_context_del(struct nouveau_fence_chan *);
68
69 int nv04_fence_create(struct nouveau_drm *);
70 int nv04_fence_mthd(struct nouveau_channel *, u32, u32, u32);
71
72 int nv10_fence_emit(struct nouveau_fence *);
73 int nv17_fence_sync(struct nouveau_fence *, struct nouveau_channel *,
74 struct nouveau_channel *);
75 u32 nv10_fence_read(struct nouveau_channel *);
76 void nv10_fence_context_del(struct nouveau_channel *);
77 void nv10_fence_destroy(struct nouveau_drm *);
78 int nv10_fence_create(struct nouveau_drm *);
79
80 int nv17_fence_create(struct nouveau_drm *);
81 void nv17_fence_resume(struct nouveau_drm *drm);
82
83 int nv50_fence_create(struct nouveau_drm *);
84 int nv84_fence_create(struct nouveau_drm *);
85 int nvc0_fence_create(struct nouveau_drm *);
86
87 int nouveau_flip_complete(void *chan);
88
89 struct nv84_fence_chan {
90 struct nouveau_fence_chan base;
91 struct nouveau_vma vma;
92 struct nouveau_vma vma_gart;
93 struct nouveau_vma dispc_vma[4];
94 };
95
96 struct nv84_fence_priv {
97 struct nouveau_fence_priv base;
98 struct nouveau_bo *bo;
99 struct nouveau_bo *bo_gart;
100 u32 *suspend;
101 };
102
103 u64 nv84_fence_crtc(struct nouveau_channel *, int);
104 int nv84_fence_context_new(struct nouveau_channel *);
105
106 #endif
This page took 0.041122 seconds and 5 git commands to generate.