]> Pileus Git - ~andy/linux/blob - drivers/gpu/drm/nouveau/nouveau_fence.h
drm/nouveau/pageflip: kick flip handling out of engsw and into fence
[~andy/linux] / drivers / gpu / drm / nouveau / nouveau_fence.h
1 #ifndef __NOUVEAU_FENCE_H__
2 #define __NOUVEAU_FENCE_H__
3
4 struct nouveau_fence {
5         struct list_head head;
6         struct kref kref;
7
8         struct nouveau_channel *channel;
9         unsigned long timeout;
10         u32 sequence;
11
12         void (*work)(void *priv, bool signalled);
13         void *priv;
14 };
15
16 int  nouveau_fence_new(struct nouveau_channel *, struct nouveau_fence **);
17 struct nouveau_fence *
18 nouveau_fence_ref(struct nouveau_fence *);
19 void nouveau_fence_unref(struct nouveau_fence **);
20
21 int  nouveau_fence_emit(struct nouveau_fence *, struct nouveau_channel *);
22 bool nouveau_fence_done(struct nouveau_fence *);
23 int  nouveau_fence_wait(struct nouveau_fence *, bool lazy, bool intr);
24 int  nouveau_fence_sync(struct nouveau_fence *, struct nouveau_channel *);
25 void nouveau_fence_idle(struct nouveau_channel *);
26 void nouveau_fence_update(struct nouveau_channel *);
27
28 struct nouveau_fence_chan {
29         struct list_head pending;
30         struct list_head flip;
31
32         spinlock_t lock;
33         u32 sequence;
34 };
35
36 struct nouveau_fence_priv {
37         void (*dtor)(struct drm_device *);
38         bool (*suspend)(struct drm_device *);
39         void (*resume)(struct drm_device *);
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 *);
46 };
47
48 void nouveau_fence_context_new(struct nouveau_fence_chan *);
49 void nouveau_fence_context_del(struct nouveau_fence_chan *);
50
51 int nv04_fence_create(struct drm_device *dev);
52 int nv04_fence_mthd(struct nouveau_channel *, u32, u32, u32);
53
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 drm_device *);
60 int  nv10_fence_create(struct drm_device *dev);
61
62 int nv50_fence_create(struct drm_device *dev);
63 int nv84_fence_create(struct drm_device *dev);
64 int nvc0_fence_create(struct drm_device *dev);
65 u64 nvc0_fence_crtc(struct nouveau_channel *, int crtc);
66
67 int nouveau_flip_complete(void *chan);
68
69 #endif