Lines Matching +full:has +full:- +full:builtin +full:- +full:dma

2  * linux/drivers/video/amifb.c -- Amiga builtin chipset frame buffer device
4 * Copyright (C) 1995-2003 Geert Uytterhoeven
30 * - 24 Jul 96: Copper generates now vblank interrupt and
32 * - 14 Jul 96: Rework and hopefully last ECS bugs fixed
33 * - 7 Mar 96: Hardware sprite support by Roman Zippel
34 * - 18 Feb 96: OCS and ECS support by Roman Zippel
36 * - 2 Dec 95: AGA version by Geert Uytterhoeven
107 ---------------------
111 +----------+---------------------------------------------+----------+-------+
115 +----------###############################################----------+-------+
122 |<-------->#<---------------+--------------------------->#<-------->|<----->|
136 +----------###############################################----------+-------+
140 +----------+---------------------------------------------+----------+-------+
144 +----------+---------------------------------------------+----------+-------+
148 -------------------
152 - hsstrt: Start of horizontal synchronization pulse
153 - hsstop: End of horizontal synchronization pulse
154 - htotal: Last value on the line (i.e. line length = htotal + 1)
155 - vsstrt: Start of vertical synchronization pulse
156 - vsstop: End of vertical synchronization pulse
157 - vtotal: Last line value (i.e. number of lines = vtotal + 1)
158 - hcenter: Start of vertical retrace for interlace
163 - hbstrt: Start of horizontal blank
164 - hbstop: End of horizontal blank
165 - vbstrt: Start of vertical blank
166 - vbstop: End of vertical blank
171 (0, 0) is somewhere in the upper-left corner :-)
175 --------------------------------
185 - diwstrt_h: Horizontal start of the visible window
186 - diwstop_h: Horizontal stop + 1(*) of the visible window
187 - diwstrt_v: Vertical start of the visible window
188 - diwstop_v: Vertical stop of the visible window
189 - ddfstrt: Horizontal start of display DMA
190 - ddfstop: Horizontal stop of display DMA
191 - hscroll: Horizontal display output delay
195 - sprstrt_h: Horizontal start - 4 of sprite
196 - sprstrt_v: Vertical start of sprite
203 (0, 0) is somewhere in the upper-left corner :-)
207 -------------------------------------------
213 - ddfstrt and ddfstop are best aligned to 64 pixels.
214 - the chipset needs 64 + 4 horizontal pixels after the DMA start before
218 - the display DMA always fetches 64 pixels at a time (fmode = 3).
219 - ddfstop is ddfstrt+#pixels - 64.
220 - diwstop_h = diwstrt_h + xres + 1. Because of the additional 1 this can
222 - hscroll simply adds a delay to the display output. Smooth horizontal
225 - if ddfstrt < 192, the sprite DMA cycles are all stolen by the bitplane
226 DMA, so it's best to make the DMA start as late as possible.
227 - you really don't want to make ddfstrt < 128, since this will steal DMA
228 cycles from the other DMA channels (audio, floppy and Chip RAM refresh).
229 - I make diwstop_h and diwstop_v as large as possible.
232 --------------------
234 - all values are SHRES pixel (35ns)
237 ------------------ ---------------- -----------------
239 -------------#------+-----+------#------+-----+------#------+-----+------
244 - chipset needs 4 pixels before the first pixel is output
245 - ddfstrt must be aligned to fetchstart (table 1)
246 - chipset needs also prefetch (table 2) to get first pixel data, so
247 ddfstrt = ((diwstrt_h - 4) & -fetchstart) - prefetch
248 - for horizontal panning decrease diwstrt_h
249 - the length of a fetchline must be aligned to fetchsize (table 3)
250 - if fetchstart is smaller than fetchsize, then ddfstrt can a little bit
251 moved to optimize use of dma (useful for OCS/ECS overscan displays)
252 - ddfstop is ddfstrt + ddfsize - fetchsize
253 - If C= didn't change anything for AGA, then at following positions the
254 dma bus is already used:
255 ddfstrt < 48 -> memory refresh
256 < 96 -> disk dma
257 < 160 -> audio dma
258 < 192 -> sprite 0 dma
259 < 416 -> sprite dma (32 per sprite)
260 - in accordance with the hardware reference manual a hardware stop is at
263 DMA priorities
264 --------------
266 Since there are limits on the earliest start value for display DMA and the
270 - if you want to start display DMA too early, you lose the ability to
271 do smooth horizontal panning (xpanstep 1 -> 64).
272 - if you want to go even further, you lose the hardware cursor too.
279 --------------
286 --------------------
289 ---- ---- ---- ----- ----- ----- ----- -----
300 ---- ---- ---- ----- ----- ----- ----- -----
302 VGA 640 480 52 112 24 19 112 - 2 +
303 VGA70 640 400 52 112 27 21 112 - 2 -
307 ---------------
310 ----- ----- ------------- --------------
312 + - 400 414
313 - + 350 362
314 - - 480 496
316 Source: CL-GD542X Technical Reference Manual, Cirrus Logic, Oct 1992
320 -----------------------
324 CCIR -> PAL
325 -----------
327 - a scanline is 64 µs long, of which 52.48 µs are visible. This is about
329 - we have 625 scanlines, of which 575 are visible (interlaced); after
332 RETMA -> NTSC
333 -------------
335 - a scanline is 63.5 µs long, of which 53.5 µs are visible. This is about
337 - we have 525 scanlines, of which 485 are visible (interlaced); after
342 - set the FB_SYNC_BROADCAST flag to indicate that standard broadcast
344 - make sure upper_margin + yres + lower_margin + vsync_len = 625 for an
345 interlaced, 312 for a non-interlaced and 156 for a doublescanned
347 - make sure left_margin + xres + right_margin + hsync_len = 1816 for a
349 - the left visible part begins at 360 (SHRES; HIRES:180, LORES:90),
351 - the upper visible part begins at 48 (interlaced; non-interlaced:24,
354 - ami_encode_var() calculates margins with a hsync of 5320 ns and a vsync
364 -- Geert --
373 #define CUSTOM_OFS(fld) ((long)&((struct CUSTOM*)0)->fld)
376 * BPLCON0 -- Bitplane Control Register 0
389 #define BPC0_BYPASS (0x0020) /* Bypass LUT - AGA */
397 * BPLCON2 -- Bitplane Control Register 2
400 #define BPC2_ZDBPSEL2 (0x4000) /* Bitplane to be used for ZD - AGA */
403 #define BPC2_ZDBPEN (0x0800) /* Enable ZD with ZDBPSELx - AGA */
404 #define BPC2_ZDCTEN (0x0400) /* Enable ZD with palette bit #31 - AGA */
405 #define BPC2_KILLEHB (0x0200) /* Kill EHB mode - AGA */
406 #define BPC2_RDRAM (0x0100) /* Color table accesses read, not write - AGA */
407 #define BPC2_SOGEN (0x0080) /* SOG output pin high - AGA */
417 * BPLCON3 -- Bitplane Control Register 3 (AGA)
436 * BPLCON4 -- Bitplane Control Register 4 (AGA)
457 * BEAMCON0 -- Beam Control Register
478 * FMODE -- Fetch Mode Control Register (AGA)
481 #define FMODE_SSCAN2 (0x8000) /* Sprite scan-doubling */
512 * These depend on the E-Clock or the Chipset, so they are filled in
543 #define up2(v) (((v) + 1) & -2)
544 #define down2(v) ((v) & -2)
548 #define up4(v) (((v) + 3) & -4)
549 #define down4(v) ((v) & -4)
554 #define up8(v) (((v) + 7) & -8)
555 #define down8(v) ((v) & -8)
559 #define up16(v) (((v) + 15) & -16)
560 #define down16(v) ((v) & -16)
564 #define up32(v) (((v) + 31) & -32)
565 #define down32(v) ((v) & -32)
569 #define up64(v) (((v) + 63) & -64)
570 #define down64(v) ((v) & -64)
574 #define upx(x, v) (((v) + (x) - 1) & -(x))
575 #define downx(x, v) ((v) & -(x))
576 #define modx(x, v) ((v) & ((x) - 1))
581 * is required for APUS support (once it is re-added to the kernel).
584 /* if x1 is not a constant, this macro won't make real sense :-) */
709 static u_short cursorstate = -1;
832 "ntsc-lace", 60, 640, 400, TAG_HIRES, 106, 86, 88, 33, 76, 4,
840 "pal-lace", 50, 640, 512, TAG_HIRES, 106, 86, 80, 29, 76, 4,
848 "multiscan-lace", 57, 640, 960, TAG_SHRES, 96, 112, 58, 16, 72,
857 "euro36-lace", 72, 640, 400, TAG_HIRES, 92, 124, 12, 12, 52,
866 "euro72-lace", 68, 640, 800, TAG_SHRES, 164, 92, 18, 18, 80,
875 "super72-lace", 70, 800, 600, TAG_SHRES, 212, 140, 20, 22, 80,
884 "dblntsc-ff", 57, 640, 400, TAG_SHRES, 196, 124, 36, 35, 80, 7,
888 "dblntsc-lace", 57, 640, 800, TAG_SHRES, 196, 124, 72, 70, 80,
897 "dblpal-ff", 47, 640, 512, TAG_SHRES, 196, 124, 28, 27, 80, 7,
901 "dblpal-lace", 47, 640, 1024, TAG_SHRES, 196, 124, 56, 54, 80,
930 "a2024-10", 10, 1024, 800, TAG_HIRES, 0, 0, 0, 0, 0, 0,
934 "a2024-15", 15, 1024, 800, TAG_HIRES, 0, 0, 0, 0, 0, 0,
952 #define DEFMODE_AMBER_PAL 3 /* "pal-lace" for flicker fixed PAL (A3000) */
953 #define DEFMODE_AMBER_NTSC 1 /* "ntsc-lace" for flicker fixed NTSC (A3000) */
974 * --------- --- ---- ----
1018 /* ddfstrt/ddfstop (display DMA) */
1027 #define htotal2hw(htotal) (div8(htotal) - 1)
1030 #define vtotal2hw(vtotal) (div2(vtotal) - 1)
1121 /* --------------------------- Hardware routines --------------------------- */
1125 * it up, if it's too big, return -EINVAL.
1140 if (var->pixclock <= pixclock[clk_shift]) in ami_decode_var()
1144 return -EINVAL; in ami_decode_var()
1146 par->clk_shift = clk_shift; in ami_decode_var()
1152 if ((par->xres = var->xres) < 64) in ami_decode_var()
1153 par->xres = 64; in ami_decode_var()
1154 if ((par->yres = var->yres) < 64) in ami_decode_var()
1155 par->yres = 64; in ami_decode_var()
1156 if ((par->vxres = var->xres_virtual) < par->xres) in ami_decode_var()
1157 par->vxres = par->xres; in ami_decode_var()
1158 if ((par->vyres = var->yres_virtual) < par->yres) in ami_decode_var()
1159 par->vyres = par->yres; in ami_decode_var()
1161 par->bpp = var->bits_per_pixel; in ami_decode_var()
1162 if (!var->nonstd) { in ami_decode_var()
1163 if (par->bpp < 1) in ami_decode_var()
1164 par->bpp = 1; in ami_decode_var()
1165 if (par->bpp > maxdepth[clk_shift]) { in ami_decode_var()
1167 par->bpp = maxdepth[clk_shift]; in ami_decode_var()
1170 return -EINVAL; in ami_decode_var()
1173 } else if (var->nonstd == FB_NONSTD_HAM) { in ami_decode_var()
1174 if (par->bpp < 6) in ami_decode_var()
1175 par->bpp = 6; in ami_decode_var()
1176 if (par->bpp != 6) { in ami_decode_var()
1177 if (par->bpp < 8) in ami_decode_var()
1178 par->bpp = 8; in ami_decode_var()
1179 if (par->bpp != 8 || !IS_AGA) { in ami_decode_var()
1181 return -EINVAL; in ami_decode_var()
1186 return -EINVAL; in ami_decode_var()
1194 par->vmode = var->vmode | FB_VMODE_SMOOTH_XPAN; in ami_decode_var()
1195 switch (par->vmode & FB_VMODE_MASK) { in ami_decode_var()
1205 return -EINVAL; in ami_decode_var()
1211 return -EINVAL; in ami_decode_var()
1214 par->line_shift = line_shift; in ami_decode_var()
1220 xres_n = par->xres << clk_shift; in ami_decode_var()
1221 yres_n = par->yres << line_shift; in ami_decode_var()
1222 par->htotal = down8((var->left_margin + par->xres + var->right_margin + in ami_decode_var()
1223 var->hsync_len) << clk_shift); in ami_decode_var()
1224 par->vtotal = in ami_decode_var()
1225 down2(((var->upper_margin + par->yres + var->lower_margin + in ami_decode_var()
1226 var->vsync_len) << line_shift) + 1); in ami_decode_var()
1229 par->bplcon3 = sprpixmode[clk_shift]; in ami_decode_var()
1231 par->bplcon3 = 0; in ami_decode_var()
1232 if (var->sync & FB_SYNC_BROADCAST) { in ami_decode_var()
1233 par->diwstop_h = par->htotal - in ami_decode_var()
1234 ((var->right_margin - var->hsync_len) << clk_shift); in ami_decode_var()
1236 par->diwstop_h += mod4(var->hsync_len); in ami_decode_var()
1238 par->diwstop_h = down4(par->diwstop_h); in ami_decode_var()
1240 par->diwstrt_h = par->diwstop_h - xres_n; in ami_decode_var()
1241 par->diwstop_v = par->vtotal - in ami_decode_var()
1242 ((var->lower_margin - var->vsync_len) << line_shift); in ami_decode_var()
1243 par->diwstrt_v = par->diwstop_v - yres_n; in ami_decode_var()
1244 if (par->diwstop_h >= par->htotal + 8) { in ami_decode_var()
1246 return -EINVAL; in ami_decode_var()
1248 if (par->diwstop_v > par->vtotal) { in ami_decode_var()
1250 return -EINVAL; in ami_decode_var()
1255 par->hsstrt = 160; in ami_decode_var()
1256 par->hsstop = 320; in ami_decode_var()
1257 par->vsstrt = 30; in ami_decode_var()
1258 par->vsstop = 34; in ami_decode_var()
1260 par->hsstrt = 0; in ami_decode_var()
1261 par->hsstop = 0; in ami_decode_var()
1262 par->vsstrt = 0; in ami_decode_var()
1263 par->vsstop = 0; in ami_decode_var()
1265 if (par->vtotal > (PAL_VTOTAL + NTSC_VTOTAL) / 2) { in ami_decode_var()
1267 if (par->htotal != PAL_HTOTAL) { in ami_decode_var()
1269 return -EINVAL; in ami_decode_var()
1271 if (par->diwstrt_h < PAL_DIWSTRT_H) { in ami_decode_var()
1273 return -EINVAL; in ami_decode_var()
1275 if (par->diwstrt_v < PAL_DIWSTRT_V) { in ami_decode_var()
1277 return -EINVAL; in ami_decode_var()
1282 par->beamcon0 = BMC0_PAL; in ami_decode_var()
1283 par->bplcon3 |= BPC3_BRDRBLNK; in ami_decode_var()
1286 par->beamcon0 = BMC0_PAL; in ami_decode_var()
1287 par->hsstop = 1; in ami_decode_var()
1290 return -EINVAL; in ami_decode_var()
1297 if (par->htotal != NTSC_HTOTAL) { in ami_decode_var()
1299 return -EINVAL; in ami_decode_var()
1301 if (par->diwstrt_h < NTSC_DIWSTRT_H) { in ami_decode_var()
1303 return -EINVAL; in ami_decode_var()
1305 if (par->diwstrt_v < NTSC_DIWSTRT_V) { in ami_decode_var()
1307 return -EINVAL; in ami_decode_var()
1312 par->beamcon0 = 0; in ami_decode_var()
1313 par->bplcon3 |= BPC3_BRDRBLNK; in ami_decode_var()
1316 par->beamcon0 = 0; in ami_decode_var()
1317 par->hsstop = 1; in ami_decode_var()
1320 return -EINVAL; in ami_decode_var()
1324 if (par->diwstrt_h >= 1024 || par->diwstop_h < 1024 || in ami_decode_var()
1325 par->diwstrt_v >= 512 || par->diwstop_v < 256) { in ami_decode_var()
1327 return -EINVAL; in ami_decode_var()
1332 par->hsstrt = var->right_margin << clk_shift; in ami_decode_var()
1333 par->hsstop = (var->right_margin + var->hsync_len) << clk_shift; in ami_decode_var()
1334 par->diwstop_h = par->htotal - mod8(par->hsstrt) + 8 - (1 << clk_shift); in ami_decode_var()
1336 par->diwstop_h = down4(par->diwstop_h) - 16; in ami_decode_var()
1337 par->diwstrt_h = par->diwstop_h - xres_n; in ami_decode_var()
1338 par->hbstop = par->diwstrt_h + 4; in ami_decode_var()
1339 par->hbstrt = par->diwstop_h + 4; in ami_decode_var()
1340 if (par->hbstrt >= par->htotal + 8) in ami_decode_var()
1341 par->hbstrt -= par->htotal; in ami_decode_var()
1342 par->hcenter = par->hsstrt + (par->htotal >> 1); in ami_decode_var()
1343 par->vsstrt = var->lower_margin << line_shift; in ami_decode_var()
1344 par->vsstop = (var->lower_margin + var->vsync_len) << line_shift; in ami_decode_var()
1345 par->diwstop_v = par->vtotal; in ami_decode_var()
1346 if ((par->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) in ami_decode_var()
1347 par->diwstop_v -= 2; in ami_decode_var()
1348 par->diwstrt_v = par->diwstop_v - yres_n; in ami_decode_var()
1349 par->vbstop = par->diwstrt_v - 2; in ami_decode_var()
1350 par->vbstrt = par->diwstop_v - 2; in ami_decode_var()
1351 if (par->vtotal > 2048) { in ami_decode_var()
1353 return -EINVAL; in ami_decode_var()
1355 if (par->htotal > 2048) { in ami_decode_var()
1357 return -EINVAL; in ami_decode_var()
1359 par->bplcon3 |= BPC3_EXTBLKEN; in ami_decode_var()
1360 par->beamcon0 = BMC0_HARDDIS | BMC0_VARVBEN | BMC0_LOLDIS | in ami_decode_var()
1363 if (var->sync & FB_SYNC_HOR_HIGH_ACT) in ami_decode_var()
1364 par->beamcon0 |= BMC0_HSYTRUE; in ami_decode_var()
1365 if (var->sync & FB_SYNC_VERT_HIGH_ACT) in ami_decode_var()
1366 par->beamcon0 |= BMC0_VSYTRUE; in ami_decode_var()
1367 if (var->sync & FB_SYNC_COMP_HIGH_ACT) in ami_decode_var()
1368 par->beamcon0 |= BMC0_CSYTRUE; in ami_decode_var()
1369 htotal = par->htotal>>clk_shift; in ami_decode_var()
1370 vtotal = par->vtotal>>1; in ami_decode_var()
1373 return -EINVAL; in ami_decode_var()
1377 * Checking the DMA timing in ami_decode_var()
1383 * smallest window start value without turn off other dma cycles in ami_decode_var()
1384 * than sprite1-7, unless you change min_fstrt in ami_decode_var()
1389 fstrt = downx(fconst, par->diwstrt_h - 4) - fsize; in ami_decode_var()
1392 return -EINVAL; in ami_decode_var()
1399 fstrt = downx(fconst, par->diwstrt_h - fconst + (1 << clk_shift) - 4) - in ami_decode_var()
1402 par->vmode &= ~FB_VMODE_SMOOTH_XPAN; in ami_decode_var()
1404 maxfetchstop = down16(par->htotal - 80); in ami_decode_var()
1406 fstrt = downx(fconst, par->diwstrt_h - 4) - 64 - fconst; in ami_decode_var()
1408 modx(fconst, downx(1 << clk_shift, par->diwstrt_h - 4))); in ami_decode_var()
1410 par->vmode &= ~FB_VMODE_SMOOTH_XPAN; in ami_decode_var()
1415 return -EINVAL; in ami_decode_var()
1419 fsize = up64(xres_n + fconst - 1); in ami_decode_var()
1420 if (min_fstrt + fsize - 64 > maxfetchstop) in ami_decode_var()
1421 par->vmode &= ~FB_VMODE_SMOOTH_XPAN; in ami_decode_var()
1424 if (min_fstrt + fsize - 64 > maxfetchstop) { in ami_decode_var()
1426 return -EINVAL; in ami_decode_var()
1429 fsize -= 64; in ami_decode_var()
1431 fsize -= fconst; in ami_decode_var()
1437 if (par->htotal - fsize - 64 < par->bpp * 64) in ami_decode_var()
1438 par->vmode &= ~FB_VMODE_YWRAP; in ami_decode_var()
1445 par->next_plane = div8(upx(16 << maxfmode, par->vxres)); in ami_decode_var()
1446 par->next_line = par->bpp * par->next_plane; in ami_decode_var()
1447 if (par->next_line * par->vyres > info->fix.smem_len) { in ami_decode_var()
1449 return -EINVAL; in ami_decode_var()
1452 par->next_line = div8(upx(16 << maxfmode, par->vxres)); in ami_decode_var()
1453 par->next_plane = par->vyres * par->next_line; in ami_decode_var()
1454 if (par->next_plane * par->bpp > info->fix.smem_len) { in ami_decode_var()
1456 return -EINVAL; in ami_decode_var()
1464 par->bplcon0 = BPC0_COLOR | bplpixmode[clk_shift]; in ami_decode_var()
1466 par->bplcon0 |= BPC0_ECSENA; in ami_decode_var()
1467 if (par->bpp == 8) in ami_decode_var()
1468 par->bplcon0 |= BPC0_BPU3; in ami_decode_var()
1470 par->bplcon0 |= par->bpp << 12; in ami_decode_var()
1471 if (var->nonstd == FB_NONSTD_HAM) in ami_decode_var()
1472 par->bplcon0 |= BPC0_HAM; in ami_decode_var()
1473 if (var->sync & FB_SYNC_EXT) in ami_decode_var()
1474 par->bplcon0 |= BPC0_ERSY; in ami_decode_var()
1477 par->fmode = bplfetchmode[maxfmode]; in ami_decode_var()
1479 switch (par->vmode & FB_VMODE_MASK) { in ami_decode_var()
1481 par->bplcon0 |= BPC0_LACE; in ami_decode_var()
1485 par->fmode |= FMODE_SSCAN2 | FMODE_BSCAN2; in ami_decode_var()
1489 if (!((par->vmode ^ var->vmode) & FB_VMODE_YWRAP)) { in ami_decode_var()
1490 par->xoffset = var->xoffset; in ami_decode_var()
1491 par->yoffset = var->yoffset; in ami_decode_var()
1492 if (par->vmode & FB_VMODE_YWRAP) { in ami_decode_var()
1493 if (par->yoffset >= par->vyres) in ami_decode_var()
1494 par->xoffset = par->yoffset = 0; in ami_decode_var()
1496 if (par->xoffset > upx(16 << maxfmode, par->vxres - par->xres) || in ami_decode_var()
1497 par->yoffset > par->vyres - par->yres) in ami_decode_var()
1498 par->xoffset = par->yoffset = 0; in ami_decode_var()
1501 par->xoffset = par->yoffset = 0; in ami_decode_var()
1503 par->crsr.crsr_x = par->crsr.crsr_y = 0; in ami_decode_var()
1504 par->crsr.spot_x = par->crsr.spot_y = 0; in ami_decode_var()
1505 par->crsr.height = par->crsr.width = 0; in ami_decode_var()
1522 clk_shift = par->clk_shift; in ami_encode_var()
1523 line_shift = par->line_shift; in ami_encode_var()
1525 var->xres = par->xres; in ami_encode_var()
1526 var->yres = par->yres; in ami_encode_var()
1527 var->xres_virtual = par->vxres; in ami_encode_var()
1528 var->yres_virtual = par->vyres; in ami_encode_var()
1529 var->xoffset = par->xoffset; in ami_encode_var()
1530 var->yoffset = par->yoffset; in ami_encode_var()
1532 var->bits_per_pixel = par->bpp; in ami_encode_var()
1533 var->grayscale = 0; in ami_encode_var()
1535 var->red.offset = 0; in ami_encode_var()
1536 var->red.msb_right = 0; in ami_encode_var()
1537 var->red.length = par->bpp; in ami_encode_var()
1538 if (par->bplcon0 & BPC0_HAM) in ami_encode_var()
1539 var->red.length -= 2; in ami_encode_var()
1540 var->blue = var->green = var->red; in ami_encode_var()
1541 var->transp.offset = 0; in ami_encode_var()
1542 var->transp.length = 0; in ami_encode_var()
1543 var->transp.msb_right = 0; in ami_encode_var()
1545 if (par->bplcon0 & BPC0_HAM) in ami_encode_var()
1546 var->nonstd = FB_NONSTD_HAM; in ami_encode_var()
1548 var->nonstd = 0; in ami_encode_var()
1549 var->activate = 0; in ami_encode_var()
1551 var->height = -1; in ami_encode_var()
1552 var->width = -1; in ami_encode_var()
1554 var->pixclock = pixclock[clk_shift]; in ami_encode_var()
1556 if (IS_AGA && par->fmode & FMODE_BSCAN2) in ami_encode_var()
1557 var->vmode = FB_VMODE_DOUBLE; in ami_encode_var()
1558 else if (par->bplcon0 & BPC0_LACE) in ami_encode_var()
1559 var->vmode = FB_VMODE_INTERLACED; in ami_encode_var()
1561 var->vmode = FB_VMODE_NONINTERLACED; in ami_encode_var()
1563 if (!IS_OCS && par->beamcon0 & BMC0_VARBEAMEN) { in ami_encode_var()
1564 var->hsync_len = (par->hsstop - par->hsstrt)>>clk_shift; in ami_encode_var()
1565 var->right_margin = par->hsstrt>>clk_shift; in ami_encode_var()
1566 var->left_margin = (par->htotal>>clk_shift) - var->xres - var->right_margin - var->hsync_len; in ami_encode_var()
1567 var->vsync_len = (par->vsstop - par->vsstrt)>>line_shift; in ami_encode_var()
1568 var->lower_margin = par->vsstrt>>line_shift; in ami_encode_var()
1569 var->upper_margin = (par->vtotal>>line_shift) - var->yres - var->lower_margin - var->vsync_len; in ami_encode_var()
1570 var->sync = 0; in ami_encode_var()
1571 if (par->beamcon0 & BMC0_HSYTRUE) in ami_encode_var()
1572 var->sync |= FB_SYNC_HOR_HIGH_ACT; in ami_encode_var()
1573 if (par->beamcon0 & BMC0_VSYTRUE) in ami_encode_var()
1574 var->sync |= FB_SYNC_VERT_HIGH_ACT; in ami_encode_var()
1575 if (par->beamcon0 & BMC0_CSYTRUE) in ami_encode_var()
1576 var->sync |= FB_SYNC_COMP_HIGH_ACT; in ami_encode_var()
1578 var->sync = FB_SYNC_BROADCAST; in ami_encode_var()
1579 var->hsync_len = (152>>clk_shift) + mod4(par->diwstop_h); in ami_encode_var()
1580 var->right_margin = ((par->htotal - down4(par->diwstop_h))>>clk_shift) + var->hsync_len; in ami_encode_var()
1581 var->left_margin = (par->htotal>>clk_shift) - var->xres - var->right_margin - var->hsync_len; in ami_encode_var()
1582 var->vsync_len = 4>>line_shift; in ami_encode_var()
1583 var->lower_margin = ((par->vtotal - par->diwstop_v)>>line_shift) + var->vsync_len; in ami_encode_var()
1584 var->upper_margin = (((par->vtotal - 2)>>line_shift) + 1) - var->yres - in ami_encode_var()
1585 var->lower_margin - var->vsync_len; in ami_encode_var()
1588 if (par->bplcon0 & BPC0_ERSY) in ami_encode_var()
1589 var->sync |= FB_SYNC_EXT; in ami_encode_var()
1590 if (par->vmode & FB_VMODE_YWRAP) in ami_encode_var()
1591 var->vmode |= FB_VMODE_YWRAP; in ami_encode_var()
1601 struct amifb_par *par = info->par; in ami_update_par()
1604 clk_shift = par->clk_shift; in ami_update_par()
1606 if (!(par->vmode & FB_VMODE_SMOOTH_XPAN)) in ami_update_par()
1607 par->xoffset = upx(16 << maxfmode, par->xoffset); in ami_update_par()
1610 vshift = modx(16 << maxfmode, par->xoffset); in ami_update_par()
1611 fstrt = par->diwstrt_h - (vshift << clk_shift) - 4; in ami_update_par()
1612 fsize = (par->xres + vshift) << clk_shift; in ami_update_par()
1614 move = downx(2 << maxfmode, div8(par->xoffset)); in ami_update_par()
1616 fstrt = downx(fconst, fstrt) - 64; in ami_update_par()
1618 fstop = fstrt + fsize - fconst; in ami_update_par()
1620 mod = fstrt = downx(fconst, fstrt) - fconst; in ami_update_par()
1621 fstop = fstrt + upx(fconst, fsize) - 64; in ami_update_par()
1623 fstrt = fstop - fsize + 64; in ami_update_par()
1625 fstop += min_fstrt - fstrt; in ami_update_par()
1628 move = move - div8((mod - fstrt)>>clk_shift); in ami_update_par()
1630 mod = par->next_line - div8(fsize>>clk_shift); in ami_update_par()
1631 par->ddfstrt = fstrt; in ami_update_par()
1632 par->ddfstop = fstop; in ami_update_par()
1633 par->bplcon1 = hscroll2hw(shift); in ami_update_par()
1634 par->bpl2mod = mod; in ami_update_par()
1635 if (par->bplcon0 & BPC0_LACE) in ami_update_par()
1636 par->bpl2mod += par->next_line; in ami_update_par()
1637 if (IS_AGA && (par->fmode & FMODE_BSCAN2)) in ami_update_par()
1638 par->bpl1mod = -div8(fsize>>clk_shift); in ami_update_par()
1640 par->bpl1mod = par->bpl2mod; in ami_update_par()
1642 if (par->yoffset) { in ami_update_par()
1643 par->bplpt0 = info->fix.smem_start + in ami_update_par()
1644 par->next_line * par->yoffset + move; in ami_update_par()
1645 if (par->vmode & FB_VMODE_YWRAP) { in ami_update_par()
1646 if (par->yoffset > par->vyres - par->yres) { in ami_update_par()
1647 par->bplpt0wrap = info->fix.smem_start + move; in ami_update_par()
1648 if (par->bplcon0 & BPC0_LACE && in ami_update_par()
1649 mod2(par->diwstrt_v + par->vyres - in ami_update_par()
1650 par->yoffset)) in ami_update_par()
1651 par->bplpt0wrap += par->next_line; in ami_update_par()
1655 par->bplpt0 = info->fix.smem_start + move; in ami_update_par()
1657 if (par->bplcon0 & BPC0_LACE && mod2(par->diwstrt_v)) in ami_update_par()
1658 par->bplpt0 += par->next_line; in ami_update_par()
1671 struct amifb_par *par = info->par; in ami_pan_var()
1673 par->xoffset = var->xoffset; in ami_pan_var()
1674 par->yoffset = var->yoffset; in ami_pan_var()
1675 if (var->vmode & FB_VMODE_YWRAP) in ami_pan_var()
1676 par->vmode |= FB_VMODE_YWRAP; in ami_pan_var()
1678 par->vmode &= ~FB_VMODE_YWRAP; in ami_pan_var()
1688 custom.bplcon1 = par->bplcon1; in ami_update_display()
1689 custom.bpl1mod = par->bpl1mod; in ami_update_display()
1690 custom.bpl2mod = par->bpl2mod; in ami_update_display()
1691 custom.ddfstrt = ddfstrt2hw(par->ddfstrt); in ami_update_display()
1692 custom.ddfstop = ddfstop2hw(par->ddfstop); in ami_update_display()
1703 custom.bplcon0 = par->bplcon0 & ~BPC0_LACE; in ami_init_display()
1706 custom.bplcon3 = par->bplcon3; in ami_init_display()
1709 if (par->beamcon0 & BMC0_VARBEAMEN) { in ami_init_display()
1710 custom.htotal = htotal2hw(par->htotal); in ami_init_display()
1711 custom.hbstrt = hbstrt2hw(par->hbstrt); in ami_init_display()
1712 custom.hbstop = hbstop2hw(par->hbstop); in ami_init_display()
1713 custom.hsstrt = hsstrt2hw(par->hsstrt); in ami_init_display()
1714 custom.hsstop = hsstop2hw(par->hsstop); in ami_init_display()
1715 custom.hcenter = hcenter2hw(par->hcenter); in ami_init_display()
1716 custom.vtotal = vtotal2hw(par->vtotal); in ami_init_display()
1717 custom.vbstrt = vbstrt2hw(par->vbstrt); in ami_init_display()
1718 custom.vbstop = vbstop2hw(par->vbstop); in ami_init_display()
1719 custom.vsstrt = vsstrt2hw(par->vsstrt); in ami_init_display()
1720 custom.vsstop = vsstop2hw(par->vsstop); in ami_init_display()
1723 if (!IS_OCS || par->hsstop) in ami_init_display()
1724 custom.beamcon0 = par->beamcon0; in ami_init_display()
1726 custom.fmode = par->fmode; in ami_init_display()
1732 amiga_audio_min_period = div16(par->htotal); in ami_init_display()
1734 is_lace = par->bplcon0 & BPC0_LACE ? 1 : 0; in ami_init_display()
1756 u_short bplcon3 = par->bplcon3; in ami_do_blank()
1766 custom.hsstrt = hsstrt2hw(par->hsstrt); in ami_do_blank()
1767 custom.hsstop = hsstop2hw(par->hsstop); in ami_do_blank()
1768 custom.vsstrt = vsstrt2hw(par->vtotal + 4); in ami_do_blank()
1769 custom.vsstop = vsstop2hw(par->vtotal + 4); in ami_do_blank()
1772 custom.hsstrt = hsstrt2hw(par->htotal + 16); in ami_do_blank()
1773 custom.hsstop = hsstop2hw(par->htotal + 16); in ami_do_blank()
1774 custom.vsstrt = vsstrt2hw(par->vsstrt); in ami_do_blank()
1775 custom.vsstop = vsstrt2hw(par->vsstop); in ami_do_blank()
1778 custom.hsstrt = hsstrt2hw(par->htotal + 16); in ami_do_blank()
1779 custom.hsstop = hsstop2hw(par->htotal + 16); in ami_do_blank()
1780 custom.vsstrt = vsstrt2hw(par->vtotal + 4); in ami_do_blank()
1781 custom.vsstop = vsstop2hw(par->vtotal + 4); in ami_do_blank()
1784 if (!(par->beamcon0 & BMC0_VARBEAMEN)) { in ami_do_blank()
1785 custom.htotal = htotal2hw(par->htotal); in ami_do_blank()
1786 custom.vtotal = vtotal2hw(par->vtotal); in ami_do_blank()
1797 custom.hsstrt = hsstrt2hw(par->hsstrt); in ami_do_blank()
1798 custom.hsstop = hsstop2hw(par->hsstop); in ami_do_blank()
1799 custom.vsstrt = vsstrt2hw(par->vsstrt); in ami_do_blank()
1800 custom.vsstop = vsstop2hw(par->vsstop); in ami_do_blank()
1801 custom.beamcon0 = par->beamcon0; in ami_do_blank()
1814 if (par->bplcon0 & BPC0_SHRES) { in ami_do_blank()
1820 for (i = 12; i >= 0; i -= 4) in ami_do_blank()
1823 for (i = 3; i >= 0; i--) in ami_do_blank()
1834 fix->crsr_width = fix->crsr_xsize = par->crsr.width; in ami_get_fix_cursorinfo()
1835 fix->crsr_height = fix->crsr_ysize = par->crsr.height; in ami_get_fix_cursorinfo()
1836 fix->crsr_color1 = 17; in ami_get_fix_cursorinfo()
1837 fix->crsr_color2 = 18; in ami_get_fix_cursorinfo()
1856 size = par->crsr.height * par->crsr.width; in ami_get_var_cursorinfo()
1857 alloc = var->height * var->width; in ami_get_var_cursorinfo()
1858 var->height = par->crsr.height; in ami_get_var_cursorinfo()
1859 var->width = par->crsr.width; in ami_get_var_cursorinfo()
1860 var->xspot = par->crsr.spot_x; in ami_get_var_cursorinfo()
1861 var->yspot = par->crsr.spot_y; in ami_get_var_cursorinfo()
1862 if (size > var->height * var->width) in ami_get_var_cursorinfo()
1863 return -ENAMETOOLONG; in ami_get_var_cursorinfo()
1864 delta = 1 << par->crsr.fmode; in ami_get_var_cursorinfo()
1866 if (par->bplcon0 & BPC0_LACE) in ami_get_var_cursorinfo()
1870 for (height = (short)var->height - 1; height >= 0; height--) { in ami_get_var_cursorinfo()
1872 for (width = (short)var->width - 1; width >= 0; width--) { in ami_get_var_cursorinfo()
1874 bits = 16; --words; in ami_get_var_cursorinfo()
1882 --bits; in ami_get_var_cursorinfo()
1897 --words; ++lspr; in ami_get_var_cursorinfo()
1899 while (--words >= 0) in ami_get_var_cursorinfo()
1929 if (!var->width) in ami_set_var_cursorinfo()
1930 return -EINVAL; in ami_set_var_cursorinfo()
1931 else if (var->width <= 16) in ami_set_var_cursorinfo()
1933 else if (var->width <= 32) in ami_set_var_cursorinfo()
1935 else if (var->width <= 64) in ami_set_var_cursorinfo()
1938 return -EINVAL; in ami_set_var_cursorinfo()
1940 return -EINVAL; in ami_set_var_cursorinfo()
1941 if (!var->height) in ami_set_var_cursorinfo()
1942 return -EINVAL; in ami_set_var_cursorinfo()
1946 if (par->bplcon0 & BPC0_LACE) { in ami_set_var_cursorinfo()
1947 if (((var->height + 4) << fmode << 2) > SPRITEMEMSIZE) in ami_set_var_cursorinfo()
1948 return -EINVAL; in ami_set_var_cursorinfo()
1949 memset(lspr, 0, (var->height + 4) << fmode << 2); in ami_set_var_cursorinfo()
1950 shfsprite += ((var->height + 5)&-2) << fmode; in ami_set_var_cursorinfo()
1953 if (((var->height + 2) << fmode << 2) > SPRITEMEMSIZE) in ami_set_var_cursorinfo()
1954 return -EINVAL; in ami_set_var_cursorinfo()
1955 memset(lspr, 0, (var->height + 2) << fmode << 2); in ami_set_var_cursorinfo()
1958 for (height = (short)var->height - 1; height >= 0; height--) { in ami_set_var_cursorinfo()
1960 for (width = (short)var->width - 1; width >= 0; width--) { in ami_set_var_cursorinfo()
1974 datawords |= (tdata & 2) << (16 - 1); in ami_set_var_cursorinfo()
1976 if (--bits == 0) { in ami_set_var_cursorinfo()
1977 bits = 16; --words; in ami_set_var_cursorinfo()
1988 --words; in ami_set_var_cursorinfo()
1999 while (--words >= 0) { in ami_set_var_cursorinfo()
2020 par->crsr.height = var->height; in ami_set_var_cursorinfo()
2021 par->crsr.width = var->width; in ami_set_var_cursorinfo()
2022 par->crsr.spot_x = var->xspot; in ami_set_var_cursorinfo()
2023 par->crsr.spot_y = var->yspot; in ami_set_var_cursorinfo()
2024 par->crsr.fmode = fmode; in ami_set_var_cursorinfo()
2026 par->fmode &= ~(FMODE_SPAGEM | FMODE_SPR32); in ami_set_var_cursorinfo()
2027 par->fmode |= sprfetchmode[fmode]; in ami_set_var_cursorinfo()
2028 custom.fmode = par->fmode; in ami_set_var_cursorinfo()
2036 state->xoffset = par->crsr.crsr_x; in ami_get_cursorstate()
2037 state->yoffset = par->crsr.crsr_y; in ami_get_cursorstate()
2038 state->mode = cursormode; in ami_get_cursorstate()
2045 par->crsr.crsr_x = state->xoffset; in ami_set_cursorstate()
2046 par->crsr.crsr_y = state->yoffset; in ami_set_cursorstate()
2047 if ((cursormode = state->mode) == FB_CURSOR_OFF) in ami_set_cursorstate()
2048 cursorstate = -1; in ami_set_cursorstate()
2063 mx = par->crsr.crsr_x - par->crsr.spot_x; in ami_set_sprite()
2064 my = par->crsr.crsr_y - par->crsr.spot_y; in ami_set_sprite()
2065 if (!(par->vmode & FB_VMODE_YWRAP)) { in ami_set_sprite()
2066 mx -= par->xoffset; in ami_set_sprite()
2067 my -= par->yoffset; in ami_set_sprite()
2069 if (!is_blanked && cursorstate > 0 && par->crsr.height > 0 && in ami_set_sprite()
2070 mx > -(short)par->crsr.width && mx < par->xres && in ami_set_sprite()
2071 my > -(short)par->crsr.height && my < par->yres) { in ami_set_sprite()
2073 hs = par->diwstrt_h + (mx << par->clk_shift) - 4; in ami_set_sprite()
2074 vs = par->diwstrt_v + (my << par->line_shift); in ami_set_sprite()
2075 ve = vs + (par->crsr.height << par->line_shift); in ami_set_sprite()
2076 if (par->bplcon0 & BPC0_LACE) { in ami_set_sprite()
2081 lofsprite[1 << par->crsr.fmode] = spr2hw_ctl(vs, hs, ve); in ami_set_sprite()
2082 shfsprite[1 << par->crsr.fmode] = spr2hw_ctl(vs + 1, hs, ve + 1); in ami_set_sprite()
2085 lofsprite[1 << par->crsr.fmode] = spr2hw_ctl(vs, hs, ve + 1); in ami_set_sprite()
2086 shfsprite[1 << par->crsr.fmode] = spr2hw_ctl(vs + 1, hs, ve); in ami_set_sprite()
2089 lofsprite[0] = spr2hw_pos(vs, hs) | (IS_AGA && (par->fmode & FMODE_BSCAN2) ? 0x80 : 0); in ami_set_sprite()
2090 lofsprite[1 << par->crsr.fmode] = spr2hw_ctl(vs, hs, ve); in ami_set_sprite()
2095 if (par->bplcon0 & BPC0_LACE) { in ami_set_sprite()
2113 (cop++)->l = CMOVE(BPC0_COLOR | BPC0_SHRES | BPC0_ECSENA, bplcon0); in ami_init_copper()
2114 (cop++)->l = CMOVE(0x0181, diwstrt); in ami_init_copper()
2115 (cop++)->l = CMOVE(0x0281, diwstop); in ami_init_copper()
2116 (cop++)->l = CMOVE(0x0000, diwhigh); in ami_init_copper()
2118 (cop++)->l = CMOVE(BPC0_COLOR, bplcon0); in ami_init_copper()
2121 (cop++)->l = CMOVE(0, spr[i].pos); in ami_init_copper()
2122 (cop++)->l = CMOVE(highw(p), sprpt[i]); in ami_init_copper()
2123 (cop++)->l = CMOVE2(loww(p), sprpt[i]); in ami_init_copper()
2126 (cop++)->l = CMOVE(IF_SETCLR | IF_COPER, intreq); in ami_init_copper()
2128 (cop++)->l = CEND; in ami_init_copper()
2129 (cop++)->l = CMOVE(0, copjmp2); in ami_init_copper()
2130 cop->l = CEND; in ami_init_copper()
2138 …copdisplay.init[cip_bplcon0].w[1] = ~(BPC0_BPU3 | BPC0_BPU2 | BPC0_BPU1 | BPC0_BPU0) & par->bplcon… in ami_reinit_copper()
2139 copdisplay.wait->l = CWAIT(32, par->diwstrt_v - 4); in ami_reinit_copper()
2156 if (IS_AGA && maxfmode + par->clk_shift == 0) in ami_rebuild_copper()
2157 h_end1 = par->diwstrt_h - 64; in ami_rebuild_copper()
2159 h_end1 = par->htotal - 32; in ami_rebuild_copper()
2160 h_end2 = par->ddfstop + 64; in ami_rebuild_copper()
2165 p = par->bplpt0; in ami_rebuild_copper()
2166 if (par->vmode & FB_VMODE_YWRAP) { in ami_rebuild_copper()
2167 if ((par->vyres - par->yoffset) != 1 || !mod2(par->diwstrt_v)) { in ami_rebuild_copper()
2168 if (par->yoffset > par->vyres - par->yres) { in ami_rebuild_copper()
2169 for (i = 0; i < (short)par->bpp; i++, p += par->next_plane) { in ami_rebuild_copper()
2170 (copl++)->l = CMOVE(highw(p), bplpt[i]); in ami_rebuild_copper()
2171 (copl++)->l = CMOVE2(loww(p), bplpt[i]); in ami_rebuild_copper()
2173 line = par->diwstrt_v + ((par->vyres - par->yoffset) << par->line_shift) - 1; in ami_rebuild_copper()
2175 (copl++)->l = CWAIT(h_end1, 510); in ami_rebuild_copper()
2176 line -= 512; in ami_rebuild_copper()
2178 if (line >= 510 && IS_AGA && maxfmode + par->clk_shift == 0) in ami_rebuild_copper()
2179 (copl++)->l = CWAIT(h_end1, line); in ami_rebuild_copper()
2181 (copl++)->l = CWAIT(h_end2, line); in ami_rebuild_copper()
2182 p = par->bplpt0wrap; in ami_rebuild_copper()
2185 p = par->bplpt0wrap; in ami_rebuild_copper()
2187 for (i = 0; i < (short)par->bpp; i++, p += par->next_plane) { in ami_rebuild_copper()
2188 (copl++)->l = CMOVE(highw(p), bplpt[i]); in ami_rebuild_copper()
2189 (copl++)->l = CMOVE2(loww(p), bplpt[i]); in ami_rebuild_copper()
2191 copl->l = CEND; in ami_rebuild_copper()
2193 if (par->bplcon0 & BPC0_LACE) { in ami_rebuild_copper()
2195 p = par->bplpt0; in ami_rebuild_copper()
2196 if (mod2(par->diwstrt_v)) in ami_rebuild_copper()
2197 p -= par->next_line; in ami_rebuild_copper()
2199 p += par->next_line; in ami_rebuild_copper()
2200 if (par->vmode & FB_VMODE_YWRAP) { in ami_rebuild_copper()
2201 if ((par->vyres - par->yoffset) != 1 || mod2(par->diwstrt_v)) { in ami_rebuild_copper()
2202 if (par->yoffset > par->vyres - par->yres + 1) { in ami_rebuild_copper()
2203 for (i = 0; i < (short)par->bpp; i++, p += par->next_plane) { in ami_rebuild_copper()
2204 (cops++)->l = CMOVE(highw(p), bplpt[i]); in ami_rebuild_copper()
2205 (cops++)->l = CMOVE2(loww(p), bplpt[i]); in ami_rebuild_copper()
2207 line = par->diwstrt_v + ((par->vyres - par->yoffset) << par->line_shift) - 2; in ami_rebuild_copper()
2209 (cops++)->l = CWAIT(h_end1, 510); in ami_rebuild_copper()
2210 line -= 512; in ami_rebuild_copper()
2212 if (line > 510 && IS_AGA && maxfmode + par->clk_shift == 0) in ami_rebuild_copper()
2213 (cops++)->l = CWAIT(h_end1, line); in ami_rebuild_copper()
2215 (cops++)->l = CWAIT(h_end2, line); in ami_rebuild_copper()
2216 p = par->bplpt0wrap; in ami_rebuild_copper()
2217 if (mod2(par->diwstrt_v + par->vyres - in ami_rebuild_copper()
2218 par->yoffset)) in ami_rebuild_copper()
2219 p -= par->next_line; in ami_rebuild_copper()
2221 p += par->next_line; in ami_rebuild_copper()
2224 p = par->bplpt0wrap - par->next_line; in ami_rebuild_copper()
2226 for (i = 0; i < (short)par->bpp; i++, p += par->next_plane) { in ami_rebuild_copper()
2227 (cops++)->l = CMOVE(highw(p), bplpt[i]); in ami_rebuild_copper()
2228 (cops++)->l = CMOVE2(loww(p), bplpt[i]); in ami_rebuild_copper()
2230 cops->l = CEND; in ami_rebuild_copper()
2241 struct amifb_par *par = info->par; in ami_build_copper()
2245 currentcop = 1 - currentcop; in ami_build_copper()
2249 (copl++)->l = CWAIT(0, 10); in ami_build_copper()
2250 (copl++)->l = CMOVE(par->bplcon0, bplcon0); in ami_build_copper()
2251 (copl++)->l = CMOVE(0, sprpt[0]); in ami_build_copper()
2252 (copl++)->l = CMOVE2(0, sprpt[0]); in ami_build_copper()
2254 if (par->bplcon0 & BPC0_LACE) { in ami_build_copper()
2257 (cops++)->l = CWAIT(0, 10); in ami_build_copper()
2258 (cops++)->l = CMOVE(par->bplcon0, bplcon0); in ami_build_copper()
2259 (cops++)->l = CMOVE(0, sprpt[0]); in ami_build_copper()
2260 (cops++)->l = CMOVE2(0, sprpt[0]); in ami_build_copper()
2262 (copl++)->l = CMOVE(diwstrt2hw(par->diwstrt_h, par->diwstrt_v + 1), diwstrt); in ami_build_copper()
2263 (copl++)->l = CMOVE(diwstop2hw(par->diwstop_h, par->diwstop_v + 1), diwstop); in ami_build_copper()
2264 (cops++)->l = CMOVE(diwstrt2hw(par->diwstrt_h, par->diwstrt_v), diwstrt); in ami_build_copper()
2265 (cops++)->l = CMOVE(diwstop2hw(par->diwstop_h, par->diwstop_v), diwstop); in ami_build_copper()
2267 (copl++)->l = CMOVE(diwhigh2hw(par->diwstrt_h, par->diwstrt_v + 1, in ami_build_copper()
2268 par->diwstop_h, par->diwstop_v + 1), diwhigh); in ami_build_copper()
2269 (cops++)->l = CMOVE(diwhigh2hw(par->diwstrt_h, par->diwstrt_v, in ami_build_copper()
2270 par->diwstop_h, par->diwstop_v), diwhigh); in ami_build_copper()
2272 if (par->beamcon0 & BMC0_VARBEAMEN) { in ami_build_copper()
2273 (copl++)->l = CMOVE(vtotal2hw(par->vtotal), vtotal); in ami_build_copper()
2274 (copl++)->l = CMOVE(vbstrt2hw(par->vbstrt + 1), vbstrt); in ami_build_copper()
2275 (copl++)->l = CMOVE(vbstop2hw(par->vbstop + 1), vbstop); in ami_build_copper()
2276 (cops++)->l = CMOVE(vtotal2hw(par->vtotal), vtotal); in ami_build_copper()
2277 (cops++)->l = CMOVE(vbstrt2hw(par->vbstrt), vbstrt); in ami_build_copper()
2278 (cops++)->l = CMOVE(vbstop2hw(par->vbstop), vbstop); in ami_build_copper()
2283 (copl++)->l = CMOVE(highw(p), cop2lc); in ami_build_copper()
2284 (copl++)->l = CMOVE2(loww(p), cop2lc); in ami_build_copper()
2286 (cops++)->l = CMOVE(highw(p), cop2lc); in ami_build_copper()
2287 (cops++)->l = CMOVE2(loww(p), cop2lc); in ami_build_copper()
2290 (copl++)->l = CMOVE(diwstrt2hw(par->diwstrt_h, par->diwstrt_v), diwstrt); in ami_build_copper()
2291 (copl++)->l = CMOVE(diwstop2hw(par->diwstop_h, par->diwstop_v), diwstop); in ami_build_copper()
2293 (copl++)->l = CMOVE(diwhigh2hw(par->diwstrt_h, par->diwstrt_v, in ami_build_copper()
2294 par->diwstop_h, par->diwstop_v), diwhigh); in ami_build_copper()
2296 if (par->beamcon0 & BMC0_VARBEAMEN) { in ami_build_copper()
2297 (copl++)->l = CMOVE(vtotal2hw(par->vtotal), vtotal); in ami_build_copper()
2298 (copl++)->l = CMOVE(vbstrt2hw(par->vbstrt), vbstrt); in ami_build_copper()
2299 (copl++)->l = CMOVE(vbstop2hw(par->vbstop), vbstop); in ami_build_copper()
2307 ami_rebuild_copper(info->par); in ami_build_copper()
2396 struct amifb_par *par = info->par; in amifb_set_par()
2403 error = ami_decode_var(&info->var, par, info); in amifb_set_par()
2414 if (par->bpp == 1) { in amifb_set_par()
2415 info->fix.type = FB_TYPE_PACKED_PIXELS; in amifb_set_par()
2416 info->fix.type_aux = 0; in amifb_set_par()
2418 info->fix.type = FB_TYPE_INTERLEAVED_PLANES; in amifb_set_par()
2419 info->fix.type_aux = par->next_line; in amifb_set_par()
2421 info->fix.type = FB_TYPE_PLANES; in amifb_set_par()
2422 info->fix.type_aux = 0; in amifb_set_par()
2424 info->fix.line_length = div8(upx(16 << maxfmode, par->vxres)); in amifb_set_par()
2426 if (par->vmode & FB_VMODE_YWRAP) { in amifb_set_par()
2427 info->fix.ywrapstep = 1; in amifb_set_par()
2428 info->fix.xpanstep = 0; in amifb_set_par()
2429 info->fix.ypanstep = 0; in amifb_set_par()
2430 info->flags = FBINFO_HWACCEL_YWRAP | in amifb_set_par()
2433 info->fix.ywrapstep = 0; in amifb_set_par()
2434 if (par->vmode & FB_VMODE_SMOOTH_XPAN) in amifb_set_par()
2435 info->fix.xpanstep = 1; in amifb_set_par()
2437 info->fix.xpanstep = 16 << maxfmode; in amifb_set_par()
2438 info->fix.ypanstep = 1; in amifb_set_par()
2439 info->flags = FBINFO_HWACCEL_YPAN; in amifb_set_par()
2454 const struct amifb_par *par = info->par; in amifb_setcolreg()
2459 } else if (par->bplcon0 & BPC0_SHRES) { in amifb_setcolreg()
2486 u_short bplcon3 = par->bplcon3; in amifb_setcolreg()
2500 if (par->bplcon0 & BPC0_SHRES) { in amifb_setcolreg()
2507 for (i = regno + 12; i >= (int)regno; i -= 4) in amifb_setcolreg()
2511 for (i = regno + 3; i >= (int)regno; i--) in amifb_setcolreg()
2528 do_blank = blank ? blank : -1; in amifb_blank()
2543 if (!(var->vmode & FB_VMODE_YWRAP)) { in amifb_pan_display()
2548 if (var->xoffset + info->var.xres > in amifb_pan_display()
2549 upx(16 << maxfmode, info->var.xres_virtual)) in amifb_pan_display()
2550 return -EINVAL; in amifb_pan_display()
2588 * Unaligned forward bit copy using 32-bit or 64-bit memory accesses
2595 int shift = dst_idx - src_idx, left, right; in bitcpy()
2602 shift = dst_idx - src_idx; in bitcpy()
2621 n -= BITS_PER_LONG - dst_idx; in bitcpy()
2635 n -= 8; in bitcpy()
2637 while (n--) in bitcpy()
2647 right = shift & (BITS_PER_LONG - 1); in bitcpy()
2648 left = -shift & (BITS_PER_LONG - 1); in bitcpy()
2675 n -= BITS_PER_LONG - dst_idx; in bitcpy()
2683 n -= BITS_PER_LONG - dst_idx; in bitcpy()
2702 n -= 4; in bitcpy()
2704 while (n--) { in bitcpy()
2728 * Unaligned reverse bit copy using 32-bit or 64-bit memory accesses
2735 int shift = dst_idx - src_idx, left, right; in bitcpy_rev()
2742 dst += (n - 1) / BITS_PER_LONG; in bitcpy_rev()
2743 src += (n - 1) / BITS_PER_LONG; in bitcpy_rev()
2744 if ((n - 1) % BITS_PER_LONG) { in bitcpy_rev()
2745 dst_idx += (n - 1) % BITS_PER_LONG; in bitcpy_rev()
2747 dst_idx &= BITS_PER_LONG - 1; in bitcpy_rev()
2748 src_idx += (n - 1) % BITS_PER_LONG; in bitcpy_rev()
2750 src_idx &= BITS_PER_LONG - 1; in bitcpy_rev()
2753 shift = dst_idx - src_idx; in bitcpy_rev()
2754 first = ~0UL << (BITS_PER_LONG - 1 - dst_idx); in bitcpy_rev()
2755 last = ~(~0UL << (BITS_PER_LONG - 1 - ((dst_idx - n) % BITS_PER_LONG))); in bitcpy_rev()
2770 dst--; in bitcpy_rev()
2771 src--; in bitcpy_rev()
2772 n -= dst_idx + 1; in bitcpy_rev()
2778 *dst-- = *src--; in bitcpy_rev()
2779 *dst-- = *src--; in bitcpy_rev()
2780 *dst-- = *src--; in bitcpy_rev()
2781 *dst-- = *src--; in bitcpy_rev()
2782 *dst-- = *src--; in bitcpy_rev()
2783 *dst-- = *src--; in bitcpy_rev()
2784 *dst-- = *src--; in bitcpy_rev()
2785 *dst-- = *src--; in bitcpy_rev()
2786 n -= 8; in bitcpy_rev()
2788 while (n--) in bitcpy_rev()
2789 *dst-- = *src--; in bitcpy_rev()
2798 right = shift & (BITS_PER_LONG - 1); in bitcpy_rev()
2799 left = -shift & (BITS_PER_LONG - 1); in bitcpy_rev()
2813 d0 = *src--; in bitcpy_rev()
2820 d0 = *src--; in bitcpy_rev()
2825 dst--; in bitcpy_rev()
2826 n -= dst_idx + 1; in bitcpy_rev()
2829 d1 = *src--; in bitcpy_rev()
2833 dst--; in bitcpy_rev()
2834 n -= dst_idx + 1; in bitcpy_rev()
2841 d1 = *src--; in bitcpy_rev()
2842 *dst-- = d0 >> right | d1 << left; in bitcpy_rev()
2844 d1 = *src--; in bitcpy_rev()
2845 *dst-- = d0 >> right | d1 << left; in bitcpy_rev()
2847 d1 = *src--; in bitcpy_rev()
2848 *dst-- = d0 >> right | d1 << left; in bitcpy_rev()
2850 d1 = *src--; in bitcpy_rev()
2851 *dst-- = d0 >> right | d1 << left; in bitcpy_rev()
2853 n -= 4; in bitcpy_rev()
2855 while (n--) { in bitcpy_rev()
2856 d1 = *src--; in bitcpy_rev()
2857 *dst-- = d0 >> right | d1 << left; in bitcpy_rev()
2879 * Unaligned forward inverting bit copy using 32-bit or 64-bit memory
2887 int shift = dst_idx - src_idx, left, right; in bitcpy_not()
2894 shift = dst_idx - src_idx; in bitcpy_not()
2913 n -= BITS_PER_LONG - dst_idx; in bitcpy_not()
2927 n -= 8; in bitcpy_not()
2929 while (n--) in bitcpy_not()
2939 right = shift & (BITS_PER_LONG - 1); in bitcpy_not()
2940 left = -shift & (BITS_PER_LONG - 1); in bitcpy_not()
2967 n -= BITS_PER_LONG - dst_idx; in bitcpy_not()
2975 n -= BITS_PER_LONG - dst_idx; in bitcpy_not()
2994 n -= 4; in bitcpy_not()
2996 while (n--) { in bitcpy_not()
3020 * Unaligned 32-bit pattern fill using 32/64-bit memory accesses
3049 n -= BITS_PER_LONG - dst_idx; in bitfill32()
3063 n -= 8; in bitfill32()
3065 while (n--) in bitfill32()
3076 * Unaligned 32-bit pattern xor using 32/64-bit memory accesses
3105 n -= BITS_PER_LONG - dst_idx; in bitxor32()
3115 n -= 4; in bitxor32()
3117 while (n--) in bitxor32()
3132 dst_idx &= (BITS_PER_LONG - 1); in fill_one_line()
3134 if (!--bpp) in fill_one_line()
3147 dst_idx &= (BITS_PER_LONG - 1); in xor_one_line()
3149 if (!--bpp) in xor_one_line()
3160 struct amifb_par *par = info->par; in amifb_fillrect()
3165 if (!rect->width || !rect->height) in amifb_fillrect()
3172 x2 = rect->dx + rect->width; in amifb_fillrect()
3173 y2 = rect->dy + rect->height; in amifb_fillrect()
3174 x2 = x2 < info->var.xres_virtual ? x2 : info->var.xres_virtual; in amifb_fillrect()
3175 y2 = y2 < info->var.yres_virtual ? y2 : info->var.yres_virtual; in amifb_fillrect()
3176 width = x2 - rect->dx; in amifb_fillrect()
3177 height = y2 - rect->dy; in amifb_fillrect()
3180 ((unsigned long)info->screen_base & ~(BYTES_PER_LONG - 1)); in amifb_fillrect()
3181 dst_idx = ((unsigned long)info->screen_base & (BYTES_PER_LONG - 1)) * 8; in amifb_fillrect()
3182 dst_idx += rect->dy * par->next_line * 8 + rect->dx; in amifb_fillrect()
3183 while (height--) { in amifb_fillrect()
3184 switch (rect->rop) { in amifb_fillrect()
3186 fill_one_line(info->var.bits_per_pixel, in amifb_fillrect()
3187 par->next_plane, dst, dst_idx, width, in amifb_fillrect()
3188 rect->color); in amifb_fillrect()
3192 xor_one_line(info->var.bits_per_pixel, par->next_plane, in amifb_fillrect()
3193 dst, dst_idx, width, rect->color); in amifb_fillrect()
3196 dst_idx += par->next_line * 8; in amifb_fillrect()
3206 dst_idx &= (BITS_PER_LONG - 1); in copy_one_line()
3208 src_idx &= (BITS_PER_LONG - 1); in copy_one_line()
3210 if (!--bpp) in copy_one_line()
3223 dst_idx &= (BITS_PER_LONG - 1); in copy_one_line_rev()
3225 src_idx &= (BITS_PER_LONG - 1); in copy_one_line_rev()
3227 if (!--bpp) in copy_one_line_rev()
3238 struct amifb_par *par = info->par; in amifb_copyarea()
3246 x2 = area->dx + area->width; in amifb_copyarea()
3247 y2 = area->dy + area->height; in amifb_copyarea()
3248 dx = area->dx > 0 ? area->dx : 0; in amifb_copyarea()
3249 dy = area->dy > 0 ? area->dy : 0; in amifb_copyarea()
3250 x2 = x2 < info->var.xres_virtual ? x2 : info->var.xres_virtual; in amifb_copyarea()
3251 y2 = y2 < info->var.yres_virtual ? y2 : info->var.yres_virtual; in amifb_copyarea()
3252 width = x2 - dx; in amifb_copyarea()
3253 height = y2 - dy; in amifb_copyarea()
3255 if (area->sx + dx < area->dx || area->sy + dy < area->dy) in amifb_copyarea()
3259 sx = area->sx + (dx - area->dx); in amifb_copyarea()
3260 sy = area->sy + (dy - area->dy); in amifb_copyarea()
3263 if (sx + width > info->var.xres_virtual || in amifb_copyarea()
3264 sy + height > info->var.yres_virtual) in amifb_copyarea()
3273 ((unsigned long)info->screen_base & ~(BYTES_PER_LONG - 1)); in amifb_copyarea()
3275 dst_idx = ((unsigned long)info->screen_base & (BYTES_PER_LONG - 1)) * 8; in amifb_copyarea()
3277 dst_idx += dy * par->next_line * 8 + dx; in amifb_copyarea()
3278 src_idx += sy * par->next_line * 8 + sx; in amifb_copyarea()
3280 while (height--) { in amifb_copyarea()
3281 dst_idx -= par->next_line * 8; in amifb_copyarea()
3282 src_idx -= par->next_line * 8; in amifb_copyarea()
3283 copy_one_line_rev(info->var.bits_per_pixel, in amifb_copyarea()
3284 par->next_plane, dst, dst_idx, src, in amifb_copyarea()
3288 while (height--) { in amifb_copyarea()
3289 copy_one_line(info->var.bits_per_pixel, in amifb_copyarea()
3290 par->next_plane, dst, dst_idx, src, in amifb_copyarea()
3292 dst_idx += par->next_line * 8; in amifb_copyarea()
3293 src_idx += par->next_line * 8; in amifb_copyarea()
3308 dst_idx &= (BITS_PER_LONG - 1); in expand_one_line()
3311 ((unsigned long)data & ~(BYTES_PER_LONG - 1)); in expand_one_line()
3312 src_idx = ((unsigned long)data & (BYTES_PER_LONG - 1)) * 8; in expand_one_line()
3320 if (!--bpp) in expand_one_line()
3331 struct amifb_par *par = info->par; in amifb_imageblit()
3343 x2 = image->dx + image->width; in amifb_imageblit()
3344 y2 = image->dy + image->height; in amifb_imageblit()
3345 dx = image->dx; in amifb_imageblit()
3346 dy = image->dy; in amifb_imageblit()
3347 x2 = x2 < info->var.xres_virtual ? x2 : info->var.xres_virtual; in amifb_imageblit()
3348 y2 = y2 < info->var.yres_virtual ? y2 : info->var.yres_virtual; in amifb_imageblit()
3349 width = x2 - dx; in amifb_imageblit()
3350 height = y2 - dy; in amifb_imageblit()
3352 if (image->depth == 1) { in amifb_imageblit()
3354 ((unsigned long)info->screen_base & ~(BYTES_PER_LONG - 1)); in amifb_imageblit()
3355 dst_idx = ((unsigned long)info->screen_base & (BYTES_PER_LONG - 1)) * 8; in amifb_imageblit()
3356 dst_idx += dy * par->next_line * 8 + dx; in amifb_imageblit()
3357 src = image->data; in amifb_imageblit()
3358 pitch = (image->width + 7) / 8; in amifb_imageblit()
3359 while (height--) { in amifb_imageblit()
3360 expand_one_line(info->var.bits_per_pixel, in amifb_imageblit()
3361 par->next_plane, dst, dst_idx, width, in amifb_imageblit()
3362 src, image->bg_color, in amifb_imageblit()
3363 image->fg_color); in amifb_imageblit()
3364 dst_idx += par->next_line * 8; in amifb_imageblit()
3368 c2p_planar(info->screen_base, image->data, dx, dy, width, in amifb_imageblit()
3369 height, par->next_line, par->next_plane, in amifb_imageblit()
3370 image->width, info->var.bits_per_pixel); in amifb_imageblit()
3392 i = ami_get_fix_cursorinfo(&crsr.fix, info->par); in amifb_ioctl()
3396 sizeof(crsr.fix)) ? -EFAULT : 0; in amifb_ioctl()
3400 ((struct fb_var_cursorinfo __user *)arg)->data, in amifb_ioctl()
3401 info->par); in amifb_ioctl()
3405 sizeof(crsr.var)) ? -EFAULT : 0; in amifb_ioctl()
3409 return -EFAULT; in amifb_ioctl()
3411 ((struct fb_var_cursorinfo __user *)arg)->data, in amifb_ioctl()
3412 info->par); in amifb_ioctl()
3415 i = ami_get_cursorstate(&crsr.state, info->par); in amifb_ioctl()
3419 sizeof(crsr.state)) ? -EFAULT : 0; in amifb_ioctl()
3423 return -EFAULT; in amifb_ioctl()
3424 return ami_set_cursorstate(&crsr.state, info->par); in amifb_ioctl()
3426 return -EINVAL; in amifb_ioctl()
3439 if (!--cursorcount) { in flash_cursor()
3440 cursorstate = -cursorstate; in flash_cursor()
3545 return -ENODEV; in amifb_probe()
3551 info = framebuffer_alloc(sizeof(struct amifb_par), &pdev->dev); in amifb_probe()
3553 return -ENOMEM; in amifb_probe()
3555 strcpy(info->fix.id, "Amiga "); in amifb_probe()
3556 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; in amifb_probe()
3557 info->fix.accel = FB_ACCEL_AMIGABLITT; in amifb_probe()
3562 strcat(info->fix.id, "OCS"); in amifb_probe()
3570 info->fix.smem_len = VIDEOMEMSIZE_OCS; in amifb_probe()
3576 strcat(info->fix.id, "ECS"); in amifb_probe()
3588 if (amiga_chip_avail() - CHIPRAM_SAFETY_LIMIT > in amifb_probe()
3590 info->fix.smem_len = VIDEOMEMSIZE_ECS_2M; in amifb_probe()
3592 info->fix.smem_len = VIDEOMEMSIZE_ECS_1M; in amifb_probe()
3598 strcat(info->fix.id, "AGA"); in amifb_probe()
3605 if (amiga_chip_avail() - CHIPRAM_SAFETY_LIMIT > in amifb_probe()
3607 info->fix.smem_len = VIDEOMEMSIZE_AGA_2M; in amifb_probe()
3609 info->fix.smem_len = VIDEOMEMSIZE_AGA_1M; in amifb_probe()
3616 strcat(info->fix.id, "Unknown"); in amifb_probe()
3619 err = -ENODEV; in amifb_probe()
3643 tag = mode->pixclock; in amifb_probe()
3645 mode->pixclock = pixclock[tag]; in amifb_probe()
3650 info->monspecs.hfmin = amifb_hfmin; in amifb_probe()
3651 info->monspecs.hfmax = amifb_hfmax; in amifb_probe()
3652 info->monspecs.vfmin = amifb_vfmin; in amifb_probe()
3653 info->monspecs.vfmax = amifb_vfmax; in amifb_probe()
3658 info->monspecs.hfmin = 15000; in amifb_probe()
3659 info->monspecs.hfmax = 38000; in amifb_probe()
3660 info->monspecs.vfmin = 49; in amifb_probe()
3661 info->monspecs.vfmax = 90; in amifb_probe()
3664 info->fbops = &amifb_ops; in amifb_probe()
3665 info->device = &pdev->dev; in amifb_probe()
3667 if (!fb_find_mode(&info->var, info, mode_option, ami_modedb, in amifb_probe()
3669 err = -EINVAL; in amifb_probe()
3674 &info->modelist); in amifb_probe()
3677 chipptr = chipalloc(info->fix.smem_len + SPRITEMEMSIZE + in amifb_probe()
3681 err = -ENOMEM; in amifb_probe()
3685 assignchunk(videomemory, u_long, chipptr, info->fix.smem_len); in amifb_probe()
3697 info->fix.smem_start = (u_long)ZTWO_PADDR(videomemory); in amifb_probe()
3698 videomemory = (u_long)ioremap_wt(info->fix.smem_start, in amifb_probe()
3699 info->fix.smem_len); in amifb_probe()
3701 dev_warn(&pdev->dev, in amifb_probe()
3703 info->screen_base = ZTWO_VADDR(info->fix.smem_start); in amifb_probe()
3705 info->screen_base = (char *)videomemory; in amifb_probe()
3710 * Make sure the Copper has something to do in amifb_probe()
3715 * Enable Display DMA in amifb_probe()
3721 "fb vertb handler", info->par); in amifb_probe()
3725 err = fb_alloc_cmap(&info->cmap, 1 << info->var.bits_per_pixel, 0); in amifb_probe()
3736 info->fix.id, info->fix.smem_len>>10); in amifb_probe()
3741 fb_dealloc_cmap(&info->cmap); in amifb_probe()
3743 free_irq(IRQ_AMIGA_COPPER, info->par); in amifb_probe()
3760 fb_dealloc_cmap(&info->cmap); in amifb_remove()
3761 free_irq(IRQ_AMIGA_COPPER, info->par); in amifb_remove()
3779 .name = "amiga-video",
3785 MODULE_DESCRIPTION("Amiga builtin chipset frame buffer driver");
3787 MODULE_ALIAS("platform:amiga-video");