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