forked from geohot/cuda_ioctl_sniffer
-
Notifications
You must be signed in to change notification settings - Fork 2
/
nouveau.h
83 lines (71 loc) · 1.88 KB
/
nouveau.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <assert.h>
#define NVC0_PUSH_EXPLICIT_SPACE_CHECKING
struct nouveau_pushbuf {
uint32_t *cur;
};
static inline uint32_t
NVC0_FIFO_PKHDR_SQ(int subc, int mthd, unsigned size)
{
return 0x20000000 | (size << 16) | (subc << 13) | (mthd >> 2);
}
static inline uint32_t
NVC0_FIFO_PKHDR_NI(int subc, int mthd, unsigned size)
{
return 0x60000000 | (size << 16) | (subc << 13) | (mthd >> 2);
}
static inline uint32_t
NVC0_FIFO_PKHDR_IL(int subc, int mthd, uint16_t data)
{
assert(data < 0x2000);
return 0x80000000 | (data << 16) | (subc << 13) | (mthd >> 2);
}
static inline uint32_t
NVC0_FIFO_PKHDR_1I(int subc, int mthd, unsigned size)
{
return 0xa0000000 | (size << 16) | (subc << 13) | (mthd >> 2);
}
static inline void
PUSH_DATA(struct nouveau_pushbuf *push, uint32_t data)
{
*push->cur++ = data;
}
static inline void
PUSH_DATAh(struct nouveau_pushbuf *push, uint64_t data)
{
*push->cur++ = (uint32_t)(data >> 32);
}
static inline void
PUSH_DATAl(struct nouveau_pushbuf *push, uint64_t data)
{
*push->cur++ = (uint32_t)(data >> 0);
}
static inline void
PUSH_DATAhl(struct nouveau_pushbuf *push, uint64_t data)
{
PUSH_DATAh(push, data);
PUSH_DATAl(push, data);
}
static inline void
BEGIN_NVC0(struct nouveau_pushbuf *push, int subc, int mthd, unsigned size)
{
#ifndef NVC0_PUSH_EXPLICIT_SPACE_CHECKING
PUSH_SPACE(push, size + 1);
#endif
PUSH_DATA (push, NVC0_FIFO_PKHDR_SQ(subc, mthd, size));
}
static inline void
BEGIN_NIC0(struct nouveau_pushbuf *push, int subc, int mthd, unsigned size)
{
#ifndef NVC0_PUSH_EXPLICIT_SPACE_CHECKING
PUSH_SPACE(push, size + 1);
#endif
PUSH_DATA (push, NVC0_FIFO_PKHDR_NI(subc, mthd, size));
}
static inline void
BEGIN_1IC0(struct nouveau_pushbuf *push, int subc, int mthd, unsigned size)
{
#ifndef NVC0_PUSH_EXPLICIT_SPACE_CHECKING
PUSH_SPACE(push, size + 1);
#endif
PUSH_DATA (push, NVC0_FIFO_PKHDR_1I(subc, mthd, size));
}