Commit 0406890a authored by James Simmons's avatar James Simmons

Merge maxwell.earthlink.net:/usr/src/linus-2.5

into maxwell.earthlink.net:/usr/src/fbdev-2.5
parents b4ad3d85 8a6af4a3
...@@ -2785,6 +2785,19 @@ S: Klosterweg 28 / i309 ...@@ -2785,6 +2785,19 @@ S: Klosterweg 28 / i309
S: 76131 Karlsruhe S: 76131 Karlsruhe
S: Germany 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 N: Jaspreet Singh
E: jaspreet@sangoma.com E: jaspreet@sangoma.com
W: www.sangoma.com W: www.sangoma.com
......
...@@ -591,6 +591,13 @@ M: kevin.curtis@farsite.co.uk ...@@ -591,6 +591,13 @@ M: kevin.curtis@farsite.co.uk
W: http://www.farsite.co.uk/ W: http://www.farsite.co.uk/
S: Supported 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()) FILE LOCKING (flock() and fcntl()/lockf())
P: Matthew Wilcox P: Matthew Wilcox
M: matthew@wil.cx M: matthew@wil.cx
......
...@@ -672,32 +672,6 @@ CONFIG_FBCON_MFB ...@@ -672,32 +672,6 @@ CONFIG_FBCON_MFB
This is the low level frame buffer console driver for monochrome This is the low level frame buffer console driver for monochrome
(2 colors) packed pixels. (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 CONFIG_FBCON_AFB
This is the low level frame buffer console driver for 1 to 8 This is the low level frame buffer console driver for 1 to 8
bitplanes (2 to 256 colors) on Amiga. bitplanes (2 to 256 colors) on Amiga.
......
...@@ -313,20 +313,16 @@ if [ "$CONFIG_FB" = "y" ]; then ...@@ -313,20 +313,16 @@ if [ "$CONFIG_FB" = "y" ]; then
define_tristate CONFIG_FBCON_CFB16 m define_tristate CONFIG_FBCON_CFB16 m
fi fi
fi fi
if [ "$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \ if [ "$CONFIG_FB_CYBER2000" = "y" -o "$CONFIG_FB_VOODOO1" = "y" -o \
"$CONFIG_FB_CLGEN" = "y" -o "$CONFIG_FB_VESA" = "y" -o \ "$CONFIG_FB_CLGEN" = "y" -o "$CONFIG_FB_PVR2" = "y" -o \
"$CONFIG_FB_MATROX" = "y" -o "$CONFIG_FB_PM2" = "y" -o \ "$CONFIG_FB_MATROX" = "y" -o "$CONFIG_FB_PM2" = "y" -o \
"$CONFIG_FB_ATY128" = "y" -o "$CONFIG_FB_RADEON" = "y" -o \ "$CONFIG_FB_ATY128" = "y" -o "$CONFIG_FB_RADEON" = "y" ]; then
"$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 define_tristate CONFIG_FBCON_CFB24 y
else else
if [ "$CONFIG_FB_ATY" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \ if [ "$CONFIG_FB_CLGEN" = "m" -o "$CONFIG_FB_VOODOO1" = "m" -o \
"$CONFIG_FB_CLGEN" = "m" -o "$CONFIG_FB_VESA" = "m" -o \
"$CONFIG_FB_MATROX" = "m" -o "$CONFIG_FB_PM2" = "m" -o \ "$CONFIG_FB_MATROX" = "m" -o "$CONFIG_FB_PM2" = "m" -o \
"$CONFIG_FB_ATY128" = "m" -o "$CONFIG_FB_RADEON" = "m" -o \ "$CONFIG_FB_ATY128" = "m" -o "$CONFIG_FB_RADEON" = "m" -o \
"$CONFIG_FB_CYBER2000" = "m" -o "$CONFIG_FB_PVR2" = "m" -o \ "$CONFIG_FB_CYBER2000" = "m" -o "$CONFIG_FB_PVR2" = "m" ]; then
"$CONFIG_FB_VOODOO1" = "m" -o "$CONFIG_FB_NEOMAGIC" = "y" ]; then
define_tristate CONFIG_FBCON_CFB24 m define_tristate CONFIG_FBCON_CFB24 m
fi fi
fi fi
...@@ -365,7 +361,8 @@ if [ "$CONFIG_FB" = "y" ]; then ...@@ -365,7 +361,8 @@ if [ "$CONFIG_FB" = "y" ]; then
if [ "$CONFIG_FB_NEOMAGIC" = "m" -o "$CONFIG_FB_HIT" = "m" -o \ if [ "$CONFIG_FB_NEOMAGIC" = "m" -o "$CONFIG_FB_HIT" = "m" -o \
"$CONFIG_FB_G364" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \ "$CONFIG_FB_G364" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \
"$CONFIG_FB_CLPS711X" = "m" -o "$CONFIG_FB_3DFX" = "m" -o \ "$CONFIG_FB_CLPS711X" = "m" -o "$CONFIG_FB_3DFX" = "m" -o \
"$CONFIG_FB_RIVA" = "m" -o "$CONFIG_FB_SGIVW" = "m" ]; then "$CONFIG_FB_RIVA" = "m" -o "$CONFIG_FB_SGIVW" = "m" -o \
"$CONFIG_FB_ATY" = "m" ]; then
define_tristate CONFIG_FBCON_ACCEL m define_tristate CONFIG_FBCON_ACCEL m
fi fi
fi fi
......
...@@ -5,12 +5,10 @@ ...@@ -5,12 +5,10 @@
# All of the (potential) objects that export symbols. # All of the (potential) objects that export symbols.
# This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'. # This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'.
export-objs := fbmem.o fbcmap.o fbcon.o fbmon.o modedb.o \ export-objs := fbmem.o fbcmap.o fbcon.o fbmon.o modedb.o fbgen.o \
fbcon-afb.o fbcon-ilbm.o fbcon-accel.o cyber2000fb.o \ fbcon-afb.o fbcon-ilbm.o fbcon-accel.o cyber2000fb.o \
fbcon-iplan2p2.o fbcon-iplan2p4.o fbgen.o \ fbcon-iplan2p2.o fbcon-iplan2p4.o fbcon-iplan2p8.o \
fbcon-iplan2p8.o fbcon-vga-planes.o fbcon-cfb16.o \ fbcon-vga-planes.o fbcon-vga8-planes.o fbcon-hga.o
fbcon-cfb2.o fbcon-cfb24.o fbcon-cfb32.o fbcon-cfb4.o \
fbcon-cfb8.o fbcon-mfb.o fbcon-hga.o
# Each configuration option enables a list of files. # Each configuration option enables a list of files.
...@@ -60,7 +58,7 @@ obj-$(CONFIG_FB_SGIVW) += sgivwfb.o cfbfillrect.o cfbcopyarea.o cfbim ...@@ -60,7 +58,7 @@ obj-$(CONFIG_FB_SGIVW) += sgivwfb.o cfbfillrect.o cfbcopyarea.o cfbim
obj-$(CONFIG_FB_3DFX) += tdfxfb.o obj-$(CONFIG_FB_3DFX) += tdfxfb.o
obj-$(CONFIG_FB_MAC) += macfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.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_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_IMSTT) += imsttfb.o
obj-$(CONFIG_FB_RETINAZ3) += retz3fb.o obj-$(CONFIG_FB_RETINAZ3) += retz3fb.o
obj-$(CONFIG_FB_CLGEN) += clgenfb.o obj-$(CONFIG_FB_CLGEN) += clgenfb.o
...@@ -68,7 +66,7 @@ obj-$(CONFIG_FB_TRIDENT) += tridentfb.o ...@@ -68,7 +66,7 @@ obj-$(CONFIG_FB_TRIDENT) += tridentfb.o
obj-$(CONFIG_FB_S3TRIO) += S3triofb.o obj-$(CONFIG_FB_S3TRIO) += S3triofb.o
obj-$(CONFIG_FB_TGA) += tgafb.o obj-$(CONFIG_FB_TGA) += tgafb.o
obj-$(CONFIG_FB_VESA) += vesafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.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_VIRGE) += virgefb.o
obj-$(CONFIG_FB_G364) += g364fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.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 obj-$(CONFIG_FB_FM2) += fm2fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
...@@ -104,12 +102,6 @@ obj-$(CONFIG_FB_VOODOO1) += sstfb.o ...@@ -104,12 +102,6 @@ obj-$(CONFIG_FB_VOODOO1) += sstfb.o
# Generic Low Level Drivers # Generic Low Level Drivers
obj-$(CONFIG_FBCON_AFB) += fbcon-afb.o 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_ILBM) += fbcon-ilbm.o
obj-$(CONFIG_FBCON_IPLAN2P2) += fbcon-iplan2p2.o obj-$(CONFIG_FBCON_IPLAN2P2) += fbcon-iplan2p2.o
obj-$(CONFIG_FBCON_IPLAN2P4) += fbcon-iplan2p4.o obj-$(CONFIG_FBCON_IPLAN2P4) += fbcon-iplan2p4.o
......
...@@ -20,11 +20,8 @@ ...@@ -20,11 +20,8 @@
#include <asm/io.h> #include <asm/io.h>
#include <video/fbcon.h>
static u32 colreg[16]; static u32 colreg[16];
static struct fb_info fb_info; static struct fb_info fb_info;
static struct display display;
static struct fb_var_screeninfo anakinfb_var = { static struct fb_var_screeninfo anakinfb_var = {
.xres = 400, .xres = 400,
...@@ -66,8 +63,6 @@ anakinfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, ...@@ -66,8 +63,6 @@ anakinfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
static struct fb_ops anakinfb_ops = { static struct fb_ops anakinfb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_set_var = gen_set_var, .fb_set_var = gen_set_var,
.fb_get_cmap = gen_get_cmap,
.fb_set_cmap = gen_set_cmap,
.fb_setcolreg = anakinfb_setcolreg, .fb_setcolreg = anakinfb_setcolreg,
.fb_fillrect = cfb_fillrect, .fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea, .fb_copyarea = cfb_copyarea,
...@@ -78,20 +73,13 @@ int __init ...@@ -78,20 +73,13 @@ int __init
anakinfb_init(void) anakinfb_init(void)
{ {
memset(&fb_info, 0, sizeof(struct fb_info)); 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.node = NODEV;
fb_info.currcon = -1;
fb_info.flags = FBINFO_FLAG_DEFAULT; fb_info.flags = FBINFO_FLAG_DEFAULT;
fb_info.fbops = &anakinfb_ops; fb_info.fbops = &anakinfb_ops;
fb_info.var = anakinfb_var; fb_info.var = anakinfb_var;
fb_info.fix = anakinfb_fix; fb_info.fix = anakinfb_fix;
fb_info.disp = &display;
strcpy(fb_info.fontname, "VGA8x16"); 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"))) if (!(request_mem_region(VGA_START, VGA_SIZE, "vga")))
return -ENOMEM; return -ENOMEM;
if (fb_info.screen_base = ioremap(VGA_START, VGA_SIZE)) { if (fb_info.screen_base = ioremap(VGA_START, VGA_SIZE)) {
...@@ -100,10 +88,9 @@ anakinfb_init(void) ...@@ -100,10 +88,9 @@ anakinfb_init(void)
} }
fb_alloc_cmap(&fb_info.cmap, 16, 0); fb_alloc_cmap(&fb_info.cmap, 16, 0);
gen_set_disp(-1, &fb_info);
if (register_framebuffer(&fb_info) < 0) { if (register_framebuffer(&fb_info) < 0) {
iounmap(display.screen_base); iounmap(fb_info.screen_base);
release_mem_region(VGA_START, VGA_SIZE); release_mem_region(VGA_START, VGA_SIZE);
return -EINVAL; return -EINVAL;
} }
......
...@@ -65,9 +65,6 @@ ...@@ -65,9 +65,6 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <video/fbcon.h>
#include "../fbcon-accel.h"
#include <video/mach64.h> #include <video/mach64.h>
#include "atyfb.h" #include "atyfb.h"
...@@ -211,8 +208,6 @@ static struct fb_ops atyfb_ops = { ...@@ -211,8 +208,6 @@ static struct fb_ops atyfb_ops = {
.fb_set_var = gen_set_var, .fb_set_var = gen_set_var,
.fb_check_var = atyfb_check_var, .fb_check_var = atyfb_check_var,
.fb_set_par = atyfb_set_par, .fb_set_par = atyfb_set_par,
.fb_get_cmap = gen_get_cmap,
.fb_set_cmap = gen_set_cmap,
.fb_setcolreg = atyfb_setcolreg, .fb_setcolreg = atyfb_setcolreg,
.fb_pan_display = atyfb_pan_display, .fb_pan_display = atyfb_pan_display,
.fb_blank = atyfb_blank, .fb_blank = atyfb_blank,
...@@ -694,6 +689,13 @@ static int aty_crtc_to_var(const struct crtc *crtc, ...@@ -694,6 +689,13 @@ static int aty_crtc_to_var(const struct crtc *crtc,
(v_sync_pol ? 0 : FB_SYNC_VERT_HIGH_ACT) | (v_sync_pol ? 0 : FB_SYNC_VERT_HIGH_ACT) |
(c_sync ? FB_SYNC_COMP_HIGH_ACT : 0); (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) { switch (pix_width) {
#if 0 #if 0
case CRTC_PIX_WIDTH_4BPP: case CRTC_PIX_WIDTH_4BPP:
...@@ -702,10 +704,7 @@ static int aty_crtc_to_var(const struct crtc *crtc, ...@@ -702,10 +704,7 @@ static int aty_crtc_to_var(const struct crtc *crtc,
var->red.length = 8; var->red.length = 8;
var->green.offset = 0; var->green.offset = 0;
var->green.length = 8; var->green.length = 8;
var->blue.offset = 0;
var->blue.length = 8; var->blue.length = 8;
var->transp.offset = 0;
var->transp.length = 0;
break; break;
#endif #endif
case CRTC_PIX_WIDTH_8BPP: case CRTC_PIX_WIDTH_8BPP:
...@@ -714,10 +713,7 @@ static int aty_crtc_to_var(const struct crtc *crtc, ...@@ -714,10 +713,7 @@ static int aty_crtc_to_var(const struct crtc *crtc,
var->red.length = 8; var->red.length = 8;
var->green.offset = 0; var->green.offset = 0;
var->green.length = 8; var->green.length = 8;
var->blue.offset = 0;
var->blue.length = 8; var->blue.length = 8;
var->transp.offset = 0;
var->transp.length = 0;
break; break;
case CRTC_PIX_WIDTH_15BPP: /* RGB 555 */ case CRTC_PIX_WIDTH_15BPP: /* RGB 555 */
bpp = 16; bpp = 16;
...@@ -725,10 +721,7 @@ static int aty_crtc_to_var(const struct crtc *crtc, ...@@ -725,10 +721,7 @@ static int aty_crtc_to_var(const struct crtc *crtc,
var->red.length = 5; var->red.length = 5;
var->green.offset = 5; var->green.offset = 5;
var->green.length = 5; var->green.length = 5;
var->blue.offset = 0;
var->blue.length = 5; var->blue.length = 5;
var->transp.offset = 0;
var->transp.length = 0;
break; break;
#if 0 #if 0
case CRTC_PIX_WIDTH_16BPP: /* RGB 565 */ case CRTC_PIX_WIDTH_16BPP: /* RGB 565 */
...@@ -737,10 +730,7 @@ static int aty_crtc_to_var(const struct crtc *crtc, ...@@ -737,10 +730,7 @@ static int aty_crtc_to_var(const struct crtc *crtc,
var->red.length = 5; var->red.length = 5;
var->green.offset = 5; var->green.offset = 5;
var->green.length = 6; var->green.length = 6;
var->blue.offset = 0;
var->blue.length = 5; var->blue.length = 5;
var->transp.offset = 0;
var->transp.length = 0;
break; break;
#endif #endif
case CRTC_PIX_WIDTH_24BPP: /* RGB 888 */ case CRTC_PIX_WIDTH_24BPP: /* RGB 888 */
...@@ -749,10 +739,7 @@ static int aty_crtc_to_var(const struct crtc *crtc, ...@@ -749,10 +739,7 @@ static int aty_crtc_to_var(const struct crtc *crtc,
var->red.length = 8; var->red.length = 8;
var->green.offset = 8; var->green.offset = 8;
var->green.length = 8; var->green.length = 8;
var->blue.offset = 0;
var->blue.length = 8; var->blue.length = 8;
var->transp.offset = 0;
var->transp.length = 0;
break; break;
case CRTC_PIX_WIDTH_32BPP: /* ARGB 8888 */ case CRTC_PIX_WIDTH_32BPP: /* ARGB 8888 */
bpp = 32; bpp = 32;
...@@ -760,7 +747,6 @@ static int aty_crtc_to_var(const struct crtc *crtc, ...@@ -760,7 +747,6 @@ static int aty_crtc_to_var(const struct crtc *crtc,
var->red.length = 8; var->red.length = 8;
var->green.offset = 8; var->green.offset = 8;
var->green.length = 8; var->green.length = 8;
var->blue.offset = 0;
var->blue.length = 8; var->blue.length = 8;
var->transp.offset = 24; var->transp.offset = 24;
var->transp.length = 8; var->transp.length = 8;
...@@ -870,8 +856,7 @@ static int atyfb_set_par(struct fb_info *info) ...@@ -870,8 +856,7 @@ static int atyfb_set_par(struct fb_info *info)
#ifdef CONFIG_BOOTX_TEXT #ifdef CONFIG_BOOTX_TEXT
btext_update_display(info->fix.smem_start, btext_update_display(info->fix.smem_start,
(((par->crtc.h_tot_disp >> 16) & 0xff) + (((par->crtc.h_tot_disp >> 16) & 0xff) + 1) * 8,
1) * 8,
((par->crtc.v_tot_disp >> 16) & 0x7ff) + 1, ((par->crtc.v_tot_disp >> 16) & 0x7ff) + 1,
info->var.bits_per_pixel, info->var.bits_per_pixel,
par->crtc.vxres * info->var.bits_per_pixel / 8); par->crtc.vxres * info->var.bits_per_pixel / 8);
...@@ -905,14 +890,13 @@ static int atyfb_encode_var(struct fb_var_screeninfo *var, ...@@ -905,14 +890,13 @@ static int atyfb_encode_var(struct fb_var_screeninfo *var,
{ {
int err; int err;
memset(var, 0, sizeof(struct fb_var_screeninfo));
if ((err = aty_crtc_to_var(&par->crtc, var))) if ((err = aty_crtc_to_var(&par->crtc, var)))
return err; return err;
var->pixclock = par->pll_ops->pll_to_var(info, &par->pll); var->pixclock = par->pll_ops->pll_to_var(info, &par->pll);
var->height = -1; var->height = -1;
var->width = -1; var->width = -1;
var->nonstd = 0;
return 0; return 0;
} }
...@@ -1442,15 +1426,15 @@ static int aty_power_mgmt(int sleep, struct atyfb_par *par) ...@@ -1442,15 +1426,15 @@ static int aty_power_mgmt(int sleep, struct atyfb_par *par)
static int aty_sleep_notify(struct pmu_sleep_notifier *self, int when) static int aty_sleep_notify(struct pmu_sleep_notifier *self, int when)
{ {
struct fb_info *info; struct fb_info *info;
struct atyfb_par *par = (struct atyfb_par *) info->fb.par; struct atyfb_par *par;
int result; int result;
result = PBOOK_SLEEP_OK; result = PBOOK_SLEEP_OK;
for (info = first_display; info != NULL; info = par->next) { for (info = first_display; info != NULL; info = par->next) {
struct fb_fix_screeninfo fix;
int nb; int nb;
par = (struct atyfb_par *) info->par;
nb = fb_display[fg_console].var.yres * info->fix.line_length; nb = fb_display[fg_console].var.yres * info->fix.line_length;
switch (when) { switch (when) {
...@@ -1469,7 +1453,7 @@ static int aty_sleep_notify(struct pmu_sleep_notifier *self, int when) ...@@ -1469,7 +1453,7 @@ static int aty_sleep_notify(struct pmu_sleep_notifier *self, int when)
if (par->blitter_may_be_busy) if (par->blitter_may_be_busy)
wait_for_idle(par); wait_for_idle(par);
/* Stop accel engine (stop bus mastering) */ /* 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); aty_reset_engine(par);
/* Backup fb content */ /* Backup fb content */
...@@ -1562,7 +1546,6 @@ static int __init aty_init(struct fb_info *info, const char *name) ...@@ -1562,7 +1546,6 @@ static int __init aty_init(struct fb_info *info, const char *name)
const char *chipname = NULL, *ramname = NULL, *xtal; const char *chipname = NULL, *ramname = NULL, *xtal;
int j, pll, mclk, gtb_memsize; int j, pll, mclk, gtb_memsize;
struct fb_var_screeninfo var; struct fb_var_screeninfo var;
struct display *disp;
u32 chip_id, i; u32 chip_id, i;
u16 type; u16 type;
u8 rev; u8 rev;
...@@ -1843,17 +1826,11 @@ static int __init aty_init(struct fb_info *info, const char *name) ...@@ -1843,17 +1826,11 @@ static int __init aty_init(struct fb_info *info, const char *name)
fb_memset((void *) info->screen_base, 0, fb_memset((void *) info->screen_base, 0,
info->fix.smem_len); info->fix.smem_len);
disp = info->disp;
strcpy(info->modename, info->fix.id);
info->node = NODEV; info->node = NODEV;
info->fbops = &atyfb_ops; info->fbops = &atyfb_ops;
info->disp = disp;
info->pseudo_palette = pseudo_palette; info->pseudo_palette = pseudo_palette;
info->currcon = -1; info->currcon = -1;
strcpy(info->fontname, fontname); strcpy(info->fontname, fontname);
info->changevar = NULL;
info->switch_con = gen_switch;
info->updatevar = gen_update_var; info->updatevar = gen_update_var;
info->flags = FBINFO_FLAG_DEFAULT; info->flags = FBINFO_FLAG_DEFAULT;
...@@ -1979,6 +1956,7 @@ static int __init aty_init(struct fb_info *info, const char *name) ...@@ -1979,6 +1956,7 @@ static int __init aty_init(struct fb_info *info, const char *name)
fb_alloc_cmap(&info->cmap, 256, 0); fb_alloc_cmap(&info->cmap, 256, 0);
var.activate = FB_ACTIVATE_NOW;
gen_set_var(&var, -1, info); gen_set_var(&var, -1, info);
if (register_framebuffer(info) < 0) if (register_framebuffer(info) < 0)
...@@ -2029,27 +2007,17 @@ int __init atyfb_init(void) ...@@ -2029,27 +2007,17 @@ int __init atyfb_init(void)
info = info =
kmalloc(sizeof(struct fb_info) + kmalloc(sizeof(struct fb_info) +
sizeof(struct display), GFP_ATOMIC); sizeof(struct atyfb_par), GFP_ATOMIC);
if (!info) { if (!info) {
printk printk
("atyfb_init: can't alloc fb_info\n"); ("atyfb_init: can't alloc fb_info\n");
return -ENXIO; return -ENXIO;
} }
memset(info, 0, memset(info, 0, sizeof(struct fb_info) +
sizeof(struct fb_info) + sizeof(struct atyfb_par));
sizeof(struct display));
default_par = default_par = (struct atyfb_par *) (info + 1);
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));
info->disp = (struct display *) (info + 1);
info->fix = atyfb_fix; info->fix = atyfb_fix;
info->par = default_par; info->par = default_par;
...@@ -2383,7 +2351,6 @@ int __init atyfb_init(void) ...@@ -2383,7 +2351,6 @@ int __init atyfb_init(void)
if (first_display == NULL) if (first_display == NULL)
pmu_register_sleep_notifier pmu_register_sleep_notifier
(&aty_sleep_notifier); (&aty_sleep_notifier);
/* FIXME info->next = first_display; */
default_par->next = first_display; default_par->next = first_display;
#endif #endif
} }
...@@ -2410,7 +2377,7 @@ int __init atyfb_init(void) ...@@ -2410,7 +2377,7 @@ int __init atyfb_init(void)
return -ENOMEM; return -ENOMEM;
} }
memset(info, 0, sizeof(struct fb_info)); 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 * Map the video memory (physical address given) to somewhere in the
...@@ -2421,7 +2388,7 @@ int __init atyfb_init(void) ...@@ -2421,7 +2388,7 @@ int __init atyfb_init(void)
info->fix.smem_start = info->screen_base; /* Fake! */ info->fix.smem_start = info->screen_base; /* Fake! */
default_par->ati_regbase = (unsigned long)ioremap(phys_guiregbase[m64_num], default_par->ati_regbase = (unsigned long)ioremap(phys_guiregbase[m64_num],
0x10000) + 0xFC00ul; 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); aty_st_le32(CLOCK_CNTL, 0x12345678, default_par);
clock_r = aty_ld_le32(CLOCK_CNTL, default_par); clock_r = aty_ld_le32(CLOCK_CNTL, default_par);
......
...@@ -40,10 +40,10 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) ...@@ -40,10 +40,10 @@ 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); 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; unsigned long *dst = NULL, *src = NULL;
char *src1, *dst1; char *src1, *dst1;
int tmp, height; int height;
/* clip the destination */ /* clip the destination */
old_dx = area->dx; old_dx = area->dx;
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/fb.h> #include <linux/fb.h>
#include <asm/types.h> #include <asm/types.h>
#include <video/fbcon.h>
#if BITS_PER_LONG == 32 #if BITS_PER_LONG == 32
#define FB_READ fb_readl #define FB_READ fb_readl
......
...@@ -31,8 +31,6 @@ ...@@ -31,8 +31,6 @@
#include <linux/fb.h> #include <linux/fb.h>
#include <asm/types.h> #include <asm/types.h>
#include <video/fbcon.h>
#define DEBUG #define DEBUG
#ifdef DEBUG #ifdef DEBUG
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <video/fbcon.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -197,8 +195,6 @@ static struct fb_ops clps7111fb_ops = { ...@@ -197,8 +195,6 @@ static struct fb_ops clps7111fb_ops = {
.fb_check_var = clps7111fb_check_var, .fb_check_var = clps7111fb_check_var,
.fb_set_par = clps7111fb_set_par, .fb_set_par = clps7111fb_set_par,
.fb_set_var = gen_set_var, .fb_set_var = gen_set_var,
.fb_set_cmap = gen_set_cmap,
.fb_get_cmap = gen_get_cmap,
.fb_setcolreg = clps7111fb_setcolreg, .fb_setcolreg = clps7111fb_setcolreg,
.fb_blank = clps7111fb_blank, .fb_blank = clps7111fb_blank,
.fb_fillrect = cfb_fillrect, .fb_fillrect = cfb_fillrect,
...@@ -261,37 +257,31 @@ int __init clps711xfb_init(void) ...@@ -261,37 +257,31 @@ int __init clps711xfb_init(void)
{ {
int err = -ENOMEM; int err = -ENOMEM;
cfb = kmalloc(sizeof(*cfb) + sizeof(struct display), GFP_KERNEL); cfb = kmalloc(sizeof(*cfb), GFP_KERNEL);
if (!cfb) if (!cfb)
goto out; goto out;
memset(cfb, 0, sizeof(*cfb) + sizeof(struct display)); memset(cfb, 0, sizeof(*cfb));
memset((void *)PAGE_OFFSET, 0, 0x14000); memset((void *)PAGE_OFFSET, 0, 0x14000);
cfb->currcon = -1;
strcpy(cfb->fix.id, "clps7111"); strcpy(cfb->fix.id, "clps7111");
cfb->screen_base = (void *)PAGE_OFFSET; cfb->screen_base = (void *)PAGE_OFFSET;
cfb->fix.smem_start = PAGE_OFFSET; cfb->fix.smem_start = PAGE_OFFSET;
cfb->fix.smem_len = 0x14000; cfb->fix.smem_len = 0x14000;
cfb->fix.type = FB_TYPE_PACKED_PIXELS; cfb->fix.type = FB_TYPE_PACKED_PIXELS;
cfb->var.xres = 640; cfb->var.xres = 640;
cfb->var.xres_virtual = 640; cfb->var.xres_virtual = 640;
cfb->var.yres = 240; cfb->var.yres = 240;
cfb->var.yres_virtual = 240; cfb->var.yres_virtual = 240;
cfb->var.bits_per_pixel = 4; cfb->var.bits_per_pixel = 4;
cfb->var.grayscale = 1; cfb->var.grayscale = 1;
cfb->var.activate = FB_ACTIVATE_NOW; cfb->var.activate = FB_ACTIVATE_NOW;
cfb->var.height = -1; cfb->var.height = -1;
cfb->var.width = -1; cfb->var.width = -1;
cfb->fbops = &clps7111fb_ops; cfb->fbops = &clps7111fb_ops;
cfb->changevar = NULL;
cfb->switch_con = gen_switch;
cfb->updatevar = gen_update_var;
cfb->flags = FBINFO_FLAG_DEFAULT; cfb->flags = FBINFO_FLAG_DEFAULT;
cfb->disp = (struct display *)(cfb + 1);
fb_alloc_cmap(&cfb->cmap, CMAP_SIZE, 0); fb_alloc_cmap(&cfb->cmap, CMAP_SIZE, 0);
......
...@@ -1114,8 +1114,6 @@ static struct fb_ops cyber2000fb_ops = { ...@@ -1114,8 +1114,6 @@ static struct fb_ops cyber2000fb_ops = {
.fb_setcolreg = cyber2000fb_setcolreg, .fb_setcolreg = cyber2000fb_setcolreg,
.fb_pan_display = cyber2000fb_pan_display, .fb_pan_display = cyber2000fb_pan_display,
.fb_blank = cyber2000fb_blank, .fb_blank = cyber2000fb_blank,
.fb_get_cmap = gen_get_cmap,
.fb_set_cmap = gen_set_cmap,
}; };
/* /*
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/module.h> #include <linux/module.h>
#include <video/fbcon.h>
/* apollo video HW definitions */ /* apollo video HW definitions */
/* /*
...@@ -111,7 +109,6 @@ ...@@ -111,7 +109,6 @@
#endif #endif
static struct fb_info fb_info; static struct fb_info fb_info;
static struct display disp;
/* frame buffer operations */ /* frame buffer operations */
...@@ -121,8 +118,6 @@ static void dnfb_copyarea(struct fb_info *info, struct fb_copyarea *area); ...@@ -121,8 +118,6 @@ static void dnfb_copyarea(struct fb_info *info, struct fb_copyarea *area);
static struct fb_ops dn_fb_ops = { static struct fb_ops dn_fb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_set_var = gen_set_var, .fb_set_var = gen_set_var,
.fb_get_cmap = gen_get_cmap,
.fb_set_cmap = gen_set_cmap,
.fb_blank = dnfb_blank, .fb_blank = dnfb_blank,
.fb_fillrect = cfb_fillrect, .fb_fillrect = cfb_fillrect,
.fb_copyarea = dnfb_copyarea, .fb_copyarea = dnfb_copyarea,
...@@ -239,22 +234,14 @@ unsigned long __init dnfb_init(unsigned long mem_start) ...@@ -239,22 +234,14 @@ unsigned long __init dnfb_init(unsigned long mem_start)
{ {
int err; int err;
strcpy(fb_info.modename, dnfb_fix.id);
fb_info.changevar = NULL;
fb_info.fontname[0] = 0; 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.node = NODEV;
fb_info.fbops = &dn_fb_ops; fb_info.fbops = &dn_fb_ops;
fb_info.currcon = -1;
fb_info.fix = dnfb_fix; fb_info.fix = dnfb_fix;
fb_info.var = dnfb_var; fb_info.var = dnfb_var;
fb_info.screen_base = (u_char *) fb_info.fix.smem_start;
fb_alloc_cmap(&fb_info.cmap, 2, 0); 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); err = register_framebuffer(&fb_info);
if (err < 0) if (err < 0)
......
...@@ -82,9 +82,10 @@ void fbcon_accel_putcs(struct vc_data *vc, struct display *p, ...@@ -82,9 +82,10 @@ void fbcon_accel_putcs(struct vc_data *vc, struct display *p,
unsigned short charmask = p->charmask; unsigned short charmask = p->charmask;
unsigned int width = ((fontwidth(p)+7)>>3); unsigned int width = ((fontwidth(p)+7)>>3);
struct fb_image image; struct fb_image image;
u16 c = scr_readw(s);
image.fg_color = attr_fgcol(p, *s); image.fg_color = attr_fgcol(p, c);
image.bg_color = attr_bgcol(p, *s); image.bg_color = attr_bgcol(p, c);
image.dx = xx * fontwidth(p); image.dx = xx * fontwidth(p);
image.dy = yy * fontheight(p); image.dy = yy * fontheight(p);
image.width = fontwidth(p); image.width = fontwidth(p);
......
/*
* 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);
/*
* 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);
/*
* 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);
/*
* 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);
/*
* 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);
/*
* 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);
/*
* 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);
...@@ -105,10 +105,9 @@ void fbcon_vga_planes_setup(struct display *p) ...@@ -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, void fbcon_vga_planes_bmove(struct display *p, int sy, int sx, int dy, int dx,
int height, int width) int height, int width)
{ {
char *src; struct fb_info *info = p->fb_info;
char *dest; char *dest, *src;
int line_ofs; int line_ofs, x;
int x;
setmode(1); setmode(1);
setop(0); setop(0);
...@@ -119,9 +118,9 @@ void fbcon_vga_planes_bmove(struct display *p, int sy, int sx, int dy, int dx, ...@@ -119,9 +118,9 @@ void fbcon_vga_planes_bmove(struct display *p, int sy, int sx, int dy, int dx,
height *= fontheight(p); height *= fontheight(p);
if (dy < sy || (dy == sy && dx < sx)) { if (dy < sy || (dy == sy && dx < sx)) {
line_ofs = p->fb_info->fix.line_length - width; line_ofs = info->fix.line_length - width;
dest = p->fb_info->screen_base + dx + dy * p->fb_info->fix.line_length; dest = info->screen_base + dx + dy * info->fix.line_length;
src = p->fb_info->screen_base + sx + sy * p->fb_info->fix.line_length; src = info->screen_base + sx + sy * info->fix.line_length;
while (height--) { while (height--) {
for (x = 0; x < width; x++) { for (x = 0; x < width; x++) {
readb(src); readb(src);
...@@ -133,9 +132,9 @@ void fbcon_vga_planes_bmove(struct display *p, int sy, int sx, int dy, int dx, ...@@ -133,9 +132,9 @@ void fbcon_vga_planes_bmove(struct display *p, int sy, int sx, int dy, int dx,
dest += line_ofs; dest += line_ofs;
} }
} else { } else {
line_ofs = p->fb_info->fix.line_length - width; line_ofs = info->fix.line_length - width;
dest = p->fb_info->screen_base + dx + width + (dy + height - 1) * p->fb_info->fix.line_length; dest = info->screen_base + dx + width + (dy + height - 1) * info->fix.line_length;
src = p->fb_info->screen_base + sx + width + (sy + height - 1) * p->fb_info->fix.line_length; src = info->screen_base + sx + width + (sy + height - 1) * info->fix.line_length;
while (height--) { while (height--) {
for (x = 0; x < width; x++) { for (x = 0; x < width; x++) {
dest--; dest--;
...@@ -177,137 +176,48 @@ void fbcon_vga_planes_clear(struct vc_data *conp, struct display *p, int sy, int ...@@ -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) void fbcon_accel_putc(struct vc_data *vc, 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)
{ {
u16 c = scr_readw(s); struct fb_info *info = p->fb_info;
int fg = attr_fgcol(p, c); unsigned short charmask = p->charmask;
int bg = attr_bgcol(p, c); unsigned int width = ((fontwidth(p)+7)>>3);
struct fb_image image;
char *where;
int n; image.fg_color = attr_fgcol(p, c);
image.bg_color = attr_bgcol(p, c);
setmode(2); image.dx = xx * fontwidth(p);
setop(0); image.dy = yy * fontheight(p);
selectmask(); image.width = fontwidth(p);
image.height = fontheight(p);
setmask(0xff); image.depth = 1;
where = p->fb_info->screen_base + xx + yy * p->fb_info->fix.line_length * fontheight(p); image.data = p->fontdata + (c & charmask)*fontheight(p)*width;
writeb(bg, where);
rmb(); info->fbops->fb_imageblit(info, &image);
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();
} }
/* 6.96 in my test */ void fbcon_accel_putcs(struct vc_data *vc, struct display *p,
void fbcon_vga_planes_putcs(struct vc_data *conp, struct display *p, const unsigned short *s, const unsigned short *s, int count, int yy, int xx)
int count, int yy, int xx)
{ {
u16 c = scr_readw(s); struct fb_info *info = p->fb_info;
int fg = attr_fgcol(p, c); unsigned short charmask = p->charmask;
int bg = attr_bgcol(p, c); unsigned int width = ((fontwidth(p)+7)>>3);
struct fb_image image;
char *where;
int n; image.fg_color = attr_fgcol(p, *s);
image.bg_color = attr_bgcol(p, *s);
setmode(2); image.dx = xx * fontwidth(p);
setop(0); image.dy = yy * fontheight(p);
setsr(0xf); image.width = fontwidth(p);
setcolor(fg); image.height = fontheight(p);
selectmask(); image.depth = 1;
setmask(0xff); while (count--) {
where = p->fb_info->screen_base + xx + yy * p->fb_info->fix.line_length * fontheight(p); image.data = p->fontdata +
writeb(bg, where); (scr_readw(s++) & charmask) * fontheight(p) * width;
rmb(); info->fbops->fb_imageblit(info, &image);
readb(where); /* fill latches */ image.dx += fontwidth(p);
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();
} }
void fbcon_vga_planes_revc(struct display *p, int xx, int yy) void fbcon_vga_planes_revc(struct display *p, int xx, int yy)
...@@ -332,18 +242,8 @@ struct display_switch fbcon_vga_planes = { ...@@ -332,18 +242,8 @@ struct display_switch fbcon_vga_planes = {
setup: fbcon_vga_planes_setup, setup: fbcon_vga_planes_setup,
bmove: fbcon_vga_planes_bmove, bmove: fbcon_vga_planes_bmove,
clear: fbcon_vga_planes_clear, clear: fbcon_vga_planes_clear,
putc: fbcon_vga_planes_putc, putc: fbcon_accel_putc,
putcs: fbcon_vga_planes_putcs, putcs: fbcon_accel_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,
revc: fbcon_vga_planes_revc, revc: fbcon_vga_planes_revc,
fontwidthmask: FONTWIDTH(8) fontwidthmask: FONTWIDTH(8)
}; };
...@@ -369,14 +269,8 @@ EXPORT_SYMBOL(fbcon_vga_planes); ...@@ -369,14 +269,8 @@ EXPORT_SYMBOL(fbcon_vga_planes);
EXPORT_SYMBOL(fbcon_vga_planes_setup); EXPORT_SYMBOL(fbcon_vga_planes_setup);
EXPORT_SYMBOL(fbcon_vga_planes_bmove); EXPORT_SYMBOL(fbcon_vga_planes_bmove);
EXPORT_SYMBOL(fbcon_vga_planes_clear); 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_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. * Overrides for Emacs so that we follow Linus's tabbing style.
* --------------------------------------------------------------------------- * ---------------------------------------------------------------------------
......
...@@ -100,7 +100,9 @@ ...@@ -100,7 +100,9 @@
#include <asm/linux_logo.h> #include <asm/linux_logo.h>
#include <video/fbcon.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> #include <video/font.h>
#ifdef FBCONDEBUG #ifdef FBCONDEBUG
...@@ -277,6 +279,41 @@ int PROC_CONSOLE(const struct fb_info *info) ...@@ -277,6 +279,41 @@ int PROC_CONSOLE(const struct fb_info *info)
return minor(current->tty->device) - 1; 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 * set_all_vcs - set all virtual consoles to match
...@@ -300,11 +337,14 @@ int set_all_vcs(int fbidx, struct fb_ops *fb, struct fb_var_screeninfo *var, ...@@ -300,11 +337,14 @@ int set_all_vcs(int fbidx, struct fb_ops *fb, struct fb_var_screeninfo *var,
var->activate |= FB_ACTIVATE_TEST; var->activate |= FB_ACTIVATE_TEST;
err = fb->fb_set_var(var, PROC_CONSOLE(info), info); err = fb->fb_set_var(var, PROC_CONSOLE(info), info);
var->activate &= ~FB_ACTIVATE_TEST; var->activate &= ~FB_ACTIVATE_TEST;
gen_set_disp(PROC_CONSOLE(info), info);
if (err) if (err)
return err; return err;
for (unit = 0; unit < MAX_NR_CONSOLES; unit++) for (unit = 0; unit < MAX_NR_CONSOLES; unit++)
if (fb_display[unit].conp && con2fb_map[unit] == fbidx) if (fb_display[unit].conp && con2fb_map[unit] == fbidx) {
fb->fb_set_var(var, unit, info); fb->fb_set_var(var, unit, info);
gen_set_disp(unit, info);
}
return 0; return 0;
} }
...@@ -350,7 +390,7 @@ void set_con2fb_map(int unit, int newidx) ...@@ -350,7 +390,7 @@ void set_con2fb_map(int unit, int newidx)
fontheightlog = fb_display[unit]._fontheightlog; fontheightlog = fb_display[unit]._fontheightlog;
userfont = fb_display[unit].userfont; userfont = fb_display[unit].userfont;
con2fb_map[unit] = newidx; con2fb_map[unit] = newidx;
fb_display[unit] = *(newfb->disp);
fb_display[unit].conp = conp; fb_display[unit].conp = conp;
fb_display[unit].fontdata = fontdata; fb_display[unit].fontdata = fontdata;
fb_display[unit]._fontwidth = fontwidth; fb_display[unit]._fontwidth = fontwidth;
...@@ -359,15 +399,13 @@ void set_con2fb_map(int unit, int newidx) ...@@ -359,15 +399,13 @@ void set_con2fb_map(int unit, int newidx)
fb_display[unit]._fontheightlog = fontheightlog; fb_display[unit]._fontheightlog = fontheightlog;
fb_display[unit].userfont = userfont; fb_display[unit].userfont = userfont;
fb_display[unit].fb_info = newfb; fb_display[unit].fb_info = newfb;
gen_set_disp(unit, newfb);
if (conp) if (conp)
conp->vc_display_fg = &newfb->display_fg; conp->vc_display_fg = &newfb->display_fg;
if (!newfb->display_fg) if (!newfb->display_fg)
newfb->display_fg = conp; newfb->display_fg = conp;
if (!newfb->changevar)
newfb->changevar = oldfb->changevar;
/* tell console var has changed */ /* tell console var has changed */
if (newfb->changevar) fbcon_changevar(unit);
newfb->changevar(unit);
} }
} }
...@@ -474,21 +512,15 @@ static void fbcon_init(struct vc_data *conp, int init) ...@@ -474,21 +512,15 @@ static void fbcon_init(struct vc_data *conp, int init)
/* on which frame buffer will we open this console? */ /* on which frame buffer will we open this console? */
info = registered_fb[(int)con2fb_map[unit]]; info = registered_fb[(int)con2fb_map[unit]];
info->changevar = &fbcon_changevar; gen_set_disp(unit, info);
fb_display[unit] = *(info->disp); /* copy from default */
DPRINTK("mode: %s\n",info->modename); 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, DPRINTK("res: %dx%d-%d\n",fb_display[unit].var.xres,
fb_display[unit].var.yres, fb_display[unit].var.yres,
fb_display[unit].var.bits_per_pixel); fb_display[unit].var.bits_per_pixel);
fb_display[unit].conp = conp; fb_display[unit].conp = conp;
fb_display[unit].fb_info = info; fb_display[unit].fb_info = info;
/* clear out the cmap so we don't have dangling pointers */ /* 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); fbcon_setup(unit, init, !init);
/* Must be done after fbcon_setup to prevent excess updates */ /* Must be done after fbcon_setup to prevent excess updates */
conp->vc_display_fg = &info->display_fg; conp->vc_display_fg = &info->display_fg;
...@@ -527,7 +559,7 @@ static __inline__ void updatescrollmode(struct display *p) ...@@ -527,7 +559,7 @@ static __inline__ void updatescrollmode(struct display *p)
divides(fontheight(p), info->var.yres_virtual)) divides(fontheight(p), info->var.yres_virtual))
m = __SCROLL_YWRAP; m = __SCROLL_YWRAP;
else if (divides(info->fix.ypanstep, fontheight(p)) && 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; m = __SCROLL_YPAN;
else if (p->scrollmode & __SCROLL_YNOMOVE) else if (p->scrollmode & __SCROLL_YNOMOVE)
m = __SCROLL_YREDRAW; m = __SCROLL_YREDRAW;
...@@ -567,7 +599,7 @@ static void fbcon_setup(int con, int init, int logo) ...@@ -567,7 +599,7 @@ static void fbcon_setup(int con, int init, int logo)
info->fix.type == FB_TYPE_TEXT) info->fix.type == FB_TYPE_TEXT)
logo = 0; 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 (con == fg_console && info->fix.type != FB_TYPE_TEXT) {
if (fbcon_softback_size) { if (fbcon_softback_size) {
...@@ -591,7 +623,7 @@ static void fbcon_setup(int con, int init, int logo) ...@@ -591,7 +623,7 @@ static void fbcon_setup(int con, int init, int logo)
} }
for (i = 0; i < MAX_NR_CONSOLES; i++) 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) fb_display[i].conp && fb_display[i].fontdata)
break; break;
...@@ -617,9 +649,9 @@ static void fbcon_setup(int con, int init, int logo) ...@@ -617,9 +649,9 @@ static void fbcon_setup(int con, int init, int logo)
} }
if (!p->fontdata) { if (!p->fontdata) {
if (!p->fb_info->fontname[0] || if (!info->fontname[0] ||
!(font = fbcon_find_font(p->fb_info->fontname))) !(font = fbcon_find_font(info->fontname)))
font = fbcon_get_default_font(p->var.xres, p->var.yres); font = fbcon_get_default_font(info->var.xres, info->var.yres);
p->_fontwidth = font->width; p->_fontwidth = font->width;
p->_fontheight = font->height; p->_fontheight = font->height;
p->fontdata = font->data; p->fontdata = font->data;
...@@ -627,17 +659,9 @@ static void fbcon_setup(int con, int init, int logo) ...@@ -627,17 +659,9 @@ static void fbcon_setup(int con, int init, int logo)
} }
if (!fontwidthvalid(p,fontwidth(p))) { if (!fontwidthvalid(p,fontwidth(p))) {
#ifdef CONFIG_FBCON_MAC /* ++Geert: changed from panic() to `correct and continue' */
if (MACH_IS_MAC) printk(KERN_ERR "fbcon_setup: No support for fontwidth %d\n", fontwidth(p));
/* ++Geert: hack to make 6x11 fonts work on mac */ p->dispsw = &fbcon_dummy;
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;
}
} }
if (p->dispsw->set_font) if (p->dispsw->set_font)
p->dispsw->set_font(p, fontwidth(p), fontheight(p)); p->dispsw->set_font(p, fontwidth(p), fontheight(p));
...@@ -646,8 +670,8 @@ static void fbcon_setup(int con, int init, int logo) ...@@ -646,8 +670,8 @@ static void fbcon_setup(int con, int init, int logo)
old_cols = conp->vc_cols; old_cols = conp->vc_cols;
old_rows = conp->vc_rows; old_rows = conp->vc_rows;
nr_cols = p->var.xres/fontwidth(p); nr_cols = info->var.xres/fontwidth(p);
nr_rows = p->var.yres/fontheight(p); nr_rows = info->var.yres/fontheight(p);
if (logo) { if (logo) {
/* Need to make room for the logo */ /* Need to make room for the logo */
...@@ -697,11 +721,11 @@ static void fbcon_setup(int con, int init, int logo) ...@@ -697,11 +721,11 @@ static void fbcon_setup(int con, int init, int logo)
conp->vc_cols = nr_cols; conp->vc_cols = nr_cols;
conp->vc_rows = nr_rows; conp->vc_rows = nr_rows;
} }
p->vrows = p->var.yres_virtual/fontheight(p); p->vrows = info->var.yres_virtual/fontheight(p);
if ((p->var.yres % fontheight(p)) && if ((info->var.yres % fontheight(p)) &&
(p->var.yres_virtual % fontheight(p) < p->var.yres % fontheight(p))) (info->var.yres_virtual % fontheight(p) < info->var.yres % fontheight(p)))
p->vrows--; 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; conp->vc_complement_mask = conp->vc_can_do_color ? 0x7700 : 0x0800;
if (charcnt == 256) { if (charcnt == 256) {
conp->vc_hi_font_mask = 0; conp->vc_hi_font_mask = 0;
...@@ -720,10 +744,10 @@ static void fbcon_setup(int con, int init, int logo) ...@@ -720,10 +744,10 @@ static void fbcon_setup(int con, int init, int logo)
if (p->dispsw == &fbcon_dummy) if (p->dispsw == &fbcon_dummy)
printk(KERN_WARNING "fbcon_setup: type %d (aux %d, depth %d) not " printk(KERN_WARNING "fbcon_setup: type %d (aux %d, depth %d) not "
"supported\n", info->fix.type, info->fix.type_aux, "supported\n", info->fix.type, info->fix.type_aux,
p->var.bits_per_pixel); info->var.bits_per_pixel);
p->dispsw->setup(p); 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; p->bgcol = 0;
if (!init) { if (!init) {
...@@ -743,11 +767,16 @@ static void fbcon_setup(int con, int init, int logo) ...@@ -743,11 +767,16 @@ static void fbcon_setup(int con, int init, int logo)
kfree(save); kfree(save);
} }
} }
if (logo) { if (logo) {
logo_shown = -2; if (logo_lines > conp->vc_bottom) {
conp->vc_top = logo_lines; 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) { if (con == fg_console && softback_buf) {
int l = fbcon_softback_size / conp->vc_size_row; int l = fbcon_softback_size / conp->vc_size_row;
...@@ -954,50 +983,54 @@ static int scrollback_current = 0; ...@@ -954,50 +983,54 @@ static int scrollback_current = 0;
static __inline__ void ywrap_up(int unit, struct vc_data *conp, static __inline__ void ywrap_up(int unit, struct vc_data *conp,
struct display *p, int count) struct display *p, int count)
{ {
struct fb_info *info = p->fb_info;
p->yscroll += count; p->yscroll += count;
if (p->yscroll >= p->vrows) /* Deal with wrap */ if (p->yscroll >= p->vrows) /* Deal with wrap */
p->yscroll -= p->vrows; p->yscroll -= p->vrows;
p->var.xoffset = 0; info->var.xoffset = 0;
p->var.yoffset = p->yscroll*fontheight(p); info->var.yoffset = p->yscroll*fontheight(p);
p->var.vmode |= FB_VMODE_YWRAP; info->var.vmode |= FB_VMODE_YWRAP;
p->fb_info->updatevar(unit, p->fb_info); info->updatevar(unit, info);
scrollback_max += count; scrollback_max += count;
if (scrollback_max > scrollback_phys_max) if (scrollback_max > scrollback_phys_max)
scrollback_max = scrollback_phys_max; scrollback_max = scrollback_phys_max;
scrollback_current = 0; scrollback_current = 0;
} }
static __inline__ void ywrap_down(int unit, struct vc_data *conp, static __inline__ void ywrap_down(int unit, struct vc_data *conp,
struct display *p, int count) struct display *p, int count)
{ {
struct fb_info *info = p->fb_info;
p->yscroll -= count; p->yscroll -= count;
if (p->yscroll < 0) /* Deal with wrap */ if (p->yscroll < 0) /* Deal with wrap */
p->yscroll += p->vrows; p->yscroll += p->vrows;
p->var.xoffset = 0; info->var.xoffset = 0;
p->var.yoffset = p->yscroll*fontheight(p); info->var.yoffset = p->yscroll*fontheight(p);
p->var.vmode |= FB_VMODE_YWRAP; info->var.vmode |= FB_VMODE_YWRAP;
p->fb_info->updatevar(unit, p->fb_info); info->updatevar(unit, info);
scrollback_max -= count; scrollback_max -= count;
if (scrollback_max < 0) if (scrollback_max < 0)
scrollback_max = 0; scrollback_max = 0;
scrollback_current = 0; scrollback_current = 0;
} }
static __inline__ void ypan_up(int unit, struct vc_data *conp, static __inline__ void ypan_up(int unit, struct vc_data *conp,
struct display *p, int count) struct display *p, int count)
{ {
struct fb_info *info = p->fb_info;
p->yscroll += count; p->yscroll += count;
if (p->yscroll > p->vrows-conp->vc_rows) { if (p->yscroll > p->vrows-conp->vc_rows) {
p->dispsw->bmove(p, p->vrows-conp->vc_rows, 0, 0, 0, p->dispsw->bmove(p, p->vrows-conp->vc_rows, 0, 0, 0,
conp->vc_rows, conp->vc_cols); conp->vc_rows, conp->vc_cols);
p->yscroll -= p->vrows-conp->vc_rows; p->yscroll -= p->vrows-conp->vc_rows;
} }
p->var.xoffset = 0; info->var.xoffset = 0;
p->var.yoffset = p->yscroll*fontheight(p); info->var.yoffset = p->yscroll*fontheight(p);
p->var.vmode &= ~FB_VMODE_YWRAP; info->var.vmode &= ~FB_VMODE_YWRAP;
p->fb_info->updatevar(unit, p->fb_info); info->updatevar(unit, info);
if (p->dispsw->clear_margins) if (p->dispsw->clear_margins)
p->dispsw->clear_margins(conp, p, 1); p->dispsw->clear_margins(conp, p, 1);
scrollback_max += count; scrollback_max += count;
...@@ -1010,16 +1043,18 @@ static __inline__ void ypan_up(int unit, struct vc_data *conp, ...@@ -1010,16 +1043,18 @@ static __inline__ void ypan_up(int unit, struct vc_data *conp,
static __inline__ void ypan_down(int unit, struct vc_data *conp, static __inline__ void ypan_down(int unit, struct vc_data *conp,
struct display *p, int count) struct display *p, int count)
{ {
struct fb_info *info = p->fb_info;
p->yscroll -= count; p->yscroll -= count;
if (p->yscroll < 0) { if (p->yscroll < 0) {
p->dispsw->bmove(p, 0, 0, p->vrows-conp->vc_rows, 0, p->dispsw->bmove(p, 0, 0, p->vrows-conp->vc_rows, 0,
conp->vc_rows, conp->vc_cols); conp->vc_rows, conp->vc_cols);
p->yscroll += p->vrows-conp->vc_rows; p->yscroll += p->vrows-conp->vc_rows;
} }
p->var.xoffset = 0; info->var.xoffset = 0;
p->var.yoffset = p->yscroll*fontheight(p); info->var.yoffset = p->yscroll*fontheight(p);
p->var.vmode &= ~FB_VMODE_YWRAP; info->var.vmode &= ~FB_VMODE_YWRAP;
p->fb_info->updatevar(unit, p->fb_info); info->updatevar(unit, info);
if (p->dispsw->clear_margins) if (p->dispsw->clear_margins)
p->dispsw->clear_margins(conp, p, 1); p->dispsw->clear_margins(conp, p, 1);
scrollback_max -= count; scrollback_max -= count;
...@@ -1522,7 +1557,8 @@ static int fbcon_switch(struct vc_data *conp) ...@@ -1522,7 +1557,8 @@ static int fbcon_switch(struct vc_data *conp)
conp2->vc_top = 0; conp2->vc_top = 0;
logo_shown = -1; logo_shown = -1;
} }
p->var.yoffset = p->yscroll = 0; if (info)
info->var.yoffset = p->yscroll = 0;
switch (p->scrollmode & __SCROLL_YMASK) { switch (p->scrollmode & __SCROLL_YMASK) {
case __SCROLL_YWRAP: case __SCROLL_YWRAP:
scrollback_phys_max = p->vrows-conp->vc_rows; scrollback_phys_max = p->vrows-conp->vc_rows;
...@@ -1539,8 +1575,6 @@ static int fbcon_switch(struct vc_data *conp) ...@@ -1539,8 +1575,6 @@ static int fbcon_switch(struct vc_data *conp)
scrollback_max = 0; scrollback_max = 0;
scrollback_current = 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) if (p->dispsw->clear_margins && vt_cons[unit]->vc_mode == KD_TEXT)
p->dispsw->clear_margins(conp, p, 0); p->dispsw->clear_margins(conp, p, 0);
if (logo_shown == -2) { if (logo_shown == -2) {
...@@ -1570,8 +1604,8 @@ static int fbcon_blank(struct vc_data *conp, int blank) ...@@ -1570,8 +1604,8 @@ static int fbcon_blank(struct vc_data *conp, int blank)
if (info->fix.visual == FB_VISUAL_MONO01) { if (info->fix.visual == FB_VISUAL_MONO01) {
if (info->screen_base) if (info->screen_base)
fb_memset255(info->screen_base, fb_memset255(info->screen_base,
p->var.xres_virtual*p->var.yres_virtual* info->var.xres_virtual*info->var.yres_virtual*
p->var.bits_per_pixel>>3); info->var.bits_per_pixel>>3);
} else { } else {
unsigned short oldc; unsigned short oldc;
u_int height; u_int height;
...@@ -1668,6 +1702,7 @@ static inline int fbcon_get_font(int unit, struct console_font_op *op) ...@@ -1668,6 +1702,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) static int fbcon_do_set_font(int unit, struct console_font_op *op, u8 *data, int userfont)
{ {
struct display *p = &fb_display[unit]; struct display *p = &fb_display[unit];
struct fb_info *info = p->fb_info;
int resize; int resize;
int w = op->width; int w = op->width;
int h = op->height; int h = op->height;
...@@ -1755,12 +1790,12 @@ static int fbcon_do_set_font(int unit, struct console_font_op *op, u8 *data, int ...@@ -1755,12 +1790,12 @@ static int fbcon_do_set_font(int unit, struct console_font_op *op, u8 *data, int
if (resize) { if (resize) {
struct vc_data *conp = p->conp; struct vc_data *conp = p->conp;
/* reset wrap/pan */ /* reset wrap/pan */
p->var.xoffset = p->var.yoffset = p->yscroll = 0; info->var.xoffset = info->var.yoffset = p->yscroll = 0;
p->vrows = p->var.yres_virtual/h; p->vrows = info->var.yres_virtual/h;
if ((p->var.yres % h) && (p->var.yres_virtual % h < p->var.yres % h)) if ((info->var.yres % h) && (info->var.yres_virtual % h < info->var.yres % h))
p->vrows--; p->vrows--;
updatescrollmode(p); 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) { if (CON_IS_VISIBLE(conp) && softback_buf) {
int l = fbcon_softback_size / conp->vc_size_row; int l = fbcon_softback_size / conp->vc_size_row;
if (l > 5) if (l > 5)
...@@ -1892,9 +1927,10 @@ static inline int fbcon_set_def_font(int unit, struct console_font_op *op) ...@@ -1892,9 +1927,10 @@ static inline int fbcon_set_def_font(int unit, struct console_font_op *op)
char name[MAX_FONT_NAME]; char name[MAX_FONT_NAME];
struct fbcon_font_desc *f; struct fbcon_font_desc *f;
struct display *p = &fb_display[unit]; struct display *p = &fb_display[unit];
struct fb_info *info = p->fb_info;
if (!op->data) 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) else if (strncpy_from_user(name, op->data, MAX_FONT_NAME-1) < 0)
return -EFAULT; return -EFAULT;
else { else {
...@@ -1937,6 +1973,7 @@ static int fbcon_set_palette(struct vc_data *conp, unsigned char *table) ...@@ -1937,6 +1973,7 @@ static int fbcon_set_palette(struct vc_data *conp, unsigned char *table)
{ {
int unit = conp->vc_num; int unit = conp->vc_num;
struct display *p = &fb_display[unit]; struct display *p = &fb_display[unit];
struct fb_info *info = p->fb_info;
int i, j, k; int i, j, k;
u8 val; u8 val;
...@@ -1951,12 +1988,12 @@ static int fbcon_set_palette(struct vc_data *conp, unsigned char *table) ...@@ -1951,12 +1988,12 @@ static int fbcon_set_palette(struct vc_data *conp, unsigned char *table)
val = conp->vc_palette[j++]; val = conp->vc_palette[j++];
palette_blue[k] = (val<<8)|val; palette_blue[k] = (val<<8)|val;
} }
if (p->var.bits_per_pixel <= 4) if (info->var.bits_per_pixel <= 4)
palette_cmap.len = 1<<p->var.bits_per_pixel; palette_cmap.len = 1 << info->var.bits_per_pixel;
else else
palette_cmap.len = 16; palette_cmap.len = 16;
palette_cmap.start = 0; 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) static u16 *fbcon_screen_pos(struct vc_data *conp, int offset)
...@@ -2033,10 +2070,13 @@ static void fbcon_invert_region(struct vc_data *conp, u16 *p, int cnt) ...@@ -2033,10 +2070,13 @@ static void fbcon_invert_region(struct vc_data *conp, u16 *p, int cnt)
static int fbcon_scrolldelta(struct vc_data *conp, int lines) static int fbcon_scrolldelta(struct vc_data *conp, int lines)
{ {
int unit, offset, limit, scrollback_old; int unit, offset, limit, scrollback_old;
struct fb_info *info;
struct display *p; struct display *p;
unit = fg_console; unit = fg_console;
p = &fb_display[unit]; p = &fb_display[unit];
info = p->fb_info;
if (softback_top) { if (softback_top) {
if (conp->vc_num != unit) if (conp->vc_num != unit)
return 0; return 0;
...@@ -2092,20 +2132,20 @@ static int fbcon_scrolldelta(struct vc_data *conp, int lines) ...@@ -2092,20 +2132,20 @@ static int fbcon_scrolldelta(struct vc_data *conp, int lines)
limit = p->vrows; limit = p->vrows;
switch (p->scrollmode && __SCROLL_YMASK) { switch (p->scrollmode && __SCROLL_YMASK) {
case __SCROLL_YWRAP: case __SCROLL_YWRAP:
p->var.vmode |= FB_VMODE_YWRAP; info->var.vmode |= FB_VMODE_YWRAP;
break; break;
case __SCROLL_YPAN: case __SCROLL_YPAN:
limit -= conp->vc_rows; limit -= conp->vc_rows;
p->var.vmode &= ~FB_VMODE_YWRAP; info->var.vmode &= ~FB_VMODE_YWRAP;
break; break;
} }
if (offset < 0) if (offset < 0)
offset += limit; offset += limit;
else if (offset >= limit) else if (offset >= limit)
offset -= limit; offset -= limit;
p->var.xoffset = 0; info->var.xoffset = 0;
p->var.yoffset = offset*fontheight(p); info->var.yoffset = offset*fontheight(p);
p->fb_info->updatevar(unit, p->fb_info); info->updatevar(unit, info);
if (!scrollback_current) if (!scrollback_current)
fbcon_cursor(conp, CM_DRAW); fbcon_cursor(conp, CM_DRAW);
return 0; return 0;
...@@ -2127,7 +2167,11 @@ static int __init fbcon_show_logo( void ) ...@@ -2127,7 +2167,11 @@ static int __init fbcon_show_logo( void )
{ {
struct display *p = &fb_display[fg_console]; /* draw to vt in foreground */ struct display *p = &fb_display[fg_console]; /* draw to vt in foreground */
struct fb_info *info = p->fb_info; 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; int line = p->next_line;
unsigned char *fb = info->screen_base; unsigned char *fb = info->screen_base;
unsigned char *logo; unsigned char *logo;
...@@ -2162,7 +2206,7 @@ static int __init fbcon_show_logo( void ) ...@@ -2162,7 +2206,7 @@ static int __init fbcon_show_logo( void )
palette_cmap.blue[j] = (linux_logo_blue[i+j] << 8) | palette_cmap.blue[j] = (linux_logo_blue[i+j] << 8) |
linux_logo_blue[i+j]; 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) { if (depth >= 8) {
...@@ -2177,13 +2221,54 @@ static int __init fbcon_show_logo( void ) ...@@ -2177,13 +2221,54 @@ static int __init fbcon_show_logo( void )
logo = linux_logo_bw; logo = linux_logo_bw;
logo_depth = 1; 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) if (info->fbops->fb_rasterimg)
info->fbops->fb_rasterimg(info, 1); info->fbops->fb_rasterimg(info, 1);
for (x = 0; x < num_online_cpus() * (LOGO_W + 8) && for (x = 0; x < num_online_cpus() * (LOGO_W + 8) &&
x < p->var.xres - (LOGO_W + 8); x += (LOGO_W + 8)) { 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;
#else
#if defined(CONFIG_FBCON_CFB16) || defined(CONFIG_FBCON_CFB24) || \ #if defined(CONFIG_FBCON_CFB16) || defined(CONFIG_FBCON_CFB24) || \
defined(CONFIG_FBCON_CFB32) || defined(CONFIG_FB_SBUS) defined(CONFIG_FBCON_CFB32) || defined(CONFIG_FB_SBUS)
if (info->fix.visual == FB_VISUAL_DIRECTCOLOR) { if (info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
...@@ -2192,9 +2277,9 @@ static int __init fbcon_show_logo( void ) ...@@ -2192,9 +2277,9 @@ static int __init fbcon_show_logo( void )
int redshift, greenshift, blueshift; int redshift, greenshift, blueshift;
/* Bug: Doesn't obey msb_right ... (who needs that?) */ /* Bug: Doesn't obey msb_right ... (who needs that?) */
redshift = p->var.red.offset; redshift = info->var.red.offset;
greenshift = p->var.green.offset; greenshift = info->var.green.offset;
blueshift = p->var.blue.offset; blueshift = info->var.blue.offset;
if (depth >= 24 && (depth % 8) == 0) { if (depth >= 24 && (depth % 8) == 0) {
/* have at least 8 bits per color */ /* have at least 8 bits per color */
...@@ -2270,12 +2355,12 @@ static int __init fbcon_show_logo( void ) ...@@ -2270,12 +2355,12 @@ static int __init fbcon_show_logo( void )
int redshift, greenshift, blueshift; int redshift, greenshift, blueshift;
/* Bug: Doesn't obey msb_right ... (who needs that?) */ /* Bug: Doesn't obey msb_right ... (who needs that?) */
redmask = mask[p->var.red.length < 8 ? p->var.red.length : 8]; redmask = mask[info->var.red.length < 8 ? info->var.red.length : 8];
greenmask = mask[p->var.green.length < 8 ? p->var.green.length : 8]; greenmask = mask[info->var.green.length < 8 ? info->var.green.length : 8];
bluemask = mask[p->var.blue.length < 8 ? p->var.blue.length : 8]; bluemask = mask[info->var.blue.length < 8 ? info->var.blue.length : 8];
redshift = p->var.red.offset - (8-p->var.red.length); redshift = info->var.red.offset - (8 - info->var.red.length);
greenshift = p->var.green.offset - (8-p->var.green.length); greenshift = info->var.green.offset - (8 - info->var.green.length);
blueshift = p->var.blue.offset - (8-p->var.blue.length); blueshift = info->var.blue.offset - (8 - info->var.blue.length);
src = logo; src = logo;
for( y1 = 0; y1 < LOGO_H; y1++ ) { for( y1 = 0; y1 < LOGO_H; y1++ ) {
...@@ -2396,7 +2481,7 @@ static int __init fbcon_show_logo( void ) ...@@ -2396,7 +2481,7 @@ static int __init fbcon_show_logo( void )
unsigned char inverse = p->inverse || info->fix.visual == FB_VISUAL_MONO01 unsigned char inverse = p->inverse || info->fix.visual == FB_VISUAL_MONO01
? 0x00 : 0xff; ? 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 */ /* can't use simply memcpy because need to apply inverse */
for( y1 = 0; y1 < LOGO_H; y1++ ) { for( y1 = 0; y1 < LOGO_H; y1++ ) {
src = logo + y1*LOGO_LINE; src = logo + y1*LOGO_LINE;
...@@ -2440,12 +2525,19 @@ static int __init fbcon_show_logo( void ) ...@@ -2440,12 +2525,19 @@ static int __init fbcon_show_logo( void )
} }
done = 1; done = 1;
} }
#endif #endif
#endif /* CONFIG_FBCON_ACCEL */
} }
if (p->fb_info->fbops->fb_rasterimg) if (info->fbops->fb_rasterimg)
p->fb_info->fbops->fb_rasterimg(p->fb_info, 0); 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 /* Modes not yet supported: packed pixels with depth != 8 (does such a
* thing exist in reality?) */ * thing exist in reality?) */
......
...@@ -21,14 +21,6 @@ ...@@ -21,14 +21,6 @@
#include <asm/io.h> #include <asm/io.h>
#include <video/fbcon.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 gen_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info)
{ {
...@@ -52,49 +44,13 @@ int gen_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) ...@@ -52,49 +44,13 @@ int gen_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info)
if (info->fbops->fb_pan_display) if (info->fbops->fb_pan_display)
info->fbops->fb_pan_display(&info->var, con, info); info->fbops->fb_pan_display(&info->var, con, info);
gen_set_disp(con, info);
fb_set_cmap(&info->cmap, 1, info); fb_set_cmap(&info->cmap, 1, info);
} }
if (info->changevar)
info->changevar(con);
} }
} }
return 0; 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, int fbgen_pan_display(struct fb_var_screeninfo *var, int con,
struct fb_info *info) struct fb_info *info)
{ {
...@@ -125,75 +81,11 @@ int fbgen_pan_display(struct fb_var_screeninfo *var, int con, ...@@ -125,75 +81,11 @@ int fbgen_pan_display(struct fb_var_screeninfo *var, int con,
/* ---- Helper functions --------------------------------------------------- */ /* ---- 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) int gen_update_var(int con, struct fb_info *info)
{ {
struct display *disp = (con < 0) ? info->disp : (fb_display + con);
int err; int err;
if (con == info->currcon) { 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 (info->fbops->fb_pan_display) {
if ((err = info->fbops->fb_pan_display(&info->var, con, info))) if ((err = info->fbops->fb_pan_display(&info->var, con, info)))
return err; return err;
...@@ -202,46 +94,6 @@ int gen_update_var(int con, struct fb_info *info) ...@@ -202,46 +94,6 @@ int gen_update_var(int con, struct fb_info *info)
return 0; 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 * fbgen_blank - blank the screen
* @blank: boolean, 0 unblank, 1 blank * @blank: boolean, 0 unblank, 1 blank
...@@ -267,20 +119,22 @@ int fbgen_blank(int blank, struct fb_info *info) ...@@ -267,20 +119,22 @@ int fbgen_blank(int blank, struct fb_info *info)
cmap.start = 0; cmap.start = 0;
cmap.len = 16; cmap.len = 16;
fb_set_cmap(&cmap, 1, info); fb_set_cmap(&cmap, 1, info);
} else } else {
do_install_cmap(info->currcon, info); 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; return 0;
} }
/* generic frame buffer operations */ /* generic frame buffer operations */
EXPORT_SYMBOL(gen_set_var); EXPORT_SYMBOL(gen_set_var);
EXPORT_SYMBOL(gen_get_cmap);
EXPORT_SYMBOL(gen_set_cmap);
EXPORT_SYMBOL(fbgen_pan_display); EXPORT_SYMBOL(fbgen_pan_display);
/* helper functions */ /* helper functions */
EXPORT_SYMBOL(do_install_cmap);
EXPORT_SYMBOL(gen_update_var); EXPORT_SYMBOL(gen_update_var);
EXPORT_SYMBOL(gen_switch);
EXPORT_SYMBOL(fbgen_blank); EXPORT_SYMBOL(fbgen_blank);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -481,11 +481,14 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -481,11 +481,14 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
case FBIOPUT_VSCREENINFO: case FBIOPUT_VSCREENINFO:
if (copy_from_user(&var, (void *) arg, sizeof(var))) if (copy_from_user(&var, (void *) arg, sizeof(var)))
return -EFAULT; return -EFAULT;
i = var.activate & FB_ACTIVATE_ALL if (var.activate & FB_ACTIVATE_ALL) {
? set_all_vcs(fbidx, fb, &var, info) i = set_all_vcs(fbidx, fb, &var, info);
: fb->fb_set_var(&var, PROC_CONSOLE(info), info); if (i) return i;
if (i) } else {
return i; i = fb->fb_set_var(&var, PROC_CONSOLE(info), info);
if (i) return i;
gen_set_disp(PROC_CONSOLE(info), info);
}
if (copy_to_user((void *) arg, &var, sizeof(var))) if (copy_to_user((void *) arg, &var, sizeof(var)))
return -EFAULT; return -EFAULT;
return 0; return 0;
...@@ -494,11 +497,11 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -494,11 +497,11 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
case FBIOPUTCMAP: case FBIOPUTCMAP:
if (copy_from_user(&cmap, (void *) arg, sizeof(cmap))) if (copy_from_user(&cmap, (void *) arg, sizeof(cmap)))
return -EFAULT; return -EFAULT;
return (fb->fb_set_cmap(&cmap, 0, PROC_CONSOLE(info), info)); return (fb_set_cmap(&cmap, 0, info));
case FBIOGETCMAP: case FBIOGETCMAP:
if (copy_from_user(&cmap, (void *) arg, sizeof(cmap))) if (copy_from_user(&cmap, (void *) arg, sizeof(cmap)))
return -EFAULT; return -EFAULT;
return (fb->fb_get_cmap(&cmap, 0, PROC_CONSOLE(info), info)); fb_copy_cmap(&info->cmap, &cmap, 0);
case FBIOPAN_DISPLAY: case FBIOPAN_DISPLAY:
if (copy_from_user(&var, (void *) arg, sizeof(var))) if (copy_from_user(&var, (void *) arg, sizeof(var)))
return -EFAULT; return -EFAULT;
...@@ -746,6 +749,7 @@ register_framebuffer(struct fb_info *fb_info) ...@@ -746,6 +749,7 @@ register_framebuffer(struct fb_info *fb_info)
if (!registered_fb[i]) if (!registered_fb[i])
break; break;
fb_info->node = mk_kdev(FB_MAJOR, i); fb_info->node = mk_kdev(FB_MAJOR, i);
fb_info->currcon = -1;
registered_fb[i] = fb_info; registered_fb[i] = fb_info;
if (!fb_ever_opened[i]) { if (!fb_ever_opened[i]) {
struct module *owner = fb_info->fbops->owner; struct module *owner = fb_info->fbops->owner;
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
#include <linux/zorro.h> #include <linux/zorro.h>
#include <asm/io.h> #include <asm/io.h>
#include <video/fbcon.h>
/* /*
* Some technical notes: * Some technical notes:
* *
...@@ -133,7 +131,6 @@ static volatile unsigned char *fm2fb_reg; ...@@ -133,7 +131,6 @@ static volatile unsigned char *fm2fb_reg;
static struct fb_info fb_info; static struct fb_info fb_info;
static u32 pseudo_palette[17]; static u32 pseudo_palette[17];
static struct display display;
static struct fb_fix_screeninfo fb_fix __initdata = { static struct fb_fix_screeninfo fb_fix __initdata = {
.smem_len = FRAMEMASTER_REG, .smem_len = FRAMEMASTER_REG,
...@@ -177,8 +174,6 @@ static int fm2fb_blank(int blank, struct fb_info *info); ...@@ -177,8 +174,6 @@ static int fm2fb_blank(int blank, struct fb_info *info);
static struct fb_ops fm2fb_ops = { static struct fb_ops fm2fb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_set_var = gen_set_var, .fb_set_var = gen_set_var,
.fb_get_cmap = gen_get_cmap,
.fb_set_cmap = gen_set_cmap,
.fb_setcolreg = fm2fb_setcolreg, .fb_setcolreg = fm2fb_setcolreg,
.fb_blank = fm2fb_blank, .fb_blank = fm2fb_blank,
.fb_fillrect = cfb_fillrect, .fb_fillrect = cfb_fillrect,
...@@ -264,7 +259,6 @@ int __init fm2fb_init(void) ...@@ -264,7 +259,6 @@ int __init fm2fb_init(void)
if (fm2fb_mode == -1) if (fm2fb_mode == -1)
fm2fb_mode = FM2FB_MODE_PAL; fm2fb_mode = FM2FB_MODE_PAL;
strcpy(fb_info.modename, fb_fix.id);
fb_info.node = NODEV; fb_info.node = NODEV;
fb_info.fbops = &fm2fb_ops; fb_info.fbops = &fm2fb_ops;
fb_info.var = fb_var_modes[fm2fb_mode]; fb_info.var = fb_var_modes[fm2fb_mode];
...@@ -274,15 +268,8 @@ int __init fm2fb_init(void) ...@@ -274,15 +268,8 @@ int __init fm2fb_init(void)
fb_info.flags = FBINFO_FLAG_DEFAULT; fb_info.flags = FBINFO_FLAG_DEFAULT;
/* The below feilds will go away !!!! */ /* 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); fb_alloc_cmap(&fb_info.cmap, 16, 0);
gen_set_disp(-1, &fb_info);
if (register_framebuffer(&fb_info) < 0) if (register_framebuffer(&fb_info) < 0)
return -EINVAL; return -EINVAL;
......
...@@ -74,7 +74,6 @@ ...@@ -74,7 +74,6 @@
#define MON_ID_REG 0xe4100000 /* unused */ #define MON_ID_REG 0xe4100000 /* unused */
#define RESET_REG 0xe4180000 /* Write only */ #define RESET_REG 0xe4180000 /* Write only */
static struct display disp;
static struct fb_info fb_info; static struct fb_info fb_info;
static struct fb_fix_screeninfo fb_fix __initdata = { static struct fb_fix_screeninfo fb_fix __initdata = {
...@@ -119,8 +118,6 @@ static int g364fb_blank(int blank, struct fb_info *info); ...@@ -119,8 +118,6 @@ static int g364fb_blank(int blank, struct fb_info *info);
static struct fb_ops g364fb_ops = { static struct fb_ops g364fb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_set_var = gen_set_var, .fb_set_var = gen_set_var,
.fb_get_cmap = gen_get_cmap,
.fb_set_cmap = gen_set_cmap,
.fb_setcolreg = g364fb_setcolreg, .fb_setcolreg = g364fb_setcolreg,
.fb_pan_display = g364fb_pan_display, .fb_pan_display = g364fb_pan_display,
.fb_blank = g364fb_blank, .fb_blank = g364fb_blank,
...@@ -239,7 +236,6 @@ int __init g364fb_init(void) ...@@ -239,7 +236,6 @@ int __init g364fb_init(void)
fb_fix.smem_len = (1 << (mem * 2)) * 512 * 1024; fb_fix.smem_len = (1 << (mem * 2)) * 512 * 1024;
fb_var.yres_virtual = fb_fix.smem_len / fb_var.xres; fb_var.yres_virtual = fb_fix.smem_len / fb_var.xres;
strcpy(fb_info.modename, fb_fix.id);
fb_info.node = NODEV; fb_info.node = NODEV;
fb_info.fbops = &g364fb_ops; fb_info.fbops = &g364fb_ops;
fb_info.screen_base = (char *) G364_MEM_BASE; /* virtual kernel address */ fb_info.screen_base = (char *) G364_MEM_BASE; /* virtual kernel address */
...@@ -247,15 +243,8 @@ int __init g364fb_init(void) ...@@ -247,15 +243,8 @@ int __init g364fb_init(void)
fb_info.fix = fb_fix; fb_info.fix = fb_fix;
fb_info.flags = FBINFO_FLAG_DEFAULT; fb_info.flags = FBINFO_FLAG_DEFAULT;
fb_info.disp = &disp;
fb_info.currcon = -1;
fb_info.fontname[0] = '\0'; 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); fb_alloc_cmap(&fb_info.cmap, 255, 0);
gen_set_disp(-1, &fb_info);
if (register_framebuffer(&fb_info) < 0) if (register_framebuffer(&fb_info) < 0)
return -EINVAL; return -EINVAL;
......
...@@ -29,8 +29,6 @@ ...@@ -29,8 +29,6 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/hd64461.h> #include <asm/hd64461.h>
#include <video/fbcon.h>
static struct fb_var_screeninfo hitfb_var __initdata = { static struct fb_var_screeninfo hitfb_var __initdata = {
.activate = FB_ACTIVATE_NOW, .activate = FB_ACTIVATE_NOW,
.height = -1, .height = -1,
...@@ -46,7 +44,6 @@ static struct fb_fix_screeninfo hitfb_fix __initdata = { ...@@ -46,7 +44,6 @@ static struct fb_fix_screeninfo hitfb_fix __initdata = {
}; };
static u16 pseudo_palette[17]; static u16 pseudo_palette[17];
static struct display display;
struct fb_info fb_info; struct fb_info fb_info;
static int hitfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) static int hitfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
...@@ -126,8 +123,6 @@ static int hitfb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -126,8 +123,6 @@ static int hitfb_setcolreg(unsigned regno, unsigned red, unsigned green,
static struct fb_ops hitfb_ops = { static struct fb_ops hitfb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_set_var = gen_set_var, .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_check_var = hitfb_check_var,
.fb_set_par = hitfb_set_par, .fb_set_par = hitfb_set_par,
.fb_setcolreg = hitfb_setcolreg, .fb_setcolreg = hitfb_setcolreg,
...@@ -167,12 +162,6 @@ int __init hitfb_init(void) ...@@ -167,12 +162,6 @@ int __init hitfb_init(void)
fb_info.pseudo_palette = pseudo_palette; fb_info.pseudo_palette = pseudo_palette;
fb_info.flags = FBINFO_FLAG_DEFAULT; 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; fb_info.screen_base = (void *) hitfb_fix.smem_start;
size = (fb_info.var.bits_per_pixel == 8) ? 256 : 16; size = (fb_info.var.bits_per_pixel == 8) ? 256 : 16;
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#include <asm/blinken.h> #include <asm/blinken.h>
#include <asm/hwtest.h> #include <asm/hwtest.h>
#include <video/fbcon.h>
static struct fb_info fb_info; static struct fb_info fb_info;
unsigned long fb_regs; unsigned long fb_regs;
...@@ -67,8 +65,6 @@ static struct fb_var_screeninfo hpfb_defined = { ...@@ -67,8 +65,6 @@ static struct fb_var_screeninfo hpfb_defined = {
.vmode = FB_VMODE_NONINTERLACED, .vmode = FB_VMODE_NONINTERLACED,
}; };
static struct display display;
/* /*
* Set the palette. This may not work on all boards but only experimentation * Set the palette. This may not work on all boards but only experimentation
* will tell. * will tell.
...@@ -106,8 +102,6 @@ void hpfb_copyarea(struct fb_info *info, struct fb_copyarea *area) ...@@ -106,8 +102,6 @@ void hpfb_copyarea(struct fb_info *info, struct fb_copyarea *area)
static struct fb_ops hpfb_ops = { static struct fb_ops hpfb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_set_var = gen_set_var, .fb_set_var = gen_set_var,
.fb_get_cmap = gen_get_cmap,
.fb_set_cmap = gen_set_cmap,
.fb_setcolreg = hpfb_setcolreg, .fb_setcolreg = hpfb_setcolreg,
.fb_fillrect = cfb_fillrect, .fb_fillrect = cfb_fillrect,
.fb_copyarea = hpfb_copyarea, .fb_copyarea = hpfb_copyarea,
...@@ -164,16 +158,8 @@ int __init hpfb_init_one(unsigned long base) ...@@ -164,16 +158,8 @@ int __init hpfb_init_one(unsigned long base)
fb_info.fix = hpfb_fix; fb_info.fix = hpfb_fix;
fb_info.screen_base = (char *)hpfb_fix.smem_start; // FIXME 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); fb_alloc_cmap(&fb_info.cmap, 256, 0);
gen_set_disp(-1, &fb_info);
if (register_framebuffer(&fb_info) < 0) if (register_framebuffer(&fb_info) < 0)
return 1; return 1;
return 0; return 0;
......
...@@ -40,8 +40,6 @@ ...@@ -40,8 +40,6 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/machw.h> #include <asm/machw.h>
#include <video/fbcon.h>
/* Common DAC base address for the LC, RBV, Valkyrie, and IIvx */ /* Common DAC base address for the LC, RBV, Valkyrie, and IIvx */
#define DAC_BASE 0x50f24000 #define DAC_BASE 0x50f24000
...@@ -173,7 +171,6 @@ static struct fb_fix_screeninfo macfb_fix = { ...@@ -173,7 +171,6 @@ static struct fb_fix_screeninfo macfb_fix = {
.accel = FB_ACCEL_NONE, .accel = FB_ACCEL_NONE,
}; };
static struct display disp;
static struct fb_info fb_info; static struct fb_info fb_info;
static u32 pseudo_palette[17]; static u32 pseudo_palette[17];
static int inverse = 0; static int inverse = 0;
...@@ -589,8 +586,6 @@ static int macfb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -589,8 +586,6 @@ static int macfb_setcolreg(unsigned regno, unsigned red, unsigned green,
static struct fb_ops macfb_ops = { static struct fb_ops macfb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_set_var = gen_set_var, .fb_set_var = gen_set_var,
.fb_get_cmap = gen_get_cmap,
.fb_set_cmap = gen_set_cmap,
.fb_setcolreg = macfb_setcolreg, .fb_setcolreg = macfb_setcolreg,
.fb_fillrect = cfb_fillrect, .fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea, .fb_copyarea = cfb_copyarea,
...@@ -952,21 +947,16 @@ void __init macfb_init(void) ...@@ -952,21 +947,16 @@ void __init macfb_init(void)
break; break;
} }
strcpy(fb_info.modename, macfb_fix.id);
fb_info.changevar = NULL;
fb_info.node = NODEV; fb_info.node = NODEV;
fb_info.fbops = &macfb_ops; fb_info.fbops = &macfb_ops;
fb_info.var = macfb_defined; fb_info.var = macfb_defined;
fb_info.fix = macfb_fix; fb_info.fix = macfb_fix;
fb_info.currcon = -1; fb_info.currcon = -1;
fb_info.disp = &disp;
fb_info.switch_con = gen_switch;
fb_info.updatevar = gen_update_var; fb_info.updatevar = gen_update_var;
fb_info.pseudo_palette = pseudo_palette; fb_info.pseudo_palette = pseudo_palette;
fb_info.flags = FBINFO_FLAG_DEFAULT; fb_info.flags = FBINFO_FLAG_DEFAULT;
fb_alloc_cmap(&fb_info.cmap, video_cmap_len, 0); fb_alloc_cmap(&fb_info.cmap, video_cmap_len, 0);
gen_set_disp(-1, &fb_info);
if (register_framebuffer(&fb_info) < 0) if (register_framebuffer(&fb_info) < 0)
return; return;
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
static struct fb_info fb_info; static struct fb_info fb_info;
static struct display disp;
static struct fb_var_screeninfo maxinefb_defined = { static struct fb_var_screeninfo maxinefb_defined = {
.xres = 1024, .xres = 1024,
...@@ -113,8 +112,6 @@ static int maxinefb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -113,8 +112,6 @@ static int maxinefb_setcolreg(unsigned regno, unsigned red, unsigned green,
static struct fb_ops maxinefb_ops = { static struct fb_ops maxinefb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_set_var = gen_set_var, .fb_set_var = gen_set_var,
.fb_get_cmap = gen_get_cmap,
.fb_set_cmap = gen_set_cmap,
.fb_setcolreg = maxinefb_setcolreg, .fb_setcolreg = maxinefb_setcolreg,
.fb_fillrect = cfb_fillrect, .fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea, .fb_copyarea = cfb_copyarea,
...@@ -156,23 +153,16 @@ int __init maxinefb_init(void) ...@@ -156,23 +153,16 @@ 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.node = NODEV;
fb_info.fbops = &maxinefb_ops; fb_info.fbops = &maxinefb_ops;
fb_info.screen_base = (char *) maxinefb_fix.smem_start; fb_info.screen_base = (char *) maxinefb_fix.smem_start;
fb_info.var = maxinefb_defined; fb_info.var = maxinefb_defined;
fb_info.fix = maxinefb_fix; fb_info.fix = maxinefb_fix;
fb_info.disp = &disp;
fb_info.currcon = -1; fb_info.currcon = -1;
fb_info.switch_con = gen_switch;
fb_info.updatevar = gen_update_var; fb_info.updatevar = gen_update_var;
fb_info.flags = FBINFO_FLAG_DEFAULT; fb_info.flags = FBINFO_FLAG_DEFAULT;
fb_alloc_cmap(&fb_info.cmap, 256, 0); fb_alloc_cmap(&fb_info.cmap, 256, 0);
gen_set_disp(-1, &fb_info);
if (register_framebuffer(&fb_info) < 0) if (register_framebuffer(&fb_info) < 0)
return 1; return 1;
......
...@@ -300,6 +300,7 @@ int __fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info, ...@@ -300,6 +300,7 @@ int __fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info,
var->vmode = mode->vmode; var->vmode = mode->vmode;
err = info->fbops->fb_set_var(var, PROC_CONSOLE(info), info); err = info->fbops->fb_set_var(var, PROC_CONSOLE(info), info);
var->activate &= ~FB_ACTIVATE_TEST; var->activate &= ~FB_ACTIVATE_TEST;
gen_set_disp(PROC_CONSOLE(info), info);
return !err; return !err;
} }
......
...@@ -67,7 +67,6 @@ ...@@ -67,7 +67,6 @@
#include <asm/mtrr.h> #include <asm/mtrr.h>
#endif #endif
#include <video/fbcon.h>
#include <video/neomagic.h> #include <video/neomagic.h>
#define NEOFB_VERSION "0.3.3" #define NEOFB_VERSION "0.3.3"
...@@ -1390,8 +1389,6 @@ static struct fb_ops neofb_ops = { ...@@ -1390,8 +1389,6 @@ static struct fb_ops neofb_ops = {
.fb_check_var = neofb_check_var, .fb_check_var = neofb_check_var,
.fb_set_par = neofb_set_par, .fb_set_par = neofb_set_par,
.fb_set_var = gen_set_var, .fb_set_var = gen_set_var,
.fb_get_cmap = gen_get_cmap,
.fb_set_cmap = gen_set_cmap,
.fb_setcolreg = neofb_setcolreg, .fb_setcolreg = neofb_setcolreg,
.fb_pan_display = neofb_pan_display, .fb_pan_display = neofb_pan_display,
.fb_blank = neofb_blank, .fb_blank = neofb_blank,
...@@ -1750,13 +1747,13 @@ static struct fb_info *__devinit neo_alloc_fb_info(struct pci_dev *dev, const st ...@@ -1750,13 +1747,13 @@ static struct fb_info *__devinit neo_alloc_fb_info(struct pci_dev *dev, const st
struct fb_info *info; struct fb_info *info;
struct neofb_par *par; struct neofb_par *par;
info = kmalloc(sizeof(struct fb_info) + sizeof(struct display) + info = kmalloc(sizeof(struct fb_info) +
sizeof(u32) * 16, GFP_KERNEL); sizeof(u32) * 17, GFP_KERNEL);
if (!info) if (!info)
return NULL; 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; par = &default_par;
memset(par, 0, sizeof(struct neofb_par)); memset(par, 0, sizeof(struct neofb_par));
...@@ -1818,16 +1815,11 @@ static struct fb_info *__devinit neo_alloc_fb_info(struct pci_dev *dev, const st ...@@ -1818,16 +1815,11 @@ static struct fb_info *__devinit neo_alloc_fb_info(struct pci_dev *dev, const st
info->var.width = -1; info->var.width = -1;
info->var.accel_flags = 0; info->var.accel_flags = 0;
strcpy(info->modename, info->fix.id);
info->fbops = &neofb_ops; info->fbops = &neofb_ops;
info->changevar = NULL;
info->switch_con = gen_switch;
info->updatevar = gen_update_var; info->updatevar = gen_update_var;
info->flags = FBINFO_FLAG_DEFAULT; info->flags = FBINFO_FLAG_DEFAULT;
info->par = par; info->par = par;
info->disp = (struct display *) (info + 1); info->pseudo_palette = (void *) (info + 1);
info->pseudo_palette = (void *) (info->disp + 1);
fb_alloc_cmap(&info->cmap, NR_PALETTE, 0); fb_alloc_cmap(&info->cmap, NR_PALETTE, 0);
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <asm/bootx.h> #include <asm/bootx.h>
#endif #endif
#include <video/fbcon.h>
#include <video/macmodes.h> #include <video/macmodes.h>
/* Supported palette hacks */ /* Supported palette hacks */
...@@ -84,8 +83,6 @@ static void offb_init_fb(const char *name, const char *full_name, ...@@ -84,8 +83,6 @@ static void offb_init_fb(const char *name, const char *full_name,
static struct fb_ops offb_ops = { static struct fb_ops offb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_set_var = gen_set_var, .fb_set_var = gen_set_var,
.fb_get_cmap = gen_get_cmap,
.fb_set_cmap = gen_set_cmap,
.fb_setcolreg = offb_setcolreg, .fb_setcolreg = offb_setcolreg,
.fb_blank = offb_blank, .fb_blank = offb_blank,
.fb_fillrect = cfb_fillrect, .fb_fillrect = cfb_fillrect,
...@@ -411,7 +408,7 @@ static void __init offb_init_fb(const char *name, const char *full_name, ...@@ -411,7 +408,7 @@ static void __init offb_init_fb(const char *name, const char *full_name,
return; 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); info = kmalloc(size, GFP_ATOMIC);
...@@ -528,24 +525,16 @@ static void __init offb_init_fb(const char *name, const char *full_name, ...@@ -528,24 +525,16 @@ static void __init offb_init_fb(const char *name, const char *full_name,
strcpy(fix->id, "OFfb "); strcpy(fix->id, "OFfb ");
strncat(fix->id, full_name, sizeof(fix->id)); strncat(fix->id, full_name, sizeof(fix->id));
strcpy(info->modename, fix->id);
info->node = NODEV; info->node = NODEV;
info->fbops = &offb_ops; info->fbops = &offb_ops;
info->screen_base = ioremap(address, fix->smem_len); info->screen_base = ioremap(address, fix->smem_len);
info->par = par; info->par = par;
info->disp = (struct display *) (info + 1); info->pseudo_palette = (void *) (info + 1);
info->pseudo_palette = (void *) (info->disp + 1);
info->currcon = -1;
info->fontname[0] = '\0'; info->fontname[0] = '\0';
info->changevar = NULL;
info->switch_con = gen_switch;
info->updatevar = gen_update_var;
info->flags = FBINFO_FLAG_DEFAULT; info->flags = FBINFO_FLAG_DEFAULT;
fb_alloc_cmap(&info->cmap, 256, 0); fb_alloc_cmap(&info->cmap, 256, 0);
gen_set_disp(-1, info);
if (register_framebuffer(info) < 0) { if (register_framebuffer(info) < 0) {
kfree(info); kfree(info);
release_mem_region(res_start, res_size); release_mem_region(res_start, res_size);
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
#include <asm/dec/tc.h> #include <asm/dec/tc.h>
#include "pmag-ba-fb.h" #include "pmag-ba-fb.h"
#include <video/fbcon.h>
struct pmag_ba_ramdac_regs { struct pmag_ba_ramdac_regs {
unsigned char addr_low; unsigned char addr_low;
unsigned char pad0[3]; unsigned char pad0[3];
...@@ -52,7 +50,6 @@ struct pmag_ba_ramdac_regs { ...@@ -52,7 +50,6 @@ struct pmag_ba_ramdac_regs {
* Max 3 TURBOchannel slots -> max 3 PMAG-BA :) * Max 3 TURBOchannel slots -> max 3 PMAG-BA :)
*/ */
static struct fb_info pmagba_fb_info[3]; static struct fb_info pmagba_fb_info[3];
static struct display pmagba_disp[3];
static struct fb_var_screeninfo pmagbafb_defined = { static struct fb_var_screeninfo pmagbafb_defined = {
.xres = 1024, .xres = 1024,
...@@ -112,8 +109,6 @@ static int pmagbafb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -112,8 +109,6 @@ static int pmagbafb_setcolreg(unsigned regno, unsigned red, unsigned green,
static struct fb_ops pmagbafb_ops = { static struct fb_ops pmagbafb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_set_var = gen_set_var, .fb_set_var = gen_set_var,
.fb_get_cmap = gen_get_cmap,
.fb_set_cmap = gen_set_cmap,
.fb_setcolreg = pmagbafb_setcolreg, .fb_setcolreg = pmagbafb_setcolreg,
.fb_fillrect = cfb_fillrect, .fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea, .fb_copyarea = cfb_copyarea,
...@@ -124,7 +119,6 @@ int __init pmagbafb_init_one(int slot) ...@@ -124,7 +119,6 @@ int __init pmagbafb_init_one(int slot)
{ {
unsigned long base_addr = get_tc_base_addr(slot); unsigned long base_addr = get_tc_base_addr(slot);
struct fb_info *info = &pmagba_fb_info[slot]; struct fb_info *info = &pmagba_fb_info[slot];
struct display *disp = &pmagba_disp[slot];
printk("PMAG-BA framebuffer in slot %d\n", slot); printk("PMAG-BA framebuffer in slot %d\n", slot);
/* /*
...@@ -141,21 +135,16 @@ int __init pmagbafb_init_one(int slot) ...@@ -141,21 +135,16 @@ int __init pmagbafb_init_one(int slot)
/* /*
* Let there be consoles.. * Let there be consoles..
*/ */
strcpy(info->modename, pmagbafb_fix.id);
info->changevar = NULL;
info->node = NODEV; info->node = NODEV;
info->fbops = &pmagbafb_ops; info->fbops = &pmagbafb_ops;
info->var = pmagbafb_defined; info->var = pmagbafb_defined;
info->fix = pmagbafb_fix; info->fix = pmagbafb_fix;
info->screen_base = pmagbafb_fix.smem_start; info->screen_base = pmagbafb_fix.smem_start;
info->disp = &disp;
info->currcon = -1; info->currcon = -1;
info->switch_con = gen_switch;
info->updatevar = gen_update_var; info->updatevar = gen_update_var;
info->flags = FBINFO_FLAG_DEFAULT; info->flags = FBINFO_FLAG_DEFAULT;
fb_alloc_cmap(&fb_info.cmap, 256, 0); fb_alloc_cmap(&fb_info.cmap, 256, 0);
gen_set_disp(-1, info);
if (register_framebuffer(info) < 0) if (register_framebuffer(info) < 0)
return 1; return 1;
......
...@@ -39,8 +39,6 @@ ...@@ -39,8 +39,6 @@
#include <asm/dec/tc.h> #include <asm/dec/tc.h>
#include "pmagb-b-fb.h" #include "pmagb-b-fb.h"
#include <video/fbcon.h>
struct pmagb_b_ramdac_regs { struct pmagb_b_ramdac_regs {
unsigned char addr_low; unsigned char addr_low;
unsigned char pad0[3]; unsigned char pad0[3];
...@@ -55,7 +53,6 @@ struct pmagb_b_ramdac_regs { ...@@ -55,7 +53,6 @@ struct pmagb_b_ramdac_regs {
* Max 3 TURBOchannel slots -> max 3 PMAGB-B :) * Max 3 TURBOchannel slots -> max 3 PMAGB-B :)
*/ */
static struct fb_info pmagbb_fb_info[3]; static struct fb_info pmagbb_fb_info[3];
static struct display pmagbb_disp[3];
static struct fb_var_screeninfo pmagbbfb_defined = { static struct fb_var_screeninfo pmagbbfb_defined = {
.xres = 1280, .xres = 1280,
...@@ -115,8 +112,6 @@ static int pmagbbfb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -115,8 +112,6 @@ static int pmagbbfb_setcolreg(unsigned regno, unsigned red, unsigned green,
static struct fb_ops pmagbbfb_ops = { static struct fb_ops pmagbbfb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_set_var = gen_set_var, .fb_set_var = gen_set_var,
.fb_get_cmap = gen_get_cmap,
.fb_set_cmap = gen_set_cmap,
.fb_setcolreg = pmagbbfb_setcolreg, .fb_setcolreg = pmagbbfb_setcolreg,
.fb_fillrect = cfb_fillrect, .fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea, .fb_copyarea = cfb_copyarea,
...@@ -127,7 +122,6 @@ int __init pmagbbfb_init_one(int slot) ...@@ -127,7 +122,6 @@ int __init pmagbbfb_init_one(int slot)
{ {
unsigned long base_addr = get_tc_base_addr(slot); unsigned long base_addr = get_tc_base_addr(slot);
struct fb_info *info = &pmagbb_fb_info[slot]; struct fb_info *info = &pmagbb_fb_info[slot];
struct display *disp = &pmagbb_disp[slot];
printk("PMAGB-BA framebuffer in slot %d\n", slot); printk("PMAGB-BA framebuffer in slot %d\n", slot);
/* /*
...@@ -144,21 +138,16 @@ int __init pmagbbfb_init_one(int slot) ...@@ -144,21 +138,16 @@ int __init pmagbbfb_init_one(int slot)
/* /*
* Let there be consoles.. * Let there be consoles..
*/ */
strcpy(info->modename, pmagbbfb_fix.id);
info->changevar = NULL;
info->node = NODEV; info->node = NODEV;
info->fbops = &pmagbbfb_ops; info->fbops = &pmagbbfb_ops;
info->var = pmagbbfb_defined; info->var = pmagbbfb_defined;
info->fix = pmagbbfb_fix; info->fix = pmagbbfb_fix;
info->screen_base = pmagbbfb_fix.smem_start; info->screen_base = pmagbbfb_fix.smem_start;
info->disp = &disp;
info->currcon = -1; info->currcon = -1;
info->switch_con = gen_switch;
info->updatevar = gen_update_var; info->updatevar = gen_update_var;
info->flags = FBINFO_FLAG_DEFAULT; info->flags = FBINFO_FLAG_DEFAULT;
fb_alloc_cmap(&fb_info.cmap, 256, 0); fb_alloc_cmap(&fb_info.cmap, 256, 0);
gen_set_disp(-1, info);
if (register_framebuffer(info) < 0) if (register_framebuffer(info) < 0)
return 1; return 1;
......
...@@ -28,13 +28,10 @@ ...@@ -28,13 +28,10 @@
#include <linux/module.h> #include <linux/module.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <video/fbcon.h>
#define Q40_PHYS_SCREEN_ADDR 0xFE800000 #define Q40_PHYS_SCREEN_ADDR 0xFE800000
static u32 pseudo_palette[17]; static u32 pseudo_palette[17];
static struct fb_info fb_info; static struct fb_info fb_info;
static struct display display;
static struct fb_fix_screeninfo q40fb_fix __initdata = { static struct fb_fix_screeninfo q40fb_fix __initdata = {
.id = "Q40", .id = "Q40",
...@@ -70,8 +67,6 @@ static int q40fb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -70,8 +67,6 @@ static int q40fb_setcolreg(unsigned regno, unsigned red, unsigned green,
static struct fb_ops q40fb_ops = { static struct fb_ops q40fb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_set_var = gen_set_var, .fb_set_var = gen_set_var,
.fb_get_cmap = gen_get_cmap,
.fb_set_cmap = gen_set_cmap,
.fb_setcolreg = q40fb_setcolreg, .fb_setcolreg = q40fb_setcolreg,
.fb_fillrect = cfb_fillrect, .fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea, .fb_copyarea = cfb_copyarea,
...@@ -117,15 +112,8 @@ int q40fb_init(void) ...@@ -117,15 +112,8 @@ int q40fb_init(void)
fb_info.screen_base = (char *) q40fb_fix.smem_start; fb_info.screen_base = (char *) q40fb_fix.smem_start;
/* The below feilds will go away !!!! */ /* 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); fb_alloc_cmap(&fb_info.cmap, 16, 0);
gen_set_disp(-1, &fb_info);
master_outb(3, DISPLAY_CONTROL_REG); master_outb(3, DISPLAY_CONTROL_REG);
if (register_framebuffer(&fb_info) < 0) { if (register_framebuffer(&fb_info) < 0) {
......
...@@ -1432,7 +1432,7 @@ static void sa1100fb_disable_controller(struct sa1100fb_info *fbi) ...@@ -1432,7 +1432,7 @@ static void sa1100fb_disable_controller(struct sa1100fb_info *fbi)
LCCR0 &= ~LCCR0_LEN; /* Disable LCD Controller */ LCCR0 &= ~LCCR0_LEN; /* Disable LCD Controller */
schedule_timeout(20 * HZ / 1000); schedule_timeout(20 * HZ / 1000);
current->state = TASK_RUNNING; set_current_state(TASK_RUNNING);
remove_wait_queue(&fbi->ctrlr_wait, &wait); remove_wait_queue(&fbi->ctrlr_wait, &wait);
} }
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/mtrr.h> #include <asm/mtrr.h>
#include <video/fbcon.h>
#define INCLUDE_TIMING_TABLE_DATA #define INCLUDE_TIMING_TABLE_DATA
#define DBE_REG_BASE regs #define DBE_REG_BASE regs
#include <video/sgivw.h> #include <video/sgivw.h>
...@@ -85,9 +83,6 @@ static struct fb_var_screeninfo sgivwfb_var __initdata = { ...@@ -85,9 +83,6 @@ static struct fb_var_screeninfo sgivwfb_var __initdata = {
.vmode = FB_VMODE_NONINTERLACED .vmode = FB_VMODE_NONINTERLACED
}; };
/* console related variables */
static struct display disp;
/* /*
* Interface used by the world * Interface used by the world
*/ */
...@@ -105,8 +100,6 @@ static int sgivwfb_mmap(struct fb_info *info, struct file *file, ...@@ -105,8 +100,6 @@ static int sgivwfb_mmap(struct fb_info *info, struct file *file,
static struct fb_ops sgivwfb_ops = { static struct fb_ops sgivwfb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_set_var = gen_set_var, .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_check_var = sgivwfb_check_var,
.fb_set_par = sgivwfb_set_par, .fb_set_par = sgivwfb_set_par,
.fb_setcolreg = sgivwfb_setcolreg, .fb_setcolreg = sgivwfb_setcolreg,
...@@ -240,8 +233,8 @@ static int sgivwfb_check_var(struct fb_var_screeninfo *var, ...@@ -240,8 +233,8 @@ static int sgivwfb_check_var(struct fb_var_screeninfo *var,
if (var->vmode & FB_VMODE_CONUPDATE) { if (var->vmode & FB_VMODE_CONUPDATE) {
var->vmode |= FB_VMODE_YWRAP; var->vmode |= FB_VMODE_YWRAP;
var->xoffset = display->var.xoffset; var->xoffset = info->var.xoffset;
var->yoffset = display->var.yoffset; var->yoffset = info->var.yoffset;
} }
/* XXX FIXME - forcing var's */ /* XXX FIXME - forcing var's */
...@@ -720,18 +713,12 @@ int __init sgivwfb_init(void) ...@@ -720,18 +713,12 @@ int __init sgivwfb_init(void)
sgivwfb_fix.ywrapstep = ywrap; sgivwfb_fix.ywrapstep = ywrap;
sgivwfb_fix.ypanstep = ypan; sgivwfb_fix.ypanstep = ypan;
strcpy(fb_info.modename, sgivwfb_fix.id);
fb_info.changevar = NULL;
fb_info.node = NODEV; fb_info.node = NODEV;
fb_info.fix = sgivwfb_fix; fb_info.fix = sgivwfb_fix;
fb_info.var = sgivwfb_var; fb_info.var = sgivwfb_var;
fb_info.fbops = &sgivwfb_ops; fb_info.fbops = &sgivwfb_ops;
fb_info.pseudo_palette = pseudo_palette; fb_info.pseudo_palette = pseudo_palette;
fb_info.par = &default_par; 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.flags = FBINFO_FLAG_DEFAULT;
fb_info.screen_base = fb_info.screen_base =
......
...@@ -125,9 +125,6 @@ static struct fb_info info; ...@@ -125,9 +125,6 @@ static struct fb_info info;
*/ */
static struct xxx_par __initdata current_par; static struct xxx_par __initdata current_par;
/* To go away in the near future */
static struct display disp;
int xxxfb_init(void); int xxxfb_init(void);
int xxxfb_setup(char*); int xxxfb_setup(char*);
...@@ -421,15 +418,6 @@ int __init xxxfb_init(void) ...@@ -421,15 +418,6 @@ int __init xxxfb_init(void)
info.flags = FBINFO_FLAG_DEFAULT; info.flags = FBINFO_FLAG_DEFAULT;
info.par = current_par; 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 * This should give a reasonable default video mode. The following is
* done when we can set a video mode. * done when we can set a video mode.
...@@ -450,7 +438,6 @@ int __init xxxfb_init(void) ...@@ -450,7 +438,6 @@ int __init xxxfb_init(void)
* mode. If we are setting the mode ourselves we don't call this. * mode. If we are setting the mode ourselves we don't call this.
*/ */
info.var = xxxfb_var; info.var = xxxfb_var;
gen_set_disp(-1, &fb_info);
if (register_framebuffer(&info) < 0) if (register_framebuffer(&info) < 0)
return -EINVAL; return -EINVAL;
...@@ -512,8 +499,6 @@ static struct fb_ops xxxfb_ops = { ...@@ -512,8 +499,6 @@ static struct fb_ops xxxfb_ops = {
.fb_release = xxxfb_release, /* 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 */ /* Stuff to go away. Use generic functions for now */
.fb_set_var = gen_set_var, .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_check_var = xxxfb_check_var,
.fb_set_par = xxxfb_set_par, /* optional */ .fb_set_par = xxxfb_set_par, /* optional */
......
...@@ -170,8 +170,6 @@ static void tdfxfb_imageblit(struct fb_info *info, struct fb_image *image); ...@@ -170,8 +170,6 @@ static void tdfxfb_imageblit(struct fb_info *info, struct fb_image *image);
static struct fb_ops tdfxfb_ops = { static struct fb_ops tdfxfb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_set_var = gen_set_var, .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_check_var = tdfxfb_check_var,
.fb_set_par = tdfxfb_set_par, .fb_set_par = tdfxfb_set_par,
.fb_setcolreg = tdfxfb_setcolreg, .fb_setcolreg = tdfxfb_setcolreg,
...@@ -192,8 +190,6 @@ static unsigned long do_lfb_size(unsigned short); ...@@ -192,8 +190,6 @@ static unsigned long do_lfb_size(unsigned short);
/* /*
* Driver data * Driver data
*/ */
static struct tdfx_par default_par;
static int nopan = 0; static int nopan = 0;
static int nowrap = 1; // not implemented (yet) static int nowrap = 1; // not implemented (yet)
static int inverse = 0; static int inverse = 0;
...@@ -204,59 +200,59 @@ static char *mode_option __initdata = NULL; ...@@ -204,59 +200,59 @@ static char *mode_option __initdata = NULL;
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
#ifdef VGA_REG_IO #ifdef VGA_REG_IO
static inline u8 vga_inb(u32 reg) { return inb(reg); } static inline u8 vga_inb(struct tdfx_par *par, u32 reg) { return inb(reg); }
static inline u16 vga_inw(u32 reg) { return inw(reg); } static inline u16 vga_inw(struct tdfx_par *par, u32 reg) { return inw(reg); }
static inline u16 vga_inl(u32 reg) { return inl(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_outb(struct tdfx_par *par, u32 reg, u8 val) { outb(val, reg); }
static inline void vga_outw(u32 reg, u16 val) { outw(val, reg); } static inline void vga_outw(struct tdfx_par *par, u32 reg, u16 val) { outw(val, reg); }
static inline void vga_outl(u32 reg, u32 val) { outl(val, reg); } static inline void vga_outl(struct tdfx_par *par, u32 reg, u32 val) { outl(val, reg); }
#else #else
static inline u8 vga_inb(u32 reg) { static inline u8 vga_inb(struct tdfx_par *par, u32 reg) {
return inb(default_par.iobase + reg - 0x300); return inb(par->iobase + reg - 0x300);
} }
static inline u16 vga_inw(u32 reg) { static inline u16 vga_inw(struct tdfx_par *par, u32 reg) {
return inw(default_par.iobase + reg - 0x300); return inw(par->iobase + reg - 0x300);
} }
static inline u16 vga_inl(u32 reg) { static inline u16 vga_inl(struct tdfx_par *par, u32 reg) {
return inl(default_par.iobase + reg - 0x300); return inl(par->iobase + reg - 0x300);
} }
static inline void vga_outb(u32 reg, u8 val) { static inline void vga_outb(struct tdfx_par *par, u32 reg, u8 val) {
outb(val, default_par.iobase + reg - 0x300); outb(val, par->iobase + reg - 0x300);
} }
static inline void vga_outw(u32 reg, u16 val) { static inline void vga_outw(struct tdfx_par *par, u32 reg, u16 val) {
outw(val, default_par.iobase + reg - 0x300); outw(val, par->iobase + reg - 0x300);
} }
static inline void vga_outl(u32 reg, u32 val) { static inline void vga_outl(struct tdfx_par *par, u32 reg, u32 val) {
outl(val, default_par.iobase + reg - 0x300); outl(val, par->iobase + reg - 0x300);
} }
#endif #endif
static inline void gra_outb(u32 idx, u8 val) { static inline void gra_outb(struct tdfx_par *par, u32 idx, u8 val) {
vga_outb(GRA_I, idx); vga_outb(GRA_D, val); vga_outb(GRA_I, idx); vga_outb(GRA_D, val);
} }
static inline u8 gra_inb(u32 idx) { static inline u8 gra_inb(struct tdfx_par *par, u32 idx) {
vga_outb(GRA_I, idx); return vga_inb(GRA_D); vga_outb(GRA_I, idx); return vga_inb(GRA_D);
} }
static inline void seq_outb(u32 idx, u8 val) { static inline void seq_outb(struct tdfx_par *par, u32 idx, u8 val) {
vga_outb(SEQ_I, idx); vga_outb(SEQ_D, val); vga_outb(SEQ_I, idx); vga_outb(SEQ_D, val);
} }
static inline u8 seq_inb(u32 idx) { static inline u8 seq_inb(struct tdfx_par *par, u32 idx) {
vga_outb(SEQ_I, idx); return vga_inb(SEQ_D); vga_outb(SEQ_I, idx); return vga_inb(SEQ_D);
} }
static inline void crt_outb(u32 idx, u8 val) { static inline void crt_outb(struct tdfx_par *par, u32 idx, u8 val) {
vga_outb(CRT_I, idx); vga_outb(CRT_D, val); vga_outb(CRT_I, idx); vga_outb(CRT_D, val);
} }
static inline u8 crt_inb(u32 idx) { static inline u8 crt_inb(struct tdfx_par *par, u32 idx) {
vga_outb(CRT_I, idx); return vga_inb(CRT_D); vga_outb(CRT_I, idx); return vga_inb(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; unsigned char tmp;
...@@ -265,7 +261,7 @@ static inline void att_outb(u32 idx, u8 val) ...@@ -265,7 +261,7 @@ static inline void att_outb(u32 idx, u8 val)
vga_outb(ATT_IW, val); vga_outb(ATT_IW, val);
} }
static inline u8 att_inb(u32 idx) static inline u8 att_inb(struct tdfx_par *par, u32 idx)
{ {
unsigned char tmp; unsigned char tmp;
...@@ -300,36 +296,36 @@ static inline void vga_disable_palette(void) ...@@ -300,36 +296,36 @@ static inline void vga_disable_palette(void)
vga_outb(ATT_IW, 0x00); vga_outb(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_inb(IS1_R);
vga_outb(ATT_IW, 0x20); vga_outb(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; int i = 0;
banshee_make_room(1); banshee_make_room(1);
tdfx_outl(COMMAND_3D, COMMAND_3D_NOP); tdfx_outl(par, COMMAND_3D, COMMAND_3D_NOP);
while(1) { 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; if(i == 3) break;
} }
} }
...@@ -337,11 +333,11 @@ static inline void banshee_wait_idle(void) ...@@ -337,11 +333,11 @@ static inline void banshee_wait_idle(void)
/* /*
* Set the color of a palette entry in 8bpp mode * 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); banshee_make_room(2);
tdfx_outl(DACADDR, regno); tdfx_outl(par, DACADDR, regno);
tdfx_outl(DACDATA, c); tdfx_outl(par, DACDATA, c);
} }
static u32 do_calc_pll(int freq, int* freq_out) static u32 do_calc_pll(int freq, int* freq_out)
...@@ -979,6 +975,7 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, ...@@ -979,6 +975,7 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev,
const struct pci_device_id *id) const struct pci_device_id *id)
{ {
struct fb_info *info; struct fb_info *info;
struct tdfx_par *par;
int size, err; int size, err;
if ((err = pci_enable_device(pdev))) { if ((err = pci_enable_device(pdev))) {
...@@ -986,33 +983,33 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, ...@@ -986,33 +983,33 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev,
return err; return err;
} }
info = kmalloc(sizeof(struct fb_info) + sizeof(struct display) + info = kmalloc(sizeof(struct fb_info) + sizeof(struct tdfx_par) +
sizeof(u32) * 16, GFP_KERNEL); sizeof(u32) * 17, GFP_KERNEL);
if (!info) return -ENOMEM; if (!info) return -ENOMEM;
memset(info, 0, sizeof(info) + sizeof(struct display) + sizeof(u32) * 16); memset(info, 0, sizeof(info) + sizeof(struct tdfx_par) + sizeof(u32) * 17);
/* Configure the default fb_fix_screeninfo first */ /* Configure the default fb_fix_screeninfo first */
switch (pdev->device) { switch (pdev->device) {
case PCI_DEVICE_ID_3DFX_BANSHEE: case PCI_DEVICE_ID_3DFX_BANSHEE:
strcat(tdfx_fix.id, " Banshee"); strcat(tdfx_fix.id, " Banshee");
default_par.max_pixclock = BANSHEE_MAX_PIXCLOCK; par->max_pixclock = BANSHEE_MAX_PIXCLOCK;
break; break;
case PCI_DEVICE_ID_3DFX_VOODOO3: case PCI_DEVICE_ID_3DFX_VOODOO3:
strcat(tdfx_fix.id, " Voodoo3"); strcat(tdfx_fix.id, " Voodoo3");
default_par.max_pixclock = VOODOO3_MAX_PIXCLOCK; par->max_pixclock = VOODOO3_MAX_PIXCLOCK;
break; break;
case PCI_DEVICE_ID_3DFX_VOODOO5: case PCI_DEVICE_ID_3DFX_VOODOO5:
strcat(tdfx_fix.id, " Voodoo5"); strcat(tdfx_fix.id, " Voodoo5");
default_par.max_pixclock = VOODOO5_MAX_PIXCLOCK; par->max_pixclock = VOODOO5_MAX_PIXCLOCK;
break; break;
} }
tdfx_fix.mmio_start = pci_resource_start(pdev, 0); tdfx_fix.mmio_start = pci_resource_start(pdev, 0);
tdfx_fix.mmio_len = pci_resource_len(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); par->regbase_virt = ioremap_nocache(tdfx_fix.mmio_start, tdfx_fix.mmio_len);
if (!default_par.regbase_virt) { if (!par->regbase_virt) {
printk("fb: Can't remap %s register area.\n", tdfx_fix.id); printk("fb: Can't remap %s register area.\n", tdfx_fix.id);
goto out_err; goto out_err;
} }
...@@ -1050,7 +1047,7 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, ...@@ -1050,7 +1047,7 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev,
goto out_err; goto out_err;
} }
default_par.iobase = pci_resource_start(pdev, 2); par->iobase = pci_resource_start(pdev, 2);
if (!request_region(pci_resource_start(pdev, 2), if (!request_region(pci_resource_start(pdev, 2),
pci_resource_len(pdev, 2), "tdfx iobase")) { pci_resource_len(pdev, 2), "tdfx iobase")) {
...@@ -1073,17 +1070,10 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, ...@@ -1073,17 +1070,10 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev,
info->node = NODEV; info->node = NODEV;
info->fbops = &tdfxfb_ops; info->fbops = &tdfxfb_ops;
info->fix = tdfx_fix; info->fix = tdfx_fix;
info->par = &default_par; info->par = (struct tdfx_par *)(info + 1);
info->disp = (struct display *)(info + 1); info->pseudo_palette = (void *)(info->par + 1);
info->pseudo_palette = (void *)(info->disp + 1);
info->flags = FBINFO_FLAG_DEFAULT; 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) if (!mode_option)
mode_option = "640x480@60"; mode_option = "640x480@60";
...@@ -1110,10 +1100,11 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, ...@@ -1110,10 +1100,11 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev,
/* /*
* Cleanup after anything that was remapped/allocated. * Cleanup after anything that was remapped/allocated.
*/ */
if (default_par.regbase_virt) if (par->regbase_virt)
iounmap(default_par.regbase_virt); iounmap(par->regbase_virt);
if (info->screen_base) if (info->screen_base)
iounmap(info->screen_base); iounmap(info->screen_base);
kfree(par);
kfree(info); kfree(info);
return -ENXIO; return -ENXIO;
} }
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/fb.h> #include <linux/fb.h>
#include <video/fbcon.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -33,7 +32,6 @@ ...@@ -33,7 +32,6 @@
*/ */
static struct fb_info fb_info; static struct fb_info fb_info;
static u32 cfb8[16]; static u32 cfb8[16];
static struct display disp;
static struct fb_fix_screeninfo tx3912fb_fix __initdata = { static struct fb_fix_screeninfo tx3912fb_fix __initdata = {
.id = "tx3912fb", .id = "tx3912fb",
...@@ -97,8 +95,6 @@ static int tx3912fb_setcolreg(u_int regno, u_int red, u_int green, ...@@ -97,8 +95,6 @@ static int tx3912fb_setcolreg(u_int regno, u_int red, u_int green,
static struct fb_ops tx3912fb_ops = { static struct fb_ops tx3912fb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_set_var = gen_set_var, .fb_set_var = gen_set_var,
.fb_get_cmap = gen_get_cmap,
.fb_set_cmap = gen_set_cmap,
.fb_setcolreg = tx3912fb_setcolreg, .fb_setcolreg = tx3912fb_setcolreg,
.fb_fillrect = cfb_fillrect, .fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea, .fb_copyarea = cfb_copyarea,
...@@ -295,17 +291,11 @@ int __init tx3912fb_init(void) ...@@ -295,17 +291,11 @@ int __init tx3912fb_init(void)
if ((tx3912fb_fix.line_length * tx3912fb_var.yres_virtual) > tx3912fb_fix.smem_len) if ((tx3912fb_fix.line_length * tx3912fb_var.yres_virtual) > tx3912fb_fix.smem_len)
return -ENOMEM; return -ENOMEM;
strcpy(fb_info.modename, tx3912fb_fix.id);
fb_info.changevar = NULL;
fb_info.node = NODEV; fb_info.node = NODEV;
fb_info.currcon = -1;
fb_info.fbops = &tx3912fb_ops; fb_info.fbops = &tx3912fb_ops;
fb_info.var = tx3912fb_var; fb_info.var = tx3912fb_var;
fb_info.fix = tx3912fb_fix; fb_info.fix = tx3912fb_fix;
fb_info.pseudo_palette = pseudo_palette; 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; fb_info.flags = FBINFO_FLAG_DEFAULT;
/* Clear the framebuffer */ /* Clear the framebuffer */
...@@ -313,7 +303,6 @@ int __init tx3912fb_init(void) ...@@ -313,7 +303,6 @@ int __init tx3912fb_init(void)
udelay(200); udelay(200);
fb_alloc_cmap(&info->cmap, size, 0); fb_alloc_cmap(&info->cmap, size, 0);
gen_set_disp(-1, &disp);
if (register_framebuffer(&fb_info) < 0) if (register_framebuffer(&fb_info) < 0)
return -1; return -1;
......
...@@ -17,16 +17,12 @@ ...@@ -17,16 +17,12 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/console.h>
#include <linux/selection.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/mtrr.h> #include <asm/mtrr.h>
#include <video/fbcon.h>
#define dac_reg (0x3c8) #define dac_reg (0x3c8)
#define dac_val (0x3c9) #define dac_val (0x3c9)
...@@ -49,7 +45,6 @@ static struct fb_fix_screeninfo vesafb_fix __initdata = { ...@@ -49,7 +45,6 @@ static struct fb_fix_screeninfo vesafb_fix __initdata = {
.accel = FB_ACCEL_NONE, .accel = FB_ACCEL_NONE,
}; };
static struct display disp;
static struct fb_info fb_info; static struct fb_info fb_info;
static u32 pseudo_palette[17]; static u32 pseudo_palette[17];
...@@ -176,8 +171,6 @@ static int vesafb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -176,8 +171,6 @@ static int vesafb_setcolreg(unsigned regno, unsigned red, unsigned green,
static struct fb_ops vesafb_ops = { static struct fb_ops vesafb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_set_var = gen_set_var, .fb_set_var = gen_set_var,
.fb_get_cmap = gen_get_cmap,
.fb_set_cmap = gen_set_cmap,
.fb_setcolreg = vesafb_setcolreg, .fb_setcolreg = vesafb_setcolreg,
.fb_pan_display = vesafb_pan_display, .fb_pan_display = vesafb_pan_display,
.fb_fillrect = cfb_fillrect, .fb_fillrect = cfb_fillrect,
...@@ -351,21 +344,15 @@ int __init vesafb_init(void) ...@@ -351,21 +344,15 @@ int __init vesafb_init(void)
} }
} }
strcpy(fb_info.modename, vesafb_fix.id);
fb_info.changevar = NULL;
fb_info.node = NODEV; fb_info.node = NODEV;
fb_info.fbops = &vesafb_ops; fb_info.fbops = &vesafb_ops;
fb_info.var = vesafb_defined; fb_info.var = vesafb_defined;
fb_info.fix = vesafb_fix; 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.updatevar = gen_update_var;
fb_info.pseudo_palette = pseudo_palette; fb_info.pseudo_palette = pseudo_palette;
fb_info.flags = FBINFO_FLAG_DEFAULT; fb_info.flags = FBINFO_FLAG_DEFAULT;
fb_alloc_cmap(&fb_info.cmap, video_cmap_len, 0); fb_alloc_cmap(&fb_info.cmap, video_cmap_len, 0);
gen_set_disp(-1, &fb_info);
if (register_framebuffer(&fb_info)<0) if (register_framebuffer(&fb_info)<0)
return -EINVAL; return -EINVAL;
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/init.h> #include <linux/init.h>
#include <video/fbcon.h>
/* /*
* RAM we reserve for the frame buffer. This defines the maximum screen * RAM we reserve for the frame buffer. This defines the maximum screen
* size * size
...@@ -42,7 +40,6 @@ static const char *mode_option __initdata = NULL; ...@@ -42,7 +40,6 @@ static const char *mode_option __initdata = NULL;
static struct fb_info fb_info; static struct fb_info fb_info;
static u32 vfb_pseudo_palette[17]; static u32 vfb_pseudo_palette[17];
static struct display disp;
static struct fb_var_screeninfo vfb_default __initdata = { static struct fb_var_screeninfo vfb_default __initdata = {
.xres = 640, .xres = 640,
...@@ -97,8 +94,6 @@ static int vfb_mmap(struct fb_info *info, struct file *file, ...@@ -97,8 +94,6 @@ static int vfb_mmap(struct fb_info *info, struct file *file,
static struct fb_ops vfb_ops = { static struct fb_ops vfb_ops = {
.fb_set_var gen_set_var, .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_check_var vfb_check_var,
.fb_set_par vfb_set_par, .fb_set_par vfb_set_par,
.fb_setcolreg vfb_setcolreg, .fb_setcolreg vfb_setcolreg,
...@@ -444,13 +439,6 @@ int __init vfb_init(void) ...@@ -444,13 +439,6 @@ int __init vfb_init(void)
fb_info.pseudo_palette = &vfb_pseudo_palette; fb_info.pseudo_palette = &vfb_pseudo_palette;
fb_info.flags = FBINFO_FLAG_DEFAULT; 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); fb_alloc_cmap(&fb_info.cmap, 256, 0);
if (register_framebuffer(&fb_info) < 0) { if (register_framebuffer(&fb_info) < 0) {
......
...@@ -27,10 +27,22 @@ ...@@ -27,10 +27,22 @@
#include <video/fbcon.h> #include <video/fbcon.h>
#include <video/fbcon-vga-planes.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" #include "vga.h"
#define dac_reg (0x3c8) #define GRAPHICS_ADDR_REG 0x3ce /* Graphics address register. */
#define dac_val (0x3c9) #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 0xA0000
#define VGA_FB_PHYS_LEN 65536 #define VGA_FB_PHYS_LEN 65536
...@@ -41,11 +53,9 @@ ...@@ -41,11 +53,9 @@
* card parameters * card parameters
*/ */
static struct vga16fb_info { static struct fb_info vga16fb;
struct fb_info fb_info;
char *video_vbase; /* 0xa0000 map address */ static struct vga16fb_par {
int isVGA;
/* structure holding original VGA register settings when the /* structure holding original VGA register settings when the
screen is blanked */ screen is blanked */
struct { struct {
...@@ -62,145 +72,246 @@ static struct vga16fb_info { ...@@ -62,145 +72,246 @@ static struct vga16fb_info {
unsigned char ModeControl; /* CRT-Controller:17h */ unsigned char ModeControl; /* CRT-Controller:17h */
unsigned char ClockingMode; /* Seq-Controller:01h */ unsigned char ClockingMode; /* Seq-Controller:01h */
} vga_state; } vga_state;
int palette_blanked, vesa_blanked, mode, isVGA;
int palette_blanked; u8 misc, pel_msk, vss, clkdiv;
int vesa_blanked;
} vga16fb;
struct vga16fb_par {
u8 crtc[VGA_CRT_C]; u8 crtc[VGA_CRT_C];
u8 atc[VGA_ATT_C]; } vga16_par;
u8 gdc[VGA_GFX_C];
u8 seq[VGA_SEQ_C];
u8 misc;
u8 vss;
struct fb_var_screeninfo var;
};
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
static struct fb_var_screeninfo vga16fb_defined = { static struct fb_var_screeninfo vga16fb_defined = {
640,480,640,480,/* W,H, W, H (virtual) load xres,xres_virtual*/ .xres = 640,
0,0, /* virtual -> visible no offset */ .yres = 480,
4, /* depth -> load bits_per_pixel */ .xres_virtual = 640,
0, /* greyscale ? */ .yres_virtual = 480,
{0,0,0}, /* R */ .bits_per_pixel = 4,
{0,0,0}, /* G */ .activate = FB_ACTIVATE_NOW,
{0,0,0}, /* B */ .height = -1,
{0,0,0}, /* transparency */ .width = -1,
0, /* standard pixel format */ .pixclock = 39721,
FB_ACTIVATE_NOW, .left_margin = 48,
-1,-1, .right_margin = 16,
0, .upper_margin = 39,
39721, 48, 16, 39, 8, .lower_margin = 8,
96, 2, 0, /* No sync info */ .hsync_len = 96,
FB_VMODE_NONINTERLACED, .vsync_len = 2,
{0,0,0,0,0,0} .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 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(GRAPHICS_MODE_INDEX, GRAPHICS_ADDR_REG);
outb(VGA_CRTC_START_HI, VGA_CRT_IC); outb(mode, GRAPHICS_DATA_REG);
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
} }
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); outb(BIT_MASK_INDEX, GRAPHICS_ADDR_REG);
return 0;
} }
static int vga16fb_get_fix(struct fb_fix_screeninfo *fix, int con, /* Set the value of the Bit Mask Register. It must already have been
struct fb_info *info) selected with selectmask(). */
static inline void setmask(int mask)
{ {
struct display *p; outb(mask, GRAPHICS_DATA_REG);
}
if (con < 0) /* Set the Data Rotate Register. Bits 0-2 are rotate count, bits 3-4
p = &disp; are logical operation (0=NOP, 1=AND, 2=OR, 3=XOR). */
else static inline void setop(int op)
p = fb_display + con; {
outb(DATA_ROTATE_INDEX, GRAPHICS_ADDR_REG);
memset(fix, 0, sizeof(struct fb_fix_screeninfo)); outb(op, GRAPHICS_DATA_REG);
strcpy(fix->id,"VGA16 VGA"); }
fix->smem_start = VGA_FB_PHYS; /* Set the Enable Set/Reset Register. The code here always uses value
fix->smem_len = VGA_FB_PHYS_LEN; 0xf for this register. */
fix->type = FB_TYPE_VGA_PLANES; static inline void setsr(int sr)
fix->visual = FB_VISUAL_PSEUDOCOLOR; {
fix->xpanstep = 8; outb(ENABLE_SET_RESET_INDEX, GRAPHICS_ADDR_REG);
fix->ypanstep = 1; outb(sr, GRAPHICS_DATA_REG);
fix->ywrapstep = 0;
fix->line_length = p->var.xres_virtual / 8;
return 0;
} }
static int vga16fb_get_var(struct fb_var_screeninfo *var, int con, /* Set the Set/Reset Register. */
struct fb_info *info) static inline void setcolor(int color)
{ {
if(con==-1) outb(SET_RESET_INDEX, GRAPHICS_ADDR_REG);
memcpy(var, &vga16fb_defined, sizeof(struct fb_var_screeninfo)); 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 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; 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; struct display *display;
if (con < 0) display = (con < 0) ? info->disp : fb_display + con;
display = &disp;
else
display = fb_display + con;
if (con != info->currcon) {
vga16fb_get_fix(&fix, con, &info->fb_info); display->dispsw = &fbcon_dummy;
return;
display->visual = fix.visual; }
display->type = fix.type;
display->type_aux = fix.type_aux; if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR ||
display->ypanstep = fix.ypanstep; info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
display->ywrapstep = fix.ywrapstep; display->can_soft_blank = info->fbops->fb_blank ? 1 : 0;
display->line_length = fix.line_length; display->dispsw_data = NULL;
display->next_line = fix.line_length; } 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->can_soft_blank = 1;
display->inverse = 0; display->inverse = 0;
if (info->isVGA) switch (info->fix.type) {
display->dispsw = &fbcon_vga_planes; #ifdef FBCON_HAS_VGA_PLANES
else case FB_TYPE_VGA_PLANES:
display->dispsw = &fbcon_ega_planes; if (info->fix.type_aux == FB_AUX_VGA_PLANES_VGA4) {
display->scrollmode = SCROLL_YREDRAW; display->dispsw = &fbcon_vga_planes;
} } else
display->dispsw = &fbcon_vga8_planes;
static void vga16fb_encode_var(struct fb_var_screeninfo *var, break;
const struct vga16fb_par *par, #endif
const struct vga16fb_info *info) #ifdef FBCON_HAS_VGA
{ case FB_TYPE_TEXT:
*var = par->var; 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, static void vga16fb_clock_chip(struct vga16fb_par *par,
unsigned int pixclock, unsigned int pixclock,
const struct vga16fb_info *info) const struct fb_info *info,
int mul, int div)
{ {
static struct { static struct {
u32 pixclock; u32 pixclock;
...@@ -214,6 +325,7 @@ static void vga16fb_clock_chip(struct vga16fb_par *par, ...@@ -214,6 +325,7 @@ static void vga16fb_clock_chip(struct vga16fb_par *par,
{ 0 /* bad */, 0x00, 0x00}}; { 0 /* bad */, 0x00, 0x00}};
int err; int err;
pixclock = (pixclock * mul) / div;
best = vgaclocks; best = vgaclocks;
err = pixclock - best->pixclock; err = pixclock - best->pixclock;
if (err < 0) err = -err; if (err < 0) err = -err;
...@@ -228,25 +340,90 @@ static void vga16fb_clock_chip(struct vga16fb_par *par, ...@@ -228,25 +340,90 @@ static void vga16fb_clock_chip(struct vga16fb_par *par,
} }
} }
par->misc |= best->misc; par->misc |= best->misc;
par->seq[VGA_SEQ_CLOCK_MODE] |= best->seq_clock_mode; par->clkdiv = best->seq_clock_mode;
par->var.pixclock = best->pixclock; pixclock = (best->pixclock * div) / mul;
} }
#define FAIL(X) return -EINVAL #define FAIL(X) return -EINVAL
static int vga16fb_decode_var(const struct fb_var_screeninfo *var, #define MODE_SKIP4 1
struct vga16fb_par *par, #define MODE_8BPP 2
const struct vga16fb_info *info) #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 xres, right, hslen, left, xtotal;
u32 yres, lower, vslen, upper, ytotal; u32 yres, lower, vslen, upper, ytotal;
u32 vxres, xoffset, vyres, yoffset; u32 vxres, xoffset, vyres, yoffset;
u32 pos; u32 pos;
u8 r7, rMode; u8 r7, rMode;
int i; int shift;
int mode;
if (var->bits_per_pixel != 4) 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; return -EINVAL;
xres = (var->xres + 7) & ~7; xres = (var->xres + 7) & ~7;
vxres = (var->xres_virtual + 0xF) & ~0xF; vxres = (var->xres_virtual + 0xF) & ~0xF;
xoffset = (var->xoffset + 7) & ~7; xoffset = (var->xoffset + 7) & ~7;
...@@ -259,18 +436,18 @@ static int vga16fb_decode_var(const struct fb_var_screeninfo *var, ...@@ -259,18 +436,18 @@ static int vga16fb_decode_var(const struct fb_var_screeninfo *var,
if (xres + xoffset > vxres) if (xres + xoffset > vxres)
xoffset = vxres - xres; xoffset = vxres - xres;
par->var.xres = xres; var->xres = xres;
par->var.right_margin = right; var->right_margin = right;
par->var.hsync_len = hslen; var->hsync_len = hslen;
par->var.left_margin = left; var->left_margin = left;
par->var.xres_virtual = vxres; var->xres_virtual = vxres;
par->var.xoffset = xoffset; var->xoffset = xoffset;
xres >>= 3; xres >>= shift;
right >>= 3; right >>= shift;
hslen >>= 3; hslen >>= shift;
left >>= 3; left >>= shift;
vxres >>= 3; vxres >>= shift;
xtotal = xres + right + hslen + left; xtotal = xres + right + hslen + left;
if (xtotal >= 256) if (xtotal >= 256)
FAIL("xtotal too big"); FAIL("xtotal too big");
...@@ -299,19 +476,19 @@ static int vga16fb_decode_var(const struct fb_var_screeninfo *var, ...@@ -299,19 +476,19 @@ static int vga16fb_decode_var(const struct fb_var_screeninfo *var,
if (yres > vyres) if (yres > vyres)
vyres = yres; vyres = yres;
if (vxres * vyres > 65536) { if (vxres * vyres > maxmem) {
vyres = 65536 / vxres; vyres = maxmem / vxres;
if (vyres < yres) if (vyres < yres)
return -ENOMEM; return -ENOMEM;
} }
if (yoffset + yres > vyres) if (yoffset + yres > vyres)
yoffset = vyres - yres; yoffset = vyres - yres;
par->var.yres = yres; var->yres = yres;
par->var.lower_margin = lower; var->lower_margin = lower;
par->var.vsync_len = vslen; var->vsync_len = vslen;
par->var.upper_margin = upper; var->upper_margin = upper;
par->var.yres_virtual = vyres; var->yres_virtual = vyres;
par->var.yoffset = yoffset; var->yoffset = yoffset;
if (var->vmode & FB_VMODE_DOUBLE) { if (var->vmode & FB_VMODE_DOUBLE) {
yres <<= 1; yres <<= 1;
...@@ -339,12 +516,13 @@ static int vga16fb_decode_var(const struct fb_var_screeninfo *var, ...@@ -339,12 +516,13 @@ static int vga16fb_decode_var(const struct fb_var_screeninfo *var,
if (ytotal & 0x200) r7 |= 0x20; if (ytotal & 0x200) r7 |= 0x20;
par->crtc[VGA_CRTC_PRESET_ROW] = 0; par->crtc[VGA_CRTC_PRESET_ROW] = 0;
par->crtc[VGA_CRTC_MAX_SCAN] = 0x40; /* 1 scanline, no linecmp */ par->crtc[VGA_CRTC_MAX_SCAN] = 0x40; /* 1 scanline, no linecmp */
par->var.vmode = var->vmode;
if (var->vmode & FB_VMODE_DOUBLE) if (var->vmode & FB_VMODE_DOUBLE)
par->crtc[VGA_CRTC_MAX_SCAN] |= 0x80; par->crtc[VGA_CRTC_MAX_SCAN] |= 0x80;
par->crtc[VGA_CRTC_CURSOR_START] = 0x20; par->crtc[VGA_CRTC_CURSOR_START] = 0x20;
par->crtc[VGA_CRTC_CURSOR_END] = 0x00; 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_HI] = pos >> 8;
par->crtc[VGA_CRTC_START_LO] = pos & 0xFF; par->crtc[VGA_CRTC_START_LO] = pos & 0xFF;
par->crtc[VGA_CRTC_CURSOR_HI] = 0x00; par->crtc[VGA_CRTC_CURSOR_HI] = 0x00;
...@@ -372,170 +550,236 @@ static int vga16fb_decode_var(const struct fb_var_screeninfo *var, ...@@ -372,170 +550,236 @@ static int vga16fb_decode_var(const struct fb_var_screeninfo *var,
if (vxres >= 512) if (vxres >= 512)
FAIL("vxres too long"); FAIL("vxres too long");
par->crtc[VGA_CRTC_OFFSET] = vxres >> 1; par->crtc[VGA_CRTC_OFFSET] = vxres >> 1;
par->crtc[VGA_CRTC_UNDERLINE] = 0x1F; if (mode & MODE_SKIP4)
par->crtc[VGA_CRTC_MODE] = rMode | 0xE3; 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_LINE_COMPARE] = 0xFF;
par->crtc[VGA_CRTC_OVERFLOW] = r7; par->crtc[VGA_CRTC_OVERFLOW] = r7;
par->vss = 0x00; /* 3DA */ par->vss = 0x00; /* 3DA */
for (i = 0x00; i < 0x10; i++) par->misc = 0xE3; /* enable CPU, ports 0x3Dx, positive sync */
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;
if (var->sync & FB_SYNC_HOR_HIGH_ACT) if (var->sync & FB_SYNC_HOR_HIGH_ACT)
par->misc &= ~0x40; par->misc &= ~0x40;
if (var->sync & FB_SYNC_VERT_HIGH_ACT) if (var->sync & FB_SYNC_VERT_HIGH_ACT)
par->misc &= ~0x80; par->misc &= ~0x80;
par->seq[VGA_SEQ_CLOCK_MODE] = 0x01; par->mode = mode;
par->seq[VGA_SEQ_PLANE_WRITE] = 0x0F;
par->seq[VGA_SEQ_CHARACTER_MAP] = 0x00; if (mode & MODE_8BPP)
par->seq[VGA_SEQ_MEMORY_MODE] = 0x06; /* pixel clock == vga clock / 2 */
vga16fb_clock_chip(par, var->pixclock, info, 1, 2);
par->gdc[VGA_GFX_SR_VALUE] = 0x00; else
par->gdc[VGA_GFX_SR_ENABLE] = 0x0F; /* pixel clock == vga clock */
par->gdc[VGA_GFX_COMPARE_VALUE] = 0x00; vga16fb_clock_chip(par, var->pixclock, info, 1, 1);
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;
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; return 0;
} }
#undef FAIL #undef FAIL
static int vga16fb_set_par(const struct vga16fb_par *par, static void vga16fb_load_font(struct display* p) {
struct vga16fb_info *info) 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 */ /* Enable graphics register modification */
if (!info->isVGA) { if (!par->isVGA) {
outb(0x00, EGA_GFX_E0); vga_io_w(EGA_GFX_E0, 0x00);
outb(0x01, EGA_GFX_E1); vga_io_w(EGA_GFX_E1, 0x01);
} }
/* update misc output register */ /* update misc output register */
outb(par->misc, VGA_MIS_W); vga_io_w(VGA_MIS_W, par->misc);
/* synchronous reset on */ /* synchronous reset on */
outb(0x00, VGA_SEQ_I); vga_io_wseq(0x00, 0x01);
outb(0x01, VGA_SEQ_D);
if (par->isVGA)
vga_io_w(VGA_PEL_MSK, par->pel_msk);
/* write sequencer registers */ /* write sequencer registers */
outb(1, VGA_SEQ_I); vga_io_wseq(VGA_SEQ_CLOCK_MODE, seq[VGA_SEQ_CLOCK_MODE] | 0x20);
outb(par->seq[1] | 0x20, VGA_SEQ_D);
for (i = 2; i < VGA_SEQ_C; i++) { for (i = 2; i < VGA_SEQ_C; i++) {
outb(i, VGA_SEQ_I); vga_io_wseq(i, seq[i]);
outb(par->seq[i], VGA_SEQ_D);
} }
/* synchronous reset off */ /* synchronous reset off */
outb(0x00, VGA_SEQ_I); vga_io_wseq(0x00, 0x03);
outb(0x03, VGA_SEQ_D);
/* deprotect CRT registers 0-7 */ /* deprotect CRT registers 0-7 */
outb(0x11, VGA_CRT_IC); vga_io_wcrt(VGA_CRTC_V_SYNC_END, par->crtc[VGA_CRTC_V_SYNC_END]);
outb(par->crtc[0x11], VGA_CRT_DC);
/* write CRT registers */ /* write CRT registers */
for (i = 0; i < VGA_CRT_C; i++) { for (i = 0; i < VGA_CRTC_REGS; i++) {
outb(i, VGA_CRT_IC); vga_io_wcrt(i, par->crtc[i]);
outb(par->crtc[i], VGA_CRT_DC);
} }
/* write graphics controller registers */ /* write graphics controller registers */
for (i = 0; i < VGA_GFX_C; i++) { for (i = 0; i < VGA_GFX_C; i++) {
outb(i, VGA_GFX_I); vga_io_wgfx(i, gdc[i]);
outb(par->gdc[i], VGA_GFX_D);
} }
/* write attribute controller registers */ /* write attribute controller registers */
for (i = 0; i < VGA_ATT_C; i++) { for (i = 0; i < VGA_ATT_C; i++) {
inb_p(VGA_IS1_RC); /* reset flip-flop */ vga_io_r(VGA_IS1_RC); /* reset flip-flop */
outb_p(i, VGA_ATT_IW); vga_io_wattr(i, atc[i]);
outb_p(par->atc[i], VGA_ATT_IW);
} }
if (par->mode & MODE_TEXT)
vga16fb_load_font(p);
/* Wait for screen to stabilize. */ /* Wait for screen to stabilize. */
mdelay(50); mdelay(50);
outb(0x01, VGA_SEQ_I); vga_io_wseq(VGA_SEQ_CLOCK_MODE, seq[VGA_SEQ_CLOCK_MODE]);
outb(par->seq[1], VGA_SEQ_D);
inb(VGA_IS1_RC); vga_io_r(VGA_IS1_RC);
outb(0x20, VGA_ATT_IW); vga_io_w(VGA_ATT_IW, 0x20);
return 0; return 0;
} }
static int vga16fb_set_var(struct fb_var_screeninfo *var, int con, 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; struct display *display;
int err; int err;
if (con < 0) if (con < 0)
display = fb->disp; display = info->disp;
else else
display = fb_display + con; display = fb_display + con;
if ((err = vga16fb_decode_var(var, &par, info)) != 0) if ((err = vga16fb_check_var(var, info)) != 0)
return err; 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) { if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) {
u32 oldxres, oldyres, oldvxres, oldvyres, oldbpp; u32 oldxres, oldyres, oldvxres, oldvyres, oldbpp, oldnonstd;
oldxres = display->var.xres; oldxres = info->var.xres;
oldyres = display->var.yres; oldyres = info->var.yres;
oldvxres = display->var.xres_virtual; oldvxres = info->var.xres_virtual;
oldvyres = display->var.yres_virtual; oldvyres = info->var.yres_virtual;
oldbpp = display->var.bits_per_pixel; oldbpp = info->var.bits_per_pixel;
oldnonstd = info->var.nonstd;
display->var = *var; info->var = *var;
if (oldxres != var->xres || oldyres != var->yres || if (con == info->currcon)
oldvxres != var->xres_virtual || oldvyres != var->yres_virtual || vga16fb_set_par(info);
oldbpp != var->bits_per_pixel) {
vga16fb_set_disp(con, info); vga16fb_set_disp(con, info);
if (info->fb_info.changevar) if (oldxres != var->xres ||
info->fb_info.changevar(con); 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; return 0;
} }
...@@ -544,31 +788,13 @@ static void ega16_setpalette(int regno, unsigned red, unsigned green, unsigned b ...@@ -544,31 +788,13 @@ static void ega16_setpalette(int regno, unsigned red, unsigned green, unsigned b
static unsigned char map[] = { 000, 001, 010, 011 }; static unsigned char map[] = { 000, 001, 010, 011 };
int val; 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) if (regno >= 16)
return 1; return;
val = map[red>>14] | ((map[green>>14]) << 1) | ((map[blue>>14]) << 2);
*red = palette[regno].red; vga_io_r(VGA_IS1_RC); /* ! 0x3BA */
*green = palette[regno].green; vga_io_wattr(regno, val);
*blue = palette[regno].blue; vga_io_r(VGA_IS1_RC); /* some clones need it */
*transp = 0; vga_io_w(VGA_ATT_IW, 0x20); /* unblank screen */
return 0;
} }
static void vga16_setpalette(int regno, unsigned red, unsigned green, unsigned blue) 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 ...@@ -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, static int vga16fb_setcolreg(unsigned regno, unsigned red, unsigned green,
unsigned blue, unsigned transp, unsigned blue, unsigned transp,
struct fb_info *fb_info) struct fb_info *info)
{ {
struct vga16fb_par *par = (struct vga16fb_par *) info->par;
int gray; int gray;
/* /*
...@@ -592,53 +819,35 @@ static int vga16fb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -592,53 +819,35 @@ static int vga16fb_setcolreg(unsigned regno, unsigned red, unsigned green,
* != 0 for invalid regno. * != 0 for invalid regno.
*/ */
if (regno >= 16) if (regno >= 256)
return 1; return 1;
palette[regno].red = red; if (info->currcon < 0)
palette[regno].green = green; gray = info->disp->var.grayscale;
palette[regno].blue = blue;
if (fb_info->currcon < 0)
gray = disp.var.grayscale;
else else
gray = fb_display[fb_info->currcon].var.grayscale; gray = fb_display[info->currcon].var.grayscale;
if (gray) { if (gray) {
/* gray = 0.30*R + 0.59*G + 0.11*B */ /* gray = 0.30*R + 0.59*G + 0.11*B */
red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8; 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); vga16_setpalette(regno,red,green,blue);
else else
ega16_setpalette(regno,red,green,blue); 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; return 0;
} }
static int vga16fb_pan_display(struct fb_var_screeninfo *var, int con, static int vga16fb_pan_display(struct fb_var_screeninfo *var, int con,
struct fb_info *info) struct fb_info *info)
{ {
if (var->xoffset + fb_display[con].var.xres > fb_display[con].var.xres_virtual || if (var->xoffset + info->var.xres > info->var.xres_virtual ||
var->yoffset + fb_display[con].var.yres > fb_display[con].var.yres_virtual) var->yoffset + info->var.yres > info->var.yres_virtual)
return -EINVAL; return -EINVAL;
if (con == info->currcon) if (con == info->currcon)
vga16fb_pan_var(info, var); vga16fb_pan_var(info, var);
fb_display[con].var.xoffset = var->xoffset; info->var.xoffset = var->xoffset;
fb_display[con].var.yoffset = var->yoffset; info->var.yoffset = var->yoffset;
fb_display[con].var.vmode &= ~FB_VMODE_YWRAP; info->var.vmode &= ~FB_VMODE_YWRAP;
return 0; return 0;
} }
...@@ -646,59 +855,49 @@ static int vga16fb_pan_display(struct fb_var_screeninfo *var, int con, ...@@ -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 blanking code was originally by Huang shi chao, and modified by
Christoph Rimek (chrimek@toppoint.de) and todd j. derr Christoph Rimek (chrimek@toppoint.de) and todd j. derr
(tjd@barefoot.org) for Linux. */ (tjd@barefoot.org) for Linux. */
#define attrib_port 0x3c0 #define attrib_port VGA_ATC_IW
#define seq_port_reg 0x3c4 #define seq_port_reg VGA_SEQ_I
#define seq_port_val 0x3c5 #define seq_port_val VGA_SEQ_D
#define gr_port_reg 0x3ce #define gr_port_reg VGA_GFX_I
#define gr_port_val 0x3cf #define gr_port_val VGA_GFX_D
#define video_misc_rd 0x3cc #define video_misc_rd VGA_MIS_R
#define video_misc_wr 0x3c2 #define video_misc_wr VGA_MIS_W
#define vga_video_port_reg 0x3d4 #define vga_video_port_reg VGA_CRT_IC
#define vga_video_port_val 0x3d5 #define vga_video_port_val VGA_CRT_DC
static void vga_vesa_blank(struct vga16fb_info *info, int mode) static void vga_vesa_blank(struct vga16fb_par *par, int mode)
{ {
unsigned char SeqCtrlIndex; unsigned char SeqCtrlIndex;
unsigned char CrtCtrlIndex; unsigned char CrtCtrlIndex;
cli(); //cli();
SeqCtrlIndex = inb_p(seq_port_reg); SeqCtrlIndex = vga_io_r(seq_port_reg);
CrtCtrlIndex = inb_p(vga_video_port_reg); CrtCtrlIndex = vga_io_r(vga_video_port_reg);
/* save original values of VGA controller registers */ /* save original values of VGA controller registers */
if(!info->vesa_blanked) { if(!par->vesa_blanked) {
info->vga_state.CrtMiscIO = inb_p(video_misc_rd); par->vga_state.CrtMiscIO = vga_io_r(video_misc_rd);
sti(); //sti();
outb_p(0x00,vga_video_port_reg); /* HorizontalTotal */ par->vga_state.HorizontalTotal = vga_io_rcrt(0x00); /* HorizontalTotal */
info->vga_state.HorizontalTotal = inb_p(vga_video_port_val); par->vga_state.HorizDisplayEnd = vga_io_rcrt(0x01); /* HorizDisplayEnd */
outb_p(0x01,vga_video_port_reg); /* HorizDisplayEnd */ par->vga_state.StartHorizRetrace = vga_io_rcrt(0x04); /* StartHorizRetrace */
info->vga_state.HorizDisplayEnd = inb_p(vga_video_port_val); par->vga_state.EndHorizRetrace = vga_io_rcrt(0x05); /* EndHorizRetrace */
outb_p(0x04,vga_video_port_reg); /* StartHorizRetrace */ par->vga_state.Overflow = vga_io_rcrt(0x07); /* Overflow */
info->vga_state.StartHorizRetrace = inb_p(vga_video_port_val); par->vga_state.StartVertRetrace = vga_io_rcrt(0x10); /* StartVertRetrace */
outb_p(0x05,vga_video_port_reg); /* EndHorizRetrace */ par->vga_state.EndVertRetrace = vga_io_rcrt(0x11); /* EndVertRetrace */
info->vga_state.EndHorizRetrace = inb_p(vga_video_port_val); par->vga_state.ModeControl = vga_io_rcrt(0x17); /* ModeControl */
outb_p(0x07,vga_video_port_reg); /* Overflow */ par->vga_state.ClockingMode = vga_io_rseq(0x01); /* ClockingMode */
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);
} }
/* assure that video is enabled */ /* assure that video is enabled */
/* "0x20" is VIDEO_ENABLE_bit in register 01 of sequencer */ /* "0x20" is VIDEO_ENABLE_bit in register 01 of sequencer */
cli(); //cli();
outb_p(0x01,seq_port_reg); vga_io_wseq(0x01, par->vga_state.ClockingMode | 0x20);
outb_p(info->vga_state.ClockingMode | 0x20,seq_port_val);
/* test for vertical retrace in process.... */ /* test for vertical retrace in process.... */
if ((info->vga_state.CrtMiscIO & 0x80) == 0x80) if ((par->vga_state.CrtMiscIO & 0x80) == 0x80)
outb_p(info->vga_state.CrtMiscIO & 0xef,video_misc_wr); vga_io_w(video_misc_wr, par->vga_state.CrtMiscIO & 0xef);
/* /*
* Set <End of vertical retrace> to minimum (0) and * Set <End of vertical retrace> to minimum (0) and
...@@ -711,7 +910,7 @@ static void vga_vesa_blank(struct vga16fb_info *info, int mode) ...@@ -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(0x11,vga_video_port_reg); /* EndVertRetrace */
outb_p(0x40,vga_video_port_val); /* minimum (bits 0..3) */ outb_p(0x40,vga_video_port_val); /* minimum (bits 0..3) */
outb_p(0x07,vga_video_port_reg); /* Overflow */ 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) { if (mode & VESA_HSYNC_SUSPEND) {
...@@ -729,44 +928,44 @@ static void vga_vesa_blank(struct vga16fb_info *info, int mode) ...@@ -729,44 +928,44 @@ static void vga_vesa_blank(struct vga16fb_info *info, int mode)
/* restore both index registers */ /* restore both index registers */
outb_p(SeqCtrlIndex,seq_port_reg); outb_p(SeqCtrlIndex,seq_port_reg);
outb_p(CrtCtrlIndex,vga_video_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 SeqCtrlIndex;
unsigned char CrtCtrlIndex; unsigned char CrtCtrlIndex;
cli(); //cli();
SeqCtrlIndex = inb_p(seq_port_reg); SeqCtrlIndex = vga_io_r(seq_port_reg);
CrtCtrlIndex = inb_p(vga_video_port_reg); CrtCtrlIndex = vga_io_r(vga_video_port_reg);
/* restore original values of VGA controller registers */ /* restore original values of VGA controller registers */
outb_p(info->vga_state.CrtMiscIO,video_misc_wr); vga_io_w(video_misc_wr, par->vga_state.CrtMiscIO);
outb_p(0x00,vga_video_port_reg); /* HorizontalTotal */ /* HorizontalTotal */
outb_p(info->vga_state.HorizontalTotal,vga_video_port_val); vga_io_wcrt(0x00, par->vga_state.HorizontalTotal);
outb_p(0x01,vga_video_port_reg); /* HorizDisplayEnd */ /* HorizDisplayEnd */
outb_p(info->vga_state.HorizDisplayEnd,vga_video_port_val); vga_io_wcrt(0x01, par->vga_state.HorizDisplayEnd);
outb_p(0x04,vga_video_port_reg); /* StartHorizRetrace */ /* StartHorizRetrace */
outb_p(info->vga_state.StartHorizRetrace,vga_video_port_val); vga_io_wcrt(0x04, par->vga_state.StartHorizRetrace);
outb_p(0x05,vga_video_port_reg); /* EndHorizRetrace */ /* EndHorizRetrace */
outb_p(info->vga_state.EndHorizRetrace,vga_video_port_val); vga_io_wcrt(0x05, par->vga_state.EndHorizRetrace);
outb_p(0x07,vga_video_port_reg); /* Overflow */ /* Overflow */
outb_p(info->vga_state.Overflow,vga_video_port_val); vga_io_wcrt(0x07, par->vga_state.Overflow);
outb_p(0x10,vga_video_port_reg); /* StartVertRetrace */ /* StartVertRetrace */
outb_p(info->vga_state.StartVertRetrace,vga_video_port_val); vga_io_wcrt(0x10, par->vga_state.StartVertRetrace);
outb_p(0x11,vga_video_port_reg); /* EndVertRetrace */ /* EndVertRetrace */
outb_p(info->vga_state.EndVertRetrace,vga_video_port_val); vga_io_wcrt(0x11, par->vga_state.EndVertRetrace);
outb_p(0x17,vga_video_port_reg); /* ModeControl */ /* ModeControl */
outb_p(info->vga_state.ModeControl,vga_video_port_val); vga_io_wcrt(0x17, par->vga_state.ModeControl);
outb_p(0x01,seq_port_reg); /* ClockingMode */ /* ClockingMode */
outb_p(info->vga_state.ClockingMode,seq_port_val); vga_io_wseq(0x01, par->vga_state.ClockingMode);
/* restore index/control registers */ /* restore index/control registers */
outb_p(SeqCtrlIndex,seq_port_reg); vga_io_w(seq_port_reg, SeqCtrlIndex);
outb_p(CrtCtrlIndex,vga_video_port_reg); vga_io_w(vga_video_port_reg, CrtCtrlIndex);
sti(); //sti();
} }
static void vga_pal_blank(void) static void vga_pal_blank(void)
...@@ -782,50 +981,96 @@ 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 */ /* 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) { switch (blank) {
case 0: /* Unblank */ case 0: /* Unblank */
if (info->vesa_blanked) { if (par->vesa_blanked) {
vga_vesa_unblank(info); vga_vesa_unblank(par);
info->vesa_blanked = 0; par->vesa_blanked = 0;
} }
if (info->palette_blanked) { if (par->palette_blanked) {
do_install_cmap(fb_info->currcon, fb_info); do_install_cmap(info->currcon, info);
info->palette_blanked = 0; par->palette_blanked = 0;
} }
break; break;
case 1: /* blank */ case 1: /* blank */
vga_pal_blank(); vga_pal_blank();
info->palette_blanked = 1; par->palette_blanked = 1;
break; break;
default: /* VESA blanking */ default: /* VESA blanking */
vga_vesa_blank(info, blank-1); vga_vesa_blank(par, blank-1);
info->vesa_blanked = 1; par->vesa_blanked = 1;
break; break;
} }
return 0; 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 = { static struct fb_ops vga16fb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_get_fix = vga16fb_get_fix, .fb_set_var = vga16fb_set_var,
.fb_get_var = vga16fb_get_var, .fb_check_var = vga16fb_check_var,
.fb_set_var = vga16fb_set_var, .fb_set_par = vga16fb_set_par,
.fb_get_cmap = vga16fb_get_cmap, .fb_get_cmap = gen_get_cmap,
.fb_set_cmap = gen_set_cmap, .fb_set_cmap = gen_set_cmap,
.fb_setcolreg = vga16fb_setcolreg, .fb_setcolreg = vga16fb_setcolreg,
.fb_pan_display =vga16fb_pan_display, .fb_pan_display = vga16fb_pan_display,
.fb_blank = vga16fb_blank, .fb_blank = vga16fb_blank,
.fb_imageblit = vga16fb_imageblit,
}; };
int vga16fb_setup(char *options) int vga16fb_setup(char *options)
{ {
char *this_opt; char *this_opt;
vga16fb.fb_info.fontname[0] = '\0'; vga16fb.fontname[0] = '\0';
if (!options || !*options) if (!options || !*options)
return 0; return 0;
...@@ -834,95 +1079,70 @@ int vga16fb_setup(char *options) ...@@ -834,95 +1079,70 @@ int vga16fb_setup(char *options)
if (!*this_opt) continue; if (!*this_opt) continue;
if (!strncmp(this_opt, "font:", 5)) if (!strncmp(this_opt, "font:", 5))
strcpy(vga16fb.fb_info.fontname, this_opt+5); strcpy(vga16fb.fontname, this_opt+5);
} }
return 0; 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 __init vga16fb_init(void)
{ {
int i,j; int i;
printk(KERN_DEBUG "vga16fb: initializing\n"); printk(KERN_DEBUG "vga16fb: initializing\n");
/* XXX share VGA_FB_PHYS region with vgacon */ /* XXX share VGA_FB_PHYS region with vgacon */
vga16fb.video_vbase = ioremap(VGA_FB_PHYS, VGA_FB_PHYS_LEN); vga16fb.screen_base = ioremap(VGA_FB_PHYS, VGA_FB_PHYS_LEN);
if (!vga16fb.video_vbase) { if (!vga16fb.screen_base) {
printk(KERN_ERR "vga16fb: unable to map device\n"); printk(KERN_ERR "vga16fb: unable to map device\n");
return -ENOMEM; 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; vga16_par.isVGA = ORIG_VIDEO_ISVGA;
vga16fb.palette_blanked = 0; vga16_par.palette_blanked = 0;
vga16fb.vesa_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.red.length = i;
vga16fb_defined.green.length = i; vga16fb_defined.green.length = i;
vga16fb_defined.blue.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 */ /* XXX share VGA I/O region with vgacon and others */
disp.var = vga16fb_defined; disp.var = vga16fb_defined;
/* name should not depend on EGA/VGA */ /* name should not depend on EGA/VGA */
strcpy(vga16fb.fb_info.modename, "VGA16 VGA"); strcpy(vga16fb.modename, "VGA16 VGA");
vga16fb.fb_info.changevar = NULL; vga16fb.changevar = NULL;
vga16fb.fb_info.node = NODEV; vga16fb.node = NODEV;
vga16fb.fb_info.fbops = &vga16fb_ops; vga16fb.fbops = &vga16fb_ops;
vga16fb.fb_info.screen_base = vga16fb.video_vbase; vga16fb.var = vga16fb_defined;
vga16fb.fb_info.disp=&disp; vga16fb.fix = vga16fb_fix;
vga16fb.fb_info.currcon = -1; vga16fb.par = &vga16_par;
vga16fb.fb_info.switch_con=&vga16fb_switch; vga16fb.disp = &disp;
vga16fb.fb_info.updatevar=&vga16fb_update_var; vga16fb.currcon = -1;
vga16fb.fb_info.flags=FBINFO_FLAG_DEFAULT; vga16fb.switch_con = gen_switch;
vga16fb.updatevar=&vga16fb_update_var;
vga16fb.flags=FBINFO_FLAG_DEFAULT;
vga16fb_set_disp(-1, &vga16fb); vga16fb_set_disp(-1, &vga16fb);
if (register_framebuffer(&vga16fb.fb_info)<0) { if (register_framebuffer(&vga16fb) < 0) {
iounmap(vga16fb.video_vbase); iounmap(vga16fb.screen_base);
return -EINVAL; return -EINVAL;
} }
printk(KERN_INFO "fb%d: %s frame buffer device\n", 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; return 0;
} }
static void __exit vga16fb_exit(void) static void __exit vga16fb_exit(void)
{ {
unregister_framebuffer(&vga16fb.fb_info); unregister_framebuffer(&vga16fb);
iounmap(vga16fb.video_vbase); iounmap(vga16fb.screen_base);
/* XXX unshare VGA regions */ /* XXX unshare VGA regions */
} }
......
...@@ -180,6 +180,13 @@ static const char __init *vgacon_startup(void) ...@@ -180,6 +180,13 @@ static const char __init *vgacon_startup(void)
#endif #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_lines = ORIG_VIDEO_LINES;
vga_video_num_columns = ORIG_VIDEO_COLS; vga_video_num_columns = ORIG_VIDEO_COLS;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <linux/tty.h> #include <linux/tty.h>
#include <asm/types.h> #include <asm/types.h>
#include <asm/io.h>
/* Definitions of frame buffers */ /* Definitions of frame buffers */
...@@ -264,10 +265,10 @@ struct fb_vblank { ...@@ -264,10 +265,10 @@ struct fb_vblank {
struct fb_copyarea { struct fb_copyarea {
__u32 sx; /* screen-relative */ __u32 sx; /* screen-relative */
__u32 sy; __u32 sy;
__u32 width;
__u32 height;
__u32 dx; __u32 dx;
__u32 dy; __u32 dy;
__u32 width;
__u32 height;
}; };
struct fb_fillrect { struct fb_fillrect {
...@@ -280,10 +281,10 @@ struct fb_fillrect { ...@@ -280,10 +281,10 @@ struct fb_fillrect {
}; };
struct fb_image { struct fb_image {
__u32 dx; /* Where to place image */
__u32 dy;
__u32 width; /* Size of image */ __u32 width; /* Size of image */
__u32 height; __u32 height;
__u16 dx; /* Where to place image */
__u16 dy;
__u32 fg_color; /* Only used when a mono bitmap */ __u32 fg_color; /* Only used when a mono bitmap */
__u32 bg_color; __u32 bg_color;
__u8 depth; /* Dpeth of the image */ __u8 depth; /* Dpeth of the image */
...@@ -319,12 +320,6 @@ struct fb_ops { ...@@ -319,12 +320,6 @@ struct fb_ops {
/* set settable parameters */ /* set settable parameters */
int (*fb_set_var)(struct fb_var_screeninfo *var, int con, int (*fb_set_var)(struct fb_var_screeninfo *var, int con,
struct fb_info *info); 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);
/* checks var and creates a par based on it */ /* checks var and creates a par based on it */
int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info); int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info);
/* set the video mode according to par */ /* set the video mode according to par */
...@@ -354,7 +349,6 @@ struct fb_ops { ...@@ -354,7 +349,6 @@ struct fb_ops {
}; };
struct fb_info { struct fb_info {
char modename[40]; /* default video mode */
kdev_t node; kdev_t node;
int flags; int flags;
int open; /* Has this been open already ? */ int open; /* Has this been open already ? */
...@@ -365,17 +359,11 @@ struct fb_info { ...@@ -365,17 +359,11 @@ struct fb_info {
struct fb_cmap cmap; /* Current cmap */ struct fb_cmap cmap; /* Current cmap */
struct fb_ops *fbops; struct fb_ops *fbops;
char *screen_base; /* Virtual address */ char *screen_base; /* Virtual address */
struct display *disp; /* initial display variable */
struct vc_data *display_fg; /* Console visible on this display */ struct vc_data *display_fg; /* Console visible on this display */
int currcon; /* Current VC. */ int currcon; /* Current VC. */
char fontname[40]; /* default font name */ char fontname[40]; /* default font name */
devfs_handle_t devfs_handle; /* Devfs handle for new name */ devfs_handle_t devfs_handle; /* Devfs handle for new name */
devfs_handle_t devfs_lhandle; /* Devfs handle for compat. symlink */ 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 void *pseudo_palette; /* Fake palette of 16 colors and
the cursor's color for non the cursor's color for non
palette mode */ palette mode */
...@@ -387,6 +375,42 @@ struct fb_info { ...@@ -387,6 +375,42 @@ struct fb_info {
#define FBINFO_FLAG_DEFAULT FBINFO_FLAG_MODULE #define FBINFO_FLAG_DEFAULT FBINFO_FLAG_MODULE
#else #else
#define FBINFO_FLAG_DEFAULT 0 #define FBINFO_FLAG_DEFAULT 0
#endif
#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 #endif
/* /*
...@@ -395,14 +419,10 @@ struct fb_info { ...@@ -395,14 +419,10 @@ struct fb_info {
extern int gen_set_var(struct fb_var_screeninfo *var, int con, extern int gen_set_var(struct fb_var_screeninfo *var, int con,
struct fb_info *info); 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, extern int fb_pan_display(struct fb_var_screeninfo *var, int con,
struct fb_info *info); struct fb_info *info);
extern void cfb_fillrect(struct fb_info *info, struct fb_fillrect *rect); 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_copyarea(struct fb_info *info, struct fb_copyarea *area);
extern void cfb_imageblit(struct fb_info *info, struct fb_image *image); extern void cfb_imageblit(struct fb_info *info, struct fb_image *image);
/* /*
...@@ -412,7 +432,6 @@ extern void cfb_imageblit(struct fb_info *info, struct fb_image *image); ...@@ -412,7 +432,6 @@ extern void cfb_imageblit(struct fb_info *info, struct fb_image *image);
extern void do_install_cmap(int con, struct fb_info *info); extern void do_install_cmap(int con, struct fb_info *info);
extern int gen_update_var(int con, struct fb_info *info); extern int gen_update_var(int con, struct fb_info *info);
extern int fb_blank(int blank, 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 gen_set_disp(int con, struct fb_info *info);
/* drivers/video/fbmem.c */ /* drivers/video/fbmem.c */
......
/*
* 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 */
/*
* 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 */
/*
* 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 */
/*
* 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 */
/*
* 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 */
/*
* 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 */
/*
* 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 */
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#endif #endif
extern struct display_switch fbcon_vga_planes; extern struct display_switch fbcon_vga_planes;
extern struct display_switch fbcon_vga8_planes;
extern struct display_switch fbcon_ega_planes; extern struct display_switch fbcon_ega_planes;
extern void fbcon_vga_planes_setup(struct display *p); 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, extern void fbcon_vga_planes_bmove(struct display *p, int sy, int sx, int dy, int dx,
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <asm/io.h> #include <asm/io.h>
struct display;
/* /*
* `switch' for the Low Level Operations * `switch' for the Low Level Operations
...@@ -51,10 +52,6 @@ extern struct display_switch fbcon_dummy; ...@@ -51,10 +52,6 @@ extern struct display_switch fbcon_dummy;
struct display { struct display {
/* Filled in by the frame buffer device */ /* 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 can_soft_blank; /* zero if no hardware blanking */
u_short inverse; /* != 0 text black on white as default */ u_short inverse; /* != 0 text black on white as default */
struct display_switch *dispsw; /* low level operations */ struct display_switch *dispsw; /* low level operations */
...@@ -184,44 +181,6 @@ extern int set_all_vcs(int fbidx, struct fb_ops *fb, ...@@ -184,44 +181,6 @@ extern int set_all_vcs(int fbidx, struct fb_ops *fb,
/* Namespace consistency */ /* Namespace consistency */
#define SCROLL_YNOPARTIAL __SCROLL_YNOPARTIAL #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_clear(struct vc_data *, struct display *, int, int, int, int);
extern void fbcon_redraw_bmove(struct display *, int, int, int, int, int, int); extern void fbcon_redraw_bmove(struct display *, int, int, int, int, int, int);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment