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 #ifndef __SAVAGE_DRM_H__
27 #define __SAVAGE_DRM_H__
28
29 #include "drm.h"
30
31 #if defined(__cplusplus)
32 extern "C" {
33 #endif
34
35 #ifndef __SAVAGE_SAREA_DEFINES__
36 #define __SAVAGE_SAREA_DEFINES__
37
38
39
40
41
42
43
44
45 #define SAVAGE_CARD_HEAP 0
46 #define SAVAGE_AGP_HEAP 1
47 #define SAVAGE_NR_TEX_HEAPS 2
48 #define SAVAGE_NR_TEX_REGIONS 16
49 #define SAVAGE_LOG_MIN_TEX_REGION_SIZE 16
50
51 #endif
52
53 typedef struct _drm_savage_sarea {
54
55
56 struct drm_tex_region texList[SAVAGE_NR_TEX_HEAPS][SAVAGE_NR_TEX_REGIONS +
57 1];
58 unsigned int texAge[SAVAGE_NR_TEX_HEAPS];
59
60
61
62 int ctxOwner;
63 } drm_savage_sarea_t, *drm_savage_sarea_ptr;
64
65
66
67 #define DRM_SAVAGE_BCI_INIT 0x00
68 #define DRM_SAVAGE_BCI_CMDBUF 0x01
69 #define DRM_SAVAGE_BCI_EVENT_EMIT 0x02
70 #define DRM_SAVAGE_BCI_EVENT_WAIT 0x03
71
72 #define DRM_IOCTL_SAVAGE_BCI_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_INIT, drm_savage_init_t)
73 #define DRM_IOCTL_SAVAGE_BCI_CMDBUF DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_CMDBUF, drm_savage_cmdbuf_t)
74 #define DRM_IOCTL_SAVAGE_BCI_EVENT_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_SAVAGE_BCI_EVENT_EMIT, drm_savage_event_emit_t)
75 #define DRM_IOCTL_SAVAGE_BCI_EVENT_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_EVENT_WAIT, drm_savage_event_wait_t)
76
77 #define SAVAGE_DMA_PCI 1
78 #define SAVAGE_DMA_AGP 3
79 typedef struct drm_savage_init {
80 enum {
81 SAVAGE_INIT_BCI = 1,
82 SAVAGE_CLEANUP_BCI = 2
83 } func;
84 unsigned int sarea_priv_offset;
85
86
87 unsigned int cob_size;
88 unsigned int bci_threshold_lo, bci_threshold_hi;
89 unsigned int dma_type;
90
91
92 unsigned int fb_bpp;
93 unsigned int front_offset, front_pitch;
94 unsigned int back_offset, back_pitch;
95 unsigned int depth_bpp;
96 unsigned int depth_offset, depth_pitch;
97
98
99 unsigned int texture_offset;
100 unsigned int texture_size;
101
102
103 unsigned long status_offset;
104 unsigned long buffers_offset;
105 unsigned long agp_textures_offset;
106 unsigned long cmd_dma_offset;
107 } drm_savage_init_t;
108
109 typedef union drm_savage_cmd_header drm_savage_cmd_header_t;
110 typedef struct drm_savage_cmdbuf {
111
112 drm_savage_cmd_header_t __user *cmd_addr;
113 unsigned int size;
114
115 unsigned int dma_idx;
116 int discard;
117
118 unsigned int __user *vb_addr;
119 unsigned int vb_size;
120 unsigned int vb_stride;
121
122 struct drm_clip_rect __user *box_addr;
123 unsigned int nbox;
124 } drm_savage_cmdbuf_t;
125
126 #define SAVAGE_WAIT_2D 0x1
127 #define SAVAGE_WAIT_3D 0x2
128 #define SAVAGE_WAIT_IRQ 0x4
129 typedef struct drm_savage_event {
130 unsigned int count;
131 unsigned int flags;
132 } drm_savage_event_emit_t, drm_savage_event_wait_t;
133
134
135
136 #define SAVAGE_CMD_STATE 0
137 #define SAVAGE_CMD_DMA_PRIM 1
138 #define SAVAGE_CMD_VB_PRIM 2
139 #define SAVAGE_CMD_DMA_IDX 3
140 #define SAVAGE_CMD_VB_IDX 4
141 #define SAVAGE_CMD_CLEAR 5
142 #define SAVAGE_CMD_SWAP 6
143
144
145
146 #define SAVAGE_PRIM_TRILIST 0
147 #define SAVAGE_PRIM_TRISTRIP 1
148 #define SAVAGE_PRIM_TRIFAN 2
149 #define SAVAGE_PRIM_TRILIST_201 3
150
151
152
153
154 #define SAVAGE_SKIP_Z 0x01
155 #define SAVAGE_SKIP_W 0x02
156 #define SAVAGE_SKIP_C0 0x04
157 #define SAVAGE_SKIP_C1 0x08
158 #define SAVAGE_SKIP_S0 0x10
159 #define SAVAGE_SKIP_T0 0x20
160 #define SAVAGE_SKIP_ST0 0x30
161 #define SAVAGE_SKIP_S1 0x40
162 #define SAVAGE_SKIP_T1 0x80
163 #define SAVAGE_SKIP_ST1 0xc0
164 #define SAVAGE_SKIP_ALL_S3D 0x3f
165 #define SAVAGE_SKIP_ALL_S4 0xff
166
167
168
169 #define SAVAGE_FRONT 0x1
170 #define SAVAGE_BACK 0x2
171 #define SAVAGE_DEPTH 0x4
172
173
174
175 union drm_savage_cmd_header {
176 struct {
177 unsigned char cmd;
178 unsigned char pad0;
179 unsigned short pad1;
180 unsigned short pad2;
181 unsigned short pad3;
182 } cmd;
183 struct {
184 unsigned char cmd;
185 unsigned char global;
186 unsigned short count;
187 unsigned short start;
188 unsigned short pad3;
189 } state;
190 struct {
191 unsigned char cmd;
192 unsigned char prim;
193 unsigned short skip;
194 unsigned short count;
195 unsigned short start;
196 } prim;
197 struct {
198 unsigned char cmd;
199 unsigned char prim;
200 unsigned short skip;
201 unsigned short count;
202 unsigned short pad3;
203 } idx;
204 struct {
205 unsigned char cmd;
206 unsigned char pad0;
207 unsigned short pad1;
208 unsigned int flags;
209 } clear0;
210 struct {
211 unsigned int mask;
212 unsigned int value;
213 } clear1;
214 };
215
216 #if defined(__cplusplus)
217 }
218 #endif
219
220 #endif