diff options
author | Geert Uytterhoeven <geert@linux-m68k.org> | 2011-11-21 15:53:52 -0500 |
---|---|---|
committer | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2011-12-03 17:03:31 -0500 |
commit | f0058b4bb0630f7d1bf10e8fc3f8784af2fc96e1 (patch) | |
tree | 7b43c2cef78ddb96c355fddf2a90c01f04fca939 /drivers/video/amifb.c | |
parent | 64cebcb510691fa3324d0589629d592925f88d7c (diff) |
fbdev/amifb: Correct whitespace
- indentation
- spacing around binary operators
No functional changes
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video/amifb.c')
-rw-r--r-- | drivers/video/amifb.c | 1186 |
1 files changed, 606 insertions, 580 deletions
diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c index 5ea6596dd824..72454c738144 100644 --- a/drivers/video/amifb.c +++ b/drivers/video/amifb.c | |||
@@ -152,10 +152,10 @@ | |||
152 | 152 | ||
153 | - hsstrt: Start of horizontal synchronization pulse | 153 | - hsstrt: Start of horizontal synchronization pulse |
154 | - hsstop: End of horizontal synchronization pulse | 154 | - hsstop: End of horizontal synchronization pulse |
155 | - htotal: Last value on the line (i.e. line length = htotal+1) | 155 | - htotal: Last value on the line (i.e. line length = htotal + 1) |
156 | - vsstrt: Start of vertical synchronization pulse | 156 | - vsstrt: Start of vertical synchronization pulse |
157 | - vsstop: End of vertical synchronization pulse | 157 | - vsstop: End of vertical synchronization pulse |
158 | - vtotal: Last line value (i.e. number of lines = vtotal+1) | 158 | - vtotal: Last line value (i.e. number of lines = vtotal + 1) |
159 | - hcenter: Start of vertical retrace for interlace | 159 | - hcenter: Start of vertical retrace for interlace |
160 | 160 | ||
161 | You can specify the blanking timings independently. Currently I just set | 161 | You can specify the blanking timings independently. Currently I just set |
@@ -184,7 +184,7 @@ | |||
184 | clock): | 184 | clock): |
185 | 185 | ||
186 | - diwstrt_h: Horizontal start of the visible window | 186 | - diwstrt_h: Horizontal start of the visible window |
187 | - diwstop_h: Horizontal stop+1(*) of the visible window | 187 | - diwstop_h: Horizontal stop + 1(*) of the visible window |
188 | - diwstrt_v: Vertical start of the visible window | 188 | - diwstrt_v: Vertical start of the visible window |
189 | - diwstop_v: Vertical stop of the visible window | 189 | - diwstop_v: Vertical stop of the visible window |
190 | - ddfstrt: Horizontal start of display DMA | 190 | - ddfstrt: Horizontal start of display DMA |
@@ -193,7 +193,7 @@ | |||
193 | 193 | ||
194 | Sprite positioning: | 194 | Sprite positioning: |
195 | 195 | ||
196 | - sprstrt_h: Horizontal start-4 of sprite | 196 | - sprstrt_h: Horizontal start - 4 of sprite |
197 | - sprstrt_v: Vertical start of sprite | 197 | - sprstrt_v: Vertical start of sprite |
198 | 198 | ||
199 | (*) Even Commodore did it wrong in the AGA monitor drivers by not adding 1. | 199 | (*) Even Commodore did it wrong in the AGA monitor drivers by not adding 1. |
@@ -212,21 +212,21 @@ | |||
212 | display parameters. Here's what I found out: | 212 | display parameters. Here's what I found out: |
213 | 213 | ||
214 | - ddfstrt and ddfstop are best aligned to 64 pixels. | 214 | - ddfstrt and ddfstop are best aligned to 64 pixels. |
215 | - the chipset needs 64+4 horizontal pixels after the DMA start before the | 215 | - the chipset needs 64 + 4 horizontal pixels after the DMA start before |
216 | first pixel is output, so diwstrt_h = ddfstrt+64+4 if you want to | 216 | the first pixel is output, so diwstrt_h = ddfstrt + 64 + 4 if you want |
217 | display the first pixel on the line too. Increase diwstrt_h for virtual | 217 | to display the first pixel on the line too. Increase diwstrt_h for |
218 | screen panning. | 218 | virtual screen panning. |
219 | - the display DMA always fetches 64 pixels at a time (fmode = 3). | 219 | - the display DMA always fetches 64 pixels at a time (fmode = 3). |
220 | - ddfstop is ddfstrt+#pixels-64. | 220 | - ddfstop is ddfstrt+#pixels - 64. |
221 | - diwstop_h = diwstrt_h+xres+1. Because of the additional 1 this can be 1 | 221 | - diwstop_h = diwstrt_h + xres + 1. Because of the additional 1 this can |
222 | more than htotal. | 222 | be 1 more than htotal. |
223 | - hscroll simply adds a delay to the display output. Smooth horizontal | 223 | - hscroll simply adds a delay to the display output. Smooth horizontal |
224 | panning needs an extra 64 pixels on the left to prefetch the pixels that | 224 | panning needs an extra 64 pixels on the left to prefetch the pixels that |
225 | `fall off' on the left. | 225 | `fall off' on the left. |
226 | - if ddfstrt < 192, the sprite DMA cycles are all stolen by the bitplane | 226 | - if ddfstrt < 192, the sprite DMA cycles are all stolen by the bitplane |
227 | DMA, so it's best to make the DMA start as late as possible. | 227 | DMA, so it's best to make the DMA start as late as possible. |
228 | - you really don't want to make ddfstrt < 128, since this will steal DMA | 228 | - you really don't want to make ddfstrt < 128, since this will steal DMA |
229 | cycles from the other DMA channels (audio, floppy and Chip RAM refresh). | 229 | cycles from the other DMA channels (audio, floppy and Chip RAM refresh). |
230 | - I make diwstop_h and diwstop_v as large as possible. | 230 | - I make diwstop_h and diwstop_v as large as possible. |
231 | 231 | ||
232 | General dependencies | 232 | General dependencies |
@@ -234,8 +234,8 @@ | |||
234 | 234 | ||
235 | - all values are SHRES pixel (35ns) | 235 | - all values are SHRES pixel (35ns) |
236 | 236 | ||
237 | table 1:fetchstart table 2:prefetch table 3:fetchsize | 237 | table 1:fetchstart table 2:prefetch table 3:fetchsize |
238 | ------------------ ---------------- ----------------- | 238 | ------------------ ---------------- ----------------- |
239 | Pixclock # SHRES|HIRES|LORES # SHRES|HIRES|LORES # SHRES|HIRES|LORES | 239 | Pixclock # SHRES|HIRES|LORES # SHRES|HIRES|LORES # SHRES|HIRES|LORES |
240 | -------------#------+-----+------#------+-----+------#------+-----+------ | 240 | -------------#------+-----+------#------+-----+------#------+-----+------ |
241 | Bus width 1x # 16 | 32 | 64 # 16 | 32 | 64 # 64 | 64 | 64 | 241 | Bus width 1x # 16 | 32 | 64 # 16 | 32 | 64 # 64 | 64 | 64 |
@@ -245,21 +245,21 @@ | |||
245 | - chipset needs 4 pixels before the first pixel is output | 245 | - chipset needs 4 pixels before the first pixel is output |
246 | - ddfstrt must be aligned to fetchstart (table 1) | 246 | - ddfstrt must be aligned to fetchstart (table 1) |
247 | - chipset needs also prefetch (table 2) to get first pixel data, so | 247 | - chipset needs also prefetch (table 2) to get first pixel data, so |
248 | ddfstrt = ((diwstrt_h-4) & -fetchstart) - prefetch | 248 | ddfstrt = ((diwstrt_h - 4) & -fetchstart) - prefetch |
249 | - for horizontal panning decrease diwstrt_h | 249 | - for horizontal panning decrease diwstrt_h |
250 | - the length of a fetchline must be aligned to fetchsize (table 3) | 250 | - the length of a fetchline must be aligned to fetchsize (table 3) |
251 | - if fetchstart is smaller than fetchsize, then ddfstrt can a little bit | 251 | - if fetchstart is smaller than fetchsize, then ddfstrt can a little bit |
252 | moved to optimize use of dma (useful for OCS/ECS overscan displays) | 252 | moved to optimize use of dma (useful for OCS/ECS overscan displays) |
253 | - ddfstop is ddfstrt+ddfsize-fetchsize | 253 | - ddfstop is ddfstrt + ddfsize - fetchsize |
254 | - If C= didn't change anything for AGA, then at following positions the | 254 | - If C= didn't change anything for AGA, then at following positions the |
255 | dma bus is already used: | 255 | dma bus is already used: |
256 | ddfstrt < 48 -> memory refresh | 256 | ddfstrt < 48 -> memory refresh |
257 | < 96 -> disk dma | 257 | < 96 -> disk dma |
258 | < 160 -> audio dma | 258 | < 160 -> audio dma |
259 | < 192 -> sprite 0 dma | 259 | < 192 -> sprite 0 dma |
260 | < 416 -> sprite dma (32 per sprite) | 260 | < 416 -> sprite dma (32 per sprite) |
261 | - in accordance with the hardware reference manual a hardware stop is at | 261 | - in accordance with the hardware reference manual a hardware stop is at |
262 | 192, but AGA (ECS?) can go below this. | 262 | 192, but AGA (ECS?) can go below this. |
263 | 263 | ||
264 | DMA priorities | 264 | DMA priorities |
265 | -------------- | 265 | -------------- |
@@ -269,7 +269,7 @@ | |||
269 | the hardware cursor: | 269 | the hardware cursor: |
270 | 270 | ||
271 | - if you want to start display DMA too early, you lose the ability to | 271 | - if you want to start display DMA too early, you lose the ability to |
272 | do smooth horizontal panning (xpanstep 1 -> 64). | 272 | do smooth horizontal panning (xpanstep 1 -> 64). |
273 | - if you want to go even further, you lose the hardware cursor too. | 273 | - if you want to go even further, you lose the hardware cursor too. |
274 | 274 | ||
275 | IMHO a hardware cursor is more important for X than horizontal scrolling, | 275 | IMHO a hardware cursor is more important for X than horizontal scrolling, |
@@ -286,8 +286,8 @@ | |||
286 | Standard VGA timings | 286 | Standard VGA timings |
287 | -------------------- | 287 | -------------------- |
288 | 288 | ||
289 | xres yres left right upper lower hsync vsync | 289 | xres yres left right upper lower hsync vsync |
290 | ---- ---- ---- ----- ----- ----- ----- ----- | 290 | ---- ---- ---- ----- ----- ----- ----- ----- |
291 | 80x25 720 400 27 45 35 12 108 2 | 291 | 80x25 720 400 27 45 35 12 108 2 |
292 | 80x30 720 480 27 45 30 9 108 2 | 292 | 80x30 720 480 27 45 30 9 108 2 |
293 | 293 | ||
@@ -297,8 +297,8 @@ | |||
297 | 297 | ||
298 | As a comparison, graphics/monitor.h suggests the following: | 298 | As a comparison, graphics/monitor.h suggests the following: |
299 | 299 | ||
300 | xres yres left right upper lower hsync vsync | 300 | xres yres left right upper lower hsync vsync |
301 | ---- ---- ---- ----- ----- ----- ----- ----- | 301 | ---- ---- ---- ----- ----- ----- ----- ----- |
302 | 302 | ||
303 | VGA 640 480 52 112 24 19 112 - 2 + | 303 | VGA 640 480 52 112 24 19 112 - 2 + |
304 | VGA70 640 400 52 112 27 21 112 - 2 - | 304 | VGA70 640 400 52 112 27 21 112 - 2 - |
@@ -309,10 +309,10 @@ | |||
309 | 309 | ||
310 | VSYNC HSYNC Vertical size Vertical total | 310 | VSYNC HSYNC Vertical size Vertical total |
311 | ----- ----- ------------- -------------- | 311 | ----- ----- ------------- -------------- |
312 | + + Reserved Reserved | 312 | + + Reserved Reserved |
313 | + - 400 414 | 313 | + - 400 414 |
314 | - + 350 362 | 314 | - + 350 362 |
315 | - - 480 496 | 315 | - - 480 496 |
316 | 316 | ||
317 | Source: CL-GD542X Technical Reference Manual, Cirrus Logic, Oct 1992 | 317 | Source: CL-GD542X Technical Reference Manual, Cirrus Logic, Oct 1992 |
318 | 318 | ||
@@ -326,33 +326,34 @@ | |||
326 | ----------- | 326 | ----------- |
327 | 327 | ||
328 | - a scanline is 64 µs long, of which 52.48 µs are visible. This is about | 328 | - a scanline is 64 µs long, of which 52.48 µs are visible. This is about |
329 | 736 visible 70 ns pixels per line. | 329 | 736 visible 70 ns pixels per line. |
330 | - we have 625 scanlines, of which 575 are visible (interlaced); after | 330 | - we have 625 scanlines, of which 575 are visible (interlaced); after |
331 | rounding this becomes 576. | 331 | rounding this becomes 576. |
332 | 332 | ||
333 | RETMA -> NTSC | 333 | RETMA -> NTSC |
334 | ------------- | 334 | ------------- |
335 | 335 | ||
336 | - a scanline is 63.5 µs long, of which 53.5 µs are visible. This is about | 336 | - a scanline is 63.5 µs long, of which 53.5 µs are visible. This is about |
337 | 736 visible 70 ns pixels per line. | 337 | 736 visible 70 ns pixels per line. |
338 | - we have 525 scanlines, of which 485 are visible (interlaced); after | 338 | - we have 525 scanlines, of which 485 are visible (interlaced); after |
339 | rounding this becomes 484. | 339 | rounding this becomes 484. |
340 | 340 | ||
341 | Thus if you want a PAL compatible display, you have to do the following: | 341 | Thus if you want a PAL compatible display, you have to do the following: |
342 | 342 | ||
343 | - set the FB_SYNC_BROADCAST flag to indicate that standard broadcast | 343 | - set the FB_SYNC_BROADCAST flag to indicate that standard broadcast |
344 | timings are to be used. | 344 | timings are to be used. |
345 | - make sure upper_margin+yres+lower_margin+vsync_len = 625 for an | 345 | - make sure upper_margin + yres + lower_margin + vsync_len = 625 for an |
346 | interlaced, 312 for a non-interlaced and 156 for a doublescanned | 346 | interlaced, 312 for a non-interlaced and 156 for a doublescanned |
347 | display. | 347 | display. |
348 | - make sure left_margin+xres+right_margin+hsync_len = 1816 for a SHRES, | 348 | - make sure left_margin + xres + right_margin + hsync_len = 1816 for a |
349 | 908 for a HIRES and 454 for a LORES display. | 349 | SHRES, 908 for a HIRES and 454 for a LORES display. |
350 | - the left visible part begins at 360 (SHRES; HIRES:180, LORES:90), | 350 | - the left visible part begins at 360 (SHRES; HIRES:180, LORES:90), |
351 | left_margin+2*hsync_len must be greater or equal. | 351 | left_margin + 2 * hsync_len must be greater or equal. |
352 | - the upper visible part begins at 48 (interlaced; non-interlaced:24, | 352 | - the upper visible part begins at 48 (interlaced; non-interlaced:24, |
353 | doublescanned:12), upper_margin+2*vsync_len must be greater or equal. | 353 | doublescanned:12), upper_margin + 2 * vsync_len must be greater or |
354 | equal. | ||
354 | - ami_encode_var() calculates margins with a hsync of 5320 ns and a vsync | 355 | - ami_encode_var() calculates margins with a hsync of 5320 ns and a vsync |
355 | of 4 scanlines | 356 | of 4 scanlines |
356 | 357 | ||
357 | The settings for a NTSC compatible display are straightforward. | 358 | The settings for a NTSC compatible display are straightforward. |
358 | 359 | ||
@@ -361,7 +362,7 @@ | |||
361 | anything about horizontal/vertical synchronization nor refresh rates. | 362 | anything about horizontal/vertical synchronization nor refresh rates. |
362 | 363 | ||
363 | 364 | ||
364 | -- Geert -- | 365 | -- Geert -- |
365 | 366 | ||
366 | *******************************************************************************/ | 367 | *******************************************************************************/ |
367 | 368 | ||
@@ -540,45 +541,45 @@ static u_short maxfmode, chipset; | |||
540 | * Various macros | 541 | * Various macros |
541 | */ | 542 | */ |
542 | 543 | ||
543 | #define up2(v) (((v)+1) & -2) | 544 | #define up2(v) (((v) + 1) & -2) |
544 | #define down2(v) ((v) & -2) | 545 | #define down2(v) ((v) & -2) |
545 | #define div2(v) ((v)>>1) | 546 | #define div2(v) ((v)>>1) |
546 | #define mod2(v) ((v) & 1) | 547 | #define mod2(v) ((v) & 1) |
547 | 548 | ||
548 | #define up4(v) (((v)+3) & -4) | 549 | #define up4(v) (((v) + 3) & -4) |
549 | #define down4(v) ((v) & -4) | 550 | #define down4(v) ((v) & -4) |
550 | #define mul4(v) ((v)<<2) | 551 | #define mul4(v) ((v) << 2) |
551 | #define div4(v) ((v)>>2) | 552 | #define div4(v) ((v)>>2) |
552 | #define mod4(v) ((v) & 3) | 553 | #define mod4(v) ((v) & 3) |
553 | 554 | ||
554 | #define up8(v) (((v)+7) & -8) | 555 | #define up8(v) (((v) + 7) & -8) |
555 | #define down8(v) ((v) & -8) | 556 | #define down8(v) ((v) & -8) |
556 | #define div8(v) ((v)>>3) | 557 | #define div8(v) ((v)>>3) |
557 | #define mod8(v) ((v) & 7) | 558 | #define mod8(v) ((v) & 7) |
558 | 559 | ||
559 | #define up16(v) (((v)+15) & -16) | 560 | #define up16(v) (((v) + 15) & -16) |
560 | #define down16(v) ((v) & -16) | 561 | #define down16(v) ((v) & -16) |
561 | #define div16(v) ((v)>>4) | 562 | #define div16(v) ((v)>>4) |
562 | #define mod16(v) ((v) & 15) | 563 | #define mod16(v) ((v) & 15) |
563 | 564 | ||
564 | #define up32(v) (((v)+31) & -32) | 565 | #define up32(v) (((v) + 31) & -32) |
565 | #define down32(v) ((v) & -32) | 566 | #define down32(v) ((v) & -32) |
566 | #define div32(v) ((v)>>5) | 567 | #define div32(v) ((v)>>5) |
567 | #define mod32(v) ((v) & 31) | 568 | #define mod32(v) ((v) & 31) |
568 | 569 | ||
569 | #define up64(v) (((v)+63) & -64) | 570 | #define up64(v) (((v) + 63) & -64) |
570 | #define down64(v) ((v) & -64) | 571 | #define down64(v) ((v) & -64) |
571 | #define div64(v) ((v)>>6) | 572 | #define div64(v) ((v)>>6) |
572 | #define mod64(v) ((v) & 63) | 573 | #define mod64(v) ((v) & 63) |
573 | 574 | ||
574 | #define upx(x,v) (((v)+(x)-1) & -(x)) | 575 | #define upx(x, v) (((v) + (x) - 1) & -(x)) |
575 | #define downx(x,v) ((v) & -(x)) | 576 | #define downx(x, v) ((v) & -(x)) |
576 | #define modx(x,v) ((v) & ((x)-1)) | 577 | #define modx(x, v) ((v) & ((x) - 1)) |
577 | 578 | ||
578 | /* if x1 is not a constant, this macro won't make real sense :-) */ | 579 | /* if x1 is not a constant, this macro won't make real sense :-) */ |
579 | #ifdef __mc68000__ | 580 | #ifdef __mc68000__ |
580 | #define DIVUL(x1, x2) ({int res; asm("divul %1,%2,%3": "=d" (res): \ | 581 | #define DIVUL(x1, x2) ({int res; asm("divul %1,%2,%3": "=d" (res): \ |
581 | "d" (x2), "d" ((long)((x1)/0x100000000ULL)), "0" ((long)(x1))); res;}) | 582 | "d" (x2), "d" ((long)((x1) / 0x100000000ULL)), "0" ((long)(x1))); res;}) |
582 | #else | 583 | #else |
583 | /* We know a bit about the numbers, so we can do it this way */ | 584 | /* We know a bit about the numbers, so we can do it this way */ |
584 | #define DIVUL(x1, x2) ((((long)((unsigned long long)x1 >> 8) / x2) << 8) + \ | 585 | #define DIVUL(x1, x2) ((((long)((unsigned long long)x1 >> 8) / x2) << 8) + \ |
@@ -607,7 +608,7 @@ static u_short maxfmode, chipset; | |||
607 | #define VIDEOMEMSIZE_ECS_1M (393216) /* ECS (1MB) : max 1024*768*16 */ | 608 | #define VIDEOMEMSIZE_ECS_1M (393216) /* ECS (1MB) : max 1024*768*16 */ |
608 | #define VIDEOMEMSIZE_OCS (262144) /* OCS : max ca. 800*600*16 */ | 609 | #define VIDEOMEMSIZE_OCS (262144) /* OCS : max ca. 800*600*16 */ |
609 | 610 | ||
610 | #define SPRITEMEMSIZE (64*64/4) /* max 64*64*4 */ | 611 | #define SPRITEMEMSIZE (64 * 64 / 4) /* max 64*64*4 */ |
611 | #define DUMMYSPRITEMEMSIZE (8) | 612 | #define DUMMYSPRITEMEMSIZE (8) |
612 | static u_long spritememory; | 613 | static u_long spritememory; |
613 | 614 | ||
@@ -634,9 +635,9 @@ static u_long min_fstrt = 192; | |||
634 | * Copper Instructions | 635 | * Copper Instructions |
635 | */ | 636 | */ |
636 | 637 | ||
637 | #define CMOVE(val, reg) (CUSTOM_OFS(reg)<<16 | (val)) | 638 | #define CMOVE(val, reg) (CUSTOM_OFS(reg) << 16 | (val)) |
638 | #define CMOVE2(val, reg) ((CUSTOM_OFS(reg)+2)<<16 | (val)) | 639 | #define CMOVE2(val, reg) ((CUSTOM_OFS(reg) + 2) << 16 | (val)) |
639 | #define CWAIT(x, y) (((y) & 0x1fe)<<23 | ((x) & 0x7f0)<<13 | 0x0001fffe) | 640 | #define CWAIT(x, y) (((y) & 0x1fe) << 23 | ((x) & 0x7f0) << 13 | 0x0001fffe) |
640 | #define CEND (0xfffffffe) | 641 | #define CEND (0xfffffffe) |
641 | 642 | ||
642 | 643 | ||
@@ -776,11 +777,11 @@ static struct amifb_par { | |||
776 | 777 | ||
777 | 778 | ||
778 | static struct fb_info fb_info = { | 779 | static struct fb_info fb_info = { |
779 | .fix = { | 780 | .fix = { |
780 | .id = "Amiga ", | 781 | .id = "Amiga ", |
781 | .visual = FB_VISUAL_PSEUDOCOLOR, | 782 | .visual = FB_VISUAL_PSEUDOCOLOR, |
782 | .accel = FB_ACCEL_AMIGABLITT | 783 | .accel = FB_ACCEL_AMIGABLITT |
783 | } | 784 | } |
784 | }; | 785 | }; |
785 | 786 | ||
786 | 787 | ||
@@ -820,116 +821,123 @@ static u_short is_lace = 0; /* Screen is laced */ | |||
820 | 821 | ||
821 | static struct fb_videomode ami_modedb[] __initdata = { | 822 | static struct fb_videomode ami_modedb[] __initdata = { |
822 | 823 | ||
823 | /* | 824 | /* |
824 | * AmigaOS Video Modes | 825 | * AmigaOS Video Modes |
825 | * | 826 | * |
826 | * If you change these, make sure to update DEFMODE_* as well! | 827 | * If you change these, make sure to update DEFMODE_* as well! |
827 | */ | 828 | */ |
828 | 829 | ||
829 | { | 830 | { |
830 | /* 640x200, 15 kHz, 60 Hz (NTSC) */ | 831 | /* 640x200, 15 kHz, 60 Hz (NTSC) */ |
831 | "ntsc", 60, 640, 200, TAG_HIRES, 106, 86, 44, 16, 76, 2, | 832 | "ntsc", 60, 640, 200, TAG_HIRES, 106, 86, 44, 16, 76, 2, |
832 | FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP | 833 | FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP |
833 | }, { | 834 | }, { |
834 | /* 640x400, 15 kHz, 60 Hz interlaced (NTSC) */ | 835 | /* 640x400, 15 kHz, 60 Hz interlaced (NTSC) */ |
835 | "ntsc-lace", 60, 640, 400, TAG_HIRES, 106, 86, 88, 33, 76, 4, | 836 | "ntsc-lace", 60, 640, 400, TAG_HIRES, 106, 86, 88, 33, 76, 4, |
836 | FB_SYNC_BROADCAST, FB_VMODE_INTERLACED | FB_VMODE_YWRAP | 837 | FB_SYNC_BROADCAST, FB_VMODE_INTERLACED | FB_VMODE_YWRAP |
837 | }, { | 838 | }, { |
838 | /* 640x256, 15 kHz, 50 Hz (PAL) */ | 839 | /* 640x256, 15 kHz, 50 Hz (PAL) */ |
839 | "pal", 50, 640, 256, TAG_HIRES, 106, 86, 40, 14, 76, 2, | 840 | "pal", 50, 640, 256, TAG_HIRES, 106, 86, 40, 14, 76, 2, |
840 | FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP | 841 | FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP |
841 | }, { | 842 | }, { |
842 | /* 640x512, 15 kHz, 50 Hz interlaced (PAL) */ | 843 | /* 640x512, 15 kHz, 50 Hz interlaced (PAL) */ |
843 | "pal-lace", 50, 640, 512, TAG_HIRES, 106, 86, 80, 29, 76, 4, | 844 | "pal-lace", 50, 640, 512, TAG_HIRES, 106, 86, 80, 29, 76, 4, |
844 | FB_SYNC_BROADCAST, FB_VMODE_INTERLACED | FB_VMODE_YWRAP | 845 | FB_SYNC_BROADCAST, FB_VMODE_INTERLACED | FB_VMODE_YWRAP |
845 | }, { | 846 | }, { |
846 | /* 640x480, 29 kHz, 57 Hz */ | 847 | /* 640x480, 29 kHz, 57 Hz */ |
847 | "multiscan", 57, 640, 480, TAG_SHRES, 96, 112, 29, 8, 72, 8, | 848 | "multiscan", 57, 640, 480, TAG_SHRES, 96, 112, 29, 8, 72, 8, |
848 | 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP | 849 | 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP |
849 | }, { | 850 | }, { |
850 | /* 640x960, 29 kHz, 57 Hz interlaced */ | 851 | /* 640x960, 29 kHz, 57 Hz interlaced */ |
851 | "multiscan-lace", 57, 640, 960, TAG_SHRES, 96, 112, 58, 16, 72, 16, | 852 | "multiscan-lace", 57, 640, 960, TAG_SHRES, 96, 112, 58, 16, 72, |
852 | 0, FB_VMODE_INTERLACED | FB_VMODE_YWRAP | 853 | 16, |
853 | }, { | 854 | 0, FB_VMODE_INTERLACED | FB_VMODE_YWRAP |
854 | /* 640x200, 15 kHz, 72 Hz */ | 855 | }, { |
855 | "euro36", 72, 640, 200, TAG_HIRES, 92, 124, 6, 6, 52, 5, | 856 | /* 640x200, 15 kHz, 72 Hz */ |
856 | 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP | 857 | "euro36", 72, 640, 200, TAG_HIRES, 92, 124, 6, 6, 52, 5, |
857 | }, { | 858 | 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP |
858 | /* 640x400, 15 kHz, 72 Hz interlaced */ | 859 | }, { |
859 | "euro36-lace", 72, 640, 400, TAG_HIRES, 92, 124, 12, 12, 52, 10, | 860 | /* 640x400, 15 kHz, 72 Hz interlaced */ |
860 | 0, FB_VMODE_INTERLACED | FB_VMODE_YWRAP | 861 | "euro36-lace", 72, 640, 400, TAG_HIRES, 92, 124, 12, 12, 52, |
861 | }, { | 862 | 10, |
862 | /* 640x400, 29 kHz, 68 Hz */ | 863 | 0, FB_VMODE_INTERLACED | FB_VMODE_YWRAP |
863 | "euro72", 68, 640, 400, TAG_SHRES, 164, 92, 9, 9, 80, 8, | 864 | }, { |
864 | 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP | 865 | /* 640x400, 29 kHz, 68 Hz */ |
865 | }, { | 866 | "euro72", 68, 640, 400, TAG_SHRES, 164, 92, 9, 9, 80, 8, |
866 | /* 640x800, 29 kHz, 68 Hz interlaced */ | 867 | 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP |
867 | "euro72-lace", 68, 640, 800, TAG_SHRES, 164, 92, 18, 18, 80, 16, | 868 | }, { |
868 | 0, FB_VMODE_INTERLACED | FB_VMODE_YWRAP | 869 | /* 640x800, 29 kHz, 68 Hz interlaced */ |
869 | }, { | 870 | "euro72-lace", 68, 640, 800, TAG_SHRES, 164, 92, 18, 18, 80, |
870 | /* 800x300, 23 kHz, 70 Hz */ | 871 | 16, |
871 | "super72", 70, 800, 300, TAG_SHRES, 212, 140, 10, 11, 80, 7, | 872 | 0, FB_VMODE_INTERLACED | FB_VMODE_YWRAP |
872 | 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP | 873 | }, { |
873 | }, { | 874 | /* 800x300, 23 kHz, 70 Hz */ |
874 | /* 800x600, 23 kHz, 70 Hz interlaced */ | 875 | "super72", 70, 800, 300, TAG_SHRES, 212, 140, 10, 11, 80, 7, |
875 | "super72-lace", 70, 800, 600, TAG_SHRES, 212, 140, 20, 22, 80, 14, | 876 | 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP |
876 | 0, FB_VMODE_INTERLACED | FB_VMODE_YWRAP | 877 | }, { |
877 | }, { | 878 | /* 800x600, 23 kHz, 70 Hz interlaced */ |
878 | /* 640x200, 27 kHz, 57 Hz doublescan */ | 879 | "super72-lace", 70, 800, 600, TAG_SHRES, 212, 140, 20, 22, 80, |
879 | "dblntsc", 57, 640, 200, TAG_SHRES, 196, 124, 18, 17, 80, 4, | 880 | 14, |
880 | 0, FB_VMODE_DOUBLE | FB_VMODE_YWRAP | 881 | 0, FB_VMODE_INTERLACED | FB_VMODE_YWRAP |
881 | }, { | 882 | }, { |
882 | /* 640x400, 27 kHz, 57 Hz */ | 883 | /* 640x200, 27 kHz, 57 Hz doublescan */ |
883 | "dblntsc-ff", 57, 640, 400, TAG_SHRES, 196, 124, 36, 35, 80, 7, | 884 | "dblntsc", 57, 640, 200, TAG_SHRES, 196, 124, 18, 17, 80, 4, |
884 | 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP | 885 | 0, FB_VMODE_DOUBLE | FB_VMODE_YWRAP |
885 | }, { | 886 | }, { |
886 | /* 640x800, 27 kHz, 57 Hz interlaced */ | 887 | /* 640x400, 27 kHz, 57 Hz */ |
887 | "dblntsc-lace", 57, 640, 800, TAG_SHRES, 196, 124, 72, 70, 80, 14, | 888 | "dblntsc-ff", 57, 640, 400, TAG_SHRES, 196, 124, 36, 35, 80, 7, |
888 | 0, FB_VMODE_INTERLACED | FB_VMODE_YWRAP | 889 | 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP |
889 | }, { | 890 | }, { |
890 | /* 640x256, 27 kHz, 47 Hz doublescan */ | 891 | /* 640x800, 27 kHz, 57 Hz interlaced */ |
891 | "dblpal", 47, 640, 256, TAG_SHRES, 196, 124, 14, 13, 80, 4, | 892 | "dblntsc-lace", 57, 640, 800, TAG_SHRES, 196, 124, 72, 70, 80, |
892 | 0, FB_VMODE_DOUBLE | FB_VMODE_YWRAP | 893 | 14, |
893 | }, { | 894 | 0, FB_VMODE_INTERLACED | FB_VMODE_YWRAP |
894 | /* 640x512, 27 kHz, 47 Hz */ | 895 | }, { |
895 | "dblpal-ff", 47, 640, 512, TAG_SHRES, 196, 124, 28, 27, 80, 7, | 896 | /* 640x256, 27 kHz, 47 Hz doublescan */ |
896 | 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP | 897 | "dblpal", 47, 640, 256, TAG_SHRES, 196, 124, 14, 13, 80, 4, |
897 | }, { | 898 | 0, FB_VMODE_DOUBLE | FB_VMODE_YWRAP |
898 | /* 640x1024, 27 kHz, 47 Hz interlaced */ | 899 | }, { |
899 | "dblpal-lace", 47, 640, 1024, TAG_SHRES, 196, 124, 56, 54, 80, 14, | 900 | /* 640x512, 27 kHz, 47 Hz */ |
900 | 0, FB_VMODE_INTERLACED | FB_VMODE_YWRAP | 901 | "dblpal-ff", 47, 640, 512, TAG_SHRES, 196, 124, 28, 27, 80, 7, |
901 | }, | 902 | 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP |
902 | 903 | }, { | |
903 | /* | 904 | /* 640x1024, 27 kHz, 47 Hz interlaced */ |
904 | * VGA Video Modes | 905 | "dblpal-lace", 47, 640, 1024, TAG_SHRES, 196, 124, 56, 54, 80, |
905 | */ | 906 | 14, |
906 | 907 | 0, FB_VMODE_INTERLACED | FB_VMODE_YWRAP | |
907 | { | 908 | }, |
908 | /* 640x480, 31 kHz, 60 Hz (VGA) */ | 909 | |
909 | "vga", 60, 640, 480, TAG_SHRES, 64, 96, 30, 9, 112, 2, | 910 | /* |
910 | 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP | 911 | * VGA Video Modes |
911 | }, { | 912 | */ |
912 | /* 640x400, 31 kHz, 70 Hz (VGA) */ | 913 | |
913 | "vga70", 70, 640, 400, TAG_SHRES, 64, 96, 35, 12, 112, 2, | 914 | { |
914 | FB_SYNC_VERT_HIGH_ACT | FB_SYNC_COMP_HIGH_ACT, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP | 915 | /* 640x480, 31 kHz, 60 Hz (VGA) */ |
915 | }, | 916 | "vga", 60, 640, 480, TAG_SHRES, 64, 96, 30, 9, 112, 2, |
917 | 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP | ||
918 | }, { | ||
919 | /* 640x400, 31 kHz, 70 Hz (VGA) */ | ||
920 | "vga70", 70, 640, 400, TAG_SHRES, 64, 96, 35, 12, 112, 2, | ||
921 | FB_SYNC_VERT_HIGH_ACT | FB_SYNC_COMP_HIGH_ACT, | ||
922 | FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP | ||
923 | }, | ||
916 | 924 | ||
917 | #if 0 | 925 | #if 0 |
918 | 926 | ||
919 | /* | 927 | /* |
920 | * A2024 video modes | 928 | * A2024 video modes |
921 | * These modes don't work yet because there's no A2024 driver. | 929 | * These modes don't work yet because there's no A2024 driver. |
922 | */ | 930 | */ |
923 | 931 | ||
924 | { | 932 | { |
925 | /* 1024x800, 10 Hz */ | 933 | /* 1024x800, 10 Hz */ |
926 | "a2024-10", 10, 1024, 800, TAG_HIRES, 0, 0, 0, 0, 0, 0, | 934 | "a2024-10", 10, 1024, 800, TAG_HIRES, 0, 0, 0, 0, 0, 0, |
927 | 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP | 935 | 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP |
928 | }, { | 936 | }, { |
929 | /* 1024x800, 15 Hz */ | 937 | /* 1024x800, 15 Hz */ |
930 | "a2024-15", 15, 1024, 800, TAG_HIRES, 0, 0, 0, 0, 0, 0, | 938 | "a2024-15", 15, 1024, 800, TAG_HIRES, 0, 0, 0, 0, 0, 0, |
931 | 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP | 939 | 0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP |
932 | } | 940 | } |
933 | #endif | 941 | #endif |
934 | }; | 942 | }; |
935 | 943 | ||
@@ -992,19 +1000,20 @@ static int amifb_inverse = 0; | |||
992 | /* bplcon1 (smooth scrolling) */ | 1000 | /* bplcon1 (smooth scrolling) */ |
993 | 1001 | ||
994 | #define hscroll2hw(hscroll) \ | 1002 | #define hscroll2hw(hscroll) \ |
995 | (((hscroll)<<12 & 0x3000) | ((hscroll)<<8 & 0xc300) | \ | 1003 | (((hscroll) << 12 & 0x3000) | ((hscroll) << 8 & 0xc300) | \ |
996 | ((hscroll)<<4 & 0x0c00) | ((hscroll)<<2 & 0x00f0) | ((hscroll)>>2 & 0x000f)) | 1004 | ((hscroll) << 4 & 0x0c00) | ((hscroll) << 2 & 0x00f0) | \ |
1005 | ((hscroll)>>2 & 0x000f)) | ||
997 | 1006 | ||
998 | /* diwstrt/diwstop/diwhigh (visible display window) */ | 1007 | /* diwstrt/diwstop/diwhigh (visible display window) */ |
999 | 1008 | ||
1000 | #define diwstrt2hw(diwstrt_h, diwstrt_v) \ | 1009 | #define diwstrt2hw(diwstrt_h, diwstrt_v) \ |
1001 | (((diwstrt_v)<<7 & 0xff00) | ((diwstrt_h)>>2 & 0x00ff)) | 1010 | (((diwstrt_v) << 7 & 0xff00) | ((diwstrt_h)>>2 & 0x00ff)) |
1002 | #define diwstop2hw(diwstop_h, diwstop_v) \ | 1011 | #define diwstop2hw(diwstop_h, diwstop_v) \ |
1003 | (((diwstop_v)<<7 & 0xff00) | ((diwstop_h)>>2 & 0x00ff)) | 1012 | (((diwstop_v) << 7 & 0xff00) | ((diwstop_h)>>2 & 0x00ff)) |
1004 | #define diwhigh2hw(diwstrt_h, diwstrt_v, diwstop_h, diwstop_v) \ | 1013 | #define diwhigh2hw(diwstrt_h, diwstrt_v, diwstop_h, diwstop_v) \ |
1005 | (((diwstop_h)<<3 & 0x2000) | ((diwstop_h)<<11 & 0x1800) | \ | 1014 | (((diwstop_h) << 3 & 0x2000) | ((diwstop_h) << 11 & 0x1800) | \ |
1006 | ((diwstop_v)>>1 & 0x0700) | ((diwstrt_h)>>5 & 0x0020) | \ | 1015 | ((diwstop_v)>>1 & 0x0700) | ((diwstrt_h)>>5 & 0x0020) | \ |
1007 | ((diwstrt_h)<<3 & 0x0018) | ((diwstrt_v)>>9 & 0x0007)) | 1016 | ((diwstrt_h) << 3 & 0x0018) | ((diwstrt_v)>>9 & 0x0007)) |
1008 | 1017 | ||
1009 | /* ddfstrt/ddfstop (display DMA) */ | 1018 | /* ddfstrt/ddfstop (display DMA) */ |
1010 | 1019 | ||
@@ -1015,38 +1024,39 @@ static int amifb_inverse = 0; | |||
1015 | 1024 | ||
1016 | #define hsstrt2hw(hsstrt) (div8(hsstrt)) | 1025 | #define hsstrt2hw(hsstrt) (div8(hsstrt)) |
1017 | #define hsstop2hw(hsstop) (div8(hsstop)) | 1026 | #define hsstop2hw(hsstop) (div8(hsstop)) |
1018 | #define htotal2hw(htotal) (div8(htotal)-1) | 1027 | #define htotal2hw(htotal) (div8(htotal) - 1) |
1019 | #define vsstrt2hw(vsstrt) (div2(vsstrt)) | 1028 | #define vsstrt2hw(vsstrt) (div2(vsstrt)) |
1020 | #define vsstop2hw(vsstop) (div2(vsstop)) | 1029 | #define vsstop2hw(vsstop) (div2(vsstop)) |
1021 | #define vtotal2hw(vtotal) (div2(vtotal)-1) | 1030 | #define vtotal2hw(vtotal) (div2(vtotal) - 1) |
1022 | #define hcenter2hw(htotal) (div8(htotal)) | 1031 | #define hcenter2hw(htotal) (div8(htotal)) |
1023 | 1032 | ||
1024 | /* hbstrt/hbstop/vbstrt/vbstop (blanking timings) */ | 1033 | /* hbstrt/hbstop/vbstrt/vbstop (blanking timings) */ |
1025 | 1034 | ||
1026 | #define hbstrt2hw(hbstrt) (((hbstrt)<<8 & 0x0700) | ((hbstrt)>>3 & 0x00ff)) | 1035 | #define hbstrt2hw(hbstrt) (((hbstrt) << 8 & 0x0700) | ((hbstrt)>>3 & 0x00ff)) |
1027 | #define hbstop2hw(hbstop) (((hbstop)<<8 & 0x0700) | ((hbstop)>>3 & 0x00ff)) | 1036 | #define hbstop2hw(hbstop) (((hbstop) << 8 & 0x0700) | ((hbstop)>>3 & 0x00ff)) |
1028 | #define vbstrt2hw(vbstrt) (div2(vbstrt)) | 1037 | #define vbstrt2hw(vbstrt) (div2(vbstrt)) |
1029 | #define vbstop2hw(vbstop) (div2(vbstop)) | 1038 | #define vbstop2hw(vbstop) (div2(vbstop)) |
1030 | 1039 | ||
1031 | /* colour */ | 1040 | /* colour */ |
1032 | 1041 | ||
1033 | #define rgb2hw8_high(red, green, blue) \ | 1042 | #define rgb2hw8_high(red, green, blue) \ |
1034 | (((red & 0xf0)<<4) | (green & 0xf0) | ((blue & 0xf0)>>4)) | 1043 | (((red & 0xf0) << 4) | (green & 0xf0) | ((blue & 0xf0)>>4)) |
1035 | #define rgb2hw8_low(red, green, blue) \ | 1044 | #define rgb2hw8_low(red, green, blue) \ |
1036 | (((red & 0x0f)<<8) | ((green & 0x0f)<<4) | (blue & 0x0f)) | 1045 | (((red & 0x0f) << 8) | ((green & 0x0f) << 4) | (blue & 0x0f)) |
1037 | #define rgb2hw4(red, green, blue) \ | 1046 | #define rgb2hw4(red, green, blue) \ |
1038 | (((red & 0xf0)<<4) | (green & 0xf0) | ((blue & 0xf0)>>4)) | 1047 | (((red & 0xf0) << 4) | (green & 0xf0) | ((blue & 0xf0)>>4)) |
1039 | #define rgb2hw2(red, green, blue) \ | 1048 | #define rgb2hw2(red, green, blue) \ |
1040 | (((red & 0xc0)<<4) | (green & 0xc0) | ((blue & 0xc0)>>4)) | 1049 | (((red & 0xc0) << 4) | (green & 0xc0) | ((blue & 0xc0)>>4)) |
1041 | 1050 | ||
1042 | /* sprpos/sprctl (sprite positioning) */ | 1051 | /* sprpos/sprctl (sprite positioning) */ |
1043 | 1052 | ||
1044 | #define spr2hw_pos(start_v, start_h) \ | 1053 | #define spr2hw_pos(start_v, start_h) \ |
1045 | (((start_v)<<7&0xff00) | ((start_h)>>3&0x00ff)) | 1054 | (((start_v) << 7 & 0xff00) | ((start_h)>>3 & 0x00ff)) |
1046 | #define spr2hw_ctl(start_v, start_h, stop_v) \ | 1055 | #define spr2hw_ctl(start_v, start_h, stop_v) \ |
1047 | (((stop_v)<<7&0xff00) | ((start_v)>>4&0x0040) | ((stop_v)>>5&0x0020) | \ | 1056 | (((stop_v) << 7 & 0xff00) | ((start_v)>>4 & 0x0040) | \ |
1048 | ((start_h)<<3&0x0018) | ((start_v)>>7&0x0004) | ((stop_v)>>8&0x0002) | \ | 1057 | ((stop_v)>>5 & 0x0020) | ((start_h) << 3 & 0x0018) | \ |
1049 | ((start_h)>>2&0x0001)) | 1058 | ((start_v)>>7 & 0x0004) | ((stop_v)>>8 & 0x0002) | \ |
1059 | ((start_h)>>2 & 0x0001)) | ||
1050 | 1060 | ||
1051 | /* get current vertical position of beam */ | 1061 | /* get current vertical position of beam */ |
1052 | #define get_vbpos() ((u_short)((*(u_long volatile *)&custom.vposr >> 7) & 0xffe)) | 1062 | #define get_vbpos() ((u_short)((*(u_long volatile *)&custom.vposr >> 7) & 0xffe)) |
@@ -1055,7 +1065,7 @@ static int amifb_inverse = 0; | |||
1055 | * Copper Initialisation List | 1065 | * Copper Initialisation List |
1056 | */ | 1066 | */ |
1057 | 1067 | ||
1058 | #define COPINITSIZE (sizeof(copins)*40) | 1068 | #define COPINITSIZE (sizeof(copins) * 40) |
1059 | 1069 | ||
1060 | enum { | 1070 | enum { |
1061 | cip_bplcon0 | 1071 | cip_bplcon0 |
@@ -1066,7 +1076,7 @@ enum { | |||
1066 | * Don't change the order, build_copper()/rebuild_copper() rely on this | 1076 | * Don't change the order, build_copper()/rebuild_copper() rely on this |
1067 | */ | 1077 | */ |
1068 | 1078 | ||
1069 | #define COPLISTSIZE (sizeof(copins)*64) | 1079 | #define COPLISTSIZE (sizeof(copins) * 64) |
1070 | 1080 | ||
1071 | enum { | 1081 | enum { |
1072 | cop_wait, cop_bplcon0, | 1082 | cop_wait, cop_bplcon0, |
@@ -1152,9 +1162,9 @@ static void chipfree(void); | |||
1152 | */ | 1162 | */ |
1153 | 1163 | ||
1154 | static int ami_decode_var(struct fb_var_screeninfo *var, | 1164 | static int ami_decode_var(struct fb_var_screeninfo *var, |
1155 | struct amifb_par *par); | 1165 | struct amifb_par *par); |
1156 | static int ami_encode_var(struct fb_var_screeninfo *var, | 1166 | static int ami_encode_var(struct fb_var_screeninfo *var, |
1157 | struct amifb_par *par); | 1167 | struct amifb_par *par); |
1158 | static void ami_pan_var(struct fb_var_screeninfo *var); | 1168 | static void ami_pan_var(struct fb_var_screeninfo *var); |
1159 | static int ami_update_par(void); | 1169 | static int ami_update_par(void); |
1160 | static void ami_update_display(void); | 1170 | static void ami_update_display(void); |
@@ -1238,9 +1248,9 @@ int __init amifb_setup(char *options) | |||
1238 | } else if (!strcmp(this_opt, "ilbm")) | 1248 | } else if (!strcmp(this_opt, "ilbm")) |
1239 | amifb_ilbm = 1; | 1249 | amifb_ilbm = 1; |
1240 | else if (!strncmp(this_opt, "monitorcap:", 11)) | 1250 | else if (!strncmp(this_opt, "monitorcap:", 11)) |
1241 | amifb_setup_mcap(this_opt+11); | 1251 | amifb_setup_mcap(this_opt + 11); |
1242 | else if (!strncmp(this_opt, "fstart:", 7)) | 1252 | else if (!strncmp(this_opt, "fstart:", 7)) |
1243 | min_fstrt = simple_strtoul(this_opt+7, NULL, 0); | 1253 | min_fstrt = simple_strtoul(this_opt + 7, NULL, 0); |
1244 | else | 1254 | else |
1245 | mode_option = this_opt; | 1255 | mode_option = this_opt; |
1246 | } | 1256 | } |
@@ -1295,20 +1305,20 @@ static int amifb_set_par(struct fb_info *info) | |||
1295 | info->fix.type = FB_TYPE_PLANES; | 1305 | info->fix.type = FB_TYPE_PLANES; |
1296 | info->fix.type_aux = 0; | 1306 | info->fix.type_aux = 0; |
1297 | } | 1307 | } |
1298 | info->fix.line_length = div8(upx(16<<maxfmode, par->vxres)); | 1308 | info->fix.line_length = div8(upx(16 << maxfmode, par->vxres)); |
1299 | 1309 | ||
1300 | if (par->vmode & FB_VMODE_YWRAP) { | 1310 | if (par->vmode & FB_VMODE_YWRAP) { |
1301 | info->fix.ywrapstep = 1; | 1311 | info->fix.ywrapstep = 1; |
1302 | info->fix.xpanstep = 0; | 1312 | info->fix.xpanstep = 0; |
1303 | info->fix.ypanstep = 0; | 1313 | info->fix.ypanstep = 0; |
1304 | info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YWRAP | | 1314 | info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YWRAP | |
1305 | FBINFO_READS_FAST; /* override SCROLL_REDRAW */ | 1315 | FBINFO_READS_FAST; /* override SCROLL_REDRAW */ |
1306 | } else { | 1316 | } else { |
1307 | info->fix.ywrapstep = 0; | 1317 | info->fix.ywrapstep = 0; |
1308 | if (par->vmode & FB_VMODE_SMOOTH_XPAN) | 1318 | if (par->vmode & FB_VMODE_SMOOTH_XPAN) |
1309 | info->fix.xpanstep = 1; | 1319 | info->fix.xpanstep = 1; |
1310 | else | 1320 | else |
1311 | info->fix.xpanstep = 16<<maxfmode; | 1321 | info->fix.xpanstep = 16 << maxfmode; |
1312 | info->fix.ypanstep = 1; | 1322 | info->fix.ypanstep = 1; |
1313 | info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; | 1323 | info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; |
1314 | } | 1324 | } |
@@ -1327,15 +1337,16 @@ static int amifb_pan_display(struct fb_var_screeninfo *var, | |||
1327 | { | 1337 | { |
1328 | if (var->vmode & FB_VMODE_YWRAP) { | 1338 | if (var->vmode & FB_VMODE_YWRAP) { |
1329 | if (var->yoffset < 0 || | 1339 | if (var->yoffset < 0 || |
1330 | var->yoffset >= info->var.yres_virtual || var->xoffset) | 1340 | var->yoffset >= info->var.yres_virtual || var->xoffset) |
1331 | return -EINVAL; | 1341 | return -EINVAL; |
1332 | } else { | 1342 | } else { |
1333 | /* | 1343 | /* |
1334 | * TODO: There will be problems when xpan!=1, so some columns | 1344 | * TODO: There will be problems when xpan!=1, so some columns |
1335 | * on the right side will never be seen | 1345 | * on the right side will never be seen |
1336 | */ | 1346 | */ |
1337 | if (var->xoffset+info->var.xres > upx(16<<maxfmode, info->var.xres_virtual) || | 1347 | if (var->xoffset + info->var.xres > |
1338 | var->yoffset+info->var.yres > info->var.yres_virtual) | 1348 | upx(16 << maxfmode, info->var.xres_virtual) || |
1349 | var->yoffset + info->var.yres > info->var.yres_virtual) | ||
1339 | return -EINVAL; | 1350 | return -EINVAL; |
1340 | } | 1351 | } |
1341 | ami_pan_var(var); | 1352 | ami_pan_var(var); |
@@ -1360,10 +1371,10 @@ static int amifb_pan_display(struct fb_var_screeninfo *var, | |||
1360 | #endif | 1371 | #endif |
1361 | 1372 | ||
1362 | 1373 | ||
1363 | /* | 1374 | /* |
1364 | * Compose two values, using a bitmask as decision value | 1375 | * Compose two values, using a bitmask as decision value |
1365 | * This is equivalent to (a & mask) | (b & ~mask) | 1376 | * This is equivalent to (a & mask) | (b & ~mask) |
1366 | */ | 1377 | */ |
1367 | 1378 | ||
1368 | static inline unsigned long comp(unsigned long a, unsigned long b, | 1379 | static inline unsigned long comp(unsigned long a, unsigned long b, |
1369 | unsigned long mask) | 1380 | unsigned long mask) |
@@ -1379,29 +1390,29 @@ static inline unsigned long xor(unsigned long a, unsigned long b, | |||
1379 | } | 1390 | } |
1380 | 1391 | ||
1381 | 1392 | ||
1382 | /* | 1393 | /* |
1383 | * Unaligned forward bit copy using 32-bit or 64-bit memory accesses | 1394 | * Unaligned forward bit copy using 32-bit or 64-bit memory accesses |
1384 | */ | 1395 | */ |
1385 | 1396 | ||
1386 | static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src, | 1397 | static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src, |
1387 | int src_idx, u32 n) | 1398 | int src_idx, u32 n) |
1388 | { | 1399 | { |
1389 | unsigned long first, last; | 1400 | unsigned long first, last; |
1390 | int shift = dst_idx-src_idx, left, right; | 1401 | int shift = dst_idx - src_idx, left, right; |
1391 | unsigned long d0, d1; | 1402 | unsigned long d0, d1; |
1392 | int m; | 1403 | int m; |
1393 | 1404 | ||
1394 | if (!n) | 1405 | if (!n) |
1395 | return; | 1406 | return; |
1396 | 1407 | ||
1397 | shift = dst_idx-src_idx; | 1408 | shift = dst_idx - src_idx; |
1398 | first = ~0UL >> dst_idx; | 1409 | first = ~0UL >> dst_idx; |
1399 | last = ~(~0UL >> ((dst_idx+n) % BITS_PER_LONG)); | 1410 | last = ~(~0UL >> ((dst_idx + n) % BITS_PER_LONG)); |
1400 | 1411 | ||
1401 | if (!shift) { | 1412 | if (!shift) { |
1402 | // Same alignment for source and dest | 1413 | // Same alignment for source and dest |
1403 | 1414 | ||
1404 | if (dst_idx+n <= BITS_PER_LONG) { | 1415 | if (dst_idx + n <= BITS_PER_LONG) { |
1405 | // Single word | 1416 | // Single word |
1406 | if (last) | 1417 | if (last) |
1407 | first &= last; | 1418 | first &= last; |
@@ -1413,7 +1424,7 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src, | |||
1413 | *dst = comp(*src, *dst, first); | 1424 | *dst = comp(*src, *dst, first); |
1414 | dst++; | 1425 | dst++; |
1415 | src++; | 1426 | src++; |
1416 | n -= BITS_PER_LONG-dst_idx; | 1427 | n -= BITS_PER_LONG - dst_idx; |
1417 | } | 1428 | } |
1418 | 1429 | ||
1419 | // Main chunk | 1430 | // Main chunk |
@@ -1439,17 +1450,17 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src, | |||
1439 | } else { | 1450 | } else { |
1440 | // Different alignment for source and dest | 1451 | // Different alignment for source and dest |
1441 | 1452 | ||
1442 | right = shift & (BITS_PER_LONG-1); | 1453 | right = shift & (BITS_PER_LONG - 1); |
1443 | left = -shift & (BITS_PER_LONG-1); | 1454 | left = -shift & (BITS_PER_LONG - 1); |
1444 | 1455 | ||
1445 | if (dst_idx+n <= BITS_PER_LONG) { | 1456 | if (dst_idx + n <= BITS_PER_LONG) { |
1446 | // Single destination word | 1457 | // Single destination word |
1447 | if (last) | 1458 | if (last) |
1448 | first &= last; | 1459 | first &= last; |
1449 | if (shift > 0) { | 1460 | if (shift > 0) { |
1450 | // Single source word | 1461 | // Single source word |
1451 | *dst = comp(*src >> right, *dst, first); | 1462 | *dst = comp(*src >> right, *dst, first); |
1452 | } else if (src_idx+n <= BITS_PER_LONG) { | 1463 | } else if (src_idx + n <= BITS_PER_LONG) { |
1453 | // Single source word | 1464 | // Single source word |
1454 | *dst = comp(*src << left, *dst, first); | 1465 | *dst = comp(*src << left, *dst, first); |
1455 | } else { | 1466 | } else { |
@@ -1467,7 +1478,7 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src, | |||
1467 | // Single source word | 1478 | // Single source word |
1468 | *dst = comp(d0 >> right, *dst, first); | 1479 | *dst = comp(d0 >> right, *dst, first); |
1469 | dst++; | 1480 | dst++; |
1470 | n -= BITS_PER_LONG-dst_idx; | 1481 | n -= BITS_PER_LONG - dst_idx; |
1471 | } else { | 1482 | } else { |
1472 | // 2 source words | 1483 | // 2 source words |
1473 | d1 = *src++; | 1484 | d1 = *src++; |
@@ -1475,7 +1486,7 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src, | |||
1475 | first); | 1486 | first); |
1476 | d0 = d1; | 1487 | d0 = d1; |
1477 | dst++; | 1488 | dst++; |
1478 | n -= BITS_PER_LONG-dst_idx; | 1489 | n -= BITS_PER_LONG - dst_idx; |
1479 | } | 1490 | } |
1480 | 1491 | ||
1481 | // Main chunk | 1492 | // Main chunk |
@@ -1519,40 +1530,40 @@ static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src, | |||
1519 | } | 1530 | } |
1520 | 1531 | ||
1521 | 1532 | ||
1522 | /* | 1533 | /* |
1523 | * Unaligned reverse bit copy using 32-bit or 64-bit memory accesses | 1534 | * Unaligned reverse bit copy using 32-bit or 64-bit memory accesses |
1524 | */ | 1535 | */ |
1525 | 1536 | ||
1526 | static void bitcpy_rev(unsigned long *dst, int dst_idx, | 1537 | static void bitcpy_rev(unsigned long *dst, int dst_idx, |
1527 | const unsigned long *src, int src_idx, u32 n) | 1538 | const unsigned long *src, int src_idx, u32 n) |
1528 | { | 1539 | { |
1529 | unsigned long first, last; | 1540 | unsigned long first, last; |
1530 | int shift = dst_idx-src_idx, left, right; | 1541 | int shift = dst_idx - src_idx, left, right; |
1531 | unsigned long d0, d1; | 1542 | unsigned long d0, d1; |
1532 | int m; | 1543 | int m; |
1533 | 1544 | ||
1534 | if (!n) | 1545 | if (!n) |
1535 | return; | 1546 | return; |
1536 | 1547 | ||
1537 | dst += (n-1)/BITS_PER_LONG; | 1548 | dst += (n - 1) / BITS_PER_LONG; |
1538 | src += (n-1)/BITS_PER_LONG; | 1549 | src += (n - 1) / BITS_PER_LONG; |
1539 | if ((n-1) % BITS_PER_LONG) { | 1550 | if ((n - 1) % BITS_PER_LONG) { |
1540 | dst_idx += (n-1) % BITS_PER_LONG; | 1551 | dst_idx += (n - 1) % BITS_PER_LONG; |
1541 | dst += dst_idx >> SHIFT_PER_LONG; | 1552 | dst += dst_idx >> SHIFT_PER_LONG; |
1542 | dst_idx &= BITS_PER_LONG-1; | 1553 | dst_idx &= BITS_PER_LONG - 1; |
1543 | src_idx += (n-1) % BITS_PER_LONG; | 1554 | src_idx += (n - 1) % BITS_PER_LONG; |
1544 | src += src_idx >> SHIFT_PER_LONG; | 1555 | src += src_idx >> SHIFT_PER_LONG; |
1545 | src_idx &= BITS_PER_LONG-1; | 1556 | src_idx &= BITS_PER_LONG - 1; |
1546 | } | 1557 | } |
1547 | 1558 | ||
1548 | shift = dst_idx-src_idx; | 1559 | shift = dst_idx - src_idx; |
1549 | first = ~0UL << (BITS_PER_LONG-1-dst_idx); | 1560 | first = ~0UL << (BITS_PER_LONG - 1 - dst_idx); |
1550 | last = ~(~0UL << (BITS_PER_LONG-1-((dst_idx-n) % BITS_PER_LONG))); | 1561 | last = ~(~0UL << (BITS_PER_LONG - 1 - ((dst_idx - n) % BITS_PER_LONG))); |
1551 | 1562 | ||
1552 | if (!shift) { | 1563 | if (!shift) { |
1553 | // Same alignment for source and dest | 1564 | // Same alignment for source and dest |
1554 | 1565 | ||
1555 | if ((unsigned long)dst_idx+1 >= n) { | 1566 | if ((unsigned long)dst_idx + 1 >= n) { |
1556 | // Single word | 1567 | // Single word |
1557 | if (last) | 1568 | if (last) |
1558 | first &= last; | 1569 | first &= last; |
@@ -1564,7 +1575,7 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx, | |||
1564 | *dst = comp(*src, *dst, first); | 1575 | *dst = comp(*src, *dst, first); |
1565 | dst--; | 1576 | dst--; |
1566 | src--; | 1577 | src--; |
1567 | n -= dst_idx+1; | 1578 | n -= dst_idx + 1; |
1568 | } | 1579 | } |
1569 | 1580 | ||
1570 | // Main chunk | 1581 | // Main chunk |
@@ -1590,17 +1601,17 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx, | |||
1590 | } else { | 1601 | } else { |
1591 | // Different alignment for source and dest | 1602 | // Different alignment for source and dest |
1592 | 1603 | ||
1593 | right = shift & (BITS_PER_LONG-1); | 1604 | right = shift & (BITS_PER_LONG - 1); |
1594 | left = -shift & (BITS_PER_LONG-1); | 1605 | left = -shift & (BITS_PER_LONG - 1); |
1595 | 1606 | ||
1596 | if ((unsigned long)dst_idx+1 >= n) { | 1607 | if ((unsigned long)dst_idx + 1 >= n) { |
1597 | // Single destination word | 1608 | // Single destination word |
1598 | if (last) | 1609 | if (last) |
1599 | first &= last; | 1610 | first &= last; |
1600 | if (shift < 0) { | 1611 | if (shift < 0) { |
1601 | // Single source word | 1612 | // Single source word |
1602 | *dst = comp(*src << left, *dst, first); | 1613 | *dst = comp(*src << left, *dst, first); |
1603 | } else if (1+(unsigned long)src_idx >= n) { | 1614 | } else if (1 + (unsigned long)src_idx >= n) { |
1604 | // Single source word | 1615 | // Single source word |
1605 | *dst = comp(*src >> right, *dst, first); | 1616 | *dst = comp(*src >> right, *dst, first); |
1606 | } else { | 1617 | } else { |
@@ -1618,7 +1629,7 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx, | |||
1618 | // Single source word | 1629 | // Single source word |
1619 | *dst = comp(d0 << left, *dst, first); | 1630 | *dst = comp(d0 << left, *dst, first); |
1620 | dst--; | 1631 | dst--; |
1621 | n -= dst_idx+1; | 1632 | n -= dst_idx + 1; |
1622 | } else { | 1633 | } else { |
1623 | // 2 source words | 1634 | // 2 source words |
1624 | d1 = *src--; | 1635 | d1 = *src--; |
@@ -1626,7 +1637,7 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx, | |||
1626 | first); | 1637 | first); |
1627 | d0 = d1; | 1638 | d0 = d1; |
1628 | dst--; | 1639 | dst--; |
1629 | n -= dst_idx+1; | 1640 | n -= dst_idx + 1; |
1630 | } | 1641 | } |
1631 | 1642 | ||
1632 | // Main chunk | 1643 | // Main chunk |
@@ -1670,30 +1681,30 @@ static void bitcpy_rev(unsigned long *dst, int dst_idx, | |||
1670 | } | 1681 | } |
1671 | 1682 | ||
1672 | 1683 | ||
1673 | /* | 1684 | /* |
1674 | * Unaligned forward inverting bit copy using 32-bit or 64-bit memory | 1685 | * Unaligned forward inverting bit copy using 32-bit or 64-bit memory |
1675 | * accesses | 1686 | * accesses |
1676 | */ | 1687 | */ |
1677 | 1688 | ||
1678 | static void bitcpy_not(unsigned long *dst, int dst_idx, | 1689 | static void bitcpy_not(unsigned long *dst, int dst_idx, |
1679 | const unsigned long *src, int src_idx, u32 n) | 1690 | const unsigned long *src, int src_idx, u32 n) |
1680 | { | 1691 | { |
1681 | unsigned long first, last; | 1692 | unsigned long first, last; |
1682 | int shift = dst_idx-src_idx, left, right; | 1693 | int shift = dst_idx - src_idx, left, right; |
1683 | unsigned long d0, d1; | 1694 | unsigned long d0, d1; |
1684 | int m; | 1695 | int m; |
1685 | 1696 | ||
1686 | if (!n) | 1697 | if (!n) |
1687 | return; | 1698 | return; |
1688 | 1699 | ||
1689 | shift = dst_idx-src_idx; | 1700 | shift = dst_idx - src_idx; |
1690 | first = ~0UL >> dst_idx; | 1701 | first = ~0UL >> dst_idx; |
1691 | last = ~(~0UL >> ((dst_idx+n) % BITS_PER_LONG)); | 1702 | last = ~(~0UL >> ((dst_idx + n) % BITS_PER_LONG)); |
1692 | 1703 | ||
1693 | if (!shift) { | 1704 | if (!shift) { |
1694 | // Same alignment for source and dest | 1705 | // Same alignment for source and dest |
1695 | 1706 | ||
1696 | if (dst_idx+n <= BITS_PER_LONG) { | 1707 | if (dst_idx + n <= BITS_PER_LONG) { |
1697 | // Single word | 1708 | // Single word |
1698 | if (last) | 1709 | if (last) |
1699 | first &= last; | 1710 | first &= last; |
@@ -1705,7 +1716,7 @@ static void bitcpy_not(unsigned long *dst, int dst_idx, | |||
1705 | *dst = comp(~*src, *dst, first); | 1716 | *dst = comp(~*src, *dst, first); |
1706 | dst++; | 1717 | dst++; |
1707 | src++; | 1718 | src++; |
1708 | n -= BITS_PER_LONG-dst_idx; | 1719 | n -= BITS_PER_LONG - dst_idx; |
1709 | } | 1720 | } |
1710 | 1721 | ||
1711 | // Main chunk | 1722 | // Main chunk |
@@ -1731,17 +1742,17 @@ static void bitcpy_not(unsigned long *dst, int dst_idx, | |||
1731 | } else { | 1742 | } else { |
1732 | // Different alignment for source and dest | 1743 | // Different alignment for source and dest |
1733 | 1744 | ||
1734 | right = shift & (BITS_PER_LONG-1); | 1745 | right = shift & (BITS_PER_LONG - 1); |
1735 | left = -shift & (BITS_PER_LONG-1); | 1746 | left = -shift & (BITS_PER_LONG - 1); |
1736 | 1747 | ||
1737 | if (dst_idx+n <= BITS_PER_LONG) { | 1748 | if (dst_idx + n <= BITS_PER_LONG) { |
1738 | // Single destination word | 1749 | // Single destination word |
1739 | if (last) | 1750 | if (last) |
1740 | first &= last; | 1751 | first &= last; |
1741 | if (shift > 0) { | 1752 | if (shift > 0) { |
1742 | // Single source word | 1753 | // Single source word |
1743 | *dst = comp(~*src >> right, *dst, first); | 1754 | *dst = comp(~*src >> right, *dst, first); |
1744 | } else if (src_idx+n <= BITS_PER_LONG) { | 1755 | } else if (src_idx + n <= BITS_PER_LONG) { |
1745 | // Single source word | 1756 | // Single source word |
1746 | *dst = comp(~*src << left, *dst, first); | 1757 | *dst = comp(~*src << left, *dst, first); |
1747 | } else { | 1758 | } else { |
@@ -1759,7 +1770,7 @@ static void bitcpy_not(unsigned long *dst, int dst_idx, | |||
1759 | // Single source word | 1770 | // Single source word |
1760 | *dst = comp(d0 >> right, *dst, first); | 1771 | *dst = comp(d0 >> right, *dst, first); |
1761 | dst++; | 1772 | dst++; |
1762 | n -= BITS_PER_LONG-dst_idx; | 1773 | n -= BITS_PER_LONG - dst_idx; |
1763 | } else { | 1774 | } else { |
1764 | // 2 source words | 1775 | // 2 source words |
1765 | d1 = ~*src++; | 1776 | d1 = ~*src++; |
@@ -1767,7 +1778,7 @@ static void bitcpy_not(unsigned long *dst, int dst_idx, | |||
1767 | first); | 1778 | first); |
1768 | d0 = d1; | 1779 | d0 = d1; |
1769 | dst++; | 1780 | dst++; |
1770 | n -= BITS_PER_LONG-dst_idx; | 1781 | n -= BITS_PER_LONG - dst_idx; |
1771 | } | 1782 | } |
1772 | 1783 | ||
1773 | // Main chunk | 1784 | // Main chunk |
@@ -1811,9 +1822,9 @@ static void bitcpy_not(unsigned long *dst, int dst_idx, | |||
1811 | } | 1822 | } |
1812 | 1823 | ||
1813 | 1824 | ||
1814 | /* | 1825 | /* |
1815 | * Unaligned 32-bit pattern fill using 32/64-bit memory accesses | 1826 | * Unaligned 32-bit pattern fill using 32/64-bit memory accesses |
1816 | */ | 1827 | */ |
1817 | 1828 | ||
1818 | static void bitfill32(unsigned long *dst, int dst_idx, u32 pat, u32 n) | 1829 | static void bitfill32(unsigned long *dst, int dst_idx, u32 pat, u32 n) |
1819 | { | 1830 | { |
@@ -1828,9 +1839,9 @@ static void bitfill32(unsigned long *dst, int dst_idx, u32 pat, u32 n) | |||
1828 | #endif | 1839 | #endif |
1829 | 1840 | ||
1830 | first = ~0UL >> dst_idx; | 1841 | first = ~0UL >> dst_idx; |
1831 | last = ~(~0UL >> ((dst_idx+n) % BITS_PER_LONG)); | 1842 | last = ~(~0UL >> ((dst_idx + n) % BITS_PER_LONG)); |
1832 | 1843 | ||
1833 | if (dst_idx+n <= BITS_PER_LONG) { | 1844 | if (dst_idx + n <= BITS_PER_LONG) { |
1834 | // Single word | 1845 | // Single word |
1835 | if (last) | 1846 | if (last) |
1836 | first &= last; | 1847 | first &= last; |
@@ -1841,7 +1852,7 @@ static void bitfill32(unsigned long *dst, int dst_idx, u32 pat, u32 n) | |||
1841 | if (first) { | 1852 | if (first) { |
1842 | *dst = comp(val, *dst, first); | 1853 | *dst = comp(val, *dst, first); |
1843 | dst++; | 1854 | dst++; |
1844 | n -= BITS_PER_LONG-dst_idx; | 1855 | n -= BITS_PER_LONG - dst_idx; |
1845 | } | 1856 | } |
1846 | 1857 | ||
1847 | // Main chunk | 1858 | // Main chunk |
@@ -1867,9 +1878,9 @@ static void bitfill32(unsigned long *dst, int dst_idx, u32 pat, u32 n) | |||
1867 | } | 1878 | } |
1868 | 1879 | ||
1869 | 1880 | ||
1870 | /* | 1881 | /* |
1871 | * Unaligned 32-bit pattern xor using 32/64-bit memory accesses | 1882 | * Unaligned 32-bit pattern xor using 32/64-bit memory accesses |
1872 | */ | 1883 | */ |
1873 | 1884 | ||
1874 | static void bitxor32(unsigned long *dst, int dst_idx, u32 pat, u32 n) | 1885 | static void bitxor32(unsigned long *dst, int dst_idx, u32 pat, u32 n) |
1875 | { | 1886 | { |
@@ -1884,9 +1895,9 @@ static void bitxor32(unsigned long *dst, int dst_idx, u32 pat, u32 n) | |||
1884 | #endif | 1895 | #endif |
1885 | 1896 | ||
1886 | first = ~0UL >> dst_idx; | 1897 | first = ~0UL >> dst_idx; |
1887 | last = ~(~0UL >> ((dst_idx+n) % BITS_PER_LONG)); | 1898 | last = ~(~0UL >> ((dst_idx + n) % BITS_PER_LONG)); |
1888 | 1899 | ||
1889 | if (dst_idx+n <= BITS_PER_LONG) { | 1900 | if (dst_idx + n <= BITS_PER_LONG) { |
1890 | // Single word | 1901 | // Single word |
1891 | if (last) | 1902 | if (last) |
1892 | first &= last; | 1903 | first &= last; |
@@ -1897,7 +1908,7 @@ static void bitxor32(unsigned long *dst, int dst_idx, u32 pat, u32 n) | |||
1897 | if (first) { | 1908 | if (first) { |
1898 | *dst = xor(val, *dst, first); | 1909 | *dst = xor(val, *dst, first); |
1899 | dst++; | 1910 | dst++; |
1900 | n -= BITS_PER_LONG-dst_idx; | 1911 | n -= BITS_PER_LONG - dst_idx; |
1901 | } | 1912 | } |
1902 | 1913 | ||
1903 | // Main chunk | 1914 | // Main chunk |
@@ -1924,12 +1935,12 @@ static inline void fill_one_line(int bpp, unsigned long next_plane, | |||
1924 | { | 1935 | { |
1925 | while (1) { | 1936 | while (1) { |
1926 | dst += dst_idx >> SHIFT_PER_LONG; | 1937 | dst += dst_idx >> SHIFT_PER_LONG; |
1927 | dst_idx &= (BITS_PER_LONG-1); | 1938 | dst_idx &= (BITS_PER_LONG - 1); |
1928 | bitfill32(dst, dst_idx, color & 1 ? ~0 : 0, n); | 1939 | bitfill32(dst, dst_idx, color & 1 ? ~0 : 0, n); |
1929 | if (!--bpp) | 1940 | if (!--bpp) |
1930 | break; | 1941 | break; |
1931 | color >>= 1; | 1942 | color >>= 1; |
1932 | dst_idx += next_plane*8; | 1943 | dst_idx += next_plane * 8; |
1933 | } | 1944 | } |
1934 | } | 1945 | } |
1935 | 1946 | ||
@@ -1939,12 +1950,12 @@ static inline void xor_one_line(int bpp, unsigned long next_plane, | |||
1939 | { | 1950 | { |
1940 | while (color) { | 1951 | while (color) { |
1941 | dst += dst_idx >> SHIFT_PER_LONG; | 1952 | dst += dst_idx >> SHIFT_PER_LONG; |
1942 | dst_idx &= (BITS_PER_LONG-1); | 1953 | dst_idx &= (BITS_PER_LONG - 1); |
1943 | bitxor32(dst, dst_idx, color & 1 ? ~0 : 0, n); | 1954 | bitxor32(dst, dst_idx, color & 1 ? ~0 : 0, n); |
1944 | if (!--bpp) | 1955 | if (!--bpp) |
1945 | break; | 1956 | break; |
1946 | color >>= 1; | 1957 | color >>= 1; |
1947 | dst_idx += next_plane*8; | 1958 | dst_idx += next_plane * 8; |
1948 | } | 1959 | } |
1949 | } | 1960 | } |
1950 | 1961 | ||
@@ -1972,23 +1983,23 @@ static void amifb_fillrect(struct fb_info *info, | |||
1972 | height = y2 - rect->dy; | 1983 | height = y2 - rect->dy; |
1973 | 1984 | ||
1974 | dst = (unsigned long *) | 1985 | dst = (unsigned long *) |
1975 | ((unsigned long)info->screen_base & ~(BYTES_PER_LONG-1)); | 1986 | ((unsigned long)info->screen_base & ~(BYTES_PER_LONG - 1)); |
1976 | dst_idx = ((unsigned long)info->screen_base & (BYTES_PER_LONG-1))*8; | 1987 | dst_idx = ((unsigned long)info->screen_base & (BYTES_PER_LONG - 1)) * 8; |
1977 | dst_idx += rect->dy*par->next_line*8+rect->dx; | 1988 | dst_idx += rect->dy * par->next_line * 8 + rect->dx; |
1978 | while (height--) { | 1989 | while (height--) { |
1979 | switch (rect->rop) { | 1990 | switch (rect->rop) { |
1980 | case ROP_COPY: | 1991 | case ROP_COPY: |
1981 | fill_one_line(info->var.bits_per_pixel, | 1992 | fill_one_line(info->var.bits_per_pixel, |
1982 | par->next_plane, dst, dst_idx, width, | 1993 | par->next_plane, dst, dst_idx, width, |
1983 | rect->color); | 1994 | rect->color); |
1984 | break; | 1995 | break; |
1985 | 1996 | ||
1986 | case ROP_XOR: | 1997 | case ROP_XOR: |
1987 | xor_one_line(info->var.bits_per_pixel, par->next_plane, | 1998 | xor_one_line(info->var.bits_per_pixel, par->next_plane, |
1988 | dst, dst_idx, width, rect->color); | 1999 | dst, dst_idx, width, rect->color); |
1989 | break; | 2000 | break; |
1990 | } | 2001 | } |
1991 | dst_idx += par->next_line*8; | 2002 | dst_idx += par->next_line * 8; |
1992 | } | 2003 | } |
1993 | } | 2004 | } |
1994 | 2005 | ||
@@ -1998,14 +2009,14 @@ static inline void copy_one_line(int bpp, unsigned long next_plane, | |||
1998 | { | 2009 | { |
1999 | while (1) { | 2010 | while (1) { |
2000 | dst += dst_idx >> SHIFT_PER_LONG; | 2011 | dst += dst_idx >> SHIFT_PER_LONG; |
2001 | dst_idx &= (BITS_PER_LONG-1); | 2012 | dst_idx &= (BITS_PER_LONG - 1); |
2002 | src += src_idx >> SHIFT_PER_LONG; | 2013 | src += src_idx >> SHIFT_PER_LONG; |
2003 | src_idx &= (BITS_PER_LONG-1); | 2014 | src_idx &= (BITS_PER_LONG - 1); |
2004 | bitcpy(dst, dst_idx, src, src_idx, n); | 2015 | bitcpy(dst, dst_idx, src, src_idx, n); |
2005 | if (!--bpp) | 2016 | if (!--bpp) |
2006 | break; | 2017 | break; |
2007 | dst_idx += next_plane*8; | 2018 | dst_idx += next_plane * 8; |
2008 | src_idx += next_plane*8; | 2019 | src_idx += next_plane * 8; |
2009 | } | 2020 | } |
2010 | } | 2021 | } |
2011 | 2022 | ||
@@ -2015,14 +2026,14 @@ static inline void copy_one_line_rev(int bpp, unsigned long next_plane, | |||
2015 | { | 2026 | { |
2016 | while (1) { | 2027 | while (1) { |
2017 | dst += dst_idx >> SHIFT_PER_LONG; | 2028 | dst += dst_idx >> SHIFT_PER_LONG; |
2018 | dst_idx &= (BITS_PER_LONG-1); | 2029 | dst_idx &= (BITS_PER_LONG - 1); |
2019 | src += src_idx >> SHIFT_PER_LONG; | 2030 | src += src_idx >> SHIFT_PER_LONG; |
2020 | src_idx &= (BITS_PER_LONG-1); | 2031 | src_idx &= (BITS_PER_LONG - 1); |
2021 | bitcpy_rev(dst, dst_idx, src, src_idx, n); | 2032 | bitcpy_rev(dst, dst_idx, src, src_idx, n); |
2022 | if (!--bpp) | 2033 | if (!--bpp) |
2023 | break; | 2034 | break; |
2024 | dst_idx += next_plane*8; | 2035 | dst_idx += next_plane * 8; |
2025 | src_idx += next_plane*8; | 2036 | src_idx += next_plane * 8; |
2026 | } | 2037 | } |
2027 | } | 2038 | } |
2028 | 2039 | ||
@@ -2065,16 +2076,16 @@ static void amifb_copyarea(struct fb_info *info, | |||
2065 | rev_copy = 1; | 2076 | rev_copy = 1; |
2066 | } | 2077 | } |
2067 | dst = (unsigned long *) | 2078 | dst = (unsigned long *) |
2068 | ((unsigned long)info->screen_base & ~(BYTES_PER_LONG-1)); | 2079 | ((unsigned long)info->screen_base & ~(BYTES_PER_LONG - 1)); |
2069 | src = dst; | 2080 | src = dst; |
2070 | dst_idx = ((unsigned long)info->screen_base & (BYTES_PER_LONG-1))*8; | 2081 | dst_idx = ((unsigned long)info->screen_base & (BYTES_PER_LONG - 1)) * 8; |
2071 | src_idx = dst_idx; | 2082 | src_idx = dst_idx; |
2072 | dst_idx += dy*par->next_line*8+dx; | 2083 | dst_idx += dy * par->next_line * 8 + dx; |
2073 | src_idx += sy*par->next_line*8+sx; | 2084 | src_idx += sy * par->next_line * 8 + sx; |
2074 | if (rev_copy) { | 2085 | if (rev_copy) { |
2075 | while (height--) { | 2086 | while (height--) { |
2076 | dst_idx -= par->next_line*8; | 2087 | dst_idx -= par->next_line * 8; |
2077 | src_idx -= par->next_line*8; | 2088 | src_idx -= par->next_line * 8; |
2078 | copy_one_line_rev(info->var.bits_per_pixel, | 2089 | copy_one_line_rev(info->var.bits_per_pixel, |
2079 | par->next_plane, dst, dst_idx, src, | 2090 | par->next_plane, dst, dst_idx, src, |
2080 | src_idx, width); | 2091 | src_idx, width); |
@@ -2084,8 +2095,8 @@ static void amifb_copyarea(struct fb_info *info, | |||
2084 | copy_one_line(info->var.bits_per_pixel, | 2095 | copy_one_line(info->var.bits_per_pixel, |
2085 | par->next_plane, dst, dst_idx, src, | 2096 | par->next_plane, dst, dst_idx, src, |
2086 | src_idx, width); | 2097 | src_idx, width); |
2087 | dst_idx += par->next_line*8; | 2098 | dst_idx += par->next_line * 8; |
2088 | src_idx += par->next_line*8; | 2099 | src_idx += par->next_line * 8; |
2089 | } | 2100 | } |
2090 | } | 2101 | } |
2091 | } | 2102 | } |
@@ -2095,28 +2106,29 @@ static inline void expand_one_line(int bpp, unsigned long next_plane, | |||
2095 | unsigned long *dst, int dst_idx, u32 n, | 2106 | unsigned long *dst, int dst_idx, u32 n, |
2096 | const u8 *data, u32 bgcolor, u32 fgcolor) | 2107 | const u8 *data, u32 bgcolor, u32 fgcolor) |
2097 | { | 2108 | { |
2098 | const unsigned long *src; | 2109 | const unsigned long *src; |
2099 | int src_idx; | 2110 | int src_idx; |
2100 | 2111 | ||
2101 | while (1) { | 2112 | while (1) { |
2102 | dst += dst_idx >> SHIFT_PER_LONG; | 2113 | dst += dst_idx >> SHIFT_PER_LONG; |
2103 | dst_idx &= (BITS_PER_LONG-1); | 2114 | dst_idx &= (BITS_PER_LONG - 1); |
2104 | if ((bgcolor ^ fgcolor) & 1) { | 2115 | if ((bgcolor ^ fgcolor) & 1) { |
2105 | src = (unsigned long *)((unsigned long)data & ~(BYTES_PER_LONG-1)); | 2116 | src = (unsigned long *) |
2106 | src_idx = ((unsigned long)data & (BYTES_PER_LONG-1))*8; | 2117 | ((unsigned long)data & ~(BYTES_PER_LONG - 1)); |
2107 | if (fgcolor & 1) | 2118 | src_idx = ((unsigned long)data & (BYTES_PER_LONG - 1)) * 8; |
2108 | bitcpy(dst, dst_idx, src, src_idx, n); | 2119 | if (fgcolor & 1) |
2109 | else | 2120 | bitcpy(dst, dst_idx, src, src_idx, n); |
2110 | bitcpy_not(dst, dst_idx, src, src_idx, n); | 2121 | else |
2111 | /* set or clear */ | 2122 | bitcpy_not(dst, dst_idx, src, src_idx, n); |
2112 | } else | 2123 | /* set or clear */ |
2113 | bitfill32(dst, dst_idx, fgcolor & 1 ? ~0 : 0, n); | 2124 | } else |
2114 | if (!--bpp) | 2125 | bitfill32(dst, dst_idx, fgcolor & 1 ? ~0 : 0, n); |
2115 | break; | 2126 | if (!--bpp) |
2116 | bgcolor >>= 1; | 2127 | break; |
2117 | fgcolor >>= 1; | 2128 | bgcolor >>= 1; |
2118 | dst_idx += next_plane*8; | 2129 | fgcolor >>= 1; |
2119 | } | 2130 | dst_idx += next_plane * 8; |
2131 | } | ||
2120 | } | 2132 | } |
2121 | 2133 | ||
2122 | 2134 | ||
@@ -2145,17 +2157,17 @@ static void amifb_imageblit(struct fb_info *info, const struct fb_image *image) | |||
2145 | 2157 | ||
2146 | if (image->depth == 1) { | 2158 | if (image->depth == 1) { |
2147 | dst = (unsigned long *) | 2159 | dst = (unsigned long *) |
2148 | ((unsigned long)info->screen_base & ~(BYTES_PER_LONG-1)); | 2160 | ((unsigned long)info->screen_base & ~(BYTES_PER_LONG - 1)); |
2149 | dst_idx = ((unsigned long)info->screen_base & (BYTES_PER_LONG-1))*8; | 2161 | dst_idx = ((unsigned long)info->screen_base & (BYTES_PER_LONG - 1)) * 8; |
2150 | dst_idx += dy*par->next_line*8+dx; | 2162 | dst_idx += dy * par->next_line * 8 + dx; |
2151 | src = image->data; | 2163 | src = image->data; |
2152 | pitch = (image->width+7)/8; | 2164 | pitch = (image->width + 7) / 8; |
2153 | while (height--) { | 2165 | while (height--) { |
2154 | expand_one_line(info->var.bits_per_pixel, | 2166 | expand_one_line(info->var.bits_per_pixel, |
2155 | par->next_plane, dst, dst_idx, width, | 2167 | par->next_plane, dst, dst_idx, width, |
2156 | src, image->bg_color, | 2168 | src, image->bg_color, |
2157 | image->fg_color); | 2169 | image->fg_color); |
2158 | dst_idx += par->next_line*8; | 2170 | dst_idx += par->next_line * 8; |
2159 | src += pitch; | 2171 | src += pitch; |
2160 | } | 2172 | } |
2161 | } else { | 2173 | } else { |
@@ -2182,39 +2194,38 @@ static int amifb_ioctl(struct fb_info *info, | |||
2182 | int i; | 2194 | int i; |
2183 | 2195 | ||
2184 | switch (cmd) { | 2196 | switch (cmd) { |
2185 | case FBIOGET_FCURSORINFO: | 2197 | case FBIOGET_FCURSORINFO: |
2186 | i = ami_get_fix_cursorinfo(&crsr.fix); | 2198 | i = ami_get_fix_cursorinfo(&crsr.fix); |
2187 | if (i) | 2199 | if (i) |
2188 | return i; | 2200 | return i; |
2189 | return copy_to_user(argp, &crsr.fix, | 2201 | return copy_to_user(argp, &crsr.fix, |
2190 | sizeof(crsr.fix)) ? -EFAULT : 0; | 2202 | sizeof(crsr.fix)) ? -EFAULT : 0; |
2191 | 2203 | ||
2192 | case FBIOGET_VCURSORINFO: | 2204 | case FBIOGET_VCURSORINFO: |
2193 | i = ami_get_var_cursorinfo(&crsr.var, | 2205 | i = ami_get_var_cursorinfo(&crsr.var, |
2194 | ((struct fb_var_cursorinfo __user *)arg)->data); | 2206 | ((struct fb_var_cursorinfo __user *)arg)->data); |
2195 | if (i) | 2207 | if (i) |
2196 | return i; | 2208 | return i; |
2197 | return copy_to_user(argp, &crsr.var, | 2209 | return copy_to_user(argp, &crsr.var, |
2198 | sizeof(crsr.var)) ? -EFAULT : 0; | 2210 | sizeof(crsr.var)) ? -EFAULT : 0; |
2199 | 2211 | ||
2200 | case FBIOPUT_VCURSORINFO: | 2212 | case FBIOPUT_VCURSORINFO: |
2201 | if (copy_from_user(&crsr.var, argp, sizeof(crsr.var))) | 2213 | if (copy_from_user(&crsr.var, argp, sizeof(crsr.var))) |
2202 | return -EFAULT; | 2214 | return -EFAULT; |
2203 | return ami_set_var_cursorinfo(&crsr.var, | 2215 | return ami_set_var_cursorinfo(&crsr.var, |
2204 | ((struct fb_var_cursorinfo __user *)arg)->data); | 2216 | ((struct fb_var_cursorinfo __user *)arg)->data); |
2205 | 2217 | ||
2206 | case FBIOGET_CURSORSTATE: | 2218 | case FBIOGET_CURSORSTATE: |
2207 | i = ami_get_cursorstate(&crsr.state); | 2219 | i = ami_get_cursorstate(&crsr.state); |
2208 | if (i) | 2220 | if (i) |
2209 | return i; | 2221 | return i; |
2210 | return copy_to_user(argp, &crsr.state, | 2222 | return copy_to_user(argp, &crsr.state, |
2211 | sizeof(crsr.state)) ? -EFAULT : 0; | 2223 | sizeof(crsr.state)) ? -EFAULT : 0; |
2212 | 2224 | ||
2213 | case FBIOPUT_CURSORSTATE: | 2225 | case FBIOPUT_CURSORSTATE: |
2214 | if (copy_from_user(&crsr.state, argp, | 2226 | if (copy_from_user(&crsr.state, argp, sizeof(crsr.state))) |
2215 | sizeof(crsr.state))) | 2227 | return -EFAULT; |
2216 | return -EFAULT; | 2228 | return ami_set_cursorstate(&crsr.state); |
2217 | return ami_set_cursorstate(&crsr.state); | ||
2218 | } | 2229 | } |
2219 | return -EINVAL; | 2230 | return -EINVAL; |
2220 | } | 2231 | } |
@@ -2267,69 +2278,68 @@ static int __init amifb_probe(struct platform_device *pdev) | |||
2267 | 2278 | ||
2268 | switch (amiga_chipset) { | 2279 | switch (amiga_chipset) { |
2269 | #ifdef CONFIG_FB_AMIGA_OCS | 2280 | #ifdef CONFIG_FB_AMIGA_OCS |
2270 | case CS_OCS: | 2281 | case CS_OCS: |
2271 | strcat(fb_info.fix.id, "OCS"); | 2282 | strcat(fb_info.fix.id, "OCS"); |
2272 | default_chipset: | 2283 | default_chipset: |
2273 | chipset = TAG_OCS; | 2284 | chipset = TAG_OCS; |
2274 | maxdepth[TAG_SHRES] = 0; /* OCS means no SHRES */ | 2285 | maxdepth[TAG_SHRES] = 0; /* OCS means no SHRES */ |
2275 | maxdepth[TAG_HIRES] = 4; | 2286 | maxdepth[TAG_HIRES] = 4; |
2276 | maxdepth[TAG_LORES] = 6; | 2287 | maxdepth[TAG_LORES] = 6; |
2277 | maxfmode = TAG_FMODE_1; | 2288 | maxfmode = TAG_FMODE_1; |
2278 | defmode = amiga_vblank == 50 ? DEFMODE_PAL | 2289 | defmode = amiga_vblank == 50 ? DEFMODE_PAL : DEFMODE_NTSC; |
2279 | : DEFMODE_NTSC; | 2290 | fb_info.fix.smem_len = VIDEOMEMSIZE_OCS; |
2280 | fb_info.fix.smem_len = VIDEOMEMSIZE_OCS; | 2291 | break; |
2281 | break; | ||
2282 | #endif /* CONFIG_FB_AMIGA_OCS */ | 2292 | #endif /* CONFIG_FB_AMIGA_OCS */ |
2283 | 2293 | ||
2284 | #ifdef CONFIG_FB_AMIGA_ECS | 2294 | #ifdef CONFIG_FB_AMIGA_ECS |
2285 | case CS_ECS: | 2295 | case CS_ECS: |
2286 | strcat(fb_info.fix.id, "ECS"); | 2296 | strcat(fb_info.fix.id, "ECS"); |
2287 | chipset = TAG_ECS; | 2297 | chipset = TAG_ECS; |
2288 | maxdepth[TAG_SHRES] = 2; | 2298 | maxdepth[TAG_SHRES] = 2; |
2289 | maxdepth[TAG_HIRES] = 4; | 2299 | maxdepth[TAG_HIRES] = 4; |
2290 | maxdepth[TAG_LORES] = 6; | 2300 | maxdepth[TAG_LORES] = 6; |
2291 | maxfmode = TAG_FMODE_1; | 2301 | maxfmode = TAG_FMODE_1; |
2292 | if (AMIGAHW_PRESENT(AMBER_FF)) | 2302 | if (AMIGAHW_PRESENT(AMBER_FF)) |
2293 | defmode = amiga_vblank == 50 ? DEFMODE_AMBER_PAL | 2303 | defmode = amiga_vblank == 50 ? DEFMODE_AMBER_PAL |
2294 | : DEFMODE_AMBER_NTSC; | 2304 | : DEFMODE_AMBER_NTSC; |
2295 | else | 2305 | else |
2296 | defmode = amiga_vblank == 50 ? DEFMODE_PAL | 2306 | defmode = amiga_vblank == 50 ? DEFMODE_PAL |
2297 | : DEFMODE_NTSC; | 2307 | : DEFMODE_NTSC; |
2298 | if (amiga_chip_avail()-CHIPRAM_SAFETY_LIMIT > | 2308 | if (amiga_chip_avail() - CHIPRAM_SAFETY_LIMIT > |
2299 | VIDEOMEMSIZE_ECS_2M) | 2309 | VIDEOMEMSIZE_ECS_2M) |
2300 | fb_info.fix.smem_len = VIDEOMEMSIZE_ECS_2M; | 2310 | fb_info.fix.smem_len = VIDEOMEMSIZE_ECS_2M; |
2301 | else | 2311 | else |
2302 | fb_info.fix.smem_len = VIDEOMEMSIZE_ECS_1M; | 2312 | fb_info.fix.smem_len = VIDEOMEMSIZE_ECS_1M; |
2303 | break; | 2313 | break; |
2304 | #endif /* CONFIG_FB_AMIGA_ECS */ | 2314 | #endif /* CONFIG_FB_AMIGA_ECS */ |
2305 | 2315 | ||
2306 | #ifdef CONFIG_FB_AMIGA_AGA | 2316 | #ifdef CONFIG_FB_AMIGA_AGA |
2307 | case CS_AGA: | 2317 | case CS_AGA: |
2308 | strcat(fb_info.fix.id, "AGA"); | 2318 | strcat(fb_info.fix.id, "AGA"); |
2309 | chipset = TAG_AGA; | 2319 | chipset = TAG_AGA; |
2310 | maxdepth[TAG_SHRES] = 8; | 2320 | maxdepth[TAG_SHRES] = 8; |
2311 | maxdepth[TAG_HIRES] = 8; | 2321 | maxdepth[TAG_HIRES] = 8; |
2312 | maxdepth[TAG_LORES] = 8; | 2322 | maxdepth[TAG_LORES] = 8; |
2313 | maxfmode = TAG_FMODE_4; | 2323 | maxfmode = TAG_FMODE_4; |
2314 | defmode = DEFMODE_AGA; | 2324 | defmode = DEFMODE_AGA; |
2315 | if (amiga_chip_avail()-CHIPRAM_SAFETY_LIMIT > | 2325 | if (amiga_chip_avail() - CHIPRAM_SAFETY_LIMIT > |
2316 | VIDEOMEMSIZE_AGA_2M) | 2326 | VIDEOMEMSIZE_AGA_2M) |
2317 | fb_info.fix.smem_len = VIDEOMEMSIZE_AGA_2M; | 2327 | fb_info.fix.smem_len = VIDEOMEMSIZE_AGA_2M; |
2318 | else | 2328 | else |
2319 | fb_info.fix.smem_len = VIDEOMEMSIZE_AGA_1M; | 2329 | fb_info.fix.smem_len = VIDEOMEMSIZE_AGA_1M; |
2320 | break; | 2330 | break; |
2321 | #endif /* CONFIG_FB_AMIGA_AGA */ | 2331 | #endif /* CONFIG_FB_AMIGA_AGA */ |
2322 | 2332 | ||
2323 | default: | 2333 | default: |
2324 | #ifdef CONFIG_FB_AMIGA_OCS | 2334 | #ifdef CONFIG_FB_AMIGA_OCS |
2325 | printk("Unknown graphics chipset, defaulting to OCS\n"); | 2335 | printk("Unknown graphics chipset, defaulting to OCS\n"); |
2326 | strcat(fb_info.fix.id, "Unknown"); | 2336 | strcat(fb_info.fix.id, "Unknown"); |
2327 | goto default_chipset; | 2337 | goto default_chipset; |
2328 | #else /* CONFIG_FB_AMIGA_OCS */ | 2338 | #else /* CONFIG_FB_AMIGA_OCS */ |
2329 | err = -ENODEV; | 2339 | err = -ENODEV; |
2330 | goto amifb_error; | 2340 | goto amifb_error; |
2331 | #endif /* CONFIG_FB_AMIGA_OCS */ | 2341 | #endif /* CONFIG_FB_AMIGA_OCS */ |
2332 | break; | 2342 | break; |
2333 | } | 2343 | } |
2334 | 2344 | ||
2335 | /* | 2345 | /* |
@@ -2360,10 +2370,10 @@ default_chipset: | |||
2360 | * These monitor specs are for a typical Amiga monitor (e.g. A1960) | 2370 | * These monitor specs are for a typical Amiga monitor (e.g. A1960) |
2361 | */ | 2371 | */ |
2362 | if (fb_info.monspecs.hfmin == 0) { | 2372 | if (fb_info.monspecs.hfmin == 0) { |
2363 | fb_info.monspecs.hfmin = 15000; | 2373 | fb_info.monspecs.hfmin = 15000; |
2364 | fb_info.monspecs.hfmax = 38000; | 2374 | fb_info.monspecs.hfmax = 38000; |
2365 | fb_info.monspecs.vfmin = 49; | 2375 | fb_info.monspecs.vfmin = 49; |
2366 | fb_info.monspecs.vfmax = 90; | 2376 | fb_info.monspecs.vfmax = 90; |
2367 | } | 2377 | } |
2368 | 2378 | ||
2369 | fb_info.fbops = &amifb_ops; | 2379 | fb_info.fbops = &amifb_ops; |
@@ -2381,11 +2391,9 @@ default_chipset: | |||
2381 | &fb_info.modelist); | 2391 | &fb_info.modelist); |
2382 | 2392 | ||
2383 | round_down_bpp = 0; | 2393 | round_down_bpp = 0; |
2384 | chipptr = chipalloc(fb_info.fix.smem_len+ | 2394 | chipptr = chipalloc(fb_info.fix.smem_len + SPRITEMEMSIZE + |
2385 | SPRITEMEMSIZE+ | 2395 | DUMMYSPRITEMEMSIZE + COPINITSIZE + |
2386 | DUMMYSPRITEMEMSIZE+ | 2396 | 4 * COPLISTSIZE); |
2387 | COPINITSIZE+ | ||
2388 | 4*COPLISTSIZE); | ||
2389 | if (!chipptr) { | 2397 | if (!chipptr) { |
2390 | err = -ENOMEM; | 2398 | err = -ENOMEM; |
2391 | goto amifb_error; | 2399 | goto amifb_error; |
@@ -2419,7 +2427,7 @@ default_chipset: | |||
2419 | */ | 2427 | */ |
2420 | 2428 | ||
2421 | custom.dmacon = DMAF_SETCLR | DMAF_MASTER | DMAF_RASTER | DMAF_COPPER | | 2429 | custom.dmacon = DMAF_SETCLR | DMAF_MASTER | DMAF_RASTER | DMAF_COPPER | |
2422 | DMAF_BLITTER | DMAF_SPRITE; | 2430 | DMAF_BLITTER | DMAF_SPRITE; |
2423 | 2431 | ||
2424 | /* | 2432 | /* |
2425 | * Make sure the Copper has something to do | 2433 | * Make sure the Copper has something to do |
@@ -2428,12 +2436,12 @@ default_chipset: | |||
2428 | ami_init_copper(); | 2436 | ami_init_copper(); |
2429 | 2437 | ||
2430 | if (request_irq(IRQ_AMIGA_COPPER, amifb_interrupt, 0, | 2438 | if (request_irq(IRQ_AMIGA_COPPER, amifb_interrupt, 0, |
2431 | "fb vertb handler", ¤tpar)) { | 2439 | "fb vertb handler", ¤tpar)) { |
2432 | err = -EBUSY; | 2440 | err = -EBUSY; |
2433 | goto amifb_error; | 2441 | goto amifb_error; |
2434 | } | 2442 | } |
2435 | 2443 | ||
2436 | err = fb_alloc_cmap(&fb_info.cmap, 1<<fb_info.var.bits_per_pixel, 0); | 2444 | err = fb_alloc_cmap(&fb_info.cmap, 1 << fb_info.var.bits_per_pixel, 0); |
2437 | if (err) | 2445 | if (err) |
2438 | goto amifb_error; | 2446 | goto amifb_error; |
2439 | 2447 | ||
@@ -2459,7 +2467,7 @@ static void amifb_deinit(struct platform_device *pdev) | |||
2459 | fb_dealloc_cmap(&fb_info.cmap); | 2467 | fb_dealloc_cmap(&fb_info.cmap); |
2460 | chipfree(); | 2468 | chipfree(); |
2461 | if (videomemory) | 2469 | if (videomemory) |
2462 | iounmap((void*)videomemory); | 2470 | iounmap((void *)videomemory); |
2463 | custom.dmacon = DMAF_ALL | DMAF_MASTER; | 2471 | custom.dmacon = DMAF_ALL | DMAF_MASTER; |
2464 | } | 2472 | } |
2465 | 2473 | ||
@@ -2539,7 +2547,7 @@ static irqreturn_t amifb_interrupt(int irq, void *dev_id) | |||
2539 | */ | 2547 | */ |
2540 | 2548 | ||
2541 | static int ami_decode_var(struct fb_var_screeninfo *var, | 2549 | static int ami_decode_var(struct fb_var_screeninfo *var, |
2542 | struct amifb_par *par) | 2550 | struct amifb_par *par) |
2543 | { | 2551 | { |
2544 | u_short clk_shift, line_shift; | 2552 | u_short clk_shift, line_shift; |
2545 | u_long maxfetchstop, fstrt, fsize, fconst, xres_n, yres_n; | 2553 | u_long maxfetchstop, fstrt, fsize, fconst, xres_n, yres_n; |
@@ -2606,23 +2614,23 @@ static int ami_decode_var(struct fb_var_screeninfo *var, | |||
2606 | 2614 | ||
2607 | par->vmode = var->vmode | FB_VMODE_SMOOTH_XPAN; | 2615 | par->vmode = var->vmode | FB_VMODE_SMOOTH_XPAN; |
2608 | switch (par->vmode & FB_VMODE_MASK) { | 2616 | switch (par->vmode & FB_VMODE_MASK) { |
2609 | case FB_VMODE_INTERLACED: | 2617 | case FB_VMODE_INTERLACED: |
2610 | line_shift = 0; | 2618 | line_shift = 0; |
2611 | break; | 2619 | break; |
2612 | case FB_VMODE_NONINTERLACED: | 2620 | case FB_VMODE_NONINTERLACED: |
2613 | line_shift = 1; | 2621 | line_shift = 1; |
2614 | break; | 2622 | break; |
2615 | case FB_VMODE_DOUBLE: | 2623 | case FB_VMODE_DOUBLE: |
2616 | if (!IS_AGA) { | 2624 | if (!IS_AGA) { |
2617 | DPRINTK("double mode only possible with aga\n"); | 2625 | DPRINTK("double mode only possible with aga\n"); |
2618 | return -EINVAL; | ||
2619 | } | ||
2620 | line_shift = 2; | ||
2621 | break; | ||
2622 | default: | ||
2623 | DPRINTK("unknown video mode\n"); | ||
2624 | return -EINVAL; | 2626 | return -EINVAL; |
2625 | break; | 2627 | } |
2628 | line_shift = 2; | ||
2629 | break; | ||
2630 | default: | ||
2631 | DPRINTK("unknown video mode\n"); | ||
2632 | return -EINVAL; | ||
2633 | break; | ||
2626 | } | 2634 | } |
2627 | par->line_shift = line_shift; | 2635 | par->line_shift = line_shift; |
2628 | 2636 | ||
@@ -2630,26 +2638,31 @@ static int ami_decode_var(struct fb_var_screeninfo *var, | |||
2630 | * Vertical and Horizontal Timings | 2638 | * Vertical and Horizontal Timings |
2631 | */ | 2639 | */ |
2632 | 2640 | ||
2633 | xres_n = par->xres<<clk_shift; | 2641 | xres_n = par->xres << clk_shift; |
2634 | yres_n = par->yres<<line_shift; | 2642 | yres_n = par->yres << line_shift; |
2635 | par->htotal = down8((var->left_margin+par->xres+var->right_margin+var->hsync_len)<<clk_shift); | 2643 | par->htotal = down8((var->left_margin + par->xres + var->right_margin + |
2636 | par->vtotal = down2(((var->upper_margin+par->yres+var->lower_margin+var->vsync_len)<<line_shift)+1); | 2644 | var->hsync_len) << clk_shift); |
2645 | par->vtotal = | ||
2646 | down2(((var->upper_margin + par->yres + var->lower_margin + | ||
2647 | var->vsync_len) << line_shift) + 1); | ||
2637 | 2648 | ||
2638 | if (IS_AGA) | 2649 | if (IS_AGA) |
2639 | par->bplcon3 = sprpixmode[clk_shift]; | 2650 | par->bplcon3 = sprpixmode[clk_shift]; |
2640 | else | 2651 | else |
2641 | par->bplcon3 = 0; | 2652 | par->bplcon3 = 0; |
2642 | if (var->sync & FB_SYNC_BROADCAST) { | 2653 | if (var->sync & FB_SYNC_BROADCAST) { |
2643 | par->diwstop_h = par->htotal-((var->right_margin-var->hsync_len)<<clk_shift); | 2654 | par->diwstop_h = par->htotal - |
2655 | ((var->right_margin - var->hsync_len) << clk_shift); | ||
2644 | if (IS_AGA) | 2656 | if (IS_AGA) |
2645 | par->diwstop_h += mod4(var->hsync_len); | 2657 | par->diwstop_h += mod4(var->hsync_len); |
2646 | else | 2658 | else |
2647 | par->diwstop_h = down4(par->diwstop_h); | 2659 | par->diwstop_h = down4(par->diwstop_h); |
2648 | 2660 | ||
2649 | par->diwstrt_h = par->diwstop_h - xres_n; | 2661 | par->diwstrt_h = par->diwstop_h - xres_n; |
2650 | par->diwstop_v = par->vtotal-((var->lower_margin-var->vsync_len)<<line_shift); | 2662 | par->diwstop_v = par->vtotal - |
2663 | ((var->lower_margin - var->vsync_len) << line_shift); | ||
2651 | par->diwstrt_v = par->diwstop_v - yres_n; | 2664 | par->diwstrt_v = par->diwstop_v - yres_n; |
2652 | if (par->diwstop_h >= par->htotal+8) { | 2665 | if (par->diwstop_h >= par->htotal + 8) { |
2653 | DPRINTK("invalid diwstop_h\n"); | 2666 | DPRINTK("invalid diwstop_h\n"); |
2654 | return -EINVAL; | 2667 | return -EINVAL; |
2655 | } | 2668 | } |
@@ -2670,7 +2683,7 @@ static int ami_decode_var(struct fb_var_screeninfo *var, | |||
2670 | par->vsstrt = 0; | 2683 | par->vsstrt = 0; |
2671 | par->vsstop = 0; | 2684 | par->vsstop = 0; |
2672 | } | 2685 | } |
2673 | if (par->vtotal > (PAL_VTOTAL+NTSC_VTOTAL)/2) { | 2686 | if (par->vtotal > (PAL_VTOTAL + NTSC_VTOTAL) / 2) { |
2674 | /* PAL video mode */ | 2687 | /* PAL video mode */ |
2675 | if (par->htotal != PAL_HTOTAL) { | 2688 | if (par->htotal != PAL_HTOTAL) { |
2676 | DPRINTK("htotal invalid for pal\n"); | 2689 | DPRINTK("htotal invalid for pal\n"); |
@@ -2690,7 +2703,7 @@ static int ami_decode_var(struct fb_var_screeninfo *var, | |||
2690 | par->beamcon0 = BMC0_PAL; | 2703 | par->beamcon0 = BMC0_PAL; |
2691 | par->bplcon3 |= BPC3_BRDRBLNK; | 2704 | par->bplcon3 |= BPC3_BRDRBLNK; |
2692 | } else if (AMIGAHW_PRESENT(AGNUS_HR_PAL) || | 2705 | } else if (AMIGAHW_PRESENT(AGNUS_HR_PAL) || |
2693 | AMIGAHW_PRESENT(AGNUS_HR_NTSC)) { | 2706 | AMIGAHW_PRESENT(AGNUS_HR_NTSC)) { |
2694 | par->beamcon0 = BMC0_PAL; | 2707 | par->beamcon0 = BMC0_PAL; |
2695 | par->hsstop = 1; | 2708 | par->hsstop = 1; |
2696 | } else if (amiga_vblank != 50) { | 2709 | } else if (amiga_vblank != 50) { |
@@ -2720,7 +2733,7 @@ static int ami_decode_var(struct fb_var_screeninfo *var, | |||
2720 | par->beamcon0 = 0; | 2733 | par->beamcon0 = 0; |
2721 | par->bplcon3 |= BPC3_BRDRBLNK; | 2734 | par->bplcon3 |= BPC3_BRDRBLNK; |
2722 | } else if (AMIGAHW_PRESENT(AGNUS_HR_PAL) || | 2735 | } else if (AMIGAHW_PRESENT(AGNUS_HR_PAL) || |
2723 | AMIGAHW_PRESENT(AGNUS_HR_NTSC)) { | 2736 | AMIGAHW_PRESENT(AGNUS_HR_NTSC)) { |
2724 | par->beamcon0 = 0; | 2737 | par->beamcon0 = 0; |
2725 | par->hsstop = 1; | 2738 | par->hsstop = 1; |
2726 | } else if (amiga_vblank != 60) { | 2739 | } else if (amiga_vblank != 60) { |
@@ -2737,8 +2750,8 @@ static int ami_decode_var(struct fb_var_screeninfo *var, | |||
2737 | } | 2750 | } |
2738 | } else if (!IS_OCS) { | 2751 | } else if (!IS_OCS) { |
2739 | /* Programmable video mode */ | 2752 | /* Programmable video mode */ |
2740 | par->hsstrt = var->right_margin<<clk_shift; | 2753 | par->hsstrt = var->right_margin << clk_shift; |
2741 | par->hsstop = (var->right_margin+var->hsync_len)<<clk_shift; | 2754 | par->hsstop = (var->right_margin + var->hsync_len) << clk_shift; |
2742 | par->diwstop_h = par->htotal - mod8(par->hsstrt) + 8 - (1 << clk_shift); | 2755 | par->diwstop_h = par->htotal - mod8(par->hsstrt) + 8 - (1 << clk_shift); |
2743 | if (!IS_AGA) | 2756 | if (!IS_AGA) |
2744 | par->diwstop_h = down4(par->diwstop_h) - 16; | 2757 | par->diwstop_h = down4(par->diwstop_h) - 16; |
@@ -2748,8 +2761,8 @@ static int ami_decode_var(struct fb_var_screeninfo *var, | |||
2748 | if (par->hbstrt >= par->htotal + 8) | 2761 | if (par->hbstrt >= par->htotal + 8) |
2749 | par->hbstrt -= par->htotal; | 2762 | par->hbstrt -= par->htotal; |
2750 | par->hcenter = par->hsstrt + (par->htotal >> 1); | 2763 | par->hcenter = par->hsstrt + (par->htotal >> 1); |
2751 | par->vsstrt = var->lower_margin<<line_shift; | 2764 | par->vsstrt = var->lower_margin << line_shift; |
2752 | par->vsstop = (var->lower_margin+var->vsync_len)<<line_shift; | 2765 | par->vsstop = (var->lower_margin + var->vsync_len) << line_shift; |
2753 | par->diwstop_v = par->vtotal; | 2766 | par->diwstop_v = par->vtotal; |
2754 | if ((par->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) | 2767 | if ((par->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) |
2755 | par->diwstop_v -= 2; | 2768 | par->diwstop_v -= 2; |
@@ -2766,8 +2779,8 @@ static int ami_decode_var(struct fb_var_screeninfo *var, | |||
2766 | } | 2779 | } |
2767 | par->bplcon3 |= BPC3_EXTBLKEN; | 2780 | par->bplcon3 |= BPC3_EXTBLKEN; |
2768 | par->beamcon0 = BMC0_HARDDIS | BMC0_VARVBEN | BMC0_LOLDIS | | 2781 | par->beamcon0 = BMC0_HARDDIS | BMC0_VARVBEN | BMC0_LOLDIS | |
2769 | BMC0_VARVSYEN | BMC0_VARHSYEN | BMC0_VARBEAMEN | | 2782 | BMC0_VARVSYEN | BMC0_VARHSYEN | BMC0_VARBEAMEN | |
2770 | BMC0_PAL | BMC0_VARCSYEN; | 2783 | BMC0_PAL | BMC0_VARCSYEN; |
2771 | if (var->sync & FB_SYNC_HOR_HIGH_ACT) | 2784 | if (var->sync & FB_SYNC_HOR_HIGH_ACT) |
2772 | par->beamcon0 |= BMC0_HSYTRUE; | 2785 | par->beamcon0 |= BMC0_HSYTRUE; |
2773 | if (var->sync & FB_SYNC_VERT_HIGH_ACT) | 2786 | if (var->sync & FB_SYNC_VERT_HIGH_ACT) |
@@ -2785,7 +2798,7 @@ static int ami_decode_var(struct fb_var_screeninfo *var, | |||
2785 | * Checking the DMA timing | 2798 | * Checking the DMA timing |
2786 | */ | 2799 | */ |
2787 | 2800 | ||
2788 | fconst = 16<<maxfmode<<clk_shift; | 2801 | fconst = 16 << maxfmode << clk_shift; |
2789 | 2802 | ||
2790 | /* | 2803 | /* |
2791 | * smallest window start value without turn off other dma cycles | 2804 | * smallest window start value without turn off other dma cycles |
@@ -2793,8 +2806,8 @@ static int ami_decode_var(struct fb_var_screeninfo *var, | |||
2793 | */ | 2806 | */ |
2794 | 2807 | ||
2795 | 2808 | ||
2796 | fsize = ((maxfmode+clk_shift <= 1) ? fconst : 64); | 2809 | fsize = ((maxfmode + clk_shift <= 1) ? fconst : 64); |
2797 | fstrt = downx(fconst, par->diwstrt_h-4) - fsize; | 2810 | fstrt = downx(fconst, par->diwstrt_h - 4) - fsize; |
2798 | if (fstrt < min_fstrt) { | 2811 | if (fstrt < min_fstrt) { |
2799 | DPRINTK("fetch start too low\n"); | 2812 | DPRINTK("fetch start too low\n"); |
2800 | return -EINVAL; | 2813 | return -EINVAL; |
@@ -2804,14 +2817,16 @@ static int ami_decode_var(struct fb_var_screeninfo *var, | |||
2804 | * smallest window start value where smooth scrolling is possible | 2817 | * smallest window start value where smooth scrolling is possible |
2805 | */ | 2818 | */ |
2806 | 2819 | ||
2807 | fstrt = downx(fconst, par->diwstrt_h-fconst+(1<<clk_shift)-4) - fsize; | 2820 | fstrt = downx(fconst, par->diwstrt_h - fconst + (1 << clk_shift) - 4) - |
2821 | fsize; | ||
2808 | if (fstrt < min_fstrt) | 2822 | if (fstrt < min_fstrt) |
2809 | par->vmode &= ~FB_VMODE_SMOOTH_XPAN; | 2823 | par->vmode &= ~FB_VMODE_SMOOTH_XPAN; |
2810 | 2824 | ||
2811 | maxfetchstop = down16(par->htotal - 80); | 2825 | maxfetchstop = down16(par->htotal - 80); |
2812 | 2826 | ||
2813 | fstrt = downx(fconst, par->diwstrt_h-4) - 64 - fconst; | 2827 | fstrt = downx(fconst, par->diwstrt_h - 4) - 64 - fconst; |
2814 | fsize = upx(fconst, xres_n + modx(fconst, downx(1<<clk_shift, par->diwstrt_h-4))); | 2828 | fsize = upx(fconst, xres_n + |
2829 | modx(fconst, downx(1 << clk_shift, par->diwstrt_h - 4))); | ||
2815 | if (fstrt + fsize > maxfetchstop) | 2830 | if (fstrt + fsize > maxfetchstop) |
2816 | par->vmode &= ~FB_VMODE_SMOOTH_XPAN; | 2831 | par->vmode &= ~FB_VMODE_SMOOTH_XPAN; |
2817 | 2832 | ||
@@ -2840,7 +2855,7 @@ static int ami_decode_var(struct fb_var_screeninfo *var, | |||
2840 | * Check if there is enough time to update the bitplane pointers for ywrap | 2855 | * Check if there is enough time to update the bitplane pointers for ywrap |
2841 | */ | 2856 | */ |
2842 | 2857 | ||
2843 | if (par->htotal-fsize-64 < par->bpp*64) | 2858 | if (par->htotal - fsize - 64 < par->bpp * 64) |
2844 | par->vmode &= ~FB_VMODE_YWRAP; | 2859 | par->vmode &= ~FB_VMODE_YWRAP; |
2845 | 2860 | ||
2846 | /* | 2861 | /* |
@@ -2848,15 +2863,15 @@ static int ami_decode_var(struct fb_var_screeninfo *var, | |||
2848 | */ | 2863 | */ |
2849 | 2864 | ||
2850 | if (amifb_ilbm) { | 2865 | if (amifb_ilbm) { |
2851 | par->next_plane = div8(upx(16<<maxfmode, par->vxres)); | 2866 | par->next_plane = div8(upx(16 << maxfmode, par->vxres)); |
2852 | par->next_line = par->bpp*par->next_plane; | 2867 | par->next_line = par->bpp * par->next_plane; |
2853 | if (par->next_line * par->vyres > fb_info.fix.smem_len) { | 2868 | if (par->next_line * par->vyres > fb_info.fix.smem_len) { |
2854 | DPRINTK("too few video mem\n"); | 2869 | DPRINTK("too few video mem\n"); |
2855 | return -EINVAL; | 2870 | return -EINVAL; |
2856 | } | 2871 | } |
2857 | } else { | 2872 | } else { |
2858 | par->next_line = div8(upx(16<<maxfmode, par->vxres)); | 2873 | par->next_line = div8(upx(16 << maxfmode, par->vxres)); |
2859 | par->next_plane = par->vyres*par->next_line; | 2874 | par->next_plane = par->vyres * par->next_line; |
2860 | if (par->next_plane * par->bpp > fb_info.fix.smem_len) { | 2875 | if (par->next_plane * par->bpp > fb_info.fix.smem_len) { |
2861 | DPRINTK("too few video mem\n"); | 2876 | DPRINTK("too few video mem\n"); |
2862 | return -EINVAL; | 2877 | return -EINVAL; |
@@ -2873,7 +2888,7 @@ static int ami_decode_var(struct fb_var_screeninfo *var, | |||
2873 | if (par->bpp == 8) | 2888 | if (par->bpp == 8) |
2874 | par->bplcon0 |= BPC0_BPU3; | 2889 | par->bplcon0 |= BPC0_BPU3; |
2875 | else | 2890 | else |
2876 | par->bplcon0 |= par->bpp<<12; | 2891 | par->bplcon0 |= par->bpp << 12; |
2877 | if (var->nonstd == FB_NONSTD_HAM) | 2892 | if (var->nonstd == FB_NONSTD_HAM) |
2878 | par->bplcon0 |= BPC0_HAM; | 2893 | par->bplcon0 |= BPC0_HAM; |
2879 | if (var->sync & FB_SYNC_EXT) | 2894 | if (var->sync & FB_SYNC_EXT) |
@@ -2883,24 +2898,26 @@ static int ami_decode_var(struct fb_var_screeninfo *var, | |||
2883 | par->fmode = bplfetchmode[maxfmode]; | 2898 | par->fmode = bplfetchmode[maxfmode]; |
2884 | 2899 | ||
2885 | switch (par->vmode & FB_VMODE_MASK) { | 2900 | switch (par->vmode & FB_VMODE_MASK) { |
2886 | case FB_VMODE_INTERLACED: | 2901 | case FB_VMODE_INTERLACED: |
2887 | par->bplcon0 |= BPC0_LACE; | 2902 | par->bplcon0 |= BPC0_LACE; |
2888 | break; | 2903 | break; |
2889 | case FB_VMODE_DOUBLE: | 2904 | case FB_VMODE_DOUBLE: |
2890 | if (IS_AGA) | 2905 | if (IS_AGA) |
2891 | par->fmode |= FMODE_SSCAN2 | FMODE_BSCAN2; | 2906 | par->fmode |= FMODE_SSCAN2 | FMODE_BSCAN2; |
2892 | break; | 2907 | break; |
2893 | } | 2908 | } |
2894 | 2909 | ||
2895 | if (!((par->vmode ^ var->vmode) & FB_VMODE_YWRAP)) { | 2910 | if (!((par->vmode ^ var->vmode) & FB_VMODE_YWRAP)) { |
2896 | par->xoffset = var->xoffset; | 2911 | par->xoffset = var->xoffset; |
2897 | par->yoffset = var->yoffset; | 2912 | par->yoffset = var->yoffset; |
2898 | if (par->vmode & FB_VMODE_YWRAP) { | 2913 | if (par->vmode & FB_VMODE_YWRAP) { |
2899 | if (par->xoffset || par->yoffset < 0 || par->yoffset >= par->vyres) | 2914 | if (par->xoffset || par->yoffset < 0 || |
2915 | par->yoffset >= par->vyres) | ||
2900 | par->xoffset = par->yoffset = 0; | 2916 | par->xoffset = par->yoffset = 0; |
2901 | } else { | 2917 | } else { |
2902 | if (par->xoffset < 0 || par->xoffset > upx(16<<maxfmode, par->vxres-par->xres) || | 2918 | if (par->xoffset < 0 || |
2903 | par->yoffset < 0 || par->yoffset > par->vyres-par->yres) | 2919 | par->xoffset > upx(16 << maxfmode, par->vxres - par->xres) || |
2920 | par->yoffset < 0 || par->yoffset > par->vyres - par->yres) | ||
2904 | par->xoffset = par->yoffset = 0; | 2921 | par->xoffset = par->yoffset = 0; |
2905 | } | 2922 | } |
2906 | } else | 2923 | } else |
@@ -2919,7 +2936,7 @@ static int ami_decode_var(struct fb_var_screeninfo *var, | |||
2919 | */ | 2936 | */ |
2920 | 2937 | ||
2921 | static int ami_encode_var(struct fb_var_screeninfo *var, | 2938 | static int ami_encode_var(struct fb_var_screeninfo *var, |
2922 | struct amifb_par *par) | 2939 | struct amifb_par *par) |
2923 | { | 2940 | { |
2924 | u_short clk_shift, line_shift; | 2941 | u_short clk_shift, line_shift; |
2925 | 2942 | ||
@@ -2942,7 +2959,7 @@ static int ami_encode_var(struct fb_var_screeninfo *var, | |||
2942 | var->red.msb_right = 0; | 2959 | var->red.msb_right = 0; |
2943 | var->red.length = par->bpp; | 2960 | var->red.length = par->bpp; |
2944 | if (par->bplcon0 & BPC0_HAM) | 2961 | if (par->bplcon0 & BPC0_HAM) |
2945 | var->red.length -= 2; | 2962 | var->red.length -= 2; |
2946 | var->blue = var->green = var->red; | 2963 | var->blue = var->green = var->red; |
2947 | var->transp.offset = 0; | 2964 | var->transp.offset = 0; |
2948 | var->transp.length = 0; | 2965 | var->transp.length = 0; |
@@ -2967,10 +2984,10 @@ static int ami_encode_var(struct fb_var_screeninfo *var, | |||
2967 | var->vmode = FB_VMODE_NONINTERLACED; | 2984 | var->vmode = FB_VMODE_NONINTERLACED; |
2968 | 2985 | ||
2969 | if (!IS_OCS && par->beamcon0 & BMC0_VARBEAMEN) { | 2986 | if (!IS_OCS && par->beamcon0 & BMC0_VARBEAMEN) { |
2970 | var->hsync_len = (par->hsstop-par->hsstrt)>>clk_shift; | 2987 | var->hsync_len = (par->hsstop - par->hsstrt)>>clk_shift; |
2971 | var->right_margin = par->hsstrt>>clk_shift; | 2988 | var->right_margin = par->hsstrt>>clk_shift; |
2972 | var->left_margin = (par->htotal>>clk_shift) - var->xres - var->right_margin - var->hsync_len; | 2989 | var->left_margin = (par->htotal>>clk_shift) - var->xres - var->right_margin - var->hsync_len; |
2973 | var->vsync_len = (par->vsstop-par->vsstrt)>>line_shift; | 2990 | var->vsync_len = (par->vsstop - par->vsstrt)>>line_shift; |
2974 | var->lower_margin = par->vsstrt>>line_shift; | 2991 | var->lower_margin = par->vsstrt>>line_shift; |
2975 | var->upper_margin = (par->vtotal>>line_shift) - var->yres - var->lower_margin - var->vsync_len; | 2992 | var->upper_margin = (par->vtotal>>line_shift) - var->yres - var->lower_margin - var->vsync_len; |
2976 | var->sync = 0; | 2993 | var->sync = 0; |
@@ -2988,7 +3005,7 @@ static int ami_encode_var(struct fb_var_screeninfo *var, | |||
2988 | var->vsync_len = 4>>line_shift; | 3005 | var->vsync_len = 4>>line_shift; |
2989 | var->lower_margin = ((par->vtotal - par->diwstop_v)>>line_shift) + var->vsync_len; | 3006 | var->lower_margin = ((par->vtotal - par->diwstop_v)>>line_shift) + var->vsync_len; |
2990 | var->upper_margin = (((par->vtotal - 2)>>line_shift) + 1) - var->yres - | 3007 | var->upper_margin = (((par->vtotal - 2)>>line_shift) + 1) - var->yres - |
2991 | var->lower_margin - var->vsync_len; | 3008 | var->lower_margin - var->vsync_len; |
2992 | } | 3009 | } |
2993 | 3010 | ||
2994 | if (par->bplcon0 & BPC0_ERSY) | 3011 | if (par->bplcon0 & BPC0_ERSY) |
@@ -3035,14 +3052,14 @@ static int ami_update_par(void) | |||
3035 | clk_shift = par->clk_shift; | 3052 | clk_shift = par->clk_shift; |
3036 | 3053 | ||
3037 | if (!(par->vmode & FB_VMODE_SMOOTH_XPAN)) | 3054 | if (!(par->vmode & FB_VMODE_SMOOTH_XPAN)) |
3038 | par->xoffset = upx(16<<maxfmode, par->xoffset); | 3055 | par->xoffset = upx(16 << maxfmode, par->xoffset); |
3039 | 3056 | ||
3040 | fconst = 16<<maxfmode<<clk_shift; | 3057 | fconst = 16 << maxfmode << clk_shift; |
3041 | vshift = modx(16<<maxfmode, par->xoffset); | 3058 | vshift = modx(16 << maxfmode, par->xoffset); |
3042 | fstrt = par->diwstrt_h - (vshift<<clk_shift) - 4; | 3059 | fstrt = par->diwstrt_h - (vshift << clk_shift) - 4; |
3043 | fsize = (par->xres+vshift)<<clk_shift; | 3060 | fsize = (par->xres + vshift) << clk_shift; |
3044 | shift = modx(fconst, fstrt); | 3061 | shift = modx(fconst, fstrt); |
3045 | move = downx(2<<maxfmode, div8(par->xoffset)); | 3062 | move = downx(2 << maxfmode, div8(par->xoffset)); |
3046 | if (maxfmode + clk_shift > 1) { | 3063 | if (maxfmode + clk_shift > 1) { |
3047 | fstrt = downx(fconst, fstrt) - 64; | 3064 | fstrt = downx(fconst, fstrt) - 64; |
3048 | fsize = upx(fconst, fsize); | 3065 | fsize = upx(fconst, fsize); |
@@ -3056,7 +3073,7 @@ static int ami_update_par(void) | |||
3056 | fstop += min_fstrt - fstrt; | 3073 | fstop += min_fstrt - fstrt; |
3057 | fstrt = min_fstrt; | 3074 | fstrt = min_fstrt; |
3058 | } | 3075 | } |
3059 | move = move - div8((mod-fstrt)>>clk_shift); | 3076 | move = move - div8((mod - fstrt)>>clk_shift); |
3060 | } | 3077 | } |
3061 | mod = par->next_line - div8(fsize>>clk_shift); | 3078 | mod = par->next_line - div8(fsize>>clk_shift); |
3062 | par->ddfstrt = fstrt; | 3079 | par->ddfstrt = fstrt; |
@@ -3071,11 +3088,14 @@ static int ami_update_par(void) | |||
3071 | par->bpl1mod = par->bpl2mod; | 3088 | par->bpl1mod = par->bpl2mod; |
3072 | 3089 | ||
3073 | if (par->yoffset) { | 3090 | if (par->yoffset) { |
3074 | par->bplpt0 = fb_info.fix.smem_start + par->next_line*par->yoffset + move; | 3091 | par->bplpt0 = fb_info.fix.smem_start + |
3092 | par->next_line * par->yoffset + move; | ||
3075 | if (par->vmode & FB_VMODE_YWRAP) { | 3093 | if (par->vmode & FB_VMODE_YWRAP) { |
3076 | if (par->yoffset > par->vyres-par->yres) { | 3094 | if (par->yoffset > par->vyres - par->yres) { |
3077 | par->bplpt0wrap = fb_info.fix.smem_start + move; | 3095 | par->bplpt0wrap = fb_info.fix.smem_start + move; |
3078 | if (par->bplcon0 & BPC0_LACE && mod2(par->diwstrt_v+par->vyres-par->yoffset)) | 3096 | if (par->bplcon0 & BPC0_LACE && |
3097 | mod2(par->diwstrt_v + par->vyres - | ||
3098 | par->yoffset)) | ||
3079 | par->bplpt0wrap += par->next_line; | 3099 | par->bplpt0wrap += par->next_line; |
3080 | } | 3100 | } |
3081 | } | 3101 | } |
@@ -3096,7 +3116,7 @@ static int ami_update_par(void) | |||
3096 | */ | 3116 | */ |
3097 | 3117 | ||
3098 | static int amifb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | 3118 | static int amifb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, |
3099 | u_int transp, struct fb_info *info) | 3119 | u_int transp, struct fb_info *info) |
3100 | { | 3120 | { |
3101 | if (IS_AGA) { | 3121 | if (IS_AGA) { |
3102 | if (regno > 255) | 3122 | if (regno > 255) |
@@ -3130,10 +3150,13 @@ static int amifb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
3130 | if (IS_AGA) { | 3150 | if (IS_AGA) { |
3131 | u_short bplcon3 = currentpar.bplcon3; | 3151 | u_short bplcon3 = currentpar.bplcon3; |
3132 | VBlankOff(); | 3152 | VBlankOff(); |
3133 | custom.bplcon3 = bplcon3 | (regno<<8 & 0xe000); | 3153 | custom.bplcon3 = bplcon3 | (regno << 8 & 0xe000); |
3134 | custom.color[regno&31] = rgb2hw8_high(red, green, blue); | 3154 | custom.color[regno & 31] = rgb2hw8_high(red, green, |
3135 | custom.bplcon3 = bplcon3 | (regno<<8 & 0xe000) | BPC3_LOCT; | 3155 | blue); |
3136 | custom.color[regno&31] = rgb2hw8_low(red, green, blue); | 3156 | custom.bplcon3 = bplcon3 | (regno << 8 & 0xe000) | |
3157 | BPC3_LOCT; | ||
3158 | custom.color[regno & 31] = rgb2hw8_low(red, green, | ||
3159 | blue); | ||
3137 | custom.bplcon3 = bplcon3; | 3160 | custom.bplcon3 = bplcon3; |
3138 | VBlankOn(); | 3161 | VBlankOn(); |
3139 | } else | 3162 | } else |
@@ -3146,11 +3169,11 @@ static int amifb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
3146 | mask = 0x3333; | 3169 | mask = 0x3333; |
3147 | color = rgb2hw2(red, green, blue); | 3170 | color = rgb2hw2(red, green, blue); |
3148 | VBlankOff(); | 3171 | VBlankOff(); |
3149 | for (i = regno+12; i >= (int)regno; i -= 4) | 3172 | for (i = regno + 12; i >= (int)regno; i -= 4) |
3150 | custom.color[i] = ecs_palette[i] = (ecs_palette[i] & mask) | color; | 3173 | custom.color[i] = ecs_palette[i] = (ecs_palette[i] & mask) | color; |
3151 | mask <<=2; color >>= 2; | 3174 | mask <<= 2; color >>= 2; |
3152 | regno = down16(regno)+mul4(mod4(regno)); | 3175 | regno = down16(regno) + mul4(mod4(regno)); |
3153 | for (i = regno+3; i >= (int)regno; i--) | 3176 | for (i = regno + 3; i >= (int)regno; i--) |
3154 | custom.color[i] = ecs_palette[i] = (ecs_palette[i] & mask) | color; | 3177 | custom.color[i] = ecs_palette[i] = (ecs_palette[i] & mask) | color; |
3155 | VBlankOn(); | 3178 | VBlankOn(); |
3156 | } else | 3179 | } else |
@@ -3243,30 +3266,30 @@ static void ami_do_blank(void) | |||
3243 | red = green = blue = 0; | 3266 | red = green = blue = 0; |
3244 | if (!IS_OCS && do_blank > 1) { | 3267 | if (!IS_OCS && do_blank > 1) { |
3245 | switch (do_blank) { | 3268 | switch (do_blank) { |
3246 | case FB_BLANK_VSYNC_SUSPEND: | 3269 | case FB_BLANK_VSYNC_SUSPEND: |
3247 | custom.hsstrt = hsstrt2hw(par->hsstrt); | 3270 | custom.hsstrt = hsstrt2hw(par->hsstrt); |
3248 | custom.hsstop = hsstop2hw(par->hsstop); | 3271 | custom.hsstop = hsstop2hw(par->hsstop); |
3249 | custom.vsstrt = vsstrt2hw(par->vtotal+4); | 3272 | custom.vsstrt = vsstrt2hw(par->vtotal + 4); |
3250 | custom.vsstop = vsstop2hw(par->vtotal+4); | 3273 | custom.vsstop = vsstop2hw(par->vtotal + 4); |
3251 | break; | 3274 | break; |
3252 | case FB_BLANK_HSYNC_SUSPEND: | 3275 | case FB_BLANK_HSYNC_SUSPEND: |
3253 | custom.hsstrt = hsstrt2hw(par->htotal+16); | 3276 | custom.hsstrt = hsstrt2hw(par->htotal + 16); |
3254 | custom.hsstop = hsstop2hw(par->htotal+16); | 3277 | custom.hsstop = hsstop2hw(par->htotal + 16); |
3255 | custom.vsstrt = vsstrt2hw(par->vsstrt); | 3278 | custom.vsstrt = vsstrt2hw(par->vsstrt); |
3256 | custom.vsstop = vsstrt2hw(par->vsstop); | 3279 | custom.vsstop = vsstrt2hw(par->vsstop); |
3257 | break; | 3280 | break; |
3258 | case FB_BLANK_POWERDOWN: | 3281 | case FB_BLANK_POWERDOWN: |
3259 | custom.hsstrt = hsstrt2hw(par->htotal+16); | 3282 | custom.hsstrt = hsstrt2hw(par->htotal + 16); |
3260 | custom.hsstop = hsstop2hw(par->htotal+16); | 3283 | custom.hsstop = hsstop2hw(par->htotal + 16); |
3261 | custom.vsstrt = vsstrt2hw(par->vtotal+4); | 3284 | custom.vsstrt = vsstrt2hw(par->vtotal + 4); |
3262 | custom.vsstop = vsstop2hw(par->vtotal+4); | 3285 | custom.vsstop = vsstop2hw(par->vtotal + 4); |
3263 | break; | 3286 | break; |
3264 | } | 3287 | } |
3265 | if (!(par->beamcon0 & BMC0_VARBEAMEN)) { | 3288 | if (!(par->beamcon0 & BMC0_VARBEAMEN)) { |
3266 | custom.htotal = htotal2hw(par->htotal); | 3289 | custom.htotal = htotal2hw(par->htotal); |
3267 | custom.vtotal = vtotal2hw(par->vtotal); | 3290 | custom.vtotal = vtotal2hw(par->vtotal); |
3268 | custom.beamcon0 = BMC0_HARDDIS | BMC0_VARBEAMEN | | 3291 | custom.beamcon0 = BMC0_HARDDIS | BMC0_VARBEAMEN | |
3269 | BMC0_VARVSYEN | BMC0_VARHSYEN | BMC0_VARCSYEN; | 3292 | BMC0_VARVSYEN | BMC0_VARHSYEN | BMC0_VARCSYEN; |
3270 | } | 3293 | } |
3271 | } | 3294 | } |
3272 | } else { | 3295 | } else { |
@@ -3300,7 +3323,7 @@ static void ami_do_blank(void) | |||
3300 | color = rgb2hw2(red, green, blue); | 3323 | color = rgb2hw2(red, green, blue); |
3301 | for (i = 12; i >= 0; i -= 4) | 3324 | for (i = 12; i >= 0; i -= 4) |
3302 | custom.color[i] = ecs_palette[i] = (ecs_palette[i] & mask) | color; | 3325 | custom.color[i] = ecs_palette[i] = (ecs_palette[i] & mask) | color; |
3303 | mask <<=2; color >>= 2; | 3326 | mask <<= 2; color >>= 2; |
3304 | for (i = 3; i >= 0; i--) | 3327 | for (i = 3; i >= 0; i--) |
3305 | custom.color[i] = ecs_palette[i] = (ecs_palette[i] & mask) | color; | 3328 | custom.color[i] = ecs_palette[i] = (ecs_palette[i] & mask) | color; |
3306 | } else | 3329 | } else |
@@ -3334,32 +3357,32 @@ static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user * | |||
3334 | short height, width, bits, words; | 3357 | short height, width, bits, words; |
3335 | int size, alloc; | 3358 | int size, alloc; |
3336 | 3359 | ||
3337 | size = par->crsr.height*par->crsr.width; | 3360 | size = par->crsr.height * par->crsr.width; |
3338 | alloc = var->height*var->width; | 3361 | alloc = var->height * var->width; |
3339 | var->height = par->crsr.height; | 3362 | var->height = par->crsr.height; |
3340 | var->width = par->crsr.width; | 3363 | var->width = par->crsr.width; |
3341 | var->xspot = par->crsr.spot_x; | 3364 | var->xspot = par->crsr.spot_x; |
3342 | var->yspot = par->crsr.spot_y; | 3365 | var->yspot = par->crsr.spot_y; |
3343 | if (size > var->height*var->width) | 3366 | if (size > var->height * var->width) |
3344 | return -ENAMETOOLONG; | 3367 | return -ENAMETOOLONG; |
3345 | if (!access_ok(VERIFY_WRITE, data, size)) | 3368 | if (!access_ok(VERIFY_WRITE, data, size)) |
3346 | return -EFAULT; | 3369 | return -EFAULT; |
3347 | delta = 1<<par->crsr.fmode; | 3370 | delta = 1 << par->crsr.fmode; |
3348 | lspr = lofsprite + (delta<<1); | 3371 | lspr = lofsprite + (delta << 1); |
3349 | if (par->bplcon0 & BPC0_LACE) | 3372 | if (par->bplcon0 & BPC0_LACE) |
3350 | sspr = shfsprite + (delta<<1); | 3373 | sspr = shfsprite + (delta << 1); |
3351 | else | 3374 | else |
3352 | sspr = NULL; | 3375 | sspr = NULL; |
3353 | for (height = (short)var->height-1; height >= 0; height--) { | 3376 | for (height = (short)var->height - 1; height >= 0; height--) { |
3354 | bits = 0; words = delta; datawords = 0; | 3377 | bits = 0; words = delta; datawords = 0; |
3355 | for (width = (short)var->width-1; width >= 0; width--) { | 3378 | for (width = (short)var->width - 1; width >= 0; width--) { |
3356 | if (bits == 0) { | 3379 | if (bits == 0) { |
3357 | bits = 16; --words; | 3380 | bits = 16; --words; |
3358 | #ifdef __mc68000__ | 3381 | #ifdef __mc68000__ |
3359 | asm volatile ("movew %1@(%3:w:2),%0 ; swap %0 ; movew %1@+,%0" | 3382 | asm volatile ("movew %1@(%3:w:2),%0 ; swap %0 ; movew %1@+,%0" |
3360 | : "=d" (datawords), "=a" (lspr) : "1" (lspr), "d" (delta)); | 3383 | : "=d" (datawords), "=a" (lspr) : "1" (lspr), "d" (delta)); |
3361 | #else | 3384 | #else |
3362 | datawords = (*(lspr+delta) << 16) | (*lspr++); | 3385 | datawords = (*(lspr + delta) << 16) | (*lspr++); |
3363 | #endif | 3386 | #endif |
3364 | } | 3387 | } |
3365 | --bits; | 3388 | --bits; |
@@ -3422,26 +3445,26 @@ static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user * | |||
3422 | return -EINVAL; | 3445 | return -EINVAL; |
3423 | if (!var->height) | 3446 | if (!var->height) |
3424 | return -EINVAL; | 3447 | return -EINVAL; |
3425 | if (!access_ok(VERIFY_READ, data, var->width*var->height)) | 3448 | if (!access_ok(VERIFY_READ, data, var->width * var->height)) |
3426 | return -EFAULT; | 3449 | return -EFAULT; |
3427 | delta = 1<<fmode; | 3450 | delta = 1 << fmode; |
3428 | lofsprite = shfsprite = (u_short *)spritememory; | 3451 | lofsprite = shfsprite = (u_short *)spritememory; |
3429 | lspr = lofsprite + (delta<<1); | 3452 | lspr = lofsprite + (delta << 1); |
3430 | if (par->bplcon0 & BPC0_LACE) { | 3453 | if (par->bplcon0 & BPC0_LACE) { |
3431 | if (((var->height+4)<<fmode<<2) > SPRITEMEMSIZE) | 3454 | if (((var->height + 4) << fmode << 2) > SPRITEMEMSIZE) |
3432 | return -EINVAL; | 3455 | return -EINVAL; |
3433 | memset(lspr, 0, (var->height+4)<<fmode<<2); | 3456 | memset(lspr, 0, (var->height + 4) << fmode << 2); |
3434 | shfsprite += ((var->height+5)&-2)<<fmode; | 3457 | shfsprite += ((var->height + 5)&-2) << fmode; |
3435 | sspr = shfsprite + (delta<<1); | 3458 | sspr = shfsprite + (delta << 1); |
3436 | } else { | 3459 | } else { |
3437 | if (((var->height+2)<<fmode<<2) > SPRITEMEMSIZE) | 3460 | if (((var->height + 2) << fmode << 2) > SPRITEMEMSIZE) |
3438 | return -EINVAL; | 3461 | return -EINVAL; |
3439 | memset(lspr, 0, (var->height+2)<<fmode<<2); | 3462 | memset(lspr, 0, (var->height + 2) << fmode << 2); |
3440 | sspr = NULL; | 3463 | sspr = NULL; |
3441 | } | 3464 | } |
3442 | for (height = (short)var->height-1; height >= 0; height--) { | 3465 | for (height = (short)var->height - 1; height >= 0; height--) { |
3443 | bits = 16; words = delta; datawords = 0; | 3466 | bits = 16; words = delta; datawords = 0; |
3444 | for (width = (short)var->width-1; width >= 0; width--) { | 3467 | for (width = (short)var->width - 1; width >= 0; width--) { |
3445 | unsigned long tdata = 0; | 3468 | unsigned long tdata = 0; |
3446 | get_user(tdata, data); | 3469 | get_user(tdata, data); |
3447 | data++; | 3470 | data++; |
@@ -3454,7 +3477,7 @@ static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user * | |||
3454 | #else | 3477 | #else |
3455 | datawords = ((datawords << 1) & 0xfffefffe); | 3478 | datawords = ((datawords << 1) & 0xfffefffe); |
3456 | datawords |= tdata & 1; | 3479 | datawords |= tdata & 1; |
3457 | datawords |= (tdata & 2) << (16-1); | 3480 | datawords |= (tdata & 2) << (16 - 1); |
3458 | #endif | 3481 | #endif |
3459 | if (--bits == 0) { | 3482 | if (--bits == 0) { |
3460 | bits = 16; --words; | 3483 | bits = 16; --words; |
@@ -3462,7 +3485,7 @@ static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user * | |||
3462 | asm volatile ("swap %2 ; movew %2,%0@(%3:w:2) ; swap %2 ; movew %2,%0@+" | 3485 | asm volatile ("swap %2 ; movew %2,%0@(%3:w:2) ; swap %2 ; movew %2,%0@+" |
3463 | : "=a" (lspr) : "0" (lspr), "d" (datawords), "d" (delta)); | 3486 | : "=a" (lspr) : "0" (lspr), "d" (datawords), "d" (delta)); |
3464 | #else | 3487 | #else |
3465 | *(lspr+delta) = (u_short) (datawords >> 16); | 3488 | *(lspr + delta) = (u_short) (datawords >> 16); |
3466 | *lspr++ = (u_short) (datawords & 0xffff); | 3489 | *lspr++ = (u_short) (datawords & 0xffff); |
3467 | #endif | 3490 | #endif |
3468 | } | 3491 | } |
@@ -3475,7 +3498,7 @@ static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user * | |||
3475 | "swap %2 ; lslw %4,%2 ; movew %2,%0@+" | 3498 | "swap %2 ; lslw %4,%2 ; movew %2,%0@+" |
3476 | : "=a" (lspr) : "0" (lspr), "d" (datawords), "d" (delta), "d" (bits)); | 3499 | : "=a" (lspr) : "0" (lspr), "d" (datawords), "d" (delta), "d" (bits)); |
3477 | #else | 3500 | #else |
3478 | *(lspr+delta) = (u_short) (datawords >> (16+bits)); | 3501 | *(lspr + delta) = (u_short) (datawords >> (16 + bits)); |
3479 | *lspr++ = (u_short) ((datawords & 0x0000ffff) >> bits); | 3502 | *lspr++ = (u_short) ((datawords & 0x0000ffff) >> bits); |
3480 | #endif | 3503 | #endif |
3481 | } | 3504 | } |
@@ -3484,7 +3507,7 @@ static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user * | |||
3484 | asm volatile ("moveql #0,%%d0 ; movew %%d0,%0@(%2:w:2) ; movew %%d0,%0@+" | 3507 | asm volatile ("moveql #0,%%d0 ; movew %%d0,%0@(%2:w:2) ; movew %%d0,%0@+" |
3485 | : "=a" (lspr) : "0" (lspr), "d" (delta) : "d0"); | 3508 | : "=a" (lspr) : "0" (lspr), "d" (delta) : "d0"); |
3486 | #else | 3509 | #else |
3487 | *(lspr+delta) = 0; | 3510 | *(lspr + delta) = 0; |
3488 | *lspr++ = 0; | 3511 | *lspr++ = 0; |
3489 | #endif | 3512 | #endif |
3490 | } | 3513 | } |
@@ -3546,8 +3569,8 @@ static void ami_set_sprite(void) | |||
3546 | cops = copdisplay.list[currentcop][0]; | 3569 | cops = copdisplay.list[currentcop][0]; |
3547 | copl = copdisplay.list[currentcop][1]; | 3570 | copl = copdisplay.list[currentcop][1]; |
3548 | ps = pl = ZTWO_PADDR(dummysprite); | 3571 | ps = pl = ZTWO_PADDR(dummysprite); |
3549 | mx = par->crsr.crsr_x-par->crsr.spot_x; | 3572 | mx = par->crsr.crsr_x - par->crsr.spot_x; |
3550 | my = par->crsr.crsr_y-par->crsr.spot_y; | 3573 | my = par->crsr.crsr_y - par->crsr.spot_y; |
3551 | if (!(par->vmode & FB_VMODE_YWRAP)) { | 3574 | if (!(par->vmode & FB_VMODE_YWRAP)) { |
3552 | mx -= par->xoffset; | 3575 | mx -= par->xoffset; |
3553 | my -= par->yoffset; | 3576 | my -= par->yoffset; |
@@ -3556,24 +3579,24 @@ static void ami_set_sprite(void) | |||
3556 | mx > -(short)par->crsr.width && mx < par->xres && | 3579 | mx > -(short)par->crsr.width && mx < par->xres && |
3557 | my > -(short)par->crsr.height && my < par->yres) { | 3580 | my > -(short)par->crsr.height && my < par->yres) { |
3558 | pl = ZTWO_PADDR(lofsprite); | 3581 | pl = ZTWO_PADDR(lofsprite); |
3559 | hs = par->diwstrt_h + (mx<<par->clk_shift) - 4; | 3582 | hs = par->diwstrt_h + (mx << par->clk_shift) - 4; |
3560 | vs = par->diwstrt_v + (my<<par->line_shift); | 3583 | vs = par->diwstrt_v + (my << par->line_shift); |
3561 | ve = vs + (par->crsr.height<<par->line_shift); | 3584 | ve = vs + (par->crsr.height << par->line_shift); |
3562 | if (par->bplcon0 & BPC0_LACE) { | 3585 | if (par->bplcon0 & BPC0_LACE) { |
3563 | ps = ZTWO_PADDR(shfsprite); | 3586 | ps = ZTWO_PADDR(shfsprite); |
3564 | lofsprite[0] = spr2hw_pos(vs, hs); | 3587 | lofsprite[0] = spr2hw_pos(vs, hs); |
3565 | shfsprite[0] = spr2hw_pos(vs+1, hs); | 3588 | shfsprite[0] = spr2hw_pos(vs + 1, hs); |
3566 | if (mod2(vs)) { | 3589 | if (mod2(vs)) { |
3567 | lofsprite[1<<par->crsr.fmode] = spr2hw_ctl(vs, hs, ve); | 3590 | lofsprite[1 << par->crsr.fmode] = spr2hw_ctl(vs, hs, ve); |
3568 | shfsprite[1<<par->crsr.fmode] = spr2hw_ctl(vs+1, hs, ve+1); | 3591 | shfsprite[1 << par->crsr.fmode] = spr2hw_ctl(vs + 1, hs, ve + 1); |
3569 | pt = pl; pl = ps; ps = pt; | 3592 | pt = pl; pl = ps; ps = pt; |
3570 | } else { | 3593 | } else { |
3571 | lofsprite[1<<par->crsr.fmode] = spr2hw_ctl(vs, hs, ve+1); | 3594 | lofsprite[1 << par->crsr.fmode] = spr2hw_ctl(vs, hs, ve + 1); |
3572 | shfsprite[1<<par->crsr.fmode] = spr2hw_ctl(vs+1, hs, ve); | 3595 | shfsprite[1 << par->crsr.fmode] = spr2hw_ctl(vs + 1, hs, ve); |
3573 | } | 3596 | } |
3574 | } else { | 3597 | } else { |
3575 | lofsprite[0] = spr2hw_pos(vs, hs) | (IS_AGA && (par->fmode & FMODE_BSCAN2) ? 0x80 : 0); | 3598 | lofsprite[0] = spr2hw_pos(vs, hs) | (IS_AGA && (par->fmode & FMODE_BSCAN2) ? 0x80 : 0); |
3576 | lofsprite[1<<par->crsr.fmode] = spr2hw_ctl(vs, hs, ve); | 3599 | lofsprite[1 << par->crsr.fmode] = spr2hw_ctl(vs, hs, ve); |
3577 | } | 3600 | } |
3578 | } | 3601 | } |
3579 | copl[cop_spr0ptrh].w[1] = highw(pl); | 3602 | copl[cop_spr0ptrh].w[1] = highw(pl); |
@@ -3624,7 +3647,7 @@ static void ami_reinit_copper(void) | |||
3624 | struct amifb_par *par = ¤tpar; | 3647 | struct amifb_par *par = ¤tpar; |
3625 | 3648 | ||
3626 | copdisplay.init[cip_bplcon0].w[1] = ~(BPC0_BPU3 | BPC0_BPU2 | BPC0_BPU1 | BPC0_BPU0) & par->bplcon0; | 3649 | copdisplay.init[cip_bplcon0].w[1] = ~(BPC0_BPU3 | BPC0_BPU2 | BPC0_BPU1 | BPC0_BPU0) & par->bplcon0; |
3627 | copdisplay.wait->l = CWAIT(32, par->diwstrt_v-4); | 3650 | copdisplay.wait->l = CWAIT(32, par->diwstrt_v - 4); |
3628 | } | 3651 | } |
3629 | 3652 | ||
3630 | /* | 3653 | /* |
@@ -3654,20 +3677,20 @@ static void ami_build_copper(void) | |||
3654 | (cops++)->l = CMOVE(0, sprpt[0]); | 3677 | (cops++)->l = CMOVE(0, sprpt[0]); |
3655 | (cops++)->l = CMOVE2(0, sprpt[0]); | 3678 | (cops++)->l = CMOVE2(0, sprpt[0]); |
3656 | 3679 | ||
3657 | (copl++)->l = CMOVE(diwstrt2hw(par->diwstrt_h, par->diwstrt_v+1), diwstrt); | 3680 | (copl++)->l = CMOVE(diwstrt2hw(par->diwstrt_h, par->diwstrt_v + 1), diwstrt); |
3658 | (copl++)->l = CMOVE(diwstop2hw(par->diwstop_h, par->diwstop_v+1), diwstop); | 3681 | (copl++)->l = CMOVE(diwstop2hw(par->diwstop_h, par->diwstop_v + 1), diwstop); |
3659 | (cops++)->l = CMOVE(diwstrt2hw(par->diwstrt_h, par->diwstrt_v), diwstrt); | 3682 | (cops++)->l = CMOVE(diwstrt2hw(par->diwstrt_h, par->diwstrt_v), diwstrt); |
3660 | (cops++)->l = CMOVE(diwstop2hw(par->diwstop_h, par->diwstop_v), diwstop); | 3683 | (cops++)->l = CMOVE(diwstop2hw(par->diwstop_h, par->diwstop_v), diwstop); |
3661 | if (!IS_OCS) { | 3684 | if (!IS_OCS) { |
3662 | (copl++)->l = CMOVE(diwhigh2hw(par->diwstrt_h, par->diwstrt_v+1, | 3685 | (copl++)->l = CMOVE(diwhigh2hw(par->diwstrt_h, par->diwstrt_v + 1, |
3663 | par->diwstop_h, par->diwstop_v+1), diwhigh); | 3686 | par->diwstop_h, par->diwstop_v + 1), diwhigh); |
3664 | (cops++)->l = CMOVE(diwhigh2hw(par->diwstrt_h, par->diwstrt_v, | 3687 | (cops++)->l = CMOVE(diwhigh2hw(par->diwstrt_h, par->diwstrt_v, |
3665 | par->diwstop_h, par->diwstop_v), diwhigh); | 3688 | par->diwstop_h, par->diwstop_v), diwhigh); |
3666 | #if 0 | 3689 | #if 0 |
3667 | if (par->beamcon0 & BMC0_VARBEAMEN) { | 3690 | if (par->beamcon0 & BMC0_VARBEAMEN) { |
3668 | (copl++)->l = CMOVE(vtotal2hw(par->vtotal), vtotal); | 3691 | (copl++)->l = CMOVE(vtotal2hw(par->vtotal), vtotal); |
3669 | (copl++)->l = CMOVE(vbstrt2hw(par->vbstrt+1), vbstrt); | 3692 | (copl++)->l = CMOVE(vbstrt2hw(par->vbstrt + 1), vbstrt); |
3670 | (copl++)->l = CMOVE(vbstop2hw(par->vbstop+1), vbstop); | 3693 | (copl++)->l = CMOVE(vbstop2hw(par->vbstop + 1), vbstop); |
3671 | (cops++)->l = CMOVE(vtotal2hw(par->vtotal), vtotal); | 3694 | (cops++)->l = CMOVE(vtotal2hw(par->vtotal), vtotal); |
3672 | (cops++)->l = CMOVE(vbstrt2hw(par->vbstrt), vbstrt); | 3695 | (cops++)->l = CMOVE(vbstrt2hw(par->vbstrt), vbstrt); |
3673 | (cops++)->l = CMOVE(vbstop2hw(par->vbstop), vbstop); | 3696 | (cops++)->l = CMOVE(vbstop2hw(par->vbstop), vbstop); |
@@ -3686,7 +3709,7 @@ static void ami_build_copper(void) | |||
3686 | (copl++)->l = CMOVE(diwstop2hw(par->diwstop_h, par->diwstop_v), diwstop); | 3709 | (copl++)->l = CMOVE(diwstop2hw(par->diwstop_h, par->diwstop_v), diwstop); |
3687 | if (!IS_OCS) { | 3710 | if (!IS_OCS) { |
3688 | (copl++)->l = CMOVE(diwhigh2hw(par->diwstrt_h, par->diwstrt_v, | 3711 | (copl++)->l = CMOVE(diwhigh2hw(par->diwstrt_h, par->diwstrt_v, |
3689 | par->diwstop_h, par->diwstop_v), diwhigh); | 3712 | par->diwstop_h, par->diwstop_v), diwhigh); |
3690 | #if 0 | 3713 | #if 0 |
3691 | if (par->beamcon0 & BMC0_VARBEAMEN) { | 3714 | if (par->beamcon0 & BMC0_VARBEAMEN) { |
3692 | (copl++)->l = CMOVE(vtotal2hw(par->vtotal), vtotal); | 3715 | (copl++)->l = CMOVE(vtotal2hw(par->vtotal), vtotal); |
@@ -3717,23 +3740,23 @@ static void ami_rebuild_copper(void) | |||
3717 | u_long p; | 3740 | u_long p; |
3718 | 3741 | ||
3719 | if (IS_AGA && maxfmode + par->clk_shift == 0) | 3742 | if (IS_AGA && maxfmode + par->clk_shift == 0) |
3720 | h_end1 = par->diwstrt_h-64; | 3743 | h_end1 = par->diwstrt_h - 64; |
3721 | else | 3744 | else |
3722 | h_end1 = par->htotal-32; | 3745 | h_end1 = par->htotal - 32; |
3723 | h_end2 = par->ddfstop+64; | 3746 | h_end2 = par->ddfstop + 64; |
3724 | 3747 | ||
3725 | ami_set_sprite(); | 3748 | ami_set_sprite(); |
3726 | 3749 | ||
3727 | copl = copdisplay.rebuild[1]; | 3750 | copl = copdisplay.rebuild[1]; |
3728 | p = par->bplpt0; | 3751 | p = par->bplpt0; |
3729 | if (par->vmode & FB_VMODE_YWRAP) { | 3752 | if (par->vmode & FB_VMODE_YWRAP) { |
3730 | if ((par->vyres-par->yoffset) != 1 || !mod2(par->diwstrt_v)) { | 3753 | if ((par->vyres - par->yoffset) != 1 || !mod2(par->diwstrt_v)) { |
3731 | if (par->yoffset > par->vyres-par->yres) { | 3754 | if (par->yoffset > par->vyres - par->yres) { |
3732 | for (i = 0; i < (short)par->bpp; i++, p += par->next_plane) { | 3755 | for (i = 0; i < (short)par->bpp; i++, p += par->next_plane) { |
3733 | (copl++)->l = CMOVE(highw(p), bplpt[i]); | 3756 | (copl++)->l = CMOVE(highw(p), bplpt[i]); |
3734 | (copl++)->l = CMOVE2(loww(p), bplpt[i]); | 3757 | (copl++)->l = CMOVE2(loww(p), bplpt[i]); |
3735 | } | 3758 | } |
3736 | line = par->diwstrt_v + ((par->vyres-par->yoffset)<<par->line_shift) - 1; | 3759 | line = par->diwstrt_v + ((par->vyres - par->yoffset) << par->line_shift) - 1; |
3737 | while (line >= 512) { | 3760 | while (line >= 512) { |
3738 | (copl++)->l = CWAIT(h_end1, 510); | 3761 | (copl++)->l = CWAIT(h_end1, 510); |
3739 | line -= 512; | 3762 | line -= 512; |
@@ -3744,7 +3767,8 @@ static void ami_rebuild_copper(void) | |||
3744 | (copl++)->l = CWAIT(h_end2, line); | 3767 | (copl++)->l = CWAIT(h_end2, line); |
3745 | p = par->bplpt0wrap; | 3768 | p = par->bplpt0wrap; |
3746 | } | 3769 | } |
3747 | } else p = par->bplpt0wrap; | 3770 | } else |
3771 | p = par->bplpt0wrap; | ||
3748 | } | 3772 | } |
3749 | for (i = 0; i < (short)par->bpp; i++, p += par->next_plane) { | 3773 | for (i = 0; i < (short)par->bpp; i++, p += par->next_plane) { |
3750 | (copl++)->l = CMOVE(highw(p), bplpt[i]); | 3774 | (copl++)->l = CMOVE(highw(p), bplpt[i]); |
@@ -3760,13 +3784,13 @@ static void ami_rebuild_copper(void) | |||
3760 | else | 3784 | else |
3761 | p += par->next_line; | 3785 | p += par->next_line; |
3762 | if (par->vmode & FB_VMODE_YWRAP) { | 3786 | if (par->vmode & FB_VMODE_YWRAP) { |
3763 | if ((par->vyres-par->yoffset) != 1 || mod2(par->diwstrt_v)) { | 3787 | if ((par->vyres - par->yoffset) != 1 || mod2(par->diwstrt_v)) { |
3764 | if (par->yoffset > par->vyres-par->yres+1) { | 3788 | if (par->yoffset > par->vyres - par->yres + 1) { |
3765 | for (i = 0; i < (short)par->bpp; i++, p += par->next_plane) { | 3789 | for (i = 0; i < (short)par->bpp; i++, p += par->next_plane) { |
3766 | (cops++)->l = CMOVE(highw(p), bplpt[i]); | 3790 | (cops++)->l = CMOVE(highw(p), bplpt[i]); |
3767 | (cops++)->l = CMOVE2(loww(p), bplpt[i]); | 3791 | (cops++)->l = CMOVE2(loww(p), bplpt[i]); |
3768 | } | 3792 | } |
3769 | line = par->diwstrt_v + ((par->vyres-par->yoffset)<<par->line_shift) - 2; | 3793 | line = par->diwstrt_v + ((par->vyres - par->yoffset) << par->line_shift) - 2; |
3770 | while (line >= 512) { | 3794 | while (line >= 512) { |
3771 | (cops++)->l = CWAIT(h_end1, 510); | 3795 | (cops++)->l = CWAIT(h_end1, 510); |
3772 | line -= 512; | 3796 | line -= 512; |
@@ -3776,12 +3800,14 @@ static void ami_rebuild_copper(void) | |||
3776 | else | 3800 | else |
3777 | (cops++)->l = CWAIT(h_end2, line); | 3801 | (cops++)->l = CWAIT(h_end2, line); |
3778 | p = par->bplpt0wrap; | 3802 | p = par->bplpt0wrap; |
3779 | if (mod2(par->diwstrt_v+par->vyres-par->yoffset)) | 3803 | if (mod2(par->diwstrt_v + par->vyres - |
3804 | par->yoffset)) | ||
3780 | p -= par->next_line; | 3805 | p -= par->next_line; |
3781 | else | 3806 | else |
3782 | p += par->next_line; | 3807 | p += par->next_line; |
3783 | } | 3808 | } |
3784 | } else p = par->bplpt0wrap - par->next_line; | 3809 | } else |
3810 | p = par->bplpt0wrap - par->next_line; | ||
3785 | } | 3811 | } |
3786 | for (i = 0; i < (short)par->bpp; i++, p += par->next_plane) { | 3812 | for (i = 0; i < (short)par->bpp; i++, p += par->next_plane) { |
3787 | (cops++)->l = CMOVE(highw(p), bplpt[i]); | 3813 | (cops++)->l = CMOVE(highw(p), bplpt[i]); |