diff options
Diffstat (limited to 'drivers/video/aty/radeon_accel.c')
-rw-r--r-- | drivers/video/aty/radeon_accel.c | 294 |
1 files changed, 86 insertions, 208 deletions
diff --git a/drivers/video/aty/radeon_accel.c b/drivers/video/aty/radeon_accel.c index a547e5d4c8bf..a469a3d6edcb 100644 --- a/drivers/video/aty/radeon_accel.c +++ b/drivers/video/aty/radeon_accel.c | |||
@@ -5,61 +5,61 @@ | |||
5 | * --dte | 5 | * --dte |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #define FLUSH_CACHE_WORKAROUND 1 | 8 | static void radeon_fixup_offset(struct radeonfb_info *rinfo) |
9 | |||
10 | void radeon_fifo_update_and_wait(struct radeonfb_info *rinfo, int entries) | ||
11 | { | 9 | { |
12 | int i; | 10 | u32 local_base; |
11 | |||
12 | /* *** Ugly workaround *** */ | ||
13 | /* | ||
14 | * On some platforms, the video memory is mapped at 0 in radeon chip space | ||
15 | * (like PPCs) by the firmware. X will always move it up so that it's seen | ||
16 | * by the chip to be at the same address as the PCI BAR. | ||
17 | * That means that when switching back from X, there is a mismatch between | ||
18 | * the offsets programmed into the engine. This means that potentially, | ||
19 | * accel operations done before radeonfb has a chance to re-init the engine | ||
20 | * will have incorrect offsets, and potentially trash system memory ! | ||
21 | * | ||
22 | * The correct fix is for fbcon to never call any accel op before the engine | ||
23 | * has properly been re-initialized (by a call to set_var), but this is a | ||
24 | * complex fix. This workaround in the meantime, called before every accel | ||
25 | * operation, makes sure the offsets are in sync. | ||
26 | */ | ||
13 | 27 | ||
14 | for (i=0; i<2000000; i++) { | 28 | radeon_fifo_wait (1); |
15 | rinfo->fifo_free = INREG(RBBM_STATUS) & 0x7f; | 29 | local_base = INREG(MC_FB_LOCATION) << 16; |
16 | if (rinfo->fifo_free >= entries) | 30 | if (local_base == rinfo->fb_local_base) |
17 | return; | 31 | return; |
18 | udelay(10); | ||
19 | } | ||
20 | printk(KERN_ERR "radeonfb: FIFO Timeout !\n"); | ||
21 | /* XXX Todo: attempt to reset the engine */ | ||
22 | } | ||
23 | 32 | ||
24 | static inline void radeon_fifo_wait(struct radeonfb_info *rinfo, int entries) | 33 | rinfo->fb_local_base = local_base; |
25 | { | ||
26 | if (entries <= rinfo->fifo_free) | ||
27 | rinfo->fifo_free -= entries; | ||
28 | else | ||
29 | radeon_fifo_update_and_wait(rinfo, entries); | ||
30 | } | ||
31 | 34 | ||
32 | static inline void radeonfb_set_creg(struct radeonfb_info *rinfo, u32 reg, | 35 | radeon_fifo_wait (3); |
33 | u32 *cache, u32 new_val) | 36 | OUTREG(DEFAULT_PITCH_OFFSET, (rinfo->pitch << 0x16) | |
34 | { | 37 | (rinfo->fb_local_base >> 10)); |
35 | if (new_val == *cache) | 38 | OUTREG(DST_PITCH_OFFSET, (rinfo->pitch << 0x16) | (rinfo->fb_local_base >> 10)); |
36 | return; | 39 | OUTREG(SRC_PITCH_OFFSET, (rinfo->pitch << 0x16) | (rinfo->fb_local_base >> 10)); |
37 | *cache = new_val; | ||
38 | radeon_fifo_wait(rinfo, 1); | ||
39 | OUTREG(reg, new_val); | ||
40 | } | 40 | } |
41 | 41 | ||
42 | static void radeonfb_prim_fillrect(struct radeonfb_info *rinfo, | 42 | static void radeonfb_prim_fillrect(struct radeonfb_info *rinfo, |
43 | const struct fb_fillrect *region) | 43 | const struct fb_fillrect *region) |
44 | { | 44 | { |
45 | radeonfb_set_creg(rinfo, DP_GUI_MASTER_CNTL, &rinfo->dp_gui_mc_cache, | 45 | radeon_fifo_wait(4); |
46 | rinfo->dp_gui_mc_base | GMC_BRUSH_SOLID_COLOR | ROP3_P); | 46 | |
47 | radeonfb_set_creg(rinfo, DP_CNTL, &rinfo->dp_cntl_cache, | 47 | OUTREG(DP_GUI_MASTER_CNTL, |
48 | DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM); | 48 | rinfo->dp_gui_master_cntl /* contains, like GMC_DST_32BPP */ |
49 | radeonfb_set_creg(rinfo, DP_BRUSH_FRGD_CLR, &rinfo->dp_brush_fg_cache, | 49 | | GMC_BRUSH_SOLID_COLOR |
50 | region->color); | 50 | | ROP3_P); |
51 | 51 | if (radeon_get_dstbpp(rinfo->depth) != DST_8BPP) | |
52 | /* Ensure the dst cache is flushed and the engine idle before | 52 | OUTREG(DP_BRUSH_FRGD_CLR, rinfo->pseudo_palette[region->color]); |
53 | * issuing the operation. | 53 | else |
54 | * | 54 | OUTREG(DP_BRUSH_FRGD_CLR, region->color); |
55 | * This works around engine lockups on some cards | 55 | OUTREG(DP_WRITE_MSK, 0xffffffff); |
56 | */ | 56 | OUTREG(DP_CNTL, (DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM)); |
57 | #if FLUSH_CACHE_WORKAROUND | 57 | |
58 | radeon_fifo_wait(rinfo, 2); | 58 | radeon_fifo_wait(2); |
59 | OUTREG(DSTCACHE_CTLSTAT, RB2D_DC_FLUSH_ALL); | 59 | OUTREG(DSTCACHE_CTLSTAT, RB2D_DC_FLUSH_ALL); |
60 | OUTREG(WAIT_UNTIL, (WAIT_2D_IDLECLEAN | WAIT_DMA_GUI_IDLE)); | 60 | OUTREG(WAIT_UNTIL, (WAIT_2D_IDLECLEAN | WAIT_DMA_GUI_IDLE)); |
61 | #endif | 61 | |
62 | radeon_fifo_wait(rinfo, 2); | 62 | radeon_fifo_wait(2); |
63 | OUTREG(DST_Y_X, (region->dy << 16) | region->dx); | 63 | OUTREG(DST_Y_X, (region->dy << 16) | region->dx); |
64 | OUTREG(DST_WIDTH_HEIGHT, (region->width << 16) | region->height); | 64 | OUTREG(DST_WIDTH_HEIGHT, (region->width << 16) | region->height); |
65 | } | 65 | } |
@@ -70,14 +70,15 @@ void radeonfb_fillrect(struct fb_info *info, const struct fb_fillrect *region) | |||
70 | struct fb_fillrect modded; | 70 | struct fb_fillrect modded; |
71 | int vxres, vyres; | 71 | int vxres, vyres; |
72 | 72 | ||
73 | WARN_ON(rinfo->gfx_mode); | 73 | if (info->state != FBINFO_STATE_RUNNING) |
74 | if (info->state != FBINFO_STATE_RUNNING || rinfo->gfx_mode) | ||
75 | return; | 74 | return; |
76 | if (info->flags & FBINFO_HWACCEL_DISABLED) { | 75 | if (info->flags & FBINFO_HWACCEL_DISABLED) { |
77 | cfb_fillrect(info, region); | 76 | cfb_fillrect(info, region); |
78 | return; | 77 | return; |
79 | } | 78 | } |
80 | 79 | ||
80 | radeon_fixup_offset(rinfo); | ||
81 | |||
81 | vxres = info->var.xres_virtual; | 82 | vxres = info->var.xres_virtual; |
82 | vyres = info->var.yres_virtual; | 83 | vyres = info->var.yres_virtual; |
83 | 84 | ||
@@ -90,10 +91,6 @@ void radeonfb_fillrect(struct fb_info *info, const struct fb_fillrect *region) | |||
90 | if(modded.dx + modded.width > vxres) modded.width = vxres - modded.dx; | 91 | if(modded.dx + modded.width > vxres) modded.width = vxres - modded.dx; |
91 | if(modded.dy + modded.height > vyres) modded.height = vyres - modded.dy; | 92 | if(modded.dy + modded.height > vyres) modded.height = vyres - modded.dy; |
92 | 93 | ||
93 | if (info->fix.visual == FB_VISUAL_TRUECOLOR || | ||
94 | info->fix.visual == FB_VISUAL_DIRECTCOLOR ) | ||
95 | modded.color = ((u32 *) (info->pseudo_palette))[region->color]; | ||
96 | |||
97 | radeonfb_prim_fillrect(rinfo, &modded); | 94 | radeonfb_prim_fillrect(rinfo, &modded); |
98 | } | 95 | } |
99 | 96 | ||
@@ -112,22 +109,22 @@ static void radeonfb_prim_copyarea(struct radeonfb_info *rinfo, | |||
112 | if ( xdir < 0 ) { sx += w-1; dx += w-1; } | 109 | if ( xdir < 0 ) { sx += w-1; dx += w-1; } |
113 | if ( ydir < 0 ) { sy += h-1; dy += h-1; } | 110 | if ( ydir < 0 ) { sy += h-1; dy += h-1; } |
114 | 111 | ||
115 | radeonfb_set_creg(rinfo, DP_GUI_MASTER_CNTL, &rinfo->dp_gui_mc_cache, | 112 | radeon_fifo_wait(3); |
116 | rinfo->dp_gui_mc_base | | 113 | OUTREG(DP_GUI_MASTER_CNTL, |
117 | GMC_BRUSH_NONE | | 114 | rinfo->dp_gui_master_cntl /* i.e. GMC_DST_32BPP */ |
118 | GMC_SRC_DATATYPE_COLOR | | 115 | | GMC_BRUSH_NONE |
119 | ROP3_S | | 116 | | GMC_SRC_DSTCOLOR |
120 | DP_SRC_SOURCE_MEMORY); | 117 | | ROP3_S |
121 | radeonfb_set_creg(rinfo, DP_CNTL, &rinfo->dp_cntl_cache, | 118 | | DP_SRC_SOURCE_MEMORY ); |
122 | (xdir>=0 ? DST_X_LEFT_TO_RIGHT : 0) | | 119 | OUTREG(DP_WRITE_MSK, 0xffffffff); |
123 | (ydir>=0 ? DST_Y_TOP_TO_BOTTOM : 0)); | 120 | OUTREG(DP_CNTL, (xdir>=0 ? DST_X_LEFT_TO_RIGHT : 0) |
124 | 121 | | (ydir>=0 ? DST_Y_TOP_TO_BOTTOM : 0)); | |
125 | #if FLUSH_CACHE_WORKAROUND | 122 | |
126 | radeon_fifo_wait(rinfo, 2); | 123 | radeon_fifo_wait(2); |
127 | OUTREG(DSTCACHE_CTLSTAT, RB2D_DC_FLUSH_ALL); | 124 | OUTREG(DSTCACHE_CTLSTAT, RB2D_DC_FLUSH_ALL); |
128 | OUTREG(WAIT_UNTIL, (WAIT_2D_IDLECLEAN | WAIT_DMA_GUI_IDLE)); | 125 | OUTREG(WAIT_UNTIL, (WAIT_2D_IDLECLEAN | WAIT_DMA_GUI_IDLE)); |
129 | #endif | 126 | |
130 | radeon_fifo_wait(rinfo, 3); | 127 | radeon_fifo_wait(3); |
131 | OUTREG(SRC_Y_X, (sy << 16) | sx); | 128 | OUTREG(SRC_Y_X, (sy << 16) | sx); |
132 | OUTREG(DST_Y_X, (dy << 16) | dx); | 129 | OUTREG(DST_Y_X, (dy << 16) | dx); |
133 | OUTREG(DST_HEIGHT_WIDTH, (h << 16) | w); | 130 | OUTREG(DST_HEIGHT_WIDTH, (h << 16) | w); |
@@ -146,14 +143,15 @@ void radeonfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) | |||
146 | modded.width = area->width; | 143 | modded.width = area->width; |
147 | modded.height = area->height; | 144 | modded.height = area->height; |
148 | 145 | ||
149 | WARN_ON(rinfo->gfx_mode); | 146 | if (info->state != FBINFO_STATE_RUNNING) |
150 | if (info->state != FBINFO_STATE_RUNNING || rinfo->gfx_mode) | ||
151 | return; | 147 | return; |
152 | if (info->flags & FBINFO_HWACCEL_DISABLED) { | 148 | if (info->flags & FBINFO_HWACCEL_DISABLED) { |
153 | cfb_copyarea(info, area); | 149 | cfb_copyarea(info, area); |
154 | return; | 150 | return; |
155 | } | 151 | } |
156 | 152 | ||
153 | radeon_fixup_offset(rinfo); | ||
154 | |||
157 | vxres = info->var.xres_virtual; | 155 | vxres = info->var.xres_virtual; |
158 | vyres = info->var.yres_virtual; | 156 | vyres = info->var.yres_virtual; |
159 | 157 | ||
@@ -170,115 +168,13 @@ void radeonfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) | |||
170 | radeonfb_prim_copyarea(rinfo, &modded); | 168 | radeonfb_prim_copyarea(rinfo, &modded); |
171 | } | 169 | } |
172 | 170 | ||
173 | static void radeonfb_prim_imageblit(struct radeonfb_info *rinfo, | ||
174 | const struct fb_image *image, | ||
175 | u32 fg, u32 bg) | ||
176 | { | ||
177 | unsigned int dwords; | ||
178 | u32 *bits; | ||
179 | |||
180 | radeonfb_set_creg(rinfo, DP_GUI_MASTER_CNTL, &rinfo->dp_gui_mc_cache, | ||
181 | rinfo->dp_gui_mc_base | | ||
182 | GMC_BRUSH_NONE | GMC_DST_CLIP_LEAVE | | ||
183 | GMC_SRC_DATATYPE_MONO_FG_BG | | ||
184 | ROP3_S | | ||
185 | GMC_BYTE_ORDER_MSB_TO_LSB | | ||
186 | DP_SRC_SOURCE_HOST_DATA); | ||
187 | radeonfb_set_creg(rinfo, DP_CNTL, &rinfo->dp_cntl_cache, | ||
188 | DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM); | ||
189 | radeonfb_set_creg(rinfo, DP_SRC_FRGD_CLR, &rinfo->dp_src_fg_cache, fg); | ||
190 | radeonfb_set_creg(rinfo, DP_SRC_BKGD_CLR, &rinfo->dp_src_bg_cache, bg); | ||
191 | |||
192 | /* Ensure the dst cache is flushed and the engine idle before | ||
193 | * issuing the operation. | ||
194 | * | ||
195 | * This works around engine lockups on some cards | ||
196 | */ | ||
197 | #if FLUSH_CACHE_WORKAROUND | ||
198 | radeon_fifo_wait(rinfo, 2); | ||
199 | OUTREG(DSTCACHE_CTLSTAT, RB2D_DC_FLUSH_ALL); | ||
200 | OUTREG(WAIT_UNTIL, (WAIT_2D_IDLECLEAN | WAIT_DMA_GUI_IDLE)); | ||
201 | #endif | ||
202 | |||
203 | /* X here pads width to a multiple of 32 and uses the clipper to | ||
204 | * adjust the result. Is that really necessary ? Things seem to | ||
205 | * work ok for me without that and the doco doesn't seem to imply] | ||
206 | * there is such a restriction. | ||
207 | */ | ||
208 | radeon_fifo_wait(rinfo, 4); | ||
209 | OUTREG(SC_TOP_LEFT, (image->dy << 16) | image->dx); | ||
210 | OUTREG(SC_BOTTOM_RIGHT, ((image->dy + image->height) << 16) | | ||
211 | (image->dx + image->width)); | ||
212 | OUTREG(DST_Y_X, (image->dy << 16) | image->dx); | ||
213 | |||
214 | OUTREG(DST_HEIGHT_WIDTH, (image->height << 16) | ((image->width + 31) & ~31)); | ||
215 | |||
216 | dwords = (image->width + 31) >> 5; | ||
217 | dwords *= image->height; | ||
218 | bits = (u32*)(image->data); | ||
219 | |||
220 | while(dwords >= 8) { | ||
221 | radeon_fifo_wait(rinfo, 8); | ||
222 | #if BITS_PER_LONG == 64 | ||
223 | __raw_writeq(*((u64 *)(bits)), rinfo->mmio_base + HOST_DATA0); | ||
224 | __raw_writeq(*((u64 *)(bits+2)), rinfo->mmio_base + HOST_DATA2); | ||
225 | __raw_writeq(*((u64 *)(bits+4)), rinfo->mmio_base + HOST_DATA4); | ||
226 | __raw_writeq(*((u64 *)(bits+6)), rinfo->mmio_base + HOST_DATA6); | ||
227 | bits += 8; | ||
228 | #else | ||
229 | __raw_writel(*(bits++), rinfo->mmio_base + HOST_DATA0); | ||
230 | __raw_writel(*(bits++), rinfo->mmio_base + HOST_DATA1); | ||
231 | __raw_writel(*(bits++), rinfo->mmio_base + HOST_DATA2); | ||
232 | __raw_writel(*(bits++), rinfo->mmio_base + HOST_DATA3); | ||
233 | __raw_writel(*(bits++), rinfo->mmio_base + HOST_DATA4); | ||
234 | __raw_writel(*(bits++), rinfo->mmio_base + HOST_DATA5); | ||
235 | __raw_writel(*(bits++), rinfo->mmio_base + HOST_DATA6); | ||
236 | __raw_writel(*(bits++), rinfo->mmio_base + HOST_DATA7); | ||
237 | #endif | ||
238 | dwords -= 8; | ||
239 | } | ||
240 | while(dwords--) { | ||
241 | radeon_fifo_wait(rinfo, 1); | ||
242 | __raw_writel(*(bits++), rinfo->mmio_base + HOST_DATA0); | ||
243 | } | ||
244 | } | ||
245 | |||
246 | void radeonfb_imageblit(struct fb_info *info, const struct fb_image *image) | 171 | void radeonfb_imageblit(struct fb_info *info, const struct fb_image *image) |
247 | { | 172 | { |
248 | struct radeonfb_info *rinfo = info->par; | 173 | struct radeonfb_info *rinfo = info->par; |
249 | u32 fg, bg; | ||
250 | |||
251 | WARN_ON(rinfo->gfx_mode); | ||
252 | if (info->state != FBINFO_STATE_RUNNING || rinfo->gfx_mode) | ||
253 | return; | ||
254 | 174 | ||
255 | if (!image->width || !image->height) | 175 | if (info->state != FBINFO_STATE_RUNNING) |
256 | return; | 176 | return; |
257 | 177 | radeon_engine_idle(); | |
258 | /* We only do 1 bpp color expansion for now */ | ||
259 | if (info->flags & FBINFO_HWACCEL_DISABLED || image->depth != 1) | ||
260 | goto fallback; | ||
261 | |||
262 | /* Fallback if running out of the screen. We may do clipping | ||
263 | * in the future */ | ||
264 | if ((image->dx + image->width) > info->var.xres_virtual || | ||
265 | (image->dy + image->height) > info->var.yres_virtual) | ||
266 | goto fallback; | ||
267 | |||
268 | if (info->fix.visual == FB_VISUAL_TRUECOLOR || | ||
269 | info->fix.visual == FB_VISUAL_DIRECTCOLOR) { | ||
270 | fg = ((u32*)(info->pseudo_palette))[image->fg_color]; | ||
271 | bg = ((u32*)(info->pseudo_palette))[image->bg_color]; | ||
272 | } else { | ||
273 | fg = image->fg_color; | ||
274 | bg = image->bg_color; | ||
275 | } | ||
276 | |||
277 | radeonfb_prim_imageblit(rinfo, image, fg, bg); | ||
278 | return; | ||
279 | |||
280 | fallback: | ||
281 | radeon_engine_idle(rinfo); | ||
282 | 178 | ||
283 | cfb_imageblit(info, image); | 179 | cfb_imageblit(info, image); |
284 | } | 180 | } |
@@ -289,8 +185,7 @@ int radeonfb_sync(struct fb_info *info) | |||
289 | 185 | ||
290 | if (info->state != FBINFO_STATE_RUNNING) | 186 | if (info->state != FBINFO_STATE_RUNNING) |
291 | return 0; | 187 | return 0; |
292 | 188 | radeon_engine_idle(); | |
293 | radeon_engine_idle(rinfo); | ||
294 | 189 | ||
295 | return 0; | 190 | return 0; |
296 | } | 191 | } |
@@ -366,10 +261,9 @@ void radeonfb_engine_init (struct radeonfb_info *rinfo) | |||
366 | /* disable 3D engine */ | 261 | /* disable 3D engine */ |
367 | OUTREG(RB3D_CNTL, 0); | 262 | OUTREG(RB3D_CNTL, 0); |
368 | 263 | ||
369 | rinfo->fifo_free = 0; | ||
370 | radeonfb_engine_reset(rinfo); | 264 | radeonfb_engine_reset(rinfo); |
371 | 265 | ||
372 | radeon_fifo_wait(rinfo, 1); | 266 | radeon_fifo_wait (1); |
373 | if (IS_R300_VARIANT(rinfo)) { | 267 | if (IS_R300_VARIANT(rinfo)) { |
374 | OUTREG(RB2D_DSTCACHE_MODE, INREG(RB2D_DSTCACHE_MODE) | | 268 | OUTREG(RB2D_DSTCACHE_MODE, INREG(RB2D_DSTCACHE_MODE) | |
375 | RB2D_DC_AUTOFLUSH_ENABLE | | 269 | RB2D_DC_AUTOFLUSH_ENABLE | |
@@ -383,7 +277,7 @@ void radeonfb_engine_init (struct radeonfb_info *rinfo) | |||
383 | OUTREG(RB2D_DSTCACHE_MODE, 0); | 277 | OUTREG(RB2D_DSTCACHE_MODE, 0); |
384 | } | 278 | } |
385 | 279 | ||
386 | radeon_fifo_wait(rinfo, 3); | 280 | radeon_fifo_wait (3); |
387 | /* We re-read MC_FB_LOCATION from card as it can have been | 281 | /* We re-read MC_FB_LOCATION from card as it can have been |
388 | * modified by XFree drivers (ouch !) | 282 | * modified by XFree drivers (ouch !) |
389 | */ | 283 | */ |
@@ -394,57 +288,41 @@ void radeonfb_engine_init (struct radeonfb_info *rinfo) | |||
394 | OUTREG(DST_PITCH_OFFSET, (rinfo->pitch << 0x16) | (rinfo->fb_local_base >> 10)); | 288 | OUTREG(DST_PITCH_OFFSET, (rinfo->pitch << 0x16) | (rinfo->fb_local_base >> 10)); |
395 | OUTREG(SRC_PITCH_OFFSET, (rinfo->pitch << 0x16) | (rinfo->fb_local_base >> 10)); | 289 | OUTREG(SRC_PITCH_OFFSET, (rinfo->pitch << 0x16) | (rinfo->fb_local_base >> 10)); |
396 | 290 | ||
397 | radeon_fifo_wait(rinfo, 1); | 291 | radeon_fifo_wait (1); |
398 | #ifdef __BIG_ENDIAN | 292 | #if defined(__BIG_ENDIAN) |
399 | OUTREGP(DP_DATATYPE, HOST_BIG_ENDIAN_EN, ~HOST_BIG_ENDIAN_EN); | 293 | OUTREGP(DP_DATATYPE, HOST_BIG_ENDIAN_EN, ~HOST_BIG_ENDIAN_EN); |
400 | #else | 294 | #else |
401 | OUTREGP(DP_DATATYPE, 0, ~HOST_BIG_ENDIAN_EN); | 295 | OUTREGP(DP_DATATYPE, 0, ~HOST_BIG_ENDIAN_EN); |
402 | #endif | 296 | #endif |
403 | radeon_fifo_wait(rinfo, 2); | 297 | radeon_fifo_wait (2); |
404 | OUTREG(DEFAULT_SC_TOP_LEFT, 0); | 298 | OUTREG(DEFAULT_SC_TOP_LEFT, 0); |
405 | OUTREG(DEFAULT_SC_BOTTOM_RIGHT, (DEFAULT_SC_RIGHT_MAX | | 299 | OUTREG(DEFAULT_SC_BOTTOM_RIGHT, (DEFAULT_SC_RIGHT_MAX | |
406 | DEFAULT_SC_BOTTOM_MAX)); | 300 | DEFAULT_SC_BOTTOM_MAX)); |
407 | 301 | ||
408 | /* set default DP_GUI_MASTER_CNTL */ | ||
409 | temp = radeon_get_dstbpp(rinfo->depth); | 302 | temp = radeon_get_dstbpp(rinfo->depth); |
410 | rinfo->dp_gui_mc_base = ((temp << 8) | GMC_CLR_CMP_CNTL_DIS); | 303 | rinfo->dp_gui_master_cntl = ((temp << 8) | GMC_CLR_CMP_CNTL_DIS); |
411 | 304 | ||
412 | rinfo->dp_gui_mc_cache = rinfo->dp_gui_mc_base | | 305 | radeon_fifo_wait (1); |
413 | GMC_BRUSH_SOLID_COLOR | | 306 | OUTREG(DP_GUI_MASTER_CNTL, (rinfo->dp_gui_master_cntl | |
414 | GMC_SRC_DATATYPE_COLOR; | 307 | GMC_BRUSH_SOLID_COLOR | |
415 | radeon_fifo_wait(rinfo, 1); | 308 | GMC_SRC_DATATYPE_COLOR)); |
416 | OUTREG(DP_GUI_MASTER_CNTL, rinfo->dp_gui_mc_cache); | ||
417 | 309 | ||
310 | radeon_fifo_wait (7); | ||
418 | 311 | ||
419 | /* clear line drawing regs */ | 312 | /* clear line drawing regs */ |
420 | radeon_fifo_wait(rinfo, 2); | ||
421 | OUTREG(DST_LINE_START, 0); | 313 | OUTREG(DST_LINE_START, 0); |
422 | OUTREG(DST_LINE_END, 0); | 314 | OUTREG(DST_LINE_END, 0); |
423 | 315 | ||
424 | /* set brush and source color regs */ | 316 | /* set brush color regs */ |
425 | rinfo->dp_brush_fg_cache = 0xffffffff; | 317 | OUTREG(DP_BRUSH_FRGD_CLR, 0xffffffff); |
426 | rinfo->dp_brush_bg_cache = 0x00000000; | 318 | OUTREG(DP_BRUSH_BKGD_CLR, 0x00000000); |
427 | rinfo->dp_src_fg_cache = 0xffffffff; | 319 | |
428 | rinfo->dp_src_bg_cache = 0x00000000; | 320 | /* set source color regs */ |
429 | radeon_fifo_wait(rinfo, 4); | 321 | OUTREG(DP_SRC_FRGD_CLR, 0xffffffff); |
430 | OUTREG(DP_BRUSH_FRGD_CLR, rinfo->dp_brush_fg_cache); | 322 | OUTREG(DP_SRC_BKGD_CLR, 0x00000000); |
431 | OUTREG(DP_BRUSH_BKGD_CLR, rinfo->dp_brush_bg_cache); | ||
432 | OUTREG(DP_SRC_FRGD_CLR, rinfo->dp_src_fg_cache); | ||
433 | OUTREG(DP_SRC_BKGD_CLR, rinfo->dp_src_bg_cache); | ||
434 | |||
435 | /* Default direction */ | ||
436 | rinfo->dp_cntl_cache = DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM; | ||
437 | radeon_fifo_wait(rinfo, 1); | ||
438 | OUTREG(DP_CNTL, rinfo->dp_cntl_cache); | ||
439 | 323 | ||
440 | /* default write mask */ | 324 | /* default write mask */ |
441 | radeon_fifo_wait(rinfo, 1); | ||
442 | OUTREG(DP_WRITE_MSK, 0xffffffff); | 325 | OUTREG(DP_WRITE_MSK, 0xffffffff); |
443 | 326 | ||
444 | /* Default to no swapping of host data */ | 327 | radeon_engine_idle (); |
445 | radeon_fifo_wait(rinfo, 1); | ||
446 | OUTREG(RBBM_GUICNTL, RBBM_GUICNTL_HOST_DATA_SWAP_NONE); | ||
447 | |||
448 | /* Make sure it's settled */ | ||
449 | radeon_engine_idle(rinfo); | ||
450 | } | 328 | } |