nouveau_fence.h 2.9 KB
Newer Older
1 2 3
#ifndef __NOUVEAU_FENCE_H__
#define __NOUVEAU_FENCE_H__

4 5 6
#include <linux/fence.h>
#include <nvif/notify.h>

7
struct nouveau_drm;
8
struct nouveau_bo;
9

10
struct nouveau_fence {
11 12
	struct fence base;

13 14
	struct list_head head;

15 16
	bool sysmem;

17 18 19 20
	struct nouveau_channel *channel;
	unsigned long timeout;
};

21 22
int  nouveau_fence_new(struct nouveau_channel *, bool sysmem,
		       struct nouveau_fence **);
23 24 25 26 27 28
struct nouveau_fence *
nouveau_fence_ref(struct nouveau_fence *);
void nouveau_fence_unref(struct nouveau_fence **);

int  nouveau_fence_emit(struct nouveau_fence *, struct nouveau_channel *);
bool nouveau_fence_done(struct nouveau_fence *);
29
void nouveau_fence_work(struct nouveau_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 37
	struct list_head flip;

38 39 40 41 42 43 44
	int  (*emit)(struct nouveau_fence *);
	int  (*sync)(struct nouveau_fence *, struct nouveau_channel *,
		     struct nouveau_channel *);
	u32  (*read)(struct nouveau_channel *);
	int  (*emit32)(struct nouveau_channel *, u64, u32);
	int  (*sync32)(struct nouveau_channel *, u64, u32);

45
	u32 sequence;
46 47 48 49 50
	u32 context;
	char name[24];

	struct nvif_notify notify;
	int notify_ref;
51 52 53
};

struct nouveau_fence_priv {
54 55 56
	void (*dtor)(struct nouveau_drm *);
	bool (*suspend)(struct nouveau_drm *);
	void (*resume)(struct nouveau_drm *);
57 58
	int  (*context_new)(struct nouveau_channel *);
	void (*context_del)(struct nouveau_channel *);
59

60
	u32 contexts, context_base;
61
	bool uevent;
62 63
};

64 65
#define nouveau_fence(drm) ((struct nouveau_fence_priv *)(drm)->fence)

66
void nouveau_fence_context_new(struct nouveau_channel *, struct nouveau_fence_chan *);
67 68
void nouveau_fence_context_del(struct nouveau_fence_chan *);

69
int nv04_fence_create(struct nouveau_drm *);
70 71
int nv04_fence_mthd(struct nouveau_channel *, u32, u32, u32);

72 73 74 75 76
int  nv10_fence_emit(struct nouveau_fence *);
int  nv17_fence_sync(struct nouveau_fence *, struct nouveau_channel *,
		     struct nouveau_channel *);
u32  nv10_fence_read(struct nouveau_channel *);
void nv10_fence_context_del(struct nouveau_channel *);
77 78
void nv10_fence_destroy(struct nouveau_drm *);
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 84 85
int nv50_fence_create(struct nouveau_drm *);
int nv84_fence_create(struct nouveau_drm *);
int nvc0_fence_create(struct nouveau_drm *);
86 87

int nouveau_flip_complete(void *chan);
88

89 90 91
struct nv84_fence_chan {
	struct nouveau_fence_chan base;
	struct nouveau_vma vma;
92
	struct nouveau_vma vma_gart;
93 94 95 96 97 98
	struct nouveau_vma dispc_vma[4];
};

struct nv84_fence_priv {
	struct nouveau_fence_priv base;
	struct nouveau_bo *bo;
99
	struct nouveau_bo *bo_gart;
100 101 102 103 104 105
	u32 *suspend;
};

u64  nv84_fence_crtc(struct nouveau_channel *, int);
int  nv84_fence_context_new(struct nouveau_channel *);

106
#endif