diff options
| author | James Simmons <jsimmons@maxwell.earthlink.net> | 2002-10-23 20:59:49 -0700 |
|---|---|---|
| committer | James Simmons <jsimmons@maxwell.earthlink.net> | 2002-10-23 20:59:49 -0700 |
| commit | 1c4eac4e2078a9b4293334e53151c85d6f445f2c (patch) | |
| tree | 37822242ca31bf8b3f4dedf2ef412d03669f5ef0 | |
| parent | fb121c4ae6dc61405d00840c0fbea259ca218dcb (diff) | |
Moved over fbcon related files to the video/console directory. I also updated a few more drivers to the new api.
25 files changed, 221 insertions, 709 deletions
diff --git a/drivers/video/Config.help b/drivers/video/Config.help index d508d1f1c7d3..162d759e217e 100644 --- a/drivers/video/Config.help +++ b/drivers/video/Config.help @@ -242,22 +242,15 @@ CONFIG_FB_VGA16 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. + Enabling this option will implement the linux framebuffer device + using calls to the STI BIOS routines for initialisation. + + If you enable this option, you will get a planar framebuffer device + /dev/fb which will work on the most common HP graphic cards of the + NGLE family, including the artist chips (in the 7xx and Bxxx series), + HCRX, HCRX24, CRX, CRX24 and VisEG series. + + It is safe to enable this option, so you should probably say "Y". CONFIG_FB_HGA Say Y here if you have a Hercules mono graphics card. diff --git a/drivers/video/console/Config.help b/drivers/video/console/Config.help index 1bd59ed8f72e..aba6605590c4 100644 --- a/drivers/video/console/Config.help +++ b/drivers/video/console/Config.help @@ -11,44 +11,6 @@ CONFIG_VIDEO_SELECT 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. diff --git a/drivers/video/console/Config.in b/drivers/video/console/Config.in index 0cabfe387136..9e89204260e5 100644 --- a/drivers/video/console/Config.in +++ b/drivers/video/console/Config.in @@ -57,7 +57,6 @@ if [ "$CONFIG_VT" != "n" ]; then 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 \ @@ -101,13 +100,6 @@ if [ "$CONFIG_VT" != "n" ]; then 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 diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile index e00c0bbed9c5..870bcc49adce 100644 --- a/drivers/video/console/Makefile +++ b/drivers/video/console/Makefile @@ -7,7 +7,7 @@ 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 + fbcon-hga.o # Each configuration option enables a list of files. diff --git a/drivers/video/console/fbcon-accel.c b/drivers/video/console/fbcon-accel.c index eb37acf9498e..92036d4f9337 100644 --- a/drivers/video/console/fbcon-accel.c +++ b/drivers/video/console/fbcon-accel.c @@ -14,7 +14,7 @@ #include <linux/string.h> #include <linux/fb.h> -#include <video/fbcon.h> +#include "fbcon.h" #include "fbcon-accel.h" void fbcon_accel_setup(struct display *p) diff --git a/drivers/video/console/fbcon-afb.c b/drivers/video/console/fbcon-afb.c index 6afee164b609..a6944f062fa5 100644 --- a/drivers/video/console/fbcon-afb.c +++ b/drivers/video/console/fbcon-afb.c @@ -15,8 +15,8 @@ #include <linux/string.h> #include <linux/fb.h> -#include <video/fbcon.h> -#include <video/fbcon-afb.h> +#include "fbcon.h" +#include "fbcon-afb.h" /* diff --git a/include/video/fbcon-afb.h b/drivers/video/console/fbcon-afb.h index cbbcf0019ad9..cbbcf0019ad9 100644 --- a/include/video/fbcon-afb.h +++ b/drivers/video/console/fbcon-afb.h diff --git a/drivers/video/console/fbcon-ilbm.c b/drivers/video/console/fbcon-ilbm.c index 157736e809a7..0d43e08dfc14 100644 --- a/drivers/video/console/fbcon-ilbm.c +++ b/drivers/video/console/fbcon-ilbm.c @@ -15,8 +15,8 @@ #include <linux/string.h> #include <linux/fb.h> -#include <video/fbcon.h> -#include <video/fbcon-ilbm.h> +#include "fbcon.h" +#include "fbcon-ilbm.h" /* diff --git a/include/video/fbcon-ilbm.h b/drivers/video/console/fbcon-ilbm.h index 80f9707f679d..80f9707f679d 100644 --- a/include/video/fbcon-ilbm.h +++ b/drivers/video/console/fbcon-ilbm.h diff --git a/drivers/video/console/fbcon-iplan2p2.c b/drivers/video/console/fbcon-iplan2p2.c index 9eea32a4efb9..9e653da1cb00 100644 --- a/drivers/video/console/fbcon-iplan2p2.c +++ b/drivers/video/console/fbcon-iplan2p2.c @@ -22,8 +22,8 @@ #include <asm/setup.h> #endif -#include <video/fbcon.h> -#include <video/fbcon-iplan2p2.h> +#include "fbcon.h" +#include "fbcon-iplan2p2.h" /* diff --git a/include/video/fbcon-iplan2p2.h b/drivers/video/console/fbcon-iplan2p2.h index b72868035317..b72868035317 100644 --- a/include/video/fbcon-iplan2p2.h +++ b/drivers/video/console/fbcon-iplan2p2.h diff --git a/drivers/video/console/fbcon-iplan2p4.c b/drivers/video/console/fbcon-iplan2p4.c index fdbb6a4d2790..db7d3a4c83c6 100644 --- a/drivers/video/console/fbcon-iplan2p4.c +++ b/drivers/video/console/fbcon-iplan2p4.c @@ -22,8 +22,8 @@ #include <asm/setup.h> #endif -#include <video/fbcon.h> -#include <video/fbcon-iplan2p4.h> +#include "fbcon.h" +#include "fbcon-iplan2p4.h" /* diff --git a/include/video/fbcon-iplan2p4.h b/drivers/video/console/fbcon-iplan2p4.h index a7012020421c..a7012020421c 100644 --- a/include/video/fbcon-iplan2p4.h +++ b/drivers/video/console/fbcon-iplan2p4.h diff --git a/drivers/video/console/fbcon-iplan2p8.c b/drivers/video/console/fbcon-iplan2p8.c index 416f28fd1e59..bf7e4c68595e 100644 --- a/drivers/video/console/fbcon-iplan2p8.c +++ b/drivers/video/console/fbcon-iplan2p8.c @@ -22,8 +22,8 @@ #include <asm/setup.h> #endif -#include <video/fbcon.h> -#include <video/fbcon-iplan2p8.h> +#include "fbcon.h" +#include "fbcon-iplan2p8.h" /* diff --git a/include/video/fbcon-iplan2p8.h b/drivers/video/console/fbcon-iplan2p8.h index 6691e18d6e26..6691e18d6e26 100644 --- a/include/video/fbcon-iplan2p8.h +++ b/drivers/video/console/fbcon-iplan2p8.h diff --git a/drivers/video/console/fbcon-sti.c b/drivers/video/console/fbcon-sti.c index ef6b9a49d119..bd7880993ac7 100644 --- a/drivers/video/console/fbcon-sti.c +++ b/drivers/video/console/fbcon-sti.c @@ -19,8 +19,8 @@ #include <linux/delay.h> #include <asm/types.h> -#include <video/fbcon.h> -#include <video/fbcon-mfb.h> +#include "fbcon.h" +#include "fbcon-mfb.h" #include "sti.h" diff --git a/drivers/video/console/fbcon-vga-planes.c b/drivers/video/console/fbcon-vga-planes.c deleted file mode 100644 index 2056b16117c2..000000000000 --- a/drivers/video/console/fbcon-vga-planes.c +++ /dev/null @@ -1,281 +0,0 @@ -/* - * linux/drivers/video/fbcon-vga-planes.c -- Low level frame buffer operations - * for VGA 4-plane modes - * - * Copyright 1999 Ben Pfaff <pfaffben@debian.org> and Petr Vandrovec <VANDROVE@vc.cvut.cz> - * Based on code 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 <linux/vt_buffer.h> - -#include <asm/io.h> - -#include <video/fbcon.h> -#include <video/fbcon-vga-planes.h> - -#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. */ - -/* 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); -} - -/* Set the Graphics Mode Register. Bits 0-1 are write mode, bit 3 is - read mode. */ -static inline void setmode(int mode) -{ - outb(GRAPHICS_MODE_INDEX, GRAPHICS_ADDR_REG); - outb(mode, GRAPHICS_DATA_REG); -} - -/* Select the Bit Mask Register. */ -static inline void selectmask(void) -{ - outb(BIT_MASK_INDEX, GRAPHICS_ADDR_REG); -} - -/* Set the value of the Bit Mask Register. It must already have been - selected with selectmask(). */ -static inline void setmask(int mask) -{ - outb(mask, GRAPHICS_DATA_REG); -} - -/* 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); -} - -/* Set the Set/Reset Register. */ -static inline void setcolor(int color) -{ - 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); -} - -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) -{ - struct fb_info *info = p->fb_info; - char *dest, *src; - int line_ofs, x; - - setmode(1); - setop(0); - setsr(0xf); - - sy *= fontheight(p); - dy *= fontheight(p); - height *= fontheight(p); - - if (dy < sy || (dy == sy && dx < sx)) { - 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); - writeb(0, dest); - dest++; - src++; - } - src += line_ofs; - dest += line_ofs; - } - } else { - 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--; - src--; - readb(src); - writeb(0, dest); - } - src -= line_ofs; - dest -= line_ofs; - } - } -} - -void fbcon_vga_planes_clear(struct vc_data *conp, struct display *p, int sy, int sx, - int height, int width) -{ - int line_ofs = p->fb_info->fix.line_length - width; - char *where; - int x; - - setmode(0); - setop(0); - setsr(0xf); - setcolor(attr_bgcol_ec(p, conp)); - selectmask(); - - setmask(0xff); - - sy *= fontheight(p); - height *= fontheight(p); - - where = p->fb_info->screen_base + sx + sy * p->fb_info->fix.line_length; - while (height--) { - for (x = 0; x < width; x++) { - writeb(0, where); - where++; - } - where += line_ofs; - } -} - -void fbcon_accel_putc(struct vc_data *vc, struct display *p, int c, int yy, - int xx) -{ - 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); -} - -void fbcon_accel_putcs(struct vc_data *vc, struct display *p, - const unsigned short *s, int count, int yy, int xx) -{ - 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) -{ - char *where = p->fb_info->screen_base + xx + yy * p->fb_info->fix.line_length * fontheight(p); - int y; - - setmode(0); - setop(0x18); - setsr(0xf); - setcolor(0xf); - selectmask(); - - setmask(0xff); - for (y = 0; y < fontheight(p); y++) { - rmw(where); - where += p->fb_info->fix.line_length; - } -} - -struct display_switch fbcon_vga_planes = { - setup: fbcon_vga_planes_setup, - bmove: fbcon_vga_planes_bmove, - clear: fbcon_vga_planes_clear, - putc: fbcon_accel_putc, - putcs: fbcon_accel_putcs, - revc: fbcon_vga_planes_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_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_revc); - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * --------------------------------------------------------------------------- - * Local variables: - * c-basic-offset: 8 - * End: - */ - diff --git a/include/video/fbcon.h b/drivers/video/console/fbcon.h index e8b66df0ed67..e23020944c11 100644 --- a/include/video/fbcon.h +++ b/drivers/video/console/fbcon.h @@ -1,5 +1,5 @@ /* - * linux/drivers/video/fbcon.h -- Low level frame buffer based console driver + * linux/drivers/video/console/fbcon.h -- Low level frame buffer based console driver * * Copyright (C) 1997 Geert Uytterhoeven * diff --git a/drivers/video/console/sticon-bmode.c b/drivers/video/console/sticon-bmode.c index 3ab5077ac27a..c6d962e00191 100644 --- a/drivers/video/console/sticon-bmode.c +++ b/drivers/video/console/sticon-bmode.c @@ -85,9 +85,8 @@ this file *will* be replaced with it. You have been warned. #include <asm/system.h> #include <asm/uaccess.h> -#include <video/fbcon.h> -#include <video/font.h> - +#include "fbcon.h" +#include "font.h" #include "sti-bmode.h" /* The latency of the STI functions cannot really be reduced by setting diff --git a/drivers/video/hgafb.c b/drivers/video/hgafb.c index c4e3f35c9124..280e49d24f66 100644 --- a/drivers/video/hgafb.c +++ b/drivers/video/hgafb.c @@ -7,6 +7,8 @@ * * History: * + * - Revision 0.1.8 (23 Oct 2002): Ported to new framebuffer api. + * * - Revision 0.1.7 (23 Jan 2001): fix crash resulting from MDA only cards * being detected as Hercules. (Paul G.) * - Revision 0.1.6 (17 Aug 2000): new style structs @@ -111,45 +113,27 @@ static spinlock_t hga_reg_lock = SPIN_LOCK_UNLOCKED; /* Framebuffer driver structures */ static struct fb_var_screeninfo hga_default_var = { - .xres = 720, - .yres = 348, - .xres_virtual = 720, - .yres_virtual = 348, - .xoffset = 0, - .yoffset = 0, - .bits_per_pixel =1, - .grayscale = 0, - .red = {0, 1, 0}, - .green = {0, 1, 0}, - .blue = {0, 1, 0}, - .transp = {0, 0, 0}, - .nonstd = 0, /* (FB_NONSTD_HGA ?) */ - .activate = 0, - .height = -1, - .width = -1, - .accel_flags = 0, - /* pixclock */ - /* left_margin, right_margin */ - /* upper_margin, lower_margin */ - /* hsync_len, vsync_len */ - /* sync */ - /* vmode */ + .xres = 720, + .yres = 348, + .xres_virtual = 720, + .yres_virtual = 348, + .bits_per_pixel = 1, + .red = {0, 1, 0}, + .green = {0, 1, 0}, + .blue = {0, 1, 0}, + .transp = {0, 0, 0}, + .height = -1, + .width = -1, }; static struct fb_fix_screeninfo hga_fix = { - .id = "HGA", - .smem_start = (unsigned long) NULL, - .smem_len = 0, - .type = FB_TYPE_PACKED_PIXELS, /* (not sure) */ - .type_aux = 0, /* (not sure) */ - .visual = FB_VISUAL_MONO10, - .xpanstep = 8, - .ypanstep = 8, - .ywrapstep = 0, - .line_length = 90, - .mmio_start = 0, - .mmio_len = 0, - .accel = FB_ACCEL_NONE + .id = "HGA", + .type = FB_TYPE_PACKED_PIXELS, /* (not sure) */ + .visual = FB_VISUAL_MONO10, + .xpanstep = 8, + .ypanstep = 8, + .line_length = 90, + .accel = FB_ACCEL_NONE }; static struct fb_info fb_info; @@ -380,97 +364,6 @@ static int __init hga_card_detect(void) return 1; } -/* ------------------------------------------------------------------------- * - * - * dispsw functions - * - * ------------------------------------------------------------------------- */ - -/** - * hga_set_var - set the user defined part of the display - * @var:new video mode - * @con:unused - * @info:pointer to fb_info object containing info for current hga board - * - * This function is called for changing video modes. Since HGA cards have - * only one fixed mode we have not much to do. After checking input - * parameters @var is copied to @info->var and @info->changevar is called. - * A zero is returned on success and %-EINVAL for failure. - * - * FIXME: - * This is the most mystical function (at least for me). - * What is the exact specification of xxx_set_var()? - * Should it handle xoffset, yoffset? Should it do panning? - * What does vmode mean? - */ - -int hga_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) -{ - CHKINFO(-EINVAL); - DPRINTK("hga_set_var: con:%d, activate:%x, info:0x%x, fb_info:%x\n", con, var->activate, (unsigned)info, (unsigned)&fb_info); - - if (var->xres != 720 || var->yres != 348 || - var->xres_virtual != 720 || - var->yres_virtual < 348 || var->yres_virtual > 348 + 16 || - var->bits_per_pixel != 1 || var->grayscale != 0) { - return -EINVAL; - } - if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) { - info->var = *var; - if (info->changevar) - (*info->changevar)(con); - } - return 0; -} - -/** - * hga_getcolreg - read color registers - * @regno:register index to read out - * @red:red value - * @green:green value - * @blue:blue value - * @transp:transparency value - * @info:unused - * - * This callback function is used to read the color registers of a HGA - * board. Since we have only two fixed colors, RGB values are 0x0000 - * for register0 and 0xaaaa for register1. - * A zero is returned on success and 1 for failure. - */ - -static int hga_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue, - u_int *transp, struct fb_info *info) -{ - if (regno == 0) { - *red = *green = *blue = 0x0000; - *transp = 0; - } else if (regno == 1) { - *red = *green = *blue = 0xaaaa; - *transp = 0; - } else - return 1; - return 0; -} - -/** - * hga_get_cmap - get the colormap - * @cmap:struct fb_cmap to fill in - * @kspc:called from kernel space? - * @con:unused - * @info:pointer to fb_info object containing info for current hga board - * - * This wrapper function passes it's input parameters to fb_get_cmap(). - * Callback function hga_getcolreg() is used to read the color registers. - */ - -int hga_get_cmap(struct fb_cmap *cmap, int kspc, int con, - struct fb_info *info) -{ - CHKINFO(-EINVAL); - DPRINTK("hga_get_cmap: con:%d\n", con); - return fb_get_cmap(cmap, kspc, hga_getcolreg, info); -} - /** * hgafb_setcolreg - set color registers * @regno:register index to set @@ -558,8 +451,8 @@ static int hgafb_blank(int blank_mode, struct fb_info *info) static struct fb_ops hgafb_ops = { .owner = THIS_MODULE, - .fb_set_var = hga_set_var, - .fb_get_cmap = hga_get_cmap, + .fb_set_var = gen_set_var, + .fb_get_cmap = gen_get_cmap, .fb_set_cmap = gen_set_cmap, .fb_setcolreg = hgafb_setcolreg, .fb_pan_display = hga_pan_display, @@ -573,69 +466,6 @@ static struct fb_ops hgafb_ops = { * * ------------------------------------------------------------------------- */ -/** - * hgafbcon_switch - switch console - * @con:new console to switch to - * @info:pointer to fb_info object containing info for current hga board - * - * This function should install a new colormap and change the video mode. - * Since we have fixed colors and only one video mode we have nothing to - * do. - * Only console administration is done but it should go to fbcon.c IMHO. - * A zero is returned on success and %-EINVAL for failure. - */ - -static int hgafbcon_switch(int con, struct fb_info *info) -{ - CHKINFO(-EINVAL); - DPRINTK("hgafbcon_switch: currcon:%d, con:%d, info:%x, fb_info:%x\n", info->currcon, con, (unsigned)info, (unsigned)&fb_info); - - /* Save the colormap and video mode */ -#if 0 /* Not necessary in hgafb, we use fixed colormap */ - fb_copy_cmap(&info->cmap, &fb_display[info->currcon].cmap, 0); -#endif - - if (info->currcon != -1) /* this check is absolute necessary! */ - memcpy(&fb_display[info->currcon].var, &info->var, - sizeof(struct fb_var_screeninfo)); - - /* Install a new colormap and change the video mode. By default fbcon - * sets all the colormaps and video modes to the default values at - * bootup. - */ -#if 0 - fb_copy_cmap(&fb_display[con].cmap, &info->cmap, 0); - fb_set_cmap(&info->cmap, 1, info); -#endif - - memcpy(&info->var, &fb_display[con].var, - sizeof(struct fb_var_screeninfo)); - /* hga_set_var(&info->var, con, &fb_info); is it necessary? */ - info->currcon = con; - - /* Hack to work correctly with XF86_Mono */ - hga_gfx_mode(); - return 0; -} - -/** - * hgafbcon_updatevar - update the user defined part of the display - * @con:console to update or -1 when no consoles defined on this fb - * @info:pointer to fb_info object containing info for current hga board - * - * This function is called when @var is changed by fbcon.c without calling - * hga_set_var(). It usually means scrolling. hga_pan_display() is called - * to update the hardware and @info->var. - * A zero is returned on success and %-EINVAL for failure. - */ - -static int hgafbcon_updatevar(int con, struct fb_info *info) -{ - CHKINFO(-EINVAL); - DPRINTK("hga_update_var: con:%d, info:%x, fb_info:%x\n", con, (unsigned)info, (unsigned)&fb_info); - return (con < 0) ? -EINVAL : hga_pan_display(&fb_display[con].var, con, info); -} - /* ------------------------------------------------------------------------- */ /* @@ -662,12 +492,6 @@ int __init hgafb_init(void) hga_fix.smem_len = hga_vram_len; disp.var = hga_default_var; - disp.visual = hga_fix.visual; - disp.type = hga_fix.type; - disp.type_aux = hga_fix.type_aux; - disp.ypanstep = hga_fix.ypanstep; - disp.ywrapstep = hga_fix.ywrapstep; - disp.line_length = hga_fix.line_length; disp.can_soft_blank = 1; disp.inverse = 0; #ifdef FBCON_HAS_HGA @@ -695,10 +519,8 @@ int __init hgafb_init(void) fb_info.disp = &disp; fb_info.currcon = 1; fb_info.changevar = NULL; - fb_info.switch_con = hgafbcon_switch; - fb_info.updatevar = hgafbcon_updatevar; - fb_info.pseudo_palette = NULL; /* ??? */ - fb_info.par = NULL; + fb_info.switch_con = gen_switch; + fb_info.updatevar = gen_update_var; if (register_framebuffer(&fb_info) < 0) return -EINVAL; diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c index c8f421e605d5..1e56fd3f8e4a 100644 --- a/drivers/video/vga16fb.c +++ b/drivers/video/vga16fb.c @@ -22,6 +22,9 @@ #include <linux/init.h> #include <asm/io.h> + +#include <video/fbcon.h> +#include "fbcon-accel.h" #include "vga.h" #define GRAPHICS_ADDR_REG 0x3ce /* Graphics address register. */ @@ -242,16 +245,10 @@ static void vga16fb_update_fix(struct fb_info *info) static void vga16fb_set_disp(int con, struct fb_info *info) { - struct vga16fb_par *par = (struct vga16fb_par *) info->par; struct display *display; display = (con < 0) ? info->disp : fb_display + con; - 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; @@ -268,34 +265,21 @@ static void vga16fb_set_disp(int con, struct fb_info *info) display->inverse = 0; 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; + display->dispsw = &fbcon_accel; } else +#ifdef FBCON_HAS_VGA_PLANES display->dispsw = &fbcon_vga8_planes; - break; #endif + break; #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; - } + display->dispsw = &fbcon_accel; break; } } @@ -362,43 +346,27 @@ static int vga16fb_check_var(struct fb_var_screeninfo *var, 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 @@ -984,7 +952,7 @@ static int vga16fb_blank(int blank, struct fb_info *info) par->vesa_blanked = 0; } if (par->palette_blanked) { - do_install_cmap(info->currcon, info); + //do_install_cmap(info->currcon, info); par->palette_blanked = 0; } break; @@ -1000,6 +968,146 @@ static int vga16fb_blank(int blank, struct fb_info *info) return 0; } +void vga16fb_fillrect(struct fb_info *info, struct fb_fillrect *rect) +{ + int x, x2, y2, vxres, vyres, width, height, line_ofs; + char *dst; + + vxres = info->var.xres_virtual; + vyres = info->var.yres_virtual; + + if (!rect->width || !rect->height || rect->dx > vxres || rect->dy > vyres) + return; + + /* We could use hardware clipping but on many cards you get around + * hardware clipping by writing to framebuffer directly. */ + + x2 = rect->dx + rect->width; + y2 = rect->dy + rect->height; + x2 = x2 < vxres ? x2 : vxres; + y2 = y2 < vyres ? y2 : vyres; + rect->width = x2 - rect->dx; + + height = y2 - rect->dy; + width = rect->width/8; + + line_ofs = info->fix.line_length - width; + dst = info->screen_base + (rect->dx/8) + rect->dy * info->fix.line_length; + + switch (rect->rop) { + case ROP_COPY: + setmode(0); + setop(0); + setsr(0xf); + setcolor(rect->color); + selectmask(); + + setmask(0xff); + + while (height--) { + for (x = 0; x < width; x++) { + writeb(0, dst); + dst++; + } + dst += line_ofs; + } + break; + case ROP_XOR: + setmode(0); + setop(0x18); + setsr(0xf); + setcolor(0xf); + selectmask(); + + setmask(0xff); + while (height--) { + for (x = 0; x < width; x++) { + rmw(dst); + dst++; + } + dst += line_ofs; + } + break; + } +} + +void vga16fb_copyarea(struct fb_info *info, struct fb_copyarea *area) +{ + int x, x2, y2, old_dx, old_dy, vxres, vyres; + int height, width, line_ofs; + char *dst = NULL, *src = NULL; + + vxres = info->var.xres_virtual; + vyres = info->var.yres_virtual; + + if (area->dx > vxres || area->sx > vxres || area->dy > vyres || + area->sy > vyres) + return; + + /* clip the destination */ + old_dx = area->dx; + old_dy = area->dy; + + /* + * We could use hardware clipping but on many cards you get around + * hardware clipping by writing to framebuffer directly. + */ + x2 = area->dx + area->width; + y2 = area->dy + area->height; + area->dx = area->dx > 0 ? area->dx : 0; + area->dy = area->dy > 0 ? area->dy : 0; + x2 = x2 < vxres ? x2 : vxres; + y2 = y2 < vyres ? y2 : vyres; + area->width = x2 - area->dx; + area->height = y2 - area->dy; + + /* update sx1,sy1 */ + area->sx += (area->dx - old_dx); + area->sy += (area->dy - old_dy); + + /* the source must be completely inside the virtual screen */ + if (area->sx < 0 || area->sy < 0 || + (area->sx + area->width) > vxres || + (area->sy + area->height) > vyres) + return; + + width = area->width/8; + height = area->height; + line_ofs = info->fix.line_length - width; + + setmode(1); + setop(0); + setsr(0xf); + + if (area->dy < area->sy || (area->dy == area->sy && area->dx < area->sx)) { + dst = info->screen_base + (area->dx/8) + area->dy * info->fix.line_length; + src = info->screen_base + (area->sx/8) + area->sy * info->fix.line_length; + while (height--) { + for (x = 0; x < width; x++) { + readb(src); + writeb(0, dst); + dst++; + src++; + } + src += line_ofs; + dst += line_ofs; + } + } else { + dst = info->screen_base + (area->dx/8) + width + (area->dy + height - 1) * info->fix.line_length; + src = info->screen_base + (area->sx/8) + width + (area->sy + height - 1) * info->fix.line_length; + while (height--) { + for (x = 0; x < width; x++) { + dst--; + src--; + readb(src); + writeb(0, dst); + } + src -= line_ofs; + dst -= line_ofs; + } + } +} + 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; @@ -1050,22 +1158,30 @@ static struct fb_ops vga16fb_ops = { .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_fillrect = vga16fb_fillrect, + .fb_copyarea = vga16fb_copyarea, .fb_imageblit = vga16fb_imageblit, - .fb_cursor = cfb_cursor, }; int vga16fb_setup(char *options) { char *this_opt; + vga16fb.fontname[0] = '\0'; + if (!options || !*options) return 0; while ((this_opt = strsep(&options, ",")) != NULL) { if (!*this_opt) continue; + + if (!strncmp(this_opt, "font:", 5)) + strcpy(vga16fb.fontname, this_opt+5); } return 0; } @@ -1095,14 +1211,24 @@ int __init vga16fb_init(void) vga16fb_defined.green.length = i; vga16fb_defined.blue.length = i; + /* XXX share VGA I/O region with vgacon and others */ + + disp.var = vga16fb_defined; + /* name should not depend on EGA/VGA */ - strcpy(vga16fb_fix.id, "VGA16 VGA"); + 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) < 0) { iounmap(vga16fb.screen_base); @@ -1110,7 +1236,8 @@ int __init vga16fb_init(void) } printk(KERN_INFO "fb%d: %s frame buffer device\n", - GET_FB_IDX(vga16fb.node), vga16fb.fix.id); + GET_FB_IDX(vga16fb.node), vga16fb.modename); + return 0; } diff --git a/include/linux/fb.h b/include/linux/fb.h index 165128ccb130..e7a049eca95d 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -433,7 +433,7 @@ struct fb_info { #define fb_writel sbus_writel #define fb_memset sbus_memset_io -#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) +#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) #define fb_readb __raw_readb #define fb_readw __raw_readw diff --git a/include/video/fbcon-mfb.h b/include/video/fbcon-mfb.h deleted file mode 100644 index f74e63da22a9..000000000000 --- a/include/video/fbcon-mfb.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * FBcon low-level driver for Monochrome (mfb) - */ - -#ifndef _VIDEO_FBCON_MFB_H -#define _VIDEO_FBCON_MFB_H - -#include <linux/config.h> - -#ifdef MODULE -#if defined(CONFIG_FBCON_MFB) || defined(CONFIG_FBCON_MFB_MODULE) -#define FBCON_HAS_MFB -#endif -#else -#if defined(CONFIG_FBCON_MFB) -#define FBCON_HAS_MFB -#endif -#endif - -extern struct display_switch fbcon_mfb; -extern void fbcon_mfb_setup(struct display *p); -extern void fbcon_mfb_bmove(struct display *p, int sy, int sx, int dy, int dx, - int height, int width); -extern void fbcon_mfb_clear(struct vc_data *conp, struct display *p, int sy, - int sx, int height, int width); -extern void fbcon_mfb_putc(struct vc_data *conp, struct display *p, int c, - int yy, int xx); -extern void fbcon_mfb_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, int yy, int xx); -extern void fbcon_mfb_revc(struct display *p, int xx, int yy); - -#endif /* _VIDEO_FBCON_MFB_H */ diff --git a/include/video/fbcon-vga-planes.h b/include/video/fbcon-vga-planes.h deleted file mode 100644 index e9e0f3c4d7fa..000000000000 --- a/include/video/fbcon-vga-planes.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * FBcon low-level driver for VGA 4-plane modes - */ - -#ifndef _VIDEO_FBCON_VGA_PLANES_H -#define _VIDEO_FBCON_VGA_PLANES_H - -#include <linux/config.h> - -#ifdef MODULE -#if defined(CONFIG_FBCON_VGA_PLANES) || defined(CONFIG_FBCON_VGA_PLANES_MODULE) -#define FBCON_HAS_VGA_PLANES -#endif -#else -#if defined(CONFIG_FBCON_VGA_PLANES) -#define FBCON_HAS_VGA_PLANES -#endif -#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, - int height, int width); -extern void fbcon_vga_planes_clear(struct vc_data *conp, struct display *p, int sy, - int sx, int height, int width); -extern void fbcon_vga_planes_putc(struct vc_data *conp, struct display *p, int c, - int yy, int xx); -extern void fbcon_ega_planes_putc(struct vc_data *conp, struct display *p, int c, - int yy, int xx); -extern void fbcon_vga_planes_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, int yy, int xx); -extern void fbcon_ega_planes_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, int yy, int xx); -extern void fbcon_vga_planes_revc(struct display *p, int xx, int yy); - -#endif /* _VIDEO_FBCON_VGA_PLANES_H */ diff --git a/include/video/fbcon-vga.h b/include/video/fbcon-vga.h deleted file mode 100644 index e7c7b2db0ce7..000000000000 --- a/include/video/fbcon-vga.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * FBcon low-level driver for VGA characters/attributes - */ - -#ifndef _VIDEO_FBCON_VGA_H -#define _VIDEO_FBCON_VGA_H - -#include <linux/config.h> - -#ifdef MODULE -#if defined(CONFIG_FBCON_VGA) || defined(CONFIG_FBCON_VGA_MODULE) -#define FBCON_HAS_VGA -#endif -#else -#if defined(CONFIG_FBCON_VGA) -#define FBCON_HAS_VGA -#endif -#endif - -extern struct display_switch fbcon_vga; -extern void fbcon_vga_setup(struct display *p); -extern void fbcon_vga_bmove(struct display *p, int sy, int sx, int dy, int dx, - int height, int width); -extern void fbcon_vga_clear(struct vc_data *conp, struct display *p, int sy, - int sx, int height, int width); -extern void fbcon_vga_putc(struct vc_data *conp, struct display *p, int c, - int yy, int xx); -extern void fbcon_vga_putcs(struct vc_data *conp, struct display *p, - const unsigned short *s, int count, int yy, int xx); -extern void fbcon_vga_revc(struct display *p, int xx, int yy); - -#endif /* _VIDEO_FBCON_VGA_H */ |
