Rev 1428 | Rev 1877 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1428 | Rev 1430 | ||
---|---|---|---|
1 | #include |
1 | #include |
2 | #include |
2 | #include |
3 | #include |
3 | #include |
4 | #include "radeon_drm.h" |
4 | #include "radeon_drm.h" |
5 | #include "radeon.h" |
5 | #include "radeon.h" |
6 | #include "radeon_object.h" |
6 | #include "radeon_object.h" |
7 | #include "display.h" |
7 | #include "display.h" |
8 | 8 | ||
9 | #include "r100d.h" |
9 | #include "r100d.h" |
10 | 10 | ||
11 | 11 | ||
12 | display_t *rdisplay; |
12 | display_t *rdisplay; |
13 | 13 | ||
14 | static cursor_t* __stdcall select_cursor(cursor_t *cursor); |
14 | static cursor_t* __stdcall select_cursor(cursor_t *cursor); |
15 | static void __stdcall move_cursor(cursor_t *cursor, int x, int y); |
15 | static void __stdcall move_cursor(cursor_t *cursor, int x, int y); |
16 | 16 | ||
17 | extern void destroy_cursor(void); |
17 | extern void destroy_cursor(void); |
18 | 18 | ||
19 | void disable_mouse(void) |
19 | void disable_mouse(void) |
20 | {}; |
20 | {}; |
21 | 21 | ||
22 | int init_cursor(cursor_t *cursor) |
22 | int init_cursor(cursor_t *cursor) |
23 | { |
23 | { |
24 | struct radeon_device *rdev; |
24 | struct radeon_device *rdev; |
25 | 25 | ||
26 | uint32_t *bits; |
26 | uint32_t *bits; |
27 | uint32_t *src; |
27 | uint32_t *src; |
28 | 28 | ||
29 | int i,j; |
29 | int i,j; |
30 | int r; |
30 | int r; |
31 | 31 | ||
32 | rdev = (struct radeon_device *)rdisplay->ddev->dev_private; |
32 | rdev = (struct radeon_device *)rdisplay->ddev->dev_private; |
33 | 33 | ||
34 | r = radeon_bo_create(rdev, NULL, CURSOR_WIDTH*CURSOR_HEIGHT*4, |
34 | r = radeon_bo_create(rdev, NULL, CURSOR_WIDTH*CURSOR_HEIGHT*4, |
35 | false, RADEON_GEM_DOMAIN_VRAM, &cursor->robj); |
35 | false, RADEON_GEM_DOMAIN_VRAM, &cursor->robj); |
36 | 36 | ||
37 | if (unlikely(r != 0)) |
37 | if (unlikely(r != 0)) |
38 | return r; |
38 | return r; |
39 | 39 | ||
40 | r = radeon_bo_reserve(cursor->robj, false); |
40 | r = radeon_bo_reserve(cursor->robj, false); |
41 | if (unlikely(r != 0)) |
41 | if (unlikely(r != 0)) |
42 | return r; |
42 | return r; |
43 | 43 | ||
44 | r = radeon_bo_pin(cursor->robj, RADEON_GEM_DOMAIN_VRAM, NULL); |
44 | r = radeon_bo_pin(cursor->robj, RADEON_GEM_DOMAIN_VRAM, NULL); |
45 | if (unlikely(r != 0)) |
45 | if (unlikely(r != 0)) |
46 | return r; |
46 | return r; |
47 | 47 | ||
48 | r = radeon_bo_kmap(cursor->robj, (void**)&bits); |
48 | r = radeon_bo_kmap(cursor->robj, (void**)&bits); |
49 | if (r) { |
49 | if (r) { |
50 | DRM_ERROR("radeon: failed to map cursor (%d).\n", r); |
50 | DRM_ERROR("radeon: failed to map cursor (%d).\n", r); |
51 | return r; |
51 | return r; |
52 | }; |
52 | }; |
53 | 53 | ||
54 | src = cursor->data; |
54 | src = cursor->data; |
55 | 55 | ||
56 | for(i = 0; i < 32; i++) |
56 | for(i = 0; i < 32; i++) |
57 | { |
57 | { |
58 | for(j = 0; j < 32; j++) |
58 | for(j = 0; j < 32; j++) |
59 | *bits++ = *src++; |
59 | *bits++ = *src++; |
60 | for(j = 32; j < CURSOR_WIDTH; j++) |
60 | for(j = 32; j < CURSOR_WIDTH; j++) |
61 | *bits++ = 0; |
61 | *bits++ = 0; |
62 | } |
62 | } |
63 | for(i = 0; i < CURSOR_WIDTH*(CURSOR_HEIGHT-32); i++) |
63 | for(i = 0; i < CURSOR_WIDTH*(CURSOR_HEIGHT-32); i++) |
64 | *bits++ = 0; |
64 | *bits++ = 0; |
65 | 65 | ||
66 | radeon_bo_kunmap(cursor->robj); |
66 | radeon_bo_kunmap(cursor->robj); |
67 | 67 | ||
68 | // cursor->header.destroy = destroy_cursor; |
68 | // cursor->header.destroy = destroy_cursor; |
69 | 69 | ||
70 | return 0; |
70 | return 0; |
71 | }; |
71 | }; |
72 | 72 | ||
73 | void fini_cursor(cursor_t *cursor) |
73 | void fini_cursor(cursor_t *cursor) |
74 | { |
74 | { |
75 | list_del(&cursor->list); |
75 | list_del(&cursor->list); |
76 | radeon_bo_unpin(cursor->robj); |
76 | radeon_bo_unpin(cursor->robj); |
77 | KernelFree(cursor->data); |
77 | KernelFree(cursor->data); |
78 | __DestroyObject(cursor); |
78 | __DestroyObject(cursor); |
79 | }; |
79 | }; |
80 | 80 | ||
81 | 81 | ||
82 | static void radeon_show_cursor() |
82 | static void radeon_show_cursor() |
83 | { |
83 | { |
84 | struct radeon_device *rdev = (struct radeon_device *)rdisplay->ddev->dev_private; |
84 | struct radeon_device *rdev = (struct radeon_device *)rdisplay->ddev->dev_private; |
85 | 85 | ||
86 | if (ASIC_IS_AVIVO(rdev)) { |
86 | if (ASIC_IS_AVIVO(rdev)) { |
87 | WREG32(RADEON_MM_INDEX, AVIVO_D1CUR_CONTROL); |
87 | WREG32(RADEON_MM_INDEX, AVIVO_D1CUR_CONTROL); |
88 | WREG32(RADEON_MM_DATA, AVIVO_D1CURSOR_EN | |
88 | WREG32(RADEON_MM_DATA, AVIVO_D1CURSOR_EN | |
89 | (AVIVO_D1CURSOR_MODE_24BPP << AVIVO_D1CURSOR_MODE_SHIFT)); |
89 | (AVIVO_D1CURSOR_MODE_24BPP << AVIVO_D1CURSOR_MODE_SHIFT)); |
90 | } else { |
90 | } else { |
91 | WREG32(RADEON_MM_INDEX, RADEON_CRTC_GEN_CNTL); |
91 | WREG32(RADEON_MM_INDEX, RADEON_CRTC_GEN_CNTL); |
92 | WREG32_P(RADEON_MM_DATA, (RADEON_CRTC_CUR_EN | |
92 | WREG32_P(RADEON_MM_DATA, (RADEON_CRTC_CUR_EN | |
93 | (RADEON_CRTC_CUR_MODE_24BPP << RADEON_CRTC_CUR_MODE_SHIFT)), |
93 | (RADEON_CRTC_CUR_MODE_24BPP << RADEON_CRTC_CUR_MODE_SHIFT)), |
94 | ~(RADEON_CRTC_CUR_EN | RADEON_CRTC_CUR_MODE_MASK)); |
94 | ~(RADEON_CRTC_CUR_EN | RADEON_CRTC_CUR_MODE_MASK)); |
95 | } |
95 | } |
96 | } |
96 | } |
97 | 97 | ||
98 | cursor_t* __stdcall select_cursor(cursor_t *cursor) |
98 | cursor_t* __stdcall select_cursor(cursor_t *cursor) |
99 | { |
99 | { |
100 | struct radeon_device *rdev; |
100 | struct radeon_device *rdev; |
101 | cursor_t *old; |
101 | cursor_t *old; |
102 | uint32_t gpu_addr; |
102 | uint32_t gpu_addr; |
103 | 103 | ||
104 | rdev = (struct radeon_device *)rdisplay->ddev->dev_private; |
104 | rdev = (struct radeon_device *)rdisplay->ddev->dev_private; |
105 | 105 | ||
106 | old = rdisplay->cursor; |
106 | old = rdisplay->cursor; |
107 | 107 | ||
108 | rdisplay->cursor = cursor; |
108 | rdisplay->cursor = cursor; |
109 | gpu_addr = radeon_bo_gpu_offset(cursor->robj); |
109 | gpu_addr = radeon_bo_gpu_offset(cursor->robj); |
110 | 110 | ||
111 | if (ASIC_IS_AVIVO(rdev)) |
111 | if (ASIC_IS_AVIVO(rdev)) |
112 | WREG32(AVIVO_D1CUR_SURFACE_ADDRESS, gpu_addr); |
112 | WREG32(AVIVO_D1CUR_SURFACE_ADDRESS, gpu_addr); |
113 | else { |
113 | else { |
114 | WREG32(RADEON_CUR_OFFSET, gpu_addr - rdev->mc.vram_location); |
114 | WREG32(RADEON_CUR_OFFSET, gpu_addr - rdev->mc.vram_start); |
115 | } |
115 | } |
116 | 116 | ||
117 | return old; |
117 | return old; |
118 | }; |
118 | }; |
119 | 119 | ||
120 | static void radeon_lock_cursor(bool lock) |
120 | static void radeon_lock_cursor(bool lock) |
121 | { |
121 | { |
122 | struct radeon_device *rdev; |
122 | struct radeon_device *rdev; |
123 | 123 | ||
124 | rdev = (struct radeon_device *)rdisplay->ddev->dev_private; |
124 | rdev = (struct radeon_device *)rdisplay->ddev->dev_private; |
125 | 125 | ||
126 | uint32_t cur_lock; |
126 | uint32_t cur_lock; |
127 | 127 | ||
128 | if (ASIC_IS_AVIVO(rdev)) { |
128 | if (ASIC_IS_AVIVO(rdev)) { |
129 | cur_lock = RREG32(AVIVO_D1CUR_UPDATE); |
129 | cur_lock = RREG32(AVIVO_D1CUR_UPDATE); |
130 | if (lock) |
130 | if (lock) |
131 | cur_lock |= AVIVO_D1CURSOR_UPDATE_LOCK; |
131 | cur_lock |= AVIVO_D1CURSOR_UPDATE_LOCK; |
132 | else |
132 | else |
133 | cur_lock &= ~AVIVO_D1CURSOR_UPDATE_LOCK; |
133 | cur_lock &= ~AVIVO_D1CURSOR_UPDATE_LOCK; |
134 | WREG32(AVIVO_D1CUR_UPDATE, cur_lock); |
134 | WREG32(AVIVO_D1CUR_UPDATE, cur_lock); |
135 | } else { |
135 | } else { |
136 | cur_lock = RREG32(RADEON_CUR_OFFSET); |
136 | cur_lock = RREG32(RADEON_CUR_OFFSET); |
137 | if (lock) |
137 | if (lock) |
138 | cur_lock |= RADEON_CUR_LOCK; |
138 | cur_lock |= RADEON_CUR_LOCK; |
139 | else |
139 | else |
140 | cur_lock &= ~RADEON_CUR_LOCK; |
140 | cur_lock &= ~RADEON_CUR_LOCK; |
141 | WREG32(RADEON_CUR_OFFSET, cur_lock); |
141 | WREG32(RADEON_CUR_OFFSET, cur_lock); |
142 | } |
142 | } |
143 | } |
143 | } |
144 | 144 | ||
145 | 145 | ||
146 | void __stdcall move_cursor(cursor_t *cursor, int x, int y) |
146 | void __stdcall move_cursor(cursor_t *cursor, int x, int y) |
147 | { |
147 | { |
148 | struct radeon_device *rdev; |
148 | struct radeon_device *rdev; |
149 | rdev = (struct radeon_device *)rdisplay->ddev->dev_private; |
149 | rdev = (struct radeon_device *)rdisplay->ddev->dev_private; |
150 | 150 | ||
151 | int hot_x = cursor->hot_x; |
151 | int hot_x = cursor->hot_x; |
152 | int hot_y = cursor->hot_y; |
152 | int hot_y = cursor->hot_y; |
153 | 153 | ||
154 | radeon_lock_cursor(true); |
154 | radeon_lock_cursor(true); |
155 | if (ASIC_IS_AVIVO(rdev)) |
155 | if (ASIC_IS_AVIVO(rdev)) |
156 | { |
156 | { |
157 | int w = 32; |
157 | int w = 32; |
158 | 158 | ||
159 | WREG32(AVIVO_D1CUR_POSITION, (x << 16) | y); |
159 | WREG32(AVIVO_D1CUR_POSITION, (x << 16) | y); |
160 | WREG32(AVIVO_D1CUR_HOT_SPOT, (hot_x << 16) | hot_y); |
160 | WREG32(AVIVO_D1CUR_HOT_SPOT, (hot_x << 16) | hot_y); |
161 | WREG32(AVIVO_D1CUR_SIZE, ((w - 1) << 16) | 31); |
161 | WREG32(AVIVO_D1CUR_SIZE, ((w - 1) << 16) | 31); |
162 | } else { |
162 | } else { |
163 | 163 | ||
164 | uint32_t gpu_addr; |
164 | uint32_t gpu_addr; |
165 | int xorg =0, yorg=0; |
165 | int xorg =0, yorg=0; |
166 | 166 | ||
167 | x = x - hot_x; |
167 | x = x - hot_x; |
168 | y = y - hot_y; |
168 | y = y - hot_y; |
169 | 169 | ||
170 | if( x < 0 ) |
170 | if( x < 0 ) |
171 | { |
171 | { |
172 | xorg = -x + 1; |
172 | xorg = -x + 1; |
173 | x = 0; |
173 | x = 0; |
174 | } |
174 | } |
175 | 175 | ||
176 | if( y < 0 ) |
176 | if( y < 0 ) |
177 | { |
177 | { |
178 | yorg = -hot_y + 1; |
178 | yorg = -hot_y + 1; |
179 | y = 0; |
179 | y = 0; |
180 | }; |
180 | }; |
181 | 181 | ||
182 | WREG32(RADEON_CUR_HORZ_VERT_OFF, |
182 | WREG32(RADEON_CUR_HORZ_VERT_OFF, |
183 | (RADEON_CUR_LOCK | (xorg << 16) | yorg )); |
183 | (RADEON_CUR_LOCK | (xorg << 16) | yorg )); |
184 | WREG32(RADEON_CUR_HORZ_VERT_POSN, |
184 | WREG32(RADEON_CUR_HORZ_VERT_POSN, |
185 | (RADEON_CUR_LOCK | (x << 16) | y)); |
185 | (RADEON_CUR_LOCK | (x << 16) | y)); |
186 | 186 | ||
187 | gpu_addr = radeon_bo_gpu_offset(cursor->robj); |
187 | gpu_addr = radeon_bo_gpu_offset(cursor->robj); |
188 | 188 | ||
189 | /* offset is from DISP(2)_BASE_ADDRESS */ |
189 | /* offset is from DISP(2)_BASE_ADDRESS */ |
190 | WREG32(RADEON_CUR_OFFSET, |
190 | WREG32(RADEON_CUR_OFFSET, |
191 | (gpu_addr - rdev->mc.vram_location + (yorg * 256))); |
191 | (gpu_addr - rdev->mc.vram_start + (yorg * 256))); |
192 | } |
192 | } |
193 | radeon_lock_cursor(false); |
193 | radeon_lock_cursor(false); |
194 | } |
194 | } |
195 | 195 | ||
196 | void __stdcall restore_cursor(int x, int y) |
196 | void __stdcall restore_cursor(int x, int y) |
197 | { |
197 | { |
198 | }; |
198 | }; |
199 | 199 | ||
200 | 200 | ||
201 | bool init_display(struct radeon_device *rdev, videomode_t *usermode) |
201 | bool init_display(struct radeon_device *rdev, videomode_t *usermode) |
202 | { |
202 | { |
203 | struct drm_device *dev; |
203 | struct drm_device *dev; |
204 | 204 | ||
205 | cursor_t *cursor; |
205 | cursor_t *cursor; |
206 | bool retval = true; |
206 | bool retval = true; |
207 | u32_t ifl; |
207 | u32_t ifl; |
208 | 208 | ||
209 | ENTER(); |
209 | ENTER(); |
210 | 210 | ||
211 | rdisplay = GetDisplay(); |
211 | rdisplay = GetDisplay(); |
212 | 212 | ||
213 | dev = rdisplay->ddev = rdev->ddev; |
213 | dev = rdisplay->ddev = rdev->ddev; |
214 | 214 | ||
215 | ifl = safe_cli(); |
215 | ifl = safe_cli(); |
216 | { |
216 | { |
217 | list_for_each_entry(cursor, &rdisplay->cursors, list) |
217 | list_for_each_entry(cursor, &rdisplay->cursors, list) |
218 | { |
218 | { |
219 | init_cursor(cursor); |
219 | init_cursor(cursor); |
220 | }; |
220 | }; |
221 | 221 | ||
222 | rdisplay->restore_cursor(0,0); |
222 | rdisplay->restore_cursor(0,0); |
223 | rdisplay->init_cursor = init_cursor; |
223 | rdisplay->init_cursor = init_cursor; |
224 | rdisplay->select_cursor = select_cursor; |
224 | rdisplay->select_cursor = select_cursor; |
225 | rdisplay->show_cursor = NULL; |
225 | rdisplay->show_cursor = NULL; |
226 | rdisplay->move_cursor = move_cursor; |
226 | rdisplay->move_cursor = move_cursor; |
227 | rdisplay->restore_cursor = restore_cursor; |
227 | rdisplay->restore_cursor = restore_cursor; |
228 | rdisplay->disable_mouse = disable_mouse; |
228 | rdisplay->disable_mouse = disable_mouse; |
229 | 229 | ||
230 | select_cursor(rdisplay->cursor); |
230 | select_cursor(rdisplay->cursor); |
231 | radeon_show_cursor(); |
231 | radeon_show_cursor(); |
232 | }; |
232 | }; |
233 | safe_sti(ifl); |
233 | safe_sti(ifl); |
234 | 234 | ||
235 | LEAVE(); |
235 | LEAVE(); |
236 | 236 | ||
237 | return retval; |
237 | return retval; |
238 | }; |
238 | }; |
239 | 239 | ||
240 | 240 | ||
241 | struct fb_info *framebuffer_alloc(size_t size, struct device *dev) |
241 | struct fb_info *framebuffer_alloc(size_t size, struct device *dev) |
242 | { |
242 | { |
243 | #define BYTES_PER_LONG (BITS_PER_LONG/8) |
243 | #define BYTES_PER_LONG (BITS_PER_LONG/8) |
244 | #define PADDING (BYTES_PER_LONG - (sizeof(struct fb_info) % BYTES_PER_LONG)) |
244 | #define PADDING (BYTES_PER_LONG - (sizeof(struct fb_info) % BYTES_PER_LONG)) |
245 | int fb_info_size = sizeof(struct fb_info); |
245 | int fb_info_size = sizeof(struct fb_info); |
246 | struct fb_info *info; |
246 | struct fb_info *info; |
247 | char *p; |
247 | char *p; |
248 | 248 | ||
249 | if (size) |
249 | if (size) |
250 | fb_info_size += PADDING; |
250 | fb_info_size += PADDING; |
251 | 251 | ||
252 | p = kzalloc(fb_info_size + size, GFP_KERNEL); |
252 | p = kzalloc(fb_info_size + size, GFP_KERNEL); |
253 | 253 | ||
254 | if (!p) |
254 | if (!p) |
255 | return NULL; |
255 | return NULL; |
256 | 256 | ||
257 | info = (struct fb_info *) p; |
257 | info = (struct fb_info *) p; |
258 | 258 | ||
259 | if (size) |
259 | if (size) |
260 | info->par = p + fb_info_size; |
260 | info->par = p + fb_info_size; |
261 | 261 | ||
262 | return info; |
262 | return info; |
263 | #undef PADDING |
263 | #undef PADDING |
264 | #undef BYTES_PER_LONG |
264 | #undef BYTES_PER_LONG |
265 | } |
265 | } |
266 | 266 | ||
267 | void framebuffer_release(struct fb_info *info) |
267 | void framebuffer_release(struct fb_info *info) |
268 | { |
268 | { |
269 | kfree(info); |
269 | kfree(info); |
270 | } |
270 | } |
271 | 271 | ||
272 | #define PACKET3_PAINT_MULTI 0x9A |
272 | #define PACKET3_PAINT_MULTI 0x9A |
273 | # define R5XX_GMC_CLR_CMP_CNTL_DIS (1 << 28) |
273 | # define R5XX_GMC_CLR_CMP_CNTL_DIS (1 << 28) |
274 | # define R5XX_GMC_WR_MSK_DIS (1 << 30) |
274 | # define R5XX_GMC_WR_MSK_DIS (1 << 30) |
275 | # define R5XX_ROP3_P 0x00f00000 |
275 | # define R5XX_ROP3_P 0x00f00000 |
276 | 276 | ||
277 | #define R5XX_SC_TOP_LEFT 0x16ec |
277 | #define R5XX_SC_TOP_LEFT 0x16ec |
278 | #define R5XX_SC_BOTTOM_RIGHT 0x16f0 |
278 | #define R5XX_SC_BOTTOM_RIGHT 0x16f0 |
279 | # define R5XX_SC_SIGN_MASK_LO 0x8000 |
279 | # define R5XX_SC_SIGN_MASK_LO 0x8000 |
280 | # define R5XX_SC_SIGN_MASK_HI 0x80000000 |
280 | # define R5XX_SC_SIGN_MASK_HI 0x80000000 |
281 | 281 | ||
282 | #define R5XX_DEFAULT_SC_BOTTOM_RIGHT 0x16e8 |
282 | #define R5XX_DEFAULT_SC_BOTTOM_RIGHT 0x16e8 |
283 | # define R5XX_DEFAULT_SC_RIGHT_MAX (0x1fff << 0) |
283 | # define R5XX_DEFAULT_SC_RIGHT_MAX (0x1fff << 0) |
284 | # define R5XX_DEFAULT_SC_BOTTOM_MAX (0x1fff << 16) |
284 | # define R5XX_DEFAULT_SC_BOTTOM_MAX (0x1fff << 16) |
285 | 285 | ||
286 | 286 | ||
287 | int r100_2D_test(struct radeon_device *rdev) |
287 | int r100_2D_test(struct radeon_device *rdev) |
288 | { |
288 | { |
289 | 289 | ||
290 | uint32_t pitch; |
290 | uint32_t pitch; |
291 | uint32_t offset; |
291 | uint32_t offset; |
292 | 292 | ||
293 | int r; |
293 | int r; |
294 | 294 | ||
295 | ENTER(); |
295 | ENTER(); |
296 | 296 | ||
297 | pitch = (1024*4)/64; |
297 | pitch = (1024*4)/64; |
298 | offset = rdev->mc.vram_location; |
298 | offset = rdev->mc.vram_start; |
299 | 299 | ||
300 | r = radeon_ring_lock(rdev, 16); |
300 | r = radeon_ring_lock(rdev, 16); |
301 | if (r) { |
301 | if (r) { |
302 | DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r); |
302 | DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r); |
303 | return r; |
303 | return r; |
304 | } |
304 | } |
305 | radeon_ring_write(rdev, PACKET0(R5XX_SC_TOP_LEFT, 0)); |
305 | radeon_ring_write(rdev, PACKET0(R5XX_SC_TOP_LEFT, 0)); |
306 | radeon_ring_write(rdev, 0); |
306 | radeon_ring_write(rdev, 0); |
307 | 307 | ||
308 | radeon_ring_write(rdev, PACKET0(R5XX_SC_BOTTOM_RIGHT, 0)); |
308 | radeon_ring_write(rdev, PACKET0(R5XX_SC_BOTTOM_RIGHT, 0)); |
309 | radeon_ring_write(rdev, RADEON_DEFAULT_SC_RIGHT_MAX | |
309 | radeon_ring_write(rdev, RADEON_DEFAULT_SC_RIGHT_MAX | |
310 | RADEON_DEFAULT_SC_BOTTOM_MAX); |
310 | RADEON_DEFAULT_SC_BOTTOM_MAX); |
311 | 311 | ||
312 | radeon_ring_write(rdev, PACKET0(R5XX_DEFAULT_SC_BOTTOM_RIGHT, 0)); |
312 | radeon_ring_write(rdev, PACKET0(R5XX_DEFAULT_SC_BOTTOM_RIGHT, 0)); |
313 | radeon_ring_write(rdev, RADEON_DEFAULT_SC_RIGHT_MAX | |
313 | radeon_ring_write(rdev, RADEON_DEFAULT_SC_RIGHT_MAX | |
314 | RADEON_DEFAULT_SC_BOTTOM_MAX); |
314 | RADEON_DEFAULT_SC_BOTTOM_MAX); |
315 | 315 | ||
316 | radeon_ring_write(rdev, PACKET3(PACKET3_PAINT_MULTI, 4)); |
316 | radeon_ring_write(rdev, PACKET3(PACKET3_PAINT_MULTI, 4)); |
317 | radeon_ring_write(rdev, RADEON_GMC_DST_PITCH_OFFSET_CNTL | |
317 | radeon_ring_write(rdev, RADEON_GMC_DST_PITCH_OFFSET_CNTL | |
318 | RADEON_GMC_BRUSH_SOLID_COLOR | |
318 | RADEON_GMC_BRUSH_SOLID_COLOR | |
319 | RADEON_GMC_DST_32BPP | |
319 | RADEON_GMC_DST_32BPP | |
320 | RADEON_GMC_SRC_DATATYPE_COLOR | |
320 | RADEON_GMC_SRC_DATATYPE_COLOR | |
321 | R5XX_GMC_CLR_CMP_CNTL_DIS | |
321 | R5XX_GMC_CLR_CMP_CNTL_DIS | |
322 | R5XX_GMC_WR_MSK_DIS | |
322 | R5XX_GMC_WR_MSK_DIS | |
323 | R5XX_ROP3_P); |
323 | R5XX_ROP3_P); |
324 | 324 | ||
325 | radeon_ring_write(rdev, (pitch<<22)|(offset>>10)); |
325 | radeon_ring_write(rdev, (pitch<<22)|(offset>>10)); |
326 | radeon_ring_write(rdev, 0x0000FF00); |
326 | radeon_ring_write(rdev, 0x0000FF00); |
327 | radeon_ring_write(rdev, (64<<16)|64); |
327 | radeon_ring_write(rdev, (64<<16)|64); |
328 | radeon_ring_write(rdev, (128<<16)|128); |
328 | radeon_ring_write(rdev, (128<<16)|128); |
329 | 329 | ||
330 | radeon_ring_write(rdev, PACKET0(RADEON_DSTCACHE_CTLSTAT, 0)); |
330 | radeon_ring_write(rdev, PACKET0(RADEON_DSTCACHE_CTLSTAT, 0)); |
331 | radeon_ring_write(rdev, RADEON_RB2D_DC_FLUSH_ALL); |
331 | radeon_ring_write(rdev, RADEON_RB2D_DC_FLUSH_ALL); |
332 | radeon_ring_write(rdev, PACKET0(RADEON_WAIT_UNTIL, 0)); |
332 | radeon_ring_write(rdev, PACKET0(RADEON_WAIT_UNTIL, 0)); |
333 | radeon_ring_write(rdev, RADEON_WAIT_2D_IDLECLEAN | |
333 | radeon_ring_write(rdev, RADEON_WAIT_2D_IDLECLEAN | |
334 | RADEON_WAIT_HOST_IDLECLEAN | |
334 | RADEON_WAIT_HOST_IDLECLEAN | |
335 | RADEON_WAIT_DMA_GUI_IDLE); |
335 | RADEON_WAIT_DMA_GUI_IDLE); |
336 | 336 | ||
337 | radeon_ring_unlock_commit(rdev); |
337 | radeon_ring_unlock_commit(rdev); |
338 | 338 | ||
339 | LEAVE(); |
339 | LEAVE(); |
340 | return r; |
340 | return r; |
341 | } |
341 | } |
342 | 342 | ||
343 | 343 | ||
344 | #include "r600_reg_auto_r6xx.h" |
344 | #include "r600_reg_auto_r6xx.h" |
345 | #include "r600_reg_r6xx.h" |
345 | #include "r600_reg_r6xx.h" |
346 | #include "r600d.h" |
346 | #include "r600d.h" |
347 | 347 | ||
348 | const u32 r6xx_default_state[] = |
348 | const u32 r6xx_default_state[] = |
349 | { |
349 | { |
350 | 0xc0002400, |
350 | 0xc0002400, |
351 | 0x00000000, |
351 | 0x00000000, |
352 | 0xc0012800, |
352 | 0xc0012800, |
353 | 0x80000000, |
353 | 0x80000000, |
354 | 0x80000000, |
354 | 0x80000000, |
355 | 0xc0004600, |
355 | 0xc0004600, |
356 | 0x00000016, |
356 | 0x00000016, |
357 | 0xc0016800, |
357 | 0xc0016800, |
358 | 0x00000010, |
358 | 0x00000010, |
359 | 0x00028000, |
359 | 0x00028000, |
360 | 0xc0016800, |
360 | 0xc0016800, |
361 | 0x00000010, |
361 | 0x00000010, |
362 | 0x00008000, |
362 | 0x00008000, |
363 | 0xc0016800, |
363 | 0xc0016800, |
364 | 0x00000542, |
364 | 0x00000542, |
365 | 0x07000003, |
365 | 0x07000003, |
366 | 0xc0016800, |
366 | 0xc0016800, |
367 | 0x000005c5, |
367 | 0x000005c5, |
368 | 0x00000000, |
368 | 0x00000000, |
369 | 0xc0016800, |
369 | 0xc0016800, |
370 | 0x00000363, |
370 | 0x00000363, |
371 | 0x00000000, |
371 | 0x00000000, |
372 | 0xc0016800, |
372 | 0xc0016800, |
373 | 0x0000060c, |
373 | 0x0000060c, |
374 | 0x82000000, |
374 | 0x82000000, |
375 | 0xc0016800, |
375 | 0xc0016800, |
376 | 0x0000060e, |
376 | 0x0000060e, |
377 | 0x01020204, |
377 | 0x01020204, |
378 | 0xc0016f00, |
378 | 0xc0016f00, |
379 | 0x00000000, |
379 | 0x00000000, |
380 | 0x00000000, |
380 | 0x00000000, |
381 | 0xc0016f00, |
381 | 0xc0016f00, |
382 | 0x00000001, |
382 | 0x00000001, |
383 | 0x00000000, |
383 | 0x00000000, |
384 | 0xc0096900, |
384 | 0xc0096900, |
385 | 0x0000022a, |
385 | 0x0000022a, |
386 | 0x00000000, |
386 | 0x00000000, |
387 | 0x00000000, |
387 | 0x00000000, |
388 | 0x00000000, |
388 | 0x00000000, |
389 | 0x00000000, |
389 | 0x00000000, |
390 | 0x00000000, |
390 | 0x00000000, |
391 | 0x00000000, |
391 | 0x00000000, |
392 | 0x00000000, |
392 | 0x00000000, |
393 | 0x00000000, |
393 | 0x00000000, |
394 | 0x00000000, |
394 | 0x00000000, |
395 | 0xc0016900, |
395 | 0xc0016900, |
396 | 0x00000004, |
396 | 0x00000004, |
397 | 0x00000000, |
397 | 0x00000000, |
398 | 0xc0016900, |
398 | 0xc0016900, |
399 | 0x0000000a, |
399 | 0x0000000a, |
400 | 0x00000000, |
400 | 0x00000000, |
401 | 0xc0016900, |
401 | 0xc0016900, |
402 | 0x0000000b, |
402 | 0x0000000b, |
403 | 0x00000000, |
403 | 0x00000000, |
404 | 0xc0016900, |
404 | 0xc0016900, |
405 | 0x0000010c, |
405 | 0x0000010c, |
406 | 0x00000000, |
406 | 0x00000000, |
407 | 0xc0016900, |
407 | 0xc0016900, |
408 | 0x0000010d, |
408 | 0x0000010d, |
409 | 0x00000000, |
409 | 0x00000000, |
410 | 0xc0016900, |
410 | 0xc0016900, |
411 | 0x00000200, |
411 | 0x00000200, |
412 | 0x00000000, |
412 | 0x00000000, |
413 | 0xc0016900, |
413 | 0xc0016900, |
414 | 0x00000343, |
414 | 0x00000343, |
415 | 0x00000060, |
415 | 0x00000060, |
416 | 0xc0016900, |
416 | 0xc0016900, |
417 | 0x00000344, |
417 | 0x00000344, |
418 | 0x00000040, |
418 | 0x00000040, |
419 | 0xc0016900, |
419 | 0xc0016900, |
420 | 0x00000351, |
420 | 0x00000351, |
421 | 0x0000aa00, |
421 | 0x0000aa00, |
422 | 0xc0016900, |
422 | 0xc0016900, |
423 | 0x00000104, |
423 | 0x00000104, |
424 | 0x00000000, |
424 | 0x00000000, |
425 | 0xc0016900, |
425 | 0xc0016900, |
426 | 0x0000010e, |
426 | 0x0000010e, |
427 | 0x00000000, |
427 | 0x00000000, |
428 | 0xc0046900, |
428 | 0xc0046900, |
429 | 0x00000105, |
429 | 0x00000105, |
430 | 0x00000000, |
430 | 0x00000000, |
431 | 0x00000000, |
431 | 0x00000000, |
432 | 0x00000000, |
432 | 0x00000000, |
433 | 0x00000000, |
433 | 0x00000000, |
434 | 0xc0036900, |
434 | 0xc0036900, |
435 | 0x00000109, |
435 | 0x00000109, |
436 | 0x00000000, |
436 | 0x00000000, |
437 | 0x00000000, |
437 | 0x00000000, |
438 | 0x00000000, |
438 | 0x00000000, |
439 | 0xc0046900, |
439 | 0xc0046900, |
440 | 0x0000030c, |
440 | 0x0000030c, |
441 | 0x01000000, |
441 | 0x01000000, |
442 | 0x00000000, |
442 | 0x00000000, |
443 | 0x00000000, |
443 | 0x00000000, |
444 | 0x00000000, |
444 | 0x00000000, |
445 | 0xc0046900, |
445 | 0xc0046900, |
446 | 0x00000048, |
446 | 0x00000048, |
447 | 0x3f800000, |
447 | 0x3f800000, |
448 | 0x00000000, |
448 | 0x00000000, |
449 | 0x3f800000, |
449 | 0x3f800000, |
450 | 0x3f800000, |
450 | 0x3f800000, |
451 | 0xc0016900, |
451 | 0xc0016900, |
452 | 0x0000008e, |
452 | 0x0000008e, |
453 | 0x0000000f, |
453 | 0x0000000f, |
454 | 0xc0016900, |
454 | 0xc0016900, |
455 | 0x00000080, |
455 | 0x00000080, |
456 | 0x00000000, |
456 | 0x00000000, |
457 | 0xc0016900, |
457 | 0xc0016900, |
458 | 0x00000083, |
458 | 0x00000083, |
459 | 0x0000ffff, |
459 | 0x0000ffff, |
460 | 0xc0016900, |
460 | 0xc0016900, |
461 | 0x00000084, |
461 | 0x00000084, |
462 | 0x00000000, |
462 | 0x00000000, |
463 | 0xc0016900, |
463 | 0xc0016900, |
464 | 0x00000085, |
464 | 0x00000085, |
465 | 0x20002000, |
465 | 0x20002000, |
466 | 0xc0016900, |
466 | 0xc0016900, |
467 | 0x00000086, |
467 | 0x00000086, |
468 | 0x00000000, |
468 | 0x00000000, |
469 | 0xc0016900, |
469 | 0xc0016900, |
470 | 0x00000087, |
470 | 0x00000087, |
471 | 0x20002000, |
471 | 0x20002000, |
472 | 0xc0016900, |
472 | 0xc0016900, |
473 | 0x00000088, |
473 | 0x00000088, |
474 | 0x00000000, |
474 | 0x00000000, |
475 | 0xc0016900, |
475 | 0xc0016900, |
476 | 0x00000089, |
476 | 0x00000089, |
477 | 0x20002000, |
477 | 0x20002000, |
478 | 0xc0016900, |
478 | 0xc0016900, |
479 | 0x0000008a, |
479 | 0x0000008a, |
480 | 0x00000000, |
480 | 0x00000000, |
481 | 0xc0016900, |
481 | 0xc0016900, |
482 | 0x0000008b, |
482 | 0x0000008b, |
483 | 0x20002000, |
483 | 0x20002000, |
484 | 0xc0016900, |
484 | 0xc0016900, |
485 | 0x0000008c, |
485 | 0x0000008c, |
486 | 0x00000000, |
486 | 0x00000000, |
487 | 0xc0016900, |
487 | 0xc0016900, |
488 | 0x00000094, |
488 | 0x00000094, |
489 | 0x80000000, |
489 | 0x80000000, |
490 | 0xc0016900, |
490 | 0xc0016900, |
491 | 0x00000095, |
491 | 0x00000095, |
492 | 0x20002000, |
492 | 0x20002000, |
493 | 0xc0026900, |
493 | 0xc0026900, |
494 | 0x000000b4, |
494 | 0x000000b4, |
495 | 0x00000000, |
495 | 0x00000000, |
496 | 0x3f800000, |
496 | 0x3f800000, |
497 | 0xc0016900, |
497 | 0xc0016900, |
498 | 0x00000096, |
498 | 0x00000096, |
499 | 0x80000000, |
499 | 0x80000000, |
500 | 0xc0016900, |
500 | 0xc0016900, |
501 | 0x00000097, |
501 | 0x00000097, |
502 | 0x20002000, |
502 | 0x20002000, |
503 | 0xc0026900, |
503 | 0xc0026900, |
504 | 0x000000b6, |
504 | 0x000000b6, |
505 | 0x00000000, |
505 | 0x00000000, |
506 | 0x3f800000, |
506 | 0x3f800000, |
507 | 0xc0016900, |
507 | 0xc0016900, |
508 | 0x00000098, |
508 | 0x00000098, |
509 | 0x80000000, |
509 | 0x80000000, |
510 | 0xc0016900, |
510 | 0xc0016900, |
511 | 0x00000099, |
511 | 0x00000099, |
512 | 0x20002000, |
512 | 0x20002000, |
513 | 0xc0026900, |
513 | 0xc0026900, |
514 | 0x000000b8, |
514 | 0x000000b8, |
515 | 0x00000000, |
515 | 0x00000000, |
516 | 0x3f800000, |
516 | 0x3f800000, |
517 | 0xc0016900, |
517 | 0xc0016900, |
518 | 0x0000009a, |
518 | 0x0000009a, |
519 | 0x80000000, |
519 | 0x80000000, |
520 | 0xc0016900, |
520 | 0xc0016900, |
521 | 0x0000009b, |
521 | 0x0000009b, |
522 | 0x20002000, |
522 | 0x20002000, |
523 | 0xc0026900, |
523 | 0xc0026900, |
524 | 0x000000ba, |
524 | 0x000000ba, |
525 | 0x00000000, |
525 | 0x00000000, |
526 | 0x3f800000, |
526 | 0x3f800000, |
527 | 0xc0016900, |
527 | 0xc0016900, |
528 | 0x0000009c, |
528 | 0x0000009c, |
529 | 0x80000000, |
529 | 0x80000000, |
530 | 0xc0016900, |
530 | 0xc0016900, |
531 | 0x0000009d, |
531 | 0x0000009d, |
532 | 0x20002000, |
532 | 0x20002000, |
533 | 0xc0026900, |
533 | 0xc0026900, |
534 | 0x000000bc, |
534 | 0x000000bc, |
535 | 0x00000000, |
535 | 0x00000000, |
536 | 0x3f800000, |
536 | 0x3f800000, |
537 | 0xc0016900, |
537 | 0xc0016900, |
538 | 0x0000009e, |
538 | 0x0000009e, |
539 | 0x80000000, |
539 | 0x80000000, |
540 | 0xc0016900, |
540 | 0xc0016900, |
541 | 0x0000009f, |
541 | 0x0000009f, |
542 | 0x20002000, |
542 | 0x20002000, |
543 | 0xc0026900, |
543 | 0xc0026900, |
544 | 0x000000be, |
544 | 0x000000be, |
545 | 0x00000000, |
545 | 0x00000000, |
546 | 0x3f800000, |
546 | 0x3f800000, |
547 | 0xc0016900, |
547 | 0xc0016900, |
548 | 0x000000a0, |
548 | 0x000000a0, |
549 | 0x80000000, |
549 | 0x80000000, |
550 | 0xc0016900, |
550 | 0xc0016900, |
551 | 0x000000a1, |
551 | 0x000000a1, |
552 | 0x20002000, |
552 | 0x20002000, |
553 | 0xc0026900, |
553 | 0xc0026900, |
554 | 0x000000c0, |
554 | 0x000000c0, |
555 | 0x00000000, |
555 | 0x00000000, |
556 | 0x3f800000, |
556 | 0x3f800000, |
557 | 0xc0016900, |
557 | 0xc0016900, |
558 | 0x000000a2, |
558 | 0x000000a2, |
559 | 0x80000000, |
559 | 0x80000000, |
560 | 0xc0016900, |
560 | 0xc0016900, |
561 | 0x000000a3, |
561 | 0x000000a3, |
562 | 0x20002000, |
562 | 0x20002000, |
563 | 0xc0026900, |
563 | 0xc0026900, |
564 | 0x000000c2, |
564 | 0x000000c2, |
565 | 0x00000000, |
565 | 0x00000000, |
566 | 0x3f800000, |
566 | 0x3f800000, |
567 | 0xc0016900, |
567 | 0xc0016900, |
568 | 0x000000a4, |
568 | 0x000000a4, |
569 | 0x80000000, |
569 | 0x80000000, |
570 | 0xc0016900, |
570 | 0xc0016900, |
571 | 0x000000a5, |
571 | 0x000000a5, |
572 | 0x20002000, |
572 | 0x20002000, |
573 | 0xc0026900, |
573 | 0xc0026900, |
574 | 0x000000c4, |
574 | 0x000000c4, |
575 | 0x00000000, |
575 | 0x00000000, |
576 | 0x3f800000, |
576 | 0x3f800000, |
577 | 0xc0016900, |
577 | 0xc0016900, |
578 | 0x000000a6, |
578 | 0x000000a6, |
579 | 0x80000000, |
579 | 0x80000000, |
580 | 0xc0016900, |
580 | 0xc0016900, |
581 | 0x000000a7, |
581 | 0x000000a7, |
582 | 0x20002000, |
582 | 0x20002000, |
583 | 0xc0026900, |
583 | 0xc0026900, |
584 | 0x000000c6, |
584 | 0x000000c6, |
585 | 0x00000000, |
585 | 0x00000000, |
586 | 0x3f800000, |
586 | 0x3f800000, |
587 | 0xc0016900, |
587 | 0xc0016900, |
588 | 0x000000a8, |
588 | 0x000000a8, |
589 | 0x80000000, |
589 | 0x80000000, |
590 | 0xc0016900, |
590 | 0xc0016900, |
591 | 0x000000a9, |
591 | 0x000000a9, |
592 | 0x20002000, |
592 | 0x20002000, |
593 | 0xc0026900, |
593 | 0xc0026900, |
594 | 0x000000c8, |
594 | 0x000000c8, |
595 | 0x00000000, |
595 | 0x00000000, |
596 | 0x3f800000, |
596 | 0x3f800000, |
597 | 0xc0016900, |
597 | 0xc0016900, |
598 | 0x000000aa, |
598 | 0x000000aa, |
599 | 0x80000000, |
599 | 0x80000000, |
600 | 0xc0016900, |
600 | 0xc0016900, |
601 | 0x000000ab, |
601 | 0x000000ab, |
602 | 0x20002000, |
602 | 0x20002000, |
603 | 0xc0026900, |
603 | 0xc0026900, |
604 | 0x000000ca, |
604 | 0x000000ca, |
605 | 0x00000000, |
605 | 0x00000000, |
606 | 0x3f800000, |
606 | 0x3f800000, |
607 | 0xc0016900, |
607 | 0xc0016900, |
608 | 0x000000ac, |
608 | 0x000000ac, |
609 | 0x80000000, |
609 | 0x80000000, |
610 | 0xc0016900, |
610 | 0xc0016900, |
611 | 0x000000ad, |
611 | 0x000000ad, |
612 | 0x20002000, |
612 | 0x20002000, |
613 | 0xc0026900, |
613 | 0xc0026900, |
614 | 0x000000cc, |
614 | 0x000000cc, |
615 | 0x00000000, |
615 | 0x00000000, |
616 | 0x3f800000, |
616 | 0x3f800000, |
617 | 0xc0016900, |
617 | 0xc0016900, |
618 | 0x000000ae, |
618 | 0x000000ae, |
619 | 0x80000000, |
619 | 0x80000000, |
620 | 0xc0016900, |
620 | 0xc0016900, |
621 | 0x000000af, |
621 | 0x000000af, |
622 | 0x20002000, |
622 | 0x20002000, |
623 | 0xc0026900, |
623 | 0xc0026900, |
624 | 0x000000ce, |
624 | 0x000000ce, |
625 | 0x00000000, |
625 | 0x00000000, |
626 | 0x3f800000, |
626 | 0x3f800000, |
627 | 0xc0016900, |
627 | 0xc0016900, |
628 | 0x000000b0, |
628 | 0x000000b0, |
629 | 0x80000000, |
629 | 0x80000000, |
630 | 0xc0016900, |
630 | 0xc0016900, |
631 | 0x000000b1, |
631 | 0x000000b1, |
632 | 0x20002000, |
632 | 0x20002000, |
633 | 0xc0026900, |
633 | 0xc0026900, |
634 | 0x000000d0, |
634 | 0x000000d0, |
635 | 0x00000000, |
635 | 0x00000000, |
636 | 0x3f800000, |
636 | 0x3f800000, |
637 | 0xc0016900, |
637 | 0xc0016900, |
638 | 0x000000b2, |
638 | 0x000000b2, |
639 | 0x80000000, |
639 | 0x80000000, |
640 | 0xc0016900, |
640 | 0xc0016900, |
641 | 0x000000b3, |
641 | 0x000000b3, |
642 | 0x20002000, |
642 | 0x20002000, |
643 | 0xc0026900, |
643 | 0xc0026900, |
644 | 0x000000d2, |
644 | 0x000000d2, |
645 | 0x00000000, |
645 | 0x00000000, |
646 | 0x3f800000, |
646 | 0x3f800000, |
647 | 0xc0016900, |
647 | 0xc0016900, |
648 | 0x00000293, |
648 | 0x00000293, |
649 | 0x00004010, |
649 | 0x00004010, |
650 | 0xc0016900, |
650 | 0xc0016900, |
651 | 0x00000300, |
651 | 0x00000300, |
652 | 0x00000000, |
652 | 0x00000000, |
653 | 0xc0016900, |
653 | 0xc0016900, |
654 | 0x00000301, |
654 | 0x00000301, |
655 | 0x00000000, |
655 | 0x00000000, |
656 | 0xc0016900, |
656 | 0xc0016900, |
657 | 0x00000312, |
657 | 0x00000312, |
658 | 0xffffffff, |
658 | 0xffffffff, |
659 | 0xc0016900, |
659 | 0xc0016900, |
660 | 0x00000307, |
660 | 0x00000307, |
661 | 0x00000000, |
661 | 0x00000000, |
662 | 0xc0016900, |
662 | 0xc0016900, |
663 | 0x00000308, |
663 | 0x00000308, |
664 | 0x00000000, |
664 | 0x00000000, |
665 | 0xc0016900, |
665 | 0xc0016900, |
666 | 0x00000283, |
666 | 0x00000283, |
667 | 0x00000000, |
667 | 0x00000000, |
668 | 0xc0016900, |
668 | 0xc0016900, |
669 | 0x00000292, |
669 | 0x00000292, |
670 | 0x00000000, |
670 | 0x00000000, |
671 | 0xc0066900, |
671 | 0xc0066900, |
672 | 0x0000010f, |
672 | 0x0000010f, |
673 | 0x00000000, |
673 | 0x00000000, |
674 | 0x00000000, |
674 | 0x00000000, |
675 | 0x00000000, |
675 | 0x00000000, |
676 | 0x00000000, |
676 | 0x00000000, |
677 | 0x00000000, |
677 | 0x00000000, |
678 | 0x00000000, |
678 | 0x00000000, |
679 | 0xc0016900, |
679 | 0xc0016900, |
680 | 0x00000206, |
680 | 0x00000206, |
681 | 0x00000000, |
681 | 0x00000000, |
682 | 0xc0016900, |
682 | 0xc0016900, |
683 | 0x00000207, |
683 | 0x00000207, |
684 | 0x00000000, |
684 | 0x00000000, |
685 | 0xc0016900, |
685 | 0xc0016900, |
686 | 0x00000208, |
686 | 0x00000208, |
687 | 0x00000000, |
687 | 0x00000000, |
688 | 0xc0046900, |
688 | 0xc0046900, |
689 | 0x00000303, |
689 | 0x00000303, |
690 | 0x3f800000, |
690 | 0x3f800000, |
691 | 0x3f800000, |
691 | 0x3f800000, |
692 | 0x3f800000, |
692 | 0x3f800000, |
693 | 0x3f800000, |
693 | 0x3f800000, |
694 | 0xc0016900, |
694 | 0xc0016900, |
695 | 0x00000205, |
695 | 0x00000205, |
696 | 0x00000004, |
696 | 0x00000004, |
697 | 0xc0016900, |
697 | 0xc0016900, |
698 | 0x00000280, |
698 | 0x00000280, |
699 | 0x00000000, |
699 | 0x00000000, |
700 | 0xc0016900, |
700 | 0xc0016900, |
701 | 0x00000281, |
701 | 0x00000281, |
702 | 0x00000000, |
702 | 0x00000000, |
703 | 0xc0016900, |
703 | 0xc0016900, |
704 | 0x0000037e, |
704 | 0x0000037e, |
705 | 0x00000000, |
705 | 0x00000000, |
706 | 0xc0016900, |
706 | 0xc0016900, |
707 | 0x00000382, |
707 | 0x00000382, |
708 | 0x00000000, |
708 | 0x00000000, |
709 | 0xc0016900, |
709 | 0xc0016900, |
710 | 0x00000380, |
710 | 0x00000380, |
711 | 0x00000000, |
711 | 0x00000000, |
712 | 0xc0016900, |
712 | 0xc0016900, |
713 | 0x00000383, |
713 | 0x00000383, |
714 | 0x00000000, |
714 | 0x00000000, |
715 | 0xc0016900, |
715 | 0xc0016900, |
716 | 0x00000381, |
716 | 0x00000381, |
717 | 0x00000000, |
717 | 0x00000000, |
718 | 0xc0016900, |
718 | 0xc0016900, |
719 | 0x00000282, |
719 | 0x00000282, |
720 | 0x00000008, |
720 | 0x00000008, |
721 | 0xc0016900, |
721 | 0xc0016900, |
722 | 0x00000302, |
722 | 0x00000302, |
723 | 0x0000002d, |
723 | 0x0000002d, |
724 | 0xc0016900, |
724 | 0xc0016900, |
725 | 0x0000037f, |
725 | 0x0000037f, |
726 | 0x00000000, |
726 | 0x00000000, |
727 | 0xc0016900, |
727 | 0xc0016900, |
728 | 0x000001b2, |
728 | 0x000001b2, |
729 | 0x00000000, |
729 | 0x00000000, |
730 | 0xc0016900, |
730 | 0xc0016900, |
731 | 0x000001b6, |
731 | 0x000001b6, |
732 | 0x00000000, |
732 | 0x00000000, |
733 | 0xc0016900, |
733 | 0xc0016900, |
734 | 0x000001b7, |
734 | 0x000001b7, |
735 | 0x00000000, |
735 | 0x00000000, |
736 | 0xc0016900, |
736 | 0xc0016900, |
737 | 0x000001b8, |
737 | 0x000001b8, |
738 | 0x00000000, |
738 | 0x00000000, |
739 | 0xc0016900, |
739 | 0xc0016900, |
740 | 0x000001b9, |
740 | 0x000001b9, |
741 | 0x00000000, |
741 | 0x00000000, |
742 | 0xc0016900, |
742 | 0xc0016900, |
743 | 0x00000225, |
743 | 0x00000225, |
744 | 0x00000000, |
744 | 0x00000000, |
745 | 0xc0016900, |
745 | 0xc0016900, |
746 | 0x00000229, |
746 | 0x00000229, |
747 | 0x00000000, |
747 | 0x00000000, |
748 | 0xc0016900, |
748 | 0xc0016900, |
749 | 0x00000237, |
749 | 0x00000237, |
750 | 0x00000000, |
750 | 0x00000000, |
751 | 0xc0016900, |
751 | 0xc0016900, |
752 | 0x00000100, |
752 | 0x00000100, |
753 | 0x00000800, |
753 | 0x00000800, |
754 | 0xc0016900, |
754 | 0xc0016900, |
755 | 0x00000101, |
755 | 0x00000101, |
756 | 0x00000000, |
756 | 0x00000000, |
757 | 0xc0016900, |
757 | 0xc0016900, |
758 | 0x00000102, |
758 | 0x00000102, |
759 | 0x00000000, |
759 | 0x00000000, |
760 | 0xc0016900, |
760 | 0xc0016900, |
761 | 0x000002a8, |
761 | 0x000002a8, |
762 | 0x00000000, |
762 | 0x00000000, |
763 | 0xc0016900, |
763 | 0xc0016900, |
764 | 0x000002a9, |
764 | 0x000002a9, |
765 | 0x00000000, |
765 | 0x00000000, |
766 | 0xc0016900, |
766 | 0xc0016900, |
767 | 0x00000103, |
767 | 0x00000103, |
768 | 0x00000000, |
768 | 0x00000000, |
769 | 0xc0016900, |
769 | 0xc0016900, |
770 | 0x00000284, |
770 | 0x00000284, |
771 | 0x00000000, |
771 | 0x00000000, |
772 | 0xc0016900, |
772 | 0xc0016900, |
773 | 0x00000290, |
773 | 0x00000290, |
774 | 0x00000000, |
774 | 0x00000000, |
775 | 0xc0016900, |
775 | 0xc0016900, |
776 | 0x00000285, |
776 | 0x00000285, |
777 | 0x00000000, |
777 | 0x00000000, |
778 | 0xc0016900, |
778 | 0xc0016900, |
779 | 0x00000286, |
779 | 0x00000286, |
780 | 0x00000000, |
780 | 0x00000000, |
781 | 0xc0016900, |
781 | 0xc0016900, |
782 | 0x00000287, |
782 | 0x00000287, |
783 | 0x00000000, |
783 | 0x00000000, |
784 | 0xc0016900, |
784 | 0xc0016900, |
785 | 0x00000288, |
785 | 0x00000288, |
786 | 0x00000000, |
786 | 0x00000000, |
787 | 0xc0016900, |
787 | 0xc0016900, |
788 | 0x00000289, |
788 | 0x00000289, |
789 | 0x00000000, |
789 | 0x00000000, |
790 | 0xc0016900, |
790 | 0xc0016900, |
791 | 0x0000028a, |
791 | 0x0000028a, |
792 | 0x00000000, |
792 | 0x00000000, |
793 | 0xc0016900, |
793 | 0xc0016900, |
794 | 0x0000028b, |
794 | 0x0000028b, |
795 | 0x00000000, |
795 | 0x00000000, |
796 | 0xc0016900, |
796 | 0xc0016900, |
797 | 0x0000028c, |
797 | 0x0000028c, |
798 | 0x00000000, |
798 | 0x00000000, |
799 | 0xc0016900, |
799 | 0xc0016900, |
800 | 0x0000028d, |
800 | 0x0000028d, |
801 | 0x00000000, |
801 | 0x00000000, |
802 | 0xc0016900, |
802 | 0xc0016900, |
803 | 0x0000028e, |
803 | 0x0000028e, |
804 | 0x00000000, |
804 | 0x00000000, |
805 | 0xc0016900, |
805 | 0xc0016900, |
806 | 0x0000028f, |
806 | 0x0000028f, |
807 | 0x00000000, |
807 | 0x00000000, |
808 | 0xc0016900, |
808 | 0xc0016900, |
809 | 0x000002a1, |
809 | 0x000002a1, |
810 | 0x00000000, |
810 | 0x00000000, |
811 | 0xc0016900, |
811 | 0xc0016900, |
812 | 0x000002a5, |
812 | 0x000002a5, |
813 | 0x00000000, |
813 | 0x00000000, |
814 | 0xc0016900, |
814 | 0xc0016900, |
815 | 0x000002ac, |
815 | 0x000002ac, |
816 | 0x00000000, |
816 | 0x00000000, |
817 | 0xc0016900, |
817 | 0xc0016900, |
818 | 0x000002ad, |
818 | 0x000002ad, |
819 | 0x00000000, |
819 | 0x00000000, |
820 | 0xc0016900, |
820 | 0xc0016900, |
821 | 0x000002ae, |
821 | 0x000002ae, |
822 | 0x00000000, |
822 | 0x00000000, |
823 | 0xc0016900, |
823 | 0xc0016900, |
824 | 0x000002c8, |
824 | 0x000002c8, |
825 | 0x00000000, |
825 | 0x00000000, |
826 | 0xc0016900, |
826 | 0xc0016900, |
827 | 0x00000206, |
827 | 0x00000206, |
828 | 0x00000100, |
828 | 0x00000100, |
829 | 0xc0016900, |
829 | 0xc0016900, |
830 | 0x00000204, |
830 | 0x00000204, |
831 | 0x00010000, |
831 | 0x00010000, |
832 | 0xc0036e00, |
832 | 0xc0036e00, |
833 | 0x00000000, |
833 | 0x00000000, |
834 | 0x00000012, |
834 | 0x00000012, |
835 | 0x00000000, |
835 | 0x00000000, |
836 | 0x00000000, |
836 | 0x00000000, |
837 | 0xc0016900, |
837 | 0xc0016900, |
838 | 0x0000008f, |
838 | 0x0000008f, |
839 | 0x0000000f, |
839 | 0x0000000f, |
840 | 0xc0016900, |
840 | 0xc0016900, |
841 | 0x000001e8, |
841 | 0x000001e8, |
842 | 0x00000001, |
842 | 0x00000001, |
843 | 0xc0016900, |
843 | 0xc0016900, |
844 | 0x00000202, |
844 | 0x00000202, |
845 | 0x00cc0000, |
845 | 0x00cc0000, |
846 | 0xc0016900, |
846 | 0xc0016900, |
847 | 0x00000205, |
847 | 0x00000205, |
848 | 0x00000244, |
848 | 0x00000244, |
849 | 0xc0016900, |
849 | 0xc0016900, |
850 | 0x00000203, |
850 | 0x00000203, |
851 | 0x00000210, |
851 | 0x00000210, |
852 | 0xc0016900, |
852 | 0xc0016900, |
853 | 0x000001b1, |
853 | 0x000001b1, |
854 | 0x00000000, |
854 | 0x00000000, |
855 | 0xc0016900, |
855 | 0xc0016900, |
856 | 0x00000185, |
856 | 0x00000185, |
857 | 0x00000000, |
857 | 0x00000000, |
858 | 0xc0016900, |
858 | 0xc0016900, |
859 | 0x000001b3, |
859 | 0x000001b3, |
860 | 0x00000001, |
860 | 0x00000001, |
861 | 0xc0016900, |
861 | 0xc0016900, |
862 | 0x000001b4, |
862 | 0x000001b4, |
863 | 0x00000000, |
863 | 0x00000000, |
864 | 0xc0016900, |
864 | 0xc0016900, |
865 | 0x00000191, |
865 | 0x00000191, |
866 | 0x00000b00, |
866 | 0x00000b00, |
867 | 0xc0016900, |
867 | 0xc0016900, |
868 | 0x000001b5, |
868 | 0x000001b5, |
869 | 0x00000000, |
869 | 0x00000000, |
870 | }; |
870 | }; |
871 | 871 | ||
872 | 872 | ||
873 | 873 | ||
874 | const u32 r7xx_default_state[] = |
874 | const u32 r7xx_default_state[] = |
875 | { |
875 | { |
876 | 0xc0012800, |
876 | 0xc0012800, |
877 | 0x80000000, |
877 | 0x80000000, |
878 | 0x80000000, |
878 | 0x80000000, |
879 | 0xc0004600, |
879 | 0xc0004600, |
880 | 0x00000016, |
880 | 0x00000016, |
881 | 0xc0016800, |
881 | 0xc0016800, |
882 | 0x00000010, |
882 | 0x00000010, |
883 | 0x00028000, |
883 | 0x00028000, |
884 | 0xc0016800, |
884 | 0xc0016800, |
885 | 0x00000010, |
885 | 0x00000010, |
886 | 0x00008000, |
886 | 0x00008000, |
887 | 0xc0016800, |
887 | 0xc0016800, |
888 | 0x00000542, |
888 | 0x00000542, |
889 | 0x07000002, |
889 | 0x07000002, |
890 | 0xc0016800, |
890 | 0xc0016800, |
891 | 0x000005c5, |
891 | 0x000005c5, |
892 | 0x00000000, |
892 | 0x00000000, |
893 | 0xc0016800, |
893 | 0xc0016800, |
894 | 0x00000363, |
894 | 0x00000363, |
895 | 0x00004000, |
895 | 0x00004000, |
896 | 0xc0016800, |
896 | 0xc0016800, |
897 | 0x0000060c, |
897 | 0x0000060c, |
898 | 0x00000000, |
898 | 0x00000000, |
899 | 0xc0016800, |
899 | 0xc0016800, |
900 | 0x0000060e, |
900 | 0x0000060e, |
901 | 0x00420204, |
901 | 0x00420204, |
902 | 0xc0016f00, |
902 | 0xc0016f00, |
903 | 0x00000000, |
903 | 0x00000000, |
904 | 0x00000000, |
904 | 0x00000000, |
905 | 0xc0016f00, |
905 | 0xc0016f00, |
906 | 0x00000001, |
906 | 0x00000001, |
907 | 0x00000000, |
907 | 0x00000000, |
908 | 0xc0096900, |
908 | 0xc0096900, |
909 | 0x0000022a, |
909 | 0x0000022a, |
910 | 0x00000000, |
910 | 0x00000000, |
911 | 0x00000000, |
911 | 0x00000000, |
912 | 0x00000000, |
912 | 0x00000000, |
913 | 0x00000000, |
913 | 0x00000000, |
914 | 0x00000000, |
914 | 0x00000000, |
915 | 0x00000000, |
915 | 0x00000000, |
916 | 0x00000000, |
916 | 0x00000000, |
917 | 0x00000000, |
917 | 0x00000000, |
918 | 0x00000000, |
918 | 0x00000000, |
919 | 0xc0016900, |
919 | 0xc0016900, |
920 | 0x00000004, |
920 | 0x00000004, |
921 | 0x00000000, |
921 | 0x00000000, |
922 | 0xc0016900, |
922 | 0xc0016900, |
923 | 0x0000000a, |
923 | 0x0000000a, |
924 | 0x00000000, |
924 | 0x00000000, |
925 | 0xc0016900, |
925 | 0xc0016900, |
926 | 0x0000000b, |
926 | 0x0000000b, |
927 | 0x00000000, |
927 | 0x00000000, |
928 | 0xc0016900, |
928 | 0xc0016900, |
929 | 0x0000010c, |
929 | 0x0000010c, |
930 | 0x00000000, |
930 | 0x00000000, |
931 | 0xc0016900, |
931 | 0xc0016900, |
932 | 0x0000010d, |
932 | 0x0000010d, |
933 | 0x00000000, |
933 | 0x00000000, |
934 | 0xc0016900, |
934 | 0xc0016900, |
935 | 0x00000200, |
935 | 0x00000200, |
936 | 0x00000000, |
936 | 0x00000000, |
937 | 0xc0016900, |
937 | 0xc0016900, |
938 | 0x00000343, |
938 | 0x00000343, |
939 | 0x00000060, |
939 | 0x00000060, |
940 | 0xc0016900, |
940 | 0xc0016900, |
941 | 0x00000344, |
941 | 0x00000344, |
942 | 0x00000000, |
942 | 0x00000000, |
943 | 0xc0016900, |
943 | 0xc0016900, |
944 | 0x00000351, |
944 | 0x00000351, |
945 | 0x0000aa00, |
945 | 0x0000aa00, |
946 | 0xc0016900, |
946 | 0xc0016900, |
947 | 0x00000104, |
947 | 0x00000104, |
948 | 0x00000000, |
948 | 0x00000000, |
949 | 0xc0016900, |
949 | 0xc0016900, |
950 | 0x0000010e, |
950 | 0x0000010e, |
951 | 0x00000000, |
951 | 0x00000000, |
952 | 0xc0046900, |
952 | 0xc0046900, |
953 | 0x00000105, |
953 | 0x00000105, |
954 | 0x00000000, |
954 | 0x00000000, |
955 | 0x00000000, |
955 | 0x00000000, |
956 | 0x00000000, |
956 | 0x00000000, |
957 | 0x00000000, |
957 | 0x00000000, |
958 | 0xc0046900, |
958 | 0xc0046900, |
959 | 0x0000030c, |
959 | 0x0000030c, |
960 | 0x01000000, |
960 | 0x01000000, |
961 | 0x00000000, |
961 | 0x00000000, |
962 | 0x00000000, |
962 | 0x00000000, |
963 | 0x00000000, |
963 | 0x00000000, |
964 | 0xc0016900, |
964 | 0xc0016900, |
965 | 0x0000008e, |
965 | 0x0000008e, |
966 | 0x0000000f, |
966 | 0x0000000f, |
967 | 0xc0016900, |
967 | 0xc0016900, |
968 | 0x00000080, |
968 | 0x00000080, |
969 | 0x00000000, |
969 | 0x00000000, |
970 | 0xc0016900, |
970 | 0xc0016900, |
971 | 0x00000083, |
971 | 0x00000083, |
972 | 0x0000ffff, |
972 | 0x0000ffff, |
973 | 0xc0016900, |
973 | 0xc0016900, |
974 | 0x00000084, |
974 | 0x00000084, |
975 | 0x00000000, |
975 | 0x00000000, |
976 | 0xc0016900, |
976 | 0xc0016900, |
977 | 0x00000085, |
977 | 0x00000085, |
978 | 0x20002000, |
978 | 0x20002000, |
979 | 0xc0016900, |
979 | 0xc0016900, |
980 | 0x00000086, |
980 | 0x00000086, |
981 | 0x00000000, |
981 | 0x00000000, |
982 | 0xc0016900, |
982 | 0xc0016900, |
983 | 0x00000087, |
983 | 0x00000087, |
984 | 0x20002000, |
984 | 0x20002000, |
985 | 0xc0016900, |
985 | 0xc0016900, |
986 | 0x00000088, |
986 | 0x00000088, |
987 | 0x00000000, |
987 | 0x00000000, |
988 | 0xc0016900, |
988 | 0xc0016900, |
989 | 0x00000089, |
989 | 0x00000089, |
990 | 0x20002000, |
990 | 0x20002000, |
991 | 0xc0016900, |
991 | 0xc0016900, |
992 | 0x0000008a, |
992 | 0x0000008a, |
993 | 0x00000000, |
993 | 0x00000000, |
994 | 0xc0016900, |
994 | 0xc0016900, |
995 | 0x0000008b, |
995 | 0x0000008b, |
996 | 0x20002000, |
996 | 0x20002000, |
997 | 0xc0016900, |
997 | 0xc0016900, |
998 | 0x0000008c, |
998 | 0x0000008c, |
999 | 0xaaaaaaaa, |
999 | 0xaaaaaaaa, |
1000 | 0xc0016900, |
1000 | 0xc0016900, |
1001 | 0x00000094, |
1001 | 0x00000094, |
1002 | 0x80000000, |
1002 | 0x80000000, |
1003 | 0xc0016900, |
1003 | 0xc0016900, |
1004 | 0x00000095, |
1004 | 0x00000095, |
1005 | 0x20002000, |
1005 | 0x20002000, |
1006 | 0xc0026900, |
1006 | 0xc0026900, |
1007 | 0x000000b4, |
1007 | 0x000000b4, |
1008 | 0x00000000, |
1008 | 0x00000000, |
1009 | 0x3f800000, |
1009 | 0x3f800000, |
1010 | 0xc0016900, |
1010 | 0xc0016900, |
1011 | 0x00000096, |
1011 | 0x00000096, |
1012 | 0x80000000, |
1012 | 0x80000000, |
1013 | 0xc0016900, |
1013 | 0xc0016900, |
1014 | 0x00000097, |
1014 | 0x00000097, |
1015 | 0x20002000, |
1015 | 0x20002000, |
1016 | 0xc0026900, |
1016 | 0xc0026900, |
1017 | 0x000000b6, |
1017 | 0x000000b6, |
1018 | 0x00000000, |
1018 | 0x00000000, |
1019 | 0x3f800000, |
1019 | 0x3f800000, |
1020 | 0xc0016900, |
1020 | 0xc0016900, |
1021 | 0x00000098, |
1021 | 0x00000098, |
1022 | 0x80000000, |
1022 | 0x80000000, |
1023 | 0xc0016900, |
1023 | 0xc0016900, |
1024 | 0x00000099, |
1024 | 0x00000099, |
1025 | 0x20002000, |
1025 | 0x20002000, |
1026 | 0xc0026900, |
1026 | 0xc0026900, |
1027 | 0x000000b8, |
1027 | 0x000000b8, |
1028 | 0x00000000, |
1028 | 0x00000000, |
1029 | 0x3f800000, |
1029 | 0x3f800000, |
1030 | 0xc0016900, |
1030 | 0xc0016900, |
1031 | 0x0000009a, |
1031 | 0x0000009a, |
1032 | 0x80000000, |
1032 | 0x80000000, |
1033 | 0xc0016900, |
1033 | 0xc0016900, |
1034 | 0x0000009b, |
1034 | 0x0000009b, |
1035 | 0x20002000, |
1035 | 0x20002000, |
1036 | 0xc0026900, |
1036 | 0xc0026900, |
1037 | 0x000000ba, |
1037 | 0x000000ba, |
1038 | 0x00000000, |
1038 | 0x00000000, |
1039 | 0x3f800000, |
1039 | 0x3f800000, |
1040 | 0xc0016900, |
1040 | 0xc0016900, |
1041 | 0x0000009c, |
1041 | 0x0000009c, |
1042 | 0x80000000, |
1042 | 0x80000000, |
1043 | 0xc0016900, |
1043 | 0xc0016900, |
1044 | 0x0000009d, |
1044 | 0x0000009d, |
1045 | 0x20002000, |
1045 | 0x20002000, |
1046 | 0xc0026900, |
1046 | 0xc0026900, |
1047 | 0x000000bc, |
1047 | 0x000000bc, |
1048 | 0x00000000, |
1048 | 0x00000000, |
1049 | 0x3f800000, |
1049 | 0x3f800000, |
1050 | 0xc0016900, |
1050 | 0xc0016900, |
1051 | 0x0000009e, |
1051 | 0x0000009e, |
1052 | 0x80000000, |
1052 | 0x80000000, |
1053 | 0xc0016900, |
1053 | 0xc0016900, |
1054 | 0x0000009f, |
1054 | 0x0000009f, |
1055 | 0x20002000, |
1055 | 0x20002000, |
1056 | 0xc0026900, |
1056 | 0xc0026900, |
1057 | 0x000000be, |
1057 | 0x000000be, |
1058 | 0x00000000, |
1058 | 0x00000000, |
1059 | 0x3f800000, |
1059 | 0x3f800000, |
1060 | 0xc0016900, |
1060 | 0xc0016900, |
1061 | 0x000000a0, |
1061 | 0x000000a0, |
1062 | 0x80000000, |
1062 | 0x80000000, |
1063 | 0xc0016900, |
1063 | 0xc0016900, |
1064 | 0x000000a1, |
1064 | 0x000000a1, |
1065 | 0x20002000, |
1065 | 0x20002000, |
1066 | 0xc0026900, |
1066 | 0xc0026900, |
1067 | 0x000000c0, |
1067 | 0x000000c0, |
1068 | 0x00000000, |
1068 | 0x00000000, |
1069 | 0x3f800000, |
1069 | 0x3f800000, |
1070 | 0xc0016900, |
1070 | 0xc0016900, |
1071 | 0x000000a2, |
1071 | 0x000000a2, |
1072 | 0x80000000, |
1072 | 0x80000000, |
1073 | 0xc0016900, |
1073 | 0xc0016900, |
1074 | 0x000000a3, |
1074 | 0x000000a3, |
1075 | 0x20002000, |
1075 | 0x20002000, |
1076 | 0xc0026900, |
1076 | 0xc0026900, |
1077 | 0x000000c2, |
1077 | 0x000000c2, |
1078 | 0x00000000, |
1078 | 0x00000000, |
1079 | 0x3f800000, |
1079 | 0x3f800000, |
1080 | 0xc0016900, |
1080 | 0xc0016900, |
1081 | 0x000000a4, |
1081 | 0x000000a4, |
1082 | 0x80000000, |
1082 | 0x80000000, |
1083 | 0xc0016900, |
1083 | 0xc0016900, |
1084 | 0x000000a5, |
1084 | 0x000000a5, |
1085 | 0x20002000, |
1085 | 0x20002000, |
1086 | 0xc0026900, |
1086 | 0xc0026900, |
1087 | 0x000000c4, |
1087 | 0x000000c4, |
1088 | 0x00000000, |
1088 | 0x00000000, |
1089 | 0x3f800000, |
1089 | 0x3f800000, |
1090 | 0xc0016900, |
1090 | 0xc0016900, |
1091 | 0x000000a6, |
1091 | 0x000000a6, |
1092 | 0x80000000, |
1092 | 0x80000000, |
1093 | 0xc0016900, |
1093 | 0xc0016900, |
1094 | 0x000000a7, |
1094 | 0x000000a7, |
1095 | 0x20002000, |
1095 | 0x20002000, |
1096 | 0xc0026900, |
1096 | 0xc0026900, |
1097 | 0x000000c6, |
1097 | 0x000000c6, |
1098 | 0x00000000, |
1098 | 0x00000000, |
1099 | 0x3f800000, |
1099 | 0x3f800000, |
1100 | 0xc0016900, |
1100 | 0xc0016900, |
1101 | 0x000000a8, |
1101 | 0x000000a8, |
1102 | 0x80000000, |
1102 | 0x80000000, |
1103 | 0xc0016900, |
1103 | 0xc0016900, |
1104 | 0x000000a9, |
1104 | 0x000000a9, |
1105 | 0x20002000, |
1105 | 0x20002000, |
1106 | 0xc0026900, |
1106 | 0xc0026900, |
1107 | 0x000000c8, |
1107 | 0x000000c8, |
1108 | 0x00000000, |
1108 | 0x00000000, |
1109 | 0x3f800000, |
1109 | 0x3f800000, |
1110 | 0xc0016900, |
1110 | 0xc0016900, |
1111 | 0x000000aa, |
1111 | 0x000000aa, |
1112 | 0x80000000, |
1112 | 0x80000000, |
1113 | 0xc0016900, |
1113 | 0xc0016900, |
1114 | 0x000000ab, |
1114 | 0x000000ab, |
1115 | 0x20002000, |
1115 | 0x20002000, |
1116 | 0xc0026900, |
1116 | 0xc0026900, |
1117 | 0x000000ca, |
1117 | 0x000000ca, |
1118 | 0x00000000, |
1118 | 0x00000000, |
1119 | 0x3f800000, |
1119 | 0x3f800000, |
1120 | 0xc0016900, |
1120 | 0xc0016900, |
1121 | 0x000000ac, |
1121 | 0x000000ac, |
1122 | 0x80000000, |
1122 | 0x80000000, |
1123 | 0xc0016900, |
1123 | 0xc0016900, |
1124 | 0x000000ad, |
1124 | 0x000000ad, |
1125 | 0x20002000, |
1125 | 0x20002000, |
1126 | 0xc0026900, |
1126 | 0xc0026900, |
1127 | 0x000000cc, |
1127 | 0x000000cc, |
1128 | 0x00000000, |
1128 | 0x00000000, |
1129 | 0x3f800000, |
1129 | 0x3f800000, |
1130 | 0xc0016900, |
1130 | 0xc0016900, |
1131 | 0x000000ae, |
1131 | 0x000000ae, |
1132 | 0x80000000, |
1132 | 0x80000000, |
1133 | 0xc0016900, |
1133 | 0xc0016900, |
1134 | 0x000000af, |
1134 | 0x000000af, |
1135 | 0x20002000, |
1135 | 0x20002000, |
1136 | 0xc0026900, |
1136 | 0xc0026900, |
1137 | 0x000000ce, |
1137 | 0x000000ce, |
1138 | 0x00000000, |
1138 | 0x00000000, |
1139 | 0x3f800000, |
1139 | 0x3f800000, |
1140 | 0xc0016900, |
1140 | 0xc0016900, |
1141 | 0x000000b0, |
1141 | 0x000000b0, |
1142 | 0x80000000, |
1142 | 0x80000000, |
1143 | 0xc0016900, |
1143 | 0xc0016900, |
1144 | 0x000000b1, |
1144 | 0x000000b1, |
1145 | 0x20002000, |
1145 | 0x20002000, |
1146 | 0xc0026900, |
1146 | 0xc0026900, |
1147 | 0x000000d0, |
1147 | 0x000000d0, |
1148 | 0x00000000, |
1148 | 0x00000000, |
1149 | 0x3f800000, |
1149 | 0x3f800000, |
1150 | 0xc0016900, |
1150 | 0xc0016900, |
1151 | 0x000000b2, |
1151 | 0x000000b2, |
1152 | 0x80000000, |
1152 | 0x80000000, |
1153 | 0xc0016900, |
1153 | 0xc0016900, |
1154 | 0x000000b3, |
1154 | 0x000000b3, |
1155 | 0x20002000, |
1155 | 0x20002000, |
1156 | 0xc0026900, |
1156 | 0xc0026900, |
1157 | 0x000000d2, |
1157 | 0x000000d2, |
1158 | 0x00000000, |
1158 | 0x00000000, |
1159 | 0x3f800000, |
1159 | 0x3f800000, |
1160 | 0xc0016900, |
1160 | 0xc0016900, |
1161 | 0x00000293, |
1161 | 0x00000293, |
1162 | 0x00514000, |
1162 | 0x00514000, |
1163 | 0xc0016900, |
1163 | 0xc0016900, |
1164 | 0x00000300, |
1164 | 0x00000300, |
1165 | 0x00000000, |
1165 | 0x00000000, |
1166 | 0xc0016900, |
1166 | 0xc0016900, |
1167 | 0x00000301, |
1167 | 0x00000301, |
1168 | 0x00000000, |
1168 | 0x00000000, |
1169 | 0xc0016900, |
1169 | 0xc0016900, |
1170 | 0x00000312, |
1170 | 0x00000312, |
1171 | 0xffffffff, |
1171 | 0xffffffff, |
1172 | 0xc0016900, |
1172 | 0xc0016900, |
1173 | 0x00000307, |
1173 | 0x00000307, |
1174 | 0x00000000, |
1174 | 0x00000000, |
1175 | 0xc0016900, |
1175 | 0xc0016900, |
1176 | 0x00000308, |
1176 | 0x00000308, |
1177 | 0x00000000, |
1177 | 0x00000000, |
1178 | 0xc0016900, |
1178 | 0xc0016900, |
1179 | 0x00000283, |
1179 | 0x00000283, |
1180 | 0x00000000, |
1180 | 0x00000000, |
1181 | 0xc0016900, |
1181 | 0xc0016900, |
1182 | 0x00000292, |
1182 | 0x00000292, |
1183 | 0x00000000, |
1183 | 0x00000000, |
1184 | 0xc0066900, |
1184 | 0xc0066900, |
1185 | 0x0000010f, |
1185 | 0x0000010f, |
1186 | 0x00000000, |
1186 | 0x00000000, |
1187 | 0x00000000, |
1187 | 0x00000000, |
1188 | 0x00000000, |
1188 | 0x00000000, |
1189 | 0x00000000, |
1189 | 0x00000000, |
1190 | 0x00000000, |
1190 | 0x00000000, |
1191 | 0x00000000, |
1191 | 0x00000000, |
1192 | 0xc0016900, |
1192 | 0xc0016900, |
1193 | 0x00000206, |
1193 | 0x00000206, |
1194 | 0x00000000, |
1194 | 0x00000000, |
1195 | 0xc0016900, |
1195 | 0xc0016900, |
1196 | 0x00000207, |
1196 | 0x00000207, |
1197 | 0x00000000, |
1197 | 0x00000000, |
1198 | 0xc0016900, |
1198 | 0xc0016900, |
1199 | 0x00000208, |
1199 | 0x00000208, |
1200 | 0x00000000, |
1200 | 0x00000000, |
1201 | 0xc0046900, |
1201 | 0xc0046900, |
1202 | 0x00000303, |
1202 | 0x00000303, |
1203 | 0x3f800000, |
1203 | 0x3f800000, |
1204 | 0x3f800000, |
1204 | 0x3f800000, |
1205 | 0x3f800000, |
1205 | 0x3f800000, |
1206 | 0x3f800000, |
1206 | 0x3f800000, |
1207 | 0xc0016900, |
1207 | 0xc0016900, |
1208 | 0x00000205, |
1208 | 0x00000205, |
1209 | 0x00000004, |
1209 | 0x00000004, |
1210 | 0xc0016900, |
1210 | 0xc0016900, |
1211 | 0x00000280, |
1211 | 0x00000280, |
1212 | 0x00000000, |
1212 | 0x00000000, |
1213 | 0xc0016900, |
1213 | 0xc0016900, |
1214 | 0x00000281, |
1214 | 0x00000281, |
1215 | 0x00000000, |
1215 | 0x00000000, |
1216 | 0xc0016900, |
1216 | 0xc0016900, |
1217 | 0x0000037e, |
1217 | 0x0000037e, |
1218 | 0x00000000, |
1218 | 0x00000000, |
1219 | 0xc0016900, |
1219 | 0xc0016900, |
1220 | 0x00000382, |
1220 | 0x00000382, |
1221 | 0x00000000, |
1221 | 0x00000000, |
1222 | 0xc0016900, |
1222 | 0xc0016900, |
1223 | 0x00000380, |
1223 | 0x00000380, |
1224 | 0x00000000, |
1224 | 0x00000000, |
1225 | 0xc0016900, |
1225 | 0xc0016900, |
1226 | 0x00000383, |
1226 | 0x00000383, |
1227 | 0x00000000, |
1227 | 0x00000000, |
1228 | 0xc0016900, |
1228 | 0xc0016900, |
1229 | 0x00000381, |
1229 | 0x00000381, |
1230 | 0x00000000, |
1230 | 0x00000000, |
1231 | 0xc0016900, |
1231 | 0xc0016900, |
1232 | 0x00000282, |
1232 | 0x00000282, |
1233 | 0x00000008, |
1233 | 0x00000008, |
1234 | 0xc0016900, |
1234 | 0xc0016900, |
1235 | 0x00000302, |
1235 | 0x00000302, |
1236 | 0x0000002d, |
1236 | 0x0000002d, |
1237 | 0xc0016900, |
1237 | 0xc0016900, |
1238 | 0x0000037f, |
1238 | 0x0000037f, |
1239 | 0x00000000, |
1239 | 0x00000000, |
1240 | 0xc0016900, |
1240 | 0xc0016900, |
1241 | 0x000001b2, |
1241 | 0x000001b2, |
1242 | 0x00000001, |
1242 | 0x00000001, |
1243 | 0xc0016900, |
1243 | 0xc0016900, |
1244 | 0x000001b6, |
1244 | 0x000001b6, |
1245 | 0x00000000, |
1245 | 0x00000000, |
1246 | 0xc0016900, |
1246 | 0xc0016900, |
1247 | 0x000001b7, |
1247 | 0x000001b7, |
1248 | 0x00000000, |
1248 | 0x00000000, |
1249 | 0xc0016900, |
1249 | 0xc0016900, |
1250 | 0x000001b8, |
1250 | 0x000001b8, |
1251 | 0x00000000, |
1251 | 0x00000000, |
1252 | 0xc0016900, |
1252 | 0xc0016900, |
1253 | 0x000001b9, |
1253 | 0x000001b9, |
1254 | 0x00000000, |
1254 | 0x00000000, |
1255 | 0xc0016900, |
1255 | 0xc0016900, |
1256 | 0x00000225, |
1256 | 0x00000225, |
1257 | 0x00000000, |
1257 | 0x00000000, |
1258 | 0xc0016900, |
1258 | 0xc0016900, |
1259 | 0x00000229, |
1259 | 0x00000229, |
1260 | 0x00000000, |
1260 | 0x00000000, |
1261 | 0xc0016900, |
1261 | 0xc0016900, |
1262 | 0x00000237, |
1262 | 0x00000237, |
1263 | 0x00000000, |
1263 | 0x00000000, |
1264 | 0xc0016900, |
1264 | 0xc0016900, |
1265 | 0x00000100, |
1265 | 0x00000100, |
1266 | 0x00000800, |
1266 | 0x00000800, |
1267 | 0xc0016900, |
1267 | 0xc0016900, |
1268 | 0x00000101, |
1268 | 0x00000101, |
1269 | 0x00000000, |
1269 | 0x00000000, |
1270 | 0xc0016900, |
1270 | 0xc0016900, |
1271 | 0x00000102, |
1271 | 0x00000102, |
1272 | 0x00000000, |
1272 | 0x00000000, |
1273 | 0xc0016900, |
1273 | 0xc0016900, |
1274 | 0x000002a8, |
1274 | 0x000002a8, |
1275 | 0x00000000, |
1275 | 0x00000000, |
1276 | 0xc0016900, |
1276 | 0xc0016900, |
1277 | 0x000002a9, |
1277 | 0x000002a9, |
1278 | 0x00000000, |
1278 | 0x00000000, |
1279 | 0xc0016900, |
1279 | 0xc0016900, |
1280 | 0x00000103, |
1280 | 0x00000103, |
1281 | 0x00000000, |
1281 | 0x00000000, |
1282 | 0xc0016900, |
1282 | 0xc0016900, |
1283 | 0x00000284, |
1283 | 0x00000284, |
1284 | 0x00000000, |
1284 | 0x00000000, |
1285 | 0xc0016900, |
1285 | 0xc0016900, |
1286 | 0x00000290, |
1286 | 0x00000290, |
1287 | 0x00000000, |
1287 | 0x00000000, |
1288 | 0xc0016900, |
1288 | 0xc0016900, |
1289 | 0x00000285, |
1289 | 0x00000285, |
1290 | 0x00000000, |
1290 | 0x00000000, |
1291 | 0xc0016900, |
1291 | 0xc0016900, |
1292 | 0x00000286, |
1292 | 0x00000286, |
1293 | 0x00000000, |
1293 | 0x00000000, |
1294 | 0xc0016900, |
1294 | 0xc0016900, |
1295 | 0x00000287, |
1295 | 0x00000287, |
1296 | 0x00000000, |
1296 | 0x00000000, |
1297 | 0xc0016900, |
1297 | 0xc0016900, |
1298 | 0x00000288, |
1298 | 0x00000288, |
1299 | 0x00000000, |
1299 | 0x00000000, |
1300 | 0xc0016900, |
1300 | 0xc0016900, |
1301 | 0x00000289, |
1301 | 0x00000289, |
1302 | 0x00000000, |
1302 | 0x00000000, |
1303 | 0xc0016900, |
1303 | 0xc0016900, |
1304 | 0x0000028a, |
1304 | 0x0000028a, |
1305 | 0x00000000, |
1305 | 0x00000000, |
1306 | 0xc0016900, |
1306 | 0xc0016900, |
1307 | 0x0000028b, |
1307 | 0x0000028b, |
1308 | 0x00000000, |
1308 | 0x00000000, |
1309 | 0xc0016900, |
1309 | 0xc0016900, |
1310 | 0x0000028c, |
1310 | 0x0000028c, |
1311 | 0x00000000, |
1311 | 0x00000000, |
1312 | 0xc0016900, |
1312 | 0xc0016900, |
1313 | 0x0000028d, |
1313 | 0x0000028d, |
1314 | 0x00000000, |
1314 | 0x00000000, |
1315 | 0xc0016900, |
1315 | 0xc0016900, |
1316 | 0x0000028e, |
1316 | 0x0000028e, |
1317 | 0x00000000, |
1317 | 0x00000000, |
1318 | 0xc0016900, |
1318 | 0xc0016900, |
1319 | 0x0000028f, |
1319 | 0x0000028f, |
1320 | 0x00000000, |
1320 | 0x00000000, |
1321 | 0xc0016900, |
1321 | 0xc0016900, |
1322 | 0x000002a1, |
1322 | 0x000002a1, |
1323 | 0x00000000, |
1323 | 0x00000000, |
1324 | 0xc0016900, |
1324 | 0xc0016900, |
1325 | 0x000002a5, |
1325 | 0x000002a5, |
1326 | 0x00000000, |
1326 | 0x00000000, |
1327 | 0xc0016900, |
1327 | 0xc0016900, |
1328 | 0x000002ac, |
1328 | 0x000002ac, |
1329 | 0x00000000, |
1329 | 0x00000000, |
1330 | 0xc0016900, |
1330 | 0xc0016900, |
1331 | 0x000002ad, |
1331 | 0x000002ad, |
1332 | 0x00000000, |
1332 | 0x00000000, |
1333 | 0xc0016900, |
1333 | 0xc0016900, |
1334 | 0x000002ae, |
1334 | 0x000002ae, |
1335 | 0x00000000, |
1335 | 0x00000000, |
1336 | 0xc0016900, |
1336 | 0xc0016900, |
1337 | 0x000002c8, |
1337 | 0x000002c8, |
1338 | 0x00000000, |
1338 | 0x00000000, |
1339 | 0xc0016900, |
1339 | 0xc0016900, |
1340 | 0x00000206, |
1340 | 0x00000206, |
1341 | 0x00000100, |
1341 | 0x00000100, |
1342 | 0xc0016900, |
1342 | 0xc0016900, |
1343 | 0x00000204, |
1343 | 0x00000204, |
1344 | 0x00010000, |
1344 | 0x00010000, |
1345 | 0xc0036e00, |
1345 | 0xc0036e00, |
1346 | 0x00000000, |
1346 | 0x00000000, |
1347 | 0x00000012, |
1347 | 0x00000012, |
1348 | 0x00000000, |
1348 | 0x00000000, |
1349 | 0x00000000, |
1349 | 0x00000000, |
1350 | 0xc0016900, |
1350 | 0xc0016900, |
1351 | 0x0000008f, |
1351 | 0x0000008f, |
1352 | 0x0000000f, |
1352 | 0x0000000f, |
1353 | 0xc0016900, |
1353 | 0xc0016900, |
1354 | 0x000001e8, |
1354 | 0x000001e8, |
1355 | 0x00000001, |
1355 | 0x00000001, |
1356 | 0xc0016900, |
1356 | 0xc0016900, |
1357 | 0x00000202, |
1357 | 0x00000202, |
1358 | 0x00cc0000, |
1358 | 0x00cc0000, |
1359 | 0xc0016900, |
1359 | 0xc0016900, |
1360 | 0x00000205, |
1360 | 0x00000205, |
1361 | 0x00000244, |
1361 | 0x00000244, |
1362 | 0xc0016900, |
1362 | 0xc0016900, |
1363 | 0x00000203, |
1363 | 0x00000203, |
1364 | 0x00000210, |
1364 | 0x00000210, |
1365 | 0xc0016900, |
1365 | 0xc0016900, |
1366 | 0x000001b1, |
1366 | 0x000001b1, |
1367 | 0x00000000, |
1367 | 0x00000000, |
1368 | 0xc0016900, |
1368 | 0xc0016900, |
1369 | 0x00000185, |
1369 | 0x00000185, |
1370 | 0x00000000, |
1370 | 0x00000000, |
1371 | 0xc0016900, |
1371 | 0xc0016900, |
1372 | 0x000001b3, |
1372 | 0x000001b3, |
1373 | 0x00000001, |
1373 | 0x00000001, |
1374 | 0xc0016900, |
1374 | 0xc0016900, |
1375 | 0x000001b4, |
1375 | 0x000001b4, |
1376 | 0x00000000, |
1376 | 0x00000000, |
1377 | 0xc0016900, |
1377 | 0xc0016900, |
1378 | 0x00000191, |
1378 | 0x00000191, |
1379 | 0x00000b00, |
1379 | 0x00000b00, |
1380 | 0xc0016900, |
1380 | 0xc0016900, |
1381 | 0x000001b5, |
1381 | 0x000001b5, |
1382 | 0x00000000, |
1382 | 0x00000000, |
1383 | }; |
1383 | }; |
1384 | 1384 | ||
1385 | const u32 r6xx_default_size = ARRAY_SIZE(r6xx_default_state); |
1385 | const u32 r6xx_default_size = ARRAY_SIZE(r6xx_default_state); |
1386 | const u32 r7xx_default_size = ARRAY_SIZE(r7xx_default_state); |
1386 | const u32 r7xx_default_size = ARRAY_SIZE(r7xx_default_state); |
1387 | 1387 | ||
1388 | 1388 | ||
1389 | int R600_solid_ps(struct radeon_device *rdev, uint32_t* shader); |
1389 | int R600_solid_ps(struct radeon_device *rdev, uint32_t* shader); |
1390 | int R600_solid_vs(struct radeon_device *rdev, uint32_t* shader); |
1390 | int R600_solid_vs(struct radeon_device *rdev, uint32_t* shader); |
1391 | 1391 | ||
1392 | #define COLOR_8_8_8_8 0x1a |
1392 | #define COLOR_8_8_8_8 0x1a |
1393 | 1393 | ||
1394 | /* emits 21 on rv770+, 23 on r600 */ |
1394 | /* emits 21 on rv770+, 23 on r600 */ |
1395 | static void |
1395 | static void |
1396 | set_render_target(struct radeon_device *rdev, int format, |
1396 | set_render_target(struct radeon_device *rdev, int format, |
1397 | int w, int h, u64 gpu_addr) |
1397 | int w, int h, u64 gpu_addr) |
1398 | { |
1398 | { |
1399 | u32 cb_color_info; |
1399 | u32 cb_color_info; |
1400 | int pitch, slice; |
1400 | int pitch, slice; |
1401 | 1401 | ||
1402 | h = (h + 7) & ~7; |
1402 | h = (h + 7) & ~7; |
1403 | if (h < 8) |
1403 | if (h < 8) |
1404 | h = 8; |
1404 | h = 8; |
1405 | 1405 | ||
1406 | cb_color_info = ((format << 2) | (1 << 27)); |
1406 | cb_color_info = ((format << 2) | (1 << 27)); |
1407 | pitch = (w / 8) - 1; |
1407 | pitch = (w / 8) - 1; |
1408 | slice = ((w * h) / 64) - 1; |
1408 | slice = ((w * h) / 64) - 1; |
1409 | 1409 | ||
1410 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
1410 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
1411 | radeon_ring_write(rdev, (CB_COLOR0_BASE - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1411 | radeon_ring_write(rdev, (CB_COLOR0_BASE - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1412 | radeon_ring_write(rdev, gpu_addr >> 8); |
1412 | radeon_ring_write(rdev, gpu_addr >> 8); |
1413 | 1413 | ||
1414 | if (rdev->family > CHIP_R600 && rdev->family < CHIP_RV770) { |
1414 | if (rdev->family > CHIP_R600 && rdev->family < CHIP_RV770) { |
1415 | radeon_ring_write(rdev, PACKET3(PACKET3_SURFACE_BASE_UPDATE, 0)); |
1415 | radeon_ring_write(rdev, PACKET3(PACKET3_SURFACE_BASE_UPDATE, 0)); |
1416 | radeon_ring_write(rdev, 2 << 0); |
1416 | radeon_ring_write(rdev, 2 << 0); |
1417 | } |
1417 | } |
1418 | 1418 | ||
1419 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
1419 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
1420 | radeon_ring_write(rdev, (CB_COLOR0_SIZE - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1420 | radeon_ring_write(rdev, (CB_COLOR0_SIZE - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1421 | radeon_ring_write(rdev, (pitch << 0) | (slice << 10)); |
1421 | radeon_ring_write(rdev, (pitch << 0) | (slice << 10)); |
1422 | 1422 | ||
1423 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
1423 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
1424 | radeon_ring_write(rdev, (CB_COLOR0_VIEW - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1424 | radeon_ring_write(rdev, (CB_COLOR0_VIEW - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1425 | radeon_ring_write(rdev, 0); |
1425 | radeon_ring_write(rdev, 0); |
1426 | 1426 | ||
1427 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
1427 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
1428 | radeon_ring_write(rdev, (CB_COLOR0_INFO - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1428 | radeon_ring_write(rdev, (CB_COLOR0_INFO - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1429 | radeon_ring_write(rdev, cb_color_info); |
1429 | radeon_ring_write(rdev, cb_color_info); |
1430 | 1430 | ||
1431 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
1431 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
1432 | radeon_ring_write(rdev, (CB_COLOR0_TILE - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1432 | radeon_ring_write(rdev, (CB_COLOR0_TILE - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1433 | radeon_ring_write(rdev, 0); |
1433 | radeon_ring_write(rdev, 0); |
1434 | 1434 | ||
1435 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
1435 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
1436 | radeon_ring_write(rdev, (CB_COLOR0_FRAG - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1436 | radeon_ring_write(rdev, (CB_COLOR0_FRAG - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1437 | radeon_ring_write(rdev, 0); |
1437 | radeon_ring_write(rdev, 0); |
1438 | 1438 | ||
1439 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
1439 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
1440 | radeon_ring_write(rdev, (CB_COLOR0_MASK - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1440 | radeon_ring_write(rdev, (CB_COLOR0_MASK - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1441 | radeon_ring_write(rdev, 0); |
1441 | radeon_ring_write(rdev, 0); |
1442 | } |
1442 | } |
1443 | 1443 | ||
1444 | 1444 | ||
1445 | /* emits 5dw */ |
1445 | /* emits 5dw */ |
1446 | static void |
1446 | static void |
1447 | cp_set_surface_sync(struct radeon_device *rdev, |
1447 | cp_set_surface_sync(struct radeon_device *rdev, |
1448 | u32 sync_type, u32 size, |
1448 | u32 sync_type, u32 size, |
1449 | u64 mc_addr) |
1449 | u64 mc_addr) |
1450 | { |
1450 | { |
1451 | u32 cp_coher_size; |
1451 | u32 cp_coher_size; |
1452 | 1452 | ||
1453 | if (size == 0xffffffff) |
1453 | if (size == 0xffffffff) |
1454 | cp_coher_size = 0xffffffff; |
1454 | cp_coher_size = 0xffffffff; |
1455 | else |
1455 | else |
1456 | cp_coher_size = ((size + 255) >> 8); |
1456 | cp_coher_size = ((size + 255) >> 8); |
1457 | 1457 | ||
1458 | radeon_ring_write(rdev, PACKET3(PACKET3_SURFACE_SYNC, 3)); |
1458 | radeon_ring_write(rdev, PACKET3(PACKET3_SURFACE_SYNC, 3)); |
1459 | radeon_ring_write(rdev, sync_type); |
1459 | radeon_ring_write(rdev, sync_type); |
1460 | radeon_ring_write(rdev, cp_coher_size); |
1460 | radeon_ring_write(rdev, cp_coher_size); |
1461 | radeon_ring_write(rdev, mc_addr >> 8); |
1461 | radeon_ring_write(rdev, mc_addr >> 8); |
1462 | radeon_ring_write(rdev, 10); /* poll interval */ |
1462 | radeon_ring_write(rdev, 10); /* poll interval */ |
1463 | } |
1463 | } |
1464 | 1464 | ||
1465 | /* emits 14 */ |
1465 | /* emits 14 */ |
1466 | static void |
1466 | static void |
1467 | set_default_state(struct radeon_device *rdev, |
1467 | set_default_state(struct radeon_device *rdev, |
1468 | u64 state_gpu_addr, u32 state_len) |
1468 | u64 state_gpu_addr, u32 state_len) |
1469 | { |
1469 | { |
1470 | u32 sq_config, sq_gpr_resource_mgmt_1, sq_gpr_resource_mgmt_2; |
1470 | u32 sq_config, sq_gpr_resource_mgmt_1, sq_gpr_resource_mgmt_2; |
1471 | u32 sq_thread_resource_mgmt, sq_stack_resource_mgmt_1, sq_stack_resource_mgmt_2; |
1471 | u32 sq_thread_resource_mgmt, sq_stack_resource_mgmt_1, sq_stack_resource_mgmt_2; |
1472 | int num_ps_gprs, num_vs_gprs, num_temp_gprs, num_gs_gprs, num_es_gprs; |
1472 | int num_ps_gprs, num_vs_gprs, num_temp_gprs, num_gs_gprs, num_es_gprs; |
1473 | int num_ps_threads, num_vs_threads, num_gs_threads, num_es_threads; |
1473 | int num_ps_threads, num_vs_threads, num_gs_threads, num_es_threads; |
1474 | int num_ps_stack_entries, num_vs_stack_entries, num_gs_stack_entries, num_es_stack_entries; |
1474 | int num_ps_stack_entries, num_vs_stack_entries, num_gs_stack_entries, num_es_stack_entries; |
1475 | u64 gpu_addr; |
1475 | u64 gpu_addr; |
1476 | int dwords; |
1476 | int dwords; |
1477 | 1477 | ||
1478 | switch (rdev->family) { |
1478 | switch (rdev->family) { |
1479 | case CHIP_R600: |
1479 | case CHIP_R600: |
1480 | num_ps_gprs = 192; |
1480 | num_ps_gprs = 192; |
1481 | num_vs_gprs = 56; |
1481 | num_vs_gprs = 56; |
1482 | num_temp_gprs = 4; |
1482 | num_temp_gprs = 4; |
1483 | num_gs_gprs = 0; |
1483 | num_gs_gprs = 0; |
1484 | num_es_gprs = 0; |
1484 | num_es_gprs = 0; |
1485 | num_ps_threads = 136; |
1485 | num_ps_threads = 136; |
1486 | num_vs_threads = 48; |
1486 | num_vs_threads = 48; |
1487 | num_gs_threads = 4; |
1487 | num_gs_threads = 4; |
1488 | num_es_threads = 4; |
1488 | num_es_threads = 4; |
1489 | num_ps_stack_entries = 128; |
1489 | num_ps_stack_entries = 128; |
1490 | num_vs_stack_entries = 128; |
1490 | num_vs_stack_entries = 128; |
1491 | num_gs_stack_entries = 0; |
1491 | num_gs_stack_entries = 0; |
1492 | num_es_stack_entries = 0; |
1492 | num_es_stack_entries = 0; |
1493 | break; |
1493 | break; |
1494 | case CHIP_RV630: |
1494 | case CHIP_RV630: |
1495 | case CHIP_RV635: |
1495 | case CHIP_RV635: |
1496 | num_ps_gprs = 84; |
1496 | num_ps_gprs = 84; |
1497 | num_vs_gprs = 36; |
1497 | num_vs_gprs = 36; |
1498 | num_temp_gprs = 4; |
1498 | num_temp_gprs = 4; |
1499 | num_gs_gprs = 0; |
1499 | num_gs_gprs = 0; |
1500 | num_es_gprs = 0; |
1500 | num_es_gprs = 0; |
1501 | num_ps_threads = 144; |
1501 | num_ps_threads = 144; |
1502 | num_vs_threads = 40; |
1502 | num_vs_threads = 40; |
1503 | num_gs_threads = 4; |
1503 | num_gs_threads = 4; |
1504 | num_es_threads = 4; |
1504 | num_es_threads = 4; |
1505 | num_ps_stack_entries = 40; |
1505 | num_ps_stack_entries = 40; |
1506 | num_vs_stack_entries = 40; |
1506 | num_vs_stack_entries = 40; |
1507 | num_gs_stack_entries = 32; |
1507 | num_gs_stack_entries = 32; |
1508 | num_es_stack_entries = 16; |
1508 | num_es_stack_entries = 16; |
1509 | break; |
1509 | break; |
1510 | case CHIP_RV610: |
1510 | case CHIP_RV610: |
1511 | case CHIP_RV620: |
1511 | case CHIP_RV620: |
1512 | case CHIP_RS780: |
1512 | case CHIP_RS780: |
1513 | case CHIP_RS880: |
1513 | case CHIP_RS880: |
1514 | default: |
1514 | default: |
1515 | num_ps_gprs = 84; |
1515 | num_ps_gprs = 84; |
1516 | num_vs_gprs = 36; |
1516 | num_vs_gprs = 36; |
1517 | num_temp_gprs = 4; |
1517 | num_temp_gprs = 4; |
1518 | num_gs_gprs = 0; |
1518 | num_gs_gprs = 0; |
1519 | num_es_gprs = 0; |
1519 | num_es_gprs = 0; |
1520 | num_ps_threads = 136; |
1520 | num_ps_threads = 136; |
1521 | num_vs_threads = 48; |
1521 | num_vs_threads = 48; |
1522 | num_gs_threads = 4; |
1522 | num_gs_threads = 4; |
1523 | num_es_threads = 4; |
1523 | num_es_threads = 4; |
1524 | num_ps_stack_entries = 40; |
1524 | num_ps_stack_entries = 40; |
1525 | num_vs_stack_entries = 40; |
1525 | num_vs_stack_entries = 40; |
1526 | num_gs_stack_entries = 32; |
1526 | num_gs_stack_entries = 32; |
1527 | num_es_stack_entries = 16; |
1527 | num_es_stack_entries = 16; |
1528 | break; |
1528 | break; |
1529 | case CHIP_RV670: |
1529 | case CHIP_RV670: |
1530 | num_ps_gprs = 144; |
1530 | num_ps_gprs = 144; |
1531 | num_vs_gprs = 40; |
1531 | num_vs_gprs = 40; |
1532 | num_temp_gprs = 4; |
1532 | num_temp_gprs = 4; |
1533 | num_gs_gprs = 0; |
1533 | num_gs_gprs = 0; |
1534 | num_es_gprs = 0; |
1534 | num_es_gprs = 0; |
1535 | num_ps_threads = 136; |
1535 | num_ps_threads = 136; |
1536 | num_vs_threads = 48; |
1536 | num_vs_threads = 48; |
1537 | num_gs_threads = 4; |
1537 | num_gs_threads = 4; |
1538 | num_es_threads = 4; |
1538 | num_es_threads = 4; |
1539 | num_ps_stack_entries = 40; |
1539 | num_ps_stack_entries = 40; |
1540 | num_vs_stack_entries = 40; |
1540 | num_vs_stack_entries = 40; |
1541 | num_gs_stack_entries = 32; |
1541 | num_gs_stack_entries = 32; |
1542 | num_es_stack_entries = 16; |
1542 | num_es_stack_entries = 16; |
1543 | break; |
1543 | break; |
1544 | case CHIP_RV770: |
1544 | case CHIP_RV770: |
1545 | num_ps_gprs = 192; |
1545 | num_ps_gprs = 192; |
1546 | num_vs_gprs = 56; |
1546 | num_vs_gprs = 56; |
1547 | num_temp_gprs = 4; |
1547 | num_temp_gprs = 4; |
1548 | num_gs_gprs = 0; |
1548 | num_gs_gprs = 0; |
1549 | num_es_gprs = 0; |
1549 | num_es_gprs = 0; |
1550 | num_ps_threads = 188; |
1550 | num_ps_threads = 188; |
1551 | num_vs_threads = 60; |
1551 | num_vs_threads = 60; |
1552 | num_gs_threads = 0; |
1552 | num_gs_threads = 0; |
1553 | num_es_threads = 0; |
1553 | num_es_threads = 0; |
1554 | num_ps_stack_entries = 256; |
1554 | num_ps_stack_entries = 256; |
1555 | num_vs_stack_entries = 256; |
1555 | num_vs_stack_entries = 256; |
1556 | num_gs_stack_entries = 0; |
1556 | num_gs_stack_entries = 0; |
1557 | num_es_stack_entries = 0; |
1557 | num_es_stack_entries = 0; |
1558 | break; |
1558 | break; |
1559 | case CHIP_RV730: |
1559 | case CHIP_RV730: |
1560 | case CHIP_RV740: |
1560 | case CHIP_RV740: |
1561 | num_ps_gprs = 84; |
1561 | num_ps_gprs = 84; |
1562 | num_vs_gprs = 36; |
1562 | num_vs_gprs = 36; |
1563 | num_temp_gprs = 4; |
1563 | num_temp_gprs = 4; |
1564 | num_gs_gprs = 0; |
1564 | num_gs_gprs = 0; |
1565 | num_es_gprs = 0; |
1565 | num_es_gprs = 0; |
1566 | num_ps_threads = 188; |
1566 | num_ps_threads = 188; |
1567 | num_vs_threads = 60; |
1567 | num_vs_threads = 60; |
1568 | num_gs_threads = 0; |
1568 | num_gs_threads = 0; |
1569 | num_es_threads = 0; |
1569 | num_es_threads = 0; |
1570 | num_ps_stack_entries = 128; |
1570 | num_ps_stack_entries = 128; |
1571 | num_vs_stack_entries = 128; |
1571 | num_vs_stack_entries = 128; |
1572 | num_gs_stack_entries = 0; |
1572 | num_gs_stack_entries = 0; |
1573 | num_es_stack_entries = 0; |
1573 | num_es_stack_entries = 0; |
1574 | break; |
1574 | break; |
1575 | case CHIP_RV710: |
1575 | case CHIP_RV710: |
1576 | num_ps_gprs = 192; |
1576 | num_ps_gprs = 192; |
1577 | num_vs_gprs = 56; |
1577 | num_vs_gprs = 56; |
1578 | num_temp_gprs = 4; |
1578 | num_temp_gprs = 4; |
1579 | num_gs_gprs = 0; |
1579 | num_gs_gprs = 0; |
1580 | num_es_gprs = 0; |
1580 | num_es_gprs = 0; |
1581 | num_ps_threads = 144; |
1581 | num_ps_threads = 144; |
1582 | num_vs_threads = 48; |
1582 | num_vs_threads = 48; |
1583 | num_gs_threads = 0; |
1583 | num_gs_threads = 0; |
1584 | num_es_threads = 0; |
1584 | num_es_threads = 0; |
1585 | num_ps_stack_entries = 128; |
1585 | num_ps_stack_entries = 128; |
1586 | num_vs_stack_entries = 128; |
1586 | num_vs_stack_entries = 128; |
1587 | num_gs_stack_entries = 0; |
1587 | num_gs_stack_entries = 0; |
1588 | num_es_stack_entries = 0; |
1588 | num_es_stack_entries = 0; |
1589 | break; |
1589 | break; |
1590 | } |
1590 | } |
1591 | 1591 | ||
1592 | if ((rdev->family == CHIP_RV610) || |
1592 | if ((rdev->family == CHIP_RV610) || |
1593 | (rdev->family == CHIP_RV620) || |
1593 | (rdev->family == CHIP_RV620) || |
1594 | (rdev->family == CHIP_RS780) || |
1594 | (rdev->family == CHIP_RS780) || |
1595 | (rdev->family == CHIP_RS880) || |
1595 | (rdev->family == CHIP_RS880) || |
1596 | (rdev->family == CHIP_RV710)) |
1596 | (rdev->family == CHIP_RV710)) |
1597 | sq_config = 0; |
1597 | sq_config = 0; |
1598 | else |
1598 | else |
1599 | sq_config = VC_ENABLE; |
1599 | sq_config = VC_ENABLE; |
1600 | 1600 | ||
1601 | sq_config |= (DX9_CONSTS | |
1601 | sq_config |= (DX9_CONSTS | |
1602 | ALU_INST_PREFER_VECTOR | |
1602 | ALU_INST_PREFER_VECTOR | |
1603 | PS_PRIO(0) | |
1603 | PS_PRIO(0) | |
1604 | VS_PRIO(1) | |
1604 | VS_PRIO(1) | |
1605 | GS_PRIO(2) | |
1605 | GS_PRIO(2) | |
1606 | ES_PRIO(3)); |
1606 | ES_PRIO(3)); |
1607 | 1607 | ||
1608 | sq_gpr_resource_mgmt_1 = (NUM_PS_GPRS(num_ps_gprs) | |
1608 | sq_gpr_resource_mgmt_1 = (NUM_PS_GPRS(num_ps_gprs) | |
1609 | NUM_VS_GPRS(num_vs_gprs) | |
1609 | NUM_VS_GPRS(num_vs_gprs) | |
1610 | NUM_CLAUSE_TEMP_GPRS(num_temp_gprs)); |
1610 | NUM_CLAUSE_TEMP_GPRS(num_temp_gprs)); |
1611 | sq_gpr_resource_mgmt_2 = (NUM_GS_GPRS(num_gs_gprs) | |
1611 | sq_gpr_resource_mgmt_2 = (NUM_GS_GPRS(num_gs_gprs) | |
1612 | NUM_ES_GPRS(num_es_gprs)); |
1612 | NUM_ES_GPRS(num_es_gprs)); |
1613 | sq_thread_resource_mgmt = (NUM_PS_THREADS(num_ps_threads) | |
1613 | sq_thread_resource_mgmt = (NUM_PS_THREADS(num_ps_threads) | |
1614 | NUM_VS_THREADS(num_vs_threads) | |
1614 | NUM_VS_THREADS(num_vs_threads) | |
1615 | NUM_GS_THREADS(num_gs_threads) | |
1615 | NUM_GS_THREADS(num_gs_threads) | |
1616 | NUM_ES_THREADS(num_es_threads)); |
1616 | NUM_ES_THREADS(num_es_threads)); |
1617 | sq_stack_resource_mgmt_1 = (NUM_PS_STACK_ENTRIES(num_ps_stack_entries) | |
1617 | sq_stack_resource_mgmt_1 = (NUM_PS_STACK_ENTRIES(num_ps_stack_entries) | |
1618 | NUM_VS_STACK_ENTRIES(num_vs_stack_entries)); |
1618 | NUM_VS_STACK_ENTRIES(num_vs_stack_entries)); |
1619 | sq_stack_resource_mgmt_2 = (NUM_GS_STACK_ENTRIES(num_gs_stack_entries) | |
1619 | sq_stack_resource_mgmt_2 = (NUM_GS_STACK_ENTRIES(num_gs_stack_entries) | |
1620 | NUM_ES_STACK_ENTRIES(num_es_stack_entries)); |
1620 | NUM_ES_STACK_ENTRIES(num_es_stack_entries)); |
1621 | 1621 | ||
1622 | /* emit an IB pointing at default state */ |
1622 | /* emit an IB pointing at default state */ |
1623 | dwords = (state_len + 0xf) & ~0xf; |
1623 | dwords = (state_len + 0xf) & ~0xf; |
1624 | gpu_addr = state_gpu_addr; |
1624 | gpu_addr = state_gpu_addr; |
1625 | 1625 | ||
1626 | radeon_ring_write(rdev, PACKET3(PACKET3_INDIRECT_BUFFER, 2)); |
1626 | radeon_ring_write(rdev, PACKET3(PACKET3_INDIRECT_BUFFER, 2)); |
1627 | radeon_ring_write(rdev, gpu_addr & 0xFFFFFFFC); |
1627 | radeon_ring_write(rdev, gpu_addr & 0xFFFFFFFC); |
1628 | radeon_ring_write(rdev, upper_32_bits(gpu_addr) & 0xFF); |
1628 | radeon_ring_write(rdev, upper_32_bits(gpu_addr) & 0xFF); |
1629 | radeon_ring_write(rdev, dwords); |
1629 | radeon_ring_write(rdev, dwords); |
1630 | 1630 | ||
1631 | radeon_ring_write(rdev, PACKET3(PACKET3_EVENT_WRITE, 0)); |
1631 | radeon_ring_write(rdev, PACKET3(PACKET3_EVENT_WRITE, 0)); |
1632 | radeon_ring_write(rdev, CACHE_FLUSH_AND_INV_EVENT); |
1632 | radeon_ring_write(rdev, CACHE_FLUSH_AND_INV_EVENT); |
1633 | /* SQ config */ |
1633 | /* SQ config */ |
1634 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONFIG_REG, 6)); |
1634 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONFIG_REG, 6)); |
1635 | radeon_ring_write(rdev, (SQ_CONFIG - PACKET3_SET_CONFIG_REG_OFFSET) >> 2); |
1635 | radeon_ring_write(rdev, (SQ_CONFIG - PACKET3_SET_CONFIG_REG_OFFSET) >> 2); |
1636 | radeon_ring_write(rdev, sq_config); |
1636 | radeon_ring_write(rdev, sq_config); |
1637 | radeon_ring_write(rdev, sq_gpr_resource_mgmt_1); |
1637 | radeon_ring_write(rdev, sq_gpr_resource_mgmt_1); |
1638 | radeon_ring_write(rdev, sq_gpr_resource_mgmt_2); |
1638 | radeon_ring_write(rdev, sq_gpr_resource_mgmt_2); |
1639 | radeon_ring_write(rdev, sq_thread_resource_mgmt); |
1639 | radeon_ring_write(rdev, sq_thread_resource_mgmt); |
1640 | radeon_ring_write(rdev, sq_stack_resource_mgmt_1); |
1640 | radeon_ring_write(rdev, sq_stack_resource_mgmt_1); |
1641 | radeon_ring_write(rdev, sq_stack_resource_mgmt_2); |
1641 | radeon_ring_write(rdev, sq_stack_resource_mgmt_2); |
1642 | } |
1642 | } |
1643 | 1643 | ||
1644 | /* emits 12 */ |
1644 | /* emits 12 */ |
1645 | static void |
1645 | static void |
1646 | set_scissors(struct radeon_device *rdev, int x1, int y1, |
1646 | set_scissors(struct radeon_device *rdev, int x1, int y1, |
1647 | int x2, int y2) |
1647 | int x2, int y2) |
1648 | { |
1648 | { |
1649 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 2)); |
1649 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 2)); |
1650 | radeon_ring_write(rdev, (PA_SC_SCREEN_SCISSOR_TL - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1650 | radeon_ring_write(rdev, (PA_SC_SCREEN_SCISSOR_TL - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1651 | radeon_ring_write(rdev, (x1 << 0) | (y1 << 16)); |
1651 | radeon_ring_write(rdev, (x1 << 0) | (y1 << 16)); |
1652 | radeon_ring_write(rdev, (x2 << 0) | (y2 << 16)); |
1652 | radeon_ring_write(rdev, (x2 << 0) | (y2 << 16)); |
1653 | 1653 | ||
1654 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 2)); |
1654 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 2)); |
1655 | radeon_ring_write(rdev, (PA_SC_GENERIC_SCISSOR_TL - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1655 | radeon_ring_write(rdev, (PA_SC_GENERIC_SCISSOR_TL - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1656 | radeon_ring_write(rdev, (x1 << 0) | (y1 << 16) | (1 << 31)); |
1656 | radeon_ring_write(rdev, (x1 << 0) | (y1 << 16) | (1 << 31)); |
1657 | radeon_ring_write(rdev, (x2 << 0) | (y2 << 16)); |
1657 | radeon_ring_write(rdev, (x2 << 0) | (y2 << 16)); |
1658 | 1658 | ||
1659 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 2)); |
1659 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 2)); |
1660 | radeon_ring_write(rdev, (PA_SC_WINDOW_SCISSOR_TL - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1660 | radeon_ring_write(rdev, (PA_SC_WINDOW_SCISSOR_TL - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
1661 | radeon_ring_write(rdev, (x1 << 0) | (y1 << 16) | (1 << 31)); |
1661 | radeon_ring_write(rdev, (x1 << 0) | (y1 << 16) | (1 << 31)); |
1662 | radeon_ring_write(rdev, (x2 << 0) | (y2 << 16)); |
1662 | radeon_ring_write(rdev, (x2 << 0) | (y2 << 16)); |
1663 | } |
1663 | } |
1664 | 1664 | ||
1665 | static void |
1665 | static void |
1666 | draw_auto(struct radeon_device *rdev) |
1666 | draw_auto(struct radeon_device *rdev) |
1667 | { |
1667 | { |
1668 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONFIG_REG, 1)); |
1668 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONFIG_REG, 1)); |
1669 | radeon_ring_write(rdev, (VGT_PRIMITIVE_TYPE - PACKET3_SET_CONFIG_REG_OFFSET) >> 2); |
1669 | radeon_ring_write(rdev, (VGT_PRIMITIVE_TYPE - PACKET3_SET_CONFIG_REG_OFFSET) >> 2); |
1670 | radeon_ring_write(rdev, DI_PT_RECTLIST); |
1670 | radeon_ring_write(rdev, DI_PT_RECTLIST); |
1671 | 1671 | ||
1672 | radeon_ring_write(rdev, PACKET3(PACKET3_INDEX_TYPE, 0)); |
1672 | radeon_ring_write(rdev, PACKET3(PACKET3_INDEX_TYPE, 0)); |
1673 | radeon_ring_write(rdev, DI_INDEX_SIZE_16_BIT); |
1673 | radeon_ring_write(rdev, DI_INDEX_SIZE_16_BIT); |
1674 | 1674 | ||
1675 | radeon_ring_write(rdev, PACKET3(PACKET3_NUM_INSTANCES, 0)); |
1675 | radeon_ring_write(rdev, PACKET3(PACKET3_NUM_INSTANCES, 0)); |
1676 | radeon_ring_write(rdev, 1); |
1676 | radeon_ring_write(rdev, 1); |
1677 | 1677 | ||
1678 | radeon_ring_write(rdev, PACKET3(PACKET3_DRAW_INDEX_AUTO, 1)); |
1678 | radeon_ring_write(rdev, PACKET3(PACKET3_DRAW_INDEX_AUTO, 1)); |
1679 | radeon_ring_write(rdev, 3); |
1679 | radeon_ring_write(rdev, 3); |
1680 | radeon_ring_write(rdev, DI_SRC_SEL_AUTO_INDEX); |
1680 | radeon_ring_write(rdev, DI_SRC_SEL_AUTO_INDEX); |
1681 | 1681 | ||
1682 | } |
1682 | } |
1683 | 1683 | ||
1684 | /* ALU clause insts */ |
1684 | /* ALU clause insts */ |
1685 | #define SRC0_SEL(x) (x) |
1685 | #define SRC0_SEL(x) (x) |
1686 | #define SRC1_SEL(x) (x) |
1686 | #define SRC1_SEL(x) (x) |
1687 | #define SRC2_SEL(x) (x) |
1687 | #define SRC2_SEL(x) (x) |
1688 | /* src[0-2]_sel */ |
1688 | /* src[0-2]_sel */ |
1689 | /* 0-127 GPR */ |
1689 | /* 0-127 GPR */ |
1690 | /* 128-159 kcache constants bank 0 */ |
1690 | /* 128-159 kcache constants bank 0 */ |
1691 | /* 160-191 kcache constants bank 1 */ |
1691 | /* 160-191 kcache constants bank 1 */ |
1692 | /* 248-255 special SQ_ALU_SRC_* (0, 1, etc.) */ |
1692 | /* 248-255 special SQ_ALU_SRC_* (0, 1, etc.) */ |
1693 | 1693 | ||
1694 | #define SRC0_REL(x) (x) |
1694 | #define SRC0_REL(x) (x) |
1695 | #define SRC1_REL(x) (x) |
1695 | #define SRC1_REL(x) (x) |
1696 | #define SRC2_REL(x) (x) |
1696 | #define SRC2_REL(x) (x) |
1697 | /* elem */ |
1697 | /* elem */ |
1698 | #define SRC0_ELEM(x) (x) |
1698 | #define SRC0_ELEM(x) (x) |
1699 | #define SRC1_ELEM(x) (x) |
1699 | #define SRC1_ELEM(x) (x) |
1700 | #define SRC2_ELEM(x) (x) |
1700 | #define SRC2_ELEM(x) (x) |
1701 | #define ELEM_X 0 |
1701 | #define ELEM_X 0 |
1702 | #define ELEM_Y 1 |
1702 | #define ELEM_Y 1 |
1703 | #define ELEM_Z 2 |
1703 | #define ELEM_Z 2 |
1704 | #define ELEM_W 3 |
1704 | #define ELEM_W 3 |
1705 | /* neg */ |
1705 | /* neg */ |
1706 | #define SRC0_NEG(x) (x) |
1706 | #define SRC0_NEG(x) (x) |
1707 | #define SRC1_NEG(x) (x) |
1707 | #define SRC1_NEG(x) (x) |
1708 | #define SRC2_NEG(x) (x) |
1708 | #define SRC2_NEG(x) (x) |
1709 | /* im */ |
1709 | /* im */ |
1710 | #define INDEX_MODE(x) (x) /* SQ_INDEX_* */ |
1710 | #define INDEX_MODE(x) (x) /* SQ_INDEX_* */ |
1711 | /* ps */ |
1711 | /* ps */ |
1712 | #define PRED_SEL(x) (x) /* SQ_PRED_SEL_* */ |
1712 | #define PRED_SEL(x) (x) /* SQ_PRED_SEL_* */ |
1713 | /* last */ |
1713 | /* last */ |
1714 | #define LAST(x) (x) |
1714 | #define LAST(x) (x) |
1715 | /* abs */ |
1715 | /* abs */ |
1716 | #define SRC0_ABS(x) (x) |
1716 | #define SRC0_ABS(x) (x) |
1717 | #define SRC1_ABS(x) (x) |
1717 | #define SRC1_ABS(x) (x) |
1718 | /* uem */ |
1718 | /* uem */ |
1719 | #define UPDATE_EXECUTE_MASK(x) (x) |
1719 | #define UPDATE_EXECUTE_MASK(x) (x) |
1720 | /* up */ |
1720 | /* up */ |
1721 | #define UPDATE_PRED(x) (x) |
1721 | #define UPDATE_PRED(x) (x) |
1722 | /* wm */ |
1722 | /* wm */ |
1723 | #define WRITE_MASK(x) (x) |
1723 | #define WRITE_MASK(x) (x) |
1724 | /* fm */ |
1724 | /* fm */ |
1725 | #define FOG_MERGE(x) (x) |
1725 | #define FOG_MERGE(x) (x) |
1726 | /* omod */ |
1726 | /* omod */ |
1727 | #define OMOD(x) (x) /* SQ_ALU_OMOD_* */ |
1727 | #define OMOD(x) (x) /* SQ_ALU_OMOD_* */ |
1728 | /* alu inst */ |
1728 | /* alu inst */ |
1729 | #define ALU_INST(x) (x) /* SQ_ALU_INST_* */ |
1729 | #define ALU_INST(x) (x) /* SQ_ALU_INST_* */ |
1730 | /*bs */ |
1730 | /*bs */ |
1731 | #define BANK_SWIZZLE(x) (x) /* SQ_ALU_VEC_* */ |
1731 | #define BANK_SWIZZLE(x) (x) /* SQ_ALU_VEC_* */ |
1732 | #define DST_GPR(x) (x) |
1732 | #define DST_GPR(x) (x) |
1733 | #define DST_REL(x) (x) |
1733 | #define DST_REL(x) (x) |
1734 | #define DST_ELEM(x) (x) |
1734 | #define DST_ELEM(x) (x) |
1735 | #define CLAMP(x) (x) |
1735 | #define CLAMP(x) (x) |
1736 | 1736 | ||
1737 | #define ALU_DWORD0(src0_sel, s0r, s0e, s0n, src1_sel, s1r, s1e, s1n, im, ps, last) \ |
1737 | #define ALU_DWORD0(src0_sel, s0r, s0e, s0n, src1_sel, s1r, s1e, s1n, im, ps, last) \ |
1738 | (((src0_sel) << 0) | ((s0r) << 9) | ((s0e) << 10) | ((s0n) << 12) | \ |
1738 | (((src0_sel) << 0) | ((s0r) << 9) | ((s0e) << 10) | ((s0n) << 12) | \ |
1739 | ((src1_sel) << 13) | ((s1r) << 22) | ((s1e) << 23) | ((s1n) << 25) | \ |
1739 | ((src1_sel) << 13) | ((s1r) << 22) | ((s1e) << 23) | ((s1n) << 25) | \ |
1740 | ((im) << 26) | ((ps) << 29) | ((last) << 31)) |
1740 | ((im) << 26) | ((ps) << 29) | ((last) << 31)) |
1741 | 1741 | ||
1742 | /* R7xx has alu_inst at a different slot, and no fog merge any more (no fix function fog any more) */ |
1742 | /* R7xx has alu_inst at a different slot, and no fog merge any more (no fix function fog any more) */ |
1743 | #define R6xx_ALU_DWORD1_OP2(s0a, s1a, uem, up, wm, fm, omod, alu_inst, bs, dst_gpr, dr, de, clamp) \ |
1743 | #define R6xx_ALU_DWORD1_OP2(s0a, s1a, uem, up, wm, fm, omod, alu_inst, bs, dst_gpr, dr, de, clamp) \ |
1744 | (((s0a) << 0) | ((s1a) << 1) | ((uem) << 2) | ((up) << 3) | ((wm) << 4) | \ |
1744 | (((s0a) << 0) | ((s1a) << 1) | ((uem) << 2) | ((up) << 3) | ((wm) << 4) | \ |
1745 | ((fm) << 5) | ((omod) << 6) | ((alu_inst) << 8) | ((bs) << 18) | ((dst_gpr) << 21) | \ |
1745 | ((fm) << 5) | ((omod) << 6) | ((alu_inst) << 8) | ((bs) << 18) | ((dst_gpr) << 21) | \ |
1746 | ((dr) << 28) | ((de) << 29) | ((clamp) << 31)) |
1746 | ((dr) << 28) | ((de) << 29) | ((clamp) << 31)) |
1747 | 1747 | ||
1748 | #define R7xx_ALU_DWORD1_OP2(s0a, s1a, uem, up, wm, omod, alu_inst, bs, dst_gpr, dr, de, clamp) \ |
1748 | #define R7xx_ALU_DWORD1_OP2(s0a, s1a, uem, up, wm, omod, alu_inst, bs, dst_gpr, dr, de, clamp) \ |
1749 | (((s0a) << 0) | ((s1a) << 1) | ((uem) << 2) | ((up) << 3) | ((wm) << 4) | \ |
1749 | (((s0a) << 0) | ((s1a) << 1) | ((uem) << 2) | ((up) << 3) | ((wm) << 4) | \ |
1750 | ((omod) << 5) | ((alu_inst) << 7) | ((bs) << 18) | ((dst_gpr) << 21) | \ |
1750 | ((omod) << 5) | ((alu_inst) << 7) | ((bs) << 18) | ((dst_gpr) << 21) | \ |
1751 | ((dr) << 28) | ((de) << 29) | ((clamp) << 31)) |
1751 | ((dr) << 28) | ((de) << 29) | ((clamp) << 31)) |
1752 | 1752 | ||
1753 | /* This is a general chipset macro, but due to selection by chipid typically not usable in static arrays */ |
1753 | /* This is a general chipset macro, but due to selection by chipid typically not usable in static arrays */ |
1754 | /* Fog is NOT USED on R7xx, even if specified. */ |
1754 | /* Fog is NOT USED on R7xx, even if specified. */ |
1755 | #define ALU_DWORD1_OP2(chipid, s0a, s1a, uem, up, wm, fm, omod, alu_inst, bs, dst_gpr, dr, de, clamp) \ |
1755 | #define ALU_DWORD1_OP2(chipid, s0a, s1a, uem, up, wm, fm, omod, alu_inst, bs, dst_gpr, dr, de, clamp) \ |
1756 | ((chipid) < CHIP_RV770 ? \ |
1756 | ((chipid) < CHIP_RV770 ? \ |
1757 | R6xx_ALU_DWORD1_OP2(s0a, s1a, uem, up, wm, fm, omod, alu_inst, bs, dst_gpr, dr, de, clamp) : \ |
1757 | R6xx_ALU_DWORD1_OP2(s0a, s1a, uem, up, wm, fm, omod, alu_inst, bs, dst_gpr, dr, de, clamp) : \ |
1758 | R7xx_ALU_DWORD1_OP2(s0a, s1a, uem, up, wm, omod, alu_inst, bs, dst_gpr, dr, de, clamp)) |
1758 | R7xx_ALU_DWORD1_OP2(s0a, s1a, uem, up, wm, omod, alu_inst, bs, dst_gpr, dr, de, clamp)) |
1759 | 1759 | ||
1760 | #define ALU_DWORD1_OP3(src2_sel, s2r, s2e, s2n, alu_inst, bs, dst_gpr, dr, de, clamp) \ |
1760 | #define ALU_DWORD1_OP3(src2_sel, s2r, s2e, s2n, alu_inst, bs, dst_gpr, dr, de, clamp) \ |
1761 | (((src2_sel) << 0) | ((s2r) << 9) | ((s2e) << 10) | ((s2n) << 12) | \ |
1761 | (((src2_sel) << 0) | ((s2r) << 9) | ((s2e) << 10) | ((s2n) << 12) | \ |
1762 | ((alu_inst) << 13) | ((bs) << 18) | ((dst_gpr) << 21) | ((dr) << 28) | \ |
1762 | ((alu_inst) << 13) | ((bs) << 18) | ((dst_gpr) << 21) | ((dr) << 28) | \ |
1763 | ((de) << 29) | ((clamp) << 31)) |
1763 | ((de) << 29) | ((clamp) << 31)) |
1764 | 1764 | ||
1765 | /* CF insts */ |
1765 | /* CF insts */ |
1766 | /* addr */ |
1766 | /* addr */ |
1767 | #define ADDR(x) (x) |
1767 | #define ADDR(x) (x) |
1768 | /* pc */ |
1768 | /* pc */ |
1769 | #define POP_COUNT(x) (x) |
1769 | #define POP_COUNT(x) (x) |
1770 | /* const */ |
1770 | /* const */ |
1771 | #define CF_CONST(x) (x) |
1771 | #define CF_CONST(x) (x) |
1772 | /* cond */ |
1772 | /* cond */ |
1773 | #define COND(x) (x) /* SQ_COND_* */ |
1773 | #define COND(x) (x) /* SQ_COND_* */ |
1774 | /* count */ |
1774 | /* count */ |
1775 | #define I_COUNT(x) ((x) ? ((x) - 1) : 0) |
1775 | #define I_COUNT(x) ((x) ? ((x) - 1) : 0) |
1776 | /*r7xx */ |
1776 | /*r7xx */ |
1777 | #define COUNT_3(x) (x) |
1777 | #define COUNT_3(x) (x) |
1778 | /* call count */ |
1778 | /* call count */ |
1779 | #define CALL_COUNT(x) (x) |
1779 | #define CALL_COUNT(x) (x) |
1780 | /* eop */ |
1780 | /* eop */ |
1781 | #define END_OF_PROGRAM(x) (x) |
1781 | #define END_OF_PROGRAM(x) (x) |
1782 | /* vpm */ |
1782 | /* vpm */ |
1783 | #define VALID_PIXEL_MODE(x) (x) |
1783 | #define VALID_PIXEL_MODE(x) (x) |
1784 | /* cf inst */ |
1784 | /* cf inst */ |
1785 | #define CF_INST(x) (x) /* SQ_CF_INST_* */ |
1785 | #define CF_INST(x) (x) /* SQ_CF_INST_* */ |
1786 | 1786 | ||
1787 | /* wqm */ |
1787 | /* wqm */ |
1788 | #define WHOLE_QUAD_MODE(x) (x) |
1788 | #define WHOLE_QUAD_MODE(x) (x) |
1789 | /* barrier */ |
1789 | /* barrier */ |
1790 | #define BARRIER(x) (x) |
1790 | #define BARRIER(x) (x) |
1791 | /*kb0 */ |
1791 | /*kb0 */ |
1792 | #define KCACHE_BANK0(x) (x) |
1792 | #define KCACHE_BANK0(x) (x) |
1793 | /*kb1 */ |
1793 | /*kb1 */ |
1794 | #define KCACHE_BANK1(x) (x) |
1794 | #define KCACHE_BANK1(x) (x) |
1795 | /* km0/1 */ |
1795 | /* km0/1 */ |
1796 | #define KCACHE_MODE0(x) (x) |
1796 | #define KCACHE_MODE0(x) (x) |
1797 | #define KCACHE_MODE1(x) (x) /* SQ_CF_KCACHE_* */ |
1797 | #define KCACHE_MODE1(x) (x) /* SQ_CF_KCACHE_* */ |
1798 | /* */ |
1798 | /* */ |
1799 | #define KCACHE_ADDR0(x) (x) |
1799 | #define KCACHE_ADDR0(x) (x) |
1800 | #define KCACHE_ADDR1(x) (x) |
1800 | #define KCACHE_ADDR1(x) (x) |
1801 | /* uw */ |
1801 | /* uw */ |
1802 | #define USES_WATERFALL(x) (x) |
1802 | #define USES_WATERFALL(x) (x) |
1803 | 1803 | ||
1804 | #define ARRAY_BASE(x) (x) |
1804 | #define ARRAY_BASE(x) (x) |
1805 | /* export pixel */ |
1805 | /* export pixel */ |
1806 | #define CF_PIXEL_MRT0 0 |
1806 | #define CF_PIXEL_MRT0 0 |
1807 | #define CF_PIXEL_MRT1 1 |
1807 | #define CF_PIXEL_MRT1 1 |
1808 | #define CF_PIXEL_MRT2 2 |
1808 | #define CF_PIXEL_MRT2 2 |
1809 | #define CF_PIXEL_MRT3 3 |
1809 | #define CF_PIXEL_MRT3 3 |
1810 | #define CF_PIXEL_MRT4 4 |
1810 | #define CF_PIXEL_MRT4 4 |
1811 | #define CF_PIXEL_MRT5 5 |
1811 | #define CF_PIXEL_MRT5 5 |
1812 | #define CF_PIXEL_MRT6 6 |
1812 | #define CF_PIXEL_MRT6 6 |
1813 | #define CF_PIXEL_MRT7 7 |
1813 | #define CF_PIXEL_MRT7 7 |
1814 | /* *_FOG: r6xx only */ |
1814 | /* *_FOG: r6xx only */ |
1815 | #define CF_PIXEL_MRT0_FOG 16 |
1815 | #define CF_PIXEL_MRT0_FOG 16 |
1816 | #define CF_PIXEL_MRT1_FOG 17 |
1816 | #define CF_PIXEL_MRT1_FOG 17 |
1817 | #define CF_PIXEL_MRT2_FOG 18 |
1817 | #define CF_PIXEL_MRT2_FOG 18 |
1818 | #define CF_PIXEL_MRT3_FOG 19 |
1818 | #define CF_PIXEL_MRT3_FOG 19 |
1819 | #define CF_PIXEL_MRT4_FOG 20 |
1819 | #define CF_PIXEL_MRT4_FOG 20 |
1820 | #define CF_PIXEL_MRT5_FOG 21 |
1820 | #define CF_PIXEL_MRT5_FOG 21 |
1821 | #define CF_PIXEL_MRT6_FOG 22 |
1821 | #define CF_PIXEL_MRT6_FOG 22 |
1822 | #define CF_PIXEL_MRT7_FOG 23 |
1822 | #define CF_PIXEL_MRT7_FOG 23 |
1823 | #define CF_PIXEL_Z 61 |
1823 | #define CF_PIXEL_Z 61 |
1824 | /* export pos */ |
1824 | /* export pos */ |
1825 | #define CF_POS0 60 |
1825 | #define CF_POS0 60 |
1826 | #define CF_POS1 61 |
1826 | #define CF_POS1 61 |
1827 | #define CF_POS2 62 |
1827 | #define CF_POS2 62 |
1828 | #define CF_POS3 63 |
1828 | #define CF_POS3 63 |
1829 | /* export param */ |
1829 | /* export param */ |
1830 | /* 0...31 */ |
1830 | /* 0...31 */ |
1831 | #define TYPE(x) (x) /* SQ_EXPORT_* */ |
1831 | #define TYPE(x) (x) /* SQ_EXPORT_* */ |
1832 | #if 0 |
1832 | #if 0 |
1833 | /* type export */ |
1833 | /* type export */ |
1834 | #define SQ_EXPORT_PIXEL 0 |
1834 | #define SQ_EXPORT_PIXEL 0 |
1835 | #define SQ_EXPORT_POS 1 |
1835 | #define SQ_EXPORT_POS 1 |
1836 | #define SQ_EXPORT_PARAM 2 |
1836 | #define SQ_EXPORT_PARAM 2 |
1837 | /* reserved 3 */ |
1837 | /* reserved 3 */ |
1838 | /* type mem */ |
1838 | /* type mem */ |
1839 | #define SQ_EXPORT_WRITE 0 |
1839 | #define SQ_EXPORT_WRITE 0 |
1840 | #define SQ_EXPORT_WRITE_IND 1 |
1840 | #define SQ_EXPORT_WRITE_IND 1 |
1841 | #define SQ_EXPORT_WRITE_ACK 2 |
1841 | #define SQ_EXPORT_WRITE_ACK 2 |
1842 | #define SQ_EXPORT_WRITE_IND_ACK 3 |
1842 | #define SQ_EXPORT_WRITE_IND_ACK 3 |
1843 | #endif |
1843 | #endif |
1844 | 1844 | ||
1845 | #define RW_GPR(x) (x) |
1845 | #define RW_GPR(x) (x) |
1846 | #define RW_REL(x) (x) |
1846 | #define RW_REL(x) (x) |
1847 | #define ABSOLUTE 0 |
1847 | #define ABSOLUTE 0 |
1848 | #define RELATIVE 1 |
1848 | #define RELATIVE 1 |
1849 | #define INDEX_GPR(x) (x) |
1849 | #define INDEX_GPR(x) (x) |
1850 | #define ELEM_SIZE(x) (x ? (x - 1) : 0) |
1850 | #define ELEM_SIZE(x) (x ? (x - 1) : 0) |
1851 | #define COMP_MASK(x) (x) |
1851 | #define COMP_MASK(x) (x) |
1852 | #define R6xx_ELEM_LOOP(x) (x) |
1852 | #define R6xx_ELEM_LOOP(x) (x) |
1853 | #define BURST_COUNT(x) (x ? (x - 1) : 0) |
1853 | #define BURST_COUNT(x) (x ? (x - 1) : 0) |
1854 | 1854 | ||
1855 | /* swiz */ |
1855 | /* swiz */ |
1856 | #define SRC_SEL_X(x) (x) /* SQ_SEL_* each */ |
1856 | #define SRC_SEL_X(x) (x) /* SQ_SEL_* each */ |
1857 | #define SRC_SEL_Y(x) (x) |
1857 | #define SRC_SEL_Y(x) (x) |
1858 | #define SRC_SEL_Z(x) (x) |
1858 | #define SRC_SEL_Z(x) (x) |
1859 | #define SRC_SEL_W(x) (x) |
1859 | #define SRC_SEL_W(x) (x) |
1860 | 1860 | ||
1861 | #define CF_DWORD0(addr) (addr) |
1861 | #define CF_DWORD0(addr) (addr) |
1862 | /* R7xx has another entry (COUNT3), but that is only used for adding a bit to count. */ |
1862 | /* R7xx has another entry (COUNT3), but that is only used for adding a bit to count. */ |
1863 | /* We allow one more bit for count in the argument of the macro on R7xx instead. */ |
1863 | /* We allow one more bit for count in the argument of the macro on R7xx instead. */ |
1864 | /* R6xx: [0,7] R7xx: [1,16] */ |
1864 | /* R6xx: [0,7] R7xx: [1,16] */ |
1865 | #define CF_DWORD1(pc, cf_const, cond, count, call_count, eop, vpm, cf_inst, wqm, b) \ |
1865 | #define CF_DWORD1(pc, cf_const, cond, count, call_count, eop, vpm, cf_inst, wqm, b) \ |
1866 | (((pc) << 0) | ((cf_const) << 3) | ((cond) << 8) | (((count) & 7) << 10) | (((count) >> 3) << 19) | \ |
1866 | (((pc) << 0) | ((cf_const) << 3) | ((cond) << 8) | (((count) & 7) << 10) | (((count) >> 3) << 19) | \ |
1867 | ((call_count) << 13) | ((eop) << 21) | ((vpm) << 22) | ((cf_inst) << 23) | ((wqm) << 30) | ((b) << 31)) |
1867 | ((call_count) << 13) | ((eop) << 21) | ((vpm) << 22) | ((cf_inst) << 23) | ((wqm) << 30) | ((b) << 31)) |
1868 | 1868 | ||
1869 | #define CF_ALU_DWORD0(addr, kb0, kb1, km0) (((addr) << 0) | ((kb0) << 22) | ((kb1) << 26) | ((km0) << 30)) |
1869 | #define CF_ALU_DWORD0(addr, kb0, kb1, km0) (((addr) << 0) | ((kb0) << 22) | ((kb1) << 26) | ((km0) << 30)) |
1870 | #define CF_ALU_DWORD1(km1, kcache_addr0, kcache_addr1, count, uw, cf_inst, wqm, b) \ |
1870 | #define CF_ALU_DWORD1(km1, kcache_addr0, kcache_addr1, count, uw, cf_inst, wqm, b) \ |
1871 | (((km1) << 0) | ((kcache_addr0) << 2) | ((kcache_addr1) << 10) | \ |
1871 | (((km1) << 0) | ((kcache_addr0) << 2) | ((kcache_addr1) << 10) | \ |
1872 | ((count) << 18) | ((uw) << 25) | ((cf_inst) << 26) | ((wqm) << 30) | ((b) << 31)) |
1872 | ((count) << 18) | ((uw) << 25) | ((cf_inst) << 26) | ((wqm) << 30) | ((b) << 31)) |
1873 | 1873 | ||
1874 | #define CF_ALLOC_IMP_EXP_DWORD0(array_base, type, rw_gpr, rr, index_gpr, es) \ |
1874 | #define CF_ALLOC_IMP_EXP_DWORD0(array_base, type, rw_gpr, rr, index_gpr, es) \ |
1875 | (((array_base) << 0) | ((type) << 13) | ((rw_gpr) << 15) | ((rr) << 22) | ((index_gpr) << 23) | \ |
1875 | (((array_base) << 0) | ((type) << 13) | ((rw_gpr) << 15) | ((rr) << 22) | ((index_gpr) << 23) | \ |
1876 | ((es) << 30)) |
1876 | ((es) << 30)) |
1877 | /* R7xx apparently doesn't have the ELEM_LOOP entry any more */ |
1877 | /* R7xx apparently doesn't have the ELEM_LOOP entry any more */ |
1878 | /* We still expose it, but ELEM_LOOP is explicitely R6xx now. */ |
1878 | /* We still expose it, but ELEM_LOOP is explicitely R6xx now. */ |
1879 | /* TODO: is this just forgotten in the docs, or really not available any more? */ |
1879 | /* TODO: is this just forgotten in the docs, or really not available any more? */ |
1880 | #define CF_ALLOC_IMP_EXP_DWORD1_BUF(array_size, comp_mask, el, bc, eop, vpm, cf_inst, wqm, b) \ |
1880 | #define CF_ALLOC_IMP_EXP_DWORD1_BUF(array_size, comp_mask, el, bc, eop, vpm, cf_inst, wqm, b) \ |
1881 | (((array_size) << 0) | ((comp_mask) << 12) | ((el) << 16) | ((bc) << 17) | \ |
1881 | (((array_size) << 0) | ((comp_mask) << 12) | ((el) << 16) | ((bc) << 17) | \ |
1882 | ((eop) << 21) | ((vpm) << 22) | ((cf_inst) << 23) | ((wqm) << 30) | ((b) << 31)) |
1882 | ((eop) << 21) | ((vpm) << 22) | ((cf_inst) << 23) | ((wqm) << 30) | ((b) << 31)) |
1883 | #define CF_ALLOC_IMP_EXP_DWORD1_SWIZ(sel_x, sel_y, sel_z, sel_w, el, bc, eop, vpm, cf_inst, wqm, b) \ |
1883 | #define CF_ALLOC_IMP_EXP_DWORD1_SWIZ(sel_x, sel_y, sel_z, sel_w, el, bc, eop, vpm, cf_inst, wqm, b) \ |
1884 | (((sel_x) << 0) | ((sel_y) << 3) | ((sel_z) << 6) | ((sel_w) << 9) | ((el) << 16) | \ |
1884 | (((sel_x) << 0) | ((sel_y) << 3) | ((sel_z) << 6) | ((sel_w) << 9) | ((el) << 16) | \ |
1885 | ((bc) << 17) | ((eop) << 21) | ((vpm) << 22) | ((cf_inst) << 23) | \ |
1885 | ((bc) << 17) | ((eop) << 21) | ((vpm) << 22) | ((cf_inst) << 23) | \ |
1886 | ((wqm) << 30) | ((b) << 31)) |
1886 | ((wqm) << 30) | ((b) << 31)) |
1887 | 1887 | ||
1888 | /* VTX clause insts */ |
1888 | /* VTX clause insts */ |
1889 | /* vxt insts */ |
1889 | /* vxt insts */ |
1890 | #define VTX_INST(x) (x) /* SQ_VTX_INST_* */ |
1890 | #define VTX_INST(x) (x) /* SQ_VTX_INST_* */ |
1891 | 1891 | ||
1892 | /* fetch type */ |
1892 | /* fetch type */ |
1893 | #define FETCH_TYPE(x) (x) /* SQ_VTX_FETCH_* */ |
1893 | #define FETCH_TYPE(x) (x) /* SQ_VTX_FETCH_* */ |
1894 | 1894 | ||
1895 | #define FETCH_WHOLE_QUAD(x) (x) |
1895 | #define FETCH_WHOLE_QUAD(x) (x) |
1896 | #define BUFFER_ID(x) (x) |
1896 | #define BUFFER_ID(x) (x) |
1897 | #define SRC_GPR(x) (x) |
1897 | #define SRC_GPR(x) (x) |
1898 | #define SRC_REL(x) (x) |
1898 | #define SRC_REL(x) (x) |
1899 | #define MEGA_FETCH_COUNT(x) ((x) ? ((x) - 1) : 0) |
1899 | #define MEGA_FETCH_COUNT(x) ((x) ? ((x) - 1) : 0) |
1900 | 1900 | ||
1901 | #define SEMANTIC_ID(x) (x) |
1901 | #define SEMANTIC_ID(x) (x) |
1902 | #define DST_SEL_X(x) (x) |
1902 | #define DST_SEL_X(x) (x) |
1903 | #define DST_SEL_Y(x) (x) |
1903 | #define DST_SEL_Y(x) (x) |
1904 | #define DST_SEL_Z(x) (x) |
1904 | #define DST_SEL_Z(x) (x) |
1905 | #define DST_SEL_W(x) (x) |
1905 | #define DST_SEL_W(x) (x) |
1906 | #define USE_CONST_FIELDS(x) (x) |
1906 | #define USE_CONST_FIELDS(x) (x) |
1907 | #define DATA_FORMAT(x) (x) |
1907 | #define DATA_FORMAT(x) (x) |
1908 | /* num format */ |
1908 | /* num format */ |
1909 | #define NUM_FORMAT_ALL(x) (x) /* SQ_NUM_FORMAT_* */ |
1909 | #define NUM_FORMAT_ALL(x) (x) /* SQ_NUM_FORMAT_* */ |
1910 | /* format comp */ |
1910 | /* format comp */ |
1911 | #define FORMAT_COMP_ALL(x) (x) /* SQ_FORMAT_COMP_* */ |
1911 | #define FORMAT_COMP_ALL(x) (x) /* SQ_FORMAT_COMP_* */ |
1912 | /* sma */ |
1912 | /* sma */ |
1913 | #define SRF_MODE_ALL(x) (x) |
1913 | #define SRF_MODE_ALL(x) (x) |
1914 | #define SRF_MODE_ZERO_CLAMP_MINUS_ONE 0 |
1914 | #define SRF_MODE_ZERO_CLAMP_MINUS_ONE 0 |
1915 | #define SRF_MODE_NO_ZERO 1 |
1915 | #define SRF_MODE_NO_ZERO 1 |
1916 | #define OFFSET(x) (x) |
1916 | #define OFFSET(x) (x) |
1917 | /* endian swap */ |
1917 | /* endian swap */ |
1918 | #define ENDIAN_SWAP(x) (x) /* SQ_ENDIAN_* */ |
1918 | #define ENDIAN_SWAP(x) (x) /* SQ_ENDIAN_* */ |
1919 | #define CONST_BUF_NO_STRIDE(x) (x) |
1919 | #define CONST_BUF_NO_STRIDE(x) (x) |
1920 | /* mf */ |
1920 | /* mf */ |
1921 | #define MEGA_FETCH(x) (x) |
1921 | #define MEGA_FETCH(x) (x) |
1922 | 1922 | ||
1923 | #define VTX_DWORD0(vtx_inst, ft, fwq, buffer_id, src_gpr, sr, ssx, mfc) \ |
1923 | #define VTX_DWORD0(vtx_inst, ft, fwq, buffer_id, src_gpr, sr, ssx, mfc) \ |
1924 | (((vtx_inst) << 0) | ((ft) << 5) | ((fwq) << 7) | ((buffer_id) << 8) | \ |
1924 | (((vtx_inst) << 0) | ((ft) << 5) | ((fwq) << 7) | ((buffer_id) << 8) | \ |
1925 | ((src_gpr) << 16) | ((sr) << 23) | ((ssx) << 24) | ((mfc) << 26)) |
1925 | ((src_gpr) << 16) | ((sr) << 23) | ((ssx) << 24) | ((mfc) << 26)) |
1926 | #define VTX_DWORD1_SEM(semantic_id, dsx, dsy, dsz, dsw, ucf, data_format, nfa, fca, sma) \ |
1926 | #define VTX_DWORD1_SEM(semantic_id, dsx, dsy, dsz, dsw, ucf, data_format, nfa, fca, sma) \ |
1927 | (((semantic_id) << 0) | ((dsx) << 9) | ((dsy) << 12) | ((dsz) << 15) | ((dsw) << 18) | \ |
1927 | (((semantic_id) << 0) | ((dsx) << 9) | ((dsy) << 12) | ((dsz) << 15) | ((dsw) << 18) | \ |
1928 | ((ucf) << 21) | ((data_format) << 22) | ((nfa) << 28) | ((fca) << 30) | ((sma) << 31)) |
1928 | ((ucf) << 21) | ((data_format) << 22) | ((nfa) << 28) | ((fca) << 30) | ((sma) << 31)) |
1929 | #define VTX_DWORD1_GPR(dst_gpr, dr, dsx, dsy, dsz, dsw, ucf, data_format, nfa, fca, sma) \ |
1929 | #define VTX_DWORD1_GPR(dst_gpr, dr, dsx, dsy, dsz, dsw, ucf, data_format, nfa, fca, sma) \ |
1930 | (((dst_gpr) << 0) | ((dr) << 7) | ((dsx) << 9) | ((dsy) << 12) | ((dsz) << 15) | ((dsw) << 18) | \ |
1930 | (((dst_gpr) << 0) | ((dr) << 7) | ((dsx) << 9) | ((dsy) << 12) | ((dsz) << 15) | ((dsw) << 18) | \ |
1931 | ((ucf) << 21) | ((data_format) << 22) | ((nfa) << 28) | ((fca) << 30) | ((sma) << 31)) |
1931 | ((ucf) << 21) | ((data_format) << 22) | ((nfa) << 28) | ((fca) << 30) | ((sma) << 31)) |
1932 | #define VTX_DWORD2(offset, es, cbns, mf) \ |
1932 | #define VTX_DWORD2(offset, es, cbns, mf) \ |
1933 | (((offset) << 0) | ((es) << 16) | ((cbns) << 18) | ((mf) << 19)) |
1933 | (((offset) << 0) | ((es) << 16) | ((cbns) << 18) | ((mf) << 19)) |
1934 | #define VTX_DWORD_PAD 0x00000000 |
1934 | #define VTX_DWORD_PAD 0x00000000 |
1935 | 1935 | ||
1936 | 1936 | ||
1937 | int R600_solid_vs(struct radeon_device *rdev, uint32_t* shader) |
1937 | int R600_solid_vs(struct radeon_device *rdev, uint32_t* shader) |
1938 | { |
1938 | { |
1939 | int i=0; |
1939 | int i=0; |
1940 | 1940 | ||
1941 | /* 0 */ |
1941 | /* 0 */ |
1942 | shader[i++] = CF_DWORD0(ADDR(4)); |
1942 | shader[i++] = CF_DWORD0(ADDR(4)); |
1943 | shader[i++] = CF_DWORD1(POP_COUNT(0), |
1943 | shader[i++] = CF_DWORD1(POP_COUNT(0), |
1944 | CF_CONST(0), |
1944 | CF_CONST(0), |
1945 | COND(SQ_CF_COND_ACTIVE), |
1945 | COND(SQ_CF_COND_ACTIVE), |
1946 | I_COUNT(1), |
1946 | I_COUNT(1), |
1947 | CALL_COUNT(0), |
1947 | CALL_COUNT(0), |
1948 | END_OF_PROGRAM(0), |
1948 | END_OF_PROGRAM(0), |
1949 | VALID_PIXEL_MODE(0), |
1949 | VALID_PIXEL_MODE(0), |
1950 | CF_INST(SQ_CF_INST_VTX), |
1950 | CF_INST(SQ_CF_INST_VTX), |
1951 | WHOLE_QUAD_MODE(0), |
1951 | WHOLE_QUAD_MODE(0), |
1952 | BARRIER(1)); |
1952 | BARRIER(1)); |
1953 | /* 1 */ |
1953 | /* 1 */ |
1954 | shader[i++] = CF_ALLOC_IMP_EXP_DWORD0(ARRAY_BASE(CF_POS0), |
1954 | shader[i++] = CF_ALLOC_IMP_EXP_DWORD0(ARRAY_BASE(CF_POS0), |
1955 | TYPE(SQ_EXPORT_POS), |
1955 | TYPE(SQ_EXPORT_POS), |
1956 | RW_GPR(1), |
1956 | RW_GPR(1), |
1957 | RW_REL(ABSOLUTE), |
1957 | RW_REL(ABSOLUTE), |
1958 | INDEX_GPR(0), |
1958 | INDEX_GPR(0), |
1959 | ELEM_SIZE(0)); |
1959 | ELEM_SIZE(0)); |
1960 | shader[i++] = CF_ALLOC_IMP_EXP_DWORD1_SWIZ(SRC_SEL_X(SQ_SEL_X), |
1960 | shader[i++] = CF_ALLOC_IMP_EXP_DWORD1_SWIZ(SRC_SEL_X(SQ_SEL_X), |
1961 | SRC_SEL_Y(SQ_SEL_Y), |
1961 | SRC_SEL_Y(SQ_SEL_Y), |
1962 | SRC_SEL_Z(SQ_SEL_Z), |
1962 | SRC_SEL_Z(SQ_SEL_Z), |
1963 | SRC_SEL_W(SQ_SEL_W), |
1963 | SRC_SEL_W(SQ_SEL_W), |
1964 | R6xx_ELEM_LOOP(0), |
1964 | R6xx_ELEM_LOOP(0), |
1965 | BURST_COUNT(1), |
1965 | BURST_COUNT(1), |
1966 | END_OF_PROGRAM(0), |
1966 | END_OF_PROGRAM(0), |
1967 | VALID_PIXEL_MODE(0), |
1967 | VALID_PIXEL_MODE(0), |
1968 | CF_INST(SQ_CF_INST_EXPORT_DONE), |
1968 | CF_INST(SQ_CF_INST_EXPORT_DONE), |
1969 | WHOLE_QUAD_MODE(0), |
1969 | WHOLE_QUAD_MODE(0), |
1970 | BARRIER(1)); |
1970 | BARRIER(1)); |
1971 | /* 2 - always export a param whether it's used or not */ |
1971 | /* 2 - always export a param whether it's used or not */ |
1972 | shader[i++] = CF_ALLOC_IMP_EXP_DWORD0(ARRAY_BASE(0), |
1972 | shader[i++] = CF_ALLOC_IMP_EXP_DWORD0(ARRAY_BASE(0), |
1973 | TYPE(SQ_EXPORT_PARAM), |
1973 | TYPE(SQ_EXPORT_PARAM), |
1974 | RW_GPR(0), |
1974 | RW_GPR(0), |
1975 | RW_REL(ABSOLUTE), |
1975 | RW_REL(ABSOLUTE), |
1976 | INDEX_GPR(0), |
1976 | INDEX_GPR(0), |
1977 | ELEM_SIZE(0)); |
1977 | ELEM_SIZE(0)); |
1978 | shader[i++] = CF_ALLOC_IMP_EXP_DWORD1_SWIZ(SRC_SEL_X(SQ_SEL_X), |
1978 | shader[i++] = CF_ALLOC_IMP_EXP_DWORD1_SWIZ(SRC_SEL_X(SQ_SEL_X), |
1979 | SRC_SEL_Y(SQ_SEL_Y), |
1979 | SRC_SEL_Y(SQ_SEL_Y), |
1980 | SRC_SEL_Z(SQ_SEL_Z), |
1980 | SRC_SEL_Z(SQ_SEL_Z), |
1981 | SRC_SEL_W(SQ_SEL_W), |
1981 | SRC_SEL_W(SQ_SEL_W), |
1982 | R6xx_ELEM_LOOP(0), |
1982 | R6xx_ELEM_LOOP(0), |
1983 | BURST_COUNT(0), |
1983 | BURST_COUNT(0), |
1984 | END_OF_PROGRAM(1), |
1984 | END_OF_PROGRAM(1), |
1985 | VALID_PIXEL_MODE(0), |
1985 | VALID_PIXEL_MODE(0), |
1986 | CF_INST(SQ_CF_INST_EXPORT_DONE), |
1986 | CF_INST(SQ_CF_INST_EXPORT_DONE), |
1987 | WHOLE_QUAD_MODE(0), |
1987 | WHOLE_QUAD_MODE(0), |
1988 | BARRIER(0)); |
1988 | BARRIER(0)); |
1989 | /* 3 - padding */ |
1989 | /* 3 - padding */ |
1990 | shader[i++] = 0x00000000; |
1990 | shader[i++] = 0x00000000; |
1991 | shader[i++] = 0x00000000; |
1991 | shader[i++] = 0x00000000; |
1992 | /* 4/5 */ |
1992 | /* 4/5 */ |
1993 | shader[i++] = VTX_DWORD0(VTX_INST(SQ_VTX_INST_FETCH), |
1993 | shader[i++] = VTX_DWORD0(VTX_INST(SQ_VTX_INST_FETCH), |
1994 | FETCH_TYPE(SQ_VTX_FETCH_VERTEX_DATA), |
1994 | FETCH_TYPE(SQ_VTX_FETCH_VERTEX_DATA), |
1995 | FETCH_WHOLE_QUAD(0), |
1995 | FETCH_WHOLE_QUAD(0), |
1996 | BUFFER_ID(0), |
1996 | BUFFER_ID(0), |
1997 | SRC_GPR(0), |
1997 | SRC_GPR(0), |
1998 | SRC_REL(ABSOLUTE), |
1998 | SRC_REL(ABSOLUTE), |
1999 | SRC_SEL_X(SQ_SEL_X), |
1999 | SRC_SEL_X(SQ_SEL_X), |
2000 | MEGA_FETCH_COUNT(8)); |
2000 | MEGA_FETCH_COUNT(8)); |
2001 | shader[i++] = VTX_DWORD1_GPR(DST_GPR(1), |
2001 | shader[i++] = VTX_DWORD1_GPR(DST_GPR(1), |
2002 | DST_REL(0), |
2002 | DST_REL(0), |
2003 | DST_SEL_X(SQ_SEL_X), |
2003 | DST_SEL_X(SQ_SEL_X), |
2004 | DST_SEL_Y(SQ_SEL_Y), |
2004 | DST_SEL_Y(SQ_SEL_Y), |
2005 | DST_SEL_Z(SQ_SEL_0), |
2005 | DST_SEL_Z(SQ_SEL_0), |
2006 | DST_SEL_W(SQ_SEL_1), |
2006 | DST_SEL_W(SQ_SEL_1), |
2007 | USE_CONST_FIELDS(0), |
2007 | USE_CONST_FIELDS(0), |
2008 | DATA_FORMAT(FMT_32_32_FLOAT), /* xxx */ |
2008 | DATA_FORMAT(FMT_32_32_FLOAT), /* xxx */ |
2009 | NUM_FORMAT_ALL(SQ_NUM_FORMAT_NORM), /* xxx */ |
2009 | NUM_FORMAT_ALL(SQ_NUM_FORMAT_NORM), /* xxx */ |
2010 | FORMAT_COMP_ALL(SQ_FORMAT_COMP_SIGNED), /* xxx */ |
2010 | FORMAT_COMP_ALL(SQ_FORMAT_COMP_SIGNED), /* xxx */ |
2011 | SRF_MODE_ALL(SRF_MODE_ZERO_CLAMP_MINUS_ONE)); |
2011 | SRF_MODE_ALL(SRF_MODE_ZERO_CLAMP_MINUS_ONE)); |
2012 | shader[i++] = VTX_DWORD2(OFFSET(0), |
2012 | shader[i++] = VTX_DWORD2(OFFSET(0), |
2013 | ENDIAN_SWAP(ENDIAN_NONE), |
2013 | ENDIAN_SWAP(ENDIAN_NONE), |
2014 | CONST_BUF_NO_STRIDE(0), |
2014 | CONST_BUF_NO_STRIDE(0), |
2015 | MEGA_FETCH(1)); |
2015 | MEGA_FETCH(1)); |
2016 | shader[i++] = VTX_DWORD_PAD; |
2016 | shader[i++] = VTX_DWORD_PAD; |
2017 | 2017 | ||
2018 | return i; |
2018 | return i; |
2019 | } |
2019 | } |
2020 | 2020 | ||
2021 | int R600_solid_ps(struct radeon_device *rdev, uint32_t* shader) |
2021 | int R600_solid_ps(struct radeon_device *rdev, uint32_t* shader) |
2022 | { |
2022 | { |
2023 | int i=0; |
2023 | int i=0; |
2024 | 2024 | ||
2025 | /* 0 */ |
2025 | /* 0 */ |
2026 | shader[i++] = CF_ALU_DWORD0(ADDR(2), |
2026 | shader[i++] = CF_ALU_DWORD0(ADDR(2), |
2027 | KCACHE_BANK0(0), |
2027 | KCACHE_BANK0(0), |
2028 | KCACHE_BANK1(0), |
2028 | KCACHE_BANK1(0), |
2029 | KCACHE_MODE0(SQ_CF_KCACHE_NOP)); |
2029 | KCACHE_MODE0(SQ_CF_KCACHE_NOP)); |
2030 | shader[i++] = CF_ALU_DWORD1(KCACHE_MODE1(SQ_CF_KCACHE_NOP), |
2030 | shader[i++] = CF_ALU_DWORD1(KCACHE_MODE1(SQ_CF_KCACHE_NOP), |
2031 | KCACHE_ADDR0(0), |
2031 | KCACHE_ADDR0(0), |
2032 | KCACHE_ADDR1(0), |
2032 | KCACHE_ADDR1(0), |
2033 | I_COUNT(4), |
2033 | I_COUNT(4), |
2034 | USES_WATERFALL(0), |
2034 | USES_WATERFALL(0), |
2035 | CF_INST(SQ_CF_INST_ALU), |
2035 | CF_INST(SQ_CF_INST_ALU), |
2036 | WHOLE_QUAD_MODE(0), |
2036 | WHOLE_QUAD_MODE(0), |
2037 | BARRIER(1)); |
2037 | BARRIER(1)); |
2038 | /* 1 */ |
2038 | /* 1 */ |
2039 | shader[i++] = CF_ALLOC_IMP_EXP_DWORD0(ARRAY_BASE(CF_PIXEL_MRT0), |
2039 | shader[i++] = CF_ALLOC_IMP_EXP_DWORD0(ARRAY_BASE(CF_PIXEL_MRT0), |
2040 | TYPE(SQ_EXPORT_PIXEL), |
2040 | TYPE(SQ_EXPORT_PIXEL), |
2041 | RW_GPR(0), |
2041 | RW_GPR(0), |
2042 | RW_REL(ABSOLUTE), |
2042 | RW_REL(ABSOLUTE), |
2043 | INDEX_GPR(0), |
2043 | INDEX_GPR(0), |
2044 | ELEM_SIZE(1)); |
2044 | ELEM_SIZE(1)); |
2045 | shader[i++] = CF_ALLOC_IMP_EXP_DWORD1_SWIZ(SRC_SEL_X(SQ_SEL_X), |
2045 | shader[i++] = CF_ALLOC_IMP_EXP_DWORD1_SWIZ(SRC_SEL_X(SQ_SEL_X), |
2046 | SRC_SEL_Y(SQ_SEL_Y), |
2046 | SRC_SEL_Y(SQ_SEL_Y), |
2047 | SRC_SEL_Z(SQ_SEL_Z), |
2047 | SRC_SEL_Z(SQ_SEL_Z), |
2048 | SRC_SEL_W(SQ_SEL_W), |
2048 | SRC_SEL_W(SQ_SEL_W), |
2049 | R6xx_ELEM_LOOP(0), |
2049 | R6xx_ELEM_LOOP(0), |
2050 | BURST_COUNT(1), |
2050 | BURST_COUNT(1), |
2051 | END_OF_PROGRAM(1), |
2051 | END_OF_PROGRAM(1), |
2052 | VALID_PIXEL_MODE(0), |
2052 | VALID_PIXEL_MODE(0), |
2053 | CF_INST(SQ_CF_INST_EXPORT_DONE), |
2053 | CF_INST(SQ_CF_INST_EXPORT_DONE), |
2054 | WHOLE_QUAD_MODE(0), |
2054 | WHOLE_QUAD_MODE(0), |
2055 | BARRIER(1)); |
2055 | BARRIER(1)); |
2056 | 2056 | ||
2057 | /* 2 */ |
2057 | /* 2 */ |
2058 | shader[i++] = ALU_DWORD0(SRC0_SEL(256), |
2058 | shader[i++] = ALU_DWORD0(SRC0_SEL(256), |
2059 | SRC0_REL(ABSOLUTE), |
2059 | SRC0_REL(ABSOLUTE), |
2060 | SRC0_ELEM(ELEM_X), |
2060 | SRC0_ELEM(ELEM_X), |
2061 | SRC0_NEG(0), |
2061 | SRC0_NEG(0), |
2062 | SRC1_SEL(0), |
2062 | SRC1_SEL(0), |
2063 | SRC1_REL(ABSOLUTE), |
2063 | SRC1_REL(ABSOLUTE), |
2064 | SRC1_ELEM(ELEM_X), |
2064 | SRC1_ELEM(ELEM_X), |
2065 | SRC1_NEG(0), |
2065 | SRC1_NEG(0), |
2066 | INDEX_MODE(SQ_INDEX_AR_X), |
2066 | INDEX_MODE(SQ_INDEX_AR_X), |
2067 | PRED_SEL(SQ_PRED_SEL_OFF), |
2067 | PRED_SEL(SQ_PRED_SEL_OFF), |
2068 | LAST(0)); |
2068 | LAST(0)); |
2069 | shader[i++] = ALU_DWORD1_OP2(rdev->family, |
2069 | shader[i++] = ALU_DWORD1_OP2(rdev->family, |
2070 | SRC0_ABS(0), |
2070 | SRC0_ABS(0), |
2071 | SRC1_ABS(0), |
2071 | SRC1_ABS(0), |
2072 | UPDATE_EXECUTE_MASK(0), |
2072 | UPDATE_EXECUTE_MASK(0), |
2073 | UPDATE_PRED(0), |
2073 | UPDATE_PRED(0), |
2074 | WRITE_MASK(1), |
2074 | WRITE_MASK(1), |
2075 | FOG_MERGE(0), |
2075 | FOG_MERGE(0), |
2076 | OMOD(SQ_ALU_OMOD_OFF), |
2076 | OMOD(SQ_ALU_OMOD_OFF), |
2077 | ALU_INST(SQ_OP2_INST_MOV), |
2077 | ALU_INST(SQ_OP2_INST_MOV), |
2078 | BANK_SWIZZLE(SQ_ALU_VEC_012), |
2078 | BANK_SWIZZLE(SQ_ALU_VEC_012), |
2079 | DST_GPR(0), |
2079 | DST_GPR(0), |
2080 | DST_REL(ABSOLUTE), |
2080 | DST_REL(ABSOLUTE), |
2081 | DST_ELEM(ELEM_X), |
2081 | DST_ELEM(ELEM_X), |
2082 | CLAMP(1)); |
2082 | CLAMP(1)); |
2083 | /* 3 */ |
2083 | /* 3 */ |
2084 | shader[i++] = ALU_DWORD0(SRC0_SEL(256), |
2084 | shader[i++] = ALU_DWORD0(SRC0_SEL(256), |
2085 | SRC0_REL(ABSOLUTE), |
2085 | SRC0_REL(ABSOLUTE), |
2086 | SRC0_ELEM(ELEM_Y), |
2086 | SRC0_ELEM(ELEM_Y), |
2087 | SRC0_NEG(0), |
2087 | SRC0_NEG(0), |
2088 | SRC1_SEL(0), |
2088 | SRC1_SEL(0), |
2089 | SRC1_REL(ABSOLUTE), |
2089 | SRC1_REL(ABSOLUTE), |
2090 | SRC1_ELEM(ELEM_Y), |
2090 | SRC1_ELEM(ELEM_Y), |
2091 | SRC1_NEG(0), |
2091 | SRC1_NEG(0), |
2092 | INDEX_MODE(SQ_INDEX_AR_X), |
2092 | INDEX_MODE(SQ_INDEX_AR_X), |
2093 | PRED_SEL(SQ_PRED_SEL_OFF), |
2093 | PRED_SEL(SQ_PRED_SEL_OFF), |
2094 | LAST(0)); |
2094 | LAST(0)); |
2095 | shader[i++] = ALU_DWORD1_OP2(rdev->family, |
2095 | shader[i++] = ALU_DWORD1_OP2(rdev->family, |
2096 | SRC0_ABS(0), |
2096 | SRC0_ABS(0), |
2097 | SRC1_ABS(0), |
2097 | SRC1_ABS(0), |
2098 | UPDATE_EXECUTE_MASK(0), |
2098 | UPDATE_EXECUTE_MASK(0), |
2099 | UPDATE_PRED(0), |
2099 | UPDATE_PRED(0), |
2100 | WRITE_MASK(1), |
2100 | WRITE_MASK(1), |
2101 | FOG_MERGE(0), |
2101 | FOG_MERGE(0), |
2102 | OMOD(SQ_ALU_OMOD_OFF), |
2102 | OMOD(SQ_ALU_OMOD_OFF), |
2103 | ALU_INST(SQ_OP2_INST_MOV), |
2103 | ALU_INST(SQ_OP2_INST_MOV), |
2104 | BANK_SWIZZLE(SQ_ALU_VEC_012), |
2104 | BANK_SWIZZLE(SQ_ALU_VEC_012), |
2105 | DST_GPR(0), |
2105 | DST_GPR(0), |
2106 | DST_REL(ABSOLUTE), |
2106 | DST_REL(ABSOLUTE), |
2107 | DST_ELEM(ELEM_Y), |
2107 | DST_ELEM(ELEM_Y), |
2108 | CLAMP(1)); |
2108 | CLAMP(1)); |
2109 | /* 4 */ |
2109 | /* 4 */ |
2110 | shader[i++] = ALU_DWORD0(SRC0_SEL(256), |
2110 | shader[i++] = ALU_DWORD0(SRC0_SEL(256), |
2111 | SRC0_REL(ABSOLUTE), |
2111 | SRC0_REL(ABSOLUTE), |
2112 | SRC0_ELEM(ELEM_Z), |
2112 | SRC0_ELEM(ELEM_Z), |
2113 | SRC0_NEG(0), |
2113 | SRC0_NEG(0), |
2114 | SRC1_SEL(0), |
2114 | SRC1_SEL(0), |
2115 | SRC1_REL(ABSOLUTE), |
2115 | SRC1_REL(ABSOLUTE), |
2116 | SRC1_ELEM(ELEM_Z), |
2116 | SRC1_ELEM(ELEM_Z), |
2117 | SRC1_NEG(0), |
2117 | SRC1_NEG(0), |
2118 | INDEX_MODE(SQ_INDEX_AR_X), |
2118 | INDEX_MODE(SQ_INDEX_AR_X), |
2119 | PRED_SEL(SQ_PRED_SEL_OFF), |
2119 | PRED_SEL(SQ_PRED_SEL_OFF), |
2120 | LAST(0)); |
2120 | LAST(0)); |
2121 | shader[i++] = ALU_DWORD1_OP2(rdev->family, |
2121 | shader[i++] = ALU_DWORD1_OP2(rdev->family, |
2122 | SRC0_ABS(0), |
2122 | SRC0_ABS(0), |
2123 | SRC1_ABS(0), |
2123 | SRC1_ABS(0), |
2124 | UPDATE_EXECUTE_MASK(0), |
2124 | UPDATE_EXECUTE_MASK(0), |
2125 | UPDATE_PRED(0), |
2125 | UPDATE_PRED(0), |
2126 | WRITE_MASK(1), |
2126 | WRITE_MASK(1), |
2127 | FOG_MERGE(0), |
2127 | FOG_MERGE(0), |
2128 | OMOD(SQ_ALU_OMOD_OFF), |
2128 | OMOD(SQ_ALU_OMOD_OFF), |
2129 | ALU_INST(SQ_OP2_INST_MOV), |
2129 | ALU_INST(SQ_OP2_INST_MOV), |
2130 | BANK_SWIZZLE(SQ_ALU_VEC_012), |
2130 | BANK_SWIZZLE(SQ_ALU_VEC_012), |
2131 | DST_GPR(0), |
2131 | DST_GPR(0), |
2132 | DST_REL(ABSOLUTE), |
2132 | DST_REL(ABSOLUTE), |
2133 | DST_ELEM(ELEM_Z), |
2133 | DST_ELEM(ELEM_Z), |
2134 | CLAMP(1)); |
2134 | CLAMP(1)); |
2135 | /* 5 */ |
2135 | /* 5 */ |
2136 | shader[i++] = ALU_DWORD0(SRC0_SEL(256), |
2136 | shader[i++] = ALU_DWORD0(SRC0_SEL(256), |
2137 | SRC0_REL(ABSOLUTE), |
2137 | SRC0_REL(ABSOLUTE), |
2138 | SRC0_ELEM(ELEM_W), |
2138 | SRC0_ELEM(ELEM_W), |
2139 | SRC0_NEG(0), |
2139 | SRC0_NEG(0), |
2140 | SRC1_SEL(0), |
2140 | SRC1_SEL(0), |
2141 | SRC1_REL(ABSOLUTE), |
2141 | SRC1_REL(ABSOLUTE), |
2142 | SRC1_ELEM(ELEM_W), |
2142 | SRC1_ELEM(ELEM_W), |
2143 | SRC1_NEG(0), |
2143 | SRC1_NEG(0), |
2144 | INDEX_MODE(SQ_INDEX_AR_X), |
2144 | INDEX_MODE(SQ_INDEX_AR_X), |
2145 | PRED_SEL(SQ_PRED_SEL_OFF), |
2145 | PRED_SEL(SQ_PRED_SEL_OFF), |
2146 | LAST(1)); |
2146 | LAST(1)); |
2147 | shader[i++] = ALU_DWORD1_OP2(rdev->family, |
2147 | shader[i++] = ALU_DWORD1_OP2(rdev->family, |
2148 | SRC0_ABS(0), |
2148 | SRC0_ABS(0), |
2149 | SRC1_ABS(0), |
2149 | SRC1_ABS(0), |
2150 | UPDATE_EXECUTE_MASK(0), |
2150 | UPDATE_EXECUTE_MASK(0), |
2151 | UPDATE_PRED(0), |
2151 | UPDATE_PRED(0), |
2152 | WRITE_MASK(1), |
2152 | WRITE_MASK(1), |
2153 | FOG_MERGE(0), |
2153 | FOG_MERGE(0), |
2154 | OMOD(SQ_ALU_OMOD_OFF), |
2154 | OMOD(SQ_ALU_OMOD_OFF), |
2155 | ALU_INST(SQ_OP2_INST_MOV), |
2155 | ALU_INST(SQ_OP2_INST_MOV), |
2156 | BANK_SWIZZLE(SQ_ALU_VEC_012), |
2156 | BANK_SWIZZLE(SQ_ALU_VEC_012), |
2157 | DST_GPR(0), |
2157 | DST_GPR(0), |
2158 | DST_REL(ABSOLUTE), |
2158 | DST_REL(ABSOLUTE), |
2159 | DST_ELEM(ELEM_W), |
2159 | DST_ELEM(ELEM_W), |
2160 | CLAMP(1)); |
2160 | CLAMP(1)); |
2161 | 2161 | ||
2162 | return i; |
2162 | return i; |
2163 | } |
2163 | } |
2164 | 2164 | ||
2165 | static inline void |
2165 | static inline void |
2166 | memcpy_toio(volatile void __iomem *dst, const void *src, int count) |
2166 | memcpy_toio(volatile void __iomem *dst, const void *src, int count) |
2167 | { |
2167 | { |
2168 | __memcpy((void __force *)dst, src, count); |
2168 | __memcpy((void __force *)dst, src, count); |
2169 | } |
2169 | } |
2170 | 2170 | ||
2171 | #define EFLOAT(val) \ |
2171 | #define EFLOAT(val) \ |
2172 | do { \ |
2172 | do { \ |
2173 | union { float f; uint32_t d; } a; \ |
2173 | union { float f; uint32_t d; } a; \ |
2174 | a.f = (val); \ |
2174 | a.f = (val); \ |
2175 | radeon_ring_write(rdev, a.d); \ |
2175 | radeon_ring_write(rdev, a.d); \ |
2176 | } while (0) |
2176 | } while (0) |
2177 | 2177 | ||
2178 | int r600_2D_test(struct radeon_device *rdev) |
2178 | int r600_2D_test(struct radeon_device *rdev) |
2179 | { |
2179 | { |
2180 | uint32_t ps_shader[16]; |
2180 | uint32_t ps_shader[16]; |
2181 | uint32_t vs_shader[16]; |
2181 | uint32_t vs_shader[16]; |
2182 | 2182 | ||
2183 | u32 packet2s[16]; |
2183 | u32 packet2s[16]; |
2184 | int num_packet2s = 0; |
2184 | int num_packet2s = 0; |
2185 | 2185 | ||
2186 | uint32_t pitch; |
2186 | uint32_t pitch; |
2187 | uint32_t offset; |
2187 | uint32_t offset; |
2188 | 2188 | ||
2189 | int state_len; |
2189 | int state_len; |
2190 | int dwords; |
2190 | int dwords; |
2191 | u32 obj_size; |
2191 | u32 obj_size; |
2192 | 2192 | ||
2193 | u32 state_offset = 0; |
2193 | u32 state_offset = 0; |
2194 | u64 state_gpu_addr = 0; |
2194 | u64 state_gpu_addr = 0; |
2195 | 2195 | ||
2196 | u32 vs_offset; |
2196 | u32 vs_offset; |
2197 | u32 ps_offset; |
2197 | u32 ps_offset; |
2198 | u32 vb_offset; |
2198 | u32 vb_offset; |
2199 | 2199 | ||
2200 | int vs_size; |
2200 | int vs_size; |
2201 | int ps_size; |
2201 | int ps_size; |
2202 | 2202 | ||
2203 | float *vb; |
2203 | float *vb; |
2204 | void *ptr; |
2204 | void *ptr; |
2205 | 2205 | ||
2206 | struct radeon_bo *state_obj; |
2206 | struct radeon_bo *state_obj; |
2207 | 2207 | ||
2208 | int r; |
2208 | int r; |
2209 | 2209 | ||
2210 | ENTER(); |
2210 | ENTER(); |
2211 | 2211 | ||
2212 | pitch = (1024*4)/64; |
2212 | pitch = (1024*4)/64; |
2213 | offset = rdev->mc.vram_location; |
2213 | offset = rdev->mc.vram_start; |
2214 | 2214 | ps_size = R600_solid_ps(rdev, ps_shader); |
|
2215 | ps_size = R600_solid_ps(rdev, ps_shader); |
- | |
2216 | vs_size = R600_solid_vs(rdev, vs_shader); |
2215 | vs_size = R600_solid_vs(rdev, vs_shader); |
2217 | 2216 | ||
2218 | if (rdev->family >= CHIP_RV770) |
2217 | if (rdev->family >= CHIP_RV770) |
2219 | state_len = r7xx_default_size; |
2218 | state_len = r7xx_default_size; |
2220 | else |
2219 | else |
2221 | state_len = r6xx_default_size; |
2220 | state_len = r6xx_default_size; |
2222 | 2221 | ||
2223 | dwords = state_len; |
2222 | dwords = state_len; |
2224 | 2223 | ||
2225 | while (dwords & 0xf) { |
2224 | while (dwords & 0xf) { |
2226 | packet2s[num_packet2s++] = PACKET2(0); |
2225 | packet2s[num_packet2s++] = PACKET2(0); |
2227 | dwords++; |
2226 | dwords++; |
2228 | } |
2227 | } |
2229 | 2228 | ||
2230 | obj_size = dwords * 4; |
2229 | obj_size = dwords * 4; |
2231 | obj_size = ALIGN(obj_size, 256); |
2230 | obj_size = ALIGN(obj_size, 256); |
2232 | 2231 | ||
2233 | vs_offset = obj_size; |
2232 | vs_offset = obj_size; |
2234 | obj_size += vs_size * 4; |
2233 | obj_size += vs_size * 4; |
2235 | obj_size = ALIGN(obj_size, 256); |
2234 | obj_size = ALIGN(obj_size, 256); |
2236 | 2235 | ||
2237 | ps_offset = obj_size; |
2236 | ps_offset = obj_size; |
2238 | obj_size += ps_size * 4; |
2237 | obj_size += ps_size * 4; |
2239 | obj_size = ALIGN(obj_size, 256); |
2238 | obj_size = ALIGN(obj_size, 256); |
2240 | 2239 | ||
2241 | vb_offset = obj_size; |
2240 | vb_offset = obj_size; |
2242 | obj_size += 32*4; |
2241 | obj_size += 32*4; |
2243 | obj_size = ALIGN(obj_size, 256); |
2242 | obj_size = ALIGN(obj_size, 256); |
2244 | 2243 | ||
2245 | r = radeon_bo_create(rdev, NULL, obj_size, true, RADEON_GEM_DOMAIN_VRAM, |
2244 | r = radeon_bo_create(rdev, NULL, obj_size, true, RADEON_GEM_DOMAIN_VRAM, |
2246 | &state_obj); |
2245 | &state_obj); |
2247 | if (r) { |
2246 | if (r) { |
2248 | DRM_ERROR("r600 failed to allocate state buffer\n"); |
2247 | DRM_ERROR("r600 failed to allocate state buffer\n"); |
2249 | return r; |
2248 | return r; |
2250 | } |
2249 | } |
2251 | 2250 | ||
2252 | DRM_DEBUG("r6xx state allocated bo %08x vs %08x ps %08x\n", |
2251 | DRM_DEBUG("r6xx state allocated bo %08x vs %08x ps %08x\n", |
2253 | obj_size, vs_offset, ps_offset); |
2252 | obj_size, vs_offset, ps_offset); |
2254 | 2253 | ||
2255 | r = radeon_bo_pin(state_obj, RADEON_GEM_DOMAIN_VRAM, |
2254 | r = radeon_bo_pin(state_obj, RADEON_GEM_DOMAIN_VRAM, |
2256 | &state_gpu_addr); |
2255 | &state_gpu_addr); |
2257 | if (r) { |
2256 | if (r) { |
2258 | DRM_ERROR("failed to pin state object %d\n", r); |
2257 | DRM_ERROR("failed to pin state object %d\n", r); |
2259 | return r; |
2258 | return r; |
2260 | }; |
2259 | }; |
2261 | 2260 | ||
2262 | r = radeon_bo_kmap(state_obj, &ptr); |
2261 | r = radeon_bo_kmap(state_obj, &ptr); |
2263 | if (r) { |
2262 | if (r) { |
2264 | DRM_ERROR("failed to map state object %d\n", r); |
2263 | DRM_ERROR("failed to map state object %d\n", r); |
2265 | return r; |
2264 | return r; |
2266 | }; |
2265 | }; |
2267 | 2266 | ||
2268 | if (rdev->family >= CHIP_RV770) |
2267 | if (rdev->family >= CHIP_RV770) |
2269 | memcpy_toio(ptr + state_offset, |
2268 | memcpy_toio(ptr + state_offset, |
2270 | r7xx_default_state, state_len * 4); |
2269 | r7xx_default_state, state_len * 4); |
2271 | else |
2270 | else |
2272 | memcpy_toio(ptr + state_offset, |
2271 | memcpy_toio(ptr + state_offset, |
2273 | r6xx_default_state, state_len * 4); |
2272 | r6xx_default_state, state_len * 4); |
2274 | 2273 | ||
2275 | if (num_packet2s) |
2274 | if (num_packet2s) |
2276 | memcpy_toio(ptr + state_offset + (state_len * 4), |
2275 | memcpy_toio(ptr + state_offset + (state_len * 4), |
2277 | packet2s, num_packet2s * 4); |
2276 | packet2s, num_packet2s * 4); |
2278 | 2277 | ||
2279 | memcpy(ptr + vs_offset, vs_shader, vs_size * 4); |
2278 | memcpy(ptr + vs_offset, vs_shader, vs_size * 4); |
2280 | memcpy(ptr + ps_offset, ps_shader, ps_size * 4); |
2279 | memcpy(ptr + ps_offset, ps_shader, ps_size * 4); |
2281 | 2280 | ||
2282 | 2281 | ||
2283 | vb = (float*)(ptr + vb_offset); |
2282 | vb = (float*)(ptr + vb_offset); |
2284 | 2283 | ||
2285 | vb[0] = (float)64; |
2284 | vb[0] = (float)64; |
2286 | vb[1] = (float)64; |
2285 | vb[1] = (float)64; |
2287 | 2286 | ||
2288 | vb[2] = (float)64; |
2287 | vb[2] = (float)64; |
2289 | vb[3] = (float)(64+128); |
2288 | vb[3] = (float)(64+128); |
2290 | 2289 | ||
2291 | vb[4] = (float)(64+128); |
2290 | vb[4] = (float)(64+128); |
2292 | vb[5] = (float)(64+128); |
2291 | vb[5] = (float)(64+128); |
2293 | 2292 | ||
2294 | int vb_index = 3; |
2293 | int vb_index = 3; |
2295 | int vb_size = vb_index * 8; |
2294 | int vb_size = vb_index * 8; |
2296 | int vtx_num_entries = vb_size / 4; |
2295 | int vtx_num_entries = vb_size / 4; |
2297 | 2296 | ||
2298 | // radeon_bo_kunmap(state_obj); |
2297 | // radeon_bo_kunmap(state_obj); |
2299 | 2298 | ||
2300 | r = radeon_ring_lock(rdev, 1024); |
2299 | r = radeon_ring_lock(rdev, 1024); |
2301 | if (r) { |
2300 | if (r) { |
2302 | DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r); |
2301 | DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r); |
2303 | return r; |
2302 | return r; |
2304 | } |
2303 | } |
2305 | 2304 | ||
2306 | set_default_state(rdev, state_gpu_addr, state_len); |
2305 | set_default_state(rdev, state_gpu_addr, state_len); |
2307 | 2306 | ||
2308 | 2307 | ||
2309 | u64 gpu_addr; |
2308 | u64 gpu_addr; |
2310 | u32 sq_pgm_resources; |
2309 | u32 sq_pgm_resources; |
2311 | 2310 | ||
2312 | /* setup shader regs */ |
2311 | /* setup shader regs */ |
2313 | 2312 | ||
2314 | /* VS */ |
2313 | /* VS */ |
2315 | 2314 | ||
2316 | sq_pgm_resources = (2 << 0); |
2315 | sq_pgm_resources = (2 << 0); |
2317 | gpu_addr = state_gpu_addr + vs_offset; |
2316 | gpu_addr = state_gpu_addr + vs_offset; |
2318 | 2317 | ||
2319 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
2318 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
2320 | radeon_ring_write(rdev, (SQ_PGM_START_VS - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
2319 | radeon_ring_write(rdev, (SQ_PGM_START_VS - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
2321 | radeon_ring_write(rdev, gpu_addr >> 8); |
2320 | radeon_ring_write(rdev, gpu_addr >> 8); |
2322 | 2321 | ||
2323 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
2322 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
2324 | radeon_ring_write(rdev, (SQ_PGM_RESOURCES_VS - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
2323 | radeon_ring_write(rdev, (SQ_PGM_RESOURCES_VS - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
2325 | radeon_ring_write(rdev, sq_pgm_resources); |
2324 | radeon_ring_write(rdev, sq_pgm_resources); |
2326 | 2325 | ||
2327 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
2326 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
2328 | radeon_ring_write(rdev, (SQ_PGM_CF_OFFSET_VS - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
2327 | radeon_ring_write(rdev, (SQ_PGM_CF_OFFSET_VS - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
2329 | radeon_ring_write(rdev, 0); |
2328 | radeon_ring_write(rdev, 0); |
2330 | 2329 | ||
2331 | /* PS */ |
2330 | /* PS */ |
2332 | 2331 | ||
2333 | sq_pgm_resources = (1 << 0); |
2332 | sq_pgm_resources = (1 << 0); |
2334 | gpu_addr = state_gpu_addr + ps_offset; |
2333 | gpu_addr = state_gpu_addr + ps_offset; |
2335 | 2334 | ||
2336 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
2335 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
2337 | radeon_ring_write(rdev, (SQ_PGM_START_PS - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
2336 | radeon_ring_write(rdev, (SQ_PGM_START_PS - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
2338 | radeon_ring_write(rdev, gpu_addr >> 8); |
2337 | radeon_ring_write(rdev, gpu_addr >> 8); |
2339 | 2338 | ||
2340 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
2339 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
2341 | radeon_ring_write(rdev, (SQ_PGM_RESOURCES_PS - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
2340 | radeon_ring_write(rdev, (SQ_PGM_RESOURCES_PS - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
2342 | radeon_ring_write(rdev, sq_pgm_resources | (1 << 28)); |
2341 | radeon_ring_write(rdev, sq_pgm_resources | (1 << 28)); |
2343 | 2342 | ||
2344 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
2343 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
2345 | radeon_ring_write(rdev, (SQ_PGM_EXPORTS_PS - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
2344 | radeon_ring_write(rdev, (SQ_PGM_EXPORTS_PS - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
2346 | radeon_ring_write(rdev, 2); |
2345 | radeon_ring_write(rdev, 2); |
2347 | 2346 | ||
2348 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
2347 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 1)); |
2349 | radeon_ring_write(rdev, (SQ_PGM_CF_OFFSET_PS - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
2348 | radeon_ring_write(rdev, (SQ_PGM_CF_OFFSET_PS - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
2350 | radeon_ring_write(rdev, 0); |
2349 | radeon_ring_write(rdev, 0); |
2351 | 2350 | ||
2352 | gpu_addr = state_gpu_addr + vs_offset; |
2351 | gpu_addr = state_gpu_addr + vs_offset; |
2353 | cp_set_surface_sync(rdev, PACKET3_SH_ACTION_ENA, 512, gpu_addr); |
2352 | cp_set_surface_sync(rdev, PACKET3_SH_ACTION_ENA, 512, gpu_addr); |
2354 | 2353 | ||
2355 | 2354 | ||
2356 | set_render_target(rdev, COLOR_8_8_8_8, 1024, 768, /* FIXME */ |
2355 | set_render_target(rdev, COLOR_8_8_8_8, 1024, 768, /* FIXME */ |
2357 | rdev->mc.vram_location); |
2356 | rdev->mc.vram_start); |
2358 | 2357 | ||
2359 | set_scissors(rdev, 0, 0, 1024, 768); |
2358 | set_scissors(rdev, 0, 0, 1024, 768); |
2360 | 2359 | ||
2361 | 2360 | ||
2362 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_ALU_CONST, 4)); |
2361 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_ALU_CONST, 4)); |
2363 | radeon_ring_write(rdev, (SQ_ALU_CONSTANT0_0 - PACKET3_SET_ALU_CONST_OFFSET) >> 2); |
2362 | radeon_ring_write(rdev, (SQ_ALU_CONSTANT0_0 - PACKET3_SET_ALU_CONST_OFFSET) >> 2); |
2364 | EFLOAT(0.0f); /* r */ |
2363 | EFLOAT(0.0f); /* r */ |
2365 | EFLOAT(1.0f); /* g */ |
2364 | EFLOAT(1.0f); /* g */ |
2366 | EFLOAT(0.0f); /* b */ |
2365 | EFLOAT(0.0f); /* b */ |
2367 | EFLOAT(1.0f); /* a */ |
2366 | EFLOAT(1.0f); /* a */ |
2368 | 2367 | ||
2369 | u32 sq_vtx_constant_word2; |
2368 | u32 sq_vtx_constant_word2; |
2370 | 2369 | ||
2371 | gpu_addr = state_gpu_addr + vb_offset; |
2370 | gpu_addr = state_gpu_addr + vb_offset; |
2372 | 2371 | ||
2373 | sq_vtx_constant_word2 = ((upper_32_bits(gpu_addr) & 0xff) | (8 << 8)); |
2372 | sq_vtx_constant_word2 = ((upper_32_bits(gpu_addr) & 0xff) | (8 << 8)); |
2374 | 2373 | ||
2375 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_RESOURCE, 7)); |
2374 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_RESOURCE, 7)); |
2376 | radeon_ring_write(rdev, 0x460); |
2375 | radeon_ring_write(rdev, 0x460); |
2377 | radeon_ring_write(rdev, gpu_addr & 0xffffffff); /* 0: BASE_ADDRESS */ |
2376 | radeon_ring_write(rdev, gpu_addr & 0xffffffff); /* 0: BASE_ADDRESS */ |
2378 | radeon_ring_write(rdev, (vtx_num_entries << 2) - 1); /* 1: SIZE */ |
2377 | radeon_ring_write(rdev, (vtx_num_entries << 2) - 1); /* 1: SIZE */ |
2379 | radeon_ring_write(rdev, sq_vtx_constant_word2); /* 2: BASE_HI, STRIDE, CLAMP, FORMAT, ENDIAN */ |
2378 | radeon_ring_write(rdev, sq_vtx_constant_word2); /* 2: BASE_HI, STRIDE, CLAMP, FORMAT, ENDIAN */ |
2380 | radeon_ring_write(rdev, 1 << 0); /* 3: MEM_REQUEST_SIZE ?!? */ |
2379 | radeon_ring_write(rdev, 1 << 0); /* 3: MEM_REQUEST_SIZE ?!? */ |
2381 | radeon_ring_write(rdev, 0); |
2380 | radeon_ring_write(rdev, 0); |
2382 | radeon_ring_write(rdev, 0); |
2381 | radeon_ring_write(rdev, 0); |
2383 | radeon_ring_write(rdev, SQ_TEX_VTX_VALID_BUFFER << 30); |
2382 | radeon_ring_write(rdev, SQ_TEX_VTX_VALID_BUFFER << 30); |
2384 | 2383 | ||
2385 | if ((rdev->family == CHIP_RV610) || |
2384 | if ((rdev->family == CHIP_RV610) || |
2386 | (rdev->family == CHIP_RV620) || |
2385 | (rdev->family == CHIP_RV620) || |
2387 | (rdev->family == CHIP_RS780) || |
2386 | (rdev->family == CHIP_RS780) || |
2388 | (rdev->family == CHIP_RS880) || |
2387 | (rdev->family == CHIP_RS880) || |
2389 | (rdev->family == CHIP_RV710)) |
2388 | (rdev->family == CHIP_RV710)) |
2390 | cp_set_surface_sync(rdev, |
2389 | cp_set_surface_sync(rdev, |
2391 | PACKET3_TC_ACTION_ENA, 24, gpu_addr); |
2390 | PACKET3_TC_ACTION_ENA, 24, gpu_addr); |
2392 | else |
2391 | else |
2393 | cp_set_surface_sync(rdev, |
2392 | cp_set_surface_sync(rdev, |
2394 | PACKET3_VC_ACTION_ENA, 24, gpu_addr); |
2393 | PACKET3_VC_ACTION_ENA, 24, gpu_addr); |
2395 | 2394 | ||
2396 | draw_auto(rdev); |
2395 | draw_auto(rdev); |
2397 | 2396 | ||
2398 | cp_set_surface_sync(rdev, PACKET3_CB_ACTION_ENA | PACKET3_CB0_DEST_BASE_ENA, |
2397 | cp_set_surface_sync(rdev, PACKET3_CB_ACTION_ENA | PACKET3_CB0_DEST_BASE_ENA, |
2399 | 1024*4*512, offset); |
2398 | 1024*4*512, offset); |
2400 | 2399 | ||
2401 | radeon_ring_write(rdev, PACKET3(PACKET3_EVENT_WRITE, 0)); |
2400 | radeon_ring_write(rdev, PACKET3(PACKET3_EVENT_WRITE, 0)); |
2402 | radeon_ring_write(rdev, CACHE_FLUSH_AND_INV_EVENT); |
2401 | radeon_ring_write(rdev, CACHE_FLUSH_AND_INV_EVENT); |
2403 | /* wait for 3D idle clean */ |
2402 | /* wait for 3D idle clean */ |
2404 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONFIG_REG, 1)); |
2403 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONFIG_REG, 1)); |
2405 | radeon_ring_write(rdev, (WAIT_UNTIL - PACKET3_SET_CONFIG_REG_OFFSET) >> 2); |
2404 | radeon_ring_write(rdev, (WAIT_UNTIL - PACKET3_SET_CONFIG_REG_OFFSET) >> 2); |
2406 | radeon_ring_write(rdev, WAIT_3D_IDLE_bit | WAIT_3D_IDLECLEAN_bit); |
2405 | radeon_ring_write(rdev, WAIT_3D_IDLE_bit | WAIT_3D_IDLECLEAN_bit); |
2407 | 2406 | ||
2408 | radeon_ring_unlock_commit(rdev); |
2407 | radeon_ring_unlock_commit(rdev); |
2409 | 2408 | ||
2410 | r600_ring_test(rdev); |
2409 | r600_ring_test(rdev); |
2411 | 2410 | ||
2412 | LEAVE(); |
2411 | LEAVE(); |
2413 | return r; |
2412 | return r; |
2414 | }><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>>><>><>>16)|128); |
2413 | }><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>>><>><>>16)|128); |
2415 | 2414 | ||
2416 | ><16)|128); |
2415 | ><16)|128); |
2417 | 2416 | ||
2418 | >16)|64); |
2417 | >16)|64); |
2419 | ><16)|64); |
2418 | ><16)|64); |
2420 | >22)|(offset><22)|(offset>><>><>><>><>><>><>>>><>><>><>><>><>>>>> |
2419 | >22)|(offset><22)|(offset>><>><>><>><>><>><>>>><>><>><>><>><>>>>> |