diff options
-rw-r--r-- | drivers/video/aty/radeon_accel.c | 295 | ||||
-rw-r--r-- | drivers/video/aty/radeon_backlight.c | 2 | ||||
-rw-r--r-- | drivers/video/aty/radeon_base.c | 46 | ||||
-rw-r--r-- | drivers/video/aty/radeon_pm.c | 6 | ||||
-rw-r--r-- | drivers/video/aty/radeonfb.h | 40 | ||||
-rw-r--r-- | include/video/radeon.h | 18 |
6 files changed, 127 insertions, 280 deletions
diff --git a/drivers/video/aty/radeon_accel.c b/drivers/video/aty/radeon_accel.c index 8da5e5ab8547..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,116 +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 | 174 | ||
251 | WARN_ON(rinfo->gfx_mode); | 175 | if (info->state != FBINFO_STATE_RUNNING) |
252 | if (info->state != FBINFO_STATE_RUNNING || rinfo->gfx_mode) | ||
253 | return; | ||
254 | |||
255 | if (!image->width || !image->height) | ||
256 | return; | 176 | return; |
257 | 177 | radeon_engine_idle(); | |
258 | /* We only do 1 bpp color expansion for now */ | ||
259 | if (!accel_cexp || | ||
260 | (info->flags & FBINFO_HWACCEL_DISABLED) || image->depth != 1) | ||
261 | goto fallback; | ||
262 | |||
263 | /* Fallback if running out of the screen. We may do clipping | ||
264 | * in the future */ | ||
265 | if ((image->dx + image->width) > info->var.xres_virtual || | ||
266 | (image->dy + image->height) > info->var.yres_virtual) | ||
267 | goto fallback; | ||
268 | |||
269 | if (info->fix.visual == FB_VISUAL_TRUECOLOR || | ||
270 | info->fix.visual == FB_VISUAL_DIRECTCOLOR) { | ||
271 | fg = ((u32*)(info->pseudo_palette))[image->fg_color]; | ||
272 | bg = ((u32*)(info->pseudo_palette))[image->bg_color]; | ||
273 | } else { | ||
274 | fg = image->fg_color; | ||
275 | bg = image->bg_color; | ||
276 | } | ||
277 | |||
278 | radeonfb_prim_imageblit(rinfo, image, fg, bg); | ||
279 | return; | ||
280 | |||
281 | fallback: | ||
282 | radeon_engine_idle(rinfo); | ||
283 | 178 | ||
284 | cfb_imageblit(info, image); | 179 | cfb_imageblit(info, image); |
285 | } | 180 | } |
@@ -290,8 +185,7 @@ int radeonfb_sync(struct fb_info *info) | |||
290 | 185 | ||
291 | if (info->state != FBINFO_STATE_RUNNING) | 186 | if (info->state != FBINFO_STATE_RUNNING) |
292 | return 0; | 187 | return 0; |
293 | 188 | radeon_engine_idle(); | |
294 | radeon_engine_idle(rinfo); | ||
295 | 189 | ||
296 | return 0; | 190 | return 0; |
297 | } | 191 | } |
@@ -367,10 +261,9 @@ void radeonfb_engine_init (struct radeonfb_info *rinfo) | |||
367 | /* disable 3D engine */ | 261 | /* disable 3D engine */ |
368 | OUTREG(RB3D_CNTL, 0); | 262 | OUTREG(RB3D_CNTL, 0); |
369 | 263 | ||
370 | rinfo->fifo_free = 0; | ||
371 | radeonfb_engine_reset(rinfo); | 264 | radeonfb_engine_reset(rinfo); |
372 | 265 | ||
373 | radeon_fifo_wait(rinfo, 1); | 266 | radeon_fifo_wait (1); |
374 | if (IS_R300_VARIANT(rinfo)) { | 267 | if (IS_R300_VARIANT(rinfo)) { |
375 | OUTREG(RB2D_DSTCACHE_MODE, INREG(RB2D_DSTCACHE_MODE) | | 268 | OUTREG(RB2D_DSTCACHE_MODE, INREG(RB2D_DSTCACHE_MODE) | |
376 | RB2D_DC_AUTOFLUSH_ENABLE | | 269 | RB2D_DC_AUTOFLUSH_ENABLE | |
@@ -384,7 +277,7 @@ void radeonfb_engine_init (struct radeonfb_info *rinfo) | |||
384 | OUTREG(RB2D_DSTCACHE_MODE, 0); | 277 | OUTREG(RB2D_DSTCACHE_MODE, 0); |
385 | } | 278 | } |
386 | 279 | ||
387 | radeon_fifo_wait(rinfo, 3); | 280 | radeon_fifo_wait (3); |
388 | /* 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 |
389 | * modified by XFree drivers (ouch !) | 282 | * modified by XFree drivers (ouch !) |
390 | */ | 283 | */ |
@@ -395,57 +288,41 @@ void radeonfb_engine_init (struct radeonfb_info *rinfo) | |||
395 | 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)); |
396 | 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)); |
397 | 290 | ||
398 | radeon_fifo_wait(rinfo, 1); | 291 | radeon_fifo_wait (1); |
399 | #ifdef __BIG_ENDIAN | 292 | #if defined(__BIG_ENDIAN) |
400 | OUTREGP(DP_DATATYPE, HOST_BIG_ENDIAN_EN, ~HOST_BIG_ENDIAN_EN); | 293 | OUTREGP(DP_DATATYPE, HOST_BIG_ENDIAN_EN, ~HOST_BIG_ENDIAN_EN); |
401 | #else | 294 | #else |
402 | OUTREGP(DP_DATATYPE, 0, ~HOST_BIG_ENDIAN_EN); | 295 | OUTREGP(DP_DATATYPE, 0, ~HOST_BIG_ENDIAN_EN); |
403 | #endif | 296 | #endif |
404 | radeon_fifo_wait(rinfo, 2); | 297 | radeon_fifo_wait (2); |
405 | OUTREG(DEFAULT_SC_TOP_LEFT, 0); | 298 | OUTREG(DEFAULT_SC_TOP_LEFT, 0); |
406 | OUTREG(DEFAULT_SC_BOTTOM_RIGHT, (DEFAULT_SC_RIGHT_MAX | | 299 | OUTREG(DEFAULT_SC_BOTTOM_RIGHT, (DEFAULT_SC_RIGHT_MAX | |
407 | DEFAULT_SC_BOTTOM_MAX)); | 300 | DEFAULT_SC_BOTTOM_MAX)); |
408 | 301 | ||
409 | /* set default DP_GUI_MASTER_CNTL */ | ||
410 | temp = radeon_get_dstbpp(rinfo->depth); | 302 | temp = radeon_get_dstbpp(rinfo->depth); |
411 | 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); |
412 | 304 | ||
413 | rinfo->dp_gui_mc_cache = rinfo->dp_gui_mc_base | | 305 | radeon_fifo_wait (1); |
414 | GMC_BRUSH_SOLID_COLOR | | 306 | OUTREG(DP_GUI_MASTER_CNTL, (rinfo->dp_gui_master_cntl | |
415 | GMC_SRC_DATATYPE_COLOR; | 307 | GMC_BRUSH_SOLID_COLOR | |
416 | radeon_fifo_wait(rinfo, 1); | 308 | GMC_SRC_DATATYPE_COLOR)); |
417 | OUTREG(DP_GUI_MASTER_CNTL, rinfo->dp_gui_mc_cache); | ||
418 | 309 | ||
310 | radeon_fifo_wait (7); | ||
419 | 311 | ||
420 | /* clear line drawing regs */ | 312 | /* clear line drawing regs */ |
421 | radeon_fifo_wait(rinfo, 2); | ||
422 | OUTREG(DST_LINE_START, 0); | 313 | OUTREG(DST_LINE_START, 0); |
423 | OUTREG(DST_LINE_END, 0); | 314 | OUTREG(DST_LINE_END, 0); |
424 | 315 | ||
425 | /* set brush and source color regs */ | 316 | /* set brush color regs */ |
426 | rinfo->dp_brush_fg_cache = 0xffffffff; | 317 | OUTREG(DP_BRUSH_FRGD_CLR, 0xffffffff); |
427 | rinfo->dp_brush_bg_cache = 0x00000000; | 318 | OUTREG(DP_BRUSH_BKGD_CLR, 0x00000000); |
428 | rinfo->dp_src_fg_cache = 0xffffffff; | 319 | |
429 | rinfo->dp_src_bg_cache = 0x00000000; | 320 | /* set source color regs */ |
430 | radeon_fifo_wait(rinfo, 4); | 321 | OUTREG(DP_SRC_FRGD_CLR, 0xffffffff); |
431 | OUTREG(DP_BRUSH_FRGD_CLR, rinfo->dp_brush_fg_cache); | 322 | OUTREG(DP_SRC_BKGD_CLR, 0x00000000); |
432 | OUTREG(DP_BRUSH_BKGD_CLR, rinfo->dp_brush_bg_cache); | ||
433 | OUTREG(DP_SRC_FRGD_CLR, rinfo->dp_src_fg_cache); | ||
434 | OUTREG(DP_SRC_BKGD_CLR, rinfo->dp_src_bg_cache); | ||
435 | |||
436 | /* Default direction */ | ||
437 | rinfo->dp_cntl_cache = DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM; | ||
438 | radeon_fifo_wait(rinfo, 1); | ||
439 | OUTREG(DP_CNTL, rinfo->dp_cntl_cache); | ||
440 | 323 | ||
441 | /* default write mask */ | 324 | /* default write mask */ |
442 | radeon_fifo_wait(rinfo, 1); | ||
443 | OUTREG(DP_WRITE_MSK, 0xffffffff); | 325 | OUTREG(DP_WRITE_MSK, 0xffffffff); |
444 | 326 | ||
445 | /* Default to no swapping of host data */ | 327 | radeon_engine_idle (); |
446 | radeon_fifo_wait(rinfo, 1); | ||
447 | OUTREG(RBBM_GUICNTL, RBBM_GUICNTL_HOST_DATA_SWAP_NONE); | ||
448 | |||
449 | /* Make sure it's settled */ | ||
450 | radeon_engine_idle(rinfo); | ||
451 | } | 328 | } |
diff --git a/drivers/video/aty/radeon_backlight.c b/drivers/video/aty/radeon_backlight.c index f343ba83f0ae..1a056adb61c8 100644 --- a/drivers/video/aty/radeon_backlight.c +++ b/drivers/video/aty/radeon_backlight.c | |||
@@ -66,7 +66,7 @@ static int radeon_bl_update_status(struct backlight_device *bd) | |||
66 | level = bd->props.brightness; | 66 | level = bd->props.brightness; |
67 | 67 | ||
68 | del_timer_sync(&rinfo->lvds_timer); | 68 | del_timer_sync(&rinfo->lvds_timer); |
69 | radeon_engine_idle(rinfo); | 69 | radeon_engine_idle(); |
70 | 70 | ||
71 | lvds_gen_cntl = INREG(LVDS_GEN_CNTL); | 71 | lvds_gen_cntl = INREG(LVDS_GEN_CNTL); |
72 | if (level > 0) { | 72 | if (level > 0) { |
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index d5b27f9d374d..d0f1a7fc2c9d 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c | |||
@@ -282,8 +282,6 @@ static int backlight = 1; | |||
282 | static int backlight = 0; | 282 | static int backlight = 0; |
283 | #endif | 283 | #endif |
284 | 284 | ||
285 | int accel_cexp = 0; | ||
286 | |||
287 | /* | 285 | /* |
288 | * prototypes | 286 | * prototypes |
289 | */ | 287 | */ |
@@ -854,6 +852,7 @@ static int radeonfb_pan_display (struct fb_var_screeninfo *var, | |||
854 | if (rinfo->asleep) | 852 | if (rinfo->asleep) |
855 | return 0; | 853 | return 0; |
856 | 854 | ||
855 | radeon_fifo_wait(2); | ||
857 | OUTREG(CRTC_OFFSET, ((var->yoffset * var->xres_virtual + var->xoffset) | 856 | OUTREG(CRTC_OFFSET, ((var->yoffset * var->xres_virtual + var->xoffset) |
858 | * var->bits_per_pixel / 8) & ~7); | 857 | * var->bits_per_pixel / 8) & ~7); |
859 | return 0; | 858 | return 0; |
@@ -883,6 +882,7 @@ static int radeonfb_ioctl (struct fb_info *info, unsigned int cmd, | |||
883 | if (rc) | 882 | if (rc) |
884 | return rc; | 883 | return rc; |
885 | 884 | ||
885 | radeon_fifo_wait(2); | ||
886 | if (value & 0x01) { | 886 | if (value & 0x01) { |
887 | tmp = INREG(LVDS_GEN_CNTL); | 887 | tmp = INREG(LVDS_GEN_CNTL); |
888 | 888 | ||
@@ -940,7 +940,7 @@ int radeon_screen_blank(struct radeonfb_info *rinfo, int blank, int mode_switch) | |||
940 | if (rinfo->lock_blank) | 940 | if (rinfo->lock_blank) |
941 | return 0; | 941 | return 0; |
942 | 942 | ||
943 | radeon_engine_idle(rinfo); | 943 | radeon_engine_idle(); |
944 | 944 | ||
945 | val = INREG(CRTC_EXT_CNTL); | 945 | val = INREG(CRTC_EXT_CNTL); |
946 | val &= ~(CRTC_DISPLAY_DIS | CRTC_HSYNC_DIS | | 946 | val &= ~(CRTC_DISPLAY_DIS | CRTC_HSYNC_DIS | |
@@ -1048,7 +1048,7 @@ static int radeonfb_blank (int blank, struct fb_info *info) | |||
1048 | 1048 | ||
1049 | if (rinfo->asleep) | 1049 | if (rinfo->asleep) |
1050 | return 0; | 1050 | return 0; |
1051 | 1051 | ||
1052 | return radeon_screen_blank(rinfo, blank, 0); | 1052 | return radeon_screen_blank(rinfo, blank, 0); |
1053 | } | 1053 | } |
1054 | 1054 | ||
@@ -1074,6 +1074,8 @@ static int radeon_setcolreg (unsigned regno, unsigned red, unsigned green, | |||
1074 | pindex = regno; | 1074 | pindex = regno; |
1075 | 1075 | ||
1076 | if (!rinfo->asleep) { | 1076 | if (!rinfo->asleep) { |
1077 | radeon_fifo_wait(9); | ||
1078 | |||
1077 | if (rinfo->bpp == 16) { | 1079 | if (rinfo->bpp == 16) { |
1078 | pindex = regno * 8; | 1080 | pindex = regno * 8; |
1079 | 1081 | ||
@@ -1242,6 +1244,8 @@ static void radeon_write_pll_regs(struct radeonfb_info *rinfo, struct radeon_reg | |||
1242 | { | 1244 | { |
1243 | int i; | 1245 | int i; |
1244 | 1246 | ||
1247 | radeon_fifo_wait(20); | ||
1248 | |||
1245 | /* Workaround from XFree */ | 1249 | /* Workaround from XFree */ |
1246 | if (rinfo->is_mobility) { | 1250 | if (rinfo->is_mobility) { |
1247 | /* A temporal workaround for the occational blanking on certain laptop | 1251 | /* A temporal workaround for the occational blanking on certain laptop |
@@ -1337,7 +1341,7 @@ static void radeon_lvds_timer_func(unsigned long data) | |||
1337 | { | 1341 | { |
1338 | struct radeonfb_info *rinfo = (struct radeonfb_info *)data; | 1342 | struct radeonfb_info *rinfo = (struct radeonfb_info *)data; |
1339 | 1343 | ||
1340 | radeon_engine_idle(rinfo); | 1344 | radeon_engine_idle(); |
1341 | 1345 | ||
1342 | OUTREG(LVDS_GEN_CNTL, rinfo->pending_lvds_gen_cntl); | 1346 | OUTREG(LVDS_GEN_CNTL, rinfo->pending_lvds_gen_cntl); |
1343 | } | 1347 | } |
@@ -1355,11 +1359,10 @@ void radeon_write_mode (struct radeonfb_info *rinfo, struct radeon_regs *mode, | |||
1355 | if (nomodeset) | 1359 | if (nomodeset) |
1356 | return; | 1360 | return; |
1357 | 1361 | ||
1358 | radeon_engine_idle(rinfo); | ||
1359 | |||
1360 | if (!regs_only) | 1362 | if (!regs_only) |
1361 | radeon_screen_blank(rinfo, FB_BLANK_NORMAL, 0); | 1363 | radeon_screen_blank(rinfo, FB_BLANK_NORMAL, 0); |
1362 | 1364 | ||
1365 | radeon_fifo_wait(31); | ||
1363 | for (i=0; i<10; i++) | 1366 | for (i=0; i<10; i++) |
1364 | OUTREG(common_regs[i].reg, common_regs[i].val); | 1367 | OUTREG(common_regs[i].reg, common_regs[i].val); |
1365 | 1368 | ||
@@ -1387,6 +1390,7 @@ void radeon_write_mode (struct radeonfb_info *rinfo, struct radeon_regs *mode, | |||
1387 | radeon_write_pll_regs(rinfo, mode); | 1390 | radeon_write_pll_regs(rinfo, mode); |
1388 | 1391 | ||
1389 | if ((primary_mon == MT_DFP) || (primary_mon == MT_LCD)) { | 1392 | if ((primary_mon == MT_DFP) || (primary_mon == MT_LCD)) { |
1393 | radeon_fifo_wait(10); | ||
1390 | OUTREG(FP_CRTC_H_TOTAL_DISP, mode->fp_crtc_h_total_disp); | 1394 | OUTREG(FP_CRTC_H_TOTAL_DISP, mode->fp_crtc_h_total_disp); |
1391 | OUTREG(FP_CRTC_V_TOTAL_DISP, mode->fp_crtc_v_total_disp); | 1395 | OUTREG(FP_CRTC_V_TOTAL_DISP, mode->fp_crtc_v_total_disp); |
1392 | OUTREG(FP_H_SYNC_STRT_WID, mode->fp_h_sync_strt_wid); | 1396 | OUTREG(FP_H_SYNC_STRT_WID, mode->fp_h_sync_strt_wid); |
@@ -1401,6 +1405,7 @@ void radeon_write_mode (struct radeonfb_info *rinfo, struct radeon_regs *mode, | |||
1401 | if (!regs_only) | 1405 | if (!regs_only) |
1402 | radeon_screen_blank(rinfo, FB_BLANK_UNBLANK, 0); | 1406 | radeon_screen_blank(rinfo, FB_BLANK_UNBLANK, 0); |
1403 | 1407 | ||
1408 | radeon_fifo_wait(2); | ||
1404 | OUTPLL(VCLK_ECP_CNTL, mode->vclk_ecp_cntl); | 1409 | OUTPLL(VCLK_ECP_CNTL, mode->vclk_ecp_cntl); |
1405 | 1410 | ||
1406 | return; | 1411 | return; |
@@ -1551,7 +1556,7 @@ static int radeonfb_set_par(struct fb_info *info) | |||
1551 | /* We always want engine to be idle on a mode switch, even | 1556 | /* We always want engine to be idle on a mode switch, even |
1552 | * if we won't actually change the mode | 1557 | * if we won't actually change the mode |
1553 | */ | 1558 | */ |
1554 | radeon_engine_idle(rinfo); | 1559 | radeon_engine_idle(); |
1555 | 1560 | ||
1556 | hSyncStart = mode->xres + mode->right_margin; | 1561 | hSyncStart = mode->xres + mode->right_margin; |
1557 | hSyncEnd = hSyncStart + mode->hsync_len; | 1562 | hSyncEnd = hSyncStart + mode->hsync_len; |
@@ -1846,6 +1851,7 @@ static int radeonfb_set_par(struct fb_info *info) | |||
1846 | return 0; | 1851 | return 0; |
1847 | } | 1852 | } |
1848 | 1853 | ||
1854 | |||
1849 | static struct fb_ops radeonfb_ops = { | 1855 | static struct fb_ops radeonfb_ops = { |
1850 | .owner = THIS_MODULE, | 1856 | .owner = THIS_MODULE, |
1851 | .fb_check_var = radeonfb_check_var, | 1857 | .fb_check_var = radeonfb_check_var, |
@@ -1869,7 +1875,6 @@ static int __devinit radeon_set_fbinfo (struct radeonfb_info *rinfo) | |||
1869 | info->par = rinfo; | 1875 | info->par = rinfo; |
1870 | info->pseudo_palette = rinfo->pseudo_palette; | 1876 | info->pseudo_palette = rinfo->pseudo_palette; |
1871 | info->flags = FBINFO_DEFAULT | 1877 | info->flags = FBINFO_DEFAULT |
1872 | | FBINFO_HWACCEL_IMAGEBLIT | ||
1873 | | FBINFO_HWACCEL_COPYAREA | 1878 | | FBINFO_HWACCEL_COPYAREA |
1874 | | FBINFO_HWACCEL_FILLRECT | 1879 | | FBINFO_HWACCEL_FILLRECT |
1875 | | FBINFO_HWACCEL_XPAN | 1880 | | FBINFO_HWACCEL_XPAN |
@@ -1877,7 +1882,6 @@ static int __devinit radeon_set_fbinfo (struct radeonfb_info *rinfo) | |||
1877 | info->fbops = &radeonfb_ops; | 1882 | info->fbops = &radeonfb_ops; |
1878 | info->screen_base = rinfo->fb_base; | 1883 | info->screen_base = rinfo->fb_base; |
1879 | info->screen_size = rinfo->mapped_vram; | 1884 | info->screen_size = rinfo->mapped_vram; |
1880 | |||
1881 | /* Fill fix common fields */ | 1885 | /* Fill fix common fields */ |
1882 | strlcpy(info->fix.id, rinfo->name, sizeof(info->fix.id)); | 1886 | strlcpy(info->fix.id, rinfo->name, sizeof(info->fix.id)); |
1883 | info->fix.smem_start = rinfo->fb_base_phys; | 1887 | info->fix.smem_start = rinfo->fb_base_phys; |
@@ -1892,25 +1896,8 @@ static int __devinit radeon_set_fbinfo (struct radeonfb_info *rinfo) | |||
1892 | info->fix.mmio_len = RADEON_REGSIZE; | 1896 | info->fix.mmio_len = RADEON_REGSIZE; |
1893 | info->fix.accel = FB_ACCEL_ATI_RADEON; | 1897 | info->fix.accel = FB_ACCEL_ATI_RADEON; |
1894 | 1898 | ||
1895 | /* Allocate colormap */ | ||
1896 | fb_alloc_cmap(&info->cmap, 256, 0); | 1899 | fb_alloc_cmap(&info->cmap, 256, 0); |
1897 | 1900 | ||
1898 | /* Setup pixmap used for acceleration */ | ||
1899 | #define PIXMAP_SIZE (2048 * 4) | ||
1900 | |||
1901 | info->pixmap.addr = kmalloc(PIXMAP_SIZE, GFP_KERNEL); | ||
1902 | if (!info->pixmap.addr) { | ||
1903 | printk(KERN_ERR "radeonfb: Failed to allocate pixmap !\n"); | ||
1904 | noaccel = 1; | ||
1905 | goto bail; | ||
1906 | } | ||
1907 | info->pixmap.size = PIXMAP_SIZE; | ||
1908 | info->pixmap.flags = FB_PIXMAP_SYSTEM; | ||
1909 | info->pixmap.scan_align = 4; | ||
1910 | info->pixmap.buf_align = 4; | ||
1911 | info->pixmap.access_align = 32; | ||
1912 | |||
1913 | bail: | ||
1914 | if (noaccel) | 1901 | if (noaccel) |
1915 | info->flags |= FBINFO_HWACCEL_DISABLED; | 1902 | info->flags |= FBINFO_HWACCEL_DISABLED; |
1916 | 1903 | ||
@@ -2019,6 +2006,7 @@ static void radeon_identify_vram(struct radeonfb_info *rinfo) | |||
2019 | u32 tom = INREG(NB_TOM); | 2006 | u32 tom = INREG(NB_TOM); |
2020 | tmp = ((((tom >> 16) - (tom & 0xffff) + 1) << 6) * 1024); | 2007 | tmp = ((((tom >> 16) - (tom & 0xffff) + 1) << 6) * 1024); |
2021 | 2008 | ||
2009 | radeon_fifo_wait(6); | ||
2022 | OUTREG(MC_FB_LOCATION, tom); | 2010 | OUTREG(MC_FB_LOCATION, tom); |
2023 | OUTREG(DISPLAY_BASE_ADDR, (tom & 0xffff) << 16); | 2011 | OUTREG(DISPLAY_BASE_ADDR, (tom & 0xffff) << 16); |
2024 | OUTREG(CRTC2_DISPLAY_BASE_ADDR, (tom & 0xffff) << 16); | 2012 | OUTREG(CRTC2_DISPLAY_BASE_ADDR, (tom & 0xffff) << 16); |
@@ -2522,8 +2510,6 @@ static int __init radeonfb_setup (char *options) | |||
2522 | } else if (!strncmp(this_opt, "ignore_devlist", 14)) { | 2510 | } else if (!strncmp(this_opt, "ignore_devlist", 14)) { |
2523 | ignore_devlist = 1; | 2511 | ignore_devlist = 1; |
2524 | #endif | 2512 | #endif |
2525 | } else if (!strncmp(this_opt, "accel_cexp", 12)) { | ||
2526 | accel_cexp = 1; | ||
2527 | } else | 2513 | } else |
2528 | mode_option = this_opt; | 2514 | mode_option = this_opt; |
2529 | } | 2515 | } |
@@ -2571,8 +2557,6 @@ module_param(monitor_layout, charp, 0); | |||
2571 | MODULE_PARM_DESC(monitor_layout, "Specify monitor mapping (like XFree86)"); | 2557 | MODULE_PARM_DESC(monitor_layout, "Specify monitor mapping (like XFree86)"); |
2572 | module_param(force_measure_pll, bool, 0); | 2558 | module_param(force_measure_pll, bool, 0); |
2573 | MODULE_PARM_DESC(force_measure_pll, "Force measurement of PLL (debug)"); | 2559 | MODULE_PARM_DESC(force_measure_pll, "Force measurement of PLL (debug)"); |
2574 | module_param(accel_cexp, bool, 0); | ||
2575 | MODULE_PARM_DESC(accel_cexp, "Use acceleration engine for color expansion"); | ||
2576 | #ifdef CONFIG_MTRR | 2560 | #ifdef CONFIG_MTRR |
2577 | module_param(nomtrr, bool, 0); | 2561 | module_param(nomtrr, bool, 0); |
2578 | MODULE_PARM_DESC(nomtrr, "bool: disable use of MTRR registers"); | 2562 | MODULE_PARM_DESC(nomtrr, "bool: disable use of MTRR registers"); |
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c index 3df5015f1d13..675abdafc2d8 100644 --- a/drivers/video/aty/radeon_pm.c +++ b/drivers/video/aty/radeon_pm.c | |||
@@ -2653,9 +2653,9 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg) | |||
2653 | 2653 | ||
2654 | if (!(info->flags & FBINFO_HWACCEL_DISABLED)) { | 2654 | if (!(info->flags & FBINFO_HWACCEL_DISABLED)) { |
2655 | /* Make sure engine is reset */ | 2655 | /* Make sure engine is reset */ |
2656 | radeon_engine_idle(rinfo); | 2656 | radeon_engine_idle(); |
2657 | radeonfb_engine_reset(rinfo); | 2657 | radeonfb_engine_reset(rinfo); |
2658 | radeon_engine_idle(rinfo); | 2658 | radeon_engine_idle(); |
2659 | } | 2659 | } |
2660 | 2660 | ||
2661 | /* Blank display and LCD */ | 2661 | /* Blank display and LCD */ |
@@ -2767,7 +2767,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev) | |||
2767 | 2767 | ||
2768 | rinfo->asleep = 0; | 2768 | rinfo->asleep = 0; |
2769 | } else | 2769 | } else |
2770 | radeon_engine_idle(rinfo); | 2770 | radeon_engine_idle(); |
2771 | 2771 | ||
2772 | /* Restore display & engine */ | 2772 | /* Restore display & engine */ |
2773 | radeon_write_mode (rinfo, &rinfo->state, 1); | 2773 | radeon_write_mode (rinfo, &rinfo->state, 1); |
diff --git a/drivers/video/aty/radeonfb.h b/drivers/video/aty/radeonfb.h index 974ca6d86540..3ea1b00fdd22 100644 --- a/drivers/video/aty/radeonfb.h +++ b/drivers/video/aty/radeonfb.h | |||
@@ -336,15 +336,7 @@ struct radeonfb_info { | |||
336 | int mon2_type; | 336 | int mon2_type; |
337 | u8 *mon2_EDID; | 337 | u8 *mon2_EDID; |
338 | 338 | ||
339 | /* accel bits */ | 339 | u32 dp_gui_master_cntl; |
340 | u32 dp_gui_mc_base; | ||
341 | u32 dp_gui_mc_cache; | ||
342 | u32 dp_cntl_cache; | ||
343 | u32 dp_brush_fg_cache; | ||
344 | u32 dp_brush_bg_cache; | ||
345 | u32 dp_src_fg_cache; | ||
346 | u32 dp_src_bg_cache; | ||
347 | u32 fifo_free; | ||
348 | 340 | ||
349 | struct pll_info pll; | 341 | struct pll_info pll; |
350 | 342 | ||
@@ -356,7 +348,6 @@ struct radeonfb_info { | |||
356 | int lock_blank; | 348 | int lock_blank; |
357 | int dynclk; | 349 | int dynclk; |
358 | int no_schedule; | 350 | int no_schedule; |
359 | int gfx_mode; | ||
360 | enum radeon_pm_mode pm_mode; | 351 | enum radeon_pm_mode pm_mode; |
361 | reinit_function_ptr reinit_func; | 352 | reinit_function_ptr reinit_func; |
362 | 353 | ||
@@ -401,14 +392,8 @@ static inline void _radeon_msleep(struct radeonfb_info *rinfo, unsigned long ms) | |||
401 | #define OUTREG8(addr,val) writeb(val, (rinfo->mmio_base)+addr) | 392 | #define OUTREG8(addr,val) writeb(val, (rinfo->mmio_base)+addr) |
402 | #define INREG16(addr) readw((rinfo->mmio_base)+addr) | 393 | #define INREG16(addr) readw((rinfo->mmio_base)+addr) |
403 | #define OUTREG16(addr,val) writew(val, (rinfo->mmio_base)+addr) | 394 | #define OUTREG16(addr,val) writew(val, (rinfo->mmio_base)+addr) |
404 | |||
405 | #ifdef CONFIG_PPC | ||
406 | #define INREG(addr) ({ eieio(); ld_le32(rinfo->mmio_base+(addr)); }) | ||
407 | #define OUTREG(addr,val) do { eieio(); st_le32(rinfo->mmio_base+(addr),(val)); } while(0) | ||
408 | #else | ||
409 | #define INREG(addr) readl((rinfo->mmio_base)+addr) | 395 | #define INREG(addr) readl((rinfo->mmio_base)+addr) |
410 | #define OUTREG(addr,val) writel(val, (rinfo->mmio_base)+addr) | 396 | #define OUTREG(addr,val) writel(val, (rinfo->mmio_base)+addr) |
411 | #endif | ||
412 | 397 | ||
413 | static inline void _OUTREGP(struct radeonfb_info *rinfo, u32 addr, | 398 | static inline void _OUTREGP(struct radeonfb_info *rinfo, u32 addr, |
414 | u32 val, u32 mask) | 399 | u32 val, u32 mask) |
@@ -550,7 +535,17 @@ static inline u32 radeon_get_dstbpp(u16 depth) | |||
550 | * 2D Engine helper routines | 535 | * 2D Engine helper routines |
551 | */ | 536 | */ |
552 | 537 | ||
553 | extern void radeon_fifo_update_and_wait(struct radeonfb_info *rinfo, int entries); | 538 | static inline void _radeon_fifo_wait(struct radeonfb_info *rinfo, int entries) |
539 | { | ||
540 | int i; | ||
541 | |||
542 | for (i=0; i<2000000; i++) { | ||
543 | if ((INREG(RBBM_STATUS) & 0x7f) >= entries) | ||
544 | return; | ||
545 | udelay(1); | ||
546 | } | ||
547 | printk(KERN_ERR "radeonfb: FIFO Timeout !\n"); | ||
548 | } | ||
554 | 549 | ||
555 | static inline void radeon_engine_flush (struct radeonfb_info *rinfo) | 550 | static inline void radeon_engine_flush (struct radeonfb_info *rinfo) |
556 | { | 551 | { |
@@ -563,7 +558,7 @@ static inline void radeon_engine_flush (struct radeonfb_info *rinfo) | |||
563 | /* Ensure FIFO is empty, ie, make sure the flush commands | 558 | /* Ensure FIFO is empty, ie, make sure the flush commands |
564 | * has reached the cache | 559 | * has reached the cache |
565 | */ | 560 | */ |
566 | radeon_fifo_update_and_wait(rinfo, 64); | 561 | _radeon_fifo_wait (rinfo, 64); |
567 | 562 | ||
568 | /* Wait for the flush to complete */ | 563 | /* Wait for the flush to complete */ |
569 | for (i=0; i < 2000000; i++) { | 564 | for (i=0; i < 2000000; i++) { |
@@ -575,12 +570,12 @@ static inline void radeon_engine_flush (struct radeonfb_info *rinfo) | |||
575 | } | 570 | } |
576 | 571 | ||
577 | 572 | ||
578 | static inline void radeon_engine_idle(struct radeonfb_info *rinfo) | 573 | static inline void _radeon_engine_idle(struct radeonfb_info *rinfo) |
579 | { | 574 | { |
580 | int i; | 575 | int i; |
581 | 576 | ||
582 | /* ensure FIFO is empty before waiting for idle */ | 577 | /* ensure FIFO is empty before waiting for idle */ |
583 | radeon_fifo_update_and_wait (rinfo, 64); | 578 | _radeon_fifo_wait (rinfo, 64); |
584 | 579 | ||
585 | for (i=0; i<2000000; i++) { | 580 | for (i=0; i<2000000; i++) { |
586 | if (((INREG(RBBM_STATUS) & GUI_ACTIVE)) == 0) { | 581 | if (((INREG(RBBM_STATUS) & GUI_ACTIVE)) == 0) { |
@@ -593,6 +588,8 @@ static inline void radeon_engine_idle(struct radeonfb_info *rinfo) | |||
593 | } | 588 | } |
594 | 589 | ||
595 | 590 | ||
591 | #define radeon_engine_idle() _radeon_engine_idle(rinfo) | ||
592 | #define radeon_fifo_wait(entries) _radeon_fifo_wait(rinfo,entries) | ||
596 | #define radeon_msleep(ms) _radeon_msleep(rinfo,ms) | 593 | #define radeon_msleep(ms) _radeon_msleep(rinfo,ms) |
597 | 594 | ||
598 | 595 | ||
@@ -622,7 +619,6 @@ extern void radeonfb_imageblit(struct fb_info *p, const struct fb_image *image); | |||
622 | extern int radeonfb_sync(struct fb_info *info); | 619 | extern int radeonfb_sync(struct fb_info *info); |
623 | extern void radeonfb_engine_init (struct radeonfb_info *rinfo); | 620 | extern void radeonfb_engine_init (struct radeonfb_info *rinfo); |
624 | extern void radeonfb_engine_reset(struct radeonfb_info *rinfo); | 621 | extern void radeonfb_engine_reset(struct radeonfb_info *rinfo); |
625 | extern void radeon_fixup_mem_offset(struct radeonfb_info *rinfo); | ||
626 | 622 | ||
627 | /* Other functions */ | 623 | /* Other functions */ |
628 | extern int radeon_screen_blank(struct radeonfb_info *rinfo, int blank, int mode_switch); | 624 | extern int radeon_screen_blank(struct radeonfb_info *rinfo, int blank, int mode_switch); |
@@ -638,6 +634,4 @@ static inline void radeonfb_bl_init(struct radeonfb_info *rinfo) {} | |||
638 | static inline void radeonfb_bl_exit(struct radeonfb_info *rinfo) {} | 634 | static inline void radeonfb_bl_exit(struct radeonfb_info *rinfo) {} |
639 | #endif | 635 | #endif |
640 | 636 | ||
641 | extern int accel_cexp; | ||
642 | |||
643 | #endif /* __RADEONFB_H__ */ | 637 | #endif /* __RADEONFB_H__ */ |
diff --git a/include/video/radeon.h b/include/video/radeon.h index d5dcaf154ba4..1cd09cc5b169 100644 --- a/include/video/radeon.h +++ b/include/video/radeon.h | |||
@@ -525,9 +525,6 @@ | |||
525 | #define CRTC_DISPLAY_DIS (1 << 10) | 525 | #define CRTC_DISPLAY_DIS (1 << 10) |
526 | #define CRTC_CRT_ON (1 << 15) | 526 | #define CRTC_CRT_ON (1 << 15) |
527 | 527 | ||
528 | /* DSTCACHE_MODE bits constants */ | ||
529 | #define RB2D_DC_AUTOFLUSH_ENABLE (1 << 8) | ||
530 | #define RB2D_DC_DC_DISABLE_IGNORE_PE (1 << 17) | ||
531 | 528 | ||
532 | /* DSTCACHE_CTLSTAT bit constants */ | 529 | /* DSTCACHE_CTLSTAT bit constants */ |
533 | #define RB2D_DC_FLUSH_2D (1 << 0) | 530 | #define RB2D_DC_FLUSH_2D (1 << 0) |
@@ -869,10 +866,15 @@ | |||
869 | #define GMC_DST_16BPP_YVYU422 0x00000c00 | 866 | #define GMC_DST_16BPP_YVYU422 0x00000c00 |
870 | #define GMC_DST_32BPP_AYUV444 0x00000e00 | 867 | #define GMC_DST_32BPP_AYUV444 0x00000e00 |
871 | #define GMC_DST_16BPP_ARGB4444 0x00000f00 | 868 | #define GMC_DST_16BPP_ARGB4444 0x00000f00 |
869 | #define GMC_SRC_MONO 0x00000000 | ||
870 | #define GMC_SRC_MONO_LBKGD 0x00001000 | ||
871 | #define GMC_SRC_DSTCOLOR 0x00003000 | ||
872 | #define GMC_BYTE_ORDER_MSB_TO_LSB 0x00000000 | 872 | #define GMC_BYTE_ORDER_MSB_TO_LSB 0x00000000 |
873 | #define GMC_BYTE_ORDER_LSB_TO_MSB 0x00004000 | 873 | #define GMC_BYTE_ORDER_LSB_TO_MSB 0x00004000 |
874 | #define GMC_DP_CONVERSION_TEMP_9300 0x00008000 | 874 | #define GMC_DP_CONVERSION_TEMP_9300 0x00008000 |
875 | #define GMC_DP_CONVERSION_TEMP_6500 0x00000000 | 875 | #define GMC_DP_CONVERSION_TEMP_6500 0x00000000 |
876 | #define GMC_DP_SRC_RECT 0x02000000 | ||
877 | #define GMC_DP_SRC_HOST 0x03000000 | ||
876 | #define GMC_DP_SRC_HOST_BYTEALIGN 0x04000000 | 878 | #define GMC_DP_SRC_HOST_BYTEALIGN 0x04000000 |
877 | #define GMC_3D_FCN_EN_CLR 0x00000000 | 879 | #define GMC_3D_FCN_EN_CLR 0x00000000 |
878 | #define GMC_3D_FCN_EN_SET 0x08000000 | 880 | #define GMC_3D_FCN_EN_SET 0x08000000 |
@@ -883,9 +885,6 @@ | |||
883 | #define GMC_WRITE_MASK_LEAVE 0x00000000 | 885 | #define GMC_WRITE_MASK_LEAVE 0x00000000 |
884 | #define GMC_WRITE_MASK_SET 0x40000000 | 886 | #define GMC_WRITE_MASK_SET 0x40000000 |
885 | #define GMC_CLR_CMP_CNTL_DIS (1 << 28) | 887 | #define GMC_CLR_CMP_CNTL_DIS (1 << 28) |
886 | #define GMC_SRC_DATATYPE_MASK (3 << 12) | ||
887 | #define GMC_SRC_DATATYPE_MONO_FG_BG (0 << 12) | ||
888 | #define GMC_SRC_DATATYPE_MONO_FG_LA (1 << 12) | ||
889 | #define GMC_SRC_DATATYPE_COLOR (3 << 12) | 888 | #define GMC_SRC_DATATYPE_COLOR (3 << 12) |
890 | #define ROP3_S 0x00cc0000 | 889 | #define ROP3_S 0x00cc0000 |
891 | #define ROP3_SRCCOPY 0x00cc0000 | 890 | #define ROP3_SRCCOPY 0x00cc0000 |
@@ -894,7 +893,6 @@ | |||
894 | #define DP_SRC_SOURCE_MASK (7 << 24) | 893 | #define DP_SRC_SOURCE_MASK (7 << 24) |
895 | #define GMC_BRUSH_NONE (15 << 4) | 894 | #define GMC_BRUSH_NONE (15 << 4) |
896 | #define DP_SRC_SOURCE_MEMORY (2 << 24) | 895 | #define DP_SRC_SOURCE_MEMORY (2 << 24) |
897 | #define DP_SRC_SOURCE_HOST_DATA (3 << 24) | ||
898 | #define GMC_BRUSH_SOLIDCOLOR 0x000000d0 | 896 | #define GMC_BRUSH_SOLIDCOLOR 0x000000d0 |
899 | 897 | ||
900 | /* DP_MIX bit constants */ | 898 | /* DP_MIX bit constants */ |
@@ -980,12 +978,6 @@ | |||
980 | #define DISP_PWR_MAN_TV_ENABLE_RST (1 << 25) | 978 | #define DISP_PWR_MAN_TV_ENABLE_RST (1 << 25) |
981 | #define DISP_PWR_MAN_AUTO_PWRUP_EN (1 << 26) | 979 | #define DISP_PWR_MAN_AUTO_PWRUP_EN (1 << 26) |
982 | 980 | ||
983 | /* RBBM_GUICNTL constants */ | ||
984 | #define RBBM_GUICNTL_HOST_DATA_SWAP_NONE (0 << 0) | ||
985 | #define RBBM_GUICNTL_HOST_DATA_SWAP_16BIT (1 << 0) | ||
986 | #define RBBM_GUICNTL_HOST_DATA_SWAP_32BIT (2 << 0) | ||
987 | #define RBBM_GUICNTL_HOST_DATA_SWAP_HDW (3 << 0) | ||
988 | |||
989 | /* masks */ | 981 | /* masks */ |
990 | 982 | ||
991 | #define CONFIG_MEMSIZE_MASK 0x1f000000 | 983 | #define CONFIG_MEMSIZE_MASK 0x1f000000 |