diff options
| author | James Simmons <jsimmons@maxwell.earthlink.net> | 2002-10-15 21:18:08 -0700 |
|---|---|---|
| committer | James Simmons <jsimmons@maxwell.earthlink.net> | 2002-10-15 21:18:08 -0700 |
| commit | 32705156ef67653fa7e63821fbdbc8fd3ea57d8d (patch) | |
| tree | b4987d368412724ec2b91c4eb6a59adce195d661 | |
| parent | 4eaa387e28409826bd1aeb578901e053f1c2ca56 (diff) | |
| parent | 00b1d58d5aecaa11e02dbefc980d368cd9e9b356 (diff) | |
Merge maxwell.earthlink.net:/usr/src/linus-2.5
into maxwell.earthlink.net:/usr/src/fbdev-2.5
107 files changed, 4143 insertions, 6319 deletions
@@ -2785,6 +2785,19 @@ S: Klosterweg 28 / i309 S: 76131 Karlsruhe S: Germany +N: James Simmons +E: jsimmons@users.sf.net +D: Frame buffer device maintainer +D: input layer developement +D: tty/console layer +D: various mipsel devices +S: 115 Carmel Avenue +S: El Cerrito CA 94530 +S: USA + +N: Chris Vance +E: cvance@tislabs.com + N: Jaspreet Singh E: jaspreet@sangoma.com W: www.sangoma.com diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl index 325a9447e073..f7b088432595 100644 --- a/Documentation/DocBook/kernel-api.tmpl +++ b/Documentation/DocBook/kernel-api.tmpl @@ -365,7 +365,7 @@ KAO --> !Edrivers/video/fbmem.c </sect1> <sect1><title>Frame Buffer Console</title> -!Edrivers/video/fbcon.c +!Edrivers/video/console/fbcon.c </sect1> <sect1><title>Frame Buffer Colormap</title> !Edrivers/video/fbcmap.c @@ -385,7 +385,7 @@ KAO --> !Idrivers/video/macmodes.c </sect1> <sect1><title>Frame Buffer Fonts</title> -!Idrivers/video/fonts.c +!Idrivers/video/console/fonts.c </sect1> </chapter> <!-- Needs ksyms to list additional exported symbols, but no specific doc. diff --git a/MAINTAINERS b/MAINTAINERS index a9b191413d74..37c36c32a477 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -591,6 +591,13 @@ M: kevin.curtis@farsite.co.uk W: http://www.farsite.co.uk/ S: Supported +FRAMEBUFFER LAYER +P: James Simmons, Geert Uytterhoeven +M: jsimmons@users.sf.net, geert@linux-m68k.org +L: linux-fbdev-devel@lists.sourceforge.net +W: http://www.linux-fbdev.org +S: Supported + FILE LOCKING (flock() and fcntl()/lockf()) P: Matthew Wilcox M: matthew@wil.cx @@ -668,7 +668,7 @@ defconfig: CLEAN_FILES += \ include/linux/compile.h \ vmlinux System.map \ - drivers/char/consolemap_deftbl.c drivers/video/promcon_tbl.c \ + drivers/char/consolemap_deftbl.c drivers/video/console/promcon_tbl.c \ drivers/char/conmakehash \ drivers/char/drm/*-mod.c \ drivers/char/defkeymap.c drivers/char/qtronixmap.c \ diff --git a/arch/alpha/config.in b/arch/alpha/config.in index dc851ada6963..c4f6d381d15e 100644 --- a/arch/alpha/config.in +++ b/arch/alpha/config.in @@ -348,22 +348,7 @@ source drivers/media/Config.in source fs/Config.in -if [ "$CONFIG_VT" = "y" ]; then - mainmenu_option next_comment - comment 'Console drivers' - bool 'VGA text console' CONFIG_VGA_CONSOLE -# if [ "$CONFIG_PCI" = "y" -a "$CONFIG_VGA_CONSOLE" = "y" ]; then -# bool ' Allow VGA on any bus?' CONFIG_VGA_HOSE -# if [ "$CONFIG_VGA_HOSE" = "y" ]; then -# define_bool CONFIG_DUMMY_CONSOLE y -# fi -# fi - source drivers/video/Config.in - if [ "$CONFIG_FB" = "y" ]; then - define_bool CONFIG_PCI_CONSOLE y - fi - endmenu -fi +source drivers/video/Config.in mainmenu_option next_comment comment 'Sound' diff --git a/arch/arm/config.in b/arch/arm/config.in index 9e6605c5a4e4..e9f7e1c2f39b 100644 --- a/arch/arm/config.in +++ b/arch/arm/config.in @@ -498,15 +498,7 @@ source drivers/media/Config.in source fs/Config.in -if [ "$CONFIG_VT" = "y" ]; then - mainmenu_option next_comment - comment 'Console drivers' - if [ "$CONFIG_ARCH_ACORN" != "y" -a "$CONFIG_ARCH_EBSA110" != "y" ]; then - bool 'VGA text console' CONFIG_VGA_CONSOLE - fi - source drivers/video/Config.in - endmenu -fi +source drivers/video/Config.in if [ "$CONFIG_ARCH_ACORN" = "y" -o \ "$CONFIG_ARCH_CLPS7500" = "y" -o \ diff --git a/arch/i386/config.in b/arch/i386/config.in index 1026d1a0a1f4..2adcd502d7a9 100644 --- a/arch/i386/config.in +++ b/arch/i386/config.in @@ -418,17 +418,7 @@ source drivers/media/Config.in source fs/Config.in -if [ "$CONFIG_VT" = "y" ]; then - mainmenu_option next_comment - comment 'Console drivers' - bool 'VGA text console' CONFIG_VGA_CONSOLE - bool 'Video mode selection support' CONFIG_VIDEO_SELECT - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - tristate 'MDA text console (dual-headed) (EXPERIMENTAL)' CONFIG_MDA_CONSOLE - source drivers/video/Config.in - fi - endmenu -fi +source drivers/video/Config.in mainmenu_option next_comment comment 'Sound' diff --git a/arch/ia64/config.in b/arch/ia64/config.in index c2e6fdf686fd..9147f72fbf74 100644 --- a/arch/ia64/config.in +++ b/arch/ia64/config.in @@ -229,16 +229,7 @@ fi # HP_SIM source fs/Config.in if [ "$CONFIG_IA64_HP_SIM" = "n" ]; then - if [ "$CONFIG_VT" = "y" ]; then - mainmenu_option next_comment - comment 'Console drivers' - bool 'VGA text console' CONFIG_VGA_CONSOLE - source drivers/video/Config.in - if [ "$CONFIG_FB" = "y" ]; then - define_bool CONFIG_PCI_CONSOLE y - fi - endmenu - fi + source drivers/video/Config.in mainmenu_option next_comment comment 'Sound' diff --git a/arch/m68k/config.in b/arch/m68k/config.in index 436e3a3986a9..9dc1eec61bac 100644 --- a/arch/m68k/config.in +++ b/arch/m68k/config.in @@ -527,12 +527,7 @@ endmenu source fs/Config.in -if [ "$CONFIG_VT" = "y" ]; then - mainmenu_option next_comment - comment 'Console drivers' - source drivers/video/Config.in - endmenu -fi +source drivers/video/Config.in mainmenu_option next_comment comment 'Kernel hacking' diff --git a/arch/mips/config.in b/arch/mips/config.in index f48cfd6ae206..f7319fdfdbd5 100644 --- a/arch/mips/config.in +++ b/arch/mips/config.in @@ -449,16 +449,7 @@ fi source fs/Config.in -if [ "$CONFIG_VT" = "y" ]; then - mainmenu_option next_comment - comment 'Console drivers' - bool 'VGA text console' CONFIG_VGA_CONSOLE - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - tristate 'MDA text console (dual-headed) (EXPERIMENTAL)' CONFIG_MDA_CONSOLE - source drivers/video/Config.in - fi - endmenu -fi +source drivers/video/Config.in if [ "$CONFIG_DECSTATION" != "y" ]; then mainmenu_option next_comment diff --git a/arch/mips64/config.in b/arch/mips64/config.in index f60cccdea4be..9851d55ee8c0 100644 --- a/arch/mips64/config.in +++ b/arch/mips64/config.in @@ -199,20 +199,7 @@ source drivers/media/Config.in source fs/Config.in -if [ "$CONFIG_VT" = "y" ]; then - mainmenu_option next_comment - comment 'Console drivers' - source drivers/video/Config.in - if [ "$CONFIG_SGI_IP22" = "y" ]; then - tristate 'SGI Newport Console support' CONFIG_SGI_NEWPORT_CONSOLE - if [ "$CONFIG_SGI_NEWPORT_CONSOLE" != "y" ]; then - define_bool CONFIG_DUMMY_CONSOLE y - else - define_bool CONFIG_FONT_8x16 y - fi - fi - endmenu -fi +source drivers/video/Config.in if [ "$CONFIG_PROC_FS" = "y" ]; then define_bool CONFIG_KCORE_ELF y diff --git a/arch/parisc/config.in b/arch/parisc/config.in index 990b739f6d80..2ec98ccce0af 100644 --- a/arch/parisc/config.in +++ b/arch/parisc/config.in @@ -168,24 +168,7 @@ if [ "$CONFIG_SOUND" != "n" ]; then fi endmenu -if [ "$CONFIG_VT" = "y" ]; then - mainmenu_option next_comment - comment 'Console drivers' - source drivers/video/Config.in - -# bool 'IODC console' CONFIG_IODC_CONSOLE - bool 'STI console' CONFIG_STI_CONSOLE - if [ "$CONFIG_IODC_CONSOLE" = "n" ]; then - if [ "$CONFIG_GSC_PS2" = "y" ]; then - define_bool CONFIG_DUMMY_CONSOLE y - fi - fi - if [ "$CONFIG_STI_CONSOLE" = "y" ]; then - define_bool CONFIG_DUMMY_CONSOLE y - fi - endmenu -fi -# endmenu +source drivers/video/Config.in mainmenu_option next_comment comment 'Kernel hacking' diff --git a/arch/ppc/config.in b/arch/ppc/config.in index 84f098ad2753..bb2c92f7b17e 100644 --- a/arch/ppc/config.in +++ b/arch/ppc/config.in @@ -459,14 +459,7 @@ source net/irda/Config.in source drivers/isdn/Config.in -mainmenu_option next_comment -comment 'Console drivers' -if [ "$CONFIG_4xx" != "y" -a "$CONFIG_8xx" != "y" ]; then - bool 'VGA text console' CONFIG_VGA_CONSOLE -fi source drivers/video/Config.in -endmenu - if [ "$CONFIG_PPC_ISERIES" = "y" ]; then mainmenu_option next_comment diff --git a/arch/ppc64/config.in b/arch/ppc64/config.in index 2d4ddf69c839..a83a7aa938ea 100644 --- a/arch/ppc64/config.in +++ b/arch/ppc64/config.in @@ -152,12 +152,7 @@ source drivers/media/Config.in source fs/Config.in -if [ "$CONFIG_VT" = "y" ]; then - mainmenu_option next_comment - comment 'Console drivers' - source drivers/video/Config.in - endmenu -fi +source drivers/video/Config.in mainmenu_option next_comment comment 'Sound' diff --git a/arch/sh/config.in b/arch/sh/config.in index 54640eb6172c..0603186fbc39 100644 --- a/arch/sh/config.in +++ b/arch/sh/config.in @@ -336,18 +336,7 @@ source fs/Config.in source drivers/media/Config.in -if [ "$CONFIG_VT" = "y" ]; then - mainmenu_option next_comment - comment 'Console drivers' - bool 'VGA text console' CONFIG_VGA_CONSOLE - bool 'Video mode selection support' CONFIG_VIDEO_SELECT - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - tristate 'MDA text console (dual-headed) (EXPERIMENTAL)' CONFIG_MDA_CONSOLE - source drivers/video/Config.in - fi - endmenu -fi - +source drivers/video/Config.in mainmenu_option next_comment comment 'Sound' diff --git a/arch/sparc/config.in b/arch/sparc/config.in index e93547ad28f3..83c207b989e8 100644 --- a/arch/sparc/config.in +++ b/arch/sparc/config.in @@ -60,14 +60,7 @@ source drivers/parport/Config.in dep_tristate ' Parallel printer support' CONFIG_PRINTER $CONFIG_PARPORT endmenu -mainmenu_option next_comment -comment 'Console drivers' -bool 'PROM console' CONFIG_PROM_CONSOLE -if [ "$CONFIG_PROM_CONSOLE" != "y" ]; then - define_bool CONFIG_DUMMY_CONSOLE y -fi source drivers/video/Config.in -endmenu source drivers/mtd/Config.in diff --git a/arch/sparc64/config.in b/arch/sparc64/config.in index 537b7d099c94..848e2f7eb6a8 100644 --- a/arch/sparc64/config.in +++ b/arch/sparc64/config.in @@ -74,11 +74,7 @@ if [ "$CONFIG_PCI" = "y" ]; then fi endmenu -mainmenu_option next_comment -comment 'Console drivers' -bool 'PROM console' CONFIG_PROM_CONSOLE source drivers/video/Config.in -endmenu source drivers/serial/Config.in source drivers/sbus/char/Config.in diff --git a/arch/x86_64/config.in b/arch/x86_64/config.in index 6c41e4e22b1d..04395edd04ca 100644 --- a/arch/x86_64/config.in +++ b/arch/x86_64/config.in @@ -188,17 +188,7 @@ source drivers/media/Config.in source fs/Config.in -if [ "$CONFIG_VT" = "y" ]; then - mainmenu_option next_comment - comment 'Console drivers' - bool 'VGA text console' CONFIG_VGA_CONSOLE - bool 'Video mode selection support' CONFIG_VIDEO_SELECT - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - tristate 'MDA text console (dual-headed) (EXPERIMENTAL)' CONFIG_MDA_CONSOLE - source drivers/video/Config.in - fi - endmenu -fi +source drivers/video/Config.in mainmenu_option next_comment comment 'Sound' diff --git a/drivers/Makefile b/drivers/Makefile index 2224ec9303f6..8815edec8cbc 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -17,7 +17,7 @@ obj-$(CONFIG_FC4) += fc4/ obj-$(CONFIG_SCSI) += scsi/ obj-$(CONFIG_FUSION) += message/ obj-$(CONFIG_IEEE1394) += ieee1394/ -obj-y += cdrom/ +obj-y += cdrom/ video/ obj-$(CONFIG_MTD) += mtd/ obj-$(CONFIG_PCMCIA) += pcmcia/ obj-$(CONFIG_DIO) += dio/ @@ -27,7 +27,6 @@ obj-$(CONFIG_ALL_PPC) += macintosh/ obj-$(CONFIG_MAC) += macintosh/ obj-$(CONFIG_PNP) += pnp/ obj-$(CONFIG_SGI) += sgi/ -obj-$(CONFIG_VT) += video/ obj-$(CONFIG_PARIDE) += block/paride/ obj-$(CONFIG_TC) += tc/ obj-$(CONFIG_USB) += usb/ diff --git a/drivers/video/Config.help b/drivers/video/Config.help index 7a079fff6d58..d508d1f1c7d3 100644 --- a/drivers/video/Config.help +++ b/drivers/video/Config.help @@ -1,19 +1,6 @@ CONFIG_FB_SGIVW SGI Visual Workstation support for framebuffer graphics. -CONFIG_VIDEO_SELECT - This enables support for text mode selection on kernel startup. If - you want to take advantage of some high-resolution text mode your - card's BIOS offers, but the traditional Linux utilities like - SVGATextMode don't, you can say Y here and set the mode using the - "vga=" option from your boot loader (lilo or loadlin) or set - "vga=ask" which brings up a video mode menu on kernel startup. (Try - "man bootparam" or see the documentation of your boot loader about - how to pass options to the kernel.) - - Read the file <file:Documentation/svga.txt> for more information - about the Video mode selection support. If unsure, say N. - CONFIG_FB The frame buffer device provides an abstraction for the graphics hardware. It represents the frame buffer of some video hardware and @@ -242,14 +229,6 @@ CONFIG_FB_VESA You will get a boot time penguin logo at no additional cost. Please read <file:Documentation/fb/vesafb.txt>. If unsure, say Y. -CONFIG_FBCON_VGA_PLANES - This low level frame buffer console driver enable the kernel to use - the 16-color planar modes of the old VGA cards where the bits of - each pixel are separated into 4 planes. - - Only answer Y here if you have a (very old) VGA card that isn't VESA - 2 compatible. - CONFIG_FB_VGA16 This is the frame buffer device driver for VGA 16 color graphic cards. Say Y if you have such a card. @@ -280,58 +259,6 @@ CONFIG_FB_STI Really old HP boxes may not have STI, and must use the PDC BIOS console or the IODC BIOS. -CONFIG_FBCON_FONTS - Say Y here if you would like to use fonts other than the default - your frame buffer console usually use. - - Note that the answer to this question won't directly affect the - kernel: saying N will just cause the configurator to skip all - the questions about foreign fonts. - - If unsure, say N (the default choices are safe). - -CONFIG_FONT_8x16 - This is the "high resolution" font for the VGA frame buffer (the one - provided by the VGA text console 80x25 mode. - - If unsure, say Y. - -CONFIG_FBCON_FONTWIDTH8_ONLY - Answer Y here will make the kernel provide only the 8x8 fonts (these - are the less readable). - - If unsure, say N. - -CONFIG_FONT_SUN8x16 - This is the high resolution console font for Sun machines. Say Y. - -CONFIG_FONT_SUN12x22 - This is the high resolution console font for Sun machines with very - big letters (like the letters used in the SPARC PROM). If the - standard font is unreadable for you, say Y, otherwise say N. - -CONFIG_FONT_8x8 - This is the "high resolution" font for the VGA frame buffer (the one - provided by the text console 80x50 (and higher) modes). - - Note that this is a poor quality font. The VGA 8x16 font is quite a - lot more readable. - - Given the resolution provided by the frame buffer device, answer N - here is safe. - -CONFIG_FONT_6x11 - Small console font with Macintosh-style high-half glyphs. Some Mac - framebuffer drivers don't support this one at all. - -CONFIG_FONT_PEARL_8x8 - Small console font with PC-style control-character and high-half - glyphs. - -CONFIG_FONT_ACORN_8x8 - Small console font with PC-style control characters and high-half - glyphs. - CONFIG_FB_HGA Say Y here if you have a Hercules mono graphics card. @@ -646,79 +573,3 @@ CONFIG_FB_SA1100 If you plan to use the LCD display with your SA-1100 system, say Y here. -CONFIG_FBCON_ADVANCED - The frame buffer console uses character drawing routines that are - tailored to the specific organization of pixels in the memory of - your graphics hardware. These are called the low level frame buffer - console drivers. Note that they are used for text console output - only; they are NOT needed for graphical applications. - - If you say N here, the needed low level drivers are automatically - enabled, depending on what frame buffer devices you selected above. - This is recommended for most users. - - If you say Y here, you have more fine-grained control over which low - level drivers are enabled. You can e.g. leave out low level drivers - for color depths you do not intend to use for text consoles. - - Low level frame buffer console drivers can be modules ( = code which - can be inserted and removed from the running kernel whenever you - want). The modules will be called fbcon-*.o. If you want to compile - (some of) them as modules, read <file:Documentation/modules.txt>. - - If unsure, say N. - -CONFIG_FBCON_MFB - This is the low level frame buffer console driver for monochrome - (2 colors) packed pixels. - -CONFIG_FBCON_CFB2 - This is the low level frame buffer console driver for 2 bits per - pixel (4 colors) packed pixels. - -CONFIG_FBCON_CFB4 - This is the low level frame buffer console driver for 4 bits per - pixel (16 colors) packed pixels. - -CONFIG_FBCON_CFB8 - This is the low level frame buffer console driver for 8 bits per - pixel (256 colors) packed pixels. - -CONFIG_FBCON_CFB16 - This is the low level frame buffer console driver for 15 or 16 bits - per pixel (32K or 64K colors, also known as `hicolor') packed - pixels. - -CONFIG_FBCON_CFB24 - This is the low level frame buffer console driver for 24 bits per - pixel (16M colors, also known as `truecolor') packed pixels. It is - NOT for `sparse' 32 bits per pixel mode. - -CONFIG_FBCON_CFB32 - This is the low level frame buffer console driver for 32 bits per - pixel (16M colors, also known as `truecolor') sparse packed pixels. - -CONFIG_FBCON_AFB - This is the low level frame buffer console driver for 1 to 8 - bitplanes (2 to 256 colors) on Amiga. - -CONFIG_FBCON_ILBM - This is the low level frame buffer console driver for 1 to 8 - interleaved bitplanes (2 to 256 colors) on Amiga. - -CONFIG_FBCON_IPLAN2P2 - This is the low level frame buffer console driver for 2 interleaved - bitplanes (4 colors) on Atari. - -CONFIG_FBCON_IPLAN2P4 - This is the low level frame buffer console driver for 4 interleaved - bitplanes (16 colors) on Atari. - -CONFIG_FBCON_IPLAN2P8 - This is the low level frame buffer console driver for 8 interleaved - bitplanes (256 colors) on Atari. - -CONFIG_FBCON_HGA - This is the low level frame buffer console driver for Hercules mono - graphics cards. - diff --git a/drivers/video/Config.in b/drivers/video/Config.in index 3fe4402c78fb..0e1c8808c985 100644 --- a/drivers/video/Config.in +++ b/drivers/video/Config.in @@ -3,12 +3,11 @@ # mainmenu_option next_comment -comment 'Frame-buffer support' +comment 'Graphics support' -bool 'Support for frame buffer devices (EXPERIMENTAL)' CONFIG_FB +bool 'Support for frame buffer devices ' CONFIG_FB if [ "$CONFIG_FB" = "y" ]; then - define_bool CONFIG_DUMMY_CONSOLE y if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then if [ "$CONFIG_AMIGA" = "y" -o "$CONFIG_PCI" = "y" ]; then tristate ' Cirrus Logic support (EXPERIMENTAL)' CONFIG_FB_CLGEN @@ -78,7 +77,7 @@ if [ "$CONFIG_FB" = "y" ]; then bool ' Chips 65550 display support' CONFIG_FB_CT65550 bool ' IMS Twin Turbo display support' CONFIG_FB_IMSTT bool ' S3 Trio display support' CONFIG_FB_S3TRIO - tristate ' VGA 16-color graphics console' CONFIG_FB_VGA16 + tristate ' VGA 16-color graphics support' CONFIG_FB_VGA16 fi if [ "$CONFIG_PARISC" = "y" ]; then bool ' Generic STI frame buffer device support' CONFIG_FB_STI @@ -95,9 +94,9 @@ if [ "$CONFIG_FB" = "y" ]; then tristate ' TGA framebuffer support' CONFIG_FB_TGA fi if [ "$CONFIG_X86" = "y" ]; then - bool ' VESA VGA graphics console' CONFIG_FB_VESA - tristate ' VGA 16-color graphics console' CONFIG_FB_VGA16 - tristate ' Hercules mono graphics console (EXPERIMENTAL)' CONFIG_FB_HGA + bool ' VESA VGA graphics support' CONFIG_FB_VESA + tristate ' VGA 16-color graphics support' CONFIG_FB_VGA16 + tristate ' Hercules mono graphics support ' CONFIG_FB_HGA define_bool CONFIG_VIDEO_SELECT y fi if [ "$CONFIG_VISWS" = "y" ]; then @@ -123,47 +122,45 @@ if [ "$CONFIG_FB" = "y" ]; then hex ' Framebuffer Base Address' CONFIG_E1355_FB_BASE a8200000 fi fi - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - if [ "$CONFIG_PCI" != "n" ]; then - tristate ' nVidia Riva support (EXPERIMENTAL)' CONFIG_FB_RIVA - tristate ' Matrox acceleration (EXPERIMENTAL)' CONFIG_FB_MATROX - if [ "$CONFIG_FB_MATROX" != "n" ]; then - bool ' Millennium I/II support' CONFIG_FB_MATROX_MILLENIUM - bool ' Mystique support' CONFIG_FB_MATROX_MYSTIQUE - bool ' G100/G200/G400/G450/G550 support' CONFIG_FB_MATROX_G450 - if [ "$CONFIG_FB_MATROX_G450" = "n" ]; then - bool ' G100/G200/G400 support' CONFIG_FB_MATROX_G100A - fi - if [ "$CONFIG_FB_MATROX_G450" = "y" -o "$CONFIG_FB_MATROX_G100A" = "y" ]; then - define_bool CONFIG_FB_MATROX_G100 y - fi - if [ "$CONFIG_I2C" != "n" ]; then - dep_tristate ' Matrox I2C support' CONFIG_FB_MATROX_I2C $CONFIG_FB_MATROX $CONFIG_I2C_ALGOBIT - if [ "$CONFIG_FB_MATROX_G100" = "y" ]; then - dep_tristate ' G400 second head support' CONFIG_FB_MATROX_MAVEN $CONFIG_FB_MATROX_I2C - fi - fi - bool ' Multihead support' CONFIG_FB_MATROX_MULTIHEAD + if [ "$CONFIG_PCI" != "n" ]; then + tristate ' nVidia Riva support ' CONFIG_FB_RIVA + tristate ' Matrox acceleration ' CONFIG_FB_MATROX + if [ "$CONFIG_FB_MATROX" != "n" ]; then + bool ' Millennium I/II support' CONFIG_FB_MATROX_MILLENIUM + bool ' Mystique support' CONFIG_FB_MATROX_MYSTIQUE + bool ' G100/G200/G400/G450/G550 support' CONFIG_FB_MATROX_G450 + if [ "$CONFIG_FB_MATROX_G450" = "n" ]; then + bool ' G100/G200/G400 support' CONFIG_FB_MATROX_G100A fi - tristate ' ATI Mach64 display support (EXPERIMENTAL)' CONFIG_FB_ATY - if [ "$CONFIG_FB_ATY" != "n" ]; then - bool ' Mach64 GX support (EXPERIMENTAL)' CONFIG_FB_ATY_GX - bool ' Mach64 CT/VT/GT/LT (incl. 3D RAGE) support' CONFIG_FB_ATY_CT + if [ "$CONFIG_FB_MATROX_G450" = "y" -o "$CONFIG_FB_MATROX_G100A" = "y" ]; then + define_bool CONFIG_FB_MATROX_G100 y fi - tristate ' ATI Radeon display support (EXPERIMENTAL)' CONFIG_FB_RADEON - tristate ' ATI Rage128 display support (EXPERIMENTAL)' CONFIG_FB_ATY128 - tristate ' SIS acceleration (EXPERIMENTAL)' CONFIG_FB_SIS - if [ "$CONFIG_FB_SIS" != "n" ]; then - bool ' SIS 630/540/730 support' CONFIG_FB_SIS_300 - bool ' SIS 315H/315 support' CONFIG_FB_SIS_315 + if [ "$CONFIG_I2C" != "n" ]; then + dep_tristate ' Matrox I2C support' CONFIG_FB_MATROX_I2C $CONFIG_FB_MATROX $CONFIG_I2C_ALGOBIT + if [ "$CONFIG_FB_MATROX_G100" = "y" ]; then + dep_tristate ' G400 second head support' CONFIG_FB_MATROX_MAVEN $CONFIG_FB_MATROX_I2C + fi fi - tristate ' NeoMagic display support (EXPERIMENTAL)' CONFIG_FB_NEOMAGIC - tristate ' 3Dfx Banshee/Voodoo3 display support (EXPERIMENTAL)' CONFIG_FB_3DFX - tristate ' 3Dfx Voodoo Graphics (sst1) support (EXPERIMENTAL)' CONFIG_FB_VOODOO1 - tristate ' Trident support (EXPERIMENTAL)' CONFIG_FB_TRIDENT - tristate ' Permedia3 support (EXPERIMENTAL)' CONFIG_FB_PM3 + bool ' Multihead support' CONFIG_FB_MATROX_MULTIHEAD fi - fi + tristate ' ATI Mach64 display support ' CONFIG_FB_ATY + if [ "$CONFIG_FB_ATY" != "n" ]; then + bool ' Mach64 GX support ' CONFIG_FB_ATY_GX + bool ' Mach64 CT/VT/GT/LT (incl. 3D RAGE) support' CONFIG_FB_ATY_CT + fi + tristate ' ATI Radeon display support ' CONFIG_FB_RADEON + tristate ' ATI Rage128 display support ' CONFIG_FB_ATY128 + tristate ' SIS acceleration ' CONFIG_FB_SIS + if [ "$CONFIG_FB_SIS" != "n" ]; then + bool ' SIS 630/540/730 support' CONFIG_FB_SIS_300 + bool ' SIS 315H/315 support' CONFIG_FB_SIS_315 + fi + tristate ' NeoMagic display support ' CONFIG_FB_NEOMAGIC + tristate ' 3Dfx Banshee/Voodoo3 display support ' CONFIG_FB_3DFX + tristate ' 3Dfx Voodoo Graphics (sst1) support ' CONFIG_FB_VOODOO1 + tristate ' Trident support ' CONFIG_FB_TRIDENT + tristate ' Permedia3 support ' CONFIG_FB_PM3 + fi if [ "$CONFIG_SPARC32" = "y" -o "$CONFIG_SPARC64" = "y" ]; then bool ' SBUS and UPA framebuffers' CONFIG_FB_SBUS if [ "$CONFIG_FB_SBUS" != "n" ]; then @@ -216,242 +213,8 @@ if [ "$CONFIG_FB" = "y" ]; then if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then tristate ' Virtual Frame Buffer support (ONLY FOR TESTING!) (EXPERIMENTAL)' CONFIG_FB_VIRTUAL fi - - bool ' Advanced low level driver options' CONFIG_FBCON_ADVANCED - if [ "$CONFIG_FBCON_ADVANCED" = "y" ]; then - tristate ' Monochrome support' CONFIG_FBCON_MFB - tristate ' 2 bpp packed pixels support' CONFIG_FBCON_CFB2 - tristate ' 4 bpp packed pixels support' CONFIG_FBCON_CFB4 - tristate ' 8 bpp packed pixels support' CONFIG_FBCON_CFB8 - tristate ' 16 bpp packed pixels support' CONFIG_FBCON_CFB16 - tristate ' 24 bpp packed pixels support' CONFIG_FBCON_CFB24 - tristate ' 32 bpp packed pixels support' CONFIG_FBCON_CFB32 - tristate ' Hardware acceleration support' CONFIG_FBCON_ACCEL - tristate ' Amiga bitplanes support' CONFIG_FBCON_AFB - tristate ' Amiga interleaved bitplanes support' CONFIG_FBCON_ILBM - tristate ' Atari interleaved bitplanes (2 planes) support' CONFIG_FBCON_IPLAN2P2 - tristate ' Atari interleaved bitplanes (4 planes) support' CONFIG_FBCON_IPLAN2P4 - tristate ' Atari interleaved bitplanes (8 planes) support' CONFIG_FBCON_IPLAN2P8 -# tristate ' Atari interleaved bitplanes (16 planes) support' CONFIG_FBCON_IPLAN2P16 - tristate ' VGA 16-color planar support' CONFIG_FBCON_VGA_PLANES - tristate ' HGA monochrome support (EXPERIMENTAL)' CONFIG_FBCON_HGA - else - # Guess what we need - if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_AMIGA" = "y" -o \ - "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_CYBER" = "y" -o \ - "$CONFIG_FB_BWTWO" = "y" -o "$CONFIG_FB_RETINAZ3" = "y" -o \ - "$CONFIG_FB_VIRGE" = "y" -o "$CONFIG_FB_CLGEN" = "y" ]; then - define_tristate CONFIG_FBCON_MFB y - else - if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_AMIGA" = "m" -o \ - "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_CYBER" = "m" -o \ - "$CONFIG_FB_BWTWO" = "m" -o "$CONFIG_FB_RETINAZ3" = "m" -o \ - "$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_CLGEN" = "m" ]; then - define_tristate CONFIG_FBCON_MFB m - fi - fi - if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_SA1100" = "y" ]; then - define_tristate CONFIG_FBCON_CFB2 y - define_tristate CONFIG_FBCON_CFB4 y - else - if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_SA1100" = "m" ]; then - define_tristate CONFIG_FBCON_CFB2 m - define_tristate CONFIG_FBCON_CFB4 m - fi - fi - if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_ATARI" = "y" -o \ - "$CONFIG_FB_P9100" = "y" -o "$CONFIG_FB_CYBER2000" = "y" -o \ - "$CONFIG_FB_RADEON" = "y" -o "$CONFIG_FB_TGA" = "y" -o \ - "$CONFIG_FB_SIS" = "y" -o "$CONFIG_FB_PM3" = "y" -o \ - "$CONFIG_FB_TCX" = "y" -o "$CONFIG_FB_CGTHREE" = "y" -o \ - "$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \ - "$CONFIG_FB_CGFOURTEEN" = "y" -o "$CONFIG_FB_TRIDENT" = "y" -o \ - "$CONFIG_FB_VIRGE" = "y" -o "$CONFIG_FB_CYBER" = "y" -o \ - "$CONFIG_FB_VALKYRIE" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \ - "$CONFIG_FB_IGA" = "y" -o "$CONFIG_FB_MATROX" = "y" -o \ - "$CONFIG_FB_CT65550" = "y" -o "$CONFIG_FB_PM2" = "y" -o \ - "$CONFIG_FB_SA1100" = "y" ]; then - define_tristate CONFIG_FBCON_CFB8 y - else - if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_ATARI" = "m" -o \ - "$CONFIG_FB_P9100" = "m" -o "$CONFIG_FB_CYBER2000" = "m" -o \ - "$CONFIG_FB_RADEON" = "m" -o "$CONFIG_FB_TGA" = "m" -o \ - "$CONFIG_FB_SIS" = "m" -o "$CONFIG_FB_PM3" = "m" -o \ - "$CONFIG_FB_TCX" = "m" -o "$CONFIG_FB_CGTHREE" = "m" -o \ - "$CONFIG_FB_CONTROL" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \ - "$CONFIG_FB_CGFOURTEEN" = "m" -o "$CONFIG_FB_TRIDENT" = "m" -o \ - "$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_CYBER" = "m" -o \ - "$CONFIG_FB_VALKYRIE" = "m" -o "$CONFIG_FB_PLATINUM" = "m" -o \ - "$CONFIG_FB_IGA" = "m" -o "$CONFIG_FB_MATROX" = "m" -o \ - "$CONFIG_FB_CT65550" = "m" -o "$CONFIG_FB_PM2" = "m" -o \ - "$CONFIG_FB_SA1100" = "m" ]; then - define_tristate CONFIG_FBCON_CFB8 m - fi - fi - if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_PM3" = "y" -o \ - "$CONFIG_FB_SIS" = "y" -o "$CONFIG_FB_PVR2" = "y" -o \ - "$CONFIG_FB_TRIDENT" = "y" -o "$CONFIG_FB_TBOX" = "y" -o \ - "$CONFIG_FB_VOODOO1" = "y" -o "$CONFIG_FB_RADEON" = "y" -o \ - "$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \ - "$CONFIG_FB_VIRGE" = "y" -o "$CONFIG_FB_CYBER" = "y" -o \ - "$CONFIG_FB_VALKYRIE" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \ - "$CONFIG_FB_CT65550" = "y" -o "$CONFIG_FB_MATROX" = "y" -o \ - "$CONFIG_FB_PM2" = "y" -o "$CONFIG_FB_CYBER2000" = "y" -o \ - "$CONFIG_FB_SA1100" = "y" ]; then - define_tristate CONFIG_FBCON_CFB16 y - else - if [ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_SIS" = "m" -o \ - "$CONFIG_FB_RADEON" = "m" -o "$CONFIG_FB_PVR2" = "m" -o \ - "$CONFIG_FB_TRIDENT" = "m" -o "$CONFIG_FB_TBOX" = "m" -o \ - "$CONFIG_FB_VOODOO1" = "m" -o "$CONFIG_FB_PM3" = "m" -o \ - "$CONFIG_FB_CONTROL" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \ - "$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_CYBER" = "m" -o \ - "$CONFIG_FB_VALKYRIE" = "m" -o "$CONFIG_FB_PLATINUM" = "m" -o \ - "$CONFIG_FB_CT65550" = "m" -o "$CONFIG_FB_MATROX" = "m" -o \ - "$CONFIG_FB_PM2" = "m" -o "$CONFIG_FB_CYBER2000" = "m" -o \ - "$CONFIG_FB_SA1100" = "y" ]; then - define_tristate CONFIG_FBCON_CFB16 m - fi - fi - if [ "$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \ - "$CONFIG_FB_CLGEN" = "y" -o "$CONFIG_FB_VESA" = "y" -o \ - "$CONFIG_FB_MATROX" = "y" -o "$CONFIG_FB_PM2" = "y" -o \ - "$CONFIG_FB_ATY128" = "y" -o "$CONFIG_FB_RADEON" = "y" -o \ - "$CONFIG_FB_CYBER2000" = "y" -o "$CONFIG_FB_PVR2" = "y" -o \ - "$CONFIG_FB_VOODOO1" = "y" -o "$CONFIG_FB_NEOMAGIC" = "y" ]; then - define_tristate CONFIG_FBCON_CFB24 y - else - if [ "$CONFIG_FB_ATY" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \ - "$CONFIG_FB_CLGEN" = "m" -o "$CONFIG_FB_VESA" = "m" -o \ - "$CONFIG_FB_MATROX" = "m" -o "$CONFIG_FB_PM2" = "m" -o \ - "$CONFIG_FB_ATY128" = "m" -o "$CONFIG_FB_RADEON" = "m" -o \ - "$CONFIG_FB_CYBER2000" = "m" -o "$CONFIG_FB_PVR2" = "m" -o \ - "$CONFIG_FB_VOODOO1" = "m" -o "$CONFIG_FB_NEOMAGIC" = "y" ]; then - define_tristate CONFIG_FBCON_CFB24 m - fi - fi - if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_RADEON" = "y" -o \ - "$CONFIG_FB_VOODOO1" = "y" -o "$CONFIG_FB_TRIDENT" = "y" -o \ - "$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \ - "$CONFIG_FB_TGA" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \ - "$CONFIG_FB_MATROX" = "y" -o "$CONFIG_FB_PM2" = "y" -o \ - "$CONFIG_FB_PVR2" = "y" -o "$CONFIG_FB_PM3" = "y" -o \ - "$CONFIG_FB_SIS" = "y" ]; then - define_tristate CONFIG_FBCON_CFB32 y - else - if [ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_RADEON" = "m" -o \ - "$CONFIG_FB_VOODOO1" = "m" -o "$CONFIG_FB_TRIDENT" = "m" -o \ - "$CONFIG_FB_CONTROL" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \ - "$CONFIG_FB_TGA" = "m" -o "$CONFIG_FB_PLATINUM" = "m" -o \ - "$CONFIG_FB_MATROX" = "m" -o "$CONFIG_FB_PM2" = "m" -o \ - "$CONFIG_FB_SIS" = "m" -o "$CONFIG_FB_PVR2" = "m" -o \ - "$CONFIG_FB_PM3" = "m" ]; then - define_tristate CONFIG_FBCON_CFB32 m - fi - fi - if [ "$CONFIG_FB_NEOMAGIC" = "y" -o "$CONFIG_FB_VESA" = "y" -o \ - "$CONFIG_FB_FM2" = "y" -o "$CONFIG_FB_HIT" = "y" -o \ - "$CONFIG_FB_HP300" = "y" -o "$CONFIG_FB_Q40" = "y" -o \ - "$CONFIG_FB_ANAKIN" = "y" -o "$CONFIG_FB_G364" = "y" -o \ - "$CONFIG_FB_VIRTUAL" = "y" -o "$CONFIG_FB_CLPS711X" = "y" -o \ - "$CONFIG_FB_PMAG_BA" = "y" -o "$CONFIG_FB_PMAGB_B" = "y" -o \ - "$CONFIG_FB_3DFX" = "y" -o "$CONFIG_FB_TX3912" = "y" -o \ - "$CONFIG_FB_MAXINE" = "y" -o "$CONFIG_FB_APOLLO" = "y" -o \ - "$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_MAC" = "y" -o \ - "$CONFIG_FB_RIVA" = "y" -o "$CONFIG_FB_OF" = "y" -o \ - "$CONFIG_FB_SGIVW" = "y" ]; then - define_tristate CONFIG_FBCON_ACCEL y - else - if [ "$CONFIG_FB_NEOMAGIC" = "m" -o "$CONFIG_FB_HIT" = "m" -o \ - "$CONFIG_FB_G364" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \ - "$CONFIG_FB_CLPS711X" = "m" -o "$CONFIG_FB_3DFX" = "m" -o \ - "$CONFIG_FB_RIVA" = "m" -o "$CONFIG_FB_SGIVW" = "m" ]; then - define_tristate CONFIG_FBCON_ACCEL m - fi - fi - if [ "$CONFIG_FB_AMIGA" = "y" ]; then - define_tristate CONFIG_FBCON_AFB y - define_tristate CONFIG_FBCON_ILBM y - else - if [ "$CONFIG_FB_AMIGA" = "m" ]; then - define_tristate CONFIG_FBCON_AFB m - define_tristate CONFIG_FBCON_ILBM m - fi - fi - if [ "$CONFIG_FB_ATARI" = "y" ]; then - define_tristate CONFIG_FBCON_IPLAN2P2 y - define_tristate CONFIG_FBCON_IPLAN2P4 y - define_tristate CONFIG_FBCON_IPLAN2P8 y - else - if [ "$CONFIG_FB_ATARI" = "m" ]; then - define_tristate CONFIG_FBCON_IPLAN2P2 m - define_tristate CONFIG_FBCON_IPLAN2P4 m - define_tristate CONFIG_FBCON_IPLAN2P8 m - fi - fi - if [ "$CONFIG_FB_VGA16" = "y" ]; then - define_tristate CONFIG_FBCON_VGA_PLANES y - else - if [ "$CONFIG_FB_VGA16" = "m" ]; then - define_tristate CONFIG_FBCON_VGA_PLANES m - fi - fi - if [ "$CONFIG_FB_HGA" = "y" ]; then - define_tristate CONFIG_FBCON_HGA y - else - if [ "$CONFIG_FB_HGA" = "m" ]; then - define_tristate CONFIG_FBCON_HGA m - fi - fi - if [ "$CONFIG_FB_STI" = "y" ]; then - define_tristate CONFIG_FBCON_STI y - fi - fi - bool ' Support only 8 pixels wide fonts' CONFIG_FBCON_FONTWIDTH8_ONLY - if [ "$CONFIG_SPARC32" = "y" -o "$CONFIG_SPARC64" = "y" ]; then - bool ' Sparc console 8x16 font' CONFIG_FONT_SUN8x16 - if [ "$CONFIG_FBCON_FONTWIDTH8_ONLY" = "n" ]; then - bool ' Sparc console 12x22 font (not supported by all drivers)' CONFIG_FONT_SUN12x22 - fi - bool ' Select other fonts' CONFIG_FBCON_FONTS - if [ "$CONFIG_FBCON_FONTS" = "y" ]; then - bool ' VGA 8x8 font' CONFIG_FONT_8x8 - bool ' VGA 8x16 font' CONFIG_FONT_8x16 - if [ "$CONFIG_FBCON_FONTWIDTH8_ONLY" = "n" ]; then - bool ' Mac console 6x11 font (not supported by all drivers)' CONFIG_FONT_6x11 - fi - bool ' Pearl (old m68k) console 8x8 font' CONFIG_FONT_PEARL_8x8 - bool ' Acorn console 8x8 font' CONFIG_FONT_ACORN_8x8 - fi - else - bool ' Select compiled-in fonts' CONFIG_FBCON_FONTS - if [ "$CONFIG_FBCON_FONTS" = "y" ]; then - bool ' VGA 8x8 font' CONFIG_FONT_8x8 - bool ' VGA 8x16 font' CONFIG_FONT_8x16 - bool ' Sparc console 8x16 font' CONFIG_FONT_SUN8x16 - if [ "$CONFIG_FBCON_FONTWIDTH8_ONLY" = "n" ]; then - bool ' Sparc console 12x22 font (not supported by all drivers)' CONFIG_FONT_SUN12x22 - bool ' Mac console 6x11 font (not supported by all drivers)' CONFIG_FONT_6x11 - fi - bool ' Pearl (old m68k) console 8x8 font' CONFIG_FONT_PEARL_8x8 - bool ' Acorn console 8x8 font' CONFIG_FONT_ACORN_8x8 - bool ' Mini 4x6 font' CONFIG_FONT_MINI_4x6 - else - define_bool CONFIG_FONT_8x8 y - define_bool CONFIG_FONT_8x16 y - if [ "$CONFIG_MAC" = "y" ]; then - if [ "$CONFIG_FBCON_FONTWIDTH8_ONLY" = "n" ]; then - define_bool CONFIG_FONT_6x11 y - fi - fi - if [ "$CONFIG_AMIGA" = "y" ]; then - define_bool CONFIG_FONT_PEARL_8x8 y - fi - if [ "$CONFIG_ARM" = "y" -a "$CONFIG_ARCH_ACORN" = "y" ]; then - define_bool CONFIG_FONT_ACORN_8x8 y - fi - fi - fi fi +source drivers/video/console/Config.in + endmenu diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 53d5a335d832..0f8739db41f4 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -5,33 +5,12 @@ # All of the (potential) objects that export symbols. # This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'. -export-objs := fbmem.o fbcmap.o fbcon.o fbmon.o modedb.o \ - fbcon-afb.o fbcon-ilbm.o fbcon-accel.o cyber2000fb.o \ - fbcon-iplan2p2.o fbcon-iplan2p4.o fbgen.o \ - fbcon-iplan2p8.o fbcon-vga-planes.o fbcon-cfb16.o \ - fbcon-cfb2.o fbcon-cfb24.o fbcon-cfb32.o fbcon-cfb4.o \ - fbcon-cfb8.o fbcon-mfb.o fbcon-hga.o +export-objs := fbmem.o fbcmap.o fbmon.o modedb.o fbgen.o cyber2000fb.o # Each configuration option enables a list of files. -obj-$(CONFIG_DUMMY_CONSOLE) += dummycon.o -obj-$(CONFIG_SGI_NEWPORT_CONSOLE) += newport_con.o -obj-$(CONFIG_PROM_CONSOLE) += promcon.o promcon_tbl.o -obj-$(CONFIG_STI_CONSOLE) += sticon.o sticon-bmode.o sticore.o -obj-$(CONFIG_VGA_CONSOLE) += vgacon.o -obj-$(CONFIG_MDA_CONSOLE) += mdacon.o - -obj-$(CONFIG_FONT_SUN8x16) += font_sun8x16.o -obj-$(CONFIG_FONT_SUN12x22) += font_sun12x22.o -obj-$(CONFIG_FONT_8x8) += font_8x8.o -obj-$(CONFIG_FONT_8x16) += font_8x16.o -obj-$(CONFIG_FONT_6x11) += font_6x11.o -obj-$(CONFIG_FONT_PEARL_8x8) += font_pearl_8x8.o -obj-$(CONFIG_FONT_ACORN_8x8) += font_acorn_8x8.o -obj-$(CONFIG_FONT_MINI_4x6) += font_mini_4x6.o - # Add fbmon.o back into obj-$(CONFIG_FB) in 2.5.x -obj-$(CONFIG_FB) += fbmem.o fbcmap.o modedb.o fbcon.o fonts.o fbgen.o +obj-$(CONFIG_FB) += fbmem.o fbcmap.o modedb.o fbgen.o # Only include macmodes.o if we have FB support and are PPC ifeq ($(CONFIG_FB),y) obj-$(CONFIG_PPC) += macmodes.o @@ -60,7 +39,7 @@ obj-$(CONFIG_FB_SGIVW) += sgivwfb.o cfbfillrect.o cfbcopyarea.o cfbim obj-$(CONFIG_FB_3DFX) += tdfxfb.o obj-$(CONFIG_FB_MAC) += macfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_HP300) += hpfb.o cfbfillrect.o cfbimgblt.o -obj-$(CONFIG_FB_OF) += offb.o cfbfillrect.o cfbimgblit.o cfbcopyarea.o +obj-$(CONFIG_FB_OF) += offb.o cfbfillrect.o cfbimgblt.o cfbcopyarea.o obj-$(CONFIG_FB_IMSTT) += imsttfb.o obj-$(CONFIG_FB_RETINAZ3) += retz3fb.o obj-$(CONFIG_FB_CLGEN) += clgenfb.o @@ -68,7 +47,7 @@ obj-$(CONFIG_FB_TRIDENT) += tridentfb.o obj-$(CONFIG_FB_S3TRIO) += S3triofb.o obj-$(CONFIG_FB_TGA) += tgafb.o obj-$(CONFIG_FB_VESA) += vesafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_VGA16) += vga16fb.o fbcon-vga-planes.o +obj-$(CONFIG_FB_VGA16) += vga16fb.o fbcon-vga-planes.o fbcon-vga8-planes.o obj-$(CONFIG_FB_VIRGE) += virgefb.o obj-$(CONFIG_FB_G364) += g364fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_FM2) += fm2fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o @@ -88,7 +67,7 @@ obj-$(CONFIG_FB_TX3912) += tx3912fb.o cfbfillrect.o cfbcopyarea.o cfbi obj-$(CONFIG_FB_MATROX) += matrox/ obj-$(CONFIG_FB_RIVA) += riva/ -obj-$(CONFIG_FB_SIS) += sis/ +obj-$(CONFIG_FB_SIS) += sis/ cfbimgblt.o obj-$(CONFIG_FB_ATY) += aty/ cfbimgblt.o obj-$(CONFIG_FB_SUN3) += sun3fb.o @@ -101,28 +80,7 @@ obj-$(CONFIG_FB_E1355) += epson1355fb.o obj-$(CONFIG_FB_PVR2) += pvr2fb.o obj-$(CONFIG_FB_VOODOO1) += sstfb.o -# Generic Low Level Drivers - -obj-$(CONFIG_FBCON_AFB) += fbcon-afb.o -obj-$(CONFIG_FBCON_CFB2) += fbcon-cfb2.o -obj-$(CONFIG_FBCON_CFB4) += fbcon-cfb4.o -obj-$(CONFIG_FBCON_CFB8) += fbcon-cfb8.o -obj-$(CONFIG_FBCON_CFB16) += fbcon-cfb16.o -obj-$(CONFIG_FBCON_CFB24) += fbcon-cfb24.o -obj-$(CONFIG_FBCON_CFB32) += fbcon-cfb32.o -obj-$(CONFIG_FBCON_ILBM) += fbcon-ilbm.o -obj-$(CONFIG_FBCON_IPLAN2P2) += fbcon-iplan2p2.o -obj-$(CONFIG_FBCON_IPLAN2P4) += fbcon-iplan2p4.o -obj-$(CONFIG_FBCON_IPLAN2P8) += fbcon-iplan2p8.o -obj-$(CONFIG_FBCON_MFB) += fbcon-mfb.o -obj-$(CONFIG_FBCON_HGA) += fbcon-hga.o -obj-$(CONFIG_FBCON_STI) += fbcon-sti.o -obj-$(CONFIG_FBCON_ACCEL) += fbcon-accel.o +obj-$(CONFIG_VT) += console/ include $(TOPDIR)/Rules.make -$(obj)/promcon_tbl.c: $(src)/prom.uni - $(objtree)/scripts/conmakehash $< | \ - sed -e '/#include <[^>]*>/p' -e 's/types/init/' \ - -e 's/dfont\(_uni.*\]\)/promfont\1 __initdata/' > $@ - diff --git a/drivers/video/anakinfb.c b/drivers/video/anakinfb.c index 340a90c23efe..2d26e5fa435a 100644 --- a/drivers/video/anakinfb.c +++ b/drivers/video/anakinfb.c @@ -20,11 +20,8 @@ #include <asm/io.h> -#include <video/fbcon.h> - static u32 colreg[16]; static struct fb_info fb_info; -static struct display display; static struct fb_var_screeninfo anakinfb_var = { .xres = 400, @@ -65,9 +62,6 @@ anakinfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, static struct fb_ops anakinfb_ops = { .owner = THIS_MODULE, - .fb_set_var = gen_set_var, - .fb_get_cmap = gen_get_cmap, - .fb_set_cmap = gen_set_cmap, .fb_setcolreg = anakinfb_setcolreg, .fb_fillrect = cfb_fillrect, .fb_copyarea = cfb_copyarea, @@ -78,20 +72,13 @@ int __init anakinfb_init(void) { memset(&fb_info, 0, sizeof(struct fb_info)); - memset(&display, 0, sizeof(struct display)); - strcpy(fb_info.modename, anakinfb_fix.id); fb_info.node = NODEV; - fb_info.currcon = -1; fb_info.flags = FBINFO_FLAG_DEFAULT; fb_info.fbops = &anakinfb_ops; fb_info.var = anakinfb_var; fb_info.fix = anakinfb_fix; - fb_info.disp = &display; strcpy(fb_info.fontname, "VGA8x16"); - fb_info.changevar = NULL; - fb_info.switch_con = gen_switch_con; - fb_info.updatevar = gen_update_var; if (!(request_mem_region(VGA_START, VGA_SIZE, "vga"))) return -ENOMEM; if (fb_info.screen_base = ioremap(VGA_START, VGA_SIZE)) { @@ -100,10 +87,9 @@ anakinfb_init(void) } fb_alloc_cmap(&fb_info.cmap, 16, 0); - gen_set_disp(-1, &fb_info); if (register_framebuffer(&fb_info) < 0) { - iounmap(display.screen_base); + iounmap(fb_info.screen_base); release_mem_region(VGA_START, VGA_SIZE); return -EINVAL; } diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index d7e50db324ec..0da73eb9aef7 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c @@ -65,9 +65,6 @@ #include <asm/io.h> #include <asm/uaccess.h> -#include <video/fbcon.h> -#include "../fbcon-accel.h" - #include <video/mach64.h> #include "atyfb.h" @@ -149,11 +146,11 @@ static int atyfb_check_var(struct fb_var_screeninfo *var, static int atyfb_set_par(struct fb_info *info); static int atyfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info); -static int atyfb_pan_display(struct fb_var_screeninfo *var, int con, +static int atyfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); static int atyfb_blank(int blank, struct fb_info *info); static int atyfb_ioctl(struct inode *inode, struct file *file, u_int cmd, - u_long arg, int con, struct fb_info *info); + u_long arg, struct fb_info *info); extern void atyfb_fillrect(struct fb_info *info, struct fb_fillrect *rect); extern void atyfb_copyarea(struct fb_info *info, struct fb_copyarea *area); extern void atyfb_imageblit(struct fb_info *info, struct fb_image *image); @@ -198,21 +195,12 @@ int atyfb_init(void); int atyfb_setup(char *); #endif -int gen_get_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) -{ - *var = info->var; - return 0; -} - static struct fb_ops atyfb_ops = { .owner = THIS_MODULE, .fb_open = atyfb_open, .fb_release = atyfb_release, - .fb_set_var = gen_set_var, .fb_check_var = atyfb_check_var, .fb_set_par = atyfb_set_par, - .fb_get_cmap = gen_get_cmap, - .fb_set_cmap = gen_set_cmap, .fb_setcolreg = atyfb_setcolreg, .fb_pan_display = atyfb_pan_display, .fb_blank = atyfb_blank, @@ -694,6 +682,13 @@ static int aty_crtc_to_var(const struct crtc *crtc, (v_sync_pol ? 0 : FB_SYNC_VERT_HIGH_ACT) | (c_sync ? FB_SYNC_COMP_HIGH_ACT : 0); + var->red.msb_right = 0; + var->green.msb_right = 0; + var->blue.offset = 0; + var->blue.msb_right = 0; + var->transp.offset = 0; + var->transp.length = 0; + var->transp.msb_right = 0; switch (pix_width) { #if 0 case CRTC_PIX_WIDTH_4BPP: @@ -702,10 +697,7 @@ static int aty_crtc_to_var(const struct crtc *crtc, var->red.length = 8; var->green.offset = 0; var->green.length = 8; - var->blue.offset = 0; var->blue.length = 8; - var->transp.offset = 0; - var->transp.length = 0; break; #endif case CRTC_PIX_WIDTH_8BPP: @@ -714,10 +706,7 @@ static int aty_crtc_to_var(const struct crtc *crtc, var->red.length = 8; var->green.offset = 0; var->green.length = 8; - var->blue.offset = 0; var->blue.length = 8; - var->transp.offset = 0; - var->transp.length = 0; break; case CRTC_PIX_WIDTH_15BPP: /* RGB 555 */ bpp = 16; @@ -725,10 +714,7 @@ static int aty_crtc_to_var(const struct crtc *crtc, var->red.length = 5; var->green.offset = 5; var->green.length = 5; - var->blue.offset = 0; var->blue.length = 5; - var->transp.offset = 0; - var->transp.length = 0; break; #if 0 case CRTC_PIX_WIDTH_16BPP: /* RGB 565 */ @@ -737,10 +723,7 @@ static int aty_crtc_to_var(const struct crtc *crtc, var->red.length = 5; var->green.offset = 5; var->green.length = 6; - var->blue.offset = 0; var->blue.length = 5; - var->transp.offset = 0; - var->transp.length = 0; break; #endif case CRTC_PIX_WIDTH_24BPP: /* RGB 888 */ @@ -749,10 +732,7 @@ static int aty_crtc_to_var(const struct crtc *crtc, var->red.length = 8; var->green.offset = 8; var->green.length = 8; - var->blue.offset = 0; var->blue.length = 8; - var->transp.offset = 0; - var->transp.length = 0; break; case CRTC_PIX_WIDTH_32BPP: /* ARGB 8888 */ bpp = 32; @@ -760,7 +740,6 @@ static int aty_crtc_to_var(const struct crtc *crtc, var->red.length = 8; var->green.offset = 8; var->green.length = 8; - var->blue.offset = 0; var->blue.length = 8; var->transp.offset = 24; var->transp.length = 8; @@ -870,8 +849,7 @@ static int atyfb_set_par(struct fb_info *info) #ifdef CONFIG_BOOTX_TEXT btext_update_display(info->fix.smem_start, - (((par->crtc.h_tot_disp >> 16) & 0xff) + - 1) * 8, + (((par->crtc.h_tot_disp >> 16) & 0xff) + 1) * 8, ((par->crtc.v_tot_disp >> 16) & 0x7ff) + 1, info->var.bits_per_pixel, par->crtc.vxres * info->var.bits_per_pixel / 8); @@ -905,14 +883,13 @@ static int atyfb_encode_var(struct fb_var_screeninfo *var, { int err; - memset(var, 0, sizeof(struct fb_var_screeninfo)); - if ((err = aty_crtc_to_var(&par->crtc, var))) return err; var->pixclock = par->pll_ops->pll_to_var(info, &par->pll); var->height = -1; var->width = -1; + var->nonstd = 0; return 0; } @@ -1018,7 +995,7 @@ static int atyfb_release(struct fb_info *info, int user) * This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag */ -static int atyfb_pan_display(struct fb_var_screeninfo *var, int con, +static int atyfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) { struct atyfb_par *par = (struct atyfb_par *) info->par; @@ -1060,7 +1037,7 @@ struct atyclk { #endif static int atyfb_ioctl(struct inode *inode, struct file *file, u_int cmd, - u_long arg, int con, struct fb_info *info) + u_long arg, struct fb_info *info) { #if defined(__sparc__) || (defined(DEBUG) && defined(CONFIG_FB_ATY_CT)) struct atyfb_par *par = (struct atyfb_par *) info->par; @@ -1442,15 +1419,15 @@ static int aty_power_mgmt(int sleep, struct atyfb_par *par) static int aty_sleep_notify(struct pmu_sleep_notifier *self, int when) { struct fb_info *info; - struct atyfb_par *par = (struct atyfb_par *) info->fb.par; + struct atyfb_par *par; int result; result = PBOOK_SLEEP_OK; for (info = first_display; info != NULL; info = par->next) { - struct fb_fix_screeninfo fix; int nb; + par = (struct atyfb_par *) info->par; nb = fb_display[fg_console].var.yres * info->fix.line_length; switch (when) { @@ -1469,7 +1446,7 @@ static int aty_sleep_notify(struct pmu_sleep_notifier *self, int when) if (par->blitter_may_be_busy) wait_for_idle(par); /* Stop accel engine (stop bus mastering) */ - if (par->accel_flags & FB_ACCELF_TEXT) + if (info->var.accel_flags & FB_ACCELF_TEXT) aty_reset_engine(par); /* Backup fb content */ @@ -1562,7 +1539,6 @@ static int __init aty_init(struct fb_info *info, const char *name) const char *chipname = NULL, *ramname = NULL, *xtal; int j, pll, mclk, gtb_memsize; struct fb_var_screeninfo var; - struct display *disp; u32 chip_id, i; u16 type; u8 rev; @@ -1843,18 +1819,10 @@ static int __init aty_init(struct fb_info *info, const char *name) fb_memset((void *) info->screen_base, 0, info->fix.smem_len); - disp = info->disp; - - strcpy(info->modename, info->fix.id); info->node = NODEV; info->fbops = &atyfb_ops; - info->disp = disp; info->pseudo_palette = pseudo_palette; - info->currcon = -1; strcpy(info->fontname, fontname); - info->changevar = NULL; - info->switch_con = gen_switch; - info->updatevar = gen_update_var; info->flags = FBINFO_FLAG_DEFAULT; #ifdef CONFIG_PMAC_BACKLIGHT @@ -1979,8 +1947,6 @@ static int __init aty_init(struct fb_info *info, const char *name) fb_alloc_cmap(&info->cmap, 256, 0); - gen_set_var(&var, -1, info); - if (register_framebuffer(info) < 0) return 0; @@ -2029,27 +1995,17 @@ int __init atyfb_init(void) info = kmalloc(sizeof(struct fb_info) + - sizeof(struct display), GFP_ATOMIC); + sizeof(struct atyfb_par), GFP_ATOMIC); if (!info) { printk ("atyfb_init: can't alloc fb_info\n"); return -ENXIO; } - memset(info, 0, - sizeof(struct fb_info) + - sizeof(struct display)); + memset(info, 0, sizeof(struct fb_info) + + sizeof(struct atyfb_par)); - default_par = - kmalloc(sizeof(struct atyfb_par), GFP_ATOMIC); - if (!default_par) { - printk - ("atyfb_init: can't alloc atyfb_par\n"); - kfree(info); - return -ENXIO; - } - memset(default_par, 0, sizeof(struct atyfb_par)); + default_par = (struct atyfb_par *) (info + 1); - info->disp = (struct display *) (info + 1); info->fix = atyfb_fix; info->par = default_par; @@ -2383,7 +2339,6 @@ int __init atyfb_init(void) if (first_display == NULL) pmu_register_sleep_notifier (&aty_sleep_notifier); - /* FIXME info->next = first_display; */ default_par->next = first_display; #endif } @@ -2410,7 +2365,7 @@ int __init atyfb_init(void) return -ENOMEM; } memset(info, 0, sizeof(struct fb_info)); - info->fix = atyfb_fix; + info->fix = atyfb_fix; /* * Map the video memory (physical address given) to somewhere in the @@ -2421,7 +2376,7 @@ int __init atyfb_init(void) info->fix.smem_start = info->screen_base; /* Fake! */ default_par->ati_regbase = (unsigned long)ioremap(phys_guiregbase[m64_num], 0x10000) + 0xFC00ul; - info->fix.mmio_start = par->ati_regbase; /* Fake! */ + info->fix.mmio_start = default_par->ati_regbase; /* Fake! */ aty_st_le32(CLOCK_CNTL, 0x12345678, default_par); clock_r = aty_ld_le32(CLOCK_CNTL, default_par); diff --git a/drivers/video/aty/mach64_ct.c b/drivers/video/aty/mach64_ct.c index 3d83d8e175d7..921b7dc0200b 100644 --- a/drivers/video/aty/mach64_ct.c +++ b/drivers/video/aty/mach64_ct.c @@ -7,8 +7,6 @@ #include <asm/io.h> -#include <video/fbcon.h> - #include <video/mach64.h> #include "atyfb.h" diff --git a/drivers/video/aty/mach64_cursor.c b/drivers/video/aty/mach64_cursor.c index b67e6f90967b..aaad2acbefc6 100644 --- a/drivers/video/aty/mach64_cursor.c +++ b/drivers/video/aty/mach64_cursor.c @@ -11,8 +11,6 @@ #include <asm/io.h> #include <asm/uaccess.h> -#include <video/fbcon.h> - #ifdef __sparc__ #include <asm/pbm.h> #include <asm/fbio.h> diff --git a/drivers/video/aty/mach64_gx.c b/drivers/video/aty/mach64_gx.c index d11e58454b29..f85f0a052784 100644 --- a/drivers/video/aty/mach64_gx.c +++ b/drivers/video/aty/mach64_gx.c @@ -9,8 +9,6 @@ #include <asm/io.h> -#include <video/fbcon.h> - #include <video/mach64.h> #include "atyfb.h" diff --git a/drivers/video/aty128fb.c b/drivers/video/aty128fb.c index ae43cc8ea62e..921adccb4c6f 100644 --- a/drivers/video/aty128fb.c +++ b/drivers/video/aty128fb.c @@ -7,13 +7,23 @@ * Ani Joshi / Jeff Garzik * - Code cleanup * + * Michel Dänzer <michdaen@iiic.ethz.ch> + * - 15/16 bit cleanup + * - fix panning + * + * Benjamin Herrenschmidt + * - pmac-specific PM stuff + * * Andreas Hundt <andi@convergence.de> * - FB_ACTIVATE fixes * + * Paul Mackerras <paulus@samba.org> + * - Convert to new framebuffer API, + * fix colormap setting at 16 bits/pixel (565) + * * Based off of Geert's atyfb.c and vfb.c. * * TODO: - * - panning * - monitor sensing (DDC) * - virtual display * - other platform support (only ppc/x86 supported) @@ -49,7 +59,7 @@ #include <linux/ioport.h> #include <asm/io.h> -#ifdef CONFIG_PPC +#ifdef CONFIG_ALL_PPC #include <asm/prom.h> #include <asm/pci-bridge.h> #include <video/macmodes.h> @@ -92,27 +102,27 @@ #define DBG(fmt, args...) #endif -#ifndef CONFIG_PPC +#ifndef CONFIG_ALL_PPC /* default mode */ static struct fb_var_screeninfo default_var __initdata = { - /* 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) */ - 640, 480, 640, 480, 0, 0, 8, 0, - {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0}, - 0, 0, -1, -1, 0, 39722, 48, 16, 33, 10, 96, 2, - 0, FB_VMODE_NONINTERLACED + /* 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) */ + 640, 480, 640, 480, 0, 0, 8, 0, + {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0}, + 0, 0, -1, -1, 0, 39722, 48, 16, 33, 10, 96, 2, + 0, FB_VMODE_NONINTERLACED }; -#else /* CONFIG_PPC */ +#else /* CONFIG_ALL_PPC */ /* default to 1024x768 at 75Hz on PPC - this will work * on the iMac, the usual 640x480 @ 60Hz doesn't. */ static struct fb_var_screeninfo default_var = { - /* 1024x768, 75 Hz, Non-Interlaced (78.75 MHz dotclock) */ - 1024, 768, 1024, 768, 0, 0, 8, 0, - {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0}, - 0, 0, -1, -1, 0, 12699, 160, 32, 28, 1, 96, 3, - FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED + /* 1024x768, 75 Hz, Non-Interlaced (78.75 MHz dotclock) */ + 1024, 768, 1024, 768, 0, 0, 8, 0, + {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0}, + 0, 0, -1, -1, 0, 12699, 160, 32, 28, 1, 96, 3, + FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }; -#endif /* CONFIG_PPC */ +#endif /* CONFIG_ALL_PPC */ /* default modedb mode */ /* 640x480, 60 Hz, Non-Interlaced (25.172 MHz dotclock) */ @@ -133,9 +143,9 @@ static struct fb_videomode defaultmode __initdata = { /* struct to hold chip description information */ struct aty128_chip_info { - const char *name; - unsigned short device; - int chip_gen; + const char *name; + unsigned short device; + int chip_gen; }; /* Chip generations */ @@ -148,16 +158,17 @@ enum { /* supported Rage128 chipsets */ static struct aty128_chip_info aty128_pci_probe_list[] __initdata = { - {"Rage128 RE (PCI)", PCI_DEVICE_ID_ATI_RAGE128_RE, rage_128}, - {"Rage128 RF (AGP)", PCI_DEVICE_ID_ATI_RAGE128_RF, rage_128}, - {"Rage128 RK (PCI)", PCI_DEVICE_ID_ATI_RAGE128_RK, rage_128}, - {"Rage128 RL (AGP)", PCI_DEVICE_ID_ATI_RAGE128_RL, rage_128}, - {"Rage128 Pro PF (AGP)", PCI_DEVICE_ID_ATI_RAGE128_PF, rage_128_pro}, - {"Rage128 Pro PR (PCI)", PCI_DEVICE_ID_ATI_RAGE128_PR, rage_128_pro}, - {"Rage128 Pro TR (AGP)", PCI_DEVICE_ID_ATI_RAGE128_U3, rage_128_pro}, - {"Rage Mobility M3 (PCI)", PCI_DEVICE_ID_ATI_RAGE128_LE, rage_M3}, - {"Rage Mobility M3 (AGP)", PCI_DEVICE_ID_ATI_RAGE128_LF, rage_M3}, - {NULL, 0, rage_128} + {"Rage128 RE (PCI)", PCI_DEVICE_ID_ATI_RAGE128_RE, rage_128}, + {"Rage128 RF (AGP)", PCI_DEVICE_ID_ATI_RAGE128_RF, rage_128}, + {"Rage128 RK (PCI)", PCI_DEVICE_ID_ATI_RAGE128_RK, rage_128}, + {"Rage128 RL (AGP)", PCI_DEVICE_ID_ATI_RAGE128_RL, rage_128}, + {"Rage128 Pro PF (AGP)", PCI_DEVICE_ID_ATI_RAGE128_PF, rage_128_pro}, + {"Rage128 Pro PR (PCI)", PCI_DEVICE_ID_ATI_RAGE128_PR, rage_128_pro}, + {"Rage128 Pro TR (AGP)", PCI_DEVICE_ID_ATI_RAGE128_U3, rage_128_pro}, + {"Rage128 Pro TF (AGP)", PCI_DEVICE_ID_ATI_RAGE128_U1, rage_128_pro}, + {"Rage Mobility M3 (PCI)", PCI_DEVICE_ID_ATI_RAGE128_LE, rage_M3}, + {"Rage Mobility M3 (AGP)", PCI_DEVICE_ID_ATI_RAGE128_LF, rage_M3}, + {NULL, 0, rage_128} }; /* packed BIOS settings */ @@ -190,28 +201,38 @@ typedef struct { /* onboard memory information */ struct aty128_meminfo { - u8 ML; - u8 MB; - u8 Trcd; - u8 Trp; - u8 Twr; - u8 CL; - u8 Tr2w; - u8 LoopLatency; - u8 DspOn; - u8 Rloop; - const char *name; + u8 ML; + u8 MB; + u8 Trcd; + u8 Trp; + u8 Twr; + u8 CL; + u8 Tr2w; + u8 LoopLatency; + u8 DspOn; + u8 Rloop; + const char *name; }; /* various memory configurations */ static const struct aty128_meminfo sdr_128 = - { 4, 4, 3, 3, 1, 3, 1, 16, 30, 16, "128-bit SDR SGRAM (1:1)" }; + { 4, 4, 3, 3, 1, 3, 1, 16, 30, 16, "128-bit SDR SGRAM (1:1)" }; static const struct aty128_meminfo sdr_64 = - { 4, 8, 3, 3, 1, 3, 1, 17, 46, 17, "64-bit SDR SGRAM (1:1)" }; + { 4, 8, 3, 3, 1, 3, 1, 17, 46, 17, "64-bit SDR SGRAM (1:1)" }; static const struct aty128_meminfo sdr_sgram = - { 4, 4, 1, 2, 1, 2, 1, 16, 24, 16, "64-bit SDR SGRAM (2:1)" }; + { 4, 4, 1, 2, 1, 2, 1, 16, 24, 16, "64-bit SDR SGRAM (2:1)" }; static const struct aty128_meminfo ddr_sgram = - { 4, 4, 3, 3, 2, 3, 1, 16, 31, 16, "64-bit DDR SGRAM" }; + { 4, 4, 3, 3, 2, 3, 1, 16, 31, 16, "64-bit DDR SGRAM" }; + +static struct fb_fix_screeninfo aty128fb_fix __initdata = { + .id = "ATY Rage128", + .type = FB_TYPE_PACKED_PIXELS, + .visual = FB_VISUAL_PSEUDOCOLOR, + .xpanstep = 8, + .ypanstep = 1, + .mmio_len = 0x2000, + .accel = FB_ACCEL_ATI_RAGE128, +}; static const char *aty128fb_name = "ATY Rage128"; static char fontname[40] __initdata = { 0 }; @@ -222,99 +243,105 @@ static char *font __initdata = NULL; static char *mode __initdata = NULL; #ifdef CONFIG_MTRR static int nomtrr __initdata = 0; -#endif +#endif /* CONFIG_MTRR */ #endif /* MODULE */ static char *mode_option __initdata = NULL; -#ifdef CONFIG_PPC +#ifdef CONFIG_ALL_PPC static int default_vmode __initdata = VMODE_1024_768_60; static int default_cmode __initdata = CMODE_8; #endif +#ifdef CONFIG_PMAC_PBOOK +static int default_crt_on __initdata = 0; +static int default_lcd_on __initdata = 1; +#endif + #ifdef CONFIG_MTRR static int mtrr = 1; #endif /* PLL constants */ struct aty128_constants { - u32 dotclock; - u32 ppll_min; - u32 ppll_max; - u32 ref_divider; - u32 xclk; - u32 fifo_width; - u32 fifo_depth; + u32 dotclock; + u32 ppll_min; + u32 ppll_max; + u32 ref_divider; + u32 xclk; + u32 fifo_width; + u32 fifo_depth; }; struct aty128_crtc { - u32 gen_cntl; - u32 ext_cntl; - u32 h_total, h_sync_strt_wid; - u32 v_total, v_sync_strt_wid; - u32 pitch; - u32 offset, offset_cntl; - u32 xoffset, yoffset; - u32 vxres, vyres; - u32 bpp; + u32 gen_cntl; + u32 ext_cntl; + u32 h_total, h_sync_strt_wid; + u32 v_total, v_sync_strt_wid; + u32 pitch; + u32 offset, offset_cntl; + u32 xoffset, yoffset; + u32 vxres, vyres; + u32 depth, bpp; }; struct aty128_pll { - u32 post_divider; - u32 feedback_divider; - u32 vclk; + u32 post_divider; + u32 feedback_divider; + u32 vclk; }; struct aty128_ddafifo { - u32 dda_config; - u32 dda_on_off; + u32 dda_config; + u32 dda_on_off; }; /* register values for a specific mode */ struct aty128fb_par { - struct aty128_crtc crtc; - struct aty128_pll pll; - struct aty128_ddafifo fifo_reg; - u32 accel_flags; -}; - -struct fb_info_aty128 { - struct fb_info fb_info; - struct fb_info_aty128 *next; - struct aty128_constants constants; /* PLL and others */ - unsigned long regbase_phys; /* physical mmio */ - void *regbase; /* remapped mmio */ - unsigned long frame_buffer_phys; /* physical fb memory */ - void *frame_buffer; /* remaped framebuffer */ - u32 vram_size; /* onboard video ram */ - int chip_gen; - const struct aty128_meminfo *mem; /* onboard mem info */ - struct aty128fb_par default_par, current_par; - struct display disp; - struct { u8 red, green, blue, pad; } palette[256]; - union { -#ifdef FBCON_HAS_CFB16 - u16 cfb16[16]; -#endif -#ifdef FBCON_HAS_CFB24 - u32 cfb24[16]; -#endif -#ifdef FBCON_HAS_CFB32 - u32 cfb32[16]; -#endif - } fbcon_cmap; + struct aty128_crtc crtc; + struct aty128_pll pll; + struct aty128_ddafifo fifo_reg; + u32 accel_flags; + struct aty128_constants constants; /* PLL and others */ + void *regbase; /* remapped mmio */ + u32 vram_size; /* onboard video ram */ + int chip_gen; + const struct aty128_meminfo *mem; /* onboard mem info */ #ifdef CONFIG_PCI - struct pci_dev *pdev; + struct pci_dev *pdev; #endif #ifdef CONFIG_MTRR - struct { int vram; int vram_valid; } mtrr; + struct { int vram; int vram_valid; } mtrr; #endif - int blitter_may_be_busy; - int fifo_slots; /* free slots in FIFO (64 max) */ + int blitter_may_be_busy; + int fifo_slots; /* free slots in FIFO (64 max) */ +#ifdef CONFIG_PMAC_PBOOK + unsigned char *save_framebuffer; + int pm_reg; + int crt_on, lcd_on; +#endif + unsigned char red[64]; /* see comments in aty128fb_setcolreg */ + unsigned char green[64]; + unsigned char blue[64]; +}; + +struct fb_info_aty128 { + struct fb_info fb_info; + struct display disp; + struct aty128fb_par par; + u32 pseudo_palette[17]; + struct fb_info_aty128 *next; }; static struct fb_info_aty128 *board_list = NULL; +#ifdef CONFIG_PMAC_PBOOK +int aty128_sleep_notify(struct pmu_sleep_notifier *self, int when); +static struct pmu_sleep_notifier aty128_sleep_notifier = { + aty128_sleep_notify, SLEEP_LEVEL_VIDEO, +}; +#endif + #define round_div(n, d) ((n+(d/2))/d) /* @@ -323,19 +350,16 @@ static struct fb_info_aty128 *board_list = NULL; int aty128fb_setup(char *options); -static int aty128fb_get_fix(struct fb_fix_screeninfo *fix, int con, - struct fb_info *info); -static int aty128fb_get_var(struct fb_var_screeninfo *var, int con, - struct fb_info *info); -static int aty128fb_set_var(struct fb_var_screeninfo *var, int con, - struct fb_info *info); -static int aty128fb_get_cmap(struct fb_cmap *cmap, int kspc, int con, - struct fb_info *info); +static int aty128fb_check_var(struct fb_var_screeninfo *var, + struct fb_info *info); +static int aty128fb_set_par(struct fb_info *info); static int aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info); static int aty128fb_pan_display(struct fb_var_screeninfo *var, int con, struct fb_info *fb); static int aty128fb_blank(int blank, struct fb_info *fb); +static int aty128fb_ioctl(struct inode *inode, struct file *file, u_int cmd, + u_long arg, int con, struct fb_info *info); static int aty128fb_rasterimg(struct fb_info *info, int start); /* @@ -343,88 +367,52 @@ static int aty128fb_rasterimg(struct fb_info *info, int start); */ int aty128fb_init(void); -static int aty128fbcon_switch(int con, struct fb_info *fb); /* * Internal routines */ -static void aty128_encode_fix(struct fb_fix_screeninfo *fix, - struct aty128fb_par *par, - const struct fb_info_aty128 *info); -static void aty128_set_dispsw(struct display *disp, - struct fb_info_aty128 *info, int bpp, int accel); -static int aty128_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue, - u_int *transp, struct fb_info *info); static int aty128_encode_var(struct fb_var_screeninfo *var, - const struct aty128fb_par *par, - const struct fb_info_aty128 *info); + const struct aty128fb_par *par); static int aty128_decode_var(struct fb_var_screeninfo *var, - struct aty128fb_par *par, - const struct fb_info_aty128 *info); + struct aty128fb_par *par); static int aty128_pci_register(struct pci_dev *pdev, const struct aty128_chip_info *aci); -static struct fb_info_aty128 *aty128_board_list_add(struct fb_info_aty128 - *board_list, struct fb_info_aty128 *new_node); #if !defined(CONFIG_PPC) && !defined(__sparc__) -static void __init aty128_get_pllinfo(struct fb_info_aty128 *info, - char *bios_seg); -static char __init *aty128find_ROM(struct fb_info_aty128 *info); -#endif -static void aty128_timings(struct fb_info_aty128 *info); -static void aty128_init_engine(const struct aty128fb_par *par, - struct fb_info_aty128 *info); -static void aty128_reset_engine(const struct fb_info_aty128 *info); -static void aty128_flush_pixel_cache(const struct fb_info_aty128 *info); -static void do_wait_for_fifo(u16 entries, struct fb_info_aty128 *info); -static void wait_for_fifo(u16 entries, struct fb_info_aty128 *info); -static void wait_for_idle(struct fb_info_aty128 *info); -static u32 bpp_to_depth(u32 bpp); - -#ifdef FBCON_HAS_CFB8 -static struct display_switch fbcon_aty128_8; -static void fbcon_aty8_putc(struct vc_data *conp, struct display *p, - int c, int yy, int xx); -static void fbcon_aty8_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, - int yy, int xx); -#endif -#ifdef FBCON_HAS_CFB16 -static struct display_switch fbcon_aty128_16; -static void fbcon_aty16_putc(struct vc_data *conp, struct display *p, - int c, int yy, int xx); -static void fbcon_aty16_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, - int yy, int xx); -#endif -#ifdef FBCON_HAS_CFB24 -static struct display_switch fbcon_aty128_24; -static void fbcon_aty24_putc(struct vc_data *conp, struct display *p, - int c, int yy, int xx); -static void fbcon_aty24_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, - int yy, int xx); -#endif -#ifdef FBCON_HAS_CFB32 -static struct display_switch fbcon_aty128_32; -static void fbcon_aty32_putc(struct vc_data *conp, struct display *p, - int c, int yy, int xx); -static void fbcon_aty32_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, - int yy, int xx); +static void __init aty128_get_pllinfo(struct aty128fb_par *par, + char *bios_seg); +static char __init *aty128find_ROM(void); #endif +static void aty128_timings(struct aty128fb_par *par); +static void aty128_init_engine(struct aty128fb_par *par); +static void aty128_reset_engine(const struct aty128fb_par *par); +static void aty128_flush_pixel_cache(const struct aty128fb_par *par); +static void do_wait_for_fifo(u16 entries, struct aty128fb_par *par); +static void wait_for_fifo(u16 entries, struct aty128fb_par *par); +static void wait_for_idle(struct aty128fb_par *par); +static u32 depth_to_dst(u32 depth); static struct fb_ops aty128fb_ops = { - .owner = THIS_MODULE, - .fb_get_fix = aty128fb_get_fix, - .fb_get_var = aty128fb_get_var, - .fb_set_var = aty128fb_set_var, - .fb_get_cmap = aty128fb_get_cmap, - .fb_set_cmap = gen_set_cmap, - .fb_setcolreg = aty128fb_setcolreg, - .fb_pan_display =aty128fb_pan_display, - .fb_blank = aty128fb_blank, - .fb_rasterimg = aty128fb_rasterimg, + .owner = THIS_MODULE, + .fb_set_var = gen_set_var, + .fb_check_var = aty128fb_check_var, + .fb_set_par = aty128fb_set_par, + .fb_get_cmap = gen_get_cmap, + .fb_set_cmap = gen_set_cmap, + .fb_setcolreg = aty128fb_setcolreg, + .fb_pan_display = aty128fb_pan_display, + .fb_blank = aty128fb_blank, + .fb_ioctl = aty128fb_ioctl, +#if 0 + .fb_fillrect = aty128fb_fillrect, + .fb_copyarea = aty128fb_copyarea, + .fb_imageblit = aty128fb_imageblit, + .fb_rasterimg = aty128fb_rasterimg, +#else + .fb_fillrect = cfb_fillrect, + .fb_copyarea = cfb_copyarea, + .fb_imageblit = cfb_imageblit, +#endif }; #ifdef CONFIG_PMAC_BACKLIGHT @@ -443,1345 +431,1194 @@ static struct backlight_controller aty128_backlight_controller = { * using the other register aperture. TODO. */ static inline u32 -_aty_ld_le32(volatile unsigned int regindex, - const struct fb_info_aty128 *info) +_aty_ld_le32(volatile unsigned int regindex, const struct aty128fb_par *par) { - u32 val; + u32 val; #if defined(__powerpc__) - asm("lwbrx %0,%1,%2;eieio" : "=r"(val) : "b"(regindex), "r"(info->regbase)); + asm("lwbrx %0,%1,%2;eieio" : "=r"(val) : "b"(regindex), "r"(par->regbase)); #else - val = readl (info->regbase + regindex); + val = readl (par->regbase + regindex); #endif - return val; + return val; } static inline void _aty_st_le32(volatile unsigned int regindex, u32 val, - const struct fb_info_aty128 *info) + const struct aty128fb_par *par) { #if defined(__powerpc__) - asm("stwbrx %0,%1,%2;eieio" : : "r"(val), "b"(regindex), - "r"(info->regbase) : "memory"); + asm("stwbrx %0,%1,%2;eieio" : : "r"(val), "b"(regindex), + "r"(par->regbase) : "memory"); #else - writel (val, info->regbase + regindex); + writel (val, par->regbase + regindex); #endif } static inline u8 -_aty_ld_8(unsigned int regindex, const struct fb_info_aty128 *info) +_aty_ld_8(unsigned int regindex, const struct aty128fb_par *par) { - return readb (info->regbase + regindex); + return readb (par->regbase + regindex); } static inline void -_aty_st_8(unsigned int regindex, u8 val, const struct fb_info_aty128 *info) +_aty_st_8(unsigned int regindex, u8 val, const struct aty128fb_par *par) { - writeb (val, info->regbase + regindex); + writeb (val, par->regbase + regindex); } -#define aty_ld_le32(regindex) _aty_ld_le32(regindex, info) -#define aty_st_le32(regindex, val) _aty_st_le32(regindex, val, info) -#define aty_ld_8(regindex) _aty_ld_8(regindex, info) -#define aty_st_8(regindex, val) _aty_st_8(regindex, val, info) +#define aty_ld_le32(regindex) _aty_ld_le32(regindex, par) +#define aty_st_le32(regindex, val) _aty_st_le32(regindex, val, par) +#define aty_ld_8(regindex) _aty_ld_8(regindex, par) +#define aty_st_8(regindex, val) _aty_st_8(regindex, val, par) /* * Functions to read from/write to the pll registers */ -#define aty_ld_pll(pll_index) _aty_ld_pll(pll_index, info) -#define aty_st_pll(pll_index, val) _aty_st_pll(pll_index, val, info) +#define aty_ld_pll(pll_index) _aty_ld_pll(pll_index, par) +#define aty_st_pll(pll_index, val) _aty_st_pll(pll_index, val, par) static u32 _aty_ld_pll(unsigned int pll_index, - const struct fb_info_aty128 *info) + const struct aty128fb_par *par) { - aty_st_8(CLOCK_CNTL_INDEX, pll_index & 0x1F); - return aty_ld_le32(CLOCK_CNTL_DATA); + aty_st_8(CLOCK_CNTL_INDEX, pll_index & 0x3F); + return aty_ld_le32(CLOCK_CNTL_DATA); } static void _aty_st_pll(unsigned int pll_index, u32 val, - const struct fb_info_aty128 *info) + const struct aty128fb_par *par) { - aty_st_8(CLOCK_CNTL_INDEX, (pll_index & 0x1F) | PLL_WR_EN); - aty_st_le32(CLOCK_CNTL_DATA, val); + aty_st_8(CLOCK_CNTL_INDEX, (pll_index & 0x3F) | PLL_WR_EN); + aty_st_le32(CLOCK_CNTL_DATA, val); } /* return true when the PLL has completed an atomic update */ static int -aty_pll_readupdate(const struct fb_info_aty128 *info) +aty_pll_readupdate(const struct aty128fb_par *par) { - return !(aty_ld_pll(PPLL_REF_DIV) & PPLL_ATOMIC_UPDATE_R); + return !(aty_ld_pll(PPLL_REF_DIV) & PPLL_ATOMIC_UPDATE_R); } static void -aty_pll_wait_readupdate(const struct fb_info_aty128 *info) +aty_pll_wait_readupdate(const struct aty128fb_par *par) { - unsigned long timeout = jiffies + HZ/100; // should be more than enough - int reset = 1; + unsigned long timeout = jiffies + HZ/100; // should be more than enough + int reset = 1; - while (time_before(jiffies, timeout)) - if (aty_pll_readupdate(info)) { - reset = 0; - break; - } + while (time_before(jiffies, timeout)) + if (aty_pll_readupdate(par)) { + reset = 0; + break; + } - if (reset) /* reset engine?? */ - printk(KERN_DEBUG "aty128fb: PLL write timeout!\n"); + if (reset) /* reset engine?? */ + printk(KERN_DEBUG "aty128fb: PLL write timeout!\n"); } /* tell PLL to update */ static void -aty_pll_writeupdate(const struct fb_info_aty128 *info) +aty_pll_writeupdate(const struct aty128fb_par *par) { - aty_pll_wait_readupdate(info); + aty_pll_wait_readupdate(par); - aty_st_pll(PPLL_REF_DIV, - aty_ld_pll(PPLL_REF_DIV) | PPLL_ATOMIC_UPDATE_W); + aty_st_pll(PPLL_REF_DIV, + aty_ld_pll(PPLL_REF_DIV) | PPLL_ATOMIC_UPDATE_W); } /* write to the scratch register to test r/w functionality */ static int __init -register_test(const struct fb_info_aty128 *info) +register_test(const struct aty128fb_par *par) { - u32 val; - int flag = 0; + u32 val; + int flag = 0; - val = aty_ld_le32(BIOS_0_SCRATCH); + val = aty_ld_le32(BIOS_0_SCRATCH); - aty_st_le32(BIOS_0_SCRATCH, 0x55555555); - if (aty_ld_le32(BIOS_0_SCRATCH) == 0x55555555) { - aty_st_le32(BIOS_0_SCRATCH, 0xAAAAAAAA); + aty_st_le32(BIOS_0_SCRATCH, 0x55555555); + if (aty_ld_le32(BIOS_0_SCRATCH) == 0x55555555) { + aty_st_le32(BIOS_0_SCRATCH, 0xAAAAAAAA); - if (aty_ld_le32(BIOS_0_SCRATCH) == 0xAAAAAAAA) - flag = 1; - } + if (aty_ld_le32(BIOS_0_SCRATCH) == 0xAAAAAAAA) + flag = 1; + } - aty_st_le32(BIOS_0_SCRATCH, val); // restore value - return flag; + aty_st_le32(BIOS_0_SCRATCH, val); // restore value + return flag; } - /* - * Accelerator engine functions - */ +/* + * Accelerator engine functions + */ static void -do_wait_for_fifo(u16 entries, struct fb_info_aty128 *info) +do_wait_for_fifo(u16 entries, struct aty128fb_par *par) { - int i; - - for (;;) { - for (i = 0; i < 2000000; i++) { - info->fifo_slots = aty_ld_le32(GUI_STAT) & 0x0fff; - if (info->fifo_slots >= entries) - return; - } - aty128_reset_engine(info); - } + int i; + + for (;;) { + for (i = 0; i < 2000000; i++) { + par->fifo_slots = aty_ld_le32(GUI_STAT) & 0x0fff; + if (par->fifo_slots >= entries) + return; + } + aty128_reset_engine(par); + } } static void -wait_for_idle(struct fb_info_aty128 *info) +wait_for_idle(struct aty128fb_par *par) { - int i; - - do_wait_for_fifo(64, info); - - for (;;) { - for (i = 0; i < 2000000; i++) { - if (!(aty_ld_le32(GUI_STAT) & (1 << 31))) { - aty128_flush_pixel_cache(info); - info->blitter_may_be_busy = 0; - return; - } - } - aty128_reset_engine(info); - } + int i; + + do_wait_for_fifo(64, par); + + for (;;) { + for (i = 0; i < 2000000; i++) { + if (!(aty_ld_le32(GUI_STAT) & (1 << 31))) { + aty128_flush_pixel_cache(par); + par->blitter_may_be_busy = 0; + return; + } + } + aty128_reset_engine(par); + } } static void -wait_for_fifo(u16 entries, struct fb_info_aty128 *info) +wait_for_fifo(u16 entries, struct aty128fb_par *par) { - if (info->fifo_slots < entries) - do_wait_for_fifo(64, info); - info->fifo_slots -= entries; + if (par->fifo_slots < entries) + do_wait_for_fifo(64, par); + par->fifo_slots -= entries; } static void -aty128_flush_pixel_cache(const struct fb_info_aty128 *info) +aty128_flush_pixel_cache(const struct aty128fb_par *par) { - int i; - u32 tmp; + int i; + u32 tmp; - tmp = aty_ld_le32(PC_NGUI_CTLSTAT); - tmp &= ~(0x00ff); - tmp |= 0x00ff; - aty_st_le32(PC_NGUI_CTLSTAT, tmp); + tmp = aty_ld_le32(PC_NGUI_CTLSTAT); + tmp &= ~(0x00ff); + tmp |= 0x00ff; + aty_st_le32(PC_NGUI_CTLSTAT, tmp); - for (i = 0; i < 2000000; i++) - if (!(aty_ld_le32(PC_NGUI_CTLSTAT) & PC_BUSY)) - break; + for (i = 0; i < 2000000; i++) + if (!(aty_ld_le32(PC_NGUI_CTLSTAT) & PC_BUSY)) + break; } static void -aty128_reset_engine(const struct fb_info_aty128 *info) +aty128_reset_engine(const struct aty128fb_par *par) { - u32 gen_reset_cntl, clock_cntl_index, mclk_cntl; + u32 gen_reset_cntl, clock_cntl_index, mclk_cntl; - aty128_flush_pixel_cache(info); + aty128_flush_pixel_cache(par); - clock_cntl_index = aty_ld_le32(CLOCK_CNTL_INDEX); - mclk_cntl = aty_ld_pll(MCLK_CNTL); + clock_cntl_index = aty_ld_le32(CLOCK_CNTL_INDEX); + mclk_cntl = aty_ld_pll(MCLK_CNTL); - aty_st_pll(MCLK_CNTL, mclk_cntl | 0x00030000); + aty_st_pll(MCLK_CNTL, mclk_cntl | 0x00030000); - gen_reset_cntl = aty_ld_le32(GEN_RESET_CNTL); - aty_st_le32(GEN_RESET_CNTL, gen_reset_cntl | SOFT_RESET_GUI); - aty_ld_le32(GEN_RESET_CNTL); - aty_st_le32(GEN_RESET_CNTL, gen_reset_cntl & ~(SOFT_RESET_GUI)); - aty_ld_le32(GEN_RESET_CNTL); + gen_reset_cntl = aty_ld_le32(GEN_RESET_CNTL); + aty_st_le32(GEN_RESET_CNTL, gen_reset_cntl | SOFT_RESET_GUI); + aty_ld_le32(GEN_RESET_CNTL); + aty_st_le32(GEN_RESET_CNTL, gen_reset_cntl & ~(SOFT_RESET_GUI)); + aty_ld_le32(GEN_RESET_CNTL); - aty_st_pll(MCLK_CNTL, mclk_cntl); - aty_st_le32(CLOCK_CNTL_INDEX, clock_cntl_index); - aty_st_le32(GEN_RESET_CNTL, gen_reset_cntl); + aty_st_pll(MCLK_CNTL, mclk_cntl); + aty_st_le32(CLOCK_CNTL_INDEX, clock_cntl_index); + aty_st_le32(GEN_RESET_CNTL, gen_reset_cntl); - /* use old pio mode */ - aty_st_le32(PM4_BUFFER_CNTL, PM4_BUFFER_CNTL_NONPM4); + /* use old pio mode */ + aty_st_le32(PM4_BUFFER_CNTL, PM4_BUFFER_CNTL_NONPM4); - DBG("engine reset"); + DBG("engine reset"); } static void -aty128_init_engine(const struct aty128fb_par *par, - struct fb_info_aty128 *info) +aty128_init_engine(struct aty128fb_par *par) { - u32 pitch_value; - - wait_for_idle(info); - - /* 3D scaler not spoken here */ - wait_for_fifo(1, info); - aty_st_le32(SCALE_3D_CNTL, 0x00000000); + u32 pitch_value; - aty128_reset_engine(info); + wait_for_idle(par); - pitch_value = par->crtc.pitch; - if (par->crtc.bpp == 24) { - pitch_value = pitch_value * 3; - } + /* 3D scaler not spoken here */ + wait_for_fifo(1, par); + aty_st_le32(SCALE_3D_CNTL, 0x00000000); - wait_for_fifo(4, info); - /* setup engine offset registers */ - aty_st_le32(DEFAULT_OFFSET, 0x00000000); - - /* setup engine pitch registers */ - aty_st_le32(DEFAULT_PITCH, pitch_value); - - /* set the default scissor register to max dimensions */ - aty_st_le32(DEFAULT_SC_BOTTOM_RIGHT, (0x1FFF << 16) | 0x1FFF); - - /* set the drawing controls registers */ - aty_st_le32(DP_GUI_MASTER_CNTL, - GMC_SRC_PITCH_OFFSET_DEFAULT | - GMC_DST_PITCH_OFFSET_DEFAULT | - GMC_SRC_CLIP_DEFAULT | - GMC_DST_CLIP_DEFAULT | - GMC_BRUSH_SOLIDCOLOR | - (bpp_to_depth(par->crtc.bpp) << 8) | - GMC_SRC_DSTCOLOR | - GMC_BYTE_ORDER_MSB_TO_LSB | - GMC_DP_CONVERSION_TEMP_6500 | - ROP3_PATCOPY | - GMC_DP_SRC_RECT | - GMC_3D_FCN_EN_CLR | - GMC_DST_CLR_CMP_FCN_CLEAR | - GMC_AUX_CLIP_CLEAR | - GMC_WRITE_MASK_SET); - - wait_for_fifo(8, info); - /* clear the line drawing registers */ - aty_st_le32(DST_BRES_ERR, 0); - aty_st_le32(DST_BRES_INC, 0); - aty_st_le32(DST_BRES_DEC, 0); - - /* set brush color registers */ - aty_st_le32(DP_BRUSH_FRGD_CLR, 0xFFFFFFFF); /* white */ - aty_st_le32(DP_BRUSH_BKGD_CLR, 0x00000000); /* black */ - - /* set source color registers */ - aty_st_le32(DP_SRC_FRGD_CLR, 0xFFFFFFFF); /* white */ - aty_st_le32(DP_SRC_BKGD_CLR, 0x00000000); /* black */ - - /* default write mask */ - aty_st_le32(DP_WRITE_MASK, 0xFFFFFFFF); - - /* Wait for all the writes to be completed before returning */ - wait_for_idle(info); -} + aty128_reset_engine(par); + pitch_value = par->crtc.pitch; + if (par->crtc.bpp == 24) { + pitch_value = pitch_value * 3; + } -/* convert bpp values to their register representation */ + wait_for_fifo(4, par); + /* setup engine offset registers */ + aty_st_le32(DEFAULT_OFFSET, 0x00000000); + + /* setup engine pitch registers */ + aty_st_le32(DEFAULT_PITCH, pitch_value); + + /* set the default scissor register to max dimensions */ + aty_st_le32(DEFAULT_SC_BOTTOM_RIGHT, (0x1FFF << 16) | 0x1FFF); + + /* set the drawing controls registers */ + aty_st_le32(DP_GUI_MASTER_CNTL, + GMC_SRC_PITCH_OFFSET_DEFAULT | + GMC_DST_PITCH_OFFSET_DEFAULT | + GMC_SRC_CLIP_DEFAULT | + GMC_DST_CLIP_DEFAULT | + GMC_BRUSH_SOLIDCOLOR | + (depth_to_dst(par->crtc.depth) << 8) | + GMC_SRC_DSTCOLOR | + GMC_BYTE_ORDER_MSB_TO_LSB | + GMC_DP_CONVERSION_TEMP_6500 | + ROP3_PATCOPY | + GMC_DP_SRC_RECT | + GMC_3D_FCN_EN_CLR | + GMC_DST_CLR_CMP_FCN_CLEAR | + GMC_AUX_CLIP_CLEAR | + GMC_WRITE_MASK_SET); + + wait_for_fifo(8, par); + /* clear the line drawing registers */ + aty_st_le32(DST_BRES_ERR, 0); + aty_st_le32(DST_BRES_INC, 0); + aty_st_le32(DST_BRES_DEC, 0); + + /* set brush color registers */ + aty_st_le32(DP_BRUSH_FRGD_CLR, 0xFFFFFFFF); /* white */ + aty_st_le32(DP_BRUSH_BKGD_CLR, 0x00000000); /* black */ + + /* set source color registers */ + aty_st_le32(DP_SRC_FRGD_CLR, 0xFFFFFFFF); /* white */ + aty_st_le32(DP_SRC_BKGD_CLR, 0x00000000); /* black */ + + /* default write mask */ + aty_st_le32(DP_WRITE_MASK, 0xFFFFFFFF); + + /* Wait for all the writes to be completed before returning */ + wait_for_idle(par); +} + + +/* convert depth values to their register representation */ static u32 -bpp_to_depth(u32 bpp) -{ - if (bpp <= 8) - return DST_8BPP; - else if (bpp <= 16) - return DST_15BPP; - else if (bpp <= 24) - return DST_24BPP; - else if (bpp <= 32) - return DST_32BPP; - - return -EINVAL; +depth_to_dst(u32 depth) +{ + if (depth <= 8) + return DST_8BPP; + else if (depth <= 15) + return DST_15BPP; + else if (depth == 16) + return DST_16BPP; + else if (depth <= 24) + return DST_24BPP; + else if (depth <= 32) + return DST_32BPP; + + return -EINVAL; } - /* +/* * CRTC programming */ /* Program the CRTC registers */ static void aty128_set_crtc(const struct aty128_crtc *crtc, - const struct fb_info_aty128 *info) + const struct aty128fb_par *par) { - aty_st_le32(CRTC_GEN_CNTL, crtc->gen_cntl); - aty_st_le32(CRTC_H_TOTAL_DISP, crtc->h_total); - aty_st_le32(CRTC_H_SYNC_STRT_WID, crtc->h_sync_strt_wid); - aty_st_le32(CRTC_V_TOTAL_DISP, crtc->v_total); - aty_st_le32(CRTC_V_SYNC_STRT_WID, crtc->v_sync_strt_wid); - aty_st_le32(CRTC_PITCH, crtc->pitch); - aty_st_le32(CRTC_OFFSET, crtc->offset); - aty_st_le32(CRTC_OFFSET_CNTL, crtc->offset_cntl); - /* Disable ATOMIC updating. Is this the right place? - * -- BenH: Breaks on my G4 - */ -#if 0 - aty_st_le32(PPLL_CNTL, aty_ld_le32(PPLL_CNTL) & ~(0x00030000)); -#endif + aty_st_le32(CRTC_GEN_CNTL, crtc->gen_cntl); + aty_st_le32(CRTC_H_TOTAL_DISP, crtc->h_total); + aty_st_le32(CRTC_H_SYNC_STRT_WID, crtc->h_sync_strt_wid); + aty_st_le32(CRTC_V_TOTAL_DISP, crtc->v_total); + aty_st_le32(CRTC_V_SYNC_STRT_WID, crtc->v_sync_strt_wid); + aty_st_le32(CRTC_PITCH, crtc->pitch); + aty_st_le32(CRTC_OFFSET, crtc->offset); + aty_st_le32(CRTC_OFFSET_CNTL, crtc->offset_cntl); + /* Disable ATOMIC updating. Is this the right place? */ + aty_st_pll(PPLL_CNTL, aty_ld_pll(PPLL_CNTL) & ~(0x00030000)); } static int aty128_var_to_crtc(const struct fb_var_screeninfo *var, - struct aty128_crtc *crtc, - const struct fb_info_aty128 *info) -{ - u32 xres, yres, vxres, vyres, xoffset, yoffset, bpp; - u32 left, right, upper, lower, hslen, vslen, sync, vmode; - u32 h_total, h_disp, h_sync_strt, h_sync_wid, h_sync_pol; - u32 v_total, v_disp, v_sync_strt, v_sync_wid, v_sync_pol, c_sync; - u32 depth, bytpp; - u8 hsync_strt_pix[5] = { 0, 0x12, 9, 6, 5 }; - u8 mode_bytpp[7] = { 0, 0, 1, 2, 2, 3, 4 }; - - /* input */ - xres = var->xres; - yres = var->yres; - vxres = var->xres_virtual; - vyres = var->yres_virtual; - xoffset = var->xoffset; - yoffset = var->yoffset; - bpp = var->bits_per_pixel; - left = var->left_margin; - right = var->right_margin; - upper = var->upper_margin; - lower = var->lower_margin; - hslen = var->hsync_len; - vslen = var->vsync_len; - sync = var->sync; - vmode = var->vmode; - - /* check for mode eligibility - * accept only non interlaced modes */ - if ((vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED) - return -EINVAL; + struct aty128_crtc *crtc, + const struct aty128fb_par *par) +{ + u32 xres, yres, vxres, vyres, xoffset, yoffset, bpp, dst; + u32 left, right, upper, lower, hslen, vslen, sync, vmode; + u32 h_total, h_disp, h_sync_strt, h_sync_wid, h_sync_pol; + u32 v_total, v_disp, v_sync_strt, v_sync_wid, v_sync_pol, c_sync; + u32 depth, bytpp; + u8 mode_bytpp[7] = { 0, 0, 1, 2, 2, 3, 4 }; + + /* input */ + xres = var->xres; + yres = var->yres; + vxres = var->xres_virtual; + vyres = var->yres_virtual; + xoffset = var->xoffset; + yoffset = var->yoffset; + bpp = var->bits_per_pixel; + left = var->left_margin; + right = var->right_margin; + upper = var->upper_margin; + lower = var->lower_margin; + hslen = var->hsync_len; + vslen = var->vsync_len; + sync = var->sync; + vmode = var->vmode; + + if (bpp != 16) + depth = bpp; + else + depth = (var->green.length == 6) ? 16 : 15; - /* convert (and round up) and validate */ - xres = (xres + 7) & ~7; - xoffset = (xoffset + 7) & ~7; + /* check for mode eligibility + * accept only non interlaced modes */ + if ((vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED) + return -EINVAL; - if (vxres < xres + xoffset) - vxres = xres + xoffset; + /* convert (and round up) and validate */ + xres = (xres + 7) & ~7; + xoffset = (xoffset + 7) & ~7; - if (vyres < yres + yoffset) - vyres = yres + yoffset; + if (vxres < xres + xoffset) + vxres = xres + xoffset; - /* convert bpp into ATI register depth */ - depth = bpp_to_depth(bpp); + if (vyres < yres + yoffset) + vyres = yres + yoffset; - /* make sure we didn't get an invalid depth */ - if (depth == -EINVAL) { - printk(KERN_ERR "aty128fb: Invalid depth\n"); - return -EINVAL; - } + /* convert depth into ATI register depth */ + dst = depth_to_dst(depth); - /* convert depth to bpp */ - bytpp = mode_bytpp[depth]; + if (dst == -EINVAL) { + printk(KERN_ERR "aty128fb: Invalid depth or RGBA\n"); + return -EINVAL; + } - /* make sure there is enough video ram for the mode */ - if ((u32)(vxres * vyres * bytpp) > info->vram_size) { - printk(KERN_ERR "aty128fb: Not enough memory for mode\n"); - return -EINVAL; - } + /* convert register depth to bytes per pixel */ + bytpp = mode_bytpp[dst]; - h_disp = (xres >> 3) - 1; - h_total = (((xres + right + hslen + left) >> 3) - 1) & 0xFFFFL; + /* make sure there is enough video ram for the mode */ + if ((u32)(vxres * vyres * bytpp) > par->vram_size) { + printk(KERN_ERR "aty128fb: Not enough memory for mode\n"); + return -EINVAL; + } - v_disp = yres - 1; - v_total = (yres + upper + vslen + lower - 1) & 0xFFFFL; + h_disp = (xres >> 3) - 1; + h_total = (((xres + right + hslen + left) >> 3) - 1) & 0xFFFFL; - /* check to make sure h_total and v_total are in range */ - if (((h_total >> 3) - 1) > 0x1ff || (v_total - 1) > 0x7FF) { - printk(KERN_ERR "aty128fb: invalid width ranges\n"); - return -EINVAL; - } + v_disp = yres - 1; + v_total = (yres + upper + vslen + lower - 1) & 0xFFFFL; - h_sync_wid = (hslen + 7) >> 3; - if (h_sync_wid == 0) - h_sync_wid = 1; - else if (h_sync_wid > 0x3f) /* 0x3f = max hwidth */ - h_sync_wid = 0x3f; + /* check to make sure h_total and v_total are in range */ + if (((h_total >> 3) - 1) > 0x1ff || (v_total - 1) > 0x7FF) { + printk(KERN_ERR "aty128fb: invalid width ranges\n"); + return -EINVAL; + } + + h_sync_wid = (hslen + 7) >> 3; + if (h_sync_wid == 0) + h_sync_wid = 1; + else if (h_sync_wid > 0x3f) /* 0x3f = max hwidth */ + h_sync_wid = 0x3f; - h_sync_strt = h_disp + (right >> 3); + h_sync_strt = (h_disp << 3) + right; - v_sync_wid = vslen; - if (v_sync_wid == 0) - v_sync_wid = 1; - else if (v_sync_wid > 0x1f) /* 0x1f = max vwidth */ - v_sync_wid = 0x1f; + v_sync_wid = vslen; + if (v_sync_wid == 0) + v_sync_wid = 1; + else if (v_sync_wid > 0x1f) /* 0x1f = max vwidth */ + v_sync_wid = 0x1f; - v_sync_strt = v_disp + lower; + v_sync_strt = v_disp + lower; - h_sync_pol = sync & FB_SYNC_HOR_HIGH_ACT ? 0 : 1; - v_sync_pol = sync & FB_SYNC_VERT_HIGH_ACT ? 0 : 1; + h_sync_pol = sync & FB_SYNC_HOR_HIGH_ACT ? 0 : 1; + v_sync_pol = sync & FB_SYNC_VERT_HIGH_ACT ? 0 : 1; - c_sync = sync & FB_SYNC_COMP_HIGH_ACT ? (1 << 4) : 0; + c_sync = sync & FB_SYNC_COMP_HIGH_ACT ? (1 << 4) : 0; - crtc->gen_cntl = 0x3000000L | c_sync | (depth << 8); + crtc->gen_cntl = 0x3000000L | c_sync | (dst << 8); - crtc->h_total = h_total | (h_disp << 16); - crtc->v_total = v_total | (v_disp << 16); + crtc->h_total = h_total | (h_disp << 16); + crtc->v_total = v_total | (v_disp << 16); - crtc->h_sync_strt_wid = hsync_strt_pix[bytpp] | (h_sync_strt << 3) | - (h_sync_wid << 16) | (h_sync_pol << 23); - crtc->v_sync_strt_wid = v_sync_strt | (v_sync_wid << 16) | + crtc->h_sync_strt_wid = h_sync_strt | (h_sync_wid << 16) | + (h_sync_pol << 23); + crtc->v_sync_strt_wid = v_sync_strt | (v_sync_wid << 16) | (v_sync_pol << 23); - crtc->pitch = vxres >> 3; + crtc->pitch = vxres >> 3; - crtc->offset = 0; + crtc->offset = 0; - if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) - crtc->offset_cntl = 0x00010000; - else - crtc->offset_cntl = 0; + if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) + crtc->offset_cntl = 0x00010000; + else + crtc->offset_cntl = 0; - crtc->vxres = vxres; - crtc->vyres = vyres; - crtc->xoffset = xoffset; - crtc->yoffset = yoffset; - crtc->bpp = bpp; + crtc->vxres = vxres; + crtc->vyres = vyres; + crtc->xoffset = xoffset; + crtc->yoffset = yoffset; + crtc->depth = depth; + crtc->bpp = bpp; - return 0; + return 0; } static int -aty128_bpp_to_var(int pix_width, struct fb_var_screeninfo *var) +aty128_pix_width_to_var(int pix_width, struct fb_var_screeninfo *var) { - /* fill in pixel info */ - switch (pix_width) { - case CRTC_PIX_WIDTH_8BPP: - var->bits_per_pixel = 8; - var->red.offset = 0; - var->red.length = 8; - var->green.offset = 0; - var->green.length = 8; - var->blue.offset = 0; - var->blue.length = 8; - var->transp.offset = 0; - var->transp.length = 0; - break; - case CRTC_PIX_WIDTH_15BPP: - case CRTC_PIX_WIDTH_16BPP: - var->bits_per_pixel = 16; - var->red.offset = 10; - var->red.length = 5; - var->green.offset = 5; - var->green.length = 5; + /* fill in pixel info */ + var->red.msb_right = 0; + var->green.msb_right = 0; var->blue.offset = 0; - var->blue.length = 5; + var->blue.msb_right = 0; var->transp.offset = 0; var->transp.length = 0; - break; - case CRTC_PIX_WIDTH_24BPP: - var->bits_per_pixel = 24; - var->red.offset = 16; - var->red.length = 8; - var->green.offset = 8; - var->green.length = 8; - var->blue.offset = 0; - var->blue.length = 8; - var->transp.offset = 0; - var->transp.length = 0; - break; - case CRTC_PIX_WIDTH_32BPP: - var->bits_per_pixel = 32; - var->red.offset = 16; - var->red.length = 8; - var->green.offset = 8; - var->green.length = 8; - var->blue.offset = 0; - var->blue.length = 8; - var->transp.offset = 24; - var->transp.length = 8; - break; - default: - printk(KERN_ERR "aty128fb: Invalid pixel width\n"); - return -EINVAL; - } + var->transp.msb_right = 0; + switch (pix_width) { + case CRTC_PIX_WIDTH_8BPP: + var->bits_per_pixel = 8; + var->red.offset = 0; + var->red.length = 8; + var->green.offset = 0; + var->green.length = 8; + var->blue.length = 8; + break; + case CRTC_PIX_WIDTH_15BPP: + var->bits_per_pixel = 16; + var->red.offset = 10; + var->red.length = 5; + var->green.offset = 5; + var->green.length = 5; + var->blue.length = 5; + break; + case CRTC_PIX_WIDTH_16BPP: + var->bits_per_pixel = 16; + var->red.offset = 11; + var->red.length = 5; + var->green.offset = 5; + var->green.length = 6; + var->blue.length = 5; + break; + case CRTC_PIX_WIDTH_24BPP: + var->bits_per_pixel = 24; + var->red.offset = 16; + var->red.length = 8; + var->green.offset = 8; + var->green.length = 8; + var->blue.length = 8; + break; + case CRTC_PIX_WIDTH_32BPP: + var->bits_per_pixel = 32; + var->red.offset = 16; + var->red.length = 8; + var->green.offset = 8; + var->green.length = 8; + var->blue.length = 8; + var->transp.offset = 24; + var->transp.length = 8; + break; + default: + printk(KERN_ERR "aty128fb: Invalid pixel width\n"); + return -EINVAL; + } - return 0; + return 0; } static int aty128_crtc_to_var(const struct aty128_crtc *crtc, - struct fb_var_screeninfo *var) + struct fb_var_screeninfo *var) +{ + u32 xres, yres, left, right, upper, lower, hslen, vslen, sync; + u32 h_total, h_disp, h_sync_strt, h_sync_dly, h_sync_wid, h_sync_pol; + u32 v_total, v_disp, v_sync_strt, v_sync_wid, v_sync_pol, c_sync; + u32 pix_width; + + /* fun with masking */ + h_total = crtc->h_total & 0x1ff; + h_disp = (crtc->h_total >> 16) & 0xff; + h_sync_strt = (crtc->h_sync_strt_wid >> 3) & 0x1ff; + h_sync_dly = crtc->h_sync_strt_wid & 0x7; + h_sync_wid = (crtc->h_sync_strt_wid >> 16) & 0x3f; + h_sync_pol = (crtc->h_sync_strt_wid >> 23) & 0x1; + v_total = crtc->v_total & 0x7ff; + v_disp = (crtc->v_total >> 16) & 0x7ff; + v_sync_strt = crtc->v_sync_strt_wid & 0x7ff; + v_sync_wid = (crtc->v_sync_strt_wid >> 16) & 0x1f; + v_sync_pol = (crtc->v_sync_strt_wid >> 23) & 0x1; + c_sync = crtc->gen_cntl & CRTC_CSYNC_EN ? 1 : 0; + pix_width = crtc->gen_cntl & CRTC_PIX_WIDTH_MASK; + + /* do conversions */ + xres = (h_disp + 1) << 3; + yres = v_disp + 1; + left = ((h_total - h_sync_strt - h_sync_wid) << 3) - h_sync_dly; + right = ((h_sync_strt - h_disp) << 3) + h_sync_dly; + hslen = h_sync_wid << 3; + upper = v_total - v_sync_strt - v_sync_wid; + lower = v_sync_strt - v_disp; + vslen = v_sync_wid; + sync = (h_sync_pol ? 0 : FB_SYNC_HOR_HIGH_ACT) | + (v_sync_pol ? 0 : FB_SYNC_VERT_HIGH_ACT) | + (c_sync ? FB_SYNC_COMP_HIGH_ACT : 0); + + aty128_pix_width_to_var(pix_width, var); + + var->xres = xres; + var->yres = yres; + var->xres_virtual = crtc->vxres; + var->yres_virtual = crtc->vyres; + var->xoffset = crtc->xoffset; + var->yoffset = crtc->yoffset; + var->left_margin = left; + var->right_margin = right; + var->upper_margin = upper; + var->lower_margin = lower; + var->hsync_len = hslen; + var->vsync_len = vslen; + var->sync = sync; + var->vmode = FB_VMODE_NONINTERLACED; + + return 0; +} + +#ifdef CONFIG_PMAC_PBOOK +static void +aty128_set_crt_enable(struct aty128fb_par *par, int on) { - u32 xres, yres, left, right, upper, lower, hslen, vslen, sync; - u32 h_total, h_disp, h_sync_strt, h_sync_dly, h_sync_wid, h_sync_pol; - u32 v_total, v_disp, v_sync_strt, v_sync_wid, v_sync_pol, c_sync; - u32 pix_width; - - /* fun with masking */ - h_total = crtc->h_total & 0x1ff; - h_disp = (crtc->h_total >> 16) & 0xff; - h_sync_strt = (crtc->h_sync_strt_wid >> 3) & 0x1ff; - h_sync_dly = crtc->h_sync_strt_wid & 0x7; - h_sync_wid = (crtc->h_sync_strt_wid >> 16) & 0x3f; - h_sync_pol = (crtc->h_sync_strt_wid >> 23) & 0x1; - v_total = crtc->v_total & 0x7ff; - v_disp = (crtc->v_total >> 16) & 0x7ff; - v_sync_strt = crtc->v_sync_strt_wid & 0x7ff; - v_sync_wid = (crtc->v_sync_strt_wid >> 16) & 0x1f; - v_sync_pol = (crtc->v_sync_strt_wid >> 23) & 0x1; - c_sync = crtc->gen_cntl & CRTC_CSYNC_EN ? 1 : 0; - pix_width = crtc->gen_cntl & CRTC_PIX_WIDTH_MASK; - - /* do conversions */ - xres = (h_disp + 1) << 3; - yres = v_disp + 1; - left = ((h_total - h_sync_strt - h_sync_wid) << 3) - h_sync_dly; - right = ((h_sync_strt - h_disp) << 3) + h_sync_dly; - hslen = h_sync_wid << 3; - upper = v_total - v_sync_strt - v_sync_wid; - lower = v_sync_strt - v_disp; - vslen = v_sync_wid; - sync = (h_sync_pol ? 0 : FB_SYNC_HOR_HIGH_ACT) | - (v_sync_pol ? 0 : FB_SYNC_VERT_HIGH_ACT) | - (c_sync ? FB_SYNC_COMP_HIGH_ACT : 0); - - aty128_bpp_to_var(pix_width, var); - - var->xres = xres; - var->yres = yres; - var->xres_virtual = crtc->vxres; - var->yres_virtual = crtc->vyres; - var->xoffset = crtc->xoffset; - var->yoffset = crtc->yoffset; - var->left_margin = left; - var->right_margin = right; - var->upper_margin = upper; - var->lower_margin = lower; - var->hsync_len = hslen; - var->vsync_len = vslen; - var->sync = sync; - var->vmode = FB_VMODE_NONINTERLACED; - - return 0; + if (on) { + aty_st_le32(CRTC_EXT_CNTL, aty_ld_le32(CRTC_EXT_CNTL) | CRT_CRTC_ON); + aty_st_le32(DAC_CNTL, (aty_ld_le32(DAC_CNTL) | DAC_PALETTE2_SNOOP_EN)); + } else + aty_st_le32(CRTC_EXT_CNTL, aty_ld_le32(CRTC_EXT_CNTL) & ~CRT_CRTC_ON); } static void -aty128_set_pll(struct aty128_pll *pll, const struct fb_info_aty128 *info) +aty128_set_lcd_enable(struct aty128fb_par *par, int on) { - u32 div3; + u32 reg; - unsigned char post_conv[] = /* register values for post dividers */ + if (on) { + reg = aty_ld_le32(LVDS_GEN_CNTL); + reg |= LVDS_ON | LVDS_EN | LVDS_BLON | LVDS_DIGION; + reg &= ~LVDS_DISPLAY_DIS; + aty_st_le32(LVDS_GEN_CNTL, reg); +#ifdef CONFIG_PMAC_BACKLIGHT + aty128_set_backlight_enable(get_backlight_enable(), + get_backlight_level(), par); +#endif + } else { +#ifdef CONFIG_PMAC_BACKLIGHT + aty128_set_backlight_enable(0, 0, par); +#endif + reg = aty_ld_le32(LVDS_GEN_CNTL); + reg |= LVDS_DISPLAY_DIS; + aty_st_le32(LVDS_GEN_CNTL, reg); + mdelay(100); + reg &= ~(LVDS_ON /*| LVDS_EN*/); + aty_st_le32(LVDS_GEN_CNTL, reg); + } +} +#endif + +static void +aty128_set_pll(struct aty128_pll *pll, const struct aty128fb_par *par) +{ + u32 div3; + + unsigned char post_conv[] = /* register values for post dividers */ { 2, 0, 1, 4, 2, 2, 6, 2, 3, 2, 2, 2, 7 }; - /* select PPLL_DIV_3 */ - aty_st_le32(CLOCK_CNTL_INDEX, aty_ld_le32(CLOCK_CNTL_INDEX) | (3 << 8)); + /* select PPLL_DIV_3 */ + aty_st_le32(CLOCK_CNTL_INDEX, aty_ld_le32(CLOCK_CNTL_INDEX) | (3 << 8)); - /* reset PLL */ - aty_st_pll(PPLL_CNTL, - aty_ld_pll(PPLL_CNTL) | PPLL_RESET | PPLL_ATOMIC_UPDATE_EN); + /* reset PLL */ + aty_st_pll(PPLL_CNTL, + aty_ld_pll(PPLL_CNTL) | PPLL_RESET | PPLL_ATOMIC_UPDATE_EN); - /* write the reference divider */ - aty_pll_wait_readupdate(info); - aty_st_pll(PPLL_REF_DIV, info->constants.ref_divider & 0x3ff); - aty_pll_writeupdate(info); + /* write the reference divider */ + aty_pll_wait_readupdate(par); + aty_st_pll(PPLL_REF_DIV, par->constants.ref_divider & 0x3ff); + aty_pll_writeupdate(par); - div3 = aty_ld_pll(PPLL_DIV_3); - div3 &= ~PPLL_FB3_DIV_MASK; - div3 |= pll->feedback_divider; - div3 &= ~PPLL_POST3_DIV_MASK; - div3 |= post_conv[pll->post_divider] << 16; + div3 = aty_ld_pll(PPLL_DIV_3); + div3 &= ~PPLL_FB3_DIV_MASK; + div3 |= pll->feedback_divider; + div3 &= ~PPLL_POST3_DIV_MASK; + div3 |= post_conv[pll->post_divider] << 16; - /* write feedback and post dividers */ - aty_pll_wait_readupdate(info); - aty_st_pll(PPLL_DIV_3, div3); - aty_pll_writeupdate(info); + /* write feedback and post dividers */ + aty_pll_wait_readupdate(par); + aty_st_pll(PPLL_DIV_3, div3); + aty_pll_writeupdate(par); - aty_pll_wait_readupdate(info); - aty_st_pll(HTOTAL_CNTL, 0); /* no horiz crtc adjustment */ - aty_pll_writeupdate(info); + aty_pll_wait_readupdate(par); + aty_st_pll(HTOTAL_CNTL, 0); /* no horiz crtc adjustment */ + aty_pll_writeupdate(par); - /* clear the reset, just in case */ - aty_st_pll(PPLL_CNTL, aty_ld_pll(PPLL_CNTL) & ~PPLL_RESET); + /* clear the reset, just in case */ + aty_st_pll(PPLL_CNTL, aty_ld_pll(PPLL_CNTL) & ~PPLL_RESET); } static int aty128_var_to_pll(u32 period_in_ps, struct aty128_pll *pll, - const struct fb_info_aty128 *info) -{ - const struct aty128_constants c = info->constants; - unsigned char post_dividers[] = {1,2,4,8,3,6,12}; - u32 output_freq; - u32 vclk; /* in .01 MHz */ - int i; - u32 n, d; - - vclk = 100000000 / period_in_ps; /* convert units to 10 kHz */ - - /* adjust pixel clock if necessary */ - if (vclk > c.ppll_max) - vclk = c.ppll_max; - if (vclk * 12 < c.ppll_min) - vclk = c.ppll_min/12; - - /* now, find an acceptable divider */ - for (i = 0; i < sizeof(post_dividers); i++) { - output_freq = post_dividers[i] * vclk; - if (output_freq >= c.ppll_min && output_freq <= c.ppll_max) - break; - } + const struct aty128fb_par *par) +{ + const struct aty128_constants c = par->constants; + unsigned char post_dividers[] = {1,2,4,8,3,6,12}; + u32 output_freq; + u32 vclk; /* in .01 MHz */ + int i; + u32 n, d; + + vclk = 100000000 / period_in_ps; /* convert units to 10 kHz */ + + /* adjust pixel clock if necessary */ + if (vclk > c.ppll_max) + vclk = c.ppll_max; + if (vclk * 12 < c.ppll_min) + vclk = c.ppll_min/12; + + /* now, find an acceptable divider */ + for (i = 0; i < sizeof(post_dividers); i++) { + output_freq = post_dividers[i] * vclk; + if (output_freq >= c.ppll_min && output_freq <= c.ppll_max) + break; + } - /* calculate feedback divider */ - n = c.ref_divider * output_freq; - d = c.dotclock; + /* calculate feedback divider */ + n = c.ref_divider * output_freq; + d = c.dotclock; - pll->post_divider = post_dividers[i]; - pll->feedback_divider = round_div(n, d); - pll->vclk = vclk; + pll->post_divider = post_dividers[i]; + pll->feedback_divider = round_div(n, d); + pll->vclk = vclk; - DBG("post %d feedback %d vlck %d output %d ref_divider %d " - "vclk_per: %d\n", pll->post_divider, - pll->feedback_divider, vclk, output_freq, - c.ref_divider, period_in_ps); + DBG("post %d feedback %d vlck %d output %d ref_divider %d " + "vclk_per: %d\n", pll->post_divider, + pll->feedback_divider, vclk, output_freq, + c.ref_divider, period_in_ps); - return 0; + return 0; } static int -aty128_pll_to_var(const struct aty128_pll *pll, struct fb_var_screeninfo *var, - const struct fb_info_aty128 *info) +aty128_pll_to_var(const struct aty128_pll *pll, struct fb_var_screeninfo *var) { - var->pixclock = 100000000 / pll->vclk; + var->pixclock = 100000000 / pll->vclk; - return 0; + return 0; } static void aty128_set_fifo(const struct aty128_ddafifo *dsp, - const struct fb_info_aty128 *info) + const struct aty128fb_par *par) { - aty_st_le32(DDA_CONFIG, dsp->dda_config); - aty_st_le32(DDA_ON_OFF, dsp->dda_on_off); + aty_st_le32(DDA_CONFIG, dsp->dda_config); + aty_st_le32(DDA_ON_OFF, dsp->dda_on_off); } static int aty128_ddafifo(struct aty128_ddafifo *dsp, - const struct aty128_pll *pll, - u32 bpp, - const struct fb_info_aty128 *info) -{ - const struct aty128_meminfo *m = info->mem; - u32 xclk = info->constants.xclk; - u32 fifo_width = info->constants.fifo_width; - u32 fifo_depth = info->constants.fifo_depth; - s32 x, b, p, ron, roff; - u32 n, d; - - /* 15bpp is really 16bpp */ - if (bpp == 15) - bpp = 16; - - n = xclk * fifo_width; - d = pll->vclk * bpp; - x = round_div(n, d); - - ron = 4 * m->MB + - 3 * ((m->Trcd - 2 > 0) ? m->Trcd - 2 : 0) + - 2 * m->Trp + - m->Twr + - m->CL + - m->Tr2w + - x; - - DBG("x %x\n", x); - - b = 0; - while (x) { - x >>= 1; - b++; - } - p = b + 1; + const struct aty128_pll *pll, + u32 depth, + const struct aty128fb_par *par) +{ + const struct aty128_meminfo *m = par->mem; + u32 xclk = par->constants.xclk; + u32 fifo_width = par->constants.fifo_width; + u32 fifo_depth = par->constants.fifo_depth; + s32 x, b, p, ron, roff; + u32 n, d, bpp; + + /* round up to multiple of 8 */ + bpp = (depth+7) & ~7; + + n = xclk * fifo_width; + d = pll->vclk * bpp; + x = round_div(n, d); + + ron = 4 * m->MB + + 3 * ((m->Trcd - 2 > 0) ? m->Trcd - 2 : 0) + + 2 * m->Trp + + m->Twr + + m->CL + + m->Tr2w + + x; + + DBG("x %x\n", x); + + b = 0; + while (x) { + x >>= 1; + b++; + } + p = b + 1; - ron <<= (11 - p); + ron <<= (11 - p); - n <<= (11 - p); - x = round_div(n, d); - roff = x * (fifo_depth - 4); + n <<= (11 - p); + x = round_div(n, d); + roff = x * (fifo_depth - 4); - if ((ron + m->Rloop) >= roff) { - printk(KERN_ERR "aty128fb: Mode out of range!\n"); - return -EINVAL; - } + if ((ron + m->Rloop) >= roff) { + printk(KERN_ERR "aty128fb: Mode out of range!\n"); + return -EINVAL; + } - DBG("p: %x rloop: %x x: %x ron: %x roff: %x\n", - p, m->Rloop, x, ron, roff); + DBG("p: %x rloop: %x x: %x ron: %x roff: %x\n", + p, m->Rloop, x, ron, roff); - dsp->dda_config = p << 16 | m->Rloop << 20 | x; - dsp->dda_on_off = ron << 16 | roff; + dsp->dda_config = p << 16 | m->Rloop << 20 | x; + dsp->dda_on_off = ron << 16 | roff; - return 0; + return 0; } /* * This actually sets the video mode. */ -static void -aty128_set_par(struct aty128fb_par *par, - struct fb_info_aty128 *info) +static int +aty128fb_set_par(struct fb_info *info) { - u32 config; - - info->current_par = *par; + struct aty128fb_par *par = info->par; + u32 config; - if (info->blitter_may_be_busy) - wait_for_idle(info); - - /* clear all registers that may interfere with mode setting */ - aty_st_le32(OVR_CLR, 0); - aty_st_le32(OVR_WID_LEFT_RIGHT, 0); - aty_st_le32(OVR_WID_TOP_BOTTOM, 0); - aty_st_le32(OV0_SCALE_CNTL, 0); - aty_st_le32(MPP_TB_CONFIG, 0); - aty_st_le32(MPP_GP_CONFIG, 0); - aty_st_le32(SUBPIC_CNTL, 0); - aty_st_le32(VIPH_CONTROL, 0); - aty_st_le32(I2C_CNTL_1, 0); /* turn off i2c */ - aty_st_le32(GEN_INT_CNTL, 0); /* turn off interrupts */ - aty_st_le32(CAP0_TRIG_CNTL, 0); - aty_st_le32(CAP1_TRIG_CNTL, 0); - - aty_st_8(CRTC_EXT_CNTL + 1, 4); /* turn video off */ - - aty128_set_crtc(&par->crtc, info); - aty128_set_pll(&par->pll, info); - aty128_set_fifo(&par->fifo_reg, info); - - config = aty_ld_le32(CONFIG_CNTL) & ~3; + if (par->blitter_may_be_busy) + wait_for_idle(par); + + /* clear all registers that may interfere with mode setting */ + aty_st_le32(OVR_CLR, 0); + aty_st_le32(OVR_WID_LEFT_RIGHT, 0); + aty_st_le32(OVR_WID_TOP_BOTTOM, 0); + aty_st_le32(OV0_SCALE_CNTL, 0); + aty_st_le32(MPP_TB_CONFIG, 0); + aty_st_le32(MPP_GP_CONFIG, 0); + aty_st_le32(SUBPIC_CNTL, 0); + aty_st_le32(VIPH_CONTROL, 0); + aty_st_le32(I2C_CNTL_1, 0); /* turn off i2c */ + aty_st_le32(GEN_INT_CNTL, 0); /* turn off interrupts */ + aty_st_le32(CAP0_TRIG_CNTL, 0); + aty_st_le32(CAP1_TRIG_CNTL, 0); + + aty_st_8(CRTC_EXT_CNTL + 1, 4); /* turn video off */ + + aty128_set_crtc(&par->crtc, par); + aty128_set_pll(&par->pll, par); + aty128_set_fifo(&par->fifo_reg, par); + + config = aty_ld_le32(CONFIG_CNTL) & ~3; #if defined(__BIG_ENDIAN) - if (par->crtc.bpp >= 24) - config |= 2; /* make aperture do 32 byte swapping */ - else if (par->crtc.bpp > 8) - config |= 1; /* make aperture do 16 byte swapping */ + if (par->crtc.bpp == 32) + config |= 2; /* make aperture do 32 bit swapping */ + else if (par->crtc.bpp == 16) + config |= 1; /* make aperture do 16 bit swapping */ #endif - aty_st_le32(CONFIG_CNTL, config); - aty_st_8(CRTC_EXT_CNTL + 1, 0); /* turn the video back on */ + aty_st_le32(CONFIG_CNTL, config); + aty_st_8(CRTC_EXT_CNTL + 1, 0); /* turn the video back on */ + + info->fix.line_length = (par->crtc.vxres * par->crtc.bpp) >> 3; + info->fix.visual = par->crtc.bpp == 8 ? FB_VISUAL_PSEUDOCOLOR + : FB_VISUAL_DIRECTCOLOR; - if (par->accel_flags & FB_ACCELF_TEXT) - aty128_init_engine(par, info); +#ifdef CONFIG_PMAC_PBOOK + if (par->chip_gen == rage_M3) { + aty128_set_crt_enable(par, par->crt_on); + aty128_set_lcd_enable(par, par->lcd_on); + } +#endif + if (par->accel_flags & FB_ACCELF_TEXT) + aty128_init_engine(par); -#if defined(CONFIG_BOOTX_TEXT) - btext_update_display(info->frame_buffer_phys, - (((par->crtc.h_total>>16) & 0xff)+1)*8, - ((par->crtc.v_total>>16) & 0x7ff)+1, - par->crtc.bpp, - par->crtc.vxres*par->crtc.bpp/8); +#ifdef CONFIG_BOOTX_TEXT + btext_update_display(info->fix.smem_start, + (((par->crtc.h_total>>16) & 0xff)+1)*8, + ((par->crtc.v_total>>16) & 0x7ff)+1, + par->crtc.bpp, + par->crtc.vxres*par->crtc.bpp/8); #endif /* CONFIG_BOOTX_TEXT */ + + return 0; } - /* - * encode/decode the User Defined Part of the Display - */ +/* + * encode/decode the User Defined Part of the Display + */ static int -aty128_decode_var(struct fb_var_screeninfo *var, struct aty128fb_par *par, - const struct fb_info_aty128 *info) +aty128_decode_var(struct fb_var_screeninfo *var, struct aty128fb_par *par) { - int err; - - if ((err = aty128_var_to_crtc(var, &par->crtc, info))) - return err; + int err; - if ((err = aty128_var_to_pll(var->pixclock, &par->pll, info))) - return err; + if ((err = aty128_var_to_crtc(var, &par->crtc, par))) + return err; - if ((err = aty128_ddafifo(&par->fifo_reg, &par->pll, par->crtc.bpp, info))) - return err; + if ((err = aty128_var_to_pll(var->pixclock, &par->pll, par))) + return err; - if (var->accel_flags & FB_ACCELF_TEXT) - par->accel_flags = FB_ACCELF_TEXT; - else - par->accel_flags = 0; + if ((err = aty128_ddafifo(&par->fifo_reg, &par->pll, par->crtc.depth, par))) + return err; + par->accel_flags = var->accel_flags; - return 0; + return 0; } static int aty128_encode_var(struct fb_var_screeninfo *var, - const struct aty128fb_par *par, - const struct fb_info_aty128 *info) + const struct aty128fb_par *par) { - int err; - - if ((err = aty128_crtc_to_var(&par->crtc, var))) - return err; + int err; - if ((err = aty128_pll_to_var(&par->pll, var, info))) - return err; + if ((err = aty128_crtc_to_var(&par->crtc, var))) + return err; - var->red.msb_right = 0; - var->green.msb_right = 0; - var->blue.msb_right = 0; - var->transp.msb_right = 0; + if ((err = aty128_pll_to_var(&par->pll, var))) + return err; - var->nonstd = 0; - var->activate = 0; + var->nonstd = 0; + var->activate = 0; - var->height = -1; - var->width = -1; - var->accel_flags = par->accel_flags; + var->height = -1; + var->width = -1; + var->accel_flags = par->accel_flags; - return 0; + return 0; } - /* - * Get the User Defined Part of the Display - */ - static int -aty128fb_get_var(struct fb_var_screeninfo *var, int con, struct fb_info *fb) +aty128fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) { - const struct fb_info_aty128 *info = (struct fb_info_aty128 *)fb; - - if (con == -1) - aty128_encode_var(var, &info->default_par, info); - else - *var = fb_display[con].var; - return 0; -} - - - /* - * Set the User Defined Part of the Display - */ - -static int -aty128fb_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *fb) -{ - struct fb_info_aty128 *info = (struct fb_info_aty128 *)fb; - struct aty128fb_par par; - struct display *display; - int oldxres, oldyres, oldvxres, oldvyres, oldbpp, oldaccel; - int accel, err; - - display = (con >= 0) ? &fb_display[con] : fb->disp; - - /* basic (in)sanity checks */ - if (!var->xres) - var->xres = 1; - if (!var->yres) - var->yres = 1; - if (var->xres > var->xres_virtual) - var->xres_virtual = var->xres; - if (var->yres > var->yres_virtual) - var->yres_virtual = var->yres; - - switch (var->bits_per_pixel) { - case 0 ... 8: - var->bits_per_pixel = 8; - break; - case 9 ... 16: - var->bits_per_pixel = 16; - break; - case 17 ... 24: - var->bits_per_pixel = 24; - break; - case 25 ... 32: - var->bits_per_pixel = 32; - break; - default: - return -EINVAL; - } - - if ((err = aty128_decode_var(var, &par, info))) - return err; - - aty128_encode_var(var, &par, info); + struct aty128fb_par *par = info->par; + int err; - if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_TEST) + if ((err = aty128_decode_var(var, par)) != 0) + return err; + aty128_encode_var(var, par); return 0; - - oldxres = display->var.xres; - oldyres = display->var.yres; - oldvxres = display->var.xres_virtual; - oldvyres = display->var.yres_virtual; - oldbpp = display->var.bits_per_pixel; - oldaccel = display->var.accel_flags; - display->var = *var; - if (oldxres != var->xres || oldyres != var->yres || - oldvxres != var->xres_virtual || oldvyres != var->yres_virtual || - oldbpp != var->bits_per_pixel || oldaccel != var->accel_flags) { - - struct fb_fix_screeninfo fix; - - aty128_encode_fix(&fix, &par, info); - fb->screen_base = info->frame_buffer; - display->visual = fix.visual; - display->type = fix.type; - display->type_aux = fix.type_aux; - display->ypanstep = fix.ypanstep; - display->ywrapstep = fix.ywrapstep; - display->line_length = fix.line_length; - display->can_soft_blank = 1; - display->inverse = 0; - - accel = var->accel_flags & FB_ACCELF_TEXT; - aty128_set_dispsw(display, info, par.crtc.bpp, accel); - - if (accel) - display->scrollmode = SCROLL_YNOMOVE; - else - display->scrollmode = SCROLL_YREDRAW; - - if (info->fb_info.changevar) - (*info->fb_info.changevar)(con); - } - - if (!info->fb_info.display_fg || info->fb_info.display_fg->vc_num == con) - aty128_set_par(&par, info); - - if (oldbpp != var->bits_per_pixel) { - if ((err = fb_alloc_cmap(&display->cmap, 0, 0))) - return err; - do_install_cmap(con, &info->fb_info); - } - - return 0; } -static void -aty128_set_dispsw(struct display *disp, - struct fb_info_aty128 *info, int bpp, int accel) -{ - switch (bpp) { -#ifdef FBCON_HAS_CFB8 - case 8: - disp->dispsw = accel ? &fbcon_aty128_8 : &fbcon_cfb8; - break; -#endif -#ifdef FBCON_HAS_CFB16 - case 15: - case 16: - disp->dispsw = accel ? &fbcon_aty128_16 : &fbcon_cfb16; - disp->dispsw_data = info->fbcon_cmap.cfb16; - break; -#endif -#ifdef FBCON_HAS_CFB24 - case 24: - disp->dispsw = accel ? &fbcon_aty128_24 : &fbcon_cfb24; - disp->dispsw_data = info->fbcon_cmap.cfb24; - break; -#endif -#ifdef FBCON_HAS_CFB32 - case 32: - disp->dispsw = accel ? &fbcon_aty128_32 : &fbcon_cfb32; - disp->dispsw_data = info->fbcon_cmap.cfb32; - break; -#endif - default: - disp->dispsw = &fbcon_dummy; - } -} - - -static void -aty128_encode_fix(struct fb_fix_screeninfo *fix, - struct aty128fb_par *par, - const struct fb_info_aty128 *info) -{ - memset(fix, 0, sizeof(struct fb_fix_screeninfo)); - - strcpy(fix->id, aty128fb_name); - - fix->smem_start = (unsigned long)info->frame_buffer_phys; - fix->mmio_start = (unsigned long)info->regbase_phys; - - fix->smem_len = info->vram_size; - fix->mmio_len = 0x1fff; - - fix->type = FB_TYPE_PACKED_PIXELS; - fix->type_aux = 0; - fix->line_length = (par->crtc.vxres * par->crtc.bpp) >> 3; - fix->visual = par->crtc.bpp <= 8 ? FB_VISUAL_PSEUDOCOLOR - : FB_VISUAL_DIRECTCOLOR; - fix->ywrapstep = 0; - fix->xpanstep = 8; - fix->ypanstep = 1; - - fix->accel = FB_ACCEL_ATI_RAGE128; - - return; -} - - - /* - * Get the Fixed Part of the Display - */ -static int -aty128fb_get_fix(struct fb_fix_screeninfo *fix, int con, struct fb_info *fb) -{ - const struct fb_info_aty128 *info = (struct fb_info_aty128 *)fb; - struct aty128fb_par par; - - if (con == -1) - par = info->default_par; - else - aty128_decode_var(&fb_display[con].var, &par, info); - - aty128_encode_fix(fix, &par, info); - - return 0; -} - - - /* - * Pan or Wrap the Display - * - * Not supported (yet!) - */ +/* + * Pan or Wrap the Display + */ static int aty128fb_pan_display(struct fb_var_screeninfo *var, int con, - struct fb_info *fb) + struct fb_info *fb) { - struct fb_info_aty128 *info = (struct fb_info_aty128 *)fb; - struct aty128fb_par *par = &info->current_par; - u32 xoffset, yoffset; - u32 offset; - u32 xres, yres; + struct aty128fb_par *par = fb->par; + u32 xoffset, yoffset; + u32 offset; + u32 xres, yres; - xres = (((par->crtc.h_total >> 16) & 0xff) + 1) << 3; - yres = ((par->crtc.v_total >> 16) & 0x7ff) + 1; + xres = (((par->crtc.h_total >> 16) & 0xff) + 1) << 3; + yres = ((par->crtc.v_total >> 16) & 0x7ff) + 1; - xoffset = (var->xoffset +7) & ~7; - yoffset = var->yoffset; + xoffset = (var->xoffset +7) & ~7; + yoffset = var->yoffset; - if (xoffset+xres > par->crtc.vxres || yoffset+yres > par->crtc.vyres) - return -EINVAL; + if (xoffset+xres > par->crtc.vxres || yoffset+yres > par->crtc.vyres) + return -EINVAL; - par->crtc.xoffset = xoffset; - par->crtc.yoffset = yoffset; + par->crtc.xoffset = xoffset; + par->crtc.yoffset = yoffset; - offset = ((yoffset * par->crtc.vxres + xoffset) * par->crtc.bpp) >> 6; + offset = ((yoffset * par->crtc.vxres + xoffset)*(par->crtc.bpp >> 3)) & ~7; - aty_st_le32(CRTC_OFFSET, offset); + if (par->crtc.bpp == 24) + offset += 8 * (offset % 3); /* Must be multiple of 8 and 3 */ - return 0; + aty_st_le32(CRTC_OFFSET, offset); + + return 0; } - /* - * Get the Colormap - */ - -static int -aty128fb_get_cmap(struct fb_cmap *cmap, int kspc, int con, - struct fb_info *info) +/* + * Helper function to store a single palette register + */ +static void +aty128_st_pal(u_int regno, u_int red, u_int green, u_int blue, + struct aty128fb_par *par) { -#if 1 - fb_copy_cmap(&info->cmap, cmap, kspc ? 0 : 2); -#else - struct fb_info_aty128 fb = (struct fb_info_aty128 *)info; - - if (con == info->currcon) /* current console? */ - return fb_get_cmap(cmap, kspc, aty128_getcolreg, info); - else if (fb_display[con].cmap.len) /* non default colormap? */ - fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2); - else { - int size = (fb_display[con].var.bits_per_pixel <= 8) ? 256 : 32; - fb_copy_cmap(fb_default_cmap(size), cmap, kspc ? 0 : 2); - } + if (par->chip_gen == rage_M3) { +#if 0 + /* Note: For now, on M3, we set palette on both heads, which may + * be useless. Can someone with a M3 check this ? + * + * This code would still be useful if using the second CRTC to + * do mirroring + */ + + aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) | DAC_PALETTE_ACCESS_CNTL); + aty_st_8(PALETTE_INDEX, regno); + aty_st_le32(PALETTE_DATA, (red<<16)|(green<<8)|blue); #endif + aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) & ~DAC_PALETTE_ACCESS_CNTL); + } - return 0; + aty_st_8(PALETTE_INDEX, regno); + aty_st_le32(PALETTE_DATA, (red<<16)|(green<<8)|blue); } static int aty128fb_rasterimg(struct fb_info *info, int start) { - struct fb_info_aty128 *fb = (struct fb_info_aty128 *)info; + struct aty128fb_par *par = info->par; - if (fb->blitter_may_be_busy) - wait_for_idle(fb); + if (par->blitter_may_be_busy) + wait_for_idle(par); - return 0; + return 0; } int __init aty128fb_setup(char *options) { - char *this_opt; + char *this_opt; - if (!options || !*options) - return 0; + if (!options || !*options) + return 0; - while ((this_opt = strsep(&options, ",")) != NULL) { - if (!strncmp(this_opt, "font:", 5)) { - char *p; - int i; + while ((this_opt = strsep(&options, ",")) != NULL) { + if (!strncmp(this_opt, "font:", 5)) { + char *p; + int i; - p = this_opt +5; - for (i = 0; i < sizeof(fontname) - 1; i++) - if (!*p || *p == ' ' || *p == ',') - break; - memcpy(fontname, this_opt + 5, i); - fontname[i] = 0; - } else if (!strncmp(this_opt, "noaccel", 7)) { - noaccel = 1; - } + p = this_opt +5; + for (i = 0; i < sizeof(fontname) - 1; i++) + if (!*p || *p == ' ' || *p == ',') + break; + memcpy(fontname, this_opt + 5, i); + fontname[i] = 0; + } else if (!strncmp(this_opt, "noaccel", 7)) { + noaccel = 1; +#ifdef CONFIG_PMAC_PBOOK + } else if (!strncmp(this_opt, "lcd:", 4)) { + default_lcd_on = simple_strtoul(this_opt+4, NULL, 0); + } else if (!strncmp(this_opt, "crt:", 4)) { + default_crt_on = simple_strtoul(this_opt+4, NULL, 0); +#endif + } #ifdef CONFIG_MTRR - else if(!strncmp(this_opt, "nomtrr", 6)) { - mtrr = 0; - } + else if(!strncmp(this_opt, "nomtrr", 6)) { + mtrr = 0; + } #endif -#ifdef CONFIG_PPC - /* vmode and cmode depreciated */ - else if (!strncmp(this_opt, "vmode:", 6)) { - unsigned int vmode = simple_strtoul(this_opt+6, NULL, 0); - if (vmode > 0 && vmode <= VMODE_MAX) - default_vmode = vmode; - } else if (!strncmp(this_opt, "cmode:", 6)) { - unsigned int cmode = simple_strtoul(this_opt+6, NULL, 0); - switch (cmode) { - case 0: - case 8: - default_cmode = CMODE_8; - break; - case 15: - case 16: - default_cmode = CMODE_16; - break; - case 24: - case 32: - default_cmode = CMODE_32; - break; - } - } -#endif /* CONFIG_PPC */ - else - mode_option = this_opt; - } - return 0; +#ifdef CONFIG_ALL_PPC + /* vmode and cmode depreciated */ + else if (!strncmp(this_opt, "vmode:", 6)) { + unsigned int vmode = simple_strtoul(this_opt+6, NULL, 0); + if (vmode > 0 && vmode <= VMODE_MAX) + default_vmode = vmode; + } else if (!strncmp(this_opt, "cmode:", 6)) { + unsigned int cmode = simple_strtoul(this_opt+6, NULL, 0); + switch (cmode) { + case 0: + case 8: + default_cmode = CMODE_8; + break; + case 15: + case 16: + default_cmode = CMODE_16; + break; + case 24: + case 32: + default_cmode = CMODE_32; + break; + } + } +#endif /* CONFIG_ALL_PPC */ + else + mode_option = this_opt; + } + return 0; } - /* - * Initialisation - */ +/* + * Initialisation + */ static int __init -aty128_init(struct fb_info_aty128 *info, const char *name) +aty128_init(struct fb_info *info, const char *name) { - struct fb_var_screeninfo var; - u32 dac; - int j, k, size; - u8 chip_rev; - const struct aty128_chip_info *aci = &aty128_pci_probe_list[0]; - char *video_card = "Rage128"; - - if (!info->vram_size) /* may have already been probed */ - info->vram_size = aty_ld_le32(CONFIG_MEMSIZE) & 0x03FFFFFF; - - /* Get the chip revision */ - chip_rev = (aty_ld_le32(CONFIG_CNTL) >> 16) & 0x1F; - - /* put a name with the face */ - while (aci->name && info->pdev->device != aci->device) { aci++; } - video_card = (char *)aci->name; - info->chip_gen = aci->chip_gen; - - printk(KERN_INFO "aty128fb: %s [chip rev 0x%x] ", video_card, chip_rev); - - if (info->vram_size % (1024 * 1024) == 0) - printk("%dM %s\n", info->vram_size / (1024*1024), info->mem->name); - else - printk("%dk %s\n", info->vram_size / 1024, info->mem->name); - - /* fill in info */ - strcpy(info->fb_info.modename, aty128fb_name); - info->fb_info.node = NODEV; - info->fb_info.fbops = &aty128fb_ops; - info->fb_info.disp = &info->disp; - strcpy(info->fb_info.fontname, fontname); - info->fb_info.changevar = NULL; - info->fb_info.switch_con = &aty128fbcon_switch; - info->fb_info.updatevar = NULL; - info->fb_info.flags = FBINFO_FLAG_DEFAULT; - - var = default_var; -#ifdef CONFIG_PPC - if (_machine == _MACH_Pmac) { - if (mode_option) { - if (!mac_find_mode(&var, &info->fb_info, mode_option, 8)) - var = default_var; - } else { - if (default_vmode <= 0 || default_vmode > VMODE_MAX) - default_vmode = VMODE_1024_768_60; - - /* iMacs need that resolution - * PowerMac2,1 first r128 iMacs - * PowerMac2,2 summer 2000 iMacs - * PowerMac4,1 january 2001 iMacs "flower power" - */ - if (machine_is_compatible("PowerMac2,1") || - machine_is_compatible("PowerMac2,2") || - machine_is_compatible("PowerMac4,1")) - default_vmode = VMODE_1024_768_75; - - /* iBook SE */ - if (machine_is_compatible("PowerBook2,2")) - default_vmode = VMODE_800_600_60; - - /* PowerBook Firewire (Pismo), iBook Dual USB */ - if (machine_is_compatible("PowerBook3,1") || - machine_is_compatible("PowerBook4,1")) - default_vmode = VMODE_1024_768_60; - - /* PowerBook Titanium */ - if (machine_is_compatible("PowerBook3,2")) - default_vmode = VMODE_1152_768_60; - - if (default_cmode < CMODE_8 || default_cmode > CMODE_32) - default_cmode = CMODE_8; - - if (mac_vmode_to_var(default_vmode, default_cmode, &var)) - var = default_var; - } - } else -#endif /* CONFIG_PPC */ - { - if (fb_find_mode(&var, &info->fb_info, mode_option, NULL, 0, - &defaultmode, 8) == 0) - var = default_var; - } + struct aty128fb_par *par = info->par; + struct fb_var_screeninfo var; + u32 dac; + u8 chip_rev; + const struct aty128_chip_info *aci = &aty128_pci_probe_list[0]; + const char *video_card; - if (noaccel) - var.accel_flags &= ~FB_ACCELF_TEXT; - else - var.accel_flags |= FB_ACCELF_TEXT; + if (!par->vram_size) /* may have already been probed */ + par->vram_size = aty_ld_le32(CONFIG_MEMSIZE) & 0x03FFFFFF; - if (aty128_decode_var(&var, &info->default_par, info)) { - printk(KERN_ERR "aty128fb: Cannot set default mode.\n"); - return 0; - } + /* Get the chip revision */ + chip_rev = (aty_ld_le32(CONFIG_CNTL) >> 16) & 0x1F; - /* load up the palette with default colors */ - for (j = 0; j < 16; j++) { - k = color_table[j]; - info->palette[j].red = default_red[k]; - info->palette[j].green = default_grn[k]; - info->palette[j].blue = default_blu[k]; - } + /* put a name with the face */ + while (aci->name && par->pdev->device != aci->device) + aci++; + video_card = aci->name? aci->name: "Rage128"; + par->chip_gen = aci->chip_gen; - /* setup the DAC the way we like it */ - dac = aty_ld_le32(DAC_CNTL); - dac |= (DAC_8BIT_EN | DAC_RANGE_CNTL); - dac |= DAC_MASK; - aty_st_le32(DAC_CNTL, dac); + printk(KERN_INFO "aty128fb: %s [chip rev 0x%x] ", video_card, chip_rev); - /* turn off bus mastering, just in case */ - aty_st_le32(BUS_CNTL, aty_ld_le32(BUS_CNTL) | BUS_MASTER_DIS); + if (par->vram_size % (1024 * 1024) == 0) + printk("%dM %s\n", par->vram_size / (1024*1024), par->mem->name); + else + printk("%dk %s\n", par->vram_size / 1024, par->mem->name); + + /* fill in info */ + strcpy(info->modename, aty128fb_name); + info->node = NODEV; + info->fbops = &aty128fb_ops; + strcpy(info->fontname, fontname); + info->changevar = NULL; + info->switch_con = gen_switch; + info->updatevar = gen_update_var; + info->flags = FBINFO_FLAG_DEFAULT; + +#ifdef CONFIG_PMAC_PBOOK + par->lcd_on = default_lcd_on; + par->crt_on = default_crt_on; +#endif - aty128fb_set_var(&var, -1, &info->fb_info); - aty128_init_engine(&info->default_par, info); + var = default_var; +#ifdef CONFIG_ALL_PPC + if (_machine == _MACH_Pmac) { + if (mode_option) { + if (!mac_find_mode(&var, info, mode_option, 8)) + var = default_var; + } else { + if (default_vmode <= 0 || default_vmode > VMODE_MAX) + default_vmode = VMODE_1024_768_60; + + /* iMacs need that resolution + * PowerMac2,1 first r128 iMacs + * PowerMac2,2 summer 2000 iMacs + * PowerMac4,1 january 2001 iMacs "flower power" + */ + if (machine_is_compatible("PowerMac2,1") || + machine_is_compatible("PowerMac2,2") || + machine_is_compatible("PowerMac4,1")) + default_vmode = VMODE_1024_768_75; + + /* iBook SE */ + if (machine_is_compatible("PowerBook2,2")) + default_vmode = VMODE_800_600_60; + + /* PowerBook Firewire (Pismo), iBook Dual USB */ + if (machine_is_compatible("PowerBook3,1") || + machine_is_compatible("PowerBook4,1")) + default_vmode = VMODE_1024_768_60; + + /* PowerBook Titanium */ + if (machine_is_compatible("PowerBook3,2")) + default_vmode = VMODE_1152_768_60; + + if (default_cmode < CMODE_8 || default_cmode > CMODE_32) + default_cmode = CMODE_8; - board_list = aty128_board_list_add(board_list, info); + if (mac_vmode_to_var(default_vmode, default_cmode, &var)) + var = default_var; + } + } else +#endif /* CONFIG_ALL_PPC */ + { + if (fb_find_mode(&var, info, mode_option, NULL, 0, + &defaultmode, 8) == 0) + var = default_var; + } - size = (var.bits_per_pixel <= 8) ? 256 : 32; - fb_alloc_cmap(&info->fb_info.cmap, size, 0); + if (noaccel) + var.accel_flags &= ~FB_ACCELF_TEXT; + else + var.accel_flags |= FB_ACCELF_TEXT; - if (register_framebuffer(&info->fb_info) < 0) - return 0; + if (aty128fb_check_var(&var, info)) { + printk(KERN_ERR "aty128fb: Cannot set default mode.\n"); + return 0; + } -#ifdef CONFIG_PMAC_BACKLIGHT - /* Could be extended to Rage128Pro LVDS output too */ - if (info->chip_gen == rage_M3) - register_backlight_controller(&aty128_backlight_controller, info, "ati"); -#endif /* CONFIG_PMAC_BACKLIGHT */ + /* setup the DAC the way we like it */ + dac = aty_ld_le32(DAC_CNTL); + dac |= (DAC_8BIT_EN | DAC_RANGE_CNTL); + dac |= DAC_MASK; + if (par->chip_gen == rage_M3) + dac |= DAC_PALETTE2_SNOOP_EN; + aty_st_le32(DAC_CNTL, dac); - printk(KERN_INFO "fb%d: %s frame buffer device on %s\n", - GET_FB_IDX(info->fb_info.node), aty128fb_name, name); + /* turn off bus mastering, just in case */ + aty_st_le32(BUS_CNTL, aty_ld_le32(BUS_CNTL) | BUS_MASTER_DIS); - return 1; /* success! */ -} + info->var = var; + fb_alloc_cmap(&info->cmap, 256, 0); + gen_set_disp(-1, info); + var.activate = FB_ACTIVATE_NOW; + gen_set_var(&var, -1, info); -/* add a new card to the list ++ajoshi */ -static struct -fb_info_aty128 *aty128_board_list_add(struct fb_info_aty128 *board_list, - struct fb_info_aty128 *new_node) -{ - struct fb_info_aty128 *i_p = board_list; + aty128_init_engine(par); - new_node->next = NULL; - if(board_list == NULL) - return new_node; - while(i_p->next != NULL) - i_p = i_p->next; - i_p->next = new_node; + if (register_framebuffer(info) < 0) + return 0; - return board_list; +#ifdef CONFIG_PMAC_BACKLIGHT + /* Could be extended to Rage128Pro LVDS output too */ + if (par->chip_gen == rage_M3) + register_backlight_controller(&aty128_backlight_controller, par, "ati"); +#endif /* CONFIG_PMAC_BACKLIGHT */ +#ifdef CONFIG_PMAC_PBOOK + if (!par->pdev) + printk(KERN_WARNING "aty128fb: Not a PCI card, can't enable power management\n"); + else { + par->pm_reg = pci_find_capability(par->pdev, PCI_CAP_ID_PM); + pmu_register_sleep_notifier(&aty128_sleep_notifier); + } +#endif + + printk(KERN_INFO "fb%d: %s frame buffer device on %s\n", + GET_FB_IDX(info->node), aty128fb_name, name); + + return 1; /* success! */ } @@ -1789,21 +1626,21 @@ int __init aty128fb_init(void) { #ifdef CONFIG_PCI - struct pci_dev *pdev = NULL; - const struct aty128_chip_info *aci = &aty128_pci_probe_list[0]; - - while (aci->name != NULL) { - pdev = pci_find_device(PCI_VENDOR_ID_ATI, aci->device, pdev); - while (pdev != NULL) { - if (aty128_pci_register(pdev, aci) == 0) - return 0; - pdev = pci_find_device(PCI_VENDOR_ID_ATI, aci->device, pdev); - } - aci++; - } + struct pci_dev *pdev = NULL; + const struct aty128_chip_info *aci = &aty128_pci_probe_list[0]; + + while (aci->name != NULL) { + pdev = pci_find_device(PCI_VENDOR_ID_ATI, aci->device, pdev); + while (pdev != NULL) { + if (aty128_pci_register(pdev, aci) == 0) + return 0; + pdev = pci_find_device(PCI_VENDOR_ID_ATI, aci->device, pdev); + } + aci++; + } #endif - return 0; + return 0; } @@ -1813,7 +1650,9 @@ static int __init aty128_pci_register(struct pci_dev *pdev, const struct aty128_chip_info *aci) { - struct fb_info_aty128 *info = NULL; + struct fb_info_aty128 *lump = NULL; + struct fb_info *info; + struct aty128fb_par *par; unsigned long fb_addr, reg_addr; int err; #if !defined(CONFIG_PPC) && !defined(__sparc__) @@ -1824,7 +1663,7 @@ aty128_pci_register(struct pci_dev *pdev, if ((err = pci_enable_device(pdev))) { printk(KERN_ERR "aty128fb: Cannot enable PCI device: %d\n", err); - goto err_out; + return -ENODEV; } fb_addr = pci_resource_start(pdev, 0); @@ -1843,38 +1682,46 @@ aty128_pci_register(struct pci_dev *pdev, } /* We have the resources. Now virtualize them */ - if (!(info = kmalloc(sizeof(struct fb_info_aty128), GFP_ATOMIC))) { + if (!(lump = kmalloc(sizeof(struct fb_info_aty128), GFP_ATOMIC))) { printk(KERN_ERR "aty128fb: can't alloc fb_info_aty128\n"); goto err_unmap_out; } - memset(info, 0, sizeof(struct fb_info_aty128)); + memset(lump, 0, sizeof(struct fb_info_aty128)); + info = &lump->fb_info; + par = &lump->par; - /* Copy PCI device info into info->pdev */ - info->pdev = pdev; + info->par = par; + info->disp = &lump->disp; + info->fix = aty128fb_fix; + info->currcon = -1; + info->pseudo_palette = lump->pseudo_palette; - info->fb_info.currcon = -1; + par->pdev = pdev; /* Virtualize mmio region */ - info->regbase_phys = reg_addr; - info->regbase = ioremap(reg_addr, 0x1FFF); - - if (!info->regbase) + info->fix.mmio_start = reg_addr; + par->regbase = ioremap(reg_addr, 0x2000); + if (!par->regbase) goto err_free_info; /* Grab memory size from the card */ - info->vram_size = aty_ld_le32(CONFIG_MEMSIZE) & 0x03FFFFFF; + par->vram_size = aty_ld_le32(CONFIG_MEMSIZE) & 0x03FFFFFF; /* Virtualize the framebuffer */ - info->frame_buffer_phys = fb_addr; - info->frame_buffer = ioremap(fb_addr, info->vram_size); - - if (!info->frame_buffer) { - iounmap((void *)info->regbase); + info->screen_base = ioremap(fb_addr, par->vram_size); + if (!info->screen_base) { + iounmap(par->regbase); goto err_free_info; } + /* Set up info->fix */ + info->fix = aty128fb_fix; + info->fix.smem_start = fb_addr; + info->fix.smem_len = par->vram_size; + info->fix.mmio_start = reg_addr; + /* If we can't test scratch registers, something is seriously wrong */ - if (!register_test(info)) { + if (!register_test(par)) { printk(KERN_ERR "aty128fb: Can't write to video register!\n"); goto err_out; } @@ -1889,14 +1736,17 @@ aty128_pci_register(struct pci_dev *pdev, aty128_get_pllinfo(info, bios_seg); } #endif - aty128_timings(info); + aty128_timings(par); if (!aty128_init(info, "PCI")) goto err_out; + lump->next = board_list; + board_list = lump; + #ifdef CONFIG_MTRR if (mtrr) { - info->mtrr.vram = mtrr_add(info->frame_buffer_phys, + info->mtrr.vram = mtrr_add(info->fix.smem_start, info->vram_size, MTRR_TYPE_WRCOMB, 1); info->mtrr.vram_valid = 1; /* let there be speed */ @@ -1906,10 +1756,10 @@ aty128_pci_register(struct pci_dev *pdev, return 0; err_out: - iounmap(info->frame_buffer); - iounmap(info->regbase); + iounmap(info->screen_base); + iounmap(par->regbase); err_free_info: - kfree(info); + kfree(lump); err_unmap_out: release_mem_region(pci_resource_start(pdev, 2), pci_resource_len(pdev, 2)); @@ -1926,8 +1776,7 @@ err_free_fb: /* PPC and Sparc cannot read video ROM */ #if !defined(CONFIG_PPC) && !defined(__sparc__) -static char __init -*aty128find_ROM(struct fb_info_aty128 *info) +static char * __init aty128find_ROM(void) { u32 segstart; char *rom_base; @@ -1985,7 +1834,7 @@ static char __init static void __init -aty128_get_pllinfo(struct fb_info_aty128 *info, char *bios_seg) +aty128_get_pllinfo(struct aty128fb_par *par, char *bios_seg) { void *bios_header; void *header_ptr; @@ -2005,16 +1854,16 @@ aty128_get_pllinfo(struct fb_info_aty128 *info, char *bios_seg) memcpy_fromio(&pll, header_ptr, 50); - info->constants.ppll_max = pll.PCLK_max_freq; - info->constants.ppll_min = pll.PCLK_min_freq; - info->constants.xclk = (u32)pll.XCLK; - info->constants.ref_divider = (u32)pll.PCLK_ref_divider; - info->constants.dotclock = (u32)pll.PCLK_ref_freq; + par->constants.ppll_max = pll.PCLK_max_freq; + par->constants.ppll_min = pll.PCLK_min_freq; + par->constants.xclk = (u32)pll.XCLK; + par->constants.ref_divider = (u32)pll.PCLK_ref_divider; + par->constants.dotclock = (u32)pll.PCLK_ref_freq; DBG("ppll_max %d ppll_min %d xclk %d ref_divider %d dotclock %d\n", - info->constants.ppll_max, info->constants.ppll_min, - info->constants.xclk, info->constants.ref_divider, - info->constants.dotclock); + par->constants.ppll_max, par->constants.ppll_min, + par->constants.xclk, par->constants.ref_divider, + par->constants.dotclock); } #endif /* !CONFIG_PPC */ @@ -2022,244 +1871,212 @@ aty128_get_pllinfo(struct fb_info_aty128 *info, char *bios_seg) /* fill in known card constants if pll_block is not available */ static void __init -aty128_timings(struct fb_info_aty128 *info) +aty128_timings(struct aty128fb_par *par) { -#ifdef CONFIG_PPC - /* instead of a table lookup, assume OF has properly - * setup the PLL registers and use their values - * to set the XCLK values and reference divider values */ - - u32 x_mpll_ref_fb_div; - u32 xclk_cntl; - u32 Nx, M; - unsigned PostDivSet[] = - { 0, 1, 2, 4, 8, 3, 6, 12 }; -#endif - - if (!info->constants.dotclock) - info->constants.dotclock = 2950; - -#ifdef CONFIG_PPC - x_mpll_ref_fb_div = aty_ld_pll(X_MPLL_REF_FB_DIV); - xclk_cntl = aty_ld_pll(XCLK_CNTL) & 0x7; - Nx = (x_mpll_ref_fb_div & 0x00ff00) >> 8; - M = x_mpll_ref_fb_div & 0x0000ff; - - info->constants.xclk = round_div((2 * Nx * - info->constants.dotclock), (M * PostDivSet[xclk_cntl])); +#ifdef CONFIG_ALL_PPC + /* instead of a table lookup, assume OF has properly + * setup the PLL registers and use their values + * to set the XCLK values and reference divider values */ - info->constants.ref_divider = - aty_ld_pll(PPLL_REF_DIV) & PPLL_REF_DIV_MASK; + u32 x_mpll_ref_fb_div; + u32 xclk_cntl; + u32 Nx, M; + unsigned PostDivSet[] = { 0, 1, 2, 4, 8, 3, 6, 12 }; #endif - if (!info->constants.ref_divider) { - info->constants.ref_divider = 0x3b; + if (!par->constants.dotclock) + par->constants.dotclock = 2950; - aty_st_pll(X_MPLL_REF_FB_DIV, 0x004c4c1e); - aty_pll_writeupdate(info); - } - aty_st_pll(PPLL_REF_DIV, info->constants.ref_divider); - aty_pll_writeupdate(info); - - /* from documentation */ - if (!info->constants.ppll_min) - info->constants.ppll_min = 12500; - if (!info->constants.ppll_max) - info->constants.ppll_max = 25000; /* 23000 on some cards? */ - if (!info->constants.xclk) - info->constants.xclk = 0x1d4d; /* same as mclk */ - - info->constants.fifo_width = 128; - info->constants.fifo_depth = 32; - - switch (aty_ld_le32(MEM_CNTL) & 0x3) { - case 0: - info->mem = &sdr_128; - break; - case 1: - info->mem = &sdr_sgram; - break; - case 2: - info->mem = &ddr_sgram; - break; - default: - info->mem = &sdr_sgram; - } -} - - -static int -aty128fbcon_switch(int con, struct fb_info *fb) -{ - struct fb_info_aty128 *info = (struct fb_info_aty128 *)fb; - struct aty128fb_par par; +#ifdef CONFIG_ALL_PPC + x_mpll_ref_fb_div = aty_ld_pll(X_MPLL_REF_FB_DIV); + xclk_cntl = aty_ld_pll(XCLK_CNTL) & 0x7; + Nx = (x_mpll_ref_fb_div & 0x00ff00) >> 8; + M = x_mpll_ref_fb_div & 0x0000ff; - /* Do we have to save the colormap? */ - if (fb_display[fb->currcon].cmap.len) - fb_get_cmap(&fb_display[fb->currcon].cmap, 1, - aty128_getcolreg, fb); + par->constants.xclk = round_div((2 * Nx * par->constants.dotclock), + (M * PostDivSet[xclk_cntl])); - /* set the current console */ - fb->currcon = con; - - aty128_decode_var(&fb_display[con].var, &par, info); - aty128_set_par(&par, info); - - aty128_set_dispsw(&fb_display[con], info, par.crtc.bpp, - par.accel_flags & FB_ACCELF_TEXT); + par->constants.ref_divider = + aty_ld_pll(PPLL_REF_DIV) & PPLL_REF_DIV_MASK; +#endif - do_install_cmap(con, fb); + if (!par->constants.ref_divider) { + par->constants.ref_divider = 0x3b; - return 1; + aty_st_pll(X_MPLL_REF_FB_DIV, 0x004c4c1e); + aty_pll_writeupdate(par); + } + aty_st_pll(PPLL_REF_DIV, par->constants.ref_divider); + aty_pll_writeupdate(par); + + /* from documentation */ + if (!par->constants.ppll_min) + par->constants.ppll_min = 12500; + if (!par->constants.ppll_max) + par->constants.ppll_max = 25000; /* 23000 on some cards? */ + if (!par->constants.xclk) + par->constants.xclk = 0x1d4d; /* same as mclk */ + + par->constants.fifo_width = 128; + par->constants.fifo_depth = 32; + + switch (aty_ld_le32(MEM_CNTL) & 0x3) { + case 0: + par->mem = &sdr_128; + break; + case 1: + par->mem = &sdr_sgram; + break; + case 2: + par->mem = &ddr_sgram; + break; + default: + par->mem = &sdr_sgram; + } } /* * Blank the display. */ -static int +static int aty128fb_blank(int blank, struct fb_info *fb) { - struct fb_info_aty128 *info = (struct fb_info_aty128 *)fb; - u8 state = 0; + struct aty128fb_par *par = fb->par; + u8 state = 0; #ifdef CONFIG_PMAC_BACKLIGHT - if ((_machine == _MACH_Pmac) && blank) - set_backlight_enable(0); + if ((_machine == _MACH_Pmac) && blank) + set_backlight_enable(0); #endif /* CONFIG_PMAC_BACKLIGHT */ - if (blank & VESA_VSYNC_SUSPEND) - state |= 2; - if (blank & VESA_HSYNC_SUSPEND) - state |= 1; - if (blank & VESA_POWERDOWN) - state |= 4; + if (blank & VESA_VSYNC_SUSPEND) + state |= 2; + if (blank & VESA_HSYNC_SUSPEND) + state |= 1; + if (blank & VESA_POWERDOWN) + state |= 4; - aty_st_8(CRTC_EXT_CNTL+1, state); + aty_st_8(CRTC_EXT_CNTL+1, state); +#ifdef CONFIG_PMAC_PBOOK + if (par->chip_gen == rage_M3) { + aty128_set_crt_enable(par, par->crt_on && !blank); + aty128_set_lcd_enable(par, par->lcd_on && !blank); + } +#endif #ifdef CONFIG_PMAC_BACKLIGHT - if ((_machine == _MACH_Pmac) && !blank) - set_backlight_enable(1); + if ((_machine == _MACH_Pmac) && !blank) + set_backlight_enable(1); #endif /* CONFIG_PMAC_BACKLIGHT */ - return 0; -} - - /* - * Read a single color register and split it into - * colors/transparent. Return != 0 for invalid regno. - */ -static int -aty128_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue, - u_int *transp, struct fb_info *fb) -{ - struct fb_info_aty128 *info = (struct fb_info_aty128 *) fb; - - if (regno > 255) - return 1; - - *red = (info->palette[regno].red<<8) | info->palette[regno].red; - *green = (info->palette[regno].green<<8) | info->palette[regno].green; - *blue = (info->palette[regno].blue<<8) | info->palette[regno].blue; - *transp = 0; - - return 0; + return 0; } - /* - * Set a single color register. The values supplied are already - * rounded down to the hardware's capabilities (according to the - * entries in the var structure). Return != 0 for invalid regno. - */ +/* + * Set a single color register. The values supplied are already + * rounded down to the hardware's capabilities (according to the + * entries in the var structure). Return != 0 for invalid regno. + */ static int aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, - u_int transp, struct fb_info *fb) -{ - struct fb_info_aty128 *info = (struct fb_info_aty128 *)fb; - u32 col; - - if (regno > 255) - return 1; - - red >>= 8; - green >>= 8; - blue >>= 8; - info->palette[regno].red = red; - info->palette[regno].green = green; - info->palette[regno].blue = blue; - - /* Note: For now, on M3, we set palette on both heads, which may - * be useless. Can someone with a M3 check this ? */ - - /* initialize gamma ramp for hi-color+ */ - - if ((info->current_par.crtc.bpp > 8) && (regno == 0)) { - int i; - - if (info->chip_gen == rage_M3) - aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) & ~DAC_PALETTE_ACCESS_CNTL); + u_int transp, struct fb_info *info) +{ + struct aty128fb_par *par = info->par; + + if (regno > 255 + || (par->crtc.depth == 16 && regno > 63) + || (par->crtc.depth == 15 && regno > 31)) + return 1; + + red >>= 8; + green >>= 8; + blue >>= 8; + + if (regno < 16) { + int i; + switch (par->crtc.depth) { + case 15: + ((u16 *) (info->pseudo_palette))[regno] = + (regno << 10) | (regno << 5) | regno; + break; + case 16: + ((u16 *) (info->pseudo_palette))[regno] = + (regno << 11) | (regno << 6) | regno; + break; + case 24: + ((u32 *) (info->pseudo_palette))[regno] = + (regno << 16) | (regno << 8) | regno; + break; + case 32: + i = (regno << 8) | regno; + ((u32 *) (info->pseudo_palette))[regno] = + (i << 16) | i; + break; + } + } - for (i=16; i<256; i++) { - aty_st_8(PALETTE_INDEX, i); - col = (i << 16) | (i << 8) | i; - aty_st_le32(PALETTE_DATA, col); - } + if (par->crtc.depth == 16) { + /* + * With the 5-6-5 split of bits for RGB at 16 bits/pixel, we + * have 32 slots for R and B values but 64 slots for G values. + * Thus the R and B values go in one slot but the G value + * goes in a different slot, and we have to avoid disturbing + * the other fields in the slots we touch. + */ + par->red[regno] = red; + par->green[regno] = green; + par->blue[regno] = blue; + if (regno > 0 && regno < 32) + aty128_st_pal(regno * 8, red, par->green[regno*2], + blue, par); + red = par->red[regno/2]; + blue = par->blue[regno/2]; + regno <<= 2; + } else if (par->crtc.bpp == 16) + regno <<= 3; + aty128_st_pal(regno, red, green, blue, par); - if (info->chip_gen == rage_M3) { - aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) | DAC_PALETTE_ACCESS_CNTL); + return 0; +} - for (i=16; i<256; i++) { - aty_st_8(PALETTE_INDEX, i); - col = (i << 16) | (i << 8) | i; - aty_st_le32(PALETTE_DATA, col); - } - } - } +#define ATY_MIRROR_LCD_ON 0x00000001 +#define ATY_MIRROR_CRT_ON 0x00000002 - /* initialize palette */ - - if (info->chip_gen == rage_M3) - aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) & ~DAC_PALETTE_ACCESS_CNTL); - - if (info->current_par.crtc.bpp == 16) - aty_st_8(PALETTE_INDEX, (regno << 3)); - else - aty_st_8(PALETTE_INDEX, regno); - col = (red << 16) | (green << 8) | blue; - aty_st_le32(PALETTE_DATA, col); - if (info->chip_gen == rage_M3) { - aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) | DAC_PALETTE_ACCESS_CNTL); - if (info->current_par.crtc.bpp == 16) - aty_st_8(PALETTE_INDEX, (regno << 3)); - else - aty_st_8(PALETTE_INDEX, regno); - aty_st_le32(PALETTE_DATA, col); - } +/* out param: u32* backlight value: 0 to 15 */ +#define FBIO_ATY128_GET_MIRROR _IOR('@', 1, sizeof(__u32*)) +/* in param: u32* backlight value: 0 to 15 */ +#define FBIO_ATY128_SET_MIRROR _IOW('@', 2, sizeof(__u32*)) - if (regno < 16) - switch (info->current_par.crtc.bpp) { -#ifdef FBCON_HAS_CFB16 - case 9 ... 16: - info->fbcon_cmap.cfb16[regno] = (regno << 10) | (regno << 5) | - regno; - break; -#endif -#ifdef FBCON_HAS_CFB24 - case 17 ... 24: - info->fbcon_cmap.cfb24[regno] = (regno << 16) | (regno << 8) | - regno; - break; -#endif -#ifdef FBCON_HAS_CFB32 - case 25 ... 32: { - u32 i; - - i = (regno << 8) | regno; - info->fbcon_cmap.cfb32[regno] = (i << 16) | i; - break; - } -#endif +static int aty128fb_ioctl(struct inode *inode, struct file *file, u_int cmd, + u_long arg, int con, struct fb_info *info) +{ +#ifdef CONFIG_PMAC_PBOOK + struct aty128fb_par *par = info->par; + u32 value; + int rc; + + switch (cmd) { + case FBIO_ATY128_SET_MIRROR: + if (par->chip_gen != rage_M3) + return -EINVAL; + rc = get_user(value, (__u32*)arg); + if (rc) + return rc; + par->lcd_on = (value & 0x01) != 0; + par->crt_on = (value & 0x02) != 0; + if (!par->crt_on && !par->lcd_on) + par->lcd_on = 1; + aty128_set_crt_enable(par, par->crt_on); + aty128_set_lcd_enable(par, par->lcd_on); + return 0; + case FBIO_ATY128_GET_MIRROR: + if (par->chip_gen != rage_M3) + return -EINVAL; + value = (par->crt_on << 1) | par->lcd_on; + return put_user(value, (__u32*)arg); } - return 0; +#endif + return -EINVAL; } #ifdef CONFIG_PMAC_BACKLIGHT @@ -2268,21 +2085,58 @@ static int backlight_conv[] = { 0x73, 0x68, 0x5d, 0x52, 0x47, 0x3c, 0x31, 0x24 }; +/* We turn off the LCD completely instead of just dimming the backlight. + * This provides greater power saving and the display is useless without + * backlight anyway + */ +#define BACKLIGHT_LVDS_OFF +/* That one prevents proper CRT output with LCD off */ +#undef BACKLIGHT_DAC_OFF + static int -aty128_set_backlight_enable(int on, int level, void* data) +aty128_set_backlight_enable(int on, int level, void *data) { - struct fb_info_aty128 *info = (struct fb_info_aty128 *)data; + struct aty128fb_par *par = data; unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL); - + + if (!par->lcd_on) + on = 0; reg |= LVDS_BL_MOD_EN | LVDS_BLON; if (on && level > BACKLIGHT_OFF) { + reg |= LVDS_DIGION; + if (!reg & LVDS_ON) { + reg &= ~LVDS_BLON; + aty_st_le32(LVDS_GEN_CNTL, reg); + (void)aty_ld_le32(LVDS_GEN_CNTL); + mdelay(10); + reg |= LVDS_BLON; + aty_st_le32(LVDS_GEN_CNTL, reg); + } reg &= ~LVDS_BL_MOD_LEVEL_MASK; reg |= (backlight_conv[level] << LVDS_BL_MOD_LEVEL_SHIFT); +#ifdef BACKLIGHT_LVDS_OFF + reg |= LVDS_ON | LVDS_EN; + reg &= ~LVDS_DISPLAY_DIS; +#endif + aty_st_le32(LVDS_GEN_CNTL, reg); +#ifdef BACKLIGHT_DAC_OFF + aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) & (~DAC_PDWN)); +#endif } else { reg &= ~LVDS_BL_MOD_LEVEL_MASK; reg |= (backlight_conv[0] << LVDS_BL_MOD_LEVEL_SHIFT); +#ifdef BACKLIGHT_LVDS_OFF + reg |= LVDS_DISPLAY_DIS; + aty_st_le32(LVDS_GEN_CNTL, reg); + (void)aty_ld_le32(LVDS_GEN_CNTL); + udelay(10); + reg &= ~(LVDS_ON | LVDS_EN | LVDS_BLON | LVDS_DIGION); +#endif + aty_st_le32(LVDS_GEN_CNTL, reg); +#ifdef BACKLIGHT_DAC_OFF + aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) | DAC_PDWN); +#endif } - aty_st_le32(LVDS_GEN_CNTL, reg); return 0; } @@ -2294,6 +2148,7 @@ aty128_set_backlight_level(int level, void* data) } #endif /* CONFIG_PMAC_BACKLIGHT */ +#if 0 /* * Accelerated functions */ @@ -2301,39 +2156,39 @@ aty128_set_backlight_level(int level, void* data) static inline void aty128_rectcopy(int srcx, int srcy, int dstx, int dsty, u_int width, u_int height, - struct fb_info_aty128 *info) + struct fb_info_aty128 *par) { - u32 save_dp_datatype, save_dp_cntl, bppval; + u32 save_dp_datatype, save_dp_cntl, dstval; if (!width || !height) return; - bppval = bpp_to_depth(info->current_par.crtc.bpp); - if (bppval == DST_24BPP) { + dstval = depth_to_dst(par->current_par.crtc.depth); + if (dstval == DST_24BPP) { srcx *= 3; dstx *= 3; width *= 3; - } else if (bppval == -EINVAL) { - printk("aty128fb: invalid depth\n"); + } else if (dstval == -EINVAL) { + printk("aty128fb: invalid depth or RGBA\n"); return; } - wait_for_fifo(2, info); + wait_for_fifo(2, par); save_dp_datatype = aty_ld_le32(DP_DATATYPE); save_dp_cntl = aty_ld_le32(DP_CNTL); - wait_for_fifo(6, info); + wait_for_fifo(6, par); aty_st_le32(SRC_Y_X, (srcy << 16) | srcx); aty_st_le32(DP_MIX, ROP3_SRCCOPY | DP_SRC_RECT); aty_st_le32(DP_CNTL, DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM); - aty_st_le32(DP_DATATYPE, save_dp_datatype | bppval | SRC_DSTCOLOR); + aty_st_le32(DP_DATATYPE, save_dp_datatype | dstval | SRC_DSTCOLOR); aty_st_le32(DST_Y_X, (dsty << 16) | dstx); aty_st_le32(DST_HEIGHT_WIDTH, (height << 16) | width); - info->blitter_may_be_busy = 1; + par->blitter_may_be_busy = 1; - wait_for_fifo(2, info); + wait_for_fifo(2, par); aty_st_le32(DP_DATATYPE, save_dp_datatype); aty_st_le32(DP_CNTL, save_dp_cntl); } @@ -2357,200 +2212,128 @@ fbcon_aty128_bmove(struct display *p, int sy, int sx, int dy, int dx, aty128_rectcopy(sx, sy, dx, dy, width, height, (struct fb_info_aty128 *)p->fb_info); } +#endif /* 0 */ - -#ifdef FBCON_HAS_CFB8 -static void fbcon_aty8_putc(struct vc_data *conp, struct display *p, - int c, int yy, int xx) -{ - struct fb_info_aty128 *fb = (struct fb_info_aty128 *)(p->fb_info); - - if (fb->blitter_may_be_busy) - wait_for_idle(fb); - - fbcon_cfb8_putc(conp, p, c, yy, xx); -} - - -static void fbcon_aty8_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, - int yy, int xx) -{ - struct fb_info_aty128 *fb = (struct fb_info_aty128 *)(p->fb_info); - - if (fb->blitter_may_be_busy) - wait_for_idle(fb); - - fbcon_cfb8_putcs(conp, p, s, count, yy, xx); -} - - -static void fbcon_aty8_clear_margins(struct vc_data *conp, - struct display *p, int bottom_only) -{ - struct fb_info_aty128 *fb = (struct fb_info_aty128 *)(p->fb_info); - - if (fb->blitter_may_be_busy) - wait_for_idle(fb); - - fbcon_cfb8_clear_margins(conp, p, bottom_only); -} - -static struct display_switch fbcon_aty128_8 = { - setup: fbcon_cfb8_setup, - bmove: fbcon_aty128_bmove, - clear: fbcon_cfb8_clear, - putc: fbcon_aty8_putc, - putcs: fbcon_aty8_putcs, - revc: fbcon_cfb8_revc, - clear_margins: fbcon_aty8_clear_margins, - fontwidthmask: FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16) -}; -#endif -#ifdef FBCON_HAS_CFB16 -static void fbcon_aty16_putc(struct vc_data *conp, struct display *p, - int c, int yy, int xx) -{ - struct fb_info_aty128 *fb = (struct fb_info_aty128 *)(p->fb_info); - - if (fb->blitter_may_be_busy) - wait_for_idle(fb); - - fbcon_cfb16_putc(conp, p, c, yy, xx); -} - - -static void fbcon_aty16_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, - int yy, int xx) -{ - struct fb_info_aty128 *fb = (struct fb_info_aty128 *)(p->fb_info); - - if (fb->blitter_may_be_busy) - wait_for_idle(fb); - - fbcon_cfb16_putcs(conp, p, s, count, yy, xx); -} - - -static void fbcon_aty16_clear_margins(struct vc_data *conp, - struct display *p, int bottom_only) -{ - struct fb_info_aty128 *fb = (struct fb_info_aty128 *)(p->fb_info); - - if (fb->blitter_may_be_busy) - wait_for_idle(fb); - - fbcon_cfb16_clear_margins(conp, p, bottom_only); -} - -static struct display_switch fbcon_aty128_16 = { - setup: fbcon_cfb16_setup, - bmove: fbcon_aty128_bmove, - clear: fbcon_cfb16_clear, - putc: fbcon_aty16_putc, - putcs: fbcon_aty16_putcs, - revc: fbcon_cfb16_revc, - clear_margins: fbcon_aty16_clear_margins, - fontwidthmask: FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16) -}; -#endif -#ifdef FBCON_HAS_CFB24 -static void fbcon_aty24_putc(struct vc_data *conp, struct display *p, - int c, int yy, int xx) -{ - struct fb_info_aty128 *fb = (struct fb_info_aty128 *)(p->fb_info); - - if (fb->blitter_may_be_busy) - wait_for_idle(fb); - - fbcon_cfb24_putc(conp, p, c, yy, xx); -} - - -static void fbcon_aty24_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, - int yy, int xx) -{ - struct fb_info_aty128 *fb = (struct fb_info_aty128 *)(p->fb_info); - - if (fb->blitter_may_be_busy) - wait_for_idle(fb); - - fbcon_cfb24_putcs(conp, p, s, count, yy, xx); -} - - -static void fbcon_aty24_clear_margins(struct vc_data *conp, - struct display *p, int bottom_only) -{ - struct fb_info_aty128 *fb = (struct fb_info_aty128 *)(p->fb_info); - - if (fb->blitter_may_be_busy) - wait_for_idle(fb); - - fbcon_cfb24_clear_margins(conp, p, bottom_only); -} - -static struct display_switch fbcon_aty128_24 = { - setup: fbcon_cfb24_setup, - bmove: fbcon_aty128_bmove, - clear: fbcon_cfb24_clear, - putc: fbcon_aty24_putc, - putcs: fbcon_aty24_putcs, - revc: fbcon_cfb24_revc, - clear_margins: fbcon_aty24_clear_margins, - fontwidthmask: FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16) -}; -#endif -#ifdef FBCON_HAS_CFB32 -static void fbcon_aty32_putc(struct vc_data *conp, struct display *p, - int c, int yy, int xx) -{ - struct fb_info_aty128 *fb = (struct fb_info_aty128 *)(p->fb_info); - - if (fb->blitter_may_be_busy) - wait_for_idle(fb); - - fbcon_cfb32_putc(conp, p, c, yy, xx); -} - - -static void fbcon_aty32_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, - int yy, int xx) -{ - struct fb_info_aty128 *fb = (struct fb_info_aty128 *)(p->fb_info); - - if (fb->blitter_may_be_busy) - wait_for_idle(fb); - - fbcon_cfb32_putcs(conp, p, s, count, yy, xx); +#ifdef CONFIG_PMAC_PBOOK +static void +aty128_set_suspend(struct aty128fb_par *par, int suspend) +{ + u32 pmgt; + u16 pwr_command; + + if (!par->pm_reg) + return; + + /* Set the chip into the appropriate suspend mode (we use D2, + * D3 would require a complete re-initialisation of the chip, + * including PCI config registers, clocks, AGP configuration, ...) + */ + if (suspend) { + /* Make sure CRTC2 is reset. Remove that the day we decide to + * actually use CRTC2 and replace it with real code for disabling + * the CRTC2 output during sleep + */ + aty_st_le32(CRTC2_GEN_CNTL, aty_ld_le32(CRTC2_GEN_CNTL) & + ~(CRTC2_EN)); + + /* Set the power management mode to be PCI based */ + /* Use this magic value for now */ + pmgt = 0x0c005407; + aty_st_pll(POWER_MANAGEMENT, pmgt); + (void)aty_ld_pll(POWER_MANAGEMENT); + aty_st_le32(BUS_CNTL1, 0x00000010); + aty_st_le32(MEM_POWER_MISC, 0x0c830000); + mdelay(100); + pci_read_config_word(par->pdev, par->pm_reg+PCI_PM_CTRL, &pwr_command); + /* Switch PCI power management to D2 */ + pci_write_config_word(par->pdev, par->pm_reg+PCI_PM_CTRL, + (pwr_command & ~PCI_PM_CTRL_STATE_MASK) | 2); + pci_read_config_word(par->pdev, par->pm_reg+PCI_PM_CTRL, &pwr_command); + } else { + /* Switch back PCI power management to D0 */ + mdelay(100); + pci_write_config_word(par->pdev, par->pm_reg+PCI_PM_CTRL, 0); + mdelay(100); + pci_read_config_word(par->pdev, par->pm_reg+PCI_PM_CTRL, &pwr_command); + mdelay(100); + } } +extern struct display_switch fbcon_dummy; -static void fbcon_aty32_clear_margins(struct vc_data *conp, - struct display *p, int bottom_only) -{ - struct fb_info_aty128 *fb = (struct fb_info_aty128 *)(p->fb_info); - - if (fb->blitter_may_be_busy) - wait_for_idle(fb); - - fbcon_cfb32_clear_margins(conp, p, bottom_only); +/* + * Save the contents of the frame buffer when we go to sleep, + * and restore it when we wake up again. + */ +int +aty128_sleep_notify(struct pmu_sleep_notifier *self, int when) +{ + struct fb_info_aty128 *board; + int result; + + result = PBOOK_SLEEP_OK; + + for (board = board_list; board != NULL; board = board->next) { + struct fb_info *info = &board->fb_info; + struct aty128fb_par *par = info->par; + int nb; + + nb = info->var.yres * info->fix.line_length; + + switch (when) { + case PBOOK_SLEEP_REQUEST: + par->save_framebuffer = vmalloc(nb); + if (par->save_framebuffer == NULL) + return PBOOK_SLEEP_REFUSE; + break; + case PBOOK_SLEEP_REJECT: + if (par->save_framebuffer) { + vfree(par->save_framebuffer); + par->save_framebuffer = 0; + } + break; + case PBOOK_SLEEP_NOW: + if (info->currcon >= 0) + fb_display[info->currcon].dispsw = &fbcon_dummy; + + wait_for_idle(par); + aty128_reset_engine(par); + wait_for_idle(par); + + /* Backup fb content */ + if (par->save_framebuffer) + memcpy_fromio(par->save_framebuffer, + info->screen_base, nb); + + /* Blank display and LCD */ + aty128fb_blank(VESA_POWERDOWN, info); + + /* Sleep the chip */ + aty128_set_suspend(par, 1); + + break; + case PBOOK_WAKE: + /* Wake the chip */ + aty128_set_suspend(par, 0); + + aty128_reset_engine(par); + wait_for_idle(par); + + /* Restore fb content */ + if (par->save_framebuffer) { + memcpy_toio(info->screen_base, + par->save_framebuffer, nb); + vfree(par->save_framebuffer); + par->save_framebuffer = 0; + } + gen_set_disp(-1, info); + aty128fb_blank(0, info); + break; + } + } + return result; } - -static struct display_switch fbcon_aty128_32 = { - setup: fbcon_cfb32_setup, - bmove: fbcon_aty128_bmove, - clear: fbcon_cfb32_clear, - putc: fbcon_aty32_putc, - putcs: fbcon_aty32_putcs, - revc: fbcon_cfb32_revc, - clear_margins: fbcon_aty32_clear_margins, - fontwidthmask: FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16) -}; -#endif +#endif /* CONFIG_PMAC_PBOOK */ #ifdef MODULE MODULE_AUTHOR("(c)1999-2000 Brad Douglas <brad@neruo.com>"); @@ -2570,55 +2353,55 @@ MODULE_PARM_DESC(nomtrr, "Disable MTRR support (0 or 1=disabled) (default=0)"); int __init init_module(void) { - if (noaccel) { - noaccel = 1; - printk(KERN_INFO "aty128fb: Parameter NOACCEL set\n"); - } - if (font) { - strncpy(fontname, font, sizeof(fontname)-1); - printk(KERN_INFO "aty128fb: Parameter FONT set to %s\n", font); - } - if (mode) { - mode_option = mode; - printk(KERN_INFO "aty128fb: Parameter MODE set to %s\n", mode); - } + if (noaccel) { + noaccel = 1; + printk(KERN_INFO "aty128fb: Parameter NOACCEL set\n"); + } + if (font) { + strncpy(fontname, font, sizeof(fontname)-1); + printk(KERN_INFO "aty128fb: Parameter FONT set to %s\n", font); + } + if (mode) { + mode_option = mode; + printk(KERN_INFO "aty128fb: Parameter MODE set to %s\n", mode); + } #ifdef CONFIG_MTRR - if (nomtrr) { - mtrr = 0; - printk(KERN_INFO "aty128fb: Parameter NOMTRR set\n"); - } + if (nomtrr) { + mtrr = 0; + printk(KERN_INFO "aty128fb: Parameter NOMTRR set\n"); + } #endif - - aty128fb_init(); - return 0; + + aty128fb_init(); + return 0; } void __exit cleanup_module(void) { - struct fb_info_aty128 *info = board_list; + struct fb_info_aty128 *info = board_list; - while (board_list) { - info = board_list; - board_list = board_list->next; + while (board_list) { + info = board_list; + board_list = board_list->next; - unregister_framebuffer(&info->fb_info); + unregister_framebuffer(&info->fb_info); #ifdef CONFIG_MTRR - if (info->mtrr.vram_valid) - mtrr_del(info->mtrr.vram, info->frame_buffer_phys, - info->vram_size); + if (info->mtrr.vram_valid) + mtrr_del(info->mtrr.vram, info->fix.smem_start, + info->vram_size); #endif /* CONFIG_MTRR */ - iounmap(info->regbase); - iounmap(info->frame_buffer); + iounmap(info->par.regbase); + iounmap(info->fb_info.screen_base); - release_mem_region(pci_resource_start(info->pdev, 0), - pci_resource_len(info->pdev, 0)); - release_mem_region(pci_resource_start(info->pdev, 1), - pci_resource_len(info->pdev, 1)); - release_mem_region(pci_resource_start(info->pdev, 2), - pci_resource_len(info->pdev, 2)); + release_mem_region(pci_resource_start(info->par.pdev, 0), + pci_resource_len(info->par.pdev, 0)); + release_mem_region(pci_resource_start(info->par.pdev, 1), + pci_resource_len(info->par.pdev, 1)); + release_mem_region(pci_resource_start(info->par.pdev, 2), + pci_resource_len(info->par.pdev, 2)); - kfree(info); - } + kfree(info); + } } #endif /* MODULE */ diff --git a/drivers/video/cfbcopyarea.c b/drivers/video/cfbcopyarea.c index a57643eb7b32..e3fcc679afb9 100644 --- a/drivers/video/cfbcopyarea.c +++ b/drivers/video/cfbcopyarea.c @@ -38,12 +38,14 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) { - int x2, y2, lineincr, shift, shift_right, shift_left, old_dx, old_dy; + int x2, y2, lineincr, shift, shift_right, shift_left, old_dx, + old_dy; int j, linesize = p->fix.line_length, bpl = sizeof(unsigned long); - unsigned long start_index, end_index, start_mask, end_mask, last; + unsigned long start_index, end_index, start_mask, end_mask, last, + tmp; unsigned long *dst = NULL, *src = NULL; char *src1, *dst1; - int tmp, height; + int height; /* clip the destination */ old_dx = area->dx; @@ -84,10 +86,16 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) lineincr = linesize; } else { /* start at the bottom */ - src1 = p->screen_base + (area->sy + area->height-1) * linesize - + (((area->sx + area->width - 1) * p->var.bits_per_pixel) >> 3); - dst1 = p->screen_base + (area->dy + area->height-1) * linesize - + (((area->dx + area->width - 1) * p->var.bits_per_pixel) >> 3); + src1 = + p->screen_base + (area->sy + area->height - + 1) * linesize + + (((area->sx + area->width - + 1) * p->var.bits_per_pixel) >> 3); + dst1 = + p->screen_base + (area->dy + area->height - + 1) * linesize + + (((area->dx + area->width - + 1) * p->var.bits_per_pixel) >> 3); lineincr = -linesize; } @@ -98,7 +106,7 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) start_index = ((unsigned long) src1 & (bpl - 1)); end_index = ((unsigned long) (src1 + n) & (bpl - 1)); shift = ((unsigned long) dst1 & (bpl - 1)) - - ((unsigned long) src1 & (bpl - 1)); + ((unsigned long) src1 & (bpl - 1)); start_mask = end_mask = 0; if (start_index) { @@ -111,7 +119,6 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) n -= end_index; } n /= bpl; - if (n <= 0) { if (start_mask) { if (end_mask) @@ -148,16 +155,25 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) last = (FB_READ(src) & start_mask); if (shift > 0) - FB_WRITE(FB_READ(dst) | (last >> shift_right), dst); + FB_WRITE(FB_READ(dst) | + (last >> + shift_right), + dst); for (j = 0; j < n; j++) { dst++; tmp = FB_READ(src); src++; - FB_WRITE((last << shift_left) | (tmp >> shift_right), dst); + FB_WRITE((last << + shift_left) | + (tmp >> + shift_right), + dst); last = tmp; src++; } - FB_WRITE(FB_READ(dst) | (last << shift_left), dst); + FB_WRITE(FB_READ(dst) | + (last << shift_left), + dst); src1 += lineincr; dst1 += lineincr; } while (--height); @@ -172,16 +188,25 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) last = (FB_READ(src) & end_mask); if (shift < 0) - FB_WRITE(FB_READ(dst) | (last >> shift_right), dst); + FB_WRITE(FB_READ(dst) | + (last >> + shift_right), + dst); for (j = 0; j < n; j++) { dst--; tmp = FB_READ(src); src--; - FB_WRITE((tmp << shift_left) | (last >> shift_right), dst); + FB_WRITE((tmp << + shift_left) | + (last >> + shift_right), + dst); last = tmp; src--; } - FB_WRITE(FB_READ(dst) | (last >> shift_right), dst); + FB_WRITE(FB_READ(dst) | + (last >> shift_right), + dst); src1 += lineincr; dst1 += lineincr; } while (--height); @@ -191,20 +216,27 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) if (lineincr > 0) { /* positive increment */ do { - dst = (unsigned long *) (dst1 - start_index); - src = (unsigned long *) (src1 - start_index); + dst = + (unsigned long *) (dst1 - + start_index); + src = + (unsigned long *) (src1 - + start_index); if (start_mask) - FB_WRITE(FB_READ(src) | start_mask, dst); + FB_WRITE(FB_READ(src) | + start_mask, dst); for (j = 0; j < n; j++) { - FB_WRITE(FB_READ(src), dst); + FB_WRITE(FB_READ(src), + dst); dst++; src++; } if (end_mask) - FB_WRITE(FB_READ(src) | end_mask, dst); + FB_WRITE(FB_READ(src) | + end_mask, dst); src1 += lineincr; dst1 += lineincr; } while (--height); @@ -215,9 +247,11 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) src = (unsigned long *) src1; if (start_mask) - FB_WRITE(FB_READ(src) | start_mask, dst); + FB_WRITE(FB_READ(src) | + start_mask, dst); for (j = 0; j < n; j++) { - FB_WRITE(FB_READ(src), dst); + FB_WRITE(FB_READ(src), + dst); dst--; src--; } @@ -226,5 +260,33 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) } while (--height); } } + } else { + int n = ((area->width * p->var.bits_per_pixel) >> 3); + int n16 = (n >> 4) << 4; + int n_fract = n - n16; + int rows; + + if (area->dy < area->sy + || (area->dy == area->sy && area->dx < area->sx)) { + for (rows = height; rows--;) { + if (n16) + fast_memmove(dst1, src1, n16); + if (n_fract) + fb_memmove(dst1 + n16, src1 + n16, + n_fract); + dst1 += linesize; + src1 += linesize; + } + } else { + for (rows = height; rows--;) { + if (n16) + fast_memmove(dst1, src1, n16); + if (n_fract) + fb_memmove(dst1 + n16, src1 + n16, + n_fract); + dst1 -= linesize; + src1 -= linesize; + } + } } } diff --git a/drivers/video/cfbfillrect.c b/drivers/video/cfbfillrect.c index d052a89bd5eb..8f42a317a1c4 100644 --- a/drivers/video/cfbfillrect.c +++ b/drivers/video/cfbfillrect.c @@ -20,7 +20,6 @@ #include <linux/string.h> #include <linux/fb.h> #include <asm/types.h> -#include <video/fbcon.h> #if BITS_PER_LONG == 32 #define FB_READ fb_readl @@ -36,7 +35,7 @@ void cfb_fillrect(struct fb_info *p, struct fb_fillrect *rect) unsigned long height, ppw, fg, fgcolor; int i, n, x2, y2, linesize = p->fix.line_length; int bpl = sizeof(unsigned long); - unsigned long *dst; + unsigned long *dst = NULL; char *dst1; if (!rect->width || !rect->height) @@ -56,7 +55,7 @@ void cfb_fillrect(struct fb_info *p, struct fb_fillrect *rect) ppw = BITS_PER_LONG / p->var.bits_per_pixel; dst1 = p->screen_base + (rect->dy * linesize) + - (rect->dx * (p->var.bits_per_pixel >> 3)); + (rect->dx * (p->var.bits_per_pixel >> 3)); start_index = ((unsigned long) dst1 & (bpl - 1)); end_index = ((unsigned long) (dst1 + n) & (bpl - 1)); @@ -98,11 +97,12 @@ void cfb_fillrect(struct fb_info *p, struct fb_fillrect *rect) case ROP_COPY: do { /* Word align to increases performace :-) */ - dst = (unsigned long *) (dst1 - start_index); + dst = + (unsigned long *) (dst1 - start_index); if (start_mask) { FB_WRITE(FB_READ(dst) | - start_mask, dst); + start_mask, dst); dst++; } @@ -113,17 +113,18 @@ void cfb_fillrect(struct fb_info *p, struct fb_fillrect *rect) if (end_mask) FB_WRITE(FB_READ(dst) | end_mask, - dst); + dst); dst1 += linesize; } while (--height); break; case ROP_XOR: do { - dst = (unsigned long *) (dst1 - start_index); + dst = + (unsigned long *) (dst1 - start_index); if (start_mask) { FB_WRITE(FB_READ(dst) ^ - start_mask, dst); + start_mask, dst); dst++; } @@ -134,56 +135,92 @@ void cfb_fillrect(struct fb_info *p, struct fb_fillrect *rect) if (end_mask) { FB_WRITE(FB_READ(dst) ^ end_mask, - dst); + dst); } dst1 += linesize; } while (--height); break; } } else { - /* Odd modes like 24 or 80 bits per pixel */ - start_mask = fg >> (start_index * p->var.bits_per_pixel); - end_mask = fg << (end_index * p->var.bits_per_pixel); - /* start_mask =& PFILL24(x1,fg); - end_mask_or = end_mask & PFILL24(x1+width-1,fg); */ - - n = (rect->width - start_index - end_index) / ppw; + /* + * Slow Method: The aim is to find the number of pixels to + * pack in order to write doubleword multiple data. + * For 24 bpp, 4 pixels are packed which are written as + * 3 dwords. + */ + char *dst2, *dst3; + int bytes = (p->var.bits_per_pixel + 7) >> 3; + int read, write, total, pack_size; + u32 pixarray[BITS_PER_LONG >> 3], m; + + fg = fgcolor; + read = (bytes + (bpl - 1)) & ~(bpl - 1); + write = bytes; + total = (rect->width * bytes); + + pack_size = bpl * write; + + dst3 = (char *) pixarray; + + for (n = read; n--;) { + *(u32 *) dst3 = fg; + dst3 += bytes; + } switch (rect->rop) { case ROP_COPY: do { - dst = (unsigned long *) dst1; - if (start_mask) - *dst |= start_mask; - if ((start_index + rect->width) > ppw) - dst++; - - /* XXX: slow */ - for (i = 0; i < n; i++) { - *dst++ = fg; + dst2 = dst1; + n = total; + + while (n >= pack_size) { + for (m = 0; m < write; m++) { + fb_writel(pixarray[m], + (u32 *) dst2); + dst2 += 4; + } + n -= pack_size; + } + if (n) { + m = 0; + while (n--) + fb_writeb(((u8 *) + pixarray)[m++], + dst2++); } - if (end_mask) - *dst |= end_mask; dst1 += linesize; } while (--height); break; case ROP_XOR: do { - dst = (unsigned long *) dst1; - if (start_mask) - *dst ^= start_mask; - if ((start_mask + rect->width) > ppw) - dst++; - - for (i = 0; i < n; i++) { - *dst++ ^= fg; /* PFILL24(fg,x1+i); */ + dst2 = dst1; + n = total; + + while (n >= pack_size) { + for (m = 0; m < write; m++) { + fb_writel(fb_readl + ((u32 *) dst2) ^ + pixarray[m], + (u32 *) dst2); + dst2 += 4; + } + n -= pack_size; + } + if (n) { + m = 0; + while (n--) { + fb_writeb(fb_readb(dst2) ^ + ((u8 *) + pixarray)[m++], + dst2); + dst2++; + } } - if (end_mask) - *dst ^= end_mask; dst1 += linesize; } while (--height); break; } + } return; } diff --git a/drivers/video/cfbimgblt.c b/drivers/video/cfbimgblt.c index e3f138ad21b3..96018596ca8e 100644 --- a/drivers/video/cfbimgblt.c +++ b/drivers/video/cfbimgblt.c @@ -22,6 +22,13 @@ * FIXME * The code for 24 bit is horrible. It copies byte by byte size instead of * longs like the other sizes. Needs to be optimized. + * + * Tony: + * Incorporate mask tables similar to fbcon-cfb*.c in 2.4 API. This speeds + * up the code significantly. + * + * Code for depths not multiples of BITS_PER_LONG is still kludgy, which is + * still processed a bit at a time. * * Also need to add code to deal with cards endians that are different than * the native cpu endians. I also need to deal with MSB position in the word. @@ -31,8 +38,6 @@ #include <linux/fb.h> #include <asm/types.h> -#include <video/fbcon.h> - #define DEBUG #ifdef DEBUG @@ -41,16 +46,251 @@ #define DPRINTK(fmt, args...) #endif -void cfb_imageblit(struct fb_info *p, struct fb_image *image) +static u32 cfb_tab8[] = { +#if defined(__BIG_ENDIAN) + 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff, + 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff, + 0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff, + 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff +#elif defined(__LITTLE_ENDIAN) + 0x00000000, 0xff000000, 0x00ff0000, 0xffff0000, + 0x0000ff00, 0xff00ff00, 0x00ffff00, 0xffffff00, + 0x000000ff, 0xff0000ff, 0x00ff00ff, 0xffff00ff, + 0x0000ffff, 0xff00ffff, 0x00ffffff, 0xffffffff +#else +#error FIXME: No endianness?? +#endif +}; + +static u32 cfb_tab16[] = { +#if defined(__BIG_ENDIAN) + 0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff +#elif defined(__LITTLE_ENDIAN) + 0x00000000, 0xffff0000, 0x0000ffff, 0xffffffff +#else +#error FIXME: No endianness?? +#endif +}; + +static u32 cfb_tab32[] = { + 0x00000000, 0xffffffff +}; + +static u32 cfb_pixarray[4]; +static u32 cfb_tabdef[2]; + + +static inline void fast_imageblit(struct fb_image *image, + struct fb_info *p, char *dst1, + int fgcolor, int bgcolor) { - int pad, ppw; - int x2, y2, n, i, j, k, l = 7; + int i, j, k, l = 8, n; + int bit_mask, end_mask, eorx; + unsigned long fgx = fgcolor, bgx = bgcolor, pad; unsigned long tmp = ~0 << (BITS_PER_LONG - p->var.bits_per_pixel); - unsigned long fgx, bgx, fgcolor, bgcolor, eorx; + unsigned long ppw = BITS_PER_LONG / p->var.bits_per_pixel; + unsigned long *dst; + u32 *tab = NULL; + char *src = image->data; + + switch (ppw) { + case 4: + tab = cfb_tab8; + break; + case 2: + tab = cfb_tab16; + break; + case 1: + tab = cfb_tab32; + break; + } + + for (i = ppw - 1; i--;) { + fgx <<= p->var.bits_per_pixel; + bgx <<= p->var.bits_per_pixel; + fgx |= fgcolor; + bgx |= bgcolor; + } + + n = ((image->width + 7) >> 3); + pad = (n << 3) - image->width; + n = image->width % ppw; + + bit_mask = (1 << ppw) - 1; + eorx = fgx ^ bgx; + + k = image->width / ppw; + + for (i = image->height; i--;) { + dst = (unsigned long *) dst1; + + for (j = k; j--;) { + l -= ppw; + end_mask = tab[(*src >> l) & bit_mask]; + fb_writel((end_mask & eorx) ^ bgx, dst++); + if (!l) { + l = 8; + src++; + } + } + if (n) { + end_mask = 0; + for (j = n; j > 0; j--) { + l--; + if (test_bit(l, (unsigned long *) src)) + end_mask |= + (tmp >> + (p->var.bits_per_pixel * + (j - 1))); + if (!l) { + l = 8; + src++; + } + } + fb_writel((end_mask & eorx) ^ bgx, dst++); + } + l -= pad; + dst1 += p->fix.line_length; + } +} + + +/* + * Slow method: The idea is to find the number of pixels necessary to form + * dword-sized multiples that will be written to the framebuffer. For BPP24, + * 4 pixels has to be read which are then packed into 3 double words that + * are then written to the framebuffer. + * + * With this method, processing is done 1 pixel at a time. + */ +static inline void slow_imageblit(struct fb_image *image, + struct fb_info *p, char *dst1, + int fgcolor, int bgcolor) +{ + int bytes = (p->var.bits_per_pixel + 7) >> 3; + int tmp = ~0UL >> (BITS_PER_LONG - p->var.bits_per_pixel); + int i, j, k, l = 8, m, end_mask, eorx; + int read, write, total, pack_size, bpl = sizeof(unsigned long); + unsigned long *dst; + char *dst2 = (char *) cfb_pixarray, *src = image->data; + + cfb_tabdef[0] = 0; + cfb_tabdef[1] = tmp; + + eorx = fgcolor ^ bgcolor; + read = (bytes + (bpl - 1)) & ~(bpl - 1); + write = bytes; + total = image->width * bytes; + pack_size = bpl * write; + + for (i = image->height; i--;) { + dst = (unsigned long *) dst1; + j = total; + m = read; + + while (j >= pack_size) { + l--; + m--; + end_mask = cfb_tabdef[(*src >> l) & 1]; + *(unsigned long *) dst2 = + (end_mask & eorx) ^ bgcolor; + dst2 += bytes; + if (!m) { + for (k = 0; k < write; k++) + fb_writel(cfb_pixarray[k], dst++); + dst2 = (char *) cfb_pixarray; + j -= pack_size; + m = read; + } + if (!l) { + l = 8; + src++; + } + } + /* write residual pixels */ + if (j) { + k = 0; + while (j--) + fb_writeb(((u8 *) cfb_pixarray)[k++], + dst++); + } + dst1 += p->fix.line_length; + } +} + +static inline void bitwise_blit(struct fb_image *image, struct fb_info *p, + char *dst1, int fgcolor, int bgcolor) +{ + int i, j, k, l = 8, n, pad, ppw; + unsigned long tmp = ~0 << (BITS_PER_LONG - p->var.bits_per_pixel); + unsigned long fgx = fgcolor, bgx = bgcolor, eorx; unsigned long end_mask; unsigned long *dst = NULL; + char *src = image->data; + + ppw = BITS_PER_LONG / p->var.bits_per_pixel; + + for (i = 0; i < ppw - 1; i++) { + fgx <<= p->var.bits_per_pixel; + bgx <<= p->var.bits_per_pixel; + fgx |= fgcolor; + bgx |= bgcolor; + } + eorx = fgx ^ bgx; + n = ((image->width + 7) >> 3); + pad = (n << 3) - image->width; + n = image->width % ppw; + + for (i = 0; i < image->height; i++) { + dst = (unsigned long *) dst1; + + for (j = image->width / ppw; j > 0; j--) { + end_mask = 0; + + for (k = ppw; k > 0; k--) { + l--; + if (test_bit(l, (unsigned long *) src)) + end_mask |= + (tmp >> + (p->var.bits_per_pixel * + (k - 1))); + if (!l) { + l = 8; + src++; + } + } + fb_writel((end_mask & eorx) ^ bgx, dst); + dst++; + } + + if (n) { + end_mask = 0; + for (j = n; j > 0; j--) { + l--; + if (test_bit(l, (unsigned long *) src)) + end_mask |= + (tmp >> + (p->var.bits_per_pixel * + (j - 1))); + if (!l) { + l = 8; + src++; + } + } + fb_writel((end_mask & eorx) ^ bgx, dst); + dst++; + } + l -= pad; + dst1 += p->fix.line_length; + } +} + +void cfb_imageblit(struct fb_info *p, struct fb_image *image) +{ + int x2, y2, n; + unsigned long fgcolor, bgcolor; + unsigned long end_mask; u8 *dst1; - u8 *src; /* * We could use hardware clipping but on many cards you get around hardware @@ -62,68 +302,37 @@ void cfb_imageblit(struct fb_info *p, struct fb_image *image) image->dy = image->dy > 0 ? image->dy : 0; x2 = x2 < p->var.xres_virtual ? x2 : p->var.xres_virtual; y2 = y2 < p->var.yres_virtual ? y2 : p->var.yres_virtual; - image->width = x2 - image->dx; + image->width = x2 - image->dx; image->height = y2 - image->dy; - - dst1 = p->screen_base + image->dy * p->fix.line_length + - ((image->dx * p->var.bits_per_pixel) >> 3); - - ppw = BITS_PER_LONG/p->var.bits_per_pixel; - src = image->data; + dst1 = p->screen_base + image->dy * p->fix.line_length + + ((image->dx * p->var.bits_per_pixel) >> 3); if (image->depth == 1) { - if (p->fix.visual == FB_VISUAL_TRUECOLOR) { - fgx = fgcolor = ((u32 *)(p->pseudo_palette))[image->fg_color]; - bgx = bgcolor = ((u32 *)(p->pseudo_palette))[image->bg_color]; + fgcolor = + ((u32 *) (p->pseudo_palette))[image->fg_color]; + bgcolor = + ((u32 *) (p->pseudo_palette))[image->bg_color]; } else { - fgx = fgcolor = image->fg_color; - bgx = bgcolor = image->bg_color; - } - - for (i = 0; i < ppw-1; i++) { - fgx <<= p->var.bits_per_pixel; - bgx <<= p->var.bits_per_pixel; - fgx |= fgcolor; - bgx |= bgcolor; + fgcolor = image->fg_color; + bgcolor = image->bg_color; } - eorx = fgx ^ bgx; - n = ((image->width + 7) >> 3); - pad = (n << 3) - image->width; - n = image->width % ppw; - - for (i = 0; i < image->height; i++) { - dst = (unsigned long *) dst1; - - for (j = image->width/ppw; j > 0; j--) { - end_mask = 0; - - for (k = ppw; k > 0; k--) { - if (test_bit(l, (unsigned long *) src)) - end_mask |= (tmp >> (p->var.bits_per_pixel*(k-1))); - l--; - if (l < 0) { l = 7; src++; } - } - fb_writel((end_mask & eorx)^bgx, dst); - dst++; - } - - if (n) { - end_mask = 0; - for (j = n; j > 0; j--) { - if (test_bit(l, (unsigned long *) src)) - end_mask |= (tmp >> (p->var.bits_per_pixel*(j-1))); - l--; - if (l < 0) { l = 7; src++; } - } - fb_writel((end_mask & eorx)^bgx, dst); - dst++; - } - l -= pad; - dst1 += p->fix.line_length; - } - } else { + + if (p->var.bits_per_pixel >= 8) { + if (BITS_PER_LONG % p->var.bits_per_pixel == 0) + fast_imageblit(image, p, dst1, fgcolor, + bgcolor); + else + slow_imageblit(image, p, dst1, fgcolor, + bgcolor); + } else + /* Is there such a thing as 3 or 5 bits per pixel? */ + slow_imageblit(image, p, dst1, fgcolor, bgcolor); + + } + + else { /* Draw the penguin */ n = ((image->width * p->var.bits_per_pixel) >> 3); end_mask = 0; diff --git a/drivers/video/console/Config.help b/drivers/video/console/Config.help new file mode 100644 index 000000000000..1bd59ed8f72e --- /dev/null +++ b/drivers/video/console/Config.help @@ -0,0 +1,149 @@ +CONFIG_VIDEO_SELECT + This enables support for text mode selection on kernel startup. If + you want to take advantage of some high-resolution text mode your + card's BIOS offers, but the traditional Linux utilities like + SVGATextMode don't, you can say Y here and set the mode using the + "vga=" option from your boot loader (lilo or loadlin) or set + "vga=ask" which brings up a video mode menu on kernel startup. (Try + "man bootparam" or see the documentation of your boot loader about + how to pass options to the kernel.) + + Read the file <file:Documentation/svga.txt> for more information + about the Video mode selection support. If unsure, say N. + +CONFIG_FBCON_VGA_PLANES + This low level frame buffer console driver enable the kernel to use + the 16-color planar modes of the old VGA cards where the bits of + each pixel are separated into 4 planes. + + Only answer Y here if you have a (very old) VGA card that isn't VESA + 2 compatible. + +CONFIG_FB_VGA16 + This is the frame buffer device driver for VGA 16 color graphic + cards. Say Y if you have such a card. + + This code is also available as a module. If you want to compile it + as a module ( = code which can be inserted in and removed from the + running kernel whenever you want), say M here and read + <file:Documentation/modules.txt>. The module will be called + vga16fb.o. + +CONFIG_FB_STI + STI refers to the HP "Standard Text Interface" which is a set of + BIOS routines contained in a ROM chip in HP PA-RISC based machines. + Enabling this option will implement the linux framebuffer device and + an fbcon color text console using calls to the STI BIOS routines. + The HP framebuffer device is usually planar, uses a strange memory + layout, and changing the plane mask to create colored pixels + requires a call to the STI routines, so do not expect /dev/fb to + actually be useful. However, it is the best we have as far as + graphics on the HP chipsets due to lack of hardware level + documentation for the various on-board HP chipsets used in these + systems. It is sufficient for basic text console functions, + including fonts. + + You should probably enable this option, unless you are having + trouble getting video when booting the kernel (make sure it isn't + just that you are running the console on the serial port, though). + Really old HP boxes may not have STI, and must use the PDC BIOS + console or the IODC BIOS. + +CONFIG_FBCON_FONTS + Say Y here if you would like to use fonts other than the default + your frame buffer console usually use. + + Note that the answer to this question won't directly affect the + kernel: saying N will just cause the configurator to skip all + the questions about foreign fonts. + + If unsure, say N (the default choices are safe). + +CONFIG_FONT_8x16 + This is the "high resolution" font for the VGA frame buffer (the one + provided by the VGA text console 80x25 mode. + + If unsure, say Y. + +CONFIG_FBCON_FONTWIDTH8_ONLY + Answer Y here will make the kernel provide only the 8x8 fonts (these + are the less readable). + + If unsure, say N. + +CONFIG_FONT_SUN8x16 + This is the high resolution console font for Sun machines. Say Y. + +CONFIG_FONT_SUN12x22 + This is the high resolution console font for Sun machines with very + big letters (like the letters used in the SPARC PROM). If the + standard font is unreadable for you, say Y, otherwise say N. + +CONFIG_FONT_8x8 + This is the "high resolution" font for the VGA frame buffer (the one + provided by the text console 80x50 (and higher) modes). + + Note that this is a poor quality font. The VGA 8x16 font is quite a + lot more readable. + + Given the resolution provided by the frame buffer device, answer N + here is safe. + +CONFIG_FONT_6x11 + Small console font with Macintosh-style high-half glyphs. Some Mac + framebuffer drivers don't support this one at all. + +CONFIG_FONT_PEARL_8x8 + Small console font with PC-style control-character and high-half + glyphs. + +CONFIG_FONT_ACORN_8x8 + Small console font with PC-style control characters and high-half + glyphs. + +CONFIG_FBCON_ADVANCED + The frame buffer console uses character drawing routines that are + tailored to the specific organization of pixels in the memory of + your graphics hardware. These are called the low level frame buffer + console drivers. Note that they are used for text console output + only; they are NOT needed for graphical applications. + + If you say N here, the needed low level drivers are automatically + enabled, depending on what frame buffer devices you selected above. + This is recommended for most users. + + If you say Y here, you have more fine-grained control over which low + level drivers are enabled. You can e.g. leave out low level drivers + for color depths you do not intend to use for text consoles. + + Low level frame buffer console drivers can be modules ( = code which + can be inserted and removed from the running kernel whenever you + want). The modules will be called fbcon-*.o. If you want to compile + (some of) them as modules, read <file:Documentation/modules.txt>. + + If unsure, say N. + +CONFIG_FBCON_AFB + This is the low level frame buffer console driver for 1 to 8 + bitplanes (2 to 256 colors) on Amiga. + +CONFIG_FBCON_ILBM + This is the low level frame buffer console driver for 1 to 8 + interleaved bitplanes (2 to 256 colors) on Amiga. + +CONFIG_FBCON_IPLAN2P2 + This is the low level frame buffer console driver for 2 interleaved + bitplanes (4 colors) on Atari. + +CONFIG_FBCON_IPLAN2P4 + This is the low level frame buffer console driver for 4 interleaved + bitplanes (16 colors) on Atari. + +CONFIG_FBCON_IPLAN2P8 + This is the low level frame buffer console driver for 8 interleaved + bitplanes (256 colors) on Atari. + +CONFIG_FBCON_HGA + This is the low level frame buffer console driver for Hercules mono + graphics cards. + diff --git a/drivers/video/console/Config.in b/drivers/video/console/Config.in new file mode 100644 index 000000000000..25d1e8671b56 --- /dev/null +++ b/drivers/video/console/Config.in @@ -0,0 +1,162 @@ +# +# Console Display configuration +# + +if [ "$CONFIG_VT" != "n" ]; then + mainmenu_option next_comment + comment 'Console Display driver support' + + bool 'Video mode selection support' CONFIG_VIDEO_SELECT + if [ "$CONFIG_ARCH_ACORN" != "y" -a "$CONFIG_ARCH_EBSA110" != "y" -a \ + "$CONFIG_4xx" != "y" -a "$CONFIG_8xx" != "y" ]; then + bool 'VGA text console' CONFIG_VGA_CONSOLE +# if [ "$CONFIG_PCI" = "y" -a "$CONFIG_VGA_CONSOLE" = "y" ]; then +# bool ' Allow VGA on any bus?' CONFIG_VGA_HOSE +# if [ "$CONFIG_VGA_HOSE" = "y" ]; then +# define_bool CONFIG_DUMMY_CONSOLE y +# fi +# fi + fi + tristate 'MDA text console (dual-headed) ' CONFIG_MDA_CONSOLE + if [ "$CONFIG_FB" = "y" ]; then + define_bool CONFIG_PCI_CONSOLE y + fi +#if [ "$CONFIG_SGI_IP22" = "y" ]; then +# tristate 'SGI Newport Console support' CONFIG_SGI_NEWPORT_CONSOLE +# if [ "$CONFIG_SGI_NEWPORT_CONSOLE" != "y" ]; then +# define_bool CONFIG_DUMMY_CONSOLE y +# else +# define_bool CONFIG_FONT_8x16 y +#fi + if [ "$CONFIG_ARCH_PARISC" = "y" ]; then +# bool 'IODC console' CONFIG_IODC_CONSOLE + bool 'STI console' CONFIG_STI_CONSOLE + if [ "$CONFIG_IODC_CONSOLE" = "n" ]; then + if [ "$CONFIG_GSC_PS2" = "y" ]; then + define_bool CONFIG_DUMMY_CONSOLE y + fi + fi + if [ "$CONFIG_STI_CONSOLE" = "y" ]; then + define_bool CONFIG_DUMMY_CONSOLE y + fi + fi + if [ "$CONFIG_SPARC32" = "y" -o "$CONFIG_SPARC64" = "y" ]; then + bool 'PROM console' CONFIG_PROM_CONSOLE + if [ "$CONFIG_PROM_CONSOLE" != "y" ]; then + define_bool CONFIG_DUMMY_CONSOLE y + fi + fi + if [ "$CONFIG_FB" = "y" ]; then + bool 'Framebuffer Console support' CONFIG_FRAMEBUFFER_CONSOLE + if [ "$CONFIG_FRAMEBUFFER_CONSOLE" = "y" ]; then + define_bool CONFIG_DUMMY_CONSOLE y + bool ' Advanced low level driver options' CONFIG_FBCON_ADVANCED + if [ "$CONFIG_FBCON_ADVANCED" = "y" ]; then + tristate ' Hardware acceleration support' CONFIG_FBCON_ACCEL + tristate ' Amiga bitplanes support' CONFIG_FBCON_AFB + tristate ' Amiga interleaved bitplanes support' CONFIG_FBCON_ILBM + tristate ' Atari interleaved bitplanes (2 planes) support' CONFIG_FBCON_IPLAN2P2 + tristate ' Atari interleaved bitplanes (4 planes) support' CONFIG_FBCON_IPLAN2P4 + tristate ' Atari interleaved bitplanes (8 planes) support' CONFIG_FBCON_IPLAN2P8 + tristate ' VGA 16-color planar support' CONFIG_FBCON_VGA_PLANES + tristate ' HGA monochrome support ' CONFIG_FBCON_HGA + else + if [ "$CONFIG_FB_NEOMAGIC" = "y" -o "$CONFIG_FB_VESA" = "y" -o \ + "$CONFIG_FB_FM2" = "y" -o "$CONFIG_FB_HIT" = "y" -o \ + "$CONFIG_FB_HP300" = "y" -o "$CONFIG_FB_Q40" = "y" -o \ + "$CONFIG_FB_ANAKIN" = "y" -o "$CONFIG_FB_G364" = "y" -o \ + "$CONFIG_FB_VIRTUAL" = "y" -o "$CONFIG_FB_CLPS711X" = "y" -o \ + "$CONFIG_FB_PMAG_BA" = "y" -o "$CONFIG_FB_PMAGB_B" = "y" -o \ + "$CONFIG_FB_3DFX" = "y" -o "$CONFIG_FB_TX3912" = "y" -o \ + "$CONFIG_FB_MAXINE" = "y" -o "$CONFIG_FB_APOLLO" = "y" -o \ + "$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_MAC" = "y" -o \ + "$CONFIG_FB_RIVA" = "y" -o "$CONFIG_FB_OF" = "y" -o \ + "$CONFIG_FB_SGIVW" = "y" -o "$CONFIG_SIS" = "y" ]; then + define_tristate CONFIG_FBCON_ACCEL y + else + if [ "$CONFIG_FB_NEOMAGIC" = "m" -o "$CONFIG_FB_HIT" = "m" -o \ + "$CONFIG_FB_G364" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \ + "$CONFIG_FB_CLPS711X" = "m" -o "$CONFIG_FB_3DFX" = "m" -o \ + "$CONFIG_FB_RIVA" = "m" -o "$CONFIG_FB_SGIVW" = "m" -o \ + "$CONFIG_FB_ATY" = "m" -o "$CONFIG_FB_SIS" = "y" ]; then + define_tristate CONFIG_FBCON_ACCEL m + fi + fi + if [ "$CONFIG_FB_AMIGA" = "y" ]; then + define_tristate CONFIG_FBCON_AFB y + define_tristate CONFIG_FBCON_ILBM y + else + if [ "$CONFIG_FB_AMIGA" = "m" ]; then + define_tristate CONFIG_FBCON_AFB m + define_tristate CONFIG_FBCON_ILBM m + fi + fi + if [ "$CONFIG_FB_ATARI" = "y" ]; then + define_tristate CONFIG_FBCON_IPLAN2P2 y + define_tristate CONFIG_FBCON_IPLAN2P4 y + define_tristate CONFIG_FBCON_IPLAN2P8 y + else + if [ "$CONFIG_FB_ATARI" = "m" ]; then + define_tristate CONFIG_FBCON_IPLAN2P2 m + define_tristate CONFIG_FBCON_IPLAN2P4 m + define_tristate CONFIG_FBCON_IPLAN2P8 m + fi + fi + if [ "$CONFIG_FB_VGA16" = "y" ]; then + define_tristate CONFIG_FBCON_VGA_PLANES y + else + if [ "$CONFIG_FB_VGA16" = "m" ]; then + define_tristate CONFIG_FBCON_VGA_PLANES m + fi + fi + fi + bool ' Support only 8 pixels wide fonts' CONFIG_FBCON_FONTWIDTH8_ONLY + if [ "$CONFIG_SPARC32" = "y" -o "$CONFIG_SPARC64" = "y" ]; then + bool ' Sparc console 8x16 font' CONFIG_FONT_SUN8x16 + if [ "$CONFIG_FBCON_FONTWIDTH8_ONLY" = "n" ]; then + bool ' Sparc console 12x22 font (not supported by all drivers)' CONFIG_FONT_SUN12x22 + fi + bool ' Select other fonts' CONFIG_FBCON_FONTS + if [ "$CONFIG_FBCON_FONTS" = "y" ]; then + bool ' VGA 8x8 font' CONFIG_FONT_8x8 + bool ' VGA 8x16 font' CONFIG_FONT_8x16 + if [ "$CONFIG_FBCON_FONTWIDTH8_ONLY" = "n" ]; then + bool ' Mac console 6x11 font (not supported by all drivers)' CONFIG_FONT_6x11 + fi + bool ' Pearl (old m68k) console 8x8 font' CONFIG_FONT_PEARL_8x8 + bool ' Acorn console 8x8 font' CONFIG_FONT_ACORN_8x8 + fi + else + bool ' Select compiled-in fonts' CONFIG_FBCON_FONTS + if [ "$CONFIG_FBCON_FONTS" = "y" ]; then + bool ' VGA 8x8 font' CONFIG_FONT_8x8 + bool ' VGA 8x16 font' CONFIG_FONT_8x16 + bool ' Sparc console 8x16 font' CONFIG_FONT_SUN8x16 + if [ "$CONFIG_FBCON_FONTWIDTH8_ONLY" = "n" ]; then + bool ' Sparc console 12x22 font (not supported by all drivers)' CONFIG_FONT_SUN12x22 + bool ' Mac console 6x11 font (not supported by all drivers)' CONFIG_FONT_6x11 + fi + bool ' Pearl (old m68k) console 8x8 font' CONFIG_FONT_PEARL_8x8 + bool ' Acorn console 8x8 font' CONFIG_FONT_ACORN_8x8 + bool ' Mini 4x6 font' CONFIG_FONT_MINI_4x6 + else + define_bool CONFIG_FONT_8x8 y + define_bool CONFIG_FONT_8x16 y + if [ "$CONFIG_MAC" = "y" ]; then + if [ "$CONFIG_FBCON_FONTWIDTH8_ONLY" = "n" ]; then + define_bool CONFIG_FONT_6x11 y + fi + fi + if [ "$CONFIG_AMIGA" = "y" ]; then + define_bool CONFIG_FONT_PEARL_8x8 y + fi + if [ "$CONFIG_ARM" = "y" -a "$CONFIG_ARCH_ACORN" = "y" ]; then + define_bool CONFIG_FONT_ACORN_8x8 y + fi + fi + fi + fi + fi + endmenu +fi + diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile new file mode 100644 index 000000000000..19ffc6d45dd7 --- /dev/null +++ b/drivers/video/console/Makefile @@ -0,0 +1,49 @@ +# Makefile for the Linux graphics to console drivers. +# 5 Aug 1999, James Simmons, <mailto:jsimmons@users.sf.net> +# Rewritten to use lists instead of if-statements. + +# All of the (potential) objects that export symbols. +# This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'. + +export-objs := fbcon.o fbcon-accel.o fbcon-afb.o fbcon-ilbm.o \ + fbcon-iplan2p2.o fbcon-iplan2p4.o fbcon-iplan2p8.o \ + fbcon-vga-planes.o fbcon-vga8-planes.o fbcon-hga.o + +# Each configuration option enables a list of files. + +obj-$(CONFIG_DUMMY_CONSOLE) += dummycon.o +obj-$(CONFIG_SGI_NEWPORT_CONSOLE) += newport_con.o +obj-$(CONFIG_PROM_CONSOLE) += promcon.o promcon_tbl.o +obj-$(CONFIG_STI_CONSOLE) += sticon.o sticon-bmode.o ../sticore.o +obj-$(CONFIG_VGA_CONSOLE) += vgacon.o +obj-$(CONFIG_MDA_CONSOLE) += mdacon.o + +obj-$(CONFIG_FONT_SUN8x16) += font_sun8x16.o +obj-$(CONFIG_FONT_SUN12x22) += font_sun12x22.o +obj-$(CONFIG_FONT_8x8) += font_8x8.o +obj-$(CONFIG_FONT_8x16) += font_8x16.o +obj-$(CONFIG_FONT_6x11) += font_6x11.o +obj-$(CONFIG_FONT_PEARL_8x8) += font_pearl_8x8.o +obj-$(CONFIG_FONT_ACORN_8x8) += font_acorn_8x8.o +obj-$(CONFIG_FONT_MINI_4x6) += font_mini_4x6.o + +obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon.o fonts.o + +# Generic Low Level Drivers + +obj-$(CONFIG_FBCON_AFB) += fbcon-afb.o +obj-$(CONFIG_FBCON_ILBM) += fbcon-ilbm.o +obj-$(CONFIG_FBCON_IPLAN2P2) += fbcon-iplan2p2.o +obj-$(CONFIG_FBCON_IPLAN2P4) += fbcon-iplan2p4.o +obj-$(CONFIG_FBCON_IPLAN2P8) += fbcon-iplan2p8.o +obj-$(CONFIG_FBCON_HGA) += fbcon-hga.o +obj-$(CONFIG_FBCON_STI) += fbcon-sti.o +obj-$(CONFIG_FBCON_ACCEL) += fbcon-accel.o + +include $(TOPDIR)/Rules.make + +$(obj)/promcon_tbl.c: $(src)/prom.uni + $(objtree)/scripts/conmakehash $< | \ + sed -e '/#include <[^>]*>/p' -e 's/types/init/' \ + -e 's/dfont\(_uni.*\]\)/promfont\1 __initdata/' > $@ + diff --git a/drivers/video/dummycon.c b/drivers/video/console/dummycon.c index 82686f4b2633..82686f4b2633 100644 --- a/drivers/video/dummycon.c +++ b/drivers/video/console/dummycon.c diff --git a/drivers/video/fbcon-accel.c b/drivers/video/console/fbcon-accel.c index 27119e32c5dc..8f6c5dfe0066 100644 --- a/drivers/video/fbcon-accel.c +++ b/drivers/video/console/fbcon-accel.c @@ -82,9 +82,10 @@ void fbcon_accel_putcs(struct vc_data *vc, struct display *p, unsigned short charmask = p->charmask; unsigned int width = ((fontwidth(p)+7)>>3); struct fb_image image; + u16 c = scr_readw(s); - image.fg_color = attr_fgcol(p, *s); - image.bg_color = attr_bgcol(p, *s); + image.fg_color = attr_fgcol(p, c); + image.bg_color = attr_bgcol(p, c); image.dx = xx * fontwidth(p); image.dy = yy * fontheight(p); image.width = fontwidth(p); diff --git a/drivers/video/fbcon-accel.h b/drivers/video/console/fbcon-accel.h index 80944b6e04c1..80944b6e04c1 100644 --- a/drivers/video/fbcon-accel.h +++ b/drivers/video/console/fbcon-accel.h diff --git a/drivers/video/fbcon-afb.c b/drivers/video/console/fbcon-afb.c index 6afee164b609..6afee164b609 100644 --- a/drivers/video/fbcon-afb.c +++ b/drivers/video/console/fbcon-afb.c diff --git a/drivers/video/fbcon-hga.c b/drivers/video/console/fbcon-hga.c index 4cb12c6e47f5..4cb12c6e47f5 100644 --- a/drivers/video/fbcon-hga.c +++ b/drivers/video/console/fbcon-hga.c diff --git a/drivers/video/fbcon-ilbm.c b/drivers/video/console/fbcon-ilbm.c index 157736e809a7..157736e809a7 100644 --- a/drivers/video/fbcon-ilbm.c +++ b/drivers/video/console/fbcon-ilbm.c diff --git a/drivers/video/fbcon-iplan2p2.c b/drivers/video/console/fbcon-iplan2p2.c index 9eea32a4efb9..9eea32a4efb9 100644 --- a/drivers/video/fbcon-iplan2p2.c +++ b/drivers/video/console/fbcon-iplan2p2.c diff --git a/drivers/video/fbcon-iplan2p4.c b/drivers/video/console/fbcon-iplan2p4.c index fdbb6a4d2790..fdbb6a4d2790 100644 --- a/drivers/video/fbcon-iplan2p4.c +++ b/drivers/video/console/fbcon-iplan2p4.c diff --git a/drivers/video/fbcon-iplan2p8.c b/drivers/video/console/fbcon-iplan2p8.c index 416f28fd1e59..416f28fd1e59 100644 --- a/drivers/video/fbcon-iplan2p8.c +++ b/drivers/video/console/fbcon-iplan2p8.c diff --git a/drivers/video/fbcon-sti.c b/drivers/video/console/fbcon-sti.c index ef6b9a49d119..ef6b9a49d119 100644 --- a/drivers/video/fbcon-sti.c +++ b/drivers/video/console/fbcon-sti.c diff --git a/drivers/video/fbcon-vga-planes.c b/drivers/video/console/fbcon-vga-planes.c index b350820fd3c1..2056b16117c2 100644 --- a/drivers/video/fbcon-vga-planes.c +++ b/drivers/video/console/fbcon-vga-planes.c @@ -105,10 +105,9 @@ void fbcon_vga_planes_setup(struct display *p) void fbcon_vga_planes_bmove(struct display *p, int sy, int sx, int dy, int dx, int height, int width) { - char *src; - char *dest; - int line_ofs; - int x; + struct fb_info *info = p->fb_info; + char *dest, *src; + int line_ofs, x; setmode(1); setop(0); @@ -119,9 +118,9 @@ void fbcon_vga_planes_bmove(struct display *p, int sy, int sx, int dy, int dx, height *= fontheight(p); if (dy < sy || (dy == sy && dx < sx)) { - line_ofs = p->fb_info->fix.line_length - width; - dest = p->fb_info->screen_base + dx + dy * p->fb_info->fix.line_length; - src = p->fb_info->screen_base + sx + sy * p->fb_info->fix.line_length; + line_ofs = info->fix.line_length - width; + dest = info->screen_base + dx + dy * info->fix.line_length; + src = info->screen_base + sx + sy * info->fix.line_length; while (height--) { for (x = 0; x < width; x++) { readb(src); @@ -133,9 +132,9 @@ void fbcon_vga_planes_bmove(struct display *p, int sy, int sx, int dy, int dx, dest += line_ofs; } } else { - line_ofs = p->fb_info->fix.line_length - width; - dest = p->fb_info->screen_base + dx + width + (dy + height - 1) * p->fb_info->fix.line_length; - src = p->fb_info->screen_base + sx + width + (sy + height - 1) * p->fb_info->fix.line_length; + line_ofs = info->fix.line_length - width; + dest = info->screen_base + dx + width + (dy + height - 1) * info->fix.line_length; + src = info->screen_base + sx + width + (sy + height - 1) * info->fix.line_length; while (height--) { for (x = 0; x < width; x++) { dest--; @@ -177,137 +176,48 @@ void fbcon_vga_planes_clear(struct vc_data *conp, struct display *p, int sy, int } } -void fbcon_ega_planes_putc(struct vc_data *conp, struct display *p, int c, int yy, int xx) -{ - int fg = attr_fgcol(p,c); - int bg = attr_bgcol(p,c); - - int y; - u8 *cdat = p->fontdata + (c & p->charmask) * fontheight(p); - char *where = p->fb_info->screen_base + xx + yy * p->fb_info->fix.line_length * fontheight(p); - - setmode(0); - setop(0); - setsr(0xf); - setcolor(bg); - selectmask(); - - setmask(0xff); - for (y = 0; y < fontheight(p); y++, where += p->fb_info->fix.line_length) - rmw(where); - - where -= p->fb_info->fix.line_length * y; - setcolor(fg); - selectmask(); - for (y = 0; y < fontheight(p); y++, where += p->fb_info->fix.line_length) - if (cdat[y]) { - setmask(cdat[y]); - rmw(where); - } -} - -void fbcon_vga_planes_putc(struct vc_data *conp, struct display *p, int c, int yy, int xx) -{ - int fg = attr_fgcol(p,c); - int bg = attr_bgcol(p,c); - - int y; - u8 *cdat = p->fontdata + (c & p->charmask) * fontheight(p); - char *where = p->fb_info->screen_base + xx + yy * p->fb_info->fix.line_length * fontheight(p); - - setmode(2); - setop(0); - setsr(0xf); - setcolor(fg); - selectmask(); - - setmask(0xff); - writeb(bg, where); - rmb(); - readb(where); /* fill latches */ - setmode(3); - wmb(); - for (y = 0; y < fontheight(p); y++, where += p->fb_info->fix.line_length) - writeb(cdat[y], where); - wmb(); -} - -/* 28.50 in my test */ -void fbcon_ega_planes_putcs(struct vc_data *conp, struct display *p, const unsigned short *s, - int count, int yy, int xx) +void fbcon_accel_putc(struct vc_data *vc, struct display *p, int c, int yy, + int xx) { - u16 c = scr_readw(s); - int fg = attr_fgcol(p, c); - int bg = attr_bgcol(p, c); - - char *where; - int n; - - setmode(2); - setop(0); - selectmask(); - - setmask(0xff); - where = p->fb_info->screen_base + xx + yy * p->fb_info->fix.line_length * fontheight(p); - writeb(bg, where); - rmb(); - readb(where); /* fill latches */ - wmb(); - selectmask(); - for (n = 0; n < count; n++) { - int c = scr_readw(s++) & p->charmask; - u8 *cdat = p->fontdata + c * fontheight(p); - u8 *end = cdat + fontheight(p); - - while (cdat < end) { - outb(*cdat++, GRAPHICS_DATA_REG); - wmb(); - writeb(fg, where); - where += p->fb_info->fix.line_length; - } - where += 1 - p->fb_info->fix.line_length * fontheight(p); - } - - wmb(); + struct fb_info *info = p->fb_info; + unsigned short charmask = p->charmask; + unsigned int width = ((fontwidth(p)+7)>>3); + struct fb_image image; + + image.fg_color = attr_fgcol(p, c); + image.bg_color = attr_bgcol(p, c); + image.dx = xx * fontwidth(p); + image.dy = yy * fontheight(p); + image.width = fontwidth(p); + image.height = fontheight(p); + image.depth = 1; + image.data = p->fontdata + (c & charmask)*fontheight(p)*width; + + info->fbops->fb_imageblit(info, &image); } -/* 6.96 in my test */ -void fbcon_vga_planes_putcs(struct vc_data *conp, struct display *p, const unsigned short *s, - int count, int yy, int xx) +void fbcon_accel_putcs(struct vc_data *vc, struct display *p, + const unsigned short *s, int count, int yy, int xx) { - u16 c = scr_readw(s); - int fg = attr_fgcol(p, c); - int bg = attr_bgcol(p, c); - - char *where; - int n; - - setmode(2); - setop(0); - setsr(0xf); - setcolor(fg); - selectmask(); - - setmask(0xff); - where = p->fb_info->screen_base + xx + yy * p->fb_info->fix.line_length * fontheight(p); - writeb(bg, where); - rmb(); - readb(where); /* fill latches */ - setmode(3); - wmb(); - for (n = 0; n < count; n++) { - int y; - int c = scr_readw(s++) & p->charmask; - u8 *cdat = p->fontdata + (c & p->charmask) * fontheight(p); - - for (y = 0; y < fontheight(p); y++, cdat++) { - writeb (*cdat, where); - where += p->fb_info->fix.line_length; - } - where += 1 - p->fb_info->fix.line_length * fontheight(p); - } - - wmb(); + struct fb_info *info = p->fb_info; + unsigned short charmask = p->charmask; + unsigned int width = ((fontwidth(p)+7)>>3); + struct fb_image image; + + image.fg_color = attr_fgcol(p, *s); + image.bg_color = attr_bgcol(p, *s); + image.dx = xx * fontwidth(p); + image.dy = yy * fontheight(p); + image.width = fontwidth(p); + image.height = fontheight(p); + image.depth = 1; + + while (count--) { + image.data = p->fontdata + + (scr_readw(s++) & charmask) * fontheight(p) * width; + info->fbops->fb_imageblit(info, &image); + image.dx += fontwidth(p); + } } void fbcon_vga_planes_revc(struct display *p, int xx, int yy) @@ -332,18 +242,8 @@ struct display_switch fbcon_vga_planes = { setup: fbcon_vga_planes_setup, bmove: fbcon_vga_planes_bmove, clear: fbcon_vga_planes_clear, - putc: fbcon_vga_planes_putc, - putcs: fbcon_vga_planes_putcs, - revc: fbcon_vga_planes_revc, - fontwidthmask: FONTWIDTH(8) -}; - -struct display_switch fbcon_ega_planes = { - setup: fbcon_vga_planes_setup, - bmove: fbcon_vga_planes_bmove, - clear: fbcon_vga_planes_clear, - putc: fbcon_ega_planes_putc, - putcs: fbcon_ega_planes_putcs, + putc: fbcon_accel_putc, + putcs: fbcon_accel_putcs, revc: fbcon_vga_planes_revc, fontwidthmask: FONTWIDTH(8) }; @@ -369,14 +269,8 @@ EXPORT_SYMBOL(fbcon_vga_planes); EXPORT_SYMBOL(fbcon_vga_planes_setup); EXPORT_SYMBOL(fbcon_vga_planes_bmove); EXPORT_SYMBOL(fbcon_vga_planes_clear); -EXPORT_SYMBOL(fbcon_vga_planes_putc); -EXPORT_SYMBOL(fbcon_vga_planes_putcs); EXPORT_SYMBOL(fbcon_vga_planes_revc); -EXPORT_SYMBOL(fbcon_ega_planes); -EXPORT_SYMBOL(fbcon_ega_planes_putc); -EXPORT_SYMBOL(fbcon_ega_planes_putcs); - /* * Overrides for Emacs so that we follow Linus's tabbing style. * --------------------------------------------------------------------------- diff --git a/drivers/video/fbcon.c b/drivers/video/console/fbcon.c index e6916fa97b85..28cc533e65b8 100644 --- a/drivers/video/fbcon.c +++ b/drivers/video/console/fbcon.c @@ -100,7 +100,9 @@ #include <asm/linux_logo.h> #include <video/fbcon.h> -#include <video/fbcon-mac.h> /* for 6x11 font on mac */ +#ifdef CONFIG_FBCON_ACCEL +#include "fbcon-accel.h" +#endif #include <video/font.h> #ifdef FBCONDEBUG @@ -277,6 +279,41 @@ int PROC_CONSOLE(const struct fb_info *info) return minor(current->tty->device) - 1; } +void gen_set_disp(int con, struct fb_info *info) +{ + struct display *display = fb_display + con; + + if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR || + info->fix.visual == FB_VISUAL_DIRECTCOLOR) { + display->can_soft_blank = info->fbops->fb_blank ? 1 : 0; + display->dispsw_data = NULL; + } else { + display->can_soft_blank = 0; + display->dispsw_data = info->pseudo_palette; + } + + /* + * If we are setting all the virtual consoles, also set + * the defaults used to create new consoles. + * + if (con < 0 || info->var.activate & FB_ACTIVATE_ALL) { + int unit; + + for (unit = 0; unit < MAX_NR_CONSOLES; unit++) + if (fb_display[unit].conp && con2fb_map[unit] == GET_FB_IDX(info->node)) + fb_display[unit].var = info->var; + } + */ + +#ifdef FBCON_HAS_ACCEL + display->scrollmode = SCROLL_YNOMOVE; + display->dispsw = &fbcon_accel; +#else + display->dispsw = &fbcon_dummy; +#endif + fbcon_changevar(con); + return; +} /** * set_all_vcs - set all virtual consoles to match @@ -298,13 +335,17 @@ int set_all_vcs(int fbidx, struct fb_ops *fb, struct fb_var_screeninfo *var, int unit, err; var->activate |= FB_ACTIVATE_TEST; - err = fb->fb_set_var(var, PROC_CONSOLE(info), info); + err = fb_set_var(var, info); var->activate &= ~FB_ACTIVATE_TEST; + gen_set_disp(PROC_CONSOLE(info), info); if (err) return err; for (unit = 0; unit < MAX_NR_CONSOLES; unit++) - if (fb_display[unit].conp && con2fb_map[unit] == fbidx) - fb->fb_set_var(var, unit, info); + if (fb_display[unit].conp && con2fb_map[unit] == fbidx) { + if (CON_IS_VISIBLE(fb_display[unit].conp)) + fb_set_var(var, info); + gen_set_disp(unit, info); + } return 0; } @@ -350,7 +391,7 @@ void set_con2fb_map(int unit, int newidx) fontheightlog = fb_display[unit]._fontheightlog; userfont = fb_display[unit].userfont; con2fb_map[unit] = newidx; - fb_display[unit] = *(newfb->disp); + fb_display[unit].conp = conp; fb_display[unit].fontdata = fontdata; fb_display[unit]._fontwidth = fontwidth; @@ -359,15 +400,13 @@ void set_con2fb_map(int unit, int newidx) fb_display[unit]._fontheightlog = fontheightlog; fb_display[unit].userfont = userfont; fb_display[unit].fb_info = newfb; + gen_set_disp(unit, newfb); if (conp) conp->vc_display_fg = &newfb->display_fg; if (!newfb->display_fg) newfb->display_fg = conp; - if (!newfb->changevar) - newfb->changevar = oldfb->changevar; /* tell console var has changed */ - if (newfb->changevar) - newfb->changevar(unit); + fbcon_changevar(unit); } } @@ -465,7 +504,6 @@ static const char *fbcon_startup(void) return display_desc; } - static void fbcon_init(struct vc_data *conp, int init) { int unit = conp->vc_num; @@ -474,21 +512,19 @@ static void fbcon_init(struct vc_data *conp, int init) /* on which frame buffer will we open this console? */ info = registered_fb[(int)con2fb_map[unit]]; - info->changevar = &fbcon_changevar; - fb_display[unit] = *(info->disp); /* copy from default */ + /* We trust the mode the driver supplies. */ + if (info->fbops->fb_set_par) + info->fbops->fb_set_par(info); + + gen_set_disp(unit, info); DPRINTK("mode: %s\n",info->modename); - DPRINTK("visual: %d\n",fb_display[unit].visual); + DPRINTK("visual: %d\n",info->fix.visual); DPRINTK("res: %dx%d-%d\n",fb_display[unit].var.xres, fb_display[unit].var.yres, fb_display[unit].var.bits_per_pixel); fb_display[unit].conp = conp; fb_display[unit].fb_info = info; /* clear out the cmap so we don't have dangling pointers */ - fb_display[unit].cmap.len = 0; - fb_display[unit].cmap.red = 0; - fb_display[unit].cmap.green = 0; - fb_display[unit].cmap.blue = 0; - fb_display[unit].cmap.transp = 0; fbcon_setup(unit, init, !init); /* Must be done after fbcon_setup to prevent excess updates */ conp->vc_display_fg = &info->display_fg; @@ -527,7 +563,7 @@ static __inline__ void updatescrollmode(struct display *p) divides(fontheight(p), info->var.yres_virtual)) m = __SCROLL_YWRAP; else if (divides(info->fix.ypanstep, fontheight(p)) && - p->var.yres_virtual >= p->var.yres+fontheight(p)) + info->var.yres_virtual >= info->var.yres+fontheight(p)) m = __SCROLL_YPAN; else if (p->scrollmode & __SCROLL_YNOMOVE) m = __SCROLL_YREDRAW; @@ -567,7 +603,7 @@ static void fbcon_setup(int con, int init, int logo) info->fix.type == FB_TYPE_TEXT) logo = 0; - p->var.xoffset = p->var.yoffset = p->yscroll = 0; /* reset wrap/pan */ + info->var.xoffset = info->var.yoffset = p->yscroll = 0; /* reset wrap/pan */ if (con == fg_console && info->fix.type != FB_TYPE_TEXT) { if (fbcon_softback_size) { @@ -591,7 +627,7 @@ static void fbcon_setup(int con, int init, int logo) } for (i = 0; i < MAX_NR_CONSOLES; i++) - if (i != con && fb_display[i].fb_info == p->fb_info && + if (i != con && fb_display[i].fb_info == info && fb_display[i].conp && fb_display[i].fontdata) break; @@ -617,9 +653,9 @@ static void fbcon_setup(int con, int init, int logo) } if (!p->fontdata) { - if (!p->fb_info->fontname[0] || - !(font = fbcon_find_font(p->fb_info->fontname))) - font = fbcon_get_default_font(p->var.xres, p->var.yres); + if (!info->fontname[0] || + !(font = fbcon_find_font(info->fontname))) + font = fbcon_get_default_font(info->var.xres, info->var.yres); p->_fontwidth = font->width; p->_fontheight = font->height; p->fontdata = font->data; @@ -627,17 +663,9 @@ static void fbcon_setup(int con, int init, int logo) } if (!fontwidthvalid(p,fontwidth(p))) { -#ifdef CONFIG_FBCON_MAC - if (MACH_IS_MAC) - /* ++Geert: hack to make 6x11 fonts work on mac */ - p->dispsw = &fbcon_mac; - else -#endif - { - /* ++Geert: changed from panic() to `correct and continue' */ - printk(KERN_ERR "fbcon_setup: No support for fontwidth %d\n", fontwidth(p)); - p->dispsw = &fbcon_dummy; - } + /* ++Geert: changed from panic() to `correct and continue' */ + printk(KERN_ERR "fbcon_setup: No support for fontwidth %d\n", fontwidth(p)); + p->dispsw = &fbcon_dummy; } if (p->dispsw->set_font) p->dispsw->set_font(p, fontwidth(p), fontheight(p)); @@ -646,8 +674,8 @@ static void fbcon_setup(int con, int init, int logo) old_cols = conp->vc_cols; old_rows = conp->vc_rows; - nr_cols = p->var.xres/fontwidth(p); - nr_rows = p->var.yres/fontheight(p); + nr_cols = info->var.xres/fontwidth(p); + nr_rows = info->var.yres/fontheight(p); if (logo) { /* Need to make room for the logo */ @@ -697,11 +725,11 @@ static void fbcon_setup(int con, int init, int logo) conp->vc_cols = nr_cols; conp->vc_rows = nr_rows; } - p->vrows = p->var.yres_virtual/fontheight(p); - if ((p->var.yres % fontheight(p)) && - (p->var.yres_virtual % fontheight(p) < p->var.yres % fontheight(p))) + p->vrows = info->var.yres_virtual/fontheight(p); + if ((info->var.yres % fontheight(p)) && + (info->var.yres_virtual % fontheight(p) < info->var.yres % fontheight(p))) p->vrows--; - conp->vc_can_do_color = p->var.bits_per_pixel != 1; + conp->vc_can_do_color = info->var.bits_per_pixel != 1; conp->vc_complement_mask = conp->vc_can_do_color ? 0x7700 : 0x0800; if (charcnt == 256) { conp->vc_hi_font_mask = 0; @@ -720,10 +748,10 @@ static void fbcon_setup(int con, int init, int logo) if (p->dispsw == &fbcon_dummy) printk(KERN_WARNING "fbcon_setup: type %d (aux %d, depth %d) not " "supported\n", info->fix.type, info->fix.type_aux, - p->var.bits_per_pixel); + info->var.bits_per_pixel); p->dispsw->setup(p); - p->fgcol = p->var.bits_per_pixel > 2 ? 7 : (1<<p->var.bits_per_pixel)-1; + p->fgcol = info->var.bits_per_pixel > 2 ? 7 : (1<<info->var.bits_per_pixel)-1; p->bgcol = 0; if (!init) { @@ -743,11 +771,16 @@ static void fbcon_setup(int con, int init, int logo) kfree(save); } } - - if (logo) { - logo_shown = -2; - conp->vc_top = logo_lines; - } + + if (logo) { + if (logo_lines > conp->vc_bottom) { + logo_shown = -1; + printk(KERN_INFO "fbcon_startup: disable boot-logo (boot-logo bigger than screen).\n"); + } else { + logo_shown = -2; + conp->vc_top = logo_lines; + } + } if (con == fg_console && softback_buf) { int l = fbcon_softback_size / conp->vc_size_row; @@ -951,53 +984,70 @@ static int scrollback_phys_max = 0; static int scrollback_max = 0; static int scrollback_current = 0; +int update_var(int con, struct fb_info *info) +{ + int err; + + if (con == info->currcon) { + if (info->fbops->fb_pan_display) { + if ((err = info->fbops->fb_pan_display(&info->var, info))) + return err; + } + } + return 0; +} + static __inline__ void ywrap_up(int unit, struct vc_data *conp, struct display *p, int count) { + struct fb_info *info = p->fb_info; + p->yscroll += count; if (p->yscroll >= p->vrows) /* Deal with wrap */ p->yscroll -= p->vrows; - p->var.xoffset = 0; - p->var.yoffset = p->yscroll*fontheight(p); - p->var.vmode |= FB_VMODE_YWRAP; - p->fb_info->updatevar(unit, p->fb_info); + info->var.xoffset = 0; + info->var.yoffset = p->yscroll*fontheight(p); + info->var.vmode |= FB_VMODE_YWRAP; + update_var(unit, info); scrollback_max += count; if (scrollback_max > scrollback_phys_max) scrollback_max = scrollback_phys_max; scrollback_current = 0; } - static __inline__ void ywrap_down(int unit, struct vc_data *conp, struct display *p, int count) { + struct fb_info *info = p->fb_info; + p->yscroll -= count; if (p->yscroll < 0) /* Deal with wrap */ p->yscroll += p->vrows; - p->var.xoffset = 0; - p->var.yoffset = p->yscroll*fontheight(p); - p->var.vmode |= FB_VMODE_YWRAP; - p->fb_info->updatevar(unit, p->fb_info); + info->var.xoffset = 0; + info->var.yoffset = p->yscroll*fontheight(p); + info->var.vmode |= FB_VMODE_YWRAP; + update_var(unit, info); scrollback_max -= count; if (scrollback_max < 0) scrollback_max = 0; scrollback_current = 0; } - static __inline__ void ypan_up(int unit, struct vc_data *conp, struct display *p, int count) { + struct fb_info *info = p->fb_info; + p->yscroll += count; if (p->yscroll > p->vrows-conp->vc_rows) { p->dispsw->bmove(p, p->vrows-conp->vc_rows, 0, 0, 0, conp->vc_rows, conp->vc_cols); p->yscroll -= p->vrows-conp->vc_rows; } - p->var.xoffset = 0; - p->var.yoffset = p->yscroll*fontheight(p); - p->var.vmode &= ~FB_VMODE_YWRAP; - p->fb_info->updatevar(unit, p->fb_info); + info->var.xoffset = 0; + info->var.yoffset = p->yscroll*fontheight(p); + info->var.vmode &= ~FB_VMODE_YWRAP; + update_var(unit, info); if (p->dispsw->clear_margins) p->dispsw->clear_margins(conp, p, 1); scrollback_max += count; @@ -1010,16 +1060,18 @@ static __inline__ void ypan_up(int unit, struct vc_data *conp, static __inline__ void ypan_down(int unit, struct vc_data *conp, struct display *p, int count) { + struct fb_info *info = p->fb_info; + p->yscroll -= count; if (p->yscroll < 0) { p->dispsw->bmove(p, 0, 0, p->vrows-conp->vc_rows, 0, conp->vc_rows, conp->vc_cols); p->yscroll += p->vrows-conp->vc_rows; } - p->var.xoffset = 0; - p->var.yoffset = p->yscroll*fontheight(p); - p->var.vmode &= ~FB_VMODE_YWRAP; - p->fb_info->updatevar(unit, p->fb_info); + info->var.xoffset = 0; + info->var.yoffset = p->yscroll*fontheight(p); + info->var.vmode &= ~FB_VMODE_YWRAP; + update_var(unit, info); if (p->dispsw->clear_margins) p->dispsw->clear_margins(conp, p, 1); scrollback_max -= count; @@ -1522,7 +1574,8 @@ static int fbcon_switch(struct vc_data *conp) conp2->vc_top = 0; logo_shown = -1; } - p->var.yoffset = p->yscroll = 0; + if (info) + info->var.yoffset = p->yscroll = 0; switch (p->scrollmode & __SCROLL_YMASK) { case __SCROLL_YWRAP: scrollback_phys_max = p->vrows-conp->vc_rows; @@ -1539,8 +1592,6 @@ static int fbcon_switch(struct vc_data *conp) scrollback_max = 0; scrollback_current = 0; - if (info && info->switch_con) - (*info->switch_con)(unit, info); if (p->dispsw->clear_margins && vt_cons[unit]->vc_mode == KD_TEXT) p->dispsw->clear_margins(conp, p, 0); if (logo_shown == -2) { @@ -1570,8 +1621,8 @@ static int fbcon_blank(struct vc_data *conp, int blank) if (info->fix.visual == FB_VISUAL_MONO01) { if (info->screen_base) fb_memset255(info->screen_base, - p->var.xres_virtual*p->var.yres_virtual* - p->var.bits_per_pixel>>3); + info->var.xres_virtual*info->var.yres_virtual* + info->var.bits_per_pixel>>3); } else { unsigned short oldc; u_int height; @@ -1668,6 +1719,7 @@ static inline int fbcon_get_font(int unit, struct console_font_op *op) static int fbcon_do_set_font(int unit, struct console_font_op *op, u8 *data, int userfont) { struct display *p = &fb_display[unit]; + struct fb_info *info = p->fb_info; int resize; int w = op->width; int h = op->height; @@ -1755,12 +1807,12 @@ static int fbcon_do_set_font(int unit, struct console_font_op *op, u8 *data, int if (resize) { struct vc_data *conp = p->conp; /* reset wrap/pan */ - p->var.xoffset = p->var.yoffset = p->yscroll = 0; - p->vrows = p->var.yres_virtual/h; - if ((p->var.yres % h) && (p->var.yres_virtual % h < p->var.yres % h)) + info->var.xoffset = info->var.yoffset = p->yscroll = 0; + p->vrows = info->var.yres_virtual/h; + if ((info->var.yres % h) && (info->var.yres_virtual % h < info->var.yres % h)) p->vrows--; updatescrollmode(p); - vc_resize_con( p->var.yres/h, p->var.xres/w, unit ); + vc_resize_con( info->var.yres/h, info->var.xres/w, unit ); if (CON_IS_VISIBLE(conp) && softback_buf) { int l = fbcon_softback_size / conp->vc_size_row; if (l > 5) @@ -1892,9 +1944,10 @@ static inline int fbcon_set_def_font(int unit, struct console_font_op *op) char name[MAX_FONT_NAME]; struct fbcon_font_desc *f; struct display *p = &fb_display[unit]; + struct fb_info *info = p->fb_info; if (!op->data) - f = fbcon_get_default_font(p->var.xres, p->var.yres); + f = fbcon_get_default_font(info->var.xres, info->var.yres); else if (strncpy_from_user(name, op->data, MAX_FONT_NAME-1) < 0) return -EFAULT; else { @@ -1937,6 +1990,7 @@ static int fbcon_set_palette(struct vc_data *conp, unsigned char *table) { int unit = conp->vc_num; struct display *p = &fb_display[unit]; + struct fb_info *info = p->fb_info; int i, j, k; u8 val; @@ -1951,12 +2005,12 @@ static int fbcon_set_palette(struct vc_data *conp, unsigned char *table) val = conp->vc_palette[j++]; palette_blue[k] = (val<<8)|val; } - if (p->var.bits_per_pixel <= 4) - palette_cmap.len = 1<<p->var.bits_per_pixel; + if (info->var.bits_per_pixel <= 4) + palette_cmap.len = 1 << info->var.bits_per_pixel; else palette_cmap.len = 16; palette_cmap.start = 0; - return p->fb_info->fbops->fb_set_cmap(&palette_cmap, 1, unit, p->fb_info); + return fb_set_cmap(&palette_cmap, 1, info); } static u16 *fbcon_screen_pos(struct vc_data *conp, int offset) @@ -2033,10 +2087,13 @@ static void fbcon_invert_region(struct vc_data *conp, u16 *p, int cnt) static int fbcon_scrolldelta(struct vc_data *conp, int lines) { int unit, offset, limit, scrollback_old; + struct fb_info *info; struct display *p; - + unit = fg_console; p = &fb_display[unit]; + info = p->fb_info; + if (softback_top) { if (conp->vc_num != unit) return 0; @@ -2092,20 +2149,20 @@ static int fbcon_scrolldelta(struct vc_data *conp, int lines) limit = p->vrows; switch (p->scrollmode && __SCROLL_YMASK) { case __SCROLL_YWRAP: - p->var.vmode |= FB_VMODE_YWRAP; + info->var.vmode |= FB_VMODE_YWRAP; break; case __SCROLL_YPAN: limit -= conp->vc_rows; - p->var.vmode &= ~FB_VMODE_YWRAP; + info->var.vmode &= ~FB_VMODE_YWRAP; break; } if (offset < 0) offset += limit; else if (offset >= limit) offset -= limit; - p->var.xoffset = 0; - p->var.yoffset = offset*fontheight(p); - p->fb_info->updatevar(unit, p->fb_info); + info->var.xoffset = 0; + info->var.yoffset = offset*fontheight(p); + update_var(unit, info); if (!scrollback_current) fbcon_cursor(conp, CM_DRAW); return 0; @@ -2127,7 +2184,11 @@ static int __init fbcon_show_logo( void ) { struct display *p = &fb_display[fg_console]; /* draw to vt in foreground */ struct fb_info *info = p->fb_info; - int depth = p->var.bits_per_pixel; +#ifdef CONFIG_FBCON_ACCEL + struct fb_image image; + u32 *palette = NULL, *saved_palette = NULL; +#endif + int depth = info->var.bits_per_pixel; int line = p->next_line; unsigned char *fb = info->screen_base; unsigned char *logo; @@ -2162,7 +2223,7 @@ static int __init fbcon_show_logo( void ) palette_cmap.blue[j] = (linux_logo_blue[i+j] << 8) | linux_logo_blue[i+j]; } - info->fbops->fb_set_cmap(&palette_cmap, 1, fg_console, info); + fb_set_cmap(&palette_cmap, 1, info); } if (depth >= 8) { @@ -2177,160 +2238,53 @@ static int __init fbcon_show_logo( void ) logo = linux_logo_bw; logo_depth = 1; } - + +#if defined(CONFIG_FBCON_ACCEL) + if (info->fix.visual == FB_VISUAL_TRUECOLOR) { + unsigned char mask[9] = { 0,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff }; + unsigned char redmask, greenmask, bluemask; + int redshift, greenshift, blueshift; + + /* Bug: Doesn't obey msb_right ... (who needs that?) */ + redmask = mask[info->var.red.length < 8 ? info->var.red.length : 8]; + greenmask = mask[info->var.green.length < 8 ? info->var.green.length : 8]; + bluemask = mask[info->var.blue.length < 8 ? info->var.blue.length : 8]; + redshift = info->var.red.offset - (8 - info->var.red.length); + greenshift = info->var.green.offset - (8 - info->var.green.length); + blueshift = info->var.blue.offset - (8 - info->var.blue.length); + + /* + * We have to create a temporary palette since console palette is only + * 16 colors long. + */ + palette = kmalloc(256 * 4, GFP_KERNEL); + if (palette == NULL) + return (LOGO_H + fontheight(p) - 1) / fontheight(p); + + for ( i = 0; i < LINUX_LOGO_COLORS; i++) { + palette[i+32] = (safe_shift((linux_logo_red[i] & redmask), redshift) | + safe_shift((linux_logo_green[i] & greenmask), greenshift) | + safe_shift((linux_logo_blue[i] & bluemask), blueshift)); + } + saved_palette = info->pseudo_palette; + info->pseudo_palette = palette; + image.width = LOGO_W; + image.height = LOGO_H; + image.depth = depth; + image.data = logo; + image.dy = 0; + } +#endif + if (info->fbops->fb_rasterimg) info->fbops->fb_rasterimg(info, 1); for (x = 0; x < num_online_cpus() * (LOGO_W + 8) && - x < p->var.xres - (LOGO_W + 8); x += (LOGO_W + 8)) { - -#if defined(CONFIG_FBCON_CFB16) || defined(CONFIG_FBCON_CFB24) || \ - defined(CONFIG_FBCON_CFB32) || defined(CONFIG_FB_SBUS) - if (info->fix.visual == FB_VISUAL_DIRECTCOLOR) { - unsigned int val; /* max. depth 32! */ - int bdepth; - int redshift, greenshift, blueshift; - - /* Bug: Doesn't obey msb_right ... (who needs that?) */ - redshift = p->var.red.offset; - greenshift = p->var.green.offset; - blueshift = p->var.blue.offset; - - if (depth >= 24 && (depth % 8) == 0) { - /* have at least 8 bits per color */ - src = logo; - bdepth = depth/8; - for( y1 = 0; y1 < LOGO_H; y1++ ) { - dst = fb + y1*line + x*bdepth; - for( x1 = 0; x1 < LOGO_W; x1++, src++ ) { - val = (*src << redshift) | - (*src << greenshift) | - (*src << blueshift); - if (bdepth == 4 && !((long)dst & 3)) { - /* Some cards require 32bit access */ - fb_writel (val, dst); - dst += 4; - } else if (bdepth == 2 && !((long)dst & 1)) { - /* others require 16bit access */ - fb_writew (val,dst); - dst +=2; - } else { -#ifdef __LITTLE_ENDIAN - for( i = 0; i < bdepth; ++i ) -#else - for( i = bdepth-1; i >= 0; --i ) -#endif - fb_writeb (val >> (i*8), dst++); - } - } - } - } - else if (depth >= 12 && depth <= 23) { - /* have 4..7 bits per color, using 16 color image */ - unsigned int pix; - src = linux_logo16; - bdepth = (depth+7)/8; - for( y1 = 0; y1 < LOGO_H; y1++ ) { - dst = fb + y1*line + x*bdepth; - for( x1 = 0; x1 < LOGO_W/2; x1++, src++ ) { - pix = *src >> 4; /* upper nibble */ - val = (pix << redshift) | - (pix << greenshift) | - (pix << blueshift); -#ifdef __LITTLE_ENDIAN - for( i = 0; i < bdepth; ++i ) -#else - for( i = bdepth-1; i >= 0; --i ) -#endif - fb_writeb (val >> (i*8), dst++); - pix = *src & 0x0f; /* lower nibble */ - val = (pix << redshift) | - (pix << greenshift) | - (pix << blueshift); -#ifdef __LITTLE_ENDIAN - for( i = 0; i < bdepth; ++i ) -#else - for( i = bdepth-1; i >= 0; --i ) -#endif - fb_writeb (val >> (i*8), dst++); - } - } - } - done = 1; - } -#endif -#if defined(CONFIG_FBCON_CFB16) || defined(CONFIG_FBCON_CFB24) || \ - defined(CONFIG_FBCON_CFB32) || defined(CONFIG_FB_SBUS) - if ((depth % 8 == 0) && (info->fix.visual == FB_VISUAL_TRUECOLOR)) { - /* Modes without color mapping, needs special data transformation... */ - unsigned int val; /* max. depth 32! */ - int bdepth = depth/8; - unsigned char mask[9] = { 0,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff }; - unsigned char redmask, greenmask, bluemask; - int redshift, greenshift, blueshift; - - /* Bug: Doesn't obey msb_right ... (who needs that?) */ - redmask = mask[p->var.red.length < 8 ? p->var.red.length : 8]; - greenmask = mask[p->var.green.length < 8 ? p->var.green.length : 8]; - bluemask = mask[p->var.blue.length < 8 ? p->var.blue.length : 8]; - redshift = p->var.red.offset - (8-p->var.red.length); - greenshift = p->var.green.offset - (8-p->var.green.length); - blueshift = p->var.blue.offset - (8-p->var.blue.length); - - src = logo; - for( y1 = 0; y1 < LOGO_H; y1++ ) { - dst = fb + y1*line + x*bdepth; - for( x1 = 0; x1 < LOGO_W; x1++, src++ ) { - val = safe_shift((linux_logo_red[*src-32] & redmask), redshift) | - safe_shift((linux_logo_green[*src-32] & greenmask), greenshift) | - safe_shift((linux_logo_blue[*src-32] & bluemask), blueshift); - if (bdepth == 4 && !((long)dst & 3)) { - /* Some cards require 32bit access */ - fb_writel (val, dst); - dst += 4; - } else if (bdepth == 2 && !((long)dst & 1)) { - /* others require 16bit access */ - fb_writew (val,dst); - dst +=2; - } else { -#ifdef __LITTLE_ENDIAN - for( i = 0; i < bdepth; ++i ) -#else - for( i = bdepth-1; i >= 0; --i ) -#endif - fb_writeb (val >> (i*8), dst++); - } - } - } - done = 1; - } -#endif -#if defined(CONFIG_FBCON_CFB4) - if (depth == 4 && info->fix.type == FB_TYPE_PACKED_PIXELS) { - src = logo; - for( y1 = 0; y1 < LOGO_H; y1++) { - dst = fb + y1*line + x/2; - for( x1 = 0; x1 < LOGO_W/2; x1++) { - u8 q = *src++; - q = (q << 4) | (q >> 4); - fb_writeb (q, dst++); - } - } - done = 1; - } -#endif -#if defined(CONFIG_FBCON_CFB8) || defined(CONFIG_FB_SBUS) - if (depth == 8 && info->fix.type == FB_TYPE_PACKED_PIXELS) { - /* depth 8 or more, packed, with color registers */ - - src = logo; - for( y1 = 0; y1 < LOGO_H; y1++ ) { - dst = fb + y1*line + x; - for( x1 = 0; x1 < LOGO_W; x1++ ) - fb_writeb (*src++, dst++); - } - done = 1; - } + x < info->var.xres - (LOGO_W + 8); x += (LOGO_W + 8)) { +#if defined (CONFIG_FBCON_ACCEL) + image.dx = x; + info->fbops->fb_imageblit(info, &image); + done = 1; #endif #if defined(CONFIG_FBCON_AFB) || defined(CONFIG_FBCON_ILBM) || \ defined(CONFIG_FBCON_IPLAN2P2) || defined(CONFIG_FBCON_IPLAN2P4) || \ @@ -2396,7 +2350,7 @@ static int __init fbcon_show_logo( void ) unsigned char inverse = p->inverse || info->fix.visual == FB_VISUAL_MONO01 ? 0x00 : 0xff; - int is_hga = !strncmp(p->fb_info->modename, "HGA", 3); + int is_hga = !strncmp(info->modename, "HGA", 3); /* can't use simply memcpy because need to apply inverse */ for( y1 = 0; y1 < LOGO_H; y1++ ) { src = logo + y1*LOGO_LINE; @@ -2440,12 +2394,18 @@ static int __init fbcon_show_logo( void ) } done = 1; } -#endif +#endif } - - if (p->fb_info->fbops->fb_rasterimg) - p->fb_info->fbops->fb_rasterimg(p->fb_info, 0); + + if (info->fbops->fb_rasterimg) + info->fbops->fb_rasterimg(info, 0); +#if defined (CONFIG_FBCON_ACCEL) + if (palette != NULL) + kfree(palette); + if (saved_palette != NULL) + info->pseudo_palette = saved_palette; +#endif /* Modes not yet supported: packed pixels with depth != 8 (does such a * thing exist in reality?) */ diff --git a/drivers/video/font_6x11.c b/drivers/video/console/font_6x11.c index aa95f8863830..aa95f8863830 100644 --- a/drivers/video/font_6x11.c +++ b/drivers/video/console/font_6x11.c diff --git a/drivers/video/font_8x16.c b/drivers/video/console/font_8x16.c index 786619712560..786619712560 100644 --- a/drivers/video/font_8x16.c +++ b/drivers/video/console/font_8x16.c diff --git a/drivers/video/font_8x8.c b/drivers/video/console/font_8x8.c index 6358e671f1ce..6358e671f1ce 100644 --- a/drivers/video/font_8x8.c +++ b/drivers/video/console/font_8x8.c diff --git a/drivers/video/font_acorn_8x8.c b/drivers/video/console/font_acorn_8x8.c index 154d0fb39da7..154d0fb39da7 100644 --- a/drivers/video/font_acorn_8x8.c +++ b/drivers/video/console/font_acorn_8x8.c diff --git a/drivers/video/font_mini_4x6.c b/drivers/video/console/font_mini_4x6.c index 9fe2db2a6edc..9fe2db2a6edc 100644 --- a/drivers/video/font_mini_4x6.c +++ b/drivers/video/console/font_mini_4x6.c diff --git a/drivers/video/font_pearl_8x8.c b/drivers/video/console/font_pearl_8x8.c index c8d7da5714c5..c8d7da5714c5 100644 --- a/drivers/video/font_pearl_8x8.c +++ b/drivers/video/console/font_pearl_8x8.c diff --git a/drivers/video/font_sun12x22.c b/drivers/video/console/font_sun12x22.c index 803b35ea8d72..803b35ea8d72 100644 --- a/drivers/video/font_sun12x22.c +++ b/drivers/video/console/font_sun12x22.c diff --git a/drivers/video/font_sun8x16.c b/drivers/video/console/font_sun8x16.c index 9f5bc40b4762..9f5bc40b4762 100644 --- a/drivers/video/font_sun8x16.c +++ b/drivers/video/console/font_sun8x16.c diff --git a/drivers/video/fonts.c b/drivers/video/console/fonts.c index 436f3a5ec2fc..436f3a5ec2fc 100644 --- a/drivers/video/fonts.c +++ b/drivers/video/console/fonts.c diff --git a/drivers/video/mdacon.c b/drivers/video/console/mdacon.c index f1c47bfaa270..f1c47bfaa270 100644 --- a/drivers/video/mdacon.c +++ b/drivers/video/console/mdacon.c diff --git a/drivers/video/newport_con.c b/drivers/video/console/newport_con.c index 364874dff50d..364874dff50d 100644 --- a/drivers/video/newport_con.c +++ b/drivers/video/console/newport_con.c diff --git a/drivers/video/prom.uni b/drivers/video/console/prom.uni index 58f9c04ed9d3..58f9c04ed9d3 100644 --- a/drivers/video/prom.uni +++ b/drivers/video/console/prom.uni diff --git a/drivers/video/promcon.c b/drivers/video/console/promcon.c index d72ce48cb3f1..d72ce48cb3f1 100644 --- a/drivers/video/promcon.c +++ b/drivers/video/console/promcon.c diff --git a/drivers/video/sti-bmode.h b/drivers/video/console/sti-bmode.h index 4aa38f6d9daa..4aa38f6d9daa 100644 --- a/drivers/video/sti-bmode.h +++ b/drivers/video/console/sti-bmode.h diff --git a/drivers/video/sticon-bmode.c b/drivers/video/console/sticon-bmode.c index 3ab5077ac27a..3ab5077ac27a 100644 --- a/drivers/video/sticon-bmode.c +++ b/drivers/video/console/sticon-bmode.c diff --git a/drivers/video/sticon.c b/drivers/video/console/sticon.c index 7dddbe42d40a..7dddbe42d40a 100644 --- a/drivers/video/sticon.c +++ b/drivers/video/console/sticon.c diff --git a/drivers/video/vgacon.c b/drivers/video/console/vgacon.c index b65d47810913..b798756cef74 100644 --- a/drivers/video/vgacon.c +++ b/drivers/video/console/vgacon.c @@ -180,6 +180,13 @@ static const char __init *vgacon_startup(void) #endif } + /* VGA16 modes are not handled by VGACON */ + if ((ORIG_VIDEO_MODE == 0x0D) || /* 320x200/4 */ + (ORIG_VIDEO_MODE == 0x0E) || /* 640x200/4 */ + (ORIG_VIDEO_MODE == 0x10) || /* 640x350/4 */ + (ORIG_VIDEO_MODE == 0x12) || /* 640x480/4 */ + (ORIG_VIDEO_MODE == 0x6A)) /* 800x600/4, 0x6A is very common */ + goto no_vga; vga_video_num_lines = ORIG_VIDEO_LINES; vga_video_num_columns = ORIG_VIDEO_COLS; diff --git a/drivers/video/dnfb.c b/drivers/video/dnfb.c index bf299d99ea67..ca34d2af2faf 100644 --- a/drivers/video/dnfb.c +++ b/drivers/video/dnfb.c @@ -15,8 +15,6 @@ #include <linux/fb.h> #include <linux/module.h> -#include <video/fbcon.h> - /* apollo video HW definitions */ /* @@ -111,7 +109,6 @@ #endif static struct fb_info fb_info; -static struct display disp; /* frame buffer operations */ @@ -120,9 +117,6 @@ static void dnfb_copyarea(struct fb_info *info, struct fb_copyarea *area); static struct fb_ops dn_fb_ops = { .owner = THIS_MODULE, - .fb_set_var = gen_set_var, - .fb_get_cmap = gen_get_cmap, - .fb_set_cmap = gen_set_cmap, .fb_blank = dnfb_blank, .fb_fillrect = cfb_fillrect, .fb_copyarea = dnfb_copyarea, @@ -239,22 +233,14 @@ unsigned long __init dnfb_init(unsigned long mem_start) { int err; - strcpy(fb_info.modename, dnfb_fix.id); - fb_info.changevar = NULL; fb_info.fontname[0] = 0; - fb_info.disp = &disp; - fb_info.switch_con = gen_switch; - fb_info.updatevar = gen_update_var; fb_info.node = NODEV; fb_info.fbops = &dn_fb_ops; - fb_info.currcon = -1; fb_info.fix = dnfb_fix; fb_info.var = dnfb_var; + fb_info.screen_base = (u_char *) fb_info.fix.smem_start; fb_alloc_cmap(&fb_info.cmap, 2, 0); - gen_set_disp(-1, &fb_info); - - fb_info.screen_base = (u_char *) fb_info.fix.smem_start; err = register_framebuffer(&fb_info); if (err < 0) diff --git a/drivers/video/fbcmap.c b/drivers/video/fbcmap.c index e10d65f53d69..a916cf5fdfcd 100644 --- a/drivers/video/fbcmap.c +++ b/drivers/video/fbcmap.c @@ -181,62 +181,6 @@ void fb_copy_cmap(struct fb_cmap *from, struct fb_cmap *to, int fsfromto) } } - -/** - * fb_get_cmap - get a colormap - * @cmap: frame buffer colormap - * @kspc: boolean, 0 copy local, 1 put_user() function - * @getcolreg: pointer to a function to get a color register - * @info: frame buffer info structure - * - * Get a colormap @cmap for a screen of device @info. - * - * Returns negative errno on error, or zero on success. - * - */ - -int fb_get_cmap(struct fb_cmap *cmap, int kspc, - int (*getcolreg)(u_int, u_int *, u_int *, u_int *, u_int *, - struct fb_info *), - struct fb_info *info) -{ - int i, start; - u16 *red, *green, *blue, *transp; - u_int hred, hgreen, hblue, htransp; - - red = cmap->red; - green = cmap->green; - blue = cmap->blue; - transp = cmap->transp; - start = cmap->start; - if (start < 0) - return -EINVAL; - for (i = 0; i < cmap->len; i++) { - if (getcolreg(start++, &hred, &hgreen, &hblue, &htransp, info)) - return 0; - if (kspc) { - *red = hred; - *green = hgreen; - *blue = hblue; - if (transp) - *transp = htransp; - } else { - put_user(hred, red); - put_user(hgreen, green); - put_user(hblue, blue); - if (transp) - put_user(htransp, transp); - } - red++; - green++; - blue++; - if (transp) - transp++; - } - return 0; -} - - /** * fb_set_cmap - set the colormap * @cmap: frame buffer colormap structure @@ -353,7 +297,6 @@ void fb_invert_cmaps(void) EXPORT_SYMBOL(fb_alloc_cmap); EXPORT_SYMBOL(fb_copy_cmap); -EXPORT_SYMBOL(fb_get_cmap); EXPORT_SYMBOL(fb_set_cmap); EXPORT_SYMBOL(fb_default_cmap); EXPORT_SYMBOL(fb_invert_cmaps); diff --git a/drivers/video/fbcon-cfb16.c b/drivers/video/fbcon-cfb16.c deleted file mode 100644 index 254e559fb591..000000000000 --- a/drivers/video/fbcon-cfb16.c +++ /dev/null @@ -1,319 +0,0 @@ -/* - * linux/drivers/video/cfb16.c -- Low level frame buffer operations for 16 bpp - * truecolor packed pixels - * - * Created 5 Apr 1997 by Geert Uytterhoeven - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive for - * more details. - */ - -#include <linux/module.h> -#include <linux/tty.h> -#include <linux/console.h> -#include <linux/string.h> -#include <linux/fb.h> -#include <asm/io.h> - -#include <video/fbcon.h> -#include <video/fbcon-cfb16.h> - - - /* - * 16 bpp packed pixels - */ - -static u32 tab_cfb16[] = { -#if defined(__BIG_ENDIAN) - 0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff -#elif defined(__LITTLE_ENDIAN) - 0x00000000, 0xffff0000, 0x0000ffff, 0xffffffff -#else -#error FIXME: No endianness?? -#endif -}; - -void fbcon_cfb16_setup(struct display *p) -{ - p->next_line = p->fb_info->fix.line_length ? p->fb_info->fix.line_length : p->var.xres_virtual<<1; - p->next_plane = 0; -} - -void fbcon_cfb16_bmove(struct display *p, int sy, int sx, int dy, int dx, - int height, int width) -{ - int bytes = p->next_line, linesize = bytes * fontheight(p), rows; - u8 *src, *dst; - - if (sx == 0 && dx == 0 && width * fontwidth(p) * 2 == bytes) { - fb_memmove(p->fb_info->screen_base + dy * linesize, - p->fb_info->screen_base + sy * linesize, - height * linesize); - return; - } - if (fontwidthlog(p)) { - sx <<= fontwidthlog(p)+1; - dx <<= fontwidthlog(p)+1; - width <<= fontwidthlog(p)+1; - } else { - sx *= fontwidth(p)*2; - dx *= fontwidth(p)*2; - width *= fontwidth(p)*2; - } - if (dy < sy || (dy == sy && dx < sx)) { - src = p->fb_info->screen_base + sy * linesize + sx; - dst = p->fb_info->screen_base + dy * linesize + dx; - for (rows = height * fontheight(p); rows--;) { - fb_memmove(dst, src, width); - src += bytes; - dst += bytes; - } - } else { - src = p->fb_info->screen_base + (sy+height) * linesize + sx - bytes; - dst = p->fb_info->screen_base + (dy+height) * linesize + dx - bytes; - for (rows = height * fontheight(p); rows--;) { - fb_memmove(dst, src, width); - src -= bytes; - dst -= bytes; - } - } -} - -static inline void rectfill(u8 *dest, int width, int height, u32 data, - int linesize) -{ - int i; - - data |= data<<16; - - while (height-- > 0) { - u32 *p = (u32 *)dest; - for (i = 0; i < width/4; i++) { - fb_writel(data, p++); - fb_writel(data, p++); - } - if (width & 2) - fb_writel(data, p++); - if (width & 1) - fb_writew(data, (u16*)p); - dest += linesize; - } -} - -void fbcon_cfb16_clear(struct vc_data *conp, struct display *p, int sy, int sx, - int height, int width) -{ - u8 *dest; - int bytes = p->next_line, lines = height * fontheight(p); - u32 bgx; - - dest = p->fb_info->screen_base + sy * fontheight(p) * bytes + sx * fontwidth(p) * 2; - - bgx = ((u16 *)p->dispsw_data)[attr_bgcol_ec(p, conp)]; - - width *= fontwidth(p)/4; - if (width * 8 == bytes) - rectfill(dest, lines * width * 4, 1, bgx, bytes); - else - rectfill(dest, width * 4, lines, bgx, bytes); -} - -void fbcon_cfb16_putc(struct vc_data *conp, struct display *p, int c, int yy, - int xx) -{ - u8 *dest, *cdat, bits; - int bytes = p->next_line, rows; - u32 eorx, fgx, bgx; - - dest = p->fb_info->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 2; - - fgx = ((u16 *)p->dispsw_data)[attr_fgcol(p, c)]; - bgx = ((u16 *)p->dispsw_data)[attr_bgcol(p, c)]; - fgx |= (fgx << 16); - bgx |= (bgx << 16); - eorx = fgx ^ bgx; - - switch (fontwidth(p)) { - case 4: - case 8: - cdat = p->fontdata + (c & p->charmask) * fontheight(p); - for (rows = fontheight(p); rows--; dest += bytes) { - bits = *cdat++; - fb_writel((tab_cfb16[bits >> 6] & eorx) ^ bgx, dest); - fb_writel((tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx, dest+4); - if (fontwidth(p) == 8) { - fb_writel((tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx, dest+8); - fb_writel((tab_cfb16[bits & 3] & eorx) ^ bgx, dest+12); - } - } - break; - case 12: - case 16: - cdat = p->fontdata + ((c & p->charmask) * fontheight(p) << 1); - for (rows = fontheight(p); rows--; dest += bytes) { - bits = *cdat++; - fb_writel((tab_cfb16[bits >> 6] & eorx) ^ bgx, dest); - fb_writel((tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx, dest+4); - fb_writel((tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx, dest+8); - fb_writel((tab_cfb16[bits & 3] & eorx) ^ bgx, dest+12); - bits = *cdat++; - fb_writel((tab_cfb16[bits >> 6] & eorx) ^ bgx, dest+16); - fb_writel((tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx, dest+20); - if (fontwidth(p) == 16) { - fb_writel((tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx, dest+24); - fb_writel((tab_cfb16[bits & 3] & eorx) ^ bgx, dest+28); - } - } - break; - } -} - -void fbcon_cfb16_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, int yy, int xx) -{ - u8 *cdat, *dest, *dest0; - u16 c; - int rows, bytes = p->next_line; - u32 eorx, fgx, bgx; - - dest0 = p->fb_info->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 2; - c = scr_readw(s); - fgx = ((u16 *)p->dispsw_data)[attr_fgcol(p, c)]; - bgx = ((u16 *)p->dispsw_data)[attr_bgcol(p, c)]; - fgx |= (fgx << 16); - bgx |= (bgx << 16); - eorx = fgx ^ bgx; - - switch (fontwidth(p)) { - case 4: - case 8: - while (count--) { - c = scr_readw(s++) & p->charmask; - cdat = p->fontdata + c * fontheight(p); - for (rows = fontheight(p), dest = dest0; rows--; dest += bytes) { - u8 bits = *cdat++; - fb_writel((tab_cfb16[bits >> 6] & eorx) ^ bgx, dest); - fb_writel((tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx, dest+4); - if (fontwidth(p) == 8) { - fb_writel((tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx, dest+8); - fb_writel((tab_cfb16[bits & 3] & eorx) ^ bgx, dest+12); - } - } - dest0 += fontwidth(p)*2;; - } - break; - case 12: - case 16: - while (count--) { - c = scr_readw(s++) & p->charmask; - cdat = p->fontdata + (c * fontheight(p) << 1); - for (rows = fontheight(p), dest = dest0; rows--; dest += bytes) { - u8 bits = *cdat++; - fb_writel((tab_cfb16[bits >> 6] & eorx) ^ bgx, dest); - fb_writel((tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx, dest+4); - fb_writel((tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx, dest+8); - fb_writel((tab_cfb16[bits & 3] & eorx) ^ bgx, dest+12); - bits = *cdat++; - fb_writel((tab_cfb16[bits >> 6] & eorx) ^ bgx, dest+16); - fb_writel((tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx, dest+20); - if (fontwidth(p) == 16) { - fb_writel((tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx, dest+24); - fb_writel((tab_cfb16[bits & 3] & eorx) ^ bgx, dest+28); - } - } - dest0 += fontwidth(p)*2; - } - break; - } -} - -void fbcon_cfb16_revc(struct display *p, int xx, int yy) -{ - u8 *dest; - int bytes = p->next_line, rows; - - dest = p->fb_info->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p)*2; - for (rows = fontheight(p); rows--; dest += bytes) { - switch (fontwidth(p)) { - case 16: - fb_writel(fb_readl(dest+24) ^ 0xffffffff, dest+24); - fb_writel(fb_readl(dest+28) ^ 0xffffffff, dest+28); - /* FALL THROUGH */ - case 12: - fb_writel(fb_readl(dest+16) ^ 0xffffffff, dest+16); - fb_writel(fb_readl(dest+20) ^ 0xffffffff, dest+20); - /* FALL THROUGH */ - case 8: - fb_writel(fb_readl(dest+8) ^ 0xffffffff, dest+8); - fb_writel(fb_readl(dest+12) ^ 0xffffffff, dest+12); - /* FALL THROUGH */ - case 4: - fb_writel(fb_readl(dest+0) ^ 0xffffffff, dest+0); - fb_writel(fb_readl(dest+4) ^ 0xffffffff, dest+4); - } - } -} - -void fbcon_cfb16_clear_margins(struct vc_data *conp, struct display *p, - int bottom_only) -{ - int bytes = p->next_line; - u32 bgx; - - unsigned int right_start = conp->vc_cols*fontwidth(p); - unsigned int bottom_start = conp->vc_rows*fontheight(p); - unsigned int right_width, bottom_width; - - bgx = ((u16 *)p->dispsw_data)[attr_bgcol_ec(p, conp)]; - - if (!bottom_only && (right_width = p->var.xres-right_start)) - rectfill(p->fb_info->screen_base+right_start*2, right_width, - p->var.yres_virtual, bgx, bytes); - if ((bottom_width = p->var.yres-bottom_start)) - rectfill(p->fb_info->screen_base+(p->var.yoffset+bottom_start)*bytes, - right_start, bottom_width, bgx, bytes); -} - - - /* - * `switch' for the low level operations - */ - -struct display_switch fbcon_cfb16 = { - setup: fbcon_cfb16_setup, - bmove: fbcon_cfb16_bmove, - clear: fbcon_cfb16_clear, - putc: fbcon_cfb16_putc, - putcs: fbcon_cfb16_putcs, - revc: fbcon_cfb16_revc, - clear_margins: fbcon_cfb16_clear_margins, - fontwidthmask: FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16) -}; - - -#ifdef MODULE -MODULE_LICENSE("GPL"); - -int init_module(void) -{ - return 0; -} - -void cleanup_module(void) -{} -#endif /* MODULE */ - - - /* - * Visible symbols for modules - */ - -EXPORT_SYMBOL(fbcon_cfb16); -EXPORT_SYMBOL(fbcon_cfb16_setup); -EXPORT_SYMBOL(fbcon_cfb16_bmove); -EXPORT_SYMBOL(fbcon_cfb16_clear); -EXPORT_SYMBOL(fbcon_cfb16_putc); -EXPORT_SYMBOL(fbcon_cfb16_putcs); -EXPORT_SYMBOL(fbcon_cfb16_revc); -EXPORT_SYMBOL(fbcon_cfb16_clear_margins); diff --git a/drivers/video/fbcon-cfb2.c b/drivers/video/fbcon-cfb2.c deleted file mode 100644 index e4896a6ce9e3..000000000000 --- a/drivers/video/fbcon-cfb2.c +++ /dev/null @@ -1,225 +0,0 @@ -/* - * linux/drivers/video/cfb2.c -- Low level frame buffer operations for 2 bpp - * packed pixels - * - * Created 26 Dec 1997 by Michael Schmitz - * Based on cfb4.c - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive for - * more details. - */ - -#include <linux/module.h> -#include <linux/tty.h> -#include <linux/console.h> -#include <linux/string.h> -#include <linux/fb.h> - -#include <video/fbcon.h> -#include <video/fbcon-cfb2.h> - - - /* - * 2 bpp packed pixels - */ - - /* - * IFF the font is even pixel aligned (that is to say each - * character start is a byte start in the pixel pairs). That - * avoids us having to mask bytes and means we won't be here - * all week. On a MacII that matters _lots_ - */ - -static u_char nibbletab_cfb2[]={ -#if defined(__BIG_ENDIAN) - 0x00,0x03,0x0c,0x0f, - 0x30,0x33,0x3c,0x3f, - 0xc0,0xc3,0xcc,0xcf, - 0xf0,0xf3,0xfc,0xff -#elif defined(__LITTLE_ENDIAN) - 0x00,0xc0,0x30,0xf0, - 0x0c,0xcc,0x3c,0xfc, - 0x03,0xc3,0x33,0xf3, - 0x0f,0xcf,0x3f,0xff -#else -#error FIXME: No endianness?? -#endif -}; - - -void fbcon_cfb2_setup(struct display *p) -{ - p->next_line = p->fb_info->fix.line_length ? p->fb_info->fix.line_length : p->var.xres_virtual>>2; - p->next_plane = 0; -} - -void fbcon_cfb2_bmove(struct display *p, int sy, int sx, int dy, int dx, - int height, int width) -{ - int bytes = p->next_line, linesize = bytes * fontheight(p), rows; - u8 *src,*dst; - - if (sx == 0 && dx == 0 && width * 2 == bytes) { - fb_memmove(p->fb_info->screen_base + dy * linesize, - p->fb_info->screen_base + sy * linesize, - height * linesize); - } - else { - if (dy < sy || (dy == sy && dx < sx)) { - src = p->fb_info->screen_base + sy * linesize + sx * 2; - dst = p->fb_info->screen_base + dy * linesize + dx * 2; - for (rows = height * fontheight(p) ; rows-- ;) { - fb_memmove(dst, src, width * 2); - src += bytes; - dst += bytes; - } - } - else { - src = p->fb_info->screen_base + (sy+height) * linesize + sx * 2 - bytes; - dst = p->fb_info->screen_base + (dy+height) * linesize + dx * 2 - bytes; - for (rows = height * fontheight(p) ; rows-- ;) { - fb_memmove(dst, src, width * 2); - src -= bytes; - dst -= bytes; - } - } - } -} - -void fbcon_cfb2_clear(struct vc_data *conp, struct display *p, int sy, int sx, - int height, int width) -{ - u8 *dest0,*dest; - int bytes=p->next_line,lines=height * fontheight(p), rows, i; - u32 bgx; - - dest = p->fb_info->screen_base + sy * fontheight(p) * bytes + sx * 2; - - bgx=attr_bgcol_ec(p,conp); - bgx |= (bgx << 2); /* expand the colour to 16 bits */ - bgx |= (bgx << 4); - bgx |= (bgx << 8); - - if (sx == 0 && width * 2 == bytes) { - for (i = 0 ; i < lines * width ; i++) { - fb_writew (bgx, dest); - dest+=2; - } - } else { - dest0=dest; - for (rows = lines; rows-- ; dest0 += bytes) { - dest=dest0; - for (i = 0 ; i < width ; i++) { - /* memset ?? */ - fb_writew (bgx, dest); - dest+=2; - } - } - } -} - -void fbcon_cfb2_putc(struct vc_data *conp, struct display *p, int c, int yy, - int xx) -{ - u8 *dest,*cdat; - int bytes=p->next_line,rows; - u32 eorx,fgx,bgx; - - dest = p->fb_info->screen_base + yy * fontheight(p) * bytes + xx * 2; - cdat = p->fontdata + (c & p->charmask) * fontheight(p); - - fgx=3;/*attr_fgcol(p,c);*/ - bgx=attr_bgcol(p,c); - fgx |= (fgx << 2); /* expand color to 8 bits */ - fgx |= (fgx << 4); - bgx |= (bgx << 2); - bgx |= (bgx << 4); - eorx = fgx ^ bgx; - - for (rows = fontheight(p) ; rows-- ; dest += bytes) { - fb_writeb((nibbletab_cfb2[*cdat >> 4] & eorx) ^ bgx, dest+0); - fb_writeb((nibbletab_cfb2[*cdat++ & 0xf] & eorx) ^ bgx, dest+1); - } -} - -void fbcon_cfb2_putcs(struct vc_data *conp, struct display *p, const unsigned short *s, - int count, int yy, int xx) -{ - u8 *cdat, *dest, *dest0; - u16 c; - int rows,bytes=p->next_line; - u32 eorx, fgx, bgx; - - dest0 = p->fb_info->screen_base + yy * fontheight(p) * bytes + xx * 2; - c = scr_readw(s); - fgx = 3/*attr_fgcol(p, c)*/; - bgx = attr_bgcol(p, c); - fgx |= (fgx << 2); - fgx |= (fgx << 4); - bgx |= (bgx << 2); - bgx |= (bgx << 4); - eorx = fgx ^ bgx; - while (count--) { - c = scr_readw(s++) & p->charmask; - cdat = p->fontdata + c * fontheight(p); - - for (rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) { - fb_writeb((nibbletab_cfb2[*cdat >> 4] & eorx) ^ bgx, dest+0); - fb_writeb((nibbletab_cfb2[*cdat++ & 0xf] & eorx) ^ bgx, dest+1); - } - dest0+=2; - } -} - -void fbcon_cfb2_revc(struct display *p, int xx, int yy) -{ - u8 *dest; - int bytes=p->next_line, rows; - - dest = p->fb_info->screen_base + yy * fontheight(p) * bytes + xx * 2; - for (rows = fontheight(p) ; rows-- ; dest += bytes) { - fb_writew(fb_readw(dest) ^ 0xffff, dest); - } -} - - - /* - * `switch' for the low level operations - */ - -struct display_switch fbcon_cfb2 = { - setup: fbcon_cfb2_setup, - bmove: fbcon_cfb2_bmove, - clear: fbcon_cfb2_clear, - putc: fbcon_cfb2_putc, - putcs: fbcon_cfb2_putcs, - revc: fbcon_cfb2_revc, - fontwidthmask: FONTWIDTH(8) -}; - - -#ifdef MODULE -MODULE_LICENSE("GPL"); - -int init_module(void) -{ - return 0; -} - -void cleanup_module(void) -{} -#endif /* MODULE */ - - - /* - * Visible symbols for modules - */ - -EXPORT_SYMBOL(fbcon_cfb2); -EXPORT_SYMBOL(fbcon_cfb2_setup); -EXPORT_SYMBOL(fbcon_cfb2_bmove); -EXPORT_SYMBOL(fbcon_cfb2_clear); -EXPORT_SYMBOL(fbcon_cfb2_putc); -EXPORT_SYMBOL(fbcon_cfb2_putcs); -EXPORT_SYMBOL(fbcon_cfb2_revc); diff --git a/drivers/video/fbcon-cfb24.c b/drivers/video/fbcon-cfb24.c deleted file mode 100644 index 878bac753eb5..000000000000 --- a/drivers/video/fbcon-cfb24.c +++ /dev/null @@ -1,333 +0,0 @@ -/* - * linux/drivers/video/cfb24.c -- Low level frame buffer operations for 24 bpp - * truecolor packed pixels - * - * Created 7 Mar 1998 by Geert Uytterhoeven - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive for - * more details. - */ - -#include <linux/module.h> -#include <linux/tty.h> -#include <linux/console.h> -#include <linux/string.h> -#include <linux/fb.h> - -#include <video/fbcon.h> -#include <video/fbcon-cfb24.h> - - - /* - * 24 bpp packed pixels - */ - -void fbcon_cfb24_setup(struct display *p) -{ - struct fb_info *info = p->fb_info; - - p->next_line = info->fix.line_length ? info->fix.line_length : p->var.xres_virtual*3; - p->next_plane = 0; -} - -void fbcon_cfb24_bmove(struct display *p, int sy, int sx, int dy, int dx, - int height, int width) -{ - int bytes = p->next_line, linesize = bytes * fontheight(p), rows; - u8 *src, *dst; - - if (sx == 0 && dx == 0 && width * fontwidth(p) * 3 == bytes) { - fb_memmove(p->fb_info->screen_base + dy * linesize, - p->fb_info->screen_base + sy * linesize, - height * linesize); - return; - } - if (fontwidthlog(p)) { - sx <<= fontwidthlog(p); - dx <<= fontwidthlog(p); - width <<= fontwidthlog(p); - } else { - sx *= fontwidth(p); - dx *= fontwidth(p); - width *= fontwidth(p); - } - sx *= 3; dx *= 3; width *= 3; - if (dy < sy || (dy == sy && dx < sx)) { - src = p->fb_info->screen_base + sy * linesize + sx; - dst = p->fb_info->screen_base + dy * linesize + dx; - for (rows = height * fontheight(p); rows--;) { - fb_memmove(dst, src, width); - src += bytes; - dst += bytes; - } - } else { - src = p->fb_info->screen_base + (sy+height) * linesize + sx - bytes; - dst = p->fb_info->screen_base + (dy+height) * linesize + dx - bytes; - for (rows = height * fontheight(p); rows--;) { - fb_memmove(dst, src, width); - src -= bytes; - dst -= bytes; - } - } -} - -#if defined(__BIG_ENDIAN) -#define convert4to3(in1, in2, in3, in4, out1, out2, out3) \ - do { \ - out1 = (in1<<8) | (in2>>16); \ - out2 = (in2<<16) | (in3>>8); \ - out3 = (in3<<24) | in4; \ - } while (0); -#elif defined(__LITTLE_ENDIAN) -#define convert4to3(in1, in2, in3, in4, out1, out2, out3) \ - do { \ - out1 = in1 | (in2<<24); \ - out2 = (in2>> 8) | (in3<<16); \ - out3 = (in3>>16) | (in4<< 8); \ - } while (0); -#else -#error FIXME: No endianness?? -#endif - -static inline void store4pixels(u32 d1, u32 d2, u32 d3, u32 d4, u32 *dest) -{ - u32 o1, o2, o3; - convert4to3(d1, d2, d3, d4, o1, o2, o3); - fb_writel (o1, dest++); - fb_writel (o2, dest++); - fb_writel (o3, dest); -} - -static inline void rectfill(u8 *dest, int width, int height, u32 data, - int linesize) -{ - u32 d1, d2, d3; - int i; - - convert4to3(data, data, data, data, d1, d2, d3); - while (height-- > 0) { - u32 *p = (u32 *)dest; - for (i = 0; i < width/4; i++) { - fb_writel(d1, p++); - fb_writel(d2, p++); - fb_writel(d3, p++); - } - dest += linesize; - } -} - -void fbcon_cfb24_clear(struct vc_data *conp, struct display *p, int sy, int sx, - int height, int width) -{ - u8 *dest; - int bytes = p->next_line, lines = height * fontheight(p); - u32 bgx; - - dest = p->fb_info->screen_base + sy * fontheight(p) * bytes + sx * fontwidth(p) * 3; - - bgx = ((u32 *)p->dispsw_data)[attr_bgcol_ec(p, conp)]; - - width *= fontwidth(p)/4; - if (width * 12 == bytes) - rectfill(dest, lines * width * 4, 1, bgx, bytes); - else - rectfill(dest, width * 4, lines, bgx, bytes); -} - -void fbcon_cfb24_putc(struct vc_data *conp, struct display *p, int c, int yy, - int xx) -{ - u8 *dest, *cdat, bits; - int bytes = p->next_line, rows; - u32 eorx, fgx, bgx, d1, d2, d3, d4; - - dest = p->fb_info->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 3; - if (fontwidth(p) <= 8) - cdat = p->fontdata + (c & p->charmask) * fontheight(p); - else - cdat = p->fontdata + ((c & p->charmask) * fontheight(p) << 1); - - fgx = ((u32 *)p->dispsw_data)[attr_fgcol(p, c)]; - bgx = ((u32 *)p->dispsw_data)[attr_bgcol(p, c)]; - eorx = fgx ^ bgx; - - for (rows = fontheight(p); rows--; dest += bytes) { - bits = *cdat++; - d1 = (-(bits >> 7) & eorx) ^ bgx; - d2 = (-(bits >> 6 & 1) & eorx) ^ bgx; - d3 = (-(bits >> 5 & 1) & eorx) ^ bgx; - d4 = (-(bits >> 4 & 1) & eorx) ^ bgx; - store4pixels(d1, d2, d3, d4, (u32 *)dest); - if (fontwidth(p) < 8) - continue; - d1 = (-(bits >> 3 & 1) & eorx) ^ bgx; - d2 = (-(bits >> 2 & 1) & eorx) ^ bgx; - d3 = (-(bits >> 1 & 1) & eorx) ^ bgx; - d4 = (-(bits & 1) & eorx) ^ bgx; - store4pixels(d1, d2, d3, d4, (u32 *)(dest+12)); - if (fontwidth(p) < 12) - continue; - bits = *cdat++; - d1 = (-(bits >> 7) & eorx) ^ bgx; - d2 = (-(bits >> 6 & 1) & eorx) ^ bgx; - d3 = (-(bits >> 5 & 1) & eorx) ^ bgx; - d4 = (-(bits >> 4 & 1) & eorx) ^ bgx; - store4pixels(d1, d2, d3, d4, (u32 *)(dest+24)); - if (fontwidth(p) < 16) - continue; - d1 = (-(bits >> 3 & 1) & eorx) ^ bgx; - d2 = (-(bits >> 2 & 1) & eorx) ^ bgx; - d3 = (-(bits >> 1 & 1) & eorx) ^ bgx; - d4 = (-(bits & 1) & eorx) ^ bgx; - store4pixels(d1, d2, d3, d4, (u32 *)(dest+36)); - } -} - -void fbcon_cfb24_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, int yy, int xx) -{ - u8 *cdat, *dest, *dest0, bits; - u16 c; - int rows, bytes = p->next_line; - u32 eorx, fgx, bgx, d1, d2, d3, d4; - - dest0 = p->fb_info->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 3; - c = scr_readw(s); - fgx = ((u32 *)p->dispsw_data)[attr_fgcol(p, c)]; - bgx = ((u32 *)p->dispsw_data)[attr_bgcol(p, c)]; - eorx = fgx ^ bgx; - while (count--) { - c = scr_readw(s++) & p->charmask; - if (fontwidth(p) <= 8) - cdat = p->fontdata + c * fontheight(p); - - else - cdat = p->fontdata + (c * fontheight(p) << 1); - for (rows = fontheight(p), dest = dest0; rows--; dest += bytes) { - bits = *cdat++; - d1 = (-(bits >> 7) & eorx) ^ bgx; - d2 = (-(bits >> 6 & 1) & eorx) ^ bgx; - d3 = (-(bits >> 5 & 1) & eorx) ^ bgx; - d4 = (-(bits >> 4 & 1) & eorx) ^ bgx; - store4pixels(d1, d2, d3, d4, (u32 *)dest); - if (fontwidth(p) < 8) - continue; - d1 = (-(bits >> 3 & 1) & eorx) ^ bgx; - d2 = (-(bits >> 2 & 1) & eorx) ^ bgx; - d3 = (-(bits >> 1 & 1) & eorx) ^ bgx; - d4 = (-(bits & 1) & eorx) ^ bgx; - store4pixels(d1, d2, d3, d4, (u32 *)(dest+12)); - if (fontwidth(p) < 12) - continue; - bits = *cdat++; - d1 = (-(bits >> 7) & eorx) ^ bgx; - d2 = (-(bits >> 6 & 1) & eorx) ^ bgx; - d3 = (-(bits >> 5 & 1) & eorx) ^ bgx; - d4 = (-(bits >> 4 & 1) & eorx) ^ bgx; - store4pixels(d1, d2, d3, d4, (u32 *)(dest+24)); - if (fontwidth(p) < 16) - continue; - d1 = (-(bits >> 3 & 1) & eorx) ^ bgx; - d2 = (-(bits >> 2 & 1) & eorx) ^ bgx; - d3 = (-(bits >> 1 & 1) & eorx) ^ bgx; - d4 = (-(bits & 1) & eorx) ^ bgx; - store4pixels(d1, d2, d3, d4, (u32 *)(dest+36)); - } - dest0 += fontwidth(p)*3; - } -} - -void fbcon_cfb24_revc(struct display *p, int xx, int yy) -{ - u8 *dest; - int bytes = p->next_line, rows; - - dest = p->fb_info->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 3; - for (rows = fontheight(p); rows--; dest += bytes) { - switch (fontwidth(p)) { - case 16: - fb_writel(fb_readl(dest+36) ^ 0xffffffff, dest+36); - fb_writel(fb_readl(dest+40) ^ 0xffffffff, dest+40); - fb_writel(fb_readl(dest+44) ^ 0xffffffff, dest+44); - /* FALL THROUGH */ - case 12: - fb_writel(fb_readl(dest+24) ^ 0xffffffff, dest+24); - fb_writel(fb_readl(dest+28) ^ 0xffffffff, dest+28); - fb_writel(fb_readl(dest+32) ^ 0xffffffff, dest+32); - /* FALL THROUGH */ - case 8: - fb_writel(fb_readl(dest+12) ^ 0xffffffff, dest+12); - fb_writel(fb_readl(dest+16) ^ 0xffffffff, dest+16); - fb_writel(fb_readl(dest+20) ^ 0xffffffff, dest+20); - /* FALL THROUGH */ - case 4: - fb_writel(fb_readl(dest+0) ^ 0xffffffff, dest+0); - fb_writel(fb_readl(dest+4) ^ 0xffffffff, dest+4); - fb_writel(fb_readl(dest+8) ^ 0xffffffff, dest+8); - } - } -} - -void fbcon_cfb24_clear_margins(struct vc_data *conp, struct display *p, - int bottom_only) -{ - int bytes = p->next_line; - u32 bgx; - - unsigned int right_start = conp->vc_cols*fontwidth(p); - unsigned int bottom_start = conp->vc_rows*fontheight(p); - unsigned int right_width, bottom_width; - - bgx = ((u32 *)p->dispsw_data)[attr_bgcol_ec(p, conp)]; - - if (!bottom_only && (right_width = p->var.xres-right_start)) - rectfill(p->fb_info->screen_base+right_start*3, right_width, - p->var.yres_virtual, bgx, bytes); - if ((bottom_width = p->var.yres-bottom_start)) - rectfill(p->fb_info->screen_base+(p->var.yoffset+bottom_start)*bytes, - right_start, bottom_width, bgx, bytes); -} - - - /* - * `switch' for the low level operations - */ - -struct display_switch fbcon_cfb24 = { - setup: fbcon_cfb24_setup, - bmove: fbcon_cfb24_bmove, - clear: fbcon_cfb24_clear, - putc: fbcon_cfb24_putc, - putcs: fbcon_cfb24_putcs, - revc: fbcon_cfb24_revc, - clear_margins: fbcon_cfb24_clear_margins, - fontwidthmask: FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16) -}; - - -#ifdef MODULE -MODULE_LICENSE("GPL"); - -int init_module(void) -{ - return 0; -} - -void cleanup_module(void) -{} -#endif /* MODULE */ - - - /* - * Visible symbols for modules - */ - -EXPORT_SYMBOL(fbcon_cfb24); -EXPORT_SYMBOL(fbcon_cfb24_setup); -EXPORT_SYMBOL(fbcon_cfb24_bmove); -EXPORT_SYMBOL(fbcon_cfb24_clear); -EXPORT_SYMBOL(fbcon_cfb24_putc); -EXPORT_SYMBOL(fbcon_cfb24_putcs); -EXPORT_SYMBOL(fbcon_cfb24_revc); -EXPORT_SYMBOL(fbcon_cfb24_clear_margins); diff --git a/drivers/video/fbcon-cfb32.c b/drivers/video/fbcon-cfb32.c deleted file mode 100644 index 76e703610960..000000000000 --- a/drivers/video/fbcon-cfb32.c +++ /dev/null @@ -1,305 +0,0 @@ -/* - * linux/drivers/video/cfb32.c -- Low level frame buffer operations for 32 bpp - * truecolor packed pixels - * - * Created 28 Dec 1997 by Geert Uytterhoeven - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive for - * more details. - */ - -#include <linux/module.h> -#include <linux/tty.h> -#include <linux/console.h> -#include <linux/string.h> -#include <linux/fb.h> - -#include <video/fbcon.h> -#include <video/fbcon-cfb32.h> - - - /* - * 32 bpp packed pixels - */ - -void fbcon_cfb32_setup(struct display *p) -{ - p->next_line = p->fb_info->fix.line_length ? p->fb_info->fix.line_length : p->var.xres_virtual<<2; - p->next_plane = 0; -} - -void fbcon_cfb32_bmove(struct display *p, int sy, int sx, int dy, int dx, - int height, int width) -{ - int bytes = p->next_line, linesize = bytes * fontheight(p), rows; - u8 *src, *dst; - - if (sx == 0 && dx == 0 && width * fontwidth(p) * 4 == bytes) { - fb_memmove(p->fb_info->screen_base + dy * linesize, - p->fb_info->screen_base + sy * linesize, - height * linesize); - return; - } - if (fontwidthlog(p)) { - sx <<= fontwidthlog(p)+2; - dx <<= fontwidthlog(p)+2; - width <<= fontwidthlog(p)+2; - } else { - sx *= fontwidth(p)*4; - dx *= fontwidth(p)*4; - width *= fontwidth(p)*4; - } - if (dy < sy || (dy == sy && dx < sx)) { - src = p->fb_info->screen_base + sy * linesize + sx; - dst = p->fb_info->screen_base + dy * linesize + dx; - for (rows = height * fontheight(p); rows--;) { - fb_memmove(dst, src, width); - src += bytes; - dst += bytes; - } - } else { - src = p->fb_info->screen_base + (sy+height) * linesize + sx - bytes; - dst = p->fb_info->screen_base + (dy+height) * linesize + dx - bytes; - for (rows = height * fontheight(p); rows--;) { - fb_memmove(dst, src, width); - src -= bytes; - dst -= bytes; - } - } -} - -static inline void rectfill(u8 *dest, int width, int height, u32 data, - int linesize) -{ - int i; - - while (height-- > 0) { - u32 *p = (u32 *)dest; - for (i = 0; i < width/4; i++) { - fb_writel(data, p++); - fb_writel(data, p++); - fb_writel(data, p++); - fb_writel(data, p++); - } - if (width & 2) { - fb_writel(data, p++); - fb_writel(data, p++); - } - if (width & 1) - fb_writel(data, p++); - dest += linesize; - } -} - -void fbcon_cfb32_clear(struct vc_data *conp, struct display *p, int sy, int sx, - int height, int width) -{ - u8 *dest; - int bytes = p->next_line, lines = height * fontheight(p); - u32 bgx; - - dest = p->fb_info->screen_base + sy * fontheight(p) * bytes + sx * fontwidth(p) * 4; - - bgx = ((u32 *)p->dispsw_data)[attr_bgcol_ec(p, conp)]; - - width *= fontwidth(p)/4; - if (width * 16 == bytes) - rectfill(dest, lines * width * 4, 1, bgx, bytes); - else - rectfill(dest, width * 4, lines, bgx, bytes); -} - -void fbcon_cfb32_putc(struct vc_data *conp, struct display *p, int c, int yy, - int xx) -{ - u8 *dest, *cdat, bits; - int bytes = p->next_line, rows; - u32 eorx, fgx, bgx, *pt; - - dest = p->fb_info->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 4; - if (fontwidth(p) <= 8) - cdat = p->fontdata + (c & p->charmask) * fontheight(p); - else - cdat = p->fontdata + ((c & p->charmask) * fontheight(p) << 1); - fgx = ((u32 *)p->dispsw_data)[attr_fgcol(p, c)]; - bgx = ((u32 *)p->dispsw_data)[attr_bgcol(p, c)]; - eorx = fgx ^ bgx; - - for (rows = fontheight(p); rows--; dest += bytes) { - bits = *cdat++; - pt = (u32 *) dest; - fb_writel((-(bits >> 7) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 6 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 5 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 4 & 1) & eorx) ^ bgx, pt++); - if (fontwidth(p) < 8) - continue; - fb_writel((-(bits >> 3 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 2 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 1 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits & 1) & eorx) ^ bgx, pt++); - if (fontwidth(p) < 12) - continue; - bits = *cdat++; - fb_writel((-(bits >> 7) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 6 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 5 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 4 & 1) & eorx) ^ bgx, pt++); - if (fontwidth(p) < 16) - continue; - fb_writel((-(bits >> 3 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 2 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 1 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits & 1) & eorx) ^ bgx, pt++); - } -} - -void fbcon_cfb32_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, int yy, int xx) -{ - u8 *cdat, *dest, *dest0, bits; - u16 c; - int rows, bytes = p->next_line; - u32 eorx, fgx, bgx, *pt; - - dest0 = p->fb_info->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 4; - c = scr_readw(s); - fgx = ((u32 *)p->dispsw_data)[attr_fgcol(p, c)]; - bgx = ((u32 *)p->dispsw_data)[attr_bgcol(p, c)]; - eorx = fgx ^ bgx; - while (count--) { - c = scr_readw(s++) & p->charmask; - if (fontwidth(p) <= 8) - cdat = p->fontdata + c * fontheight(p); - else - cdat = p->fontdata + (c * fontheight(p) << 1); - for (rows = fontheight(p), dest = dest0; rows--; dest += bytes) { - bits = *cdat++; - pt = (u32 *) dest; - fb_writel((-(bits >> 7) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 6 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 5 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 4 & 1) & eorx) ^ bgx, pt++); - if (fontwidth(p) < 8) - continue; - fb_writel((-(bits >> 3 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 2 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 1 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits & 1) & eorx) ^ bgx, pt++); - if (fontwidth(p) < 12) - continue; - bits = *cdat++; - fb_writel((-(bits >> 7) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 6 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 5 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 4 & 1) & eorx) ^ bgx, pt++); - if (fontwidth(p) < 16) - continue; - fb_writel((-(bits >> 3 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 2 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits >> 1 & 1) & eorx) ^ bgx, pt++); - fb_writel((-(bits & 1) & eorx) ^ bgx, pt++); - } - dest0 += fontwidth(p)*4; - } -} - -void fbcon_cfb32_revc(struct display *p, int xx, int yy) -{ - u8 *dest; - int bytes = p->next_line, rows; - - dest = p->fb_info->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 4; - for (rows = fontheight(p); rows--; dest += bytes) { - switch (fontwidth(p)) { - case 16: - fb_writel(fb_readl(dest+(4*12)) ^ 0xffffffff, dest+(4*12)); - fb_writel(fb_readl(dest+(4*13)) ^ 0xffffffff, dest+(4*13)); - fb_writel(fb_readl(dest+(4*14)) ^ 0xffffffff, dest+(4*14)); - fb_writel(fb_readl(dest+(4*15)) ^ 0xffffffff, dest+(4*15)); - /* FALL THROUGH */ - case 12: - fb_writel(fb_readl(dest+(4*8)) ^ 0xffffffff, dest+(4*8)); - fb_writel(fb_readl(dest+(4*9)) ^ 0xffffffff, dest+(4*9)); - fb_writel(fb_readl(dest+(4*10)) ^ 0xffffffff, dest+(4*10)); - fb_writel(fb_readl(dest+(4*11)) ^ 0xffffffff, dest+(4*11)); - /* FALL THROUGH */ - case 8: - fb_writel(fb_readl(dest+(4*4)) ^ 0xffffffff, dest+(4*4)); - fb_writel(fb_readl(dest+(4*5)) ^ 0xffffffff, dest+(4*5)); - fb_writel(fb_readl(dest+(4*6)) ^ 0xffffffff, dest+(4*6)); - fb_writel(fb_readl(dest+(4*7)) ^ 0xffffffff, dest+(4*7)); - /* FALL THROUGH */ - case 4: - fb_writel(fb_readl(dest+(4*0)) ^ 0xffffffff, dest+(4*0)); - fb_writel(fb_readl(dest+(4*1)) ^ 0xffffffff, dest+(4*1)); - fb_writel(fb_readl(dest+(4*2)) ^ 0xffffffff, dest+(4*2)); - fb_writel(fb_readl(dest+(4*3)) ^ 0xffffffff, dest+(4*3)); - /* FALL THROUGH */ - } - } -} - -void fbcon_cfb32_clear_margins(struct vc_data *conp, struct display *p, - int bottom_only) -{ - int bytes = p->next_line; - u32 bgx; - - unsigned int right_start = conp->vc_cols*fontwidth(p); - unsigned int bottom_start = conp->vc_rows*fontheight(p); - unsigned int right_width, bottom_width; - - bgx = ((u32 *)p->dispsw_data)[attr_bgcol_ec(p, conp)]; - - if (!bottom_only && (right_width = p->var.xres-right_start)) - rectfill(p->fb_info->screen_base+right_start*4, right_width, - p->var.yres_virtual, bgx, bytes); - if ((bottom_width = p->var.yres-bottom_start)) - rectfill(p->fb_info->screen_base+(p->var.yoffset+bottom_start)*bytes, - right_start, bottom_width, bgx, bytes); -} - - - /* - * `switch' for the low level operations - */ - -struct display_switch fbcon_cfb32 = { - setup: fbcon_cfb32_setup, - bmove: fbcon_cfb32_bmove, - clear: fbcon_cfb32_clear, - putc: fbcon_cfb32_putc, - putcs: fbcon_cfb32_putcs, - revc: fbcon_cfb32_revc, - clear_margins: fbcon_cfb32_clear_margins, - fontwidthmask: FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16) -}; - - -#ifdef MODULE -MODULE_LICENSE("GPL"); - -int init_module(void) -{ - return 0; -} - -void cleanup_module(void) -{} -#endif /* MODULE */ - - - /* - * Visible symbols for modules - */ - -EXPORT_SYMBOL(fbcon_cfb32); -EXPORT_SYMBOL(fbcon_cfb32_setup); -EXPORT_SYMBOL(fbcon_cfb32_bmove); -EXPORT_SYMBOL(fbcon_cfb32_clear); -EXPORT_SYMBOL(fbcon_cfb32_putc); -EXPORT_SYMBOL(fbcon_cfb32_putcs); -EXPORT_SYMBOL(fbcon_cfb32_revc); -EXPORT_SYMBOL(fbcon_cfb32_clear_margins); diff --git a/drivers/video/fbcon-cfb4.c b/drivers/video/fbcon-cfb4.c deleted file mode 100644 index 5af563a65965..000000000000 --- a/drivers/video/fbcon-cfb4.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * linux/drivers/video/cfb4.c -- Low level frame buffer operations for 4 bpp - * packed pixels - * - * Created 26 Dec 1997 by Michael Schmitz - * Based on the old macfb.c 4bpp code by Alan Cox - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive for - * more details. - */ - -#include <linux/module.h> -#include <linux/tty.h> -#include <linux/console.h> -#include <linux/string.h> -#include <linux/fb.h> - -#include <video/fbcon.h> -#include <video/fbcon-cfb4.h> - - - /* - * 4 bpp packed pixels - */ - - /* - * IFF the font is even pixel aligned (that is to say each - * character start is a byte start in the pixel pairs). That - * avoids us having to mask bytes and means we won't be here - * all week. On a MacII that matters _lots_ - */ - -static u16 nibbletab_cfb4[] = { -#if defined(__BIG_ENDIAN) - 0x0000,0x000f,0x00f0,0x00ff, - 0x0f00,0x0f0f,0x0ff0,0x0fff, - 0xf000,0xf00f,0xf0f0,0xf0ff, - 0xff00,0xff0f,0xfff0,0xffff -#elif defined(__LITTLE_ENDIAN) - 0x0000,0xf000,0x0f00,0xff00, - 0x00f0,0xf0f0,0x0ff0,0xfff0, - 0x000f,0xf00f,0x0f0f,0xff0f, - 0x00ff,0xf0ff,0x0fff,0xffff -#else -#error FIXME: No endianness?? -#endif - -}; - -void fbcon_cfb4_setup(struct display *p) -{ - p->next_line = p->fb_info->fix.line_length ? p->fb_info->fix.line_length : p->var.xres_virtual>>1; - p->next_plane = 0; -} - -void fbcon_cfb4_bmove(struct display *p, int sy, int sx, int dy, int dx, - int height, int width) -{ - int bytes = p->next_line, linesize = bytes * fontheight(p), rows; - u8 *src,*dst; - - if (sx == 0 && dx == 0 && width * 4 == bytes) { - fb_memmove(p->fb_info->screen_base + dy * linesize, - p->fb_info->screen_base + sy * linesize, - height * linesize); - } - else { - if (dy < sy || (dy == sy && dx < sx)) { - src = p->fb_info->screen_base + sy * linesize + sx * 4; - dst = p->fb_info->screen_base + dy * linesize + dx * 4; - for (rows = height * fontheight(p) ; rows-- ;) { - fb_memmove(dst, src, width * 4); - src += bytes; - dst += bytes; - } - } - else { - src = p->fb_info->screen_base + (sy+height) * linesize + sx * 4 - bytes; - dst = p->fb_info->screen_base + (dy+height) * linesize + dx * 4 - bytes; - for (rows = height * fontheight(p) ; rows-- ;) { - fb_memmove(dst, src, width * 4); - src -= bytes; - dst -= bytes; - } - } - } -} - -void fbcon_cfb4_clear(struct vc_data *conp, struct display *p, int sy, int sx, - int height, int width) -{ - u8 *dest0,*dest; - int bytes=p->next_line,lines=height * fontheight(p), rows, i; - u32 bgx; - -/* if(p->fb_info->screen_base!=0xFDD00020) - mac_boom(1);*/ - dest = p->fb_info->screen_base + sy * fontheight(p) * bytes + sx * 4; - - bgx=attr_bgcol_ec(p,conp); - bgx |= (bgx << 4); /* expand the colour to 32bits */ - bgx |= (bgx << 8); - bgx |= (bgx << 16); - - if (sx == 0 && width * 4 == bytes) { - for (i = 0 ; i < lines * width ; i++) { - fb_writel (bgx, dest); - dest+=4; - } - } else { - dest0=dest; - for (rows = lines; rows-- ; dest0 += bytes) { - dest=dest0; - for (i = 0 ; i < width ; i++) { - /* memset ?? */ - fb_writel (bgx, dest); - dest+=4; - } - } - } -} - -void fbcon_cfb4_putc(struct vc_data *conp, struct display *p, int c, int yy, - int xx) -{ - u8 *dest,*cdat; - int bytes=p->next_line,rows; - u32 eorx,fgx,bgx; - - dest = p->fb_info->screen_base + yy * fontheight(p) * bytes + xx * 4; - cdat = p->fontdata + (c & p->charmask) * fontheight(p); - - fgx=attr_fgcol(p,c); - bgx=attr_bgcol(p,c); - fgx |= (fgx << 4); - fgx |= (fgx << 8); - bgx |= (bgx << 4); - bgx |= (bgx << 8); - eorx = fgx ^ bgx; - - for (rows = fontheight(p) ; rows-- ; dest += bytes) { - fb_writew((nibbletab_cfb4[*cdat >> 4] & eorx) ^ bgx, dest+0); - fb_writew((nibbletab_cfb4[*cdat++ & 0xf] & eorx) ^ bgx, dest+2); - } -} - -void fbcon_cfb4_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, int yy, int xx) -{ - u8 *cdat, *dest, *dest0; - u16 c; - int rows,bytes=p->next_line; - u32 eorx, fgx, bgx; - - dest0 = p->fb_info->screen_base + yy * fontheight(p) * bytes + xx * 4; - c = scr_readw(s); - fgx = attr_fgcol(p, c); - bgx = attr_bgcol(p, c); - fgx |= (fgx << 4); - fgx |= (fgx << 8); - fgx |= (fgx << 16); - bgx |= (bgx << 4); - bgx |= (bgx << 8); - bgx |= (bgx << 16); - eorx = fgx ^ bgx; - while (count--) { - c = scr_readw(s++) & p->charmask; - cdat = p->fontdata + c * fontheight(p); - - for (rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) { - fb_writew((nibbletab_cfb4[*cdat >> 4] & eorx) ^ bgx, dest+0); - fb_writew((nibbletab_cfb4[*cdat++ & 0xf] & eorx) ^ bgx, dest+2); - } - dest0+=4; - } -} - -void fbcon_cfb4_revc(struct display *p, int xx, int yy) -{ - u8 *dest; - int bytes=p->next_line, rows; - - dest = p->fb_info->screen_base + yy * fontheight(p) * bytes + xx * 4; - for (rows = fontheight(p) ; rows-- ; dest += bytes) { - fb_writel(fb_readl(dest+0) ^ 0xffffffff, dest+0); - } -} - - - /* - * `switch' for the low level operations - */ - -struct display_switch fbcon_cfb4 = { - setup: fbcon_cfb4_setup, - bmove: fbcon_cfb4_bmove, - clear: fbcon_cfb4_clear, - putc: fbcon_cfb4_putc, - putcs: fbcon_cfb4_putcs, - revc: fbcon_cfb4_revc, - fontwidthmask: FONTWIDTH(8) -}; - - -#ifdef MODULE -MODULE_LICENSE("GPL"); - -int init_module(void) -{ - return 0; -} - -void cleanup_module(void) -{} -#endif /* MODULE */ - - - /* - * Visible symbols for modules - */ - -EXPORT_SYMBOL(fbcon_cfb4); -EXPORT_SYMBOL(fbcon_cfb4_setup); -EXPORT_SYMBOL(fbcon_cfb4_bmove); -EXPORT_SYMBOL(fbcon_cfb4_clear); -EXPORT_SYMBOL(fbcon_cfb4_putc); -EXPORT_SYMBOL(fbcon_cfb4_putcs); -EXPORT_SYMBOL(fbcon_cfb4_revc); diff --git a/drivers/video/fbcon-cfb8.c b/drivers/video/fbcon-cfb8.c deleted file mode 100644 index 1ac103832e2a..000000000000 --- a/drivers/video/fbcon-cfb8.c +++ /dev/null @@ -1,294 +0,0 @@ -/* - * linux/drivers/video/cfb8.c -- Low level frame buffer operations for 8 bpp - * packed pixels - * - * Created 5 Apr 1997 by Geert Uytterhoeven - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive for - * more details. - */ - -#include <linux/module.h> -#include <linux/tty.h> -#include <linux/console.h> -#include <linux/string.h> -#include <linux/fb.h> - -#include <video/fbcon.h> -#include <video/fbcon-cfb8.h> - - - /* - * 8 bpp packed pixels - */ - -static u32 nibbletab_cfb8[] = { -#if defined(__BIG_ENDIAN) - 0x00000000,0x000000ff,0x0000ff00,0x0000ffff, - 0x00ff0000,0x00ff00ff,0x00ffff00,0x00ffffff, - 0xff000000,0xff0000ff,0xff00ff00,0xff00ffff, - 0xffff0000,0xffff00ff,0xffffff00,0xffffffff -#elif defined(__LITTLE_ENDIAN) - 0x00000000,0xff000000,0x00ff0000,0xffff0000, - 0x0000ff00,0xff00ff00,0x00ffff00,0xffffff00, - 0x000000ff,0xff0000ff,0x00ff00ff,0xffff00ff, - 0x0000ffff,0xff00ffff,0x00ffffff,0xffffffff -#else -#error FIXME: No endianness?? -#endif -}; - -void fbcon_cfb8_setup(struct display *p) -{ - p->next_line = p->fb_info->fix.line_length ? p->fb_info->fix.line_length : p->var.xres_virtual; - p->next_plane = 0; -} - -void fbcon_cfb8_bmove(struct display *p, int sy, int sx, int dy, int dx, - int height, int width) -{ - int bytes = p->next_line, linesize = bytes * fontheight(p), rows; - u8 *src,*dst; - - if (sx == 0 && dx == 0 && width * fontwidth(p) == bytes) { - fb_memmove(p->fb_info->screen_base + dy * linesize, - p->fb_info->screen_base + sy * linesize, - height * linesize); - return; - } - if (fontwidthlog(p)) { - sx <<= fontwidthlog(p); dx <<= fontwidthlog(p); width <<= fontwidthlog(p); - } else { - sx *= fontwidth(p); dx *= fontwidth(p); width *= fontwidth(p); - } - if (dy < sy || (dy == sy && dx < sx)) { - src = p->fb_info->screen_base + sy * linesize + sx; - dst = p->fb_info->screen_base + dy * linesize + dx; - for (rows = height * fontheight(p) ; rows-- ;) { - fb_memmove(dst, src, width); - src += bytes; - dst += bytes; - } - } else { - src = p->fb_info->screen_base + (sy+height) * linesize + sx - bytes; - dst = p->fb_info->screen_base + (dy+height) * linesize + dx - bytes; - for (rows = height * fontheight(p) ; rows-- ;) { - fb_memmove(dst, src, width); - src -= bytes; - dst -= bytes; - } - } -} - -static inline void rectfill(u8 *dest, int width, int height, u8 data, - int linesize) -{ - while (height-- > 0) { - fb_memset(dest, data, width); - dest += linesize; - } -} - -void fbcon_cfb8_clear(struct vc_data *conp, struct display *p, int sy, int sx, - int height, int width) -{ - u8 *dest; - int bytes=p->next_line,lines=height * fontheight(p); - u8 bgx; - - dest = p->fb_info->screen_base + sy * fontheight(p) * bytes + sx * fontwidth(p); - - bgx=attr_bgcol_ec(p,conp); - - width *= fontwidth(p); - if (width == bytes) - rectfill(dest, lines * width, 1, bgx, bytes); - else - rectfill(dest, width, lines, bgx, bytes); -} - -void fbcon_cfb8_putc(struct vc_data *conp, struct display *p, int c, int yy, - int xx) -{ - u8 *dest,*cdat; - int bytes=p->next_line,rows; - u32 eorx,fgx,bgx; - - dest = p->fb_info->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p); - if (fontwidth(p) <= 8) - cdat = p->fontdata + (c & p->charmask) * fontheight(p); - else - cdat = p->fontdata + ((c & p->charmask) * fontheight(p) << 1); - - fgx=attr_fgcol(p,c); - bgx=attr_bgcol(p,c); - fgx |= (fgx << 8); - fgx |= (fgx << 16); - bgx |= (bgx << 8); - bgx |= (bgx << 16); - eorx = fgx ^ bgx; - - switch (fontwidth(p)) { - case 4: - for (rows = fontheight(p) ; rows-- ; dest += bytes) - fb_writel((nibbletab_cfb8[*cdat++ >> 4] & eorx) ^ bgx, dest); - break; - case 8: - for (rows = fontheight(p) ; rows-- ; dest += bytes) { - fb_writel((nibbletab_cfb8[*cdat >> 4] & eorx) ^ bgx, dest); - fb_writel((nibbletab_cfb8[*cdat++ & 0xf] & eorx) ^ bgx, dest+4); - } - break; - case 12: - case 16: - for (rows = fontheight(p) ; rows-- ; dest += bytes) { - fb_writel((nibbletab_cfb8[*cdat >> 4] & eorx) ^ bgx, dest); - fb_writel((nibbletab_cfb8[*cdat++ & 0xf] & eorx) ^ bgx, dest+4); - fb_writel((nibbletab_cfb8[(*cdat >> 4) & 0xf] & eorx) ^ bgx, dest+8); - if (fontwidth(p) == 16) - fb_writel((nibbletab_cfb8[*cdat & 0xf] & eorx) ^ bgx, dest+12); - cdat++; - } - break; - } -} - -void fbcon_cfb8_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, int yy, int xx) -{ - u8 *cdat, *dest, *dest0; - u16 c; - int rows,bytes=p->next_line; - u32 eorx, fgx, bgx; - - dest0 = p->fb_info->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p); - c = scr_readw(s); - fgx = attr_fgcol(p, c); - bgx = attr_bgcol(p, c); - fgx |= (fgx << 8); - fgx |= (fgx << 16); - bgx |= (bgx << 8); - bgx |= (bgx << 16); - eorx = fgx ^ bgx; - switch (fontwidth(p)) { - case 4: - while (count--) { - c = scr_readw(s++) & p->charmask; - cdat = p->fontdata + c * fontheight(p); - - for (rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) - fb_writel((nibbletab_cfb8[*cdat++ >> 4] & eorx) ^ bgx, dest); - dest0+=4; - } - break; - case 8: - while (count--) { - c = scr_readw(s++) & p->charmask; - cdat = p->fontdata + c * fontheight(p); - - for (rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) { - fb_writel((nibbletab_cfb8[*cdat >> 4] & eorx) ^ bgx, dest); - fb_writel((nibbletab_cfb8[*cdat++ & 0xf] & eorx) ^ bgx, dest+4); - } - dest0+=8; - } - break; - case 12: - case 16: - while (count--) { - c = scr_readw(s++) & p->charmask; - cdat = p->fontdata + (c * fontheight(p) << 1); - - for (rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) { - fb_writel((nibbletab_cfb8[*cdat >> 4] & eorx) ^ bgx, dest); - fb_writel((nibbletab_cfb8[*cdat++ & 0xf] & eorx) ^ bgx, dest+4); - fb_writel((nibbletab_cfb8[(*cdat >> 4) & 0xf] & eorx) ^ bgx, dest+8); - if (fontwidth(p) == 16) - fb_writel((nibbletab_cfb8[*cdat & 0xf] & eorx) ^ bgx, dest+12); - cdat++; - } - dest0+=fontwidth(p); - } - break; - } -} - -void fbcon_cfb8_revc(struct display *p, int xx, int yy) -{ - u8 *dest; - int bytes=p->next_line, rows; - - dest = p->fb_info->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p); - for (rows = fontheight(p) ; rows-- ; dest += bytes) { - switch (fontwidth(p)) { - case 16: fb_writel(fb_readl(dest+12) ^ 0x0f0f0f0f, dest+12); /* fall thru */ - case 12: fb_writel(fb_readl(dest+8) ^ 0x0f0f0f0f, dest+8); /* fall thru */ - case 8: fb_writel(fb_readl(dest+4) ^ 0x0f0f0f0f, dest+4); /* fall thru */ - case 4: fb_writel(fb_readl(dest) ^ 0x0f0f0f0f, dest); /* fall thru */ - default: break; - } - } -} - -void fbcon_cfb8_clear_margins(struct vc_data *conp, struct display *p, - int bottom_only) -{ - int bytes=p->next_line; - u8 bgx; - - unsigned int right_start = conp->vc_cols*fontwidth(p); - unsigned int bottom_start = conp->vc_rows*fontheight(p); - unsigned int right_width, bottom_width; - - bgx=attr_bgcol_ec(p,conp); - - if (!bottom_only && (right_width = p->var.xres-right_start)) - rectfill(p->fb_info->screen_base+right_start, right_width, p->var.yres_virtual, bgx, bytes); - if ((bottom_width = p->var.yres-bottom_start)) - rectfill(p->fb_info->screen_base+(p->var.yoffset+bottom_start)*bytes, - right_start, bottom_width, bgx, bytes); -} - - - /* - * `switch' for the low level operations - */ - -struct display_switch fbcon_cfb8 = { - setup: fbcon_cfb8_setup, - bmove: fbcon_cfb8_bmove, - clear: fbcon_cfb8_clear, - putc: fbcon_cfb8_putc, - putcs: fbcon_cfb8_putcs, - revc: fbcon_cfb8_revc, - clear_margins: fbcon_cfb8_clear_margins, - fontwidthmask: FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16) -}; - - -#ifdef MODULE -MODULE_LICENSE("GPL"); - -int init_module(void) -{ - return 0; -} - -void cleanup_module(void) -{} -#endif /* MODULE */ - - - /* - * Visible symbols for modules - */ - -EXPORT_SYMBOL(fbcon_cfb8); -EXPORT_SYMBOL(fbcon_cfb8_setup); -EXPORT_SYMBOL(fbcon_cfb8_bmove); -EXPORT_SYMBOL(fbcon_cfb8_clear); -EXPORT_SYMBOL(fbcon_cfb8_putc); -EXPORT_SYMBOL(fbcon_cfb8_putcs); -EXPORT_SYMBOL(fbcon_cfb8_revc); -EXPORT_SYMBOL(fbcon_cfb8_clear_margins); diff --git a/drivers/video/fbcon-mfb.c b/drivers/video/fbcon-mfb.c deleted file mode 100644 index 21b7b3ddaba7..000000000000 --- a/drivers/video/fbcon-mfb.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - * linux/drivers/video/mfb.c -- Low level frame buffer operations for - * monochrome - * - * Created 5 Apr 1997 by Geert Uytterhoeven - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive for - * more details. - */ - -#include <linux/module.h> -#include <linux/tty.h> -#include <linux/console.h> -#include <linux/string.h> -#include <linux/fb.h> - -#include <video/fbcon.h> -#include <video/fbcon-mfb.h> - - - /* - * Monochrome - */ - -void fbcon_mfb_setup(struct display *p) -{ - if (p->fb_info->fix.line_length) - p->next_line = p->fb_info->fix.line_length; - else - p->next_line = p->var.xres_virtual>>3; - p->next_plane = 0; -} - -void fbcon_mfb_bmove(struct display *p, int sy, int sx, int dy, int dx, - int height, int width) -{ - u8 *src, *dest; - u_int rows; - - if (sx == 0 && dx == 0 && width == p->next_line) { - src = p->fb_info->screen_base+sy*fontheight(p)*width; - dest = p->fb_info->screen_base+dy*fontheight(p)*width; - fb_memmove(dest, src, height*fontheight(p)*width); - } else if (dy <= sy) { - src = p->fb_info->screen_base+sy*fontheight(p)*p->next_line+sx; - dest = p->fb_info->screen_base+dy*fontheight(p)*p->next_line+dx; - for (rows = height*fontheight(p); rows--;) { - fb_memmove(dest, src, width); - src += p->next_line; - dest += p->next_line; - } - } else { - src = p->fb_info->screen_base+((sy+height)*fontheight(p)-1)*p->next_line+sx; - dest = p->fb_info->screen_base+((dy+height)*fontheight(p)-1)*p->next_line+dx; - for (rows = height*fontheight(p); rows--;) { - fb_memmove(dest, src, width); - src -= p->next_line; - dest -= p->next_line; - } - } -} - -void fbcon_mfb_clear(struct vc_data *conp, struct display *p, int sy, int sx, - int height, int width) -{ - u8 *dest; - u_int rows; - int inverse = conp ? attr_reverse(p,conp->vc_video_erase_char) : 0; - - dest = p->fb_info->screen_base+sy*fontheight(p)*p->next_line+sx; - - if (sx == 0 && width == p->next_line) { - if (inverse) - fb_memset255(dest, height*fontheight(p)*width); - else - fb_memclear(dest, height*fontheight(p)*width); - } else - for (rows = height*fontheight(p); rows--; dest += p->next_line) - if (inverse) - fb_memset255(dest, width); - else - fb_memclear_small(dest, width); -} - -void fbcon_mfb_putc(struct vc_data *conp, struct display *p, int c, int yy, - int xx) -{ - u8 *dest, *cdat; - u_int rows, bold, revs, underl; - u8 d; - - dest = p->fb_info->screen_base+yy*fontheight(p)*p->next_line+xx; - cdat = p->fontdata+(c&p->charmask)*fontheight(p); - bold = attr_bold(p,c); - revs = attr_reverse(p,c); - underl = attr_underline(p,c); - - for (rows = fontheight(p); rows--; dest += p->next_line) { - d = *cdat++; - if (underl && !rows) - d = 0xff; - else if (bold) - d |= d>>1; - if (revs) - d = ~d; - fb_writeb (d, dest); - } -} - -void fbcon_mfb_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, int yy, int xx) -{ - u8 *dest, *dest0, *cdat; - u_int rows, bold, revs, underl; - u8 d; - u16 c; - - dest0 = p->fb_info->screen_base+yy*fontheight(p)*p->next_line+xx; - c = scr_readw(s); - bold = attr_bold(p, c); - revs = attr_reverse(p, c); - underl = attr_underline(p, c); - - while (count--) { - c = scr_readw(s++) & p->charmask; - dest = dest0++; - cdat = p->fontdata+c*fontheight(p); - for (rows = fontheight(p); rows--; dest += p->next_line) { - d = *cdat++; - if (underl && !rows) - d = 0xff; - else if (bold) - d |= d>>1; - if (revs) - d = ~d; - fb_writeb (d, dest); - } - } -} - -void fbcon_mfb_revc(struct display *p, int xx, int yy) -{ - u8 *dest, d; - u_int rows; - - dest = p->fb_info->screen_base+yy*fontheight(p)*p->next_line+xx; - for (rows = fontheight(p); rows--; dest += p->next_line) { - d = fb_readb(dest); - fb_writeb (~d, dest); - } -} - -void fbcon_mfb_clear_margins(struct vc_data *conp, struct display *p, - int bottom_only) -{ - u8 *dest; - int height, bottom; - int inverse = conp ? attr_reverse(p,conp->vc_video_erase_char) : 0; - - /* XXX Need to handle right margin? */ - - height = p->var.yres - conp->vc_rows * fontheight(p); - if (!height) - return; - bottom = conp->vc_rows + p->yscroll; - if (bottom >= p->vrows) - bottom -= p->vrows; - dest = p->fb_info->screen_base + bottom * fontheight(p) * p->next_line; - if (inverse) - fb_memset255(dest, height * p->next_line); - else - fb_memclear(dest, height * p->next_line); -} - - - /* - * `switch' for the low level operations - */ - -struct display_switch fbcon_mfb = { - setup: fbcon_mfb_setup, - bmove: fbcon_mfb_bmove, - clear: fbcon_mfb_clear, - putc: fbcon_mfb_putc, - putcs: fbcon_mfb_putcs, - revc: fbcon_mfb_revc, - clear_margins: fbcon_mfb_clear_margins, - fontwidthmask: FONTWIDTH(8) -}; - - -#ifdef MODULE -MODULE_LICENSE("GPL"); - -int init_module(void) -{ - return 0; -} - -void cleanup_module(void) -{} -#endif /* MODULE */ - - - /* - * Visible symbols for modules - */ - -EXPORT_SYMBOL(fbcon_mfb); -EXPORT_SYMBOL(fbcon_mfb_setup); -EXPORT_SYMBOL(fbcon_mfb_bmove); -EXPORT_SYMBOL(fbcon_mfb_clear); -EXPORT_SYMBOL(fbcon_mfb_putc); -EXPORT_SYMBOL(fbcon_mfb_putcs); -EXPORT_SYMBOL(fbcon_mfb_revc); -EXPORT_SYMBOL(fbcon_mfb_clear_margins); diff --git a/drivers/video/fbgen.c b/drivers/video/fbgen.c index e13783ed31d8..3f9c2b28bc4e 100644 --- a/drivers/video/fbgen.c +++ b/drivers/video/fbgen.c @@ -20,21 +20,11 @@ #include <asm/uaccess.h> #include <asm/io.h> -#include <video/fbcon.h> -#include <video/fbcon-mfb.h> -#include <video/fbcon-cfb2.h> -#include <video/fbcon-cfb4.h> -#include <video/fbcon-cfb8.h> -#include <video/fbcon-cfb16.h> -#include <video/fbcon-cfb24.h> -#include <video/fbcon-cfb32.h> -#include "fbcon-accel.h" - -int gen_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) +int fb_set_var(struct fb_var_screeninfo *var, struct fb_info *info) { int err; - if (con < 0 || (memcmp(&info->var, var, sizeof(struct fb_var_screeninfo)))) { + if (memcmp(&info->var, var, sizeof(struct fb_var_screeninfo))) { if (!info->fbops->fb_check_var) { *var = info->var; return 0; @@ -46,57 +36,18 @@ int gen_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) { info->var = *var; - if (con == info->currcon) { - if (info->fbops->fb_set_par) - info->fbops->fb_set_par(info); - - if (info->fbops->fb_pan_display) - info->fbops->fb_pan_display(&info->var, con, info); + if (info->fbops->fb_set_par) + info->fbops->fb_set_par(info); - gen_set_disp(con, info); - fb_set_cmap(&info->cmap, 1, info); - } - - if (info->changevar) - info->changevar(con); + if (info->fbops->fb_pan_display) + info->fbops->fb_pan_display(&info->var, info); + fb_set_cmap(&info->cmap, 1, info); } } return 0; } -int gen_get_cmap(struct fb_cmap *cmap, int kspc, int con, struct fb_info *info) -{ - fb_copy_cmap (&info->cmap, cmap, kspc ? 0 : 2); - return 0; -} - -int gen_set_cmap(struct fb_cmap *cmap, int kspc, int con, - struct fb_info *info) -{ - struct display *disp = (con < 0) ? info->disp : (fb_display + con); - struct fb_cmap *dcmap = &disp->cmap; - int err = 0; - - /* No colormap allocated ? */ - if (!dcmap->len) { - int size = info->cmap.len; - - err = fb_alloc_cmap(dcmap, size, 0); - } - - - if (!err && con == info->currcon) { - err = fb_set_cmap(cmap, kspc, info); - dcmap = &info->cmap; - } - - if (!err) - fb_copy_cmap(cmap, dcmap, kspc ? 0 : 1); - return err; -} - -int fbgen_pan_display(struct fb_var_screeninfo *var, int con, - struct fb_info *info) +int fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) { int xoffset = var->xoffset; int yoffset = var->yoffset; @@ -106,12 +57,11 @@ int fbgen_pan_display(struct fb_var_screeninfo *var, int con, xoffset + info->var.xres > info->var.xres_virtual || yoffset + info->var.yres > info->var.yres_virtual) return -EINVAL; - if (con == info->currcon) { - if (info->fbops->fb_pan_display) { - if ((err = info->fbops->fb_pan_display(var, con, info))) + if (info->fbops->fb_pan_display) { + if ((err = info->fbops->fb_pan_display(var, info))) return err; - } else - return -EINVAL; + else + return -EINVAL; } info->var.xoffset = var->xoffset; info->var.yoffset = var->yoffset; @@ -125,125 +75,8 @@ int fbgen_pan_display(struct fb_var_screeninfo *var, int con, /* ---- Helper functions --------------------------------------------------- */ -void gen_set_disp(int con, struct fb_info *info) -{ - struct display *display = (con < 0) ? info->disp : (fb_display + con); - - if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR || - info->fix.visual == FB_VISUAL_DIRECTCOLOR) { - display->can_soft_blank = info->fbops->fb_blank ? 1 : 0; - display->dispsw_data = NULL; - } else { - display->can_soft_blank = 0; - display->dispsw_data = info->pseudo_palette; - } - display->var = info->var; - - /* - * If we are setting all the virtual consoles, also set - * the defaults used to create new consoles. - */ - if (con < 0 || info->var.activate & FB_ACTIVATE_ALL) - info->disp->var = info->var; - - if (info->var.bits_per_pixel == 24) { -#ifdef FBCON_HAS_CFB24 - display->scrollmode = SCROLL_YREDRAW; - display->dispsw = &fbcon_cfb24; - return; -#endif - } - -#ifdef FBCON_HAS_ACCEL - display->scrollmode = SCROLL_YNOMOVE; - display->dispsw = &fbcon_accel; -#else - display->dispsw = &fbcon_dummy; -#endif - return; -} - -/** - * do_install_cmap - install the current colormap - * @con: virtual console number - * @info: generic frame buffer info structure - * - * Installs the current colormap for virtual console @con on - * device @info. - * - */ - -void do_install_cmap(int con, struct fb_info *info) -{ - if (con != info->currcon) - return; - if (fb_display[con].cmap.len) - fb_set_cmap(&fb_display[con].cmap, 1, info); - else { - int size = fb_display[con].var.bits_per_pixel == 16 ? 64 : 256; - fb_set_cmap(fb_default_cmap(size), 1, info); - } -} - -int gen_update_var(int con, struct fb_info *info) -{ - struct display *disp = (con < 0) ? info->disp : (fb_display + con); - int err; - - if (con == info->currcon) { - info->var.xoffset = disp->var.xoffset; - info->var.yoffset = disp->var.yoffset; - info->var.vmode = disp->var.vmode; - if (info->fbops->fb_pan_display) { - if ((err = info->fbops->fb_pan_display(&info->var, con, info))) - return err; - } - } - return 0; -} - -int gen_switch(int con, struct fb_info *info) -{ - struct display *disp; - struct fb_cmap *cmap; - - if (info->currcon >= 0) { - disp = fb_display + info->currcon; - - /* - * Save the old colormap and graphics mode. - */ - disp->var = info->var; - if (disp->cmap.len) - fb_copy_cmap(&info->cmap, &disp->cmap, 0); - } - - info->currcon = con; - disp = fb_display + con; - - /* - * Install the new colormap and change the graphics mode. By default - * fbcon sets all the colormaps and graphics modes to the default - * values at bootup. - * - * Really, we want to set the colormap size depending on the - * depth of the new grpahics mode. For now, we leave it as its - * default 256 entry. - */ - if (disp->cmap.len) - cmap = &disp->cmap; - else - cmap = fb_default_cmap(1 << disp->var.bits_per_pixel); - - fb_copy_cmap(cmap, &info->cmap, 0); - - disp->var.activate = FB_ACTIVATE_NOW; - info->fbops->fb_set_var(&disp->var, con, info); - return 0; -} - /** - * fbgen_blank - blank the screen + * fb_blank - blank the screen * @blank: boolean, 0 unblank, 1 blank * @info: frame buffer info structure * @@ -251,7 +84,7 @@ int gen_switch(int con, struct fb_info *info) * */ -int fbgen_blank(int blank, struct fb_info *info) +int fb_blank(int blank, struct fb_info *info) { struct fb_cmap cmap; u16 black[16]; @@ -267,20 +100,20 @@ int fbgen_blank(int blank, struct fb_info *info) cmap.start = 0; cmap.len = 16; fb_set_cmap(&cmap, 1, info); - } else - do_install_cmap(info->currcon, info); + } else { + if (info->cmap.len) + fb_set_cmap(&info->cmap, 1, info); + else { + int size = info->var.bits_per_pixel == 16 ? 64 : 256; + fb_set_cmap(fb_default_cmap(size), 1, info); + } + } return 0; } /* generic frame buffer operations */ -EXPORT_SYMBOL(gen_set_var); -EXPORT_SYMBOL(gen_get_cmap); -EXPORT_SYMBOL(gen_set_cmap); -EXPORT_SYMBOL(fbgen_pan_display); -/* helper functions */ -EXPORT_SYMBOL(do_install_cmap); -EXPORT_SYMBOL(gen_update_var); -EXPORT_SYMBOL(gen_switch); -EXPORT_SYMBOL(fbgen_blank); +EXPORT_SYMBOL(fb_set_var); +EXPORT_SYMBOL(fb_pan_display); +EXPORT_SYMBOL(fb_blank); MODULE_LICENSE("GPL"); diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index c8f357a2944e..c3217085ee32 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -377,7 +377,7 @@ static int fbmem_read_proc(char *buf, char **start, off_t offset, if (*fi) clen += sprintf(buf + clen, "%d %s\n", GET_FB_IDX((*fi)->node), - (*fi)->modename); + (*fi)->fix.id); *start = buf + offset; if (clen > offset) clen -= offset; @@ -466,10 +466,10 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, int fbidx = GET_FB_IDX(inode->i_rdev); struct fb_info *info = registered_fb[fbidx]; struct fb_ops *fb = info->fbops; - struct fb_cmap cmap; struct fb_var_screeninfo var; struct fb_fix_screeninfo fix; struct fb_con2fbmap con2fb; + struct fb_cmap cmap; int i; if (! fb) @@ -481,11 +481,13 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, case FBIOPUT_VSCREENINFO: if (copy_from_user(&var, (void *) arg, sizeof(var))) return -EFAULT; - i = var.activate & FB_ACTIVATE_ALL - ? set_all_vcs(fbidx, fb, &var, info) - : fb->fb_set_var(&var, PROC_CONSOLE(info), info); - if (i) - return i; + if (var.activate & FB_ACTIVATE_ALL) { + i = set_all_vcs(fbidx, fb, &var, info); + if (i) return i; + } else { + i = fb_set_var(&var, info); + if (i) return i; + } if (copy_to_user((void *) arg, &var, sizeof(var))) return -EFAULT; return 0; @@ -494,21 +496,22 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, case FBIOPUTCMAP: if (copy_from_user(&cmap, (void *) arg, sizeof(cmap))) return -EFAULT; - return (fb->fb_set_cmap(&cmap, 0, PROC_CONSOLE(info), info)); + return (fb_set_cmap(&cmap, 0, info)); case FBIOGETCMAP: if (copy_from_user(&cmap, (void *) arg, sizeof(cmap))) return -EFAULT; - return (fb->fb_get_cmap(&cmap, 0, PROC_CONSOLE(info), info)); + fb_copy_cmap(&info->cmap, &cmap, 0); case FBIOPAN_DISPLAY: if (copy_from_user(&var, (void *) arg, sizeof(var))) return -EFAULT; if (fb->fb_pan_display == NULL) return (var.xoffset || var.yoffset) ? -EINVAL : 0; - if ((i=fb->fb_pan_display(&var, PROC_CONSOLE(info), info))) + if ((i=fb->fb_pan_display(&var, info))) return i; if (copy_to_user((void *) arg, &var, sizeof(var))) return -EFAULT; return i; +#ifdef CONFIG_VT case FBIOGET_CON2FBMAP: if (copy_from_user(&con2fb, (void *)arg, sizeof(con2fb))) return -EFAULT; @@ -537,6 +540,7 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, for (i = 0; i < MAX_NR_CONSOLES; i++) set_con2fb_map(i, con2fb.framebuffer); return 0; +#endif case FBIOBLANK: if (fb->fb_blank == NULL) return -EINVAL; @@ -544,8 +548,7 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, default: if (fb->fb_ioctl == NULL) return -EINVAL; - return fb->fb_ioctl(inode, file, cmd, arg, PROC_CONSOLE(info), - info); + return fb->fb_ioctl(inode, file, cmd, arg, info); } } @@ -746,6 +749,7 @@ register_framebuffer(struct fb_info *fb_info) if (!registered_fb[i]) break; fb_info->node = mk_kdev(FB_MAJOR, i); + fb_info->currcon = -1; registered_fb[i] = fb_info; if (!fb_ever_opened[i]) { struct module *owner = fb_info->fbops->owner; diff --git a/drivers/video/fm2fb.c b/drivers/video/fm2fb.c index 05ed2f341c12..903cf86661ed 100644 --- a/drivers/video/fm2fb.c +++ b/drivers/video/fm2fb.c @@ -21,8 +21,6 @@ #include <linux/zorro.h> #include <asm/io.h> -#include <video/fbcon.h> - /* * Some technical notes: * @@ -133,7 +131,6 @@ static volatile unsigned char *fm2fb_reg; static struct fb_info fb_info; static u32 pseudo_palette[17]; -static struct display display; static struct fb_fix_screeninfo fb_fix __initdata = { .smem_len = FRAMEMASTER_REG, @@ -176,9 +173,6 @@ static int fm2fb_blank(int blank, struct fb_info *info); static struct fb_ops fm2fb_ops = { .owner = THIS_MODULE, - .fb_set_var = gen_set_var, - .fb_get_cmap = gen_get_cmap, - .fb_set_cmap = gen_set_cmap, .fb_setcolreg = fm2fb_setcolreg, .fb_blank = fm2fb_blank, .fb_fillrect = cfb_fillrect, @@ -264,7 +258,6 @@ int __init fm2fb_init(void) if (fm2fb_mode == -1) fm2fb_mode = FM2FB_MODE_PAL; - strcpy(fb_info.modename, fb_fix.id); fb_info.node = NODEV; fb_info.fbops = &fm2fb_ops; fb_info.var = fb_var_modes[fm2fb_mode]; @@ -274,15 +267,8 @@ int __init fm2fb_init(void) fb_info.flags = FBINFO_FLAG_DEFAULT; /* The below feilds will go away !!!! */ - fb_info.currcon = -1; - strcpy(fb_info.modename, fb_info.fix.id); - fb_info.disp = &display; - fb_info.switch_con = gen_switch; - fb_info.updatevar = gen_update_var; fb_alloc_cmap(&fb_info.cmap, 16, 0); - gen_set_disp(-1, &fb_info); - if (register_framebuffer(&fb_info) < 0) return -EINVAL; diff --git a/drivers/video/g364fb.c b/drivers/video/g364fb.c index 6ee7d7d0fe1c..fc7cdd3af470 100644 --- a/drivers/video/g364fb.c +++ b/drivers/video/g364fb.c @@ -31,8 +31,6 @@ #include <asm/io.h> #include <asm/jazz.h> -#include <video/fbcon.h> - /* * Various defines for the G364 */ @@ -74,7 +72,6 @@ #define MON_ID_REG 0xe4100000 /* unused */ #define RESET_REG 0xe4180000 /* Write only */ -static struct display disp; static struct fb_info fb_info; static struct fb_fix_screeninfo fb_fix __initdata = { @@ -109,7 +106,7 @@ static struct fb_var_screeninfo fb_var __initdata = { */ int g364fb_init(void); -static int g364fb_pan_display(struct fb_var_screeninfo *var, int con, +static int g364fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); static int g364fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, @@ -118,9 +115,6 @@ static int g364fb_blank(int blank, struct fb_info *info); static struct fb_ops g364fb_ops = { .owner = THIS_MODULE, - .fb_set_var = gen_set_var, - .fb_get_cmap = gen_get_cmap, - .fb_set_cmap = gen_set_cmap, .fb_setcolreg = g364fb_setcolreg, .fb_pan_display = g364fb_pan_display, .fb_blank = g364fb_blank, @@ -151,7 +145,7 @@ void fbcon_g364fb_cursor(struct display *p, int mode, int x, int y) * * This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag */ -static int g364fb_pan_display(struct fb_var_screeninfo *var, int con, +static int g364fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) { if (var->xoffset || var->yoffset + var->yres > var->yres_virtual) @@ -239,7 +233,6 @@ int __init g364fb_init(void) fb_fix.smem_len = (1 << (mem * 2)) * 512 * 1024; fb_var.yres_virtual = fb_fix.smem_len / fb_var.xres; - strcpy(fb_info.modename, fb_fix.id); fb_info.node = NODEV; fb_info.fbops = &g364fb_ops; fb_info.screen_base = (char *) G364_MEM_BASE; /* virtual kernel address */ @@ -247,15 +240,8 @@ int __init g364fb_init(void) fb_info.fix = fb_fix; fb_info.flags = FBINFO_FLAG_DEFAULT; - fb_info.disp = &disp; - fb_info.currcon = -1; fb_info.fontname[0] = '\0'; - fb_info.changevar = NULL; - fb_info.switch_con = gen_switch; - fb_info.updatevar = gen_update_var; - fb_alloc_cmap(&fb_info.cmap, 255, 0); - gen_set_disp(-1, &fb_info); if (register_framebuffer(&fb_info) < 0) return -EINVAL; diff --git a/drivers/video/hitfb.c b/drivers/video/hitfb.c index a18844098a6c..278f8c2c7967 100644 --- a/drivers/video/hitfb.c +++ b/drivers/video/hitfb.c @@ -29,8 +29,6 @@ #include <asm/io.h> #include <asm/hd64461.h> -#include <video/fbcon.h> - static struct fb_var_screeninfo hitfb_var __initdata = { .activate = FB_ACTIVATE_NOW, .height = -1, @@ -46,7 +44,6 @@ static struct fb_fix_screeninfo hitfb_fix __initdata = { }; static u16 pseudo_palette[17]; -static struct display display; struct fb_info fb_info; static int hitfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) @@ -125,9 +122,6 @@ static int hitfb_setcolreg(unsigned regno, unsigned red, unsigned green, static struct fb_ops hitfb_ops = { .owner = THIS_MODULE, - .fb_set_var = gen_set_var, - .fb_get_cmap = gen_get_cmap, - .fb_set_cmap = gen_set_cmap, .fb_check_var = hitfb_check_var, .fb_set_par = hitfb_set_par, .fb_setcolreg = hitfb_setcolreg, @@ -167,19 +161,11 @@ int __init hitfb_init(void) fb_info.pseudo_palette = pseudo_palette; fb_info.flags = FBINFO_FLAG_DEFAULT; - strcpy(fb_info.modename, fb_info.fix.id); - fb_info.currcon = -1; - fb_info.disp = &display; - fb_info.changevar = NULL; - fb_info.switch_con = gen_switch; - fb_info.updatevar = gen_update_var; fb_info.screen_base = (void *) hitfb_fix.smem_start; size = (fb_info.var.bits_per_pixel == 8) ? 256 : 16; fb_alloc_cmap(&fb_info.cmap, size, 0); - gen_set_var(&fb_info.var, -1, &fb_info); - if (register_framebuffer(&fb_info) < 0) return -EINVAL; diff --git a/drivers/video/hpfb.c b/drivers/video/hpfb.c index 706eb0c6dc53..2d1c7a211ff6 100644 --- a/drivers/video/hpfb.c +++ b/drivers/video/hpfb.c @@ -19,8 +19,6 @@ #include <asm/blinken.h> #include <asm/hwtest.h> -#include <video/fbcon.h> - static struct fb_info fb_info; unsigned long fb_regs; @@ -67,8 +65,6 @@ static struct fb_var_screeninfo hpfb_defined = { .vmode = FB_VMODE_NONINTERLACED, }; -static struct display display; - /* * Set the palette. This may not work on all boards but only experimentation * will tell. @@ -105,9 +101,6 @@ void hpfb_copyarea(struct fb_info *info, struct fb_copyarea *area) static struct fb_ops hpfb_ops = { .owner = THIS_MODULE, - .fb_set_var = gen_set_var, - .fb_get_cmap = gen_get_cmap, - .fb_set_cmap = gen_set_cmap, .fb_setcolreg = hpfb_setcolreg, .fb_fillrect = cfb_fillrect, .fb_copyarea = hpfb_copyarea, @@ -164,16 +157,8 @@ int __init hpfb_init_one(unsigned long base) fb_info.fix = hpfb_fix; fb_info.screen_base = (char *)hpfb_fix.smem_start; // FIXME - /* The below feilds will go away !!!! */ - fb_info.currcon = -1; - strcpy(fb_info.modename, fb_info.fix.id); - fb_info.disp = &display; - fb_info.switch_con = gen_switch; - fb_info.updatevar = gen_update_var; fb_alloc_cmap(&fb_info.cmap, 256, 0); - gen_set_disp(-1, &fb_info); - if (register_framebuffer(&fb_info) < 0) return 1; return 0; diff --git a/drivers/video/macfb.c b/drivers/video/macfb.c index 252cf713c4a2..9211ff1ac10e 100644 --- a/drivers/video/macfb.c +++ b/drivers/video/macfb.c @@ -40,8 +40,6 @@ #include <asm/io.h> #include <asm/machw.h> -#include <video/fbcon.h> - /* Common DAC base address for the LC, RBV, Valkyrie, and IIvx */ #define DAC_BASE 0x50f24000 @@ -173,7 +171,6 @@ static struct fb_fix_screeninfo macfb_fix = { .accel = FB_ACCEL_NONE, }; -static struct display disp; static struct fb_info fb_info; static u32 pseudo_palette[17]; static int inverse = 0; @@ -225,7 +222,7 @@ static int dafb_setpalette (unsigned int regno, unsigned int red, local_irq_save(flags); - /* fbcon will set an entire colourmap, but X won't. Hopefully + /* fbdev will set an entire colourmap, but X won't. Hopefully this should accomodate both of them */ if (regno != lastreg+1) { int i; @@ -588,9 +585,6 @@ static int macfb_setcolreg(unsigned regno, unsigned red, unsigned green, static struct fb_ops macfb_ops = { .owner = THIS_MODULE, - .fb_set_var = gen_set_var, - .fb_get_cmap = gen_get_cmap, - .fb_set_cmap = gen_set_cmap, .fb_setcolreg = macfb_setcolreg, .fb_fillrect = cfb_fillrect, .fb_copyarea = cfb_copyarea, @@ -952,21 +946,14 @@ void __init macfb_init(void) break; } - strcpy(fb_info.modename, macfb_fix.id); - fb_info.changevar = NULL; fb_info.node = NODEV; fb_info.fbops = &macfb_ops; fb_info.var = macfb_defined; fb_info.fix = macfb_fix; - fb_info.currcon = -1; - fb_info.disp = &disp; - fb_info.switch_con = gen_switch; - fb_info.updatevar = gen_update_var; fb_info.pseudo_palette = pseudo_palette; fb_info.flags = FBINFO_FLAG_DEFAULT; fb_alloc_cmap(&fb_info.cmap, video_cmap_len, 0); - gen_set_disp(-1, &fb_info); if (register_framebuffer(&fb_info) < 0) return; diff --git a/drivers/video/maxinefb.c b/drivers/video/maxinefb.c index 6e1fd2f76347..1f16a8c8affb 100644 --- a/drivers/video/maxinefb.c +++ b/drivers/video/maxinefb.c @@ -42,7 +42,6 @@ #include <asm/bootinfo.h> static struct fb_info fb_info; -static struct display disp; static struct fb_var_screeninfo maxinefb_defined = { .xres = 1024, @@ -112,9 +111,6 @@ static int maxinefb_setcolreg(unsigned regno, unsigned red, unsigned green, static struct fb_ops maxinefb_ops = { .owner = THIS_MODULE, - .fb_set_var = gen_set_var, - .fb_get_cmap = gen_get_cmap, - .fb_set_cmap = gen_set_cmap, .fb_setcolreg = maxinefb_setcolreg, .fb_fillrect = cfb_fillrect, .fb_copyarea = cfb_copyarea, @@ -156,23 +152,14 @@ int __init maxinefb_init(void) */ } - /* Let there be consoles... */ - - strcpy(fb_info.modename, "Maxine onboard graphics 1024x768x8"); - fb_info.changevar = NULL; fb_info.node = NODEV; fb_info.fbops = &maxinefb_ops; fb_info.screen_base = (char *) maxinefb_fix.smem_start; fb_info.var = maxinefb_defined; fb_info.fix = maxinefb_fix; - fb_info.disp = &disp; - fb_info.currcon = -1; - fb_info.switch_con = gen_switch; - fb_info.updatevar = gen_update_var; fb_info.flags = FBINFO_FLAG_DEFAULT; fb_alloc_cmap(&fb_info.cmap, 256, 0); - gen_set_disp(-1, &fb_info); if (register_framebuffer(&fb_info) < 0) return 1; diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c index 16d0aeb9184d..5dd60c82914f 100644 --- a/drivers/video/modedb.c +++ b/drivers/video/modedb.c @@ -16,8 +16,6 @@ #include <linux/fb.h> #include <linux/sched.h> -#include <video/fbcon.h> - #undef DEBUG #define name_matches(v, s, l) \ @@ -277,7 +275,7 @@ static int __init my_atoi(const char *name) int __fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info, const struct fb_videomode *mode, unsigned int bpp) { - int err; + int err = 1; DPRINTK("Trying mode %s %dx%d-%d@%d\n", mode->name ? mode->name : "noname", mode->xres, mode->yres, bpp, mode->refresh); @@ -298,7 +296,8 @@ int __fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info, var->vsync_len = mode->vsync_len; var->sync = mode->sync; var->vmode = mode->vmode; - err = info->fbops->fb_set_var(var, PROC_CONSOLE(info), info); + if (info->fbops->fb_check_var) + err = info->fbops->fb_check_var(var, info); var->activate &= ~FB_ACTIVATE_TEST; return !err; } diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c index 08174b35099a..f33874aa81af 100644 --- a/drivers/video/neofb.c +++ b/drivers/video/neofb.c @@ -67,7 +67,6 @@ #include <asm/mtrr.h> #endif -#include <video/fbcon.h> #include <video/neomagic.h> #define NEOFB_VERSION "0.3.3" @@ -1165,10 +1164,9 @@ static void neofb_update_start(struct fb_info *info, /* * Pan or Wrap the Display */ -static int neofb_pan_display(struct fb_var_screeninfo *var, int con, - struct fb_info *fb) +static int neofb_pan_display(struct fb_var_screeninfo *var, + struct fb_info *info) { - struct fb_info *info = (struct fb_info *) fb; u_int y_bottom; y_bottom = var->yoffset; @@ -1389,9 +1387,6 @@ static struct fb_ops neofb_ops = { .owner = THIS_MODULE, .fb_check_var = neofb_check_var, .fb_set_par = neofb_set_par, - .fb_set_var = gen_set_var, - .fb_get_cmap = gen_get_cmap, - .fb_set_cmap = gen_set_cmap, .fb_setcolreg = neofb_setcolreg, .fb_pan_display = neofb_pan_display, .fb_blank = neofb_blank, @@ -1750,18 +1745,17 @@ static struct fb_info *__devinit neo_alloc_fb_info(struct pci_dev *dev, const st struct fb_info *info; struct neofb_par *par; - info = kmalloc(sizeof(struct fb_info) + sizeof(struct display) + - sizeof(u32) * 16, GFP_KERNEL); + info = kmalloc(sizeof(struct fb_info) + + sizeof(u32) * 17, GFP_KERNEL); if (!info) return NULL; - memset(info, 0, sizeof(struct fb_info) + sizeof(struct display)); + memset(info, 0, sizeof(struct fb_info) + sizeof(u32) * 17); par = &default_par; memset(par, 0, sizeof(struct neofb_par)); - info->currcon = -1; info->fix.accel = id->driver_data; par->pci_burst = !nopciburst; @@ -1818,16 +1812,11 @@ static struct fb_info *__devinit neo_alloc_fb_info(struct pci_dev *dev, const st info->var.width = -1; info->var.accel_flags = 0; - strcpy(info->modename, info->fix.id); - info->fbops = &neofb_ops; - info->changevar = NULL; - info->switch_con = gen_switch; info->updatevar = gen_update_var; info->flags = FBINFO_FLAG_DEFAULT; info->par = par; - info->disp = (struct display *) (info + 1); - info->pseudo_palette = (void *) (info->disp + 1); + info->pseudo_palette = (void *) (info + 1); fb_alloc_cmap(&info->cmap, NR_PALETTE, 0); @@ -1881,8 +1870,6 @@ static int __devinit neofb_probe(struct pci_dev *dev, if (err) goto failed; - gen_set_var(neofb_var, -1, info); - /* * Calculate the hsync and vsync frequencies. Note that * we split the 1e12 constant up so that we can preserve diff --git a/drivers/video/offb.c b/drivers/video/offb.c index 4186b17c0d67..70fac775a7b2 100644 --- a/drivers/video/offb.c +++ b/drivers/video/offb.c @@ -24,7 +24,6 @@ #include <linux/delay.h> #include <linux/interrupt.h> #include <linux/fb.h> -#include <linux/selection.h> #include <linux/init.h> #include <linux/ioport.h> #include <asm/io.h> @@ -33,7 +32,6 @@ #include <asm/bootx.h> #endif -#include <video/fbcon.h> #include <video/macmodes.h> /* Supported palette hacks */ @@ -83,9 +81,6 @@ static void offb_init_fb(const char *name, const char *full_name, static struct fb_ops offb_ops = { .owner = THIS_MODULE, - .fb_set_var = gen_set_var, - .fb_get_cmap = gen_get_cmap, - .fb_set_cmap = gen_set_cmap, .fb_setcolreg = offb_setcolreg, .fb_blank = offb_blank, .fb_fillrect = cfb_fillrect, @@ -411,7 +406,7 @@ static void __init offb_init_fb(const char *name, const char *full_name, return; } - size = sizeof(struct fb_info) + sizeof(struct display) + sizeof(u32) * 17; + size = sizeof(struct fb_info) + sizeof(u32) * 17; info = kmalloc(size, GFP_ATOMIC); @@ -528,24 +523,16 @@ static void __init offb_init_fb(const char *name, const char *full_name, strcpy(fix->id, "OFfb "); strncat(fix->id, full_name, sizeof(fix->id)); - strcpy(info->modename, fix->id); info->node = NODEV; info->fbops = &offb_ops; info->screen_base = ioremap(address, fix->smem_len); info->par = par; - info->disp = (struct display *) (info + 1); - info->pseudo_palette = (void *) (info->disp + 1); - info->currcon = -1; + info->pseudo_palette = (void *) (info + 1); info->fontname[0] = '\0'; - info->changevar = NULL; - info->switch_con = gen_switch; - info->updatevar = gen_update_var; info->flags = FBINFO_FLAG_DEFAULT; fb_alloc_cmap(&info->cmap, 256, 0); - gen_set_disp(-1, info); - if (register_framebuffer(info) < 0) { kfree(info); release_mem_region(res_start, res_size); diff --git a/drivers/video/pmag-ba-fb.c b/drivers/video/pmag-ba-fb.c index aba95ee840c4..668caf7a7bef 100644 --- a/drivers/video/pmag-ba-fb.c +++ b/drivers/video/pmag-ba-fb.c @@ -36,8 +36,6 @@ #include <asm/dec/tc.h> #include "pmag-ba-fb.h" -#include <video/fbcon.h> - struct pmag_ba_ramdac_regs { unsigned char addr_low; unsigned char pad0[3]; @@ -52,7 +50,6 @@ struct pmag_ba_ramdac_regs { * Max 3 TURBOchannel slots -> max 3 PMAG-BA :) */ static struct fb_info pmagba_fb_info[3]; -static struct display pmagba_disp[3]; static struct fb_var_screeninfo pmagbafb_defined = { .xres = 1024, @@ -111,9 +108,6 @@ static int pmagbafb_setcolreg(unsigned regno, unsigned red, unsigned green, static struct fb_ops pmagbafb_ops = { .owner = THIS_MODULE, - .fb_set_var = gen_set_var, - .fb_get_cmap = gen_get_cmap, - .fb_set_cmap = gen_set_cmap, .fb_setcolreg = pmagbafb_setcolreg, .fb_fillrect = cfb_fillrect, .fb_copyarea = cfb_copyarea, @@ -124,7 +118,6 @@ int __init pmagbafb_init_one(int slot) { unsigned long base_addr = get_tc_base_addr(slot); struct fb_info *info = &pmagba_fb_info[slot]; - struct display *disp = &pmagba_disp[slot]; printk("PMAG-BA framebuffer in slot %d\n", slot); /* @@ -141,21 +134,14 @@ int __init pmagbafb_init_one(int slot) /* * Let there be consoles.. */ - strcpy(info->modename, pmagbafb_fix.id); - info->changevar = NULL; info->node = NODEV; info->fbops = &pmagbafb_ops; info->var = pmagbafb_defined; info->fix = pmagbafb_fix; info->screen_base = pmagbafb_fix.smem_start; - info->disp = &disp; - info->currcon = -1; - info->switch_con = gen_switch; - info->updatevar = gen_update_var; info->flags = FBINFO_FLAG_DEFAULT; fb_alloc_cmap(&fb_info.cmap, 256, 0); - gen_set_disp(-1, info); if (register_framebuffer(info) < 0) return 1; diff --git a/drivers/video/pmagb-b-fb.c b/drivers/video/pmagb-b-fb.c index 9d95f157ce46..589b2a0e2529 100644 --- a/drivers/video/pmagb-b-fb.c +++ b/drivers/video/pmagb-b-fb.c @@ -39,8 +39,6 @@ #include <asm/dec/tc.h> #include "pmagb-b-fb.h" -#include <video/fbcon.h> - struct pmagb_b_ramdac_regs { unsigned char addr_low; unsigned char pad0[3]; @@ -55,7 +53,6 @@ struct pmagb_b_ramdac_regs { * Max 3 TURBOchannel slots -> max 3 PMAGB-B :) */ static struct fb_info pmagbb_fb_info[3]; -static struct display pmagbb_disp[3]; static struct fb_var_screeninfo pmagbbfb_defined = { .xres = 1280, @@ -114,9 +111,6 @@ static int pmagbbfb_setcolreg(unsigned regno, unsigned red, unsigned green, static struct fb_ops pmagbbfb_ops = { .owner = THIS_MODULE, - .fb_set_var = gen_set_var, - .fb_get_cmap = gen_get_cmap, - .fb_set_cmap = gen_set_cmap, .fb_setcolreg = pmagbbfb_setcolreg, .fb_fillrect = cfb_fillrect, .fb_copyarea = cfb_copyarea, @@ -127,7 +121,6 @@ int __init pmagbbfb_init_one(int slot) { unsigned long base_addr = get_tc_base_addr(slot); struct fb_info *info = &pmagbb_fb_info[slot]; - struct display *disp = &pmagbb_disp[slot]; printk("PMAGB-BA framebuffer in slot %d\n", slot); /* @@ -144,21 +137,14 @@ int __init pmagbbfb_init_one(int slot) /* * Let there be consoles.. */ - strcpy(info->modename, pmagbbfb_fix.id); - info->changevar = NULL; info->node = NODEV; info->fbops = &pmagbbfb_ops; info->var = pmagbbfb_defined; info->fix = pmagbbfb_fix; info->screen_base = pmagbbfb_fix.smem_start; - info->disp = &disp; - info->currcon = -1; - info->switch_con = gen_switch; - info->updatevar = gen_update_var; info->flags = FBINFO_FLAG_DEFAULT; fb_alloc_cmap(&fb_info.cmap, 256, 0); - gen_set_disp(-1, info); if (register_framebuffer(info) < 0) return 1; diff --git a/drivers/video/q40fb.c b/drivers/video/q40fb.c index 97b036f6cce0..4e952e2d9849 100644 --- a/drivers/video/q40fb.c +++ b/drivers/video/q40fb.c @@ -28,13 +28,10 @@ #include <linux/module.h> #include <asm/pgtable.h> -#include <video/fbcon.h> - #define Q40_PHYS_SCREEN_ADDR 0xFE800000 static u32 pseudo_palette[17]; static struct fb_info fb_info; -static struct display display; static struct fb_fix_screeninfo q40fb_fix __initdata = { .id = "Q40", @@ -69,9 +66,6 @@ static int q40fb_setcolreg(unsigned regno, unsigned red, unsigned green, static struct fb_ops q40fb_ops = { .owner = THIS_MODULE, - .fb_set_var = gen_set_var, - .fb_get_cmap = gen_get_cmap, - .fb_set_cmap = gen_set_cmap, .fb_setcolreg = q40fb_setcolreg, .fb_fillrect = cfb_fillrect, .fb_copyarea = cfb_copyarea, @@ -117,15 +111,8 @@ int q40fb_init(void) fb_info.screen_base = (char *) q40fb_fix.smem_start; /* The below feilds will go away !!!! */ - fb_info.currcon = -1; - strcpy(fb_info.modename, fb_info.fix.id); - fb_info.disp = &display; - fb_info.switch_con = gen_switch; - fb_info.updatevar = gen_update_var; fb_alloc_cmap(&fb_info.cmap, 16, 0); - gen_set_disp(-1, &fb_info); - master_outb(3, DISPLAY_CONTROL_REG); if (register_framebuffer(&fb_info) < 0) { diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index d8ac3095f2d0..e296037e6225 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c @@ -1432,7 +1432,7 @@ static void sa1100fb_disable_controller(struct sa1100fb_info *fbi) LCCR0 &= ~LCCR0_LEN; /* Disable LCD Controller */ schedule_timeout(20 * HZ / 1000); - current->state = TASK_RUNNING; + set_current_state(TASK_RUNNING); remove_wait_queue(&fbi->ctrlr_wait, &wait); } diff --git a/drivers/video/sgivwfb.c b/drivers/video/sgivwfb.c index 59400e61e448..4582175b2648 100644 --- a/drivers/video/sgivwfb.c +++ b/drivers/video/sgivwfb.c @@ -26,8 +26,6 @@ #include <asm/io.h> #include <asm/mtrr.h> -#include <video/fbcon.h> - #define INCLUDE_TIMING_TABLE_DATA #define DBE_REG_BASE regs #include <video/sgivw.h> @@ -85,9 +83,6 @@ static struct fb_var_screeninfo sgivwfb_var __initdata = { .vmode = FB_VMODE_NONINTERLACED }; -/* console related variables */ -static struct display disp; - /* * Interface used by the world */ @@ -104,9 +99,6 @@ static int sgivwfb_mmap(struct fb_info *info, struct file *file, static struct fb_ops sgivwfb_ops = { .owner = THIS_MODULE, - .fb_set_var = gen_set_var, - .fb_get_cmap = gen_get_cmap, - .fb_set_cmap = gen_set_cmap, .fb_check_var = sgivwfb_check_var, .fb_set_par = sgivwfb_set_par, .fb_setcolreg = sgivwfb_setcolreg, @@ -240,8 +232,8 @@ static int sgivwfb_check_var(struct fb_var_screeninfo *var, if (var->vmode & FB_VMODE_CONUPDATE) { var->vmode |= FB_VMODE_YWRAP; - var->xoffset = display->var.xoffset; - var->yoffset = display->var.yoffset; + var->xoffset = info->var.xoffset; + var->yoffset = info->var.yoffset; } /* XXX FIXME - forcing var's */ @@ -720,18 +712,12 @@ int __init sgivwfb_init(void) sgivwfb_fix.ywrapstep = ywrap; sgivwfb_fix.ypanstep = ypan; - strcpy(fb_info.modename, sgivwfb_fix.id); - fb_info.changevar = NULL; fb_info.node = NODEV; fb_info.fix = sgivwfb_fix; fb_info.var = sgivwfb_var; fb_info.fbops = &sgivwfb_ops; fb_info.pseudo_palette = pseudo_palette; fb_info.par = &default_par; - fb_info.disp = &disp; - fb_info.currcon = -1; - fb_info.switch_con = gen_switch; - fb_info.updatevar = gen_update_var; fb_info.flags = FBINFO_FLAG_DEFAULT; fb_info.screen_base = @@ -742,8 +728,7 @@ int __init sgivwfb_init(void) goto fail_ioremap_fbmem; } - /* turn on default video mode */ - gen_set_var(&fb_info->var, -1, &fb_info); + fb_alloc_cmap(&fb_info.cmap, 256, 0); if (register_framebuffer(&fb_info) < 0) { printk(KERN_ERR diff --git a/drivers/video/sis/Makefile b/drivers/video/sis/Makefile index 8987332dd1ce..c816cec01859 100644 --- a/drivers/video/sis/Makefile +++ b/drivers/video/sis/Makefile @@ -6,7 +6,7 @@ export-objs := sis_main.o obj-$(CONFIG_FB_SIS) += sisfb.o -sisfb-objs := sis_main.o init.o init301.o +sisfb-objs := sis_main.o sis_accel.o init.o init301.o include $(TOPDIR)/Rules.make diff --git a/drivers/video/sis/sis_accel.c b/drivers/video/sis/sis_accel.c new file mode 100644 index 000000000000..fa0a1851f09b --- /dev/null +++ b/drivers/video/sis/sis_accel.c @@ -0,0 +1,495 @@ +/* + * SiS 300/630/730/540/315/550/650/740 frame buffer driver + * for Linux kernels 2.4.x and 2.5.x + * + * 2D acceleration part + * + * Based on the X driver's sis300_accel.c which is + * Copyright Xavier Ducoin <x.ducoin@lectra.com> + * Copyright 2002 by Thomas Winischhofer, Vienna, Austria + * and sis310_accel.c which is + * Copyright 2002 by Thomas Winischhofer, Vienna, Austria + * + * Author: Thomas Winischhofer <thomas@winischhofer.net> + * (see http://www.winischhofer.net/ + * for more information and updates) + */ + +#include <linux/config.h> +#include <linux/version.h> +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/string.h> +#include <linux/mm.h> +#include <linux/tty.h> +#include <linux/slab.h> +#include <linux/delay.h> +#include <linux/fb.h> +#include <linux/console.h> +#include <linux/selection.h> +#include <linux/ioport.h> +#include <linux/init.h> +#include <linux/pci.h> +#include <linux/vt_kern.h> +#include <linux/capability.h> +#include <linux/fs.h> +#include <linux/agp_backend.h> + +#include <linux/types.h> +#include <linux/sisfb.h> + +#include <asm/io.h> +#include <asm/mtrr.h> + +#include <video/fbcon.h> +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,33) +#include <video/fbcon-cfb8.h> +#include <video/fbcon-cfb16.h> +#include <video/fbcon-cfb24.h> +#include <video/fbcon-cfb32.h> +#endif + +#include "osdef.h" +#include "vgatypes.h" +#include "vstruct.h" +#include "sis_accel.h" + +extern struct video_info ivideo; +extern VGA_ENGINE sisvga_engine; + +static const int sisALUConv[] = +{ + 0x00, /* dest = 0; 0, GXclear, 0 */ + 0x88, /* dest &= src; DSa, GXand, 0x1 */ + 0x44, /* dest = src & ~dest; SDna, GXandReverse, 0x2 */ + 0xCC, /* dest = src; S, GXcopy, 0x3 */ + 0x22, /* dest &= ~src; DSna, GXandInverted, 0x4 */ + 0xAA, /* dest = dest; D, GXnoop, 0x5 */ + 0x66, /* dest = ^src; DSx, GXxor, 0x6 */ + 0xEE, /* dest |= src; DSo, GXor, 0x7 */ + 0x11, /* dest = ~src & ~dest; DSon, GXnor, 0x8 */ + 0x99, /* dest ^= ~src ; DSxn, GXequiv, 0x9 */ + 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */ + 0xDD, /* dest = src|~dest ; SDno, GXorReverse, 0xB */ + 0x33, /* dest = ~src; Sn, GXcopyInverted, 0xC */ + 0xBB, /* dest |= ~src; DSno, GXorInverted, 0xD */ + 0x77, /* dest = ~src|~dest; DSan, GXnand, 0xE */ + 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ +}; +/* same ROP but with Pattern as Source */ +static const int sisPatALUConv[] = +{ + 0x00, /* dest = 0; 0, GXclear, 0 */ + 0xA0, /* dest &= src; DPa, GXand, 0x1 */ + 0x50, /* dest = src & ~dest; PDna, GXandReverse, 0x2 */ + 0xF0, /* dest = src; P, GXcopy, 0x3 */ + 0x0A, /* dest &= ~src; DPna, GXandInverted, 0x4 */ + 0xAA, /* dest = dest; D, GXnoop, 0x5 */ + 0x5A, /* dest = ^src; DPx, GXxor, 0x6 */ + 0xFA, /* dest |= src; DPo, GXor, 0x7 */ + 0x05, /* dest = ~src & ~dest; DPon, GXnor, 0x8 */ + 0xA5, /* dest ^= ~src ; DPxn, GXequiv, 0x9 */ + 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */ + 0xF5, /* dest = src|~dest ; PDno, GXorReverse, 0xB */ + 0x0F, /* dest = ~src; Pn, GXcopyInverted, 0xC */ + 0xAF, /* dest |= ~src; DPno, GXorInverted, 0xD */ + 0x5F, /* dest = ~src|~dest; DPan, GXnand, 0xE */ + 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ +}; + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,34) +static const unsigned char myrops[] = { + 3, 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 + }; +#endif + +/* 300 series */ + +static void +SiS300Sync(void) +{ + SiS300Idle +} + +static void +SiS310Sync(void) +{ + SiS310Idle +} + +static void +SiS300SetupForScreenToScreenCopy(int xdir, int ydir, int rop, + unsigned int planemask, int trans_color) +{ + SiS300SetupDSTColorDepth(ivideo.DstColor); + SiS300SetupSRCPitch(ivideo.video_linelength) + SiS300SetupDSTRect(ivideo.video_linelength, -1) + + if(trans_color != -1) { + SiS300SetupROP(0x0A) + SiS300SetupSRCTrans(trans_color) + SiS300SetupCMDFlag(TRANSPARENT_BITBLT) + } else { + SiS300SetupROP(sisALUConv[rop]) + } + if(xdir > 0) { + SiS300SetupCMDFlag(X_INC) + } + if(ydir > 0) { + SiS300SetupCMDFlag(Y_INC) + } +} + +static void +SiS300SubsequentScreenToScreenCopy(int src_x, int src_y, int dst_x, int dst_y, + int width, int height) +{ + long srcbase, dstbase; + + srcbase = dstbase = 0; + if (src_y >= 2048) { + srcbase = ivideo.video_linelength * src_y; + src_y = 0; + } + if (dst_y >= 2048) { + dstbase = ivideo.video_linelength * dst_y; + dst_y = 0; + } + + SiS300SetupSRCBase(srcbase); + SiS300SetupDSTBase(dstbase); + + if(!(ivideo.CommandReg & X_INC)) { + src_x += width-1; + dst_x += width-1; + } + if(!(ivideo.CommandReg & Y_INC)) { + src_y += height-1; + dst_y += height-1; + } + SiS300SetupRect(width, height) + SiS300SetupSRCXY(src_x, src_y) + SiS300SetupDSTXY(dst_x, dst_y) + SiS300DoCMD +} + +static void +SiS300SetupForSolidFill(int color, int rop, unsigned int planemask) +{ + SiS300SetupPATFG(color) + SiS300SetupDSTRect(ivideo.video_linelength, -1) + SiS300SetupDSTColorDepth(ivideo.DstColor); + SiS300SetupROP(sisPatALUConv[rop]) + SiS300SetupCMDFlag(PATFG) +} + +static void +SiS300SubsequentSolidFillRect(int x, int y, int w, int h) +{ + long dstbase; + + dstbase = 0; + if(y >= 2048) { + dstbase = ivideo.video_linelength * y; + y = 0; + } + SiS300SetupDSTBase(dstbase) + SiS300SetupDSTXY(x,y) + SiS300SetupRect(w,h) + SiS300SetupCMDFlag(X_INC | Y_INC | BITBLT) + SiS300DoCMD +} + +/* 310/325 series ------------------------------------------------ */ + +static void +SiS310SetupForScreenToScreenCopy(int xdir, int ydir, int rop, + unsigned int planemask, int trans_color) +{ + SiS310SetupDSTColorDepth(ivideo.DstColor); + SiS310SetupSRCPitch(ivideo.video_linelength) + SiS310SetupDSTRect(ivideo.video_linelength, -1) + if (trans_color != -1) { + SiS310SetupROP(0x0A) + SiS310SetupSRCTrans(trans_color) + SiS310SetupCMDFlag(TRANSPARENT_BITBLT) + } else { + SiS310SetupROP(sisALUConv[rop]) + /* Set command - not needed, both 0 */ + /* SiSSetupCMDFlag(BITBLT | SRCVIDEO) */ + } + SiS310SetupCMDFlag(ivideo.SiS310_AccelDepth) + /* TW: The 310/325 series is smart enough to know the direction */ +} + +static void +SiS310SubsequentScreenToScreenCopy(int src_x, int src_y, int dst_x, int dst_y, + int width, int height) +{ + long srcbase, dstbase; + + srcbase = dstbase = 0; + if (src_y >= 2048) { + srcbase = ivideo.video_linelength * src_y; + src_y = 0; + } + if (dst_y >= 2048) { + dstbase = ivideo.video_linelength * dst_y; + dst_y = 0; + } + + SiS310SetupSRCBase(srcbase); + SiS310SetupDSTBase(dstbase); + SiS310SetupRect(width, height) + SiS310SetupSRCXY(src_x, src_y) + SiS310SetupDSTXY(dst_x, dst_y) + SiS310DoCMD +} + +static void +SiS310SetupForSolidFill(int color, int rop, unsigned int planemask) +{ + SiS310SetupPATFG(color) + SiS310SetupDSTRect(ivideo.video_linelength, -1) + SiS310SetupDSTColorDepth(ivideo.DstColor); + SiS310SetupROP(sisPatALUConv[rop]) + SiS310SetupCMDFlag(PATFG | ivideo.SiS310_AccelDepth) +} + +static void +SiS310SubsequentSolidFillRect(int x, int y, int w, int h) +{ + long dstbase; + + dstbase = 0; + if(y >= 2048) { + dstbase = ivideo.video_linelength * y; + y = 0; + } + SiS310SetupDSTBase(dstbase) + SiS310SetupDSTXY(x,y) + SiS310SetupRect(w,h) + SiS310SetupCMDFlag(BITBLT) + SiS310DoCMD +} + +/* --------------------------------------------------------------------- */ + +/* The exported routines */ + +int sisfb_initaccel(void) +{ +#ifdef SISFB_USE_SPINLOCKS + spin_lock_init(&ivideo.lockaccel); +#endif + return(0); +} + + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,34) /* --- KERNEL 2.5.34 and later --- */ + +void fbcon_sis_fillrect(struct fb_info *info, struct fb_fillrect *rect) +{ + CRITFLAGS + + if(!rect->width || !rect->height) + return; + + if(sisvga_engine == SIS_300_VGA) { + CRITBEGIN + SiS300SetupForSolidFill(rect->color, myrops[rect->rop], 0); + SiS300SubsequentSolidFillRect(rect->dx, rect->dy, rect->width, rect->height); + CRITEND + SiS300Sync(); + } else { + CRITBEGIN + SiS310SetupForSolidFill(rect->color, myrops[rect->rop], 0); + SiS310SubsequentSolidFillRect(rect->dx, rect->dy, rect->width, rect->height); + CRITEND + SiS310Sync(); + } + +} + +void fbcon_sis_copyarea(struct fb_info *info, struct fb_copyarea *area) +{ + int xdir, ydir; + CRITFLAGS + + if(!area->width || !area->height) + return; + + if(area->sx < area->dx) xdir = 0; + else xdir = 1; + if(area->sy < area->dy) ydir = 0; + else ydir = 1; + + if(sisvga_engine == SIS_300_VGA) { + CRITBEGIN + SiS300SetupForScreenToScreenCopy(xdir, ydir, 3, 0, -1); + SiS300SubsequentScreenToScreenCopy(area->sx, area->sy, area->dx, area->dy, area->width, area->height); + CRITEND + SiS300Sync(); + } else { + CRITBEGIN + SiS310SetupForScreenToScreenCopy(xdir, ydir, 3, 0, -1); + SiS310SubsequentScreenToScreenCopy(area->sx, area->sy, area->dx, area->dy, area->width, area->height); + CRITEND + SiS310Sync(); + } +} + +#endif + +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,33) /* ------ KERNEL <2.5.34 ------ */ + +void fbcon_sis_bmove(struct display *p, int srcy, int srcx, + int dsty, int dstx, int height, int width) +{ + int xdir, ydir; + CRITFLAGS + + srcx *= fontwidth(p); + srcy *= fontheight(p); + dstx *= fontwidth(p); + dsty *= fontheight(p); + width *= fontwidth(p); + height *= fontheight(p); + + + if(srcx < dstx) xdir = 0; + else xdir = 1; + if(srcy < dsty) ydir = 0; + else ydir = 1; + + if(sisvga_engine == SIS_300_VGA) { + CRITBEGIN + SiS300SetupForScreenToScreenCopy(xdir, ydir, 3, 0, -1); + SiS300SubsequentScreenToScreenCopy(srcx, srcy, dstx, dsty, width, height); + CRITEND + SiS300Sync(); + } else { + CRITBEGIN + SiS310SetupForScreenToScreenCopy(xdir, ydir, 3, 0, -1); + SiS310SubsequentScreenToScreenCopy(srcx, srcy, dstx, dsty, width, height); + CRITEND + SiS310Sync(); + } +} + + +static void fbcon_sis_clear(struct vc_data *conp, struct display *p, + int srcy, int srcx, int height, int width, int color) +{ + CRITFLAGS + + srcx *= fontwidth(p); + srcy *= fontheight(p); + width *= fontwidth(p); + height *= fontheight(p); + + if(sisvga_engine == SIS_300_VGA) { + CRITBEGIN + SiS300SetupForSolidFill(color, 3, 0); + SiS300SubsequentSolidFillRect(srcx, srcy, width, height); + CRITEND + SiS300Sync(); + } else { + CRITBEGIN + SiS310SetupForSolidFill(color, 3, 0); + SiS310SubsequentSolidFillRect(srcx, srcy, width, height); + CRITEND + SiS310Sync(); + } +} + +void fbcon_sis_clear8(struct vc_data *conp, struct display *p, + int srcy, int srcx, int height, int width) +{ + u32 bgx; + + bgx = attr_bgcol_ec(p, conp); + fbcon_sis_clear(conp, p, srcy, srcx, height, width, bgx); +} + +void fbcon_sis_clear16(struct vc_data *conp, struct display *p, + int srcy, int srcx, int height, int width) +{ + u32 bgx; + + bgx = ((u_int16_t*)p->dispsw_data)[attr_bgcol_ec(p, conp)]; + fbcon_sis_clear(conp, p, srcy, srcx, height, width, bgx); +} + +void fbcon_sis_clear32(struct vc_data *conp, struct display *p, + int srcy, int srcx, int height, int width) +{ + u32 bgx; + + bgx = ((u_int32_t*)p->dispsw_data)[attr_bgcol_ec(p, conp)]; + fbcon_sis_clear(conp, p, srcy, srcx, height, width, bgx); +} + +void fbcon_sis_revc(struct display *p, int srcx, int srcy) +{ + CRITFLAGS + + srcx *= fontwidth(p); + srcy *= fontheight(p); + + if(sisvga_engine == SIS_300_VGA) { + CRITBEGIN + SiS300SetupForSolidFill(0, 0x0a, 0); + SiS300SubsequentSolidFillRect(srcx, srcy, fontwidth(p), fontheight(p)); + CRITEND + SiS300Sync(); + } else { + CRITBEGIN + SiS310SetupForSolidFill(0, 0x0a, 0); + SiS310SubsequentSolidFillRect(srcx, srcy, fontwidth(p), fontheight(p)); + CRITEND + SiS310Sync(); + } +} + +#ifdef FBCON_HAS_CFB8 +struct display_switch fbcon_sis8 = { + setup: fbcon_cfb8_setup, + bmove: fbcon_sis_bmove, + clear: fbcon_sis_clear8, + putc: fbcon_cfb8_putc, + putcs: fbcon_cfb8_putcs, + revc: fbcon_cfb8_revc, + clear_margins: fbcon_cfb8_clear_margins, + fontwidthmask: FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16) +}; +#endif +#ifdef FBCON_HAS_CFB16 +struct display_switch fbcon_sis16 = { + setup: fbcon_cfb16_setup, + bmove: fbcon_sis_bmove, + clear: fbcon_sis_clear16, + putc: fbcon_cfb16_putc, + putcs: fbcon_cfb16_putcs, + revc: fbcon_sis_revc, + clear_margins: fbcon_cfb16_clear_margins, + fontwidthmask: FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16) +}; +#endif +#ifdef FBCON_HAS_CFB32 +struct display_switch fbcon_sis32 = { + setup: fbcon_cfb32_setup, + bmove: fbcon_sis_bmove, + clear: fbcon_sis_clear32, + putc: fbcon_cfb32_putc, + putcs: fbcon_cfb32_putcs, + revc: fbcon_sis_revc, + clear_margins: fbcon_cfb32_clear_margins, + fontwidthmask: FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16) +}; +#endif + +#endif /* KERNEL VERSION */ + + diff --git a/drivers/video/skeletonfb.c b/drivers/video/skeletonfb.c index 110e85dea332..c4d9d92694b8 100644 --- a/drivers/video/skeletonfb.c +++ b/drivers/video/skeletonfb.c @@ -125,9 +125,6 @@ static struct fb_info info; */ static struct xxx_par __initdata current_par; - /* To go away in the near future */ -static struct display disp; - int xxxfb_init(void); int xxxfb_setup(char*); @@ -298,7 +295,7 @@ static int xxxfb_setcolreg(unsigned regno, unsigned red, unsigned green, * Returns negative errno on error, or zero on success. * */ -static int xxxfb_pan_display(struct fb_var_screeninfo *var, int con, +static int xxxfb_pan_display(struct fb_var_screeninfo *var, const struct fb_info *info) { /* ... */ @@ -421,15 +418,6 @@ int __init xxxfb_init(void) info.flags = FBINFO_FLAG_DEFAULT; info.par = current_par; - /* The following has to be set but in th efuture will go away */ - strcpy(info.modename, xxxfb_fix.id); - info.changevar = NULL; - info.currcon = -1; - info.disp = &disp; - info.switch_con = gen_switch; - info.updatevar = gen_update_var; - - /* * This should give a reasonable default video mode. The following is * done when we can set a video mode. @@ -450,7 +438,6 @@ int __init xxxfb_init(void) * mode. If we are setting the mode ourselves we don't call this. */ info.var = xxxfb_var; - gen_set_disp(-1, &fb_info); if (register_framebuffer(&info) < 0) return -EINVAL; @@ -510,11 +497,6 @@ static struct fb_ops xxxfb_ops = { .owner = THIS_MODULE, .fb_open = xxxfb_open, /* only if you need it to do something */ .fb_release = xxxfb_release, /* only if you need it to do something */ - /* Stuff to go away. Use generic functions for now */ - .fb_set_var = gen_set_var, - .fb_get_cmap = gen_get_cmap, - .fb_set_cmap = gen_set_cmap, - .fb_check_var = xxxfb_check_var, .fb_set_par = xxxfb_set_par, /* optional */ .fb_setcolreg = xxxfb_setcolreg, diff --git a/drivers/video/tdfxfb.c b/drivers/video/tdfxfb.c index bde930eb65f3..1dfddbc0ae8b 100644 --- a/drivers/video/tdfxfb.c +++ b/drivers/video/tdfxfb.c @@ -77,7 +77,6 @@ #include <linux/spinlock.h> #include <video/tdfx.h> -#include <video/fbcon.h> #undef TDFXFB_DEBUG #ifdef TDFXFB_DEBUG @@ -143,10 +142,10 @@ static struct pci_device_id tdfxfb_id_table[] __devinitdata = { }; static struct pci_driver tdfxfb_driver = { - .name = "tdfxfb", - .id_table = tdfxfb_id_table, - .probe = tdfxfb_probe, - .remove = __devexit_p(tdfxfb_remove), + .name = "tdfxfb", + .id_table = tdfxfb_id_table, + .probe = tdfxfb_probe, + .remove = __devexit_p(tdfxfb_remove), }; MODULE_DEVICE_TABLE(pci, tdfxfb_id_table); @@ -162,16 +161,13 @@ static int tdfxfb_set_par(struct fb_info *info); static int tdfxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info); static int tdfxfb_blank(int blank, struct fb_info *info); -static int tdfxfb_pan_display(struct fb_var_screeninfo *var, int con, struct fb_info *info); +static int tdfxfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); static void tdfxfb_fillrect(struct fb_info *info, struct fb_fillrect *rect); static void tdfxfb_copyarea(struct fb_info *info, struct fb_copyarea *area); static void tdfxfb_imageblit(struct fb_info *info, struct fb_image *image); static struct fb_ops tdfxfb_ops = { .owner = THIS_MODULE, - .fb_set_var = gen_set_var, - .fb_get_cmap = gen_get_cmap, - .fb_set_cmap = gen_set_cmap, .fb_check_var = tdfxfb_check_var, .fb_set_par = tdfxfb_set_par, .fb_setcolreg = tdfxfb_setcolreg, @@ -186,14 +182,12 @@ static struct fb_ops tdfxfb_ops = { * do_xxx: Hardware-specific functions */ static u32 do_calc_pll(int freq, int *freq_out); -static void do_write_regs(struct banshee_reg *reg); -static unsigned long do_lfb_size(unsigned short); +static void do_write_regs(struct tdfx_par *par, struct banshee_reg *reg); +static unsigned long do_lfb_size(struct tdfx_par *par, unsigned short); /* * Driver data */ -static struct tdfx_par default_par; - static int nopan = 0; static int nowrap = 1; // not implemented (yet) static int inverse = 0; @@ -204,132 +198,132 @@ static char *mode_option __initdata = NULL; * ------------------------------------------------------------------------- */ #ifdef VGA_REG_IO -static inline u8 vga_inb(u32 reg) { return inb(reg); } -static inline u16 vga_inw(u32 reg) { return inw(reg); } -static inline u16 vga_inl(u32 reg) { return inl(reg); } +static inline u8 vga_inb(struct tdfx_par *par, u32 reg) { return inb(reg); } +static inline u16 vga_inw(struct tdfx_par *par, u32 reg) { return inw(reg); } +static inline u16 vga_inl(struct tdfx_par *par, u32 reg) { return inl(reg); } -static inline void vga_outb(u32 reg, u8 val) { outb(val, reg); } -static inline void vga_outw(u32 reg, u16 val) { outw(val, reg); } -static inline void vga_outl(u32 reg, u32 val) { outl(val, reg); } +static inline void vga_outb(struct tdfx_par *par, u32 reg, u8 val) { outb(val, reg); } +static inline void vga_outw(struct tdfx_par *par, u32 reg, u16 val) { outw(val, reg); } +static inline void vga_outl(struct tdfx_par *par, u32 reg, u32 val) { outl(val, reg); } #else -static inline u8 vga_inb(u32 reg) { - return inb(default_par.iobase + reg - 0x300); +static inline u8 vga_inb(struct tdfx_par *par, u32 reg) { + return inb(par->iobase + reg - 0x300); } -static inline u16 vga_inw(u32 reg) { - return inw(default_par.iobase + reg - 0x300); +static inline u16 vga_inw(struct tdfx_par *par, u32 reg) { + return inw(par->iobase + reg - 0x300); } -static inline u16 vga_inl(u32 reg) { - return inl(default_par.iobase + reg - 0x300); +static inline u16 vga_inl(struct tdfx_par *par, u32 reg) { + return inl(par->iobase + reg - 0x300); } -static inline void vga_outb(u32 reg, u8 val) { - outb(val, default_par.iobase + reg - 0x300); +static inline void vga_outb(struct tdfx_par *par, u32 reg, u8 val) { + outb(val, par->iobase + reg - 0x300); } -static inline void vga_outw(u32 reg, u16 val) { - outw(val, default_par.iobase + reg - 0x300); +static inline void vga_outw(struct tdfx_par *par, u32 reg, u16 val) { + outw(val, par->iobase + reg - 0x300); } -static inline void vga_outl(u32 reg, u32 val) { - outl(val, default_par.iobase + reg - 0x300); +static inline void vga_outl(struct tdfx_par *par, u32 reg, u32 val) { + outl(val, par->iobase + reg - 0x300); } #endif -static inline void gra_outb(u32 idx, u8 val) { - vga_outb(GRA_I, idx); vga_outb(GRA_D, val); +static inline void gra_outb(struct tdfx_par *par, u32 idx, u8 val) { + vga_outb(par, GRA_I, idx); vga_outb(par, GRA_D, val); } -static inline u8 gra_inb(u32 idx) { - vga_outb(GRA_I, idx); return vga_inb(GRA_D); +static inline u8 gra_inb(struct tdfx_par *par, u32 idx) { + vga_outb(par, GRA_I, idx); return vga_inb(par, GRA_D); } -static inline void seq_outb(u32 idx, u8 val) { - vga_outb(SEQ_I, idx); vga_outb(SEQ_D, val); +static inline void seq_outb(struct tdfx_par *par, u32 idx, u8 val) { + vga_outb(par, SEQ_I, idx); vga_outb(par, SEQ_D, val); } -static inline u8 seq_inb(u32 idx) { - vga_outb(SEQ_I, idx); return vga_inb(SEQ_D); +static inline u8 seq_inb(struct tdfx_par *par, u32 idx) { + vga_outb(par, SEQ_I, idx); return vga_inb(par, SEQ_D); } -static inline void crt_outb(u32 idx, u8 val) { - vga_outb(CRT_I, idx); vga_outb(CRT_D, val); +static inline void crt_outb(struct tdfx_par *par, u32 idx, u8 val) { + vga_outb(par, CRT_I, idx); vga_outb(par, CRT_D, val); } -static inline u8 crt_inb(u32 idx) { - vga_outb(CRT_I, idx); return vga_inb(CRT_D); +static inline u8 crt_inb(struct tdfx_par *par, u32 idx) { + vga_outb(par, CRT_I, idx); return vga_inb(par, CRT_D); } -static inline void att_outb(u32 idx, u8 val) +static inline void att_outb(struct tdfx_par *par, u32 idx, u8 val) { unsigned char tmp; - tmp = vga_inb(IS1_R); - vga_outb(ATT_IW, idx); - vga_outb(ATT_IW, val); + tmp = vga_inb(par, IS1_R); + vga_outb(par, ATT_IW, idx); + vga_outb(par, ATT_IW, val); } -static inline u8 att_inb(u32 idx) +static inline u8 att_inb(struct tdfx_par *par, u32 idx) { unsigned char tmp; - tmp = vga_inb(IS1_R); - vga_outb(ATT_IW, idx); - return vga_inb(ATT_IW); + tmp = vga_inb(par, IS1_R); + vga_outb(par, ATT_IW, idx); + return vga_inb(par, ATT_IW); } -static inline void vga_disable_video(void) +static inline void vga_disable_video(struct tdfx_par *par) { unsigned char s; - s = seq_inb(0x01) | 0x20; - seq_outb(0x00, 0x01); - seq_outb(0x01, s); - seq_outb(0x00, 0x03); + s = seq_inb(par, 0x01) | 0x20; + seq_outb(par, 0x00, 0x01); + seq_outb(par, 0x01, s); + seq_outb(par, 0x00, 0x03); } -static inline void vga_enable_video(void) +static inline void vga_enable_video(struct tdfx_par *par) { unsigned char s; - s = seq_inb(0x01) & 0xdf; - seq_outb(0x00, 0x01); - seq_outb(0x01, s); - seq_outb(0x00, 0x03); + s = seq_inb(par, 0x01) & 0xdf; + seq_outb(par, 0x00, 0x01); + seq_outb(par, 0x01, s); + seq_outb(par, 0x00, 0x03); } -static inline void vga_disable_palette(void) +static inline void vga_disable_palette(struct tdfx_par *par) { - vga_inb(IS1_R); - vga_outb(ATT_IW, 0x00); + vga_inb(par, IS1_R); + vga_outb(par, ATT_IW, 0x00); } -static inline void vga_enable_palette(void) +static inline void vga_enable_palette(struct tdfx_par *par) { - vga_inb(IS1_R); - vga_outb(ATT_IW, 0x20); + vga_inb(par, IS1_R); + vga_outb(par, ATT_IW, 0x20); } -static inline u32 tdfx_inl(unsigned int reg) +static inline u32 tdfx_inl(struct tdfx_par *par, unsigned int reg) { - return readl(default_par.regbase_virt + reg); + return readl(par->regbase_virt + reg); } -static inline void tdfx_outl(unsigned int reg, u32 val) +static inline void tdfx_outl(struct tdfx_par *par, unsigned int reg, u32 val) { - writel(val, default_par.regbase_virt + reg); + writel(val, par->regbase_virt + reg); } -static inline void banshee_make_room(int size) +static inline void banshee_make_room(struct tdfx_par *par, int size) { - while((tdfx_inl(STATUS) & 0x1f) < size); + while((tdfx_inl(par, STATUS) & 0x1f) < size); } -static inline void banshee_wait_idle(void) +static inline void banshee_wait_idle(struct tdfx_par *par) { int i = 0; - banshee_make_room(1); - tdfx_outl(COMMAND_3D, COMMAND_3D_NOP); + banshee_make_room(par, 1); + tdfx_outl(par, COMMAND_3D, COMMAND_3D_NOP); while(1) { - i = (tdfx_inl(STATUS) & STATUS_BUSY) ? 0 : i + 1; + i = (tdfx_inl(par, STATUS) & STATUS_BUSY) ? 0 : i + 1; if(i == 3) break; } } @@ -337,11 +331,11 @@ static inline void banshee_wait_idle(void) /* * Set the color of a palette entry in 8bpp mode */ -static inline void do_setpalentry(unsigned regno, u32 c) +static inline void do_setpalentry(struct tdfx_par *par, unsigned regno, u32 c) { - banshee_make_room(2); - tdfx_outl(DACADDR, regno); - tdfx_outl(DACDATA, c); + banshee_make_room(par, 2); + tdfx_outl(par, DACADDR, regno); + tdfx_outl(par, DACDATA, c); } static u32 do_calc_pll(int freq, int* freq_out) @@ -373,71 +367,71 @@ static u32 do_calc_pll(int freq, int* freq_out) return (n << 8) | (m << 2) | k; } -static void do_write_regs(struct banshee_reg* reg) +static void do_write_regs(struct tdfx_par *par, struct banshee_reg* reg) { int i; - banshee_wait_idle(); + banshee_wait_idle(par); - tdfx_outl(MISCINIT1, tdfx_inl(MISCINIT1) | 0x01); + tdfx_outl(par, MISCINIT1, tdfx_inl(par, MISCINIT1) | 0x01); - crt_outb(0x11, crt_inb(0x11) & 0x7f); /* CRT unprotect */ + crt_outb(par, 0x11, crt_inb(par, 0x11) & 0x7f); /* CRT unprotect */ - banshee_make_room(3); - tdfx_outl(VGAINIT1, reg->vgainit1 & 0x001FFFFF); - tdfx_outl(VIDPROCCFG, reg->vidcfg & ~0x00000001); + banshee_make_room(par, 3); + tdfx_outl(par, VGAINIT1, reg->vgainit1 & 0x001FFFFF); + tdfx_outl(par, VIDPROCCFG, reg->vidcfg & ~0x00000001); #if 0 - tdfx_outl(PLLCTRL1, reg->mempll); - tdfx_outl(PLLCTRL2, reg->gfxpll); + tdfx_outl(par, PLLCTRL1, reg->mempll); + tdfx_outl(par, PLLCTRL2, reg->gfxpll); #endif - tdfx_outl(PLLCTRL0, reg->vidpll); + tdfx_outl(par, PLLCTRL0, reg->vidpll); - vga_outb(MISC_W, reg->misc[0x00] | 0x01); + vga_outb(par, MISC_W, reg->misc[0x00] | 0x01); for (i = 0; i < 5; i++) - seq_outb(i, reg->seq[i]); + seq_outb(par, i, reg->seq[i]); for (i = 0; i < 25; i++) - crt_outb(i, reg->crt[i]); + crt_outb(par, i, reg->crt[i]); for (i = 0; i < 9; i++) - gra_outb(i, reg->gra[i]); + gra_outb(par, i, reg->gra[i]); for (i = 0; i < 21; i++) - att_outb(i, reg->att[i]); + att_outb(par, i, reg->att[i]); - crt_outb(0x1a, reg->ext[0]); - crt_outb(0x1b, reg->ext[1]); + crt_outb(par, 0x1a, reg->ext[0]); + crt_outb(par, 0x1b, reg->ext[1]); - vga_enable_palette(); - vga_enable_video(); + vga_enable_palette(par); + vga_enable_video(par); - banshee_make_room(11); - tdfx_outl(VGAINIT0, reg->vgainit0); - tdfx_outl(DACMODE, reg->dacmode); - tdfx_outl(VIDDESKSTRIDE, reg->stride); - tdfx_outl(HWCURPATADDR, 0); + banshee_make_room(par, 11); + tdfx_outl(par, VGAINIT0, reg->vgainit0); + tdfx_outl(par, DACMODE, reg->dacmode); + tdfx_outl(par, VIDDESKSTRIDE, reg->stride); + tdfx_outl(par, HWCURPATADDR, 0); - tdfx_outl(VIDSCREENSIZE,reg->screensize); - tdfx_outl(VIDDESKSTART, reg->startaddr); - tdfx_outl(VIDPROCCFG, reg->vidcfg); - tdfx_outl(VGAINIT1, reg->vgainit1); - tdfx_outl(MISCINIT0, reg->miscinit0); - - banshee_make_room(8); - tdfx_outl(SRCBASE, reg->srcbase); - tdfx_outl(DSTBASE, reg->dstbase); - tdfx_outl(COMMANDEXTRA_2D, 0); - tdfx_outl(CLIP0MIN, 0); - tdfx_outl(CLIP0MAX, 0x0fff0fff); - tdfx_outl(CLIP1MIN, 0); - tdfx_outl(CLIP1MAX, 0x0fff0fff); - tdfx_outl(SRCXY, 0); - - banshee_wait_idle(); + tdfx_outl(par, VIDSCREENSIZE,reg->screensize); + tdfx_outl(par, VIDDESKSTART, reg->startaddr); + tdfx_outl(par, VIDPROCCFG, reg->vidcfg); + tdfx_outl(par, VGAINIT1, reg->vgainit1); + tdfx_outl(par, MISCINIT0, reg->miscinit0); + + banshee_make_room(par, 8); + tdfx_outl(par, SRCBASE, reg->srcbase); + tdfx_outl(par, DSTBASE, reg->dstbase); + tdfx_outl(par, COMMANDEXTRA_2D, 0); + tdfx_outl(par, CLIP0MIN, 0); + tdfx_outl(par, CLIP0MAX, 0x0fff0fff); + tdfx_outl(par, CLIP1MIN, 0); + tdfx_outl(par, CLIP1MAX, 0x0fff0fff); + tdfx_outl(par, SRCXY, 0); + + banshee_wait_idle(par); } -static unsigned long do_lfb_size(unsigned short dev_id) +static unsigned long do_lfb_size(struct tdfx_par *par, unsigned short dev_id) { u32 draminit0 = 0; u32 draminit1 = 0; @@ -445,8 +439,8 @@ static unsigned long do_lfb_size(unsigned short dev_id) u32 lfbsize = 0; int sgram_p = 0; - draminit0 = tdfx_inl(DRAMINIT0); - draminit1 = tdfx_inl(DRAMINIT1); + draminit0 = tdfx_inl(par, DRAMINIT0); + draminit1 = tdfx_inl(par, DRAMINIT1); if ((dev_id == PCI_DEVICE_ID_3DFX_BANSHEE) || (dev_id == PCI_DEVICE_ID_3DFX_VOODOO3)) { @@ -467,12 +461,12 @@ static unsigned long do_lfb_size(unsigned short dev_id) lfbsize <<= 20; } /* disable block writes for SDRAM (why?) */ - miscinit1 = tdfx_inl(MISCINIT1); + miscinit1 = tdfx_inl(par, MISCINIT1); miscinit1 |= sgram_p ? 0 : MISCINIT1_2DBLOCK_DIS; miscinit1 |= MISCINIT1_CLUT_INV; - banshee_make_room(1); - tdfx_outl(MISCINIT1, miscinit1); + banshee_make_room(par, 1); + tdfx_outl(par, MISCINIT1, miscinit1); return lfbsize; } @@ -710,7 +704,7 @@ static int tdfxfb_set_par(struct fb_info *info) VGAINIT0_WAKEUP_3C3 | VGAINIT0_ALT_READBACK | VGAINIT0_EXTSHIFTOUT; - reg.vgainit1 = tdfx_inl(VGAINIT1) & 0x1fffff; + reg.vgainit1 = tdfx_inl(par, VGAINIT1) & 0x1fffff; reg.cursloc = 0; @@ -740,7 +734,7 @@ static int tdfxfb_set_par(struct fb_info *info) reg.screensize = info->var.xres | (info->var.yres << 12); reg.vidcfg &= ~VIDCFG_HALF_MODE; - reg.miscinit0 = tdfx_inl(MISCINIT0); + reg.miscinit0 = tdfx_inl(par, MISCINIT0); #if defined(__BIG_ENDIAN) switch (info->var.bits_per_pixel) { @@ -759,7 +753,7 @@ static int tdfxfb_set_par(struct fb_info *info) break; } #endif - do_write_regs(®); + do_write_regs(par, ®); /* Now change fb_fix_screeninfo according to changes in par */ info->fix.line_length = info->var.xres * ((info->var.bits_per_pixel + 7)>>3); @@ -773,6 +767,7 @@ static int tdfxfb_set_par(struct fb_info *info) static int tdfxfb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue,unsigned transp,struct fb_info *info) { + struct tdfx_par *par = (struct tdfx_par *) info->par; u32 rgbcol; if (regno >= info->cmap.len) return 1; @@ -782,7 +777,7 @@ static int tdfxfb_setcolreg(unsigned regno, unsigned red, unsigned green, rgbcol =(((u32)red & 0xff00) << 8) | (((u32)green & 0xff00) << 0) | (((u32)blue & 0xff00) >> 8); - do_setpalentry(regno, rgbcol); + do_setpalentry(par, regno, rgbcol); break; /* Truecolor has no hardware color palettes. */ case FB_VISUAL_TRUECOLOR: @@ -805,9 +800,10 @@ static int tdfxfb_setcolreg(unsigned regno, unsigned red, unsigned green, /* 0 unblank, 1 blank, 2 no vsync, 3 no hsync, 4 off */ static int tdfxfb_blank(int blank, struct fb_info *info) { + struct tdfx_par *par = (struct tdfx_par *) info->par; u32 dacmode, state = 0, vgablank = 0; - dacmode = tdfx_inl(DACMODE); + dacmode = tdfx_inl(par, DACMODE); switch (blank) { case 0: /* Screen: On; HSync: On, VSync: On */ @@ -834,21 +830,22 @@ static int tdfxfb_blank(int blank, struct fb_info *info) dacmode &= ~(BIT(1) | BIT(3)); dacmode |= state; - banshee_make_room(1); - tdfx_outl(DACMODE, dacmode); + banshee_make_room(par, 1); + tdfx_outl(par, DACMODE, dacmode); if (vgablank) - vga_disable_video(); + vga_disable_video(par); else - vga_enable_video(); + vga_enable_video(par); return 0; } /* * Set the starting position of the visible screen to var->yoffset */ -static int tdfxfb_pan_display(struct fb_var_screeninfo *var, int con, +static int tdfxfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) { + struct tdfx_par *par = (struct tdfx_par *) info->par; u32 addr; if (nopan || var->xoffset || (var->yoffset > var->yres_virtual)) @@ -857,8 +854,8 @@ static int tdfxfb_pan_display(struct fb_var_screeninfo *var, int con, return -EINVAL; addr = var->yoffset * info->fix.line_length; - banshee_make_room(1); - tdfx_outl(VIDDESKSTART, addr); + banshee_make_room(par, 1); + tdfx_outl(par, VIDDESKSTART, addr); info->var.xoffset = var->xoffset; info->var.yoffset = var->yoffset; @@ -870,6 +867,7 @@ static int tdfxfb_pan_display(struct fb_var_screeninfo *var, int con, */ static void tdfxfb_fillrect(struct fb_info *info, struct fb_fillrect *rect) { + struct tdfx_par *par = (struct tdfx_par *) info->par; u32 bpp = info->var.bits_per_pixel; u32 stride = info->fix.line_length; u32 fmt= stride | ((bpp+((bpp==8) ? 0 : 8)) << 13); @@ -880,13 +878,13 @@ static void tdfxfb_fillrect(struct fb_info *info, struct fb_fillrect *rect) else tdfx_rop = TDFX_ROP_XOR; - banshee_make_room(5); - tdfx_outl(DSTFORMAT, fmt); - tdfx_outl(COLORFORE, rect->color); - tdfx_outl(COMMAND_2D, COMMAND_2D_FILLRECT | (tdfx_rop << 24)); - tdfx_outl(DSTSIZE, rect->width | (rect->height << 16)); - tdfx_outl(LAUNCH_2D, rect->dx | (rect->dy << 16)); - banshee_wait_idle(); + banshee_make_room(par, 5); + tdfx_outl(par, DSTFORMAT, fmt); + tdfx_outl(par, COLORFORE, rect->color); + tdfx_outl(par, COMMAND_2D, COMMAND_2D_FILLRECT | (tdfx_rop << 24)); + tdfx_outl(par, DSTSIZE, rect->width | (rect->height << 16)); + tdfx_outl(par, LAUNCH_2D, rect->dx | (rect->dy << 16)); + banshee_wait_idle(par); } /* @@ -894,6 +892,7 @@ static void tdfxfb_fillrect(struct fb_info *info, struct fb_fillrect *rect) */ static void tdfxfb_copyarea(struct fb_info *info, struct fb_copyarea *area) { + struct tdfx_par *par = (struct tdfx_par *) info->par; u32 bpp = info->var.bits_per_pixel; u32 stride = info->fix.line_length; u32 blitcmd = COMMAND_2D_S2S_BITBLT | (TDFX_ROP_COPY << 24); @@ -912,19 +911,20 @@ static void tdfxfb_copyarea(struct fb_info *info, struct fb_copyarea *area) area->dy += area->height - 1; } - banshee_make_room(6); - - tdfx_outl(SRCFORMAT, fmt); - tdfx_outl(DSTFORMAT, fmt); - tdfx_outl(COMMAND_2D, blitcmd); - tdfx_outl(DSTSIZE, area->width | (area->height << 16)); - tdfx_outl(DSTXY, area->dx | (area->dy << 16)); - tdfx_outl(LAUNCH_2D, area->sx | (area->sy << 16)); - banshee_wait_idle(); + banshee_make_room(par, 6); + + tdfx_outl(par, SRCFORMAT, fmt); + tdfx_outl(par, DSTFORMAT, fmt); + tdfx_outl(par, COMMAND_2D, blitcmd); + tdfx_outl(par, DSTSIZE, area->width | (area->height << 16)); + tdfx_outl(par, DSTXY, area->dx | (area->dy << 16)); + tdfx_outl(par, LAUNCH_2D, area->sx | (area->sy << 16)); + banshee_wait_idle(par); } static void tdfxfb_imageblit(struct fb_info *info, struct fb_image *pixmap) { + struct tdfx_par *par = (struct tdfx_par *) info->par; int size = pixmap->height*((pixmap->width*pixmap->depth + 7)>>3); int i, stride = info->fix.line_length; u32 bpp = info->var.bits_per_pixel; @@ -933,25 +933,25 @@ static void tdfxfb_imageblit(struct fb_info *info, struct fb_image *pixmap) u32 srcfmt; if (pixmap->depth == 1) { - banshee_make_room(8 + ((size + 3) >> 2)); - tdfx_outl(COLORFORE, pixmap->fg_color); - tdfx_outl(COLORBACK, pixmap->bg_color); + banshee_make_room(par, 8 + ((size + 3) >> 2)); + tdfx_outl(par, COLORFORE, pixmap->fg_color); + tdfx_outl(par, COLORBACK, pixmap->bg_color); srcfmt = 0x400000; } else { - banshee_make_room(6 + ((size + 3) >> 2)); + banshee_make_room(par, 6 + ((size + 3) >> 2)); srcfmt = stride | ((bpp+((bpp==8) ? 0 : 8)) << 13) | 0x400000; } - tdfx_outl(SRCXY, 0); - tdfx_outl(DSTXY, pixmap->dx | (pixmap->dy << 16)); - tdfx_outl(COMMAND_2D, COMMAND_2D_H2S_BITBLT | (TDFX_ROP_COPY << 24)); - tdfx_outl(SRCFORMAT, srcfmt); - tdfx_outl(DSTFORMAT, dstfmt); - tdfx_outl(DSTSIZE, pixmap->width | (pixmap->height << 16)); + tdfx_outl(par, SRCXY, 0); + tdfx_outl(par, DSTXY, pixmap->dx | (pixmap->dy << 16)); + tdfx_outl(par, COMMAND_2D, COMMAND_2D_H2S_BITBLT | (TDFX_ROP_COPY << 24)); + tdfx_outl(par, SRCFORMAT, srcfmt); + tdfx_outl(par, DSTFORMAT, dstfmt); + tdfx_outl(par, DSTSIZE, pixmap->width | (pixmap->height << 16)); /* Send four bytes at a time of data */ for (i = (size >> 2) ; i > 0; i--) { - tdfx_outl(LAUNCH_2D,*(u32*)chardata); + tdfx_outl(par, LAUNCH_2D,*(u32*)chardata); chardata += 4; } @@ -959,11 +959,11 @@ static void tdfxfb_imageblit(struct fb_info *info, struct fb_image *pixmap) i = size%4; switch (i) { case 0: break; - case 1: tdfx_outl(LAUNCH_2D,*chardata); break; - case 2: tdfx_outl(LAUNCH_2D,*(u16*)chardata); break; - case 3: tdfx_outl(LAUNCH_2D,*(u16*)chardata | ((chardata[3]) << 24)); break; + case 1: tdfx_outl(par, LAUNCH_2D,*chardata); break; + case 2: tdfx_outl(par, LAUNCH_2D,*(u16*)chardata); break; + case 3: tdfx_outl(par, LAUNCH_2D,*(u16*)chardata | ((chardata[3]) << 24)); break; } - banshee_wait_idle(); + banshee_wait_idle(par); } /** @@ -978,6 +978,7 @@ static void tdfxfb_imageblit(struct fb_info *info, struct fb_image *pixmap) static int __devinit tdfxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id) { + struct tdfx_par *default_par; struct fb_info *info; int size, err; @@ -992,27 +993,29 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, if (!info) return -ENOMEM; memset(info, 0, sizeof(info) + sizeof(struct display) + sizeof(u32) * 16); - + + default_par = kmalloc(sizeof(struct tdfx_par), GFP_KERNEL); + /* Configure the default fb_fix_screeninfo first */ switch (pdev->device) { case PCI_DEVICE_ID_3DFX_BANSHEE: strcat(tdfx_fix.id, " Banshee"); - default_par.max_pixclock = BANSHEE_MAX_PIXCLOCK; + default_par->max_pixclock = BANSHEE_MAX_PIXCLOCK; break; case PCI_DEVICE_ID_3DFX_VOODOO3: strcat(tdfx_fix.id, " Voodoo3"); - default_par.max_pixclock = VOODOO3_MAX_PIXCLOCK; + default_par->max_pixclock = VOODOO3_MAX_PIXCLOCK; break; case PCI_DEVICE_ID_3DFX_VOODOO5: strcat(tdfx_fix.id, " Voodoo5"); - default_par.max_pixclock = VOODOO5_MAX_PIXCLOCK; + default_par->max_pixclock = VOODOO5_MAX_PIXCLOCK; break; } tdfx_fix.mmio_start = pci_resource_start(pdev, 0); tdfx_fix.mmio_len = pci_resource_len(pdev, 0); - default_par.regbase_virt = ioremap_nocache(tdfx_fix.mmio_start, tdfx_fix.mmio_len); - if (!default_par.regbase_virt) { + default_par->regbase_virt = ioremap_nocache(tdfx_fix.mmio_start, tdfx_fix.mmio_len); + if (!default_par->regbase_virt) { printk("fb: Can't remap %s register area.\n", tdfx_fix.id); goto out_err; } @@ -1024,7 +1027,7 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, } tdfx_fix.smem_start = pci_resource_start(pdev, 1); - if (!(tdfx_fix.smem_len = do_lfb_size(pdev->device))) { + if (!(tdfx_fix.smem_len = do_lfb_size(default_par, pdev->device))) { printk("fb: Can't count %s memory.\n", tdfx_fix.id); release_mem_region(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0)); @@ -1050,7 +1053,7 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, goto out_err; } - default_par.iobase = pci_resource_start(pdev, 2); + default_par->iobase = pci_resource_start(pdev, 2); if (!request_region(pci_resource_start(pdev, 2), pci_resource_len(pdev, 2), "tdfx iobase")) { @@ -1073,17 +1076,10 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, info->node = NODEV; info->fbops = &tdfxfb_ops; info->fix = tdfx_fix; - info->par = &default_par; - info->disp = (struct display *)(info + 1); - info->pseudo_palette = (void *)(info->disp + 1); + info->par = default_par; + info->pseudo_palette = (void *)(info + 1); info->flags = FBINFO_FLAG_DEFAULT; - /* The below feilds will go away !!!! */ - strcpy(info->modename, info->fix.id); - info->currcon = -1; - info->switch_con = gen_switch; - info->updatevar = gen_update_var; - if (!mode_option) mode_option = "640x480@60"; @@ -1094,8 +1090,6 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, size = (info->var.bits_per_pixel == 8) ? 256 : 16; fb_alloc_cmap(&info->cmap, size, 0); - gen_set_var(&info->var, -1, info); - if (register_framebuffer(info) < 0) { printk("tdfxfb: can't register framebuffer\n"); goto out_err; @@ -1110,8 +1104,8 @@ out_err: /* * Cleanup after anything that was remapped/allocated. */ - if (default_par.regbase_virt) - iounmap(default_par.regbase_virt); + if (default_par->regbase_virt) + iounmap(default_par->regbase_virt); if (info->screen_base) iounmap(info->screen_base); kfree(info); diff --git a/drivers/video/tx3912fb.c b/drivers/video/tx3912fb.c index d395664206ec..e9c8c235e359 100644 --- a/drivers/video/tx3912fb.c +++ b/drivers/video/tx3912fb.c @@ -21,7 +21,6 @@ #include <linux/init.h> #include <linux/pm.h> #include <linux/fb.h> -#include <video/fbcon.h> #include <asm/io.h> #include <asm/bootinfo.h> #include <asm/uaccess.h> @@ -33,7 +32,6 @@ */ static struct fb_info fb_info; static u32 cfb8[16]; -static struct display disp; static struct fb_fix_screeninfo tx3912fb_fix __initdata = { .id = "tx3912fb", @@ -96,9 +94,6 @@ static int tx3912fb_setcolreg(u_int regno, u_int red, u_int green, */ static struct fb_ops tx3912fb_ops = { .owner = THIS_MODULE, - .fb_set_var = gen_set_var, - .fb_get_cmap = gen_get_cmap, - .fb_set_cmap = gen_set_cmap, .fb_setcolreg = tx3912fb_setcolreg, .fb_fillrect = cfb_fillrect, .fb_copyarea = cfb_copyarea, @@ -215,6 +210,7 @@ static int tx3912fb_setcolreg(u_int regno, u_int red, u_int green, int __init tx3912fb_init(void) { u_long tx3912fb_paddr = 0; + int size = (info->var.bits_per_pixel == 8) ? 256 : 16; /* Disable the video logic */ outl(inl(TX3912_VIDEO_CTRL1) & @@ -295,17 +291,11 @@ int __init tx3912fb_init(void) if ((tx3912fb_fix.line_length * tx3912fb_var.yres_virtual) > tx3912fb_fix.smem_len) return -ENOMEM; - strcpy(fb_info.modename, tx3912fb_fix.id); - fb_info.changevar = NULL; fb_info.node = NODEV; - fb_info.currcon = -1; fb_info.fbops = &tx3912fb_ops; fb_info.var = tx3912fb_var; fb_info.fix = tx3912fb_fix; fb_info.pseudo_palette = pseudo_palette; - fb_info.disp = &disp; - fb_info.switch_con = gen_switch; - fb_info.updatevar = gen_update_var; fb_info.flags = FBINFO_FLAG_DEFAULT; /* Clear the framebuffer */ @@ -313,7 +303,6 @@ int __init tx3912fb_init(void) udelay(200); fb_alloc_cmap(&info->cmap, size, 0); - gen_set_disp(-1, &disp); if (register_framebuffer(&fb_info) < 0) return -1; diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c index 1326c71bd697..ea9426dfcc5a 100644 --- a/drivers/video/vesafb.c +++ b/drivers/video/vesafb.c @@ -17,16 +17,12 @@ #include <linux/slab.h> #include <linux/delay.h> #include <linux/fb.h> -#include <linux/console.h> -#include <linux/selection.h> #include <linux/ioport.h> #include <linux/init.h> #include <asm/io.h> #include <asm/mtrr.h> -#include <video/fbcon.h> - #define dac_reg (0x3c8) #define dac_val (0x3c9) @@ -49,7 +45,6 @@ static struct fb_fix_screeninfo vesafb_fix __initdata = { .accel = FB_ACCEL_NONE, }; -static struct display disp; static struct fb_info fb_info; static u32 pseudo_palette[17]; @@ -64,7 +59,7 @@ static void (*pmi_pal)(void); /* --------------------------------------------------------------------- */ -static int vesafb_pan_display(struct fb_var_screeninfo *var, int con, +static int vesafb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) { int offset; @@ -175,9 +170,6 @@ static int vesafb_setcolreg(unsigned regno, unsigned red, unsigned green, static struct fb_ops vesafb_ops = { .owner = THIS_MODULE, - .fb_set_var = gen_set_var, - .fb_get_cmap = gen_get_cmap, - .fb_set_cmap = gen_set_cmap, .fb_setcolreg = vesafb_setcolreg, .fb_pan_display = vesafb_pan_display, .fb_fillrect = cfb_fillrect, @@ -351,21 +343,14 @@ int __init vesafb_init(void) } } - strcpy(fb_info.modename, vesafb_fix.id); - fb_info.changevar = NULL; fb_info.node = NODEV; fb_info.fbops = &vesafb_ops; fb_info.var = vesafb_defined; fb_info.fix = vesafb_fix; - fb_info.currcon = -1; - fb_info.disp = &disp; - fb_info.switch_con = gen_switch; - fb_info.updatevar = gen_update_var; fb_info.pseudo_palette = pseudo_palette; fb_info.flags = FBINFO_FLAG_DEFAULT; fb_alloc_cmap(&fb_info.cmap, video_cmap_len, 0); - gen_set_disp(-1, &fb_info); if (register_framebuffer(&fb_info)<0) return -EINVAL; diff --git a/drivers/video/vfb.c b/drivers/video/vfb.c index 5ed50a49b234..6ab6aade8275 100644 --- a/drivers/video/vfb.c +++ b/drivers/video/vfb.c @@ -24,8 +24,6 @@ #include <linux/fb.h> #include <linux/init.h> -#include <video/fbcon.h> - /* * RAM we reserve for the frame buffer. This defines the maximum screen * size @@ -42,7 +40,6 @@ static const char *mode_option __initdata = NULL; static struct fb_info fb_info; static u32 vfb_pseudo_palette[17]; -static struct display disp; static struct fb_var_screeninfo vfb_default __initdata = { .xres = 640, @@ -90,15 +87,12 @@ static int vfb_check_var(struct fb_var_screeninfo *var, static int vfb_set_par(struct fb_info *info); static int vfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info); -static int vfb_pan_display(struct fb_var_screeninfo *var, int con, +static int vfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); static int vfb_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma); static struct fb_ops vfb_ops = { - .fb_set_var gen_set_var, - .fb_get_cmap gen_set_cmap, - .fb_set_cmap gen_set_cmap, .fb_check_var vfb_check_var, .fb_set_par vfb_set_par, .fb_setcolreg vfb_setcolreg, @@ -356,7 +350,7 @@ static int vfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, * This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag */ -static int vfb_pan_display(struct fb_var_screeninfo *var, int con, +static int vfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) { if (var->vmode & FB_VMODE_YWRAP) { @@ -444,13 +438,6 @@ int __init vfb_init(void) fb_info.pseudo_palette = &vfb_pseudo_palette; fb_info.flags = FBINFO_FLAG_DEFAULT; - strcpy(fb_info.modename, vfb_fix.id); - fb_info.changevar = NULL; - fb_info.currcon = -1; - fb_info.disp = &disp; - fb_info.switch_con = gen_switch; - fb_info.updatevar = gen_update_var; - fb_alloc_cmap(&fb_info.cmap, 256, 0); if (register_framebuffer(&fb_info) < 0) { diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c index e96f540178b7..0d1529f45650 100644 --- a/drivers/video/vga16fb.c +++ b/drivers/video/vga16fb.c @@ -27,10 +27,22 @@ #include <video/fbcon.h> #include <video/fbcon-vga-planes.h> +#include <video/fbcon-vga.h> +#include <video/fbcon-cfb4.h> +#include <video/fbcon-cfb8.h> #include "vga.h" -#define dac_reg (0x3c8) -#define dac_val (0x3c9) +#define GRAPHICS_ADDR_REG 0x3ce /* Graphics address register. */ +#define GRAPHICS_DATA_REG 0x3cf /* Graphics data register. */ + +#define SET_RESET_INDEX 0 /* Set/Reset Register index. */ +#define ENABLE_SET_RESET_INDEX 1 /* Enable Set/Reset Register index. */ +#define DATA_ROTATE_INDEX 3 /* Data Rotate Register index. */ +#define GRAPHICS_MODE_INDEX 5 /* Graphics Mode Register index. */ +#define BIT_MASK_INDEX 8 /* Bit Mask Register index. */ + +#define dac_reg (VGA_PEL_IW) +#define dac_val (VGA_PEL_D) #define VGA_FB_PHYS 0xA0000 #define VGA_FB_PHYS_LEN 65536 @@ -41,11 +53,9 @@ * card parameters */ -static struct vga16fb_info { - struct fb_info fb_info; - char *video_vbase; /* 0xa0000 map address */ - int isVGA; - +static struct fb_info vga16fb; + +static struct vga16fb_par { /* structure holding original VGA register settings when the screen is blanked */ struct { @@ -62,145 +72,246 @@ static struct vga16fb_info { unsigned char ModeControl; /* CRT-Controller:17h */ unsigned char ClockingMode; /* Seq-Controller:01h */ } vga_state; - - int palette_blanked; - int vesa_blanked; -} vga16fb; - - -struct vga16fb_par { + int palette_blanked, vesa_blanked, mode, isVGA; + u8 misc, pel_msk, vss, clkdiv; u8 crtc[VGA_CRT_C]; - u8 atc[VGA_ATT_C]; - u8 gdc[VGA_GFX_C]; - u8 seq[VGA_SEQ_C]; - u8 misc; - u8 vss; - struct fb_var_screeninfo var; -}; +} vga16_par; /* --------------------------------------------------------------------- */ static struct fb_var_screeninfo vga16fb_defined = { - 640,480,640,480,/* W,H, W, H (virtual) load xres,xres_virtual*/ - 0,0, /* virtual -> visible no offset */ - 4, /* depth -> load bits_per_pixel */ - 0, /* greyscale ? */ - {0,0,0}, /* R */ - {0,0,0}, /* G */ - {0,0,0}, /* B */ - {0,0,0}, /* transparency */ - 0, /* standard pixel format */ - FB_ACTIVATE_NOW, - -1,-1, - 0, - 39721, 48, 16, 39, 8, - 96, 2, 0, /* No sync info */ - FB_VMODE_NONINTERLACED, - {0,0,0,0,0,0} + .xres = 640, + .yres = 480, + .xres_virtual = 640, + .yres_virtual = 480, + .bits_per_pixel = 4, + .activate = FB_ACTIVATE_NOW, + .height = -1, + .width = -1, + .pixclock = 39721, + .left_margin = 48, + .right_margin = 16, + .upper_margin = 39, + .lower_margin = 8, + .hsync_len = 96, + .vsync_len = 2, + .vmode = FB_VMODE_NONINTERLACED, +}; + +/* name should not depend on EGA/VGA */ +static struct fb_fix_screeninfo vga16fb_fix __initdata = { + .id = "VGA16 VGA", + .smem_start = VGA_FB_PHYS, + .smem_len = VGA_FB_PHYS_LEN, + .type = FB_TYPE_VGA_PLANES, + .type_aux = FB_AUX_VGA_PLANES_VGA4, + .visual = FB_VISUAL_PSEUDOCOLOR, + .xpanstep = 8, + .ypanstep = 1, + .line_length = 640/8, + .accel = FB_ACCEL_NONE }; static struct display disp; -static struct { u_short blue, green, red, pad; } palette[256]; -/* --------------------------------------------------------------------- */ +/* The VGA's weird architecture often requires that we read a byte and + write a byte to the same location. It doesn't matter *what* byte + we write, however. This is because all the action goes on behind + the scenes in the VGA's 32-bit latch register, and reading and writing + video memory just invokes latch behavior. + + To avoid race conditions (is this necessary?), reading and writing + the memory byte should be done with a single instruction. One + suitable instruction is the x86 bitwise OR. The following + read-modify-write routine should optimize to one such bitwise + OR. */ +static inline void rmw(volatile char *p) +{ + readb(p); + writeb(1, p); +} -static void vga16fb_pan_var(struct fb_info *info, struct fb_var_screeninfo *var) +/* Set the Graphics Mode Register. Bits 0-1 are write mode, bit 3 is + read mode. */ +static inline void setmode(int mode) { - u32 pos = (var->xres_virtual * var->yoffset + var->xoffset) >> 3; - outb(VGA_CRTC_START_HI, VGA_CRT_IC); - outb(pos >> 8, VGA_CRT_DC); - outb(VGA_CRTC_START_LO, VGA_CRT_IC); - outb(pos & 0xFF, VGA_CRT_DC); -#if 0 - /* if someone supports xoffset in bit resolution */ - inb(VGA_IS1_RC); /* reset flip-flop */ - outb(VGA_ATC_PEL, VGA_ATT_IW); - outb(xoffset & 7, VGA_ATT_IW); - inb(VGA_IS1_RC); - outb(0x20, VGA_ATT_IW); -#endif + outb(GRAPHICS_MODE_INDEX, GRAPHICS_ADDR_REG); + outb(mode, GRAPHICS_DATA_REG); } -static int vga16fb_update_var(int con, struct fb_info *info) +/* Select the Bit Mask Register. */ +static inline void selectmask(void) { - vga16fb_pan_var(info, &fb_display[con].var); - return 0; + outb(BIT_MASK_INDEX, GRAPHICS_ADDR_REG); } -static int vga16fb_get_fix(struct fb_fix_screeninfo *fix, int con, - struct fb_info *info) +/* Set the value of the Bit Mask Register. It must already have been + selected with selectmask(). */ +static inline void setmask(int mask) { - struct display *p; + outb(mask, GRAPHICS_DATA_REG); +} - if (con < 0) - p = &disp; - else - p = fb_display + con; - - memset(fix, 0, sizeof(struct fb_fix_screeninfo)); - strcpy(fix->id,"VGA16 VGA"); - - fix->smem_start = VGA_FB_PHYS; - fix->smem_len = VGA_FB_PHYS_LEN; - fix->type = FB_TYPE_VGA_PLANES; - fix->visual = FB_VISUAL_PSEUDOCOLOR; - fix->xpanstep = 8; - fix->ypanstep = 1; - fix->ywrapstep = 0; - fix->line_length = p->var.xres_virtual / 8; - return 0; +/* Set the Data Rotate Register. Bits 0-2 are rotate count, bits 3-4 + are logical operation (0=NOP, 1=AND, 2=OR, 3=XOR). */ +static inline void setop(int op) +{ + outb(DATA_ROTATE_INDEX, GRAPHICS_ADDR_REG); + outb(op, GRAPHICS_DATA_REG); +} + +/* Set the Enable Set/Reset Register. The code here always uses value + 0xf for this register. */ +static inline void setsr(int sr) +{ + outb(ENABLE_SET_RESET_INDEX, GRAPHICS_ADDR_REG); + outb(sr, GRAPHICS_DATA_REG); } -static int vga16fb_get_var(struct fb_var_screeninfo *var, int con, - struct fb_info *info) +/* Set the Set/Reset Register. */ +static inline void setcolor(int color) { - if(con==-1) - memcpy(var, &vga16fb_defined, sizeof(struct fb_var_screeninfo)); + outb(SET_RESET_INDEX, GRAPHICS_ADDR_REG); + outb(color, GRAPHICS_DATA_REG); +} + +/* Set the value in the Graphics Address Register. */ +static inline void setindex(int index) +{ + outb(index, GRAPHICS_ADDR_REG); +} + +static void vga16fb_pan_var(struct fb_info *info, + struct fb_var_screeninfo *var) +{ + struct display *p; + u32 xoffset, pos; + + p = (info->currcon < 0) ? info->disp : fb_display + info->currcon; + + xoffset = var->xoffset; + if (info->var.bits_per_pixel == 8) { + pos = (info->var.xres_virtual * var->yoffset + xoffset) >> 2; + } else if (info->var.bits_per_pixel == 0) { + int fh = fontheight(p); + if (!fh) fh = 16; + pos = (info->var.xres_virtual * (var->yoffset / fh) + xoffset) >> 3; + } else { + if (info->var.nonstd) + xoffset--; + pos = (info->var.xres_virtual * var->yoffset + xoffset) >> 3; + } + vga_io_wcrt(VGA_CRTC_START_HI, pos >> 8); + vga_io_wcrt(VGA_CRTC_START_LO, pos & 0xFF); +/* if we support CFB4, then we must! support xoffset with pixel granularity */ + /* if someone supports xoffset in bit resolution */ + vga_io_r(VGA_IS1_RC); /* reset flip-flop */ + vga_io_w(VGA_ATT_IW, VGA_ATC_PEL); + if (var->bits_per_pixel == 8) + vga_io_w(VGA_ATT_IW, (xoffset & 3) << 1); else - *var=fb_display[con].var; + vga_io_w(VGA_ATT_IW, xoffset & 7); + vga_io_r(VGA_IS1_RC); + vga_io_w(VGA_ATT_IW, 0x20); +} + +static int vga16fb_update_var(int con, struct fb_info *info) +{ + vga16fb_pan_var(info, &info->var); return 0; } -static void vga16fb_set_disp(int con, struct vga16fb_info *info) +static void vga16fb_update_fix(struct fb_info *info) +{ + if (info->var.bits_per_pixel == 4) { + if (info->var.nonstd) { + info->fix.type = FB_TYPE_PACKED_PIXELS; + info->fix.line_length = info->var.xres_virtual / 2; + } else { + info->fix.type = FB_TYPE_VGA_PLANES; + info->fix.type_aux = FB_AUX_VGA_PLANES_VGA4; + info->fix.line_length = info->var.xres_virtual / 8; + } + } else if (info->var.bits_per_pixel == 0) { + info->fix.type = FB_TYPE_TEXT; + info->fix.type_aux = FB_AUX_TEXT_CGA; + info->fix.line_length = info->var.xres_virtual / 4; + } else { /* 8bpp */ + if (info->var.nonstd) { + info->fix.type = FB_TYPE_VGA_PLANES; + info->fix.type_aux = FB_AUX_VGA_PLANES_CFB8; + info->fix.line_length = info->var.xres_virtual / 4; + } else { + info->fix.type = FB_TYPE_PACKED_PIXELS; + info->fix.line_length = info->var.xres_virtual; + } + } +} + +static void vga16fb_set_disp(int con, struct fb_info *info) { - struct fb_fix_screeninfo fix; + struct vga16fb_par *par = (struct vga16fb_par *) info->par; struct display *display; - if (con < 0) - display = &disp; - else - display = fb_display + con; + display = (con < 0) ? info->disp : fb_display + con; - - vga16fb_get_fix(&fix, con, &info->fb_info); - - display->visual = fix.visual; - display->type = fix.type; - display->type_aux = fix.type_aux; - display->ypanstep = fix.ypanstep; - display->ywrapstep = fix.ywrapstep; - display->line_length = fix.line_length; - display->next_line = fix.line_length; + if (con != info->currcon) { + display->dispsw = &fbcon_dummy; + return; + } + + if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR || + info->fix.visual == FB_VISUAL_DIRECTCOLOR) { + display->can_soft_blank = info->fbops->fb_blank ? 1 : 0; + display->dispsw_data = NULL; + } else { + display->can_soft_blank = 0; + display->dispsw_data = info->pseudo_palette; + } + display->var = info->var; + + vga16fb_update_fix(info); + display->next_line = info->fix.line_length; display->can_soft_blank = 1; display->inverse = 0; - if (info->isVGA) - display->dispsw = &fbcon_vga_planes; - else - display->dispsw = &fbcon_ega_planes; - display->scrollmode = SCROLL_YREDRAW; -} - -static void vga16fb_encode_var(struct fb_var_screeninfo *var, - const struct vga16fb_par *par, - const struct vga16fb_info *info) -{ - *var = par->var; + switch (info->fix.type) { +#ifdef FBCON_HAS_VGA_PLANES + case FB_TYPE_VGA_PLANES: + if (info->fix.type_aux == FB_AUX_VGA_PLANES_VGA4) { + display->dispsw = &fbcon_vga_planes; + } else + display->dispsw = &fbcon_vga8_planes; + break; +#endif +#ifdef FBCON_HAS_VGA + case FB_TYPE_TEXT: + display->dispsw = &fbcon_vga; + break; +#endif + default: /* only FB_TYPE_PACKED_PIXELS */ + switch (info->var.bits_per_pixel) { +#ifdef FBCON_HAS_CFB4 + case 4: + display->dispsw = &fbcon_cfb4; + break; +#endif +#ifdef FBCON_HAS_CFB8 + case 8: + display->dispsw = &fbcon_cfb8; + break; +#endif + default: + display->dispsw = &fbcon_dummy; + } + break; + } } static void vga16fb_clock_chip(struct vga16fb_par *par, unsigned int pixclock, - const struct vga16fb_info *info) + const struct fb_info *info, + int mul, int div) { static struct { u32 pixclock; @@ -214,6 +325,7 @@ static void vga16fb_clock_chip(struct vga16fb_par *par, { 0 /* bad */, 0x00, 0x00}}; int err; + pixclock = (pixclock * mul) / div; best = vgaclocks; err = pixclock - best->pixclock; if (err < 0) err = -err; @@ -228,25 +340,90 @@ static void vga16fb_clock_chip(struct vga16fb_par *par, } } par->misc |= best->misc; - par->seq[VGA_SEQ_CLOCK_MODE] |= best->seq_clock_mode; - par->var.pixclock = best->pixclock; + par->clkdiv = best->seq_clock_mode; + pixclock = (best->pixclock * div) / mul; } #define FAIL(X) return -EINVAL -static int vga16fb_decode_var(const struct fb_var_screeninfo *var, - struct vga16fb_par *par, - const struct vga16fb_info *info) +#define MODE_SKIP4 1 +#define MODE_8BPP 2 +#define MODE_CFB 4 +#define MODE_TEXT 8 +static int vga16fb_check_var(struct fb_var_screeninfo *var, + struct fb_info *info) { +#ifdef FBCON_HAS_VGA + struct display *p = (info->currcon < 0) ? info->disp : (fb_display + info->currcon); +#endif + struct vga16fb_par *par = (struct vga16fb_par *) info->par; u32 xres, right, hslen, left, xtotal; u32 yres, lower, vslen, upper, ytotal; u32 vxres, xoffset, vyres, yoffset; u32 pos; u8 r7, rMode; - int i; - - if (var->bits_per_pixel != 4) + int shift; + int mode; + u32 maxmem; + + par->pel_msk = 0xFF; + + if (var->bits_per_pixel == 4) { + if (var->nonstd) { +#ifdef FBCON_HAS_CFB4 + if (!par->isVGA) + return -EINVAL; + shift = 3; + mode = MODE_SKIP4 | MODE_CFB; + maxmem = 16384; + par->pel_msk = 0x0F; +#else + return -EINVAL; +#endif + } else { +#ifdef FBCON_HAS_VGA_PLANES + shift = 3; + mode = 0; + maxmem = 65536; +#else + return -EINVAL; +#endif + } + } else if (var->bits_per_pixel == 8) { + if (!par->isVGA) + return -EINVAL; /* no support on EGA */ + shift = 2; + if (var->nonstd) { +#ifdef FBCON_HAS_VGA_PLANES + mode = MODE_8BPP | MODE_CFB; + maxmem = 65536; +#else + return -EINVAL; +#endif + } else { +#ifdef FBCON_HAS_CFB8 + mode = MODE_SKIP4 | MODE_8BPP | MODE_CFB; + maxmem = 16384; +#else + return -EINVAL; +#endif + } + } +#ifdef FBCON_HAS_VGA + else if (var->bits_per_pixel == 0) { + int fh; + + shift = 3; + mode = MODE_TEXT; + fh = fontheight(p); + if (!fh) + fh = 16; + maxmem = 32768 * fh; + } +#endif + else return -EINVAL; + xres = (var->xres + 7) & ~7; vxres = (var->xres_virtual + 0xF) & ~0xF; xoffset = (var->xoffset + 7) & ~7; @@ -259,18 +436,18 @@ static int vga16fb_decode_var(const struct fb_var_screeninfo *var, if (xres + xoffset > vxres) xoffset = vxres - xres; - par->var.xres = xres; - par->var.right_margin = right; - par->var.hsync_len = hslen; - par->var.left_margin = left; - par->var.xres_virtual = vxres; - par->var.xoffset = xoffset; - - xres >>= 3; - right >>= 3; - hslen >>= 3; - left >>= 3; - vxres >>= 3; + var->xres = xres; + var->right_margin = right; + var->hsync_len = hslen; + var->left_margin = left; + var->xres_virtual = vxres; + var->xoffset = xoffset; + + xres >>= shift; + right >>= shift; + hslen >>= shift; + left >>= shift; + vxres >>= shift; xtotal = xres + right + hslen + left; if (xtotal >= 256) FAIL("xtotal too big"); @@ -299,19 +476,19 @@ static int vga16fb_decode_var(const struct fb_var_screeninfo *var, if (yres > vyres) vyres = yres; - if (vxres * vyres > 65536) { - vyres = 65536 / vxres; + if (vxres * vyres > maxmem) { + vyres = maxmem / vxres; if (vyres < yres) return -ENOMEM; } if (yoffset + yres > vyres) yoffset = vyres - yres; - par->var.yres = yres; - par->var.lower_margin = lower; - par->var.vsync_len = vslen; - par->var.upper_margin = upper; - par->var.yres_virtual = vyres; - par->var.yoffset = yoffset; + var->yres = yres; + var->lower_margin = lower; + var->vsync_len = vslen; + var->upper_margin = upper; + var->yres_virtual = vyres; + var->yoffset = yoffset; if (var->vmode & FB_VMODE_DOUBLE) { yres <<= 1; @@ -339,12 +516,13 @@ static int vga16fb_decode_var(const struct fb_var_screeninfo *var, if (ytotal & 0x200) r7 |= 0x20; par->crtc[VGA_CRTC_PRESET_ROW] = 0; par->crtc[VGA_CRTC_MAX_SCAN] = 0x40; /* 1 scanline, no linecmp */ - par->var.vmode = var->vmode; if (var->vmode & FB_VMODE_DOUBLE) par->crtc[VGA_CRTC_MAX_SCAN] |= 0x80; par->crtc[VGA_CRTC_CURSOR_START] = 0x20; par->crtc[VGA_CRTC_CURSOR_END] = 0x00; - pos = yoffset * vxres + (xoffset >> 3); + if ((mode & (MODE_CFB | MODE_8BPP)) == MODE_CFB) + xoffset--; + pos = yoffset * vxres + (xoffset >> shift); par->crtc[VGA_CRTC_START_HI] = pos >> 8; par->crtc[VGA_CRTC_START_LO] = pos & 0xFF; par->crtc[VGA_CRTC_CURSOR_HI] = 0x00; @@ -372,170 +550,236 @@ static int vga16fb_decode_var(const struct fb_var_screeninfo *var, if (vxres >= 512) FAIL("vxres too long"); par->crtc[VGA_CRTC_OFFSET] = vxres >> 1; - par->crtc[VGA_CRTC_UNDERLINE] = 0x1F; - par->crtc[VGA_CRTC_MODE] = rMode | 0xE3; + if (mode & MODE_SKIP4) + par->crtc[VGA_CRTC_UNDERLINE] = 0x5F; /* 256, cfb8 */ + else + par->crtc[VGA_CRTC_UNDERLINE] = 0x1F; /* 16, vgap */ + par->crtc[VGA_CRTC_MODE] = rMode | ((mode & MODE_TEXT) ? 0xA3 : 0xE3); par->crtc[VGA_CRTC_LINE_COMPARE] = 0xFF; par->crtc[VGA_CRTC_OVERFLOW] = r7; par->vss = 0x00; /* 3DA */ - for (i = 0x00; i < 0x10; i++) - par->atc[i] = i; - par->atc[VGA_ATC_MODE] = 0x81; - par->atc[VGA_ATC_OVERSCAN] = 0x00; /* 0 for EGA, 0xFF for VGA */ - par->atc[VGA_ATC_PLANE_ENABLE] = 0x0F; - par->atc[VGA_ATC_PEL] = xoffset & 7; - par->atc[VGA_ATC_COLOR_PAGE] = 0x00; - - par->misc = 0xC3; /* enable CPU, ports 0x3Dx, positive sync */ - par->var.sync = var->sync; + par->misc = 0xE3; /* enable CPU, ports 0x3Dx, positive sync */ if (var->sync & FB_SYNC_HOR_HIGH_ACT) par->misc &= ~0x40; if (var->sync & FB_SYNC_VERT_HIGH_ACT) par->misc &= ~0x80; - par->seq[VGA_SEQ_CLOCK_MODE] = 0x01; - par->seq[VGA_SEQ_PLANE_WRITE] = 0x0F; - par->seq[VGA_SEQ_CHARACTER_MAP] = 0x00; - par->seq[VGA_SEQ_MEMORY_MODE] = 0x06; - - par->gdc[VGA_GFX_SR_VALUE] = 0x00; - par->gdc[VGA_GFX_SR_ENABLE] = 0x0F; - par->gdc[VGA_GFX_COMPARE_VALUE] = 0x00; - par->gdc[VGA_GFX_DATA_ROTATE] = 0x20; - par->gdc[VGA_GFX_PLANE_READ] = 0; - par->gdc[VGA_GFX_MODE] = 0x00; - par->gdc[VGA_GFX_MISC] = 0x05; - par->gdc[VGA_GFX_COMPARE_MASK] = 0x0F; - par->gdc[VGA_GFX_BIT_MASK] = 0xFF; - - vga16fb_clock_chip(par, var->pixclock, info); - - par->var.bits_per_pixel = 4; - par->var.grayscale = var->grayscale; - par->var.red.offset = par->var.green.offset = par->var.blue.offset = - par->var.transp.offset = 0; - par->var.red.length = par->var.green.length = par->var.blue.length = - (info->isVGA) ? 6 : 2; - par->var.transp.length = 0; - par->var.nonstd = 0; - par->var.activate = FB_ACTIVATE_NOW; - par->var.height = -1; - par->var.width = -1; - par->var.accel_flags = 0; + par->mode = mode; + + if (mode & MODE_8BPP) + /* pixel clock == vga clock / 2 */ + vga16fb_clock_chip(par, var->pixclock, info, 1, 2); + else + /* pixel clock == vga clock */ + vga16fb_clock_chip(par, var->pixclock, info, 1, 1); + var->red.offset = var->green.offset = var->blue.offset = + var->transp.offset = 0; + var->red.length = var->green.length = var->blue.length = + (par->isVGA) ? 6 : 2; + var->transp.length = 0; + var->activate = FB_ACTIVATE_NOW; + var->height = -1; + var->width = -1; + var->accel_flags = 0; return 0; } #undef FAIL -static int vga16fb_set_par(const struct vga16fb_par *par, - struct vga16fb_info *info) +static void vga16fb_load_font(struct display* p) { + int chars; + unsigned char* font; + unsigned char* dest; + + if (!p || !p->fontdata) + return; + chars = 256; + font = p->fontdata; + dest = vga16fb.screen_base; + + vga_io_wseq(0x00, 0x01); + vga_io_wseq(VGA_SEQ_PLANE_WRITE, 0x04); + vga_io_wseq(VGA_SEQ_MEMORY_MODE, 0x07); + vga_io_wseq(0x00, 0x03); + vga_io_wgfx(VGA_GFX_MODE, 0x00); + vga_io_wgfx(VGA_GFX_MISC, 0x04); + while (chars--) { + int i; + + for (i = fontheight(p); i > 0; i--) + writeb(*font++, dest++); + dest += 32 - fontheight(p); + } + vga_io_wseq(0x00, 0x01); + vga_io_wseq(VGA_SEQ_PLANE_WRITE, 0x03); + vga_io_wseq(VGA_SEQ_MEMORY_MODE, 0x03); + vga_io_wseq(0x00, 0x03); + vga_io_wgfx(VGA_GFX_MODE, 0x10); + vga_io_wgfx(VGA_GFX_MISC, 0x06); +} + +static int vga16fb_set_par(struct fb_info *info) { - int i; + struct vga16fb_par *par = (struct vga16fb_par *) info->par; + struct display *p = (info->currcon < 0) ? info->disp : (fb_display + info->currcon); + u8 gdc[VGA_GFX_C]; + u8 seq[VGA_SEQ_C]; + u8 atc[VGA_ATT_C]; + int fh, i; + + seq[VGA_SEQ_CLOCK_MODE] = 0x01 | par->clkdiv; + if (par->mode & MODE_TEXT) + seq[VGA_SEQ_PLANE_WRITE] = 0x03; + else + seq[VGA_SEQ_PLANE_WRITE] = 0x0F; + seq[VGA_SEQ_CHARACTER_MAP] = 0x00; + if (par->mode & MODE_TEXT) + seq[VGA_SEQ_MEMORY_MODE] = 0x03; + else if (par->mode & MODE_SKIP4) + seq[VGA_SEQ_MEMORY_MODE] = 0x0E; + else + seq[VGA_SEQ_MEMORY_MODE] = 0x06; + + gdc[VGA_GFX_SR_VALUE] = 0x00; + gdc[VGA_GFX_SR_ENABLE] = 0x00; + gdc[VGA_GFX_COMPARE_VALUE] = 0x00; + gdc[VGA_GFX_DATA_ROTATE] = 0x00; + gdc[VGA_GFX_PLANE_READ] = 0; + if (par->mode & MODE_TEXT) { + gdc[VGA_GFX_MODE] = 0x10; + gdc[VGA_GFX_MISC] = 0x06; + } else { + if (par->mode & MODE_CFB) + gdc[VGA_GFX_MODE] = 0x40; + else + gdc[VGA_GFX_MODE] = 0x00; + gdc[VGA_GFX_MISC] = 0x05; + } + gdc[VGA_GFX_COMPARE_MASK] = 0x0F; + gdc[VGA_GFX_BIT_MASK] = 0xFF; + + for (i = 0x00; i < 0x10; i++) + atc[i] = i; + if (par->mode & MODE_TEXT) + atc[VGA_ATC_MODE] = 0x04; + else if (par->mode & MODE_8BPP) + atc[VGA_ATC_MODE] = 0x41; + else + atc[VGA_ATC_MODE] = 0x81; + atc[VGA_ATC_OVERSCAN] = 0x00; /* 0 for EGA, 0xFF for VGA */ + atc[VGA_ATC_PLANE_ENABLE] = 0x0F; + if (par->mode & MODE_8BPP) + atc[VGA_ATC_PEL] = (info->var.xoffset & 3) << 1; + else + atc[VGA_ATC_PEL] = info->var.xoffset & 7; + atc[VGA_ATC_COLOR_PAGE] = 0x00; + + if (par->mode & MODE_TEXT) { + fh = fontheight(p); + if (!fh) + fh = 16; + par->crtc[VGA_CRTC_MAX_SCAN] = (par->crtc[VGA_CRTC_MAX_SCAN] + & ~0x1F) | (fh - 1); + } - outb(inb(VGA_MIS_R) | 0x01, VGA_MIS_W); + vga_io_w(VGA_MIS_W, vga_io_r(VGA_MIS_R) | 0x01); /* Enable graphics register modification */ - if (!info->isVGA) { - outb(0x00, EGA_GFX_E0); - outb(0x01, EGA_GFX_E1); + if (!par->isVGA) { + vga_io_w(EGA_GFX_E0, 0x00); + vga_io_w(EGA_GFX_E1, 0x01); } /* update misc output register */ - outb(par->misc, VGA_MIS_W); + vga_io_w(VGA_MIS_W, par->misc); /* synchronous reset on */ - outb(0x00, VGA_SEQ_I); - outb(0x01, VGA_SEQ_D); - + vga_io_wseq(0x00, 0x01); + + if (par->isVGA) + vga_io_w(VGA_PEL_MSK, par->pel_msk); + /* write sequencer registers */ - outb(1, VGA_SEQ_I); - outb(par->seq[1] | 0x20, VGA_SEQ_D); + vga_io_wseq(VGA_SEQ_CLOCK_MODE, seq[VGA_SEQ_CLOCK_MODE] | 0x20); for (i = 2; i < VGA_SEQ_C; i++) { - outb(i, VGA_SEQ_I); - outb(par->seq[i], VGA_SEQ_D); + vga_io_wseq(i, seq[i]); } /* synchronous reset off */ - outb(0x00, VGA_SEQ_I); - outb(0x03, VGA_SEQ_D); - + vga_io_wseq(0x00, 0x03); + /* deprotect CRT registers 0-7 */ - outb(0x11, VGA_CRT_IC); - outb(par->crtc[0x11], VGA_CRT_DC); + vga_io_wcrt(VGA_CRTC_V_SYNC_END, par->crtc[VGA_CRTC_V_SYNC_END]); /* write CRT registers */ - for (i = 0; i < VGA_CRT_C; i++) { - outb(i, VGA_CRT_IC); - outb(par->crtc[i], VGA_CRT_DC); + for (i = 0; i < VGA_CRTC_REGS; i++) { + vga_io_wcrt(i, par->crtc[i]); } /* write graphics controller registers */ for (i = 0; i < VGA_GFX_C; i++) { - outb(i, VGA_GFX_I); - outb(par->gdc[i], VGA_GFX_D); + vga_io_wgfx(i, gdc[i]); } /* write attribute controller registers */ for (i = 0; i < VGA_ATT_C; i++) { - inb_p(VGA_IS1_RC); /* reset flip-flop */ - outb_p(i, VGA_ATT_IW); - outb_p(par->atc[i], VGA_ATT_IW); + vga_io_r(VGA_IS1_RC); /* reset flip-flop */ + vga_io_wattr(i, atc[i]); } + if (par->mode & MODE_TEXT) + vga16fb_load_font(p); + /* Wait for screen to stabilize. */ mdelay(50); - outb(0x01, VGA_SEQ_I); - outb(par->seq[1], VGA_SEQ_D); + vga_io_wseq(VGA_SEQ_CLOCK_MODE, seq[VGA_SEQ_CLOCK_MODE]); - inb(VGA_IS1_RC); - outb(0x20, VGA_ATT_IW); - + vga_io_r(VGA_IS1_RC); + vga_io_w(VGA_ATT_IW, 0x20); return 0; } static int vga16fb_set_var(struct fb_var_screeninfo *var, int con, - struct fb_info *fb) + struct fb_info *info) { - struct vga16fb_info *info = (struct vga16fb_info*)fb; - struct vga16fb_par par; struct display *display; int err; if (con < 0) - display = fb->disp; + display = info->disp; else display = fb_display + con; - if ((err = vga16fb_decode_var(var, &par, info)) != 0) + if ((err = vga16fb_check_var(var, info)) != 0) return err; - vga16fb_encode_var(var, &par, info); - if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_TEST) - return 0; - if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) { - u32 oldxres, oldyres, oldvxres, oldvyres, oldbpp; - - oldxres = display->var.xres; - oldyres = display->var.yres; - oldvxres = display->var.xres_virtual; - oldvyres = display->var.yres_virtual; - oldbpp = display->var.bits_per_pixel; - - display->var = *var; - - if (oldxres != var->xres || oldyres != var->yres || - oldvxres != var->xres_virtual || oldvyres != var->yres_virtual || - oldbpp != var->bits_per_pixel) { - vga16fb_set_disp(con, info); - if (info->fb_info.changevar) - info->fb_info.changevar(con); + u32 oldxres, oldyres, oldvxres, oldvyres, oldbpp, oldnonstd; + + oldxres = info->var.xres; + oldyres = info->var.yres; + oldvxres = info->var.xres_virtual; + oldvyres = info->var.yres_virtual; + oldbpp = info->var.bits_per_pixel; + oldnonstd = info->var.nonstd; + info->var = *var; + + if (con == info->currcon) + vga16fb_set_par(info); + + vga16fb_set_disp(con, info); + if (oldxres != var->xres || + oldyres != var->yres || + oldvxres != var->xres_virtual || + oldvyres != var->yres_virtual || + oldbpp != var->bits_per_pixel || + oldnonstd != var->nonstd) { + if (info->changevar) + info->changevar(con); } - if (con == info->fb_info.currcon) - vga16fb_set_par(&par, info); } - return 0; } @@ -544,31 +788,13 @@ static void ega16_setpalette(int regno, unsigned red, unsigned green, unsigned b static unsigned char map[] = { 000, 001, 010, 011 }; int val; - val = map[red>>14] | ((map[green>>14]) << 1) | ((map[blue>>14]) << 2); - inb_p(0x3DA); /* ! 0x3BA */ - outb_p(regno, 0x3C0); - outb_p(val, 0x3C0); - inb_p(0x3DA); /* some clones need it */ - outb_p(0x20, 0x3C0); /* unblank screen */ -} - -static int vga16_getcolreg(unsigned regno, unsigned *red, unsigned *green, - unsigned *blue, unsigned *transp, - struct fb_info *fb_info) -{ - /* - * Read a single color register and split it into colors/transparent. - * Return != 0 for invalid regno. - */ - if (regno >= 16) - return 1; - - *red = palette[regno].red; - *green = palette[regno].green; - *blue = palette[regno].blue; - *transp = 0; - return 0; + return; + val = map[red>>14] | ((map[green>>14]) << 1) | ((map[blue>>14]) << 2); + vga_io_r(VGA_IS1_RC); /* ! 0x3BA */ + vga_io_wattr(regno, val); + vga_io_r(VGA_IS1_RC); /* some clones need it */ + vga_io_w(VGA_ATT_IW, 0x20); /* unblank screen */ } static void vga16_setpalette(int regno, unsigned red, unsigned green, unsigned blue) @@ -581,8 +807,9 @@ static void vga16_setpalette(int regno, unsigned red, unsigned green, unsigned b static int vga16fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, - struct fb_info *fb_info) + struct fb_info *info) { + struct vga16fb_par *par = (struct vga16fb_par *) info->par; int gray; /* @@ -592,53 +819,35 @@ static int vga16fb_setcolreg(unsigned regno, unsigned red, unsigned green, * != 0 for invalid regno. */ - if (regno >= 16) + if (regno >= 256) return 1; - palette[regno].red = red; - palette[regno].green = green; - palette[regno].blue = blue; - - if (fb_info->currcon < 0) - gray = disp.var.grayscale; + if (info->currcon < 0) + gray = info->disp->var.grayscale; else - gray = fb_display[fb_info->currcon].var.grayscale; + gray = fb_display[info->currcon].var.grayscale; if (gray) { /* gray = 0.30*R + 0.59*G + 0.11*B */ red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8; } - if (((struct vga16fb_info *) fb_info)->isVGA) + if (par->isVGA) vga16_setpalette(regno,red,green,blue); else ega16_setpalette(regno,red,green,blue); - - return 0; -} - -static int vga16fb_get_cmap(struct fb_cmap *cmap, int kspc, int con, - struct fb_info *info) -{ - if (con == info->currcon) /* current console? */ - return fb_get_cmap(cmap, kspc, vga16_getcolreg, info); - else if (fb_display[con].cmap.len) /* non default colormap? */ - fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2); - else - fb_copy_cmap(fb_default_cmap(16), - cmap, kspc ? 0 : 2); return 0; } static int vga16fb_pan_display(struct fb_var_screeninfo *var, int con, struct fb_info *info) { - if (var->xoffset + fb_display[con].var.xres > fb_display[con].var.xres_virtual || - var->yoffset + fb_display[con].var.yres > fb_display[con].var.yres_virtual) + if (var->xoffset + info->var.xres > info->var.xres_virtual || + var->yoffset + info->var.yres > info->var.yres_virtual) return -EINVAL; if (con == info->currcon) vga16fb_pan_var(info, var); - fb_display[con].var.xoffset = var->xoffset; - fb_display[con].var.yoffset = var->yoffset; - fb_display[con].var.vmode &= ~FB_VMODE_YWRAP; + info->var.xoffset = var->xoffset; + info->var.yoffset = var->yoffset; + info->var.vmode &= ~FB_VMODE_YWRAP; return 0; } @@ -646,59 +855,49 @@ static int vga16fb_pan_display(struct fb_var_screeninfo *var, int con, blanking code was originally by Huang shi chao, and modified by Christoph Rimek (chrimek@toppoint.de) and todd j. derr (tjd@barefoot.org) for Linux. */ -#define attrib_port 0x3c0 -#define seq_port_reg 0x3c4 -#define seq_port_val 0x3c5 -#define gr_port_reg 0x3ce -#define gr_port_val 0x3cf -#define video_misc_rd 0x3cc -#define video_misc_wr 0x3c2 -#define vga_video_port_reg 0x3d4 -#define vga_video_port_val 0x3d5 - -static void vga_vesa_blank(struct vga16fb_info *info, int mode) +#define attrib_port VGA_ATC_IW +#define seq_port_reg VGA_SEQ_I +#define seq_port_val VGA_SEQ_D +#define gr_port_reg VGA_GFX_I +#define gr_port_val VGA_GFX_D +#define video_misc_rd VGA_MIS_R +#define video_misc_wr VGA_MIS_W +#define vga_video_port_reg VGA_CRT_IC +#define vga_video_port_val VGA_CRT_DC + +static void vga_vesa_blank(struct vga16fb_par *par, int mode) { unsigned char SeqCtrlIndex; unsigned char CrtCtrlIndex; - cli(); - SeqCtrlIndex = inb_p(seq_port_reg); - CrtCtrlIndex = inb_p(vga_video_port_reg); + //cli(); + SeqCtrlIndex = vga_io_r(seq_port_reg); + CrtCtrlIndex = vga_io_r(vga_video_port_reg); /* save original values of VGA controller registers */ - if(!info->vesa_blanked) { - info->vga_state.CrtMiscIO = inb_p(video_misc_rd); - sti(); - - outb_p(0x00,vga_video_port_reg); /* HorizontalTotal */ - info->vga_state.HorizontalTotal = inb_p(vga_video_port_val); - outb_p(0x01,vga_video_port_reg); /* HorizDisplayEnd */ - info->vga_state.HorizDisplayEnd = inb_p(vga_video_port_val); - outb_p(0x04,vga_video_port_reg); /* StartHorizRetrace */ - info->vga_state.StartHorizRetrace = inb_p(vga_video_port_val); - outb_p(0x05,vga_video_port_reg); /* EndHorizRetrace */ - info->vga_state.EndHorizRetrace = inb_p(vga_video_port_val); - outb_p(0x07,vga_video_port_reg); /* Overflow */ - info->vga_state.Overflow = inb_p(vga_video_port_val); - outb_p(0x10,vga_video_port_reg); /* StartVertRetrace */ - info->vga_state.StartVertRetrace = inb_p(vga_video_port_val); - outb_p(0x11,vga_video_port_reg); /* EndVertRetrace */ - info->vga_state.EndVertRetrace = inb_p(vga_video_port_val); - outb_p(0x17,vga_video_port_reg); /* ModeControl */ - info->vga_state.ModeControl = inb_p(vga_video_port_val); - outb_p(0x01,seq_port_reg); /* ClockingMode */ - info->vga_state.ClockingMode = inb_p(seq_port_val); + if(!par->vesa_blanked) { + par->vga_state.CrtMiscIO = vga_io_r(video_misc_rd); + //sti(); + + par->vga_state.HorizontalTotal = vga_io_rcrt(0x00); /* HorizontalTotal */ + par->vga_state.HorizDisplayEnd = vga_io_rcrt(0x01); /* HorizDisplayEnd */ + par->vga_state.StartHorizRetrace = vga_io_rcrt(0x04); /* StartHorizRetrace */ + par->vga_state.EndHorizRetrace = vga_io_rcrt(0x05); /* EndHorizRetrace */ + par->vga_state.Overflow = vga_io_rcrt(0x07); /* Overflow */ + par->vga_state.StartVertRetrace = vga_io_rcrt(0x10); /* StartVertRetrace */ + par->vga_state.EndVertRetrace = vga_io_rcrt(0x11); /* EndVertRetrace */ + par->vga_state.ModeControl = vga_io_rcrt(0x17); /* ModeControl */ + par->vga_state.ClockingMode = vga_io_rseq(0x01); /* ClockingMode */ } /* assure that video is enabled */ /* "0x20" is VIDEO_ENABLE_bit in register 01 of sequencer */ - cli(); - outb_p(0x01,seq_port_reg); - outb_p(info->vga_state.ClockingMode | 0x20,seq_port_val); + //cli(); + vga_io_wseq(0x01, par->vga_state.ClockingMode | 0x20); /* test for vertical retrace in process.... */ - if ((info->vga_state.CrtMiscIO & 0x80) == 0x80) - outb_p(info->vga_state.CrtMiscIO & 0xef,video_misc_wr); + if ((par->vga_state.CrtMiscIO & 0x80) == 0x80) + vga_io_w(video_misc_wr, par->vga_state.CrtMiscIO & 0xef); /* * Set <End of vertical retrace> to minimum (0) and @@ -711,7 +910,7 @@ static void vga_vesa_blank(struct vga16fb_info *info, int mode) outb_p(0x11,vga_video_port_reg); /* EndVertRetrace */ outb_p(0x40,vga_video_port_val); /* minimum (bits 0..3) */ outb_p(0x07,vga_video_port_reg); /* Overflow */ - outb_p(info->vga_state.Overflow | 0x84,vga_video_port_val); /* bits 9,10 of vert. retrace */ + outb_p(par->vga_state.Overflow | 0x84,vga_video_port_val); /* bits 9,10 of vert. retrace */ } if (mode & VESA_HSYNC_SUSPEND) { @@ -729,44 +928,44 @@ static void vga_vesa_blank(struct vga16fb_info *info, int mode) /* restore both index registers */ outb_p(SeqCtrlIndex,seq_port_reg); outb_p(CrtCtrlIndex,vga_video_port_reg); - sti(); + //sti(); } -static void vga_vesa_unblank(struct vga16fb_info *info) +static void vga_vesa_unblank(struct vga16fb_par *par) { unsigned char SeqCtrlIndex; unsigned char CrtCtrlIndex; - cli(); - SeqCtrlIndex = inb_p(seq_port_reg); - CrtCtrlIndex = inb_p(vga_video_port_reg); + //cli(); + SeqCtrlIndex = vga_io_r(seq_port_reg); + CrtCtrlIndex = vga_io_r(vga_video_port_reg); /* restore original values of VGA controller registers */ - outb_p(info->vga_state.CrtMiscIO,video_misc_wr); - - outb_p(0x00,vga_video_port_reg); /* HorizontalTotal */ - outb_p(info->vga_state.HorizontalTotal,vga_video_port_val); - outb_p(0x01,vga_video_port_reg); /* HorizDisplayEnd */ - outb_p(info->vga_state.HorizDisplayEnd,vga_video_port_val); - outb_p(0x04,vga_video_port_reg); /* StartHorizRetrace */ - outb_p(info->vga_state.StartHorizRetrace,vga_video_port_val); - outb_p(0x05,vga_video_port_reg); /* EndHorizRetrace */ - outb_p(info->vga_state.EndHorizRetrace,vga_video_port_val); - outb_p(0x07,vga_video_port_reg); /* Overflow */ - outb_p(info->vga_state.Overflow,vga_video_port_val); - outb_p(0x10,vga_video_port_reg); /* StartVertRetrace */ - outb_p(info->vga_state.StartVertRetrace,vga_video_port_val); - outb_p(0x11,vga_video_port_reg); /* EndVertRetrace */ - outb_p(info->vga_state.EndVertRetrace,vga_video_port_val); - outb_p(0x17,vga_video_port_reg); /* ModeControl */ - outb_p(info->vga_state.ModeControl,vga_video_port_val); - outb_p(0x01,seq_port_reg); /* ClockingMode */ - outb_p(info->vga_state.ClockingMode,seq_port_val); + vga_io_w(video_misc_wr, par->vga_state.CrtMiscIO); + + /* HorizontalTotal */ + vga_io_wcrt(0x00, par->vga_state.HorizontalTotal); + /* HorizDisplayEnd */ + vga_io_wcrt(0x01, par->vga_state.HorizDisplayEnd); + /* StartHorizRetrace */ + vga_io_wcrt(0x04, par->vga_state.StartHorizRetrace); + /* EndHorizRetrace */ + vga_io_wcrt(0x05, par->vga_state.EndHorizRetrace); + /* Overflow */ + vga_io_wcrt(0x07, par->vga_state.Overflow); + /* StartVertRetrace */ + vga_io_wcrt(0x10, par->vga_state.StartVertRetrace); + /* EndVertRetrace */ + vga_io_wcrt(0x11, par->vga_state.EndVertRetrace); + /* ModeControl */ + vga_io_wcrt(0x17, par->vga_state.ModeControl); + /* ClockingMode */ + vga_io_wseq(0x01, par->vga_state.ClockingMode); /* restore index/control registers */ - outb_p(SeqCtrlIndex,seq_port_reg); - outb_p(CrtCtrlIndex,vga_video_port_reg); - sti(); + vga_io_w(seq_port_reg, SeqCtrlIndex); + vga_io_w(vga_video_port_reg, CrtCtrlIndex); + //sti(); } static void vga_pal_blank(void) @@ -782,50 +981,96 @@ static void vga_pal_blank(void) } /* 0 unblank, 1 blank, 2 no vsync, 3 no hsync, 4 off */ -static int vga16fb_blank(int blank, struct fb_info *fb_info) +static int vga16fb_blank(int blank, struct fb_info *info) { - struct vga16fb_info *info = (struct vga16fb_info*)fb_info; + struct vga16fb_par *par = (struct vga16fb_par *) info->par; switch (blank) { case 0: /* Unblank */ - if (info->vesa_blanked) { - vga_vesa_unblank(info); - info->vesa_blanked = 0; + if (par->vesa_blanked) { + vga_vesa_unblank(par); + par->vesa_blanked = 0; } - if (info->palette_blanked) { - do_install_cmap(fb_info->currcon, fb_info); - info->palette_blanked = 0; + if (par->palette_blanked) { + do_install_cmap(info->currcon, info); + par->palette_blanked = 0; } break; case 1: /* blank */ vga_pal_blank(); - info->palette_blanked = 1; + par->palette_blanked = 1; break; default: /* VESA blanking */ - vga_vesa_blank(info, blank-1); - info->vesa_blanked = 1; + vga_vesa_blank(par, blank-1); + par->vesa_blanked = 1; break; } return 0; } +void vga16fb_imageblit(struct fb_info *info, struct fb_image *image) +{ + char *where = info->screen_base + (image->dx/image->width) + image->dy * info->fix.line_length; + struct vga16fb_par *par = (struct vga16fb_par *) info->par; + u8 *cdat = image->data; + int y; + + if (par->isVGA) { + setmode(2); + setop(0); + setsr(0xf); + setcolor(image->fg_color); + selectmask(); + + setmask(0xff); + writeb(image->bg_color, where); + rmb(); + readb(where); /* fill latches */ + setmode(3); + wmb(); + for (y = 0; y < image->height; y++, where += info->fix.line_length) + writeb(cdat[y], where); + wmb(); + } else { + setmode(0); + setop(0); + setsr(0xf); + setcolor(image->bg_color); + selectmask(); + + setmask(0xff); + for (y = 0; y < image->height; y++, where += info->fix.line_length) + rmw(where); + + where -= info->fix.line_length * y; + setcolor(image->fg_color); + selectmask(); + for (y = 0; y < image->height; y++, where += info->fix.line_length) + if (cdat[y]) { + setmask(cdat[y]); + rmw(where); + } + } +} + static struct fb_ops vga16fb_ops = { - .owner = THIS_MODULE, - .fb_get_fix = vga16fb_get_fix, - .fb_get_var = vga16fb_get_var, - .fb_set_var = vga16fb_set_var, - .fb_get_cmap = vga16fb_get_cmap, - .fb_set_cmap = gen_set_cmap, - .fb_setcolreg = vga16fb_setcolreg, - .fb_pan_display =vga16fb_pan_display, - .fb_blank = vga16fb_blank, + .owner = THIS_MODULE, + .fb_set_var = vga16fb_set_var, + .fb_check_var = vga16fb_check_var, + .fb_set_par = vga16fb_set_par, + .fb_get_cmap = gen_get_cmap, + .fb_set_cmap = gen_set_cmap, + .fb_setcolreg = vga16fb_setcolreg, + .fb_pan_display = vga16fb_pan_display, + .fb_blank = vga16fb_blank, + .fb_imageblit = vga16fb_imageblit, }; int vga16fb_setup(char *options) { char *this_opt; - vga16fb.fb_info.fontname[0] = '\0'; + vga16fb.fontname[0] = '\0'; if (!options || !*options) return 0; @@ -834,95 +1079,70 @@ int vga16fb_setup(char *options) if (!*this_opt) continue; if (!strncmp(this_opt, "font:", 5)) - strcpy(vga16fb.fb_info.fontname, this_opt+5); + strcpy(vga16fb.fontname, this_opt+5); } return 0; } -static int vga16fb_switch(int con, struct fb_info *fb) -{ - struct vga16fb_par par; - struct vga16fb_info *info = (struct vga16fb_info*)fb; - - /* Do we have to save the colormap? */ - if (fb_display[fb->currcon].cmap.len) - fb_get_cmap(&fb_display[fb->currcon].cmap, 1, vga16_getcolreg, - fb); - - fb->currcon = con; - vga16fb_decode_var(&fb_display[con].var, &par, info); - vga16fb_set_par(&par, info); - vga16fb_set_disp(con, info); - - /* Install new colormap */ - do_install_cmap(con, fb); -/* vga16fb_update_var(con, fb); */ - return 1; -} - int __init vga16fb_init(void) { - int i,j; + int i; printk(KERN_DEBUG "vga16fb: initializing\n"); /* XXX share VGA_FB_PHYS region with vgacon */ - vga16fb.video_vbase = ioremap(VGA_FB_PHYS, VGA_FB_PHYS_LEN); - if (!vga16fb.video_vbase) { + vga16fb.screen_base = ioremap(VGA_FB_PHYS, VGA_FB_PHYS_LEN); + if (!vga16fb.screen_base) { printk(KERN_ERR "vga16fb: unable to map device\n"); return -ENOMEM; } - printk(KERN_INFO "vga16fb: mapped to 0x%p\n", vga16fb.video_vbase); + printk(KERN_INFO "vga16fb: mapped to 0x%p\n", vga16fb.screen_base); - vga16fb.isVGA = ORIG_VIDEO_ISVGA; - vga16fb.palette_blanked = 0; - vga16fb.vesa_blanked = 0; + vga16_par.isVGA = ORIG_VIDEO_ISVGA; + vga16_par.palette_blanked = 0; + vga16_par.vesa_blanked = 0; - i = vga16fb.isVGA? 6 : 2; + i = vga16_par.isVGA? 6 : 2; vga16fb_defined.red.length = i; vga16fb_defined.green.length = i; vga16fb_defined.blue.length = i; - for(i = 0; i < 16; i++) { - j = color_table[i]; - palette[i].red = default_red[j]; - palette[i].green = default_grn[j]; - palette[i].blue = default_blu[j]; - } /* XXX share VGA I/O region with vgacon and others */ disp.var = vga16fb_defined; /* name should not depend on EGA/VGA */ - strcpy(vga16fb.fb_info.modename, "VGA16 VGA"); - vga16fb.fb_info.changevar = NULL; - vga16fb.fb_info.node = NODEV; - vga16fb.fb_info.fbops = &vga16fb_ops; - vga16fb.fb_info.screen_base = vga16fb.video_vbase; - vga16fb.fb_info.disp=&disp; - vga16fb.fb_info.currcon = -1; - vga16fb.fb_info.switch_con=&vga16fb_switch; - vga16fb.fb_info.updatevar=&vga16fb_update_var; - vga16fb.fb_info.flags=FBINFO_FLAG_DEFAULT; + strcpy(vga16fb.modename, "VGA16 VGA"); + vga16fb.changevar = NULL; + vga16fb.node = NODEV; + vga16fb.fbops = &vga16fb_ops; + vga16fb.var = vga16fb_defined; + vga16fb.fix = vga16fb_fix; + vga16fb.par = &vga16_par; + vga16fb.disp = &disp; + vga16fb.currcon = -1; + vga16fb.switch_con = gen_switch; + vga16fb.updatevar=&vga16fb_update_var; + vga16fb.flags=FBINFO_FLAG_DEFAULT; vga16fb_set_disp(-1, &vga16fb); - if (register_framebuffer(&vga16fb.fb_info)<0) { - iounmap(vga16fb.video_vbase); + if (register_framebuffer(&vga16fb) < 0) { + iounmap(vga16fb.screen_base); return -EINVAL; } printk(KERN_INFO "fb%d: %s frame buffer device\n", - GET_FB_IDX(vga16fb.fb_info.node), vga16fb.fb_info.modename); + GET_FB_IDX(vga16fb.node), vga16fb.modename); return 0; } static void __exit vga16fb_exit(void) { - unregister_framebuffer(&vga16fb.fb_info); - iounmap(vga16fb.video_vbase); + unregister_framebuffer(&vga16fb); + iounmap(vga16fb.screen_base); /* XXX unshare VGA regions */ } diff --git a/include/linux/fb.h b/include/linux/fb.h index d1782a6bd008..d6ba52c1e461 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -3,6 +3,7 @@ #include <linux/tty.h> #include <asm/types.h> +#include <asm/io.h> /* Definitions of frame buffers */ @@ -264,10 +265,10 @@ struct fb_vblank { struct fb_copyarea { __u32 sx; /* screen-relative */ __u32 sy; - __u32 width; - __u32 height; __u32 dx; __u32 dy; + __u32 width; + __u32 height; }; struct fb_fillrect { @@ -280,10 +281,10 @@ struct fb_fillrect { }; struct fb_image { + __u32 dx; /* Where to place image */ + __u32 dy; __u32 width; /* Size of image */ __u32 height; - __u16 dx; /* Where to place image */ - __u16 dy; __u32 fg_color; /* Only used when a mono bitmap */ __u32 bg_color; __u8 depth; /* Dpeth of the image */ @@ -316,15 +317,9 @@ struct fb_ops { struct module *owner; int (*fb_open)(struct fb_info *info, int user); int (*fb_release)(struct fb_info *info, int user); - /* set settable parameters */ - int (*fb_set_var)(struct fb_var_screeninfo *var, int con, - struct fb_info *info); - /* get colormap */ - int (*fb_get_cmap)(struct fb_cmap *cmap, int kspc, int con, - struct fb_info *info); - /* set colormap */ - int (*fb_set_cmap)(struct fb_cmap *cmap, int kspc, int con, - struct fb_info *info); + /* For framebuffers with strange non linear layouts */ + ssize_t (*fb_read)(struct file *file, char *buf, size_t count, loff_t *ppos); + ssize_t (*fb_write)(struct file *file, const char *buf, size_t count, loff_t *ppos); /* checks var and creates a par based on it */ int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info); /* set the video mode according to par */ @@ -335,7 +330,7 @@ struct fb_ops { /* blank display */ int (*fb_blank)(int blank, struct fb_info *info); /* pan display */ - int (*fb_pan_display)(struct fb_var_screeninfo *var, int con, struct fb_info *info); + int (*fb_pan_display)(struct fb_var_screeninfo *var, struct fb_info *info); /* draws a rectangle */ void (*fb_fillrect)(struct fb_info *info, struct fb_fillrect *rect); /* Copy data from area to another */ @@ -344,9 +339,11 @@ struct fb_ops { void (*fb_imageblit)(struct fb_info *info, struct fb_image *image); /* perform polling on fb device */ int (*fb_poll)(struct fb_info *info, poll_table *wait); + /* wait for blit idle, optional */ + void (*fb_sync)(struct fb_info *info); /* perform fb specific ioctl (optional) */ int (*fb_ioctl)(struct inode *inode, struct file *file, unsigned int cmd, - unsigned long arg, int con, struct fb_info *info); + unsigned long arg, struct fb_info *info); /* perform fb specific mmap */ int (*fb_mmap)(struct fb_info *info, struct file *file, struct vm_area_struct *vma); /* switch to/from raster image mode */ @@ -354,7 +351,6 @@ struct fb_ops { }; struct fb_info { - char modename[40]; /* default video mode */ kdev_t node; int flags; int open; /* Has this been open already ? */ @@ -365,17 +361,11 @@ struct fb_info { struct fb_cmap cmap; /* Current cmap */ struct fb_ops *fbops; char *screen_base; /* Virtual address */ - struct display *disp; /* initial display variable */ struct vc_data *display_fg; /* Console visible on this display */ int currcon; /* Current VC. */ char fontname[40]; /* default font name */ devfs_handle_t devfs_handle; /* Devfs handle for new name */ devfs_handle_t devfs_lhandle; /* Devfs handle for compat. symlink */ - int (*changevar)(int); /* tell console var has changed */ - int (*switch_con)(int, struct fb_info*); - /* tell fb to switch consoles */ - int (*updatevar)(int, struct fb_info*); - /* tell fb to update the vars */ void *pseudo_palette; /* Fake palette of 16 colors and the cursor's color for non palette mode */ @@ -389,31 +379,52 @@ struct fb_info { #define FBINFO_FLAG_DEFAULT 0 #endif - /* - * `Generic' versions of the frame buffer device operations - */ +#if defined(__sparc__) -extern int gen_set_var(struct fb_var_screeninfo *var, int con, - struct fb_info *info); -extern int gen_get_cmap(struct fb_cmap *cmap, int kspc, int con, - struct fb_info *info); -extern int gen_set_cmap(struct fb_cmap *cmap, int kspc, int con, - struct fb_info *info); -extern int fb_pan_display(struct fb_var_screeninfo *var, int con, - struct fb_info *info); -extern void cfb_fillrect(struct fb_info *info, struct fb_fillrect *rect); -extern void cfb_copyarea(struct fb_info *info, struct fb_copyarea *region); -extern void cfb_imageblit(struct fb_info *info, struct fb_image *image); +/* We map all of our framebuffers such that big-endian accesses + * are what we want, so the following is sufficient. + */ + +#define fb_readb sbus_readb +#define fb_readw sbus_readw +#define fb_readl sbus_readl +#define fb_writeb sbus_writeb +#define fb_writew sbus_writew +#define fb_writel sbus_writel +#define fb_memset sbus_memset_io + +#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) + +#define fb_readb __raw_readb +#define fb_readw __raw_readw +#define fb_readl __raw_readl +#define fb_writeb __raw_writeb +#define fb_writew __raw_writew +#define fb_writel __raw_writel +#define fb_memset memset_io + +#else + +#define fb_readb(addr) (*(volatile u8 *) (addr)) +#define fb_readw(addr) (*(volatile u16 *) (addr)) +#define fb_readl(addr) (*(volatile u32 *) (addr)) +#define fb_writeb(b,addr) (*(volatile u8 *) (addr) = (b)) +#define fb_writew(b,addr) (*(volatile u16 *) (addr) = (b)) +#define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b)) +#define fb_memset memset + +#endif /* - * Helper functions + * `Generic' versions of the frame buffer device operations */ -extern void do_install_cmap(int con, struct fb_info *info); -extern int gen_update_var(int con, struct fb_info *info); +extern int fb_set_var(struct fb_var_screeninfo *var, struct fb_info *info); +extern int fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); extern int fb_blank(int blank, struct fb_info *info); -extern int gen_switch(int con, struct fb_info *info); -extern void gen_set_disp(int con, struct fb_info *info); +extern void cfb_fillrect(struct fb_info *info, struct fb_fillrect *rect); +extern void cfb_copyarea(struct fb_info *info, struct fb_copyarea *area); +extern void cfb_imageblit(struct fb_info *info, struct fb_image *image); /* drivers/video/fbmem.c */ extern int register_framebuffer(struct fb_info *fb_info); @@ -431,10 +442,6 @@ extern int fbmon_dpms(const struct fb_info *fb_info); extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp); extern void fb_copy_cmap(struct fb_cmap *from, struct fb_cmap *to, int fsfromto); -extern int fb_get_cmap(struct fb_cmap *cmap, int kspc, - int (*getcolreg)(u_int, u_int *, u_int *, u_int *, - u_int *, struct fb_info *), - struct fb_info *fb_info); extern int fb_set_cmap(struct fb_cmap *cmap, int kspc, struct fb_info *fb_info); extern struct fb_cmap *fb_default_cmap(int len); extern void fb_invert_cmaps(void); diff --git a/include/linux/sisfb.h b/include/linux/sisfb.h index 4d12567013ba..f45257643986 100644 --- a/include/linux/sisfb.h +++ b/include/linux/sisfb.h @@ -1,6 +1,11 @@ #ifndef _LINUX_SISFB #define _LINUX_SISFB +#include <linux/spinlock.h> + +#include <asm/ioctl.h> +#include <asm/types.h> + #define DISPTYPE_CRT1 0x00000008L #define DISPTYPE_CRT2 0x00000004L #define DISPTYPE_LCD 0x00000002L @@ -20,6 +25,7 @@ #define HASVB_303 0x40 #define HASVB_CHRONTEL 0x80 +/* TW: *Never* change the order of the following enum */ typedef enum _SIS_CHIP_TYPE { SIS_VGALegacy = 0, SIS_300, @@ -32,10 +38,17 @@ typedef enum _SIS_CHIP_TYPE { SIS_315PRO, SIS_640, SIS_740, - SIS_330, + SIS_650, + SIS_330, MAX_SIS_CHIP } SIS_CHIP_TYPE; +typedef enum _VGA_ENGINE { + UNKNOWN_VGA = 0, + SIS_300_VGA, + SIS_315_VGA, +} VGA_ENGINE; + typedef enum _TVTYPE { TVMODE_NTSC = 0, TVMODE_PAL, @@ -81,21 +94,25 @@ struct ap_data { }; struct video_info { - int chip_id; + int chip_id; unsigned int video_size; unsigned long video_base; - char *video_vbase; + char * video_vbase; unsigned long mmio_base; - char *mmio_vbase; + char * mmio_vbase; unsigned long vga_base; + unsigned long mtrr; + unsigned long heapstart; int video_bpp; + int video_cmap_len; int video_width; int video_height; int video_vwidth; int video_vheight; int org_x; int org_y; + int video_linelength; unsigned int refresh_rate; unsigned long disp_state; @@ -106,9 +123,42 @@ struct video_info { SIS_CHIP_TYPE chip; unsigned char revision_id; + unsigned short DstColor; /* TW: For 2d acceleration */ + unsigned long SiS310_AccelDepth; + unsigned long CommandReg; + + spinlock_t lockaccel; + char reserved[256]; }; + +/* TW: Addtional IOCTL for communication sisfb <> X driver */ +/* If changing this, vgatypes.h must also be changed (for X driver) */ + +/* TW: ioctl for identifying and giving some info (esp. memory heap start) */ +#define SISFB_GET_INFO _IOR('n',0xF8,sizeof(__u32)) + +/* TW: Structure argument for SISFB_GET_INFO ioctl */ +typedef struct _SISFB_INFO sisfb_info, *psisfb_info; + +struct _SISFB_INFO { + unsigned long sisfb_id; /* for identifying sisfb */ +#ifndef SISFB_ID +#define SISFB_ID 0x53495346 /* Identify myself with 'SISF' */ +#endif + int chip_id; /* PCI ID of detected chip */ + int memory; /* video memory in KB which sisfb manages */ + int heapstart; /* heap start (= sisfb "mem" argument) in KB */ + unsigned char fbvidmode; /* current sisfb mode */ + + unsigned char sisfb_version; + unsigned char sisfb_revision; + unsigned char sisfb_patchlevel; + + char reserved[253]; /* for future use */ +}; + #ifdef __KERNEL__ extern struct video_info ivideo; diff --git a/include/video/fbcon-cfb16.h b/include/video/fbcon-cfb16.h deleted file mode 100644 index 3ccc7d7cd535..000000000000 --- a/include/video/fbcon-cfb16.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * FBcon low-level driver for 16 bpp packed pixel (cfb16) - */ - -#ifndef _VIDEO_FBCON_CFB16_H -#define _VIDEO_FBCON_CFB16_H - -#include <linux/config.h> - -#ifdef MODULE -#if defined(CONFIG_FBCON_CFB16) || defined(CONFIG_FBCON_CFB16_MODULE) -#define FBCON_HAS_CFB16 -#endif -#else -#if defined(CONFIG_FBCON_CFB16) -#define FBCON_HAS_CFB16 -#endif -#endif - -extern struct display_switch fbcon_cfb16; -extern void fbcon_cfb16_setup(struct display *p); -extern void fbcon_cfb16_bmove(struct display *p, int sy, int sx, int dy, - int dx, int height, int width); -extern void fbcon_cfb16_clear(struct vc_data *conp, struct display *p, int sy, - int sx, int height, int width); -extern void fbcon_cfb16_putc(struct vc_data *conp, struct display *p, int c, - int yy, int xx); -extern void fbcon_cfb16_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, int yy, int xx); -extern void fbcon_cfb16_revc(struct display *p, int xx, int yy); -extern void fbcon_cfb16_clear_margins(struct vc_data *conp, struct display *p, - int bottom_only); - -#endif /* _VIDEO_FBCON_CFB16_H */ diff --git a/include/video/fbcon-cfb2.h b/include/video/fbcon-cfb2.h deleted file mode 100644 index 5ba68a5f0a4f..000000000000 --- a/include/video/fbcon-cfb2.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * FBcon low-level driver for 2 bpp packed pixel (cfb2) - */ - -#ifndef _VIDEO_FBCON_CFB2_H -#define _VIDEO_FBCON_CFB2_H - -#include <linux/config.h> - -#ifdef MODULE -#if defined(CONFIG_FBCON_CFB2) || defined(CONFIG_FBCON_CFB2_MODULE) -#define FBCON_HAS_CFB2 -#endif -#else -#if defined(CONFIG_FBCON_CFB2) -#define FBCON_HAS_CFB2 -#endif -#endif - -extern struct display_switch fbcon_cfb2; -extern void fbcon_cfb2_setup(struct display *p); -extern void fbcon_cfb2_bmove(struct display *p, int sy, int sx, int dy, int dx, - int height, int width); -extern void fbcon_cfb2_clear(struct vc_data *conp, struct display *p, int sy, - int sx, int height, int width); -extern void fbcon_cfb2_putc(struct vc_data *conp, struct display *p, int c, - int yy, int xx); -extern void fbcon_cfb2_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, int yy, int xx); -extern void fbcon_cfb2_revc(struct display *p, int xx, int yy); - -#endif /* _VIDEO_FBCON_CFB2_H */ diff --git a/include/video/fbcon-cfb24.h b/include/video/fbcon-cfb24.h deleted file mode 100644 index 77442e22d2af..000000000000 --- a/include/video/fbcon-cfb24.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * FBcon low-level driver for 24 bpp packed pixel (cfb24) - */ - -#ifndef _VIDEO_FBCON_CFB24_H -#define _VIDEO_FBCON_CFB24_H - -#include <linux/config.h> - -#ifdef MODULE -#if defined(CONFIG_FBCON_CFB24) || defined(CONFIG_FBCON_CFB24_MODULE) -#define FBCON_HAS_CFB24 -#endif -#else -#if defined(CONFIG_FBCON_CFB24) -#define FBCON_HAS_CFB24 -#endif -#endif - -extern struct display_switch fbcon_cfb24; -extern void fbcon_cfb24_setup(struct display *p); -extern void fbcon_cfb24_bmove(struct display *p, int sy, int sx, int dy, - int dx, int height, int width); -extern void fbcon_cfb24_clear(struct vc_data *conp, struct display *p, int sy, - int sx, int height, int width); -extern void fbcon_cfb24_putc(struct vc_data *conp, struct display *p, int c, - int yy, int xx); -extern void fbcon_cfb24_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, int yy, int xx); -extern void fbcon_cfb24_revc(struct display *p, int xx, int yy); -extern void fbcon_cfb24_clear_margins(struct vc_data *conp, struct display *p, - int bottom_only); - -#endif /* _VIDEO_FBCON_CFB24_H */ diff --git a/include/video/fbcon-cfb32.h b/include/video/fbcon-cfb32.h deleted file mode 100644 index abac3baa2f37..000000000000 --- a/include/video/fbcon-cfb32.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * FBcon low-level driver for 32 bpp packed pixel (cfb32) - */ - -#ifndef _VIDEO_FBCON_CFB32_H -#define _VIDEO_FBCON_CFB32_H - -#include <linux/config.h> - -#ifdef MODULE -#if defined(CONFIG_FBCON_CFB32) || defined(CONFIG_FBCON_CFB32_MODULE) -#define FBCON_HAS_CFB32 -#endif -#else -#if defined(CONFIG_FBCON_CFB32) -#define FBCON_HAS_CFB32 -#endif -#endif - -extern struct display_switch fbcon_cfb32; -extern void fbcon_cfb32_setup(struct display *p); -extern void fbcon_cfb32_bmove(struct display *p, int sy, int sx, int dy, - int dx, int height, int width); -extern void fbcon_cfb32_clear(struct vc_data *conp, struct display *p, int sy, - int sx, int height, int width); -extern void fbcon_cfb32_putc(struct vc_data *conp, struct display *p, int c, - int yy, int xx); -extern void fbcon_cfb32_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, int yy, int xx); -extern void fbcon_cfb32_revc(struct display *p, int xx, int yy); -extern void fbcon_cfb32_clear_margins(struct vc_data *conp, struct display *p, - int bottom_only); - -#endif /* _VIDEO_FBCON_CFB32_H */ diff --git a/include/video/fbcon-cfb4.h b/include/video/fbcon-cfb4.h deleted file mode 100644 index 963befe5ca1e..000000000000 --- a/include/video/fbcon-cfb4.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * FBcon low-level driver for 4 bpp packed pixel (cfb4) - */ - -#ifndef _VIDEO_FBCON_CFB4_H -#define _VIDEO_FBCON_CFB4_H - -#include <linux/config.h> - -#ifdef MODULE -#if defined(CONFIG_FBCON_CFB4) || defined(CONFIG_FBCON_CFB4_MODULE) -#define FBCON_HAS_CFB4 -#endif -#else -#if defined(CONFIG_FBCON_CFB4) -#define FBCON_HAS_CFB4 -#endif -#endif - -extern struct display_switch fbcon_cfb4; -extern void fbcon_cfb4_setup(struct display *p); -extern void fbcon_cfb4_bmove(struct display *p, int sy, int sx, int dy, int dx, - int height, int width); -extern void fbcon_cfb4_clear(struct vc_data *conp, struct display *p, int sy, - int sx, int height, int width); -extern void fbcon_cfb4_putc(struct vc_data *conp, struct display *p, int c, - int yy, int xx); -extern void fbcon_cfb4_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, int yy, int xx); -extern void fbcon_cfb4_revc(struct display *p, int xx, int yy); - -#endif /* _VIDEO_FBCON_CFB4_H */ diff --git a/include/video/fbcon-cfb8.h b/include/video/fbcon-cfb8.h deleted file mode 100644 index 96189d0acd27..000000000000 --- a/include/video/fbcon-cfb8.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * FBcon low-level driver for 8 bpp packed pixel (cfb8) - */ - -#ifndef _VIDEO_FBCON_CFB8_H -#define _VIDEO_FBCON_CFB8_H - -#include <linux/config.h> - -#ifdef MODULE -#if defined(CONFIG_FBCON_CFB8) || defined(CONFIG_FBCON_CFB8_MODULE) -#define FBCON_HAS_CFB8 -#endif -#else -#if defined(CONFIG_FBCON_CFB8) -#define FBCON_HAS_CFB8 -#endif -#endif - -extern struct display_switch fbcon_cfb8; -extern void fbcon_cfb8_setup(struct display *p); -extern void fbcon_cfb8_bmove(struct display *p, int sy, int sx, int dy, int dx, - int height, int width); -extern void fbcon_cfb8_clear(struct vc_data *conp, struct display *p, int sy, - int sx, int height, int width); -extern void fbcon_cfb8_putc(struct vc_data *conp, struct display *p, int c, - int yy, int xx); -extern void fbcon_cfb8_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, int yy, int xx); -extern void fbcon_cfb8_revc(struct display *p, int xx, int yy); -extern void fbcon_cfb8_clear_margins(struct vc_data *conp, struct display *p, - int bottom_only); - -#endif /* _VIDEO_FBCON_CFB8_H */ diff --git a/include/video/fbcon-mac.h b/include/video/fbcon-mac.h deleted file mode 100644 index b275ff91b824..000000000000 --- a/include/video/fbcon-mac.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * FBcon low-level driver for Mac variable bpp packed pixels (mac) - */ - -#ifndef _VIDEO_FBCON_MAC_H -#define _VIDEO_FBCON_MAC_H - -#include <linux/config.h> - -#ifdef MODULE -#if defined(CONFIG_FBCON_MAC) || defined(CONFIG_FBCON_MAC_MODULE) -#define FBCON_HAS_MAC -#endif -#else -#if defined(CONFIG_FBCON_MAC) -#define FBCON_HAS_MAC -#endif -#endif - -extern struct display_switch fbcon_mac; -extern void fbcon_mac_setup(struct display *p); -extern void fbcon_mac_bmove(struct display *p, int sy, int sx, int dy, int dx, - int height, int width); -extern void fbcon_mac_clear(struct vc_data *conp, struct display *p, int sy, - int sx, int height, int width); -extern void fbcon_mac_putc(struct vc_data *conp, struct display *p, int c, - int yy, int xx); -extern void fbcon_mac_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, int yy, int xx); -extern void fbcon_mac_revc(struct display *p, int xx, int yy); - -#endif /* _VIDEO_FBCON_MAC_H */ diff --git a/include/video/fbcon-vga-planes.h b/include/video/fbcon-vga-planes.h index 31578d41c58f..e9e0f3c4d7fa 100644 --- a/include/video/fbcon-vga-planes.h +++ b/include/video/fbcon-vga-planes.h @@ -18,6 +18,7 @@ #endif extern struct display_switch fbcon_vga_planes; +extern struct display_switch fbcon_vga8_planes; extern struct display_switch fbcon_ega_planes; extern void fbcon_vga_planes_setup(struct display *p); extern void fbcon_vga_planes_bmove(struct display *p, int sy, int sx, int dy, int dx, diff --git a/include/video/fbcon.h b/include/video/fbcon.h index c28fea0c10c3..10ca672e0d65 100644 --- a/include/video/fbcon.h +++ b/include/video/fbcon.h @@ -18,6 +18,7 @@ #include <asm/io.h> +struct display; /* * `switch' for the Low Level Operations @@ -51,10 +52,6 @@ extern struct display_switch fbcon_dummy; struct display { /* Filled in by the frame buffer device */ - - struct fb_var_screeninfo var; /* variable infos. yoffset and vmode */ - /* are updated by fbcon.c */ - struct fb_cmap cmap; /* colormap */ u_short can_soft_blank; /* zero if no hardware blanking */ u_short inverse; /* != 0 text black on white as default */ struct display_switch *dispsw; /* low level operations */ @@ -184,44 +181,6 @@ extern int set_all_vcs(int fbidx, struct fb_ops *fb, /* Namespace consistency */ #define SCROLL_YNOPARTIAL __SCROLL_YNOPARTIAL - -#if defined(__sparc__) - -/* We map all of our framebuffers such that big-endian accesses - * are what we want, so the following is sufficient. - */ - -#define fb_readb sbus_readb -#define fb_readw sbus_readw -#define fb_readl sbus_readl -#define fb_writeb sbus_writeb -#define fb_writew sbus_writew -#define fb_writel sbus_writel -#define fb_memset sbus_memset_io - -#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) - -#define fb_readb __raw_readb -#define fb_readw __raw_readw -#define fb_readl __raw_readl -#define fb_writeb __raw_writeb -#define fb_writew __raw_writew -#define fb_writel __raw_writel -#define fb_memset memset_io - -#else - -#define fb_readb(addr) (*(volatile u8 *) (addr)) -#define fb_readw(addr) (*(volatile u16 *) (addr)) -#define fb_readl(addr) (*(volatile u32 *) (addr)) -#define fb_writeb(b,addr) (*(volatile u8 *) (addr) = (b)) -#define fb_writew(b,addr) (*(volatile u16 *) (addr) = (b)) -#define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b)) -#define fb_memset memset - -#endif - - extern void fbcon_redraw_clear(struct vc_data *, struct display *, int, int, int, int); extern void fbcon_redraw_bmove(struct display *, int, int, int, int, int, int); |
