diff --git a/drivers/video/Config.in b/drivers/video/Config.in index 135ff2828763d2b732c763bdb5a00e8621fc1ebe..952d044f354432a6585f731d77f7e1854b0ff2d8 100644 --- a/drivers/video/Config.in +++ b/drivers/video/Config.in @@ -273,8 +273,7 @@ if [ "$CONFIG_FB" = "y" ]; then "$CONFIG_FB_P9100" = "y" -o "$CONFIG_FB_ATY128" = "y" -o \ "$CONFIG_FB_RIVA" = "y" -o "$CONFIG_FB_RADEON" = "y" -o \ "$CONFIG_FB_SGIVW" = "y" -o "$CONFIG_FB_CYBER2000" = "y" -o \ - "$CONFIG_FB_SA1100" = "y" -o "$CONFIG_FB_SIS" = "y" -o \ - "$CONFIG_FB_PMAG_BA" = "y" -o "$CONFIG_FB_PMAGB_B" = "y" ]; then + "$CONFIG_FB_SA1100" = "y" -o "$CONFIG_FB_SIS" = "y" ]; then define_tristate CONFIG_FBCON_CFB8 y else if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_ATARI" = "m" -o \ @@ -291,7 +290,6 @@ if [ "$CONFIG_FB" = "y" ]; then "$CONFIG_FB_P9100" = "m" -o "$CONFIG_FB_ATY128" = "m" -o \ "$CONFIG_FB_RIVA" = "m" -o "$CONFIG_FB_TX3912" = "m" -o \ "$CONFIG_FB_SGIVW" = "m" -o "$CONFIG_FB_CYBER2000" = "m" -o \ - "$CONFIG_FB_PMAG_BA" = "m" -o "$CONFIG_FB_PMAGB_B" = "m" -o \ "$CONFIG_FB_SA1100" = "m" -o "$CONFIG_FB_RADEON" = "m" ]; then define_tristate CONFIG_FBCON_CFB8 m fi @@ -370,7 +368,8 @@ if [ "$CONFIG_FB" = "y" ]; then "$CONFIG_FB_HP300" = "y" -o "$CONFIG_FB_Q40" = "y" -o \ "$CONFIG_FB_ANAKIN" = "y" -o "$CONFIG_FB_G364" = "y" -o \ "$CONFIG_FB_VIRTUAL" = "y" -o "$CONFIG_FB_CLPS711X" = "y" -o \ - "$CONFIG_FB_3DFX" = "y" -o "$CONFIG_FB_APOLLO" = "y" -o + "$CONFIG_FB_3DFX" = "y" -o "$CONFIG_FB_APOLLO" = "y" -o \ + "$CONFIG_FB_PMAG_BA" = "y" -o "$CONFIG_FB_PMAGB_B" = "y" -o \ "$CONFIG_FB_MAXINE" = "y" ]; then define_tristate CONFIG_FBCON_ACCEL y else diff --git a/drivers/video/Makefile b/drivers/video/Makefile index de6b0a632308cff2610b0d7eb5ffdd1bde005550..1831e5fa78ce1f471a4a4d9ab761f950fb37b57b 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -7,13 +7,18 @@ mod-subdirs := matrox # All of the (potential) objects that export symbols. # This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'. -export-objs := fbmem.o fbcmap.o fbcon.o fbmon.o modedb.o \ - fbcon-afb.o fbcon-ilbm.o fbcon-accel.o \ - fbcon-vga.o fbcon-iplan2p2.o fbcon-iplan2p4.o \ - fbcon-iplan2p8.o fbcon-vga-planes.o fbcon-cfb16.o \ - fbcon-cfb2.o fbcon-cfb24.o fbcon-cfb32.o fbcon-cfb4.o \ - fbcon-cfb8.o fbcon-mac.o fbcon-mfb.o \ - cyber2000fb.o sa1100fb.o fbcon-hga.o fbgen.o +export-objs := fbmem.o fbcmap.o fbcon.o fbmon.o modedb.o \ + fbcon-afb.o fbcon-ilbm.o fbcon-accel.o \ + fbcon-vga.o fbcon-iplan2p2.o fbcon-iplan2p4.o \ + fbcon-iplan2p8.o fbcon-vga-planes.o fbcon-cfb16.o \ + fbcon-cfb2.o fbcon-cfb24.o fbcon-cfb32.o fbcon-cfb4.o \ + fbcon-cfb8.o fbcon-mac.o fbcon-mfb.o \ + cyber2000fb.o sa1100fb.o fbcon-hga.o fbgen.o + +obj-y := +obj-m := +obj-n := +obj- := # Each configuration option enables a list of files. diff --git a/drivers/video/anakinfb.c b/drivers/video/anakinfb.c index 9de8c631c64e720efcb42685ee9ba760d6537d52..3206f467426aaccd703216f065a83cbc948f3c34 100644 --- a/drivers/video/anakinfb.c +++ b/drivers/video/anakinfb.c @@ -83,7 +83,8 @@ anakinfb_init(void) memset(&display, 0, sizeof(struct display)); strcpy(fb_info.modename, anakinfb_fix.id); - fb_info.node = fb_info.currcon = -1; + fb_info.node = NODEV; + fb_info.currcon = -1; fb_info.flags = FBINFO_FLAG_DEFAULT; fb_info.fbops = &anakinfb_ops; fb_info.var = anakinfb_var; diff --git a/drivers/video/aty128fb.c b/drivers/video/aty128fb.c index a4c741f5f9aae5f3e4a7f61e8f3f40d4166b157f..7ea055b22928313fb2985e952a19319401ce9ba3 100644 --- a/drivers/video/aty128fb.c +++ b/drivers/video/aty128fb.c @@ -1659,7 +1659,7 @@ aty128_init(struct fb_info_aty128 *info, const char *name) { struct fb_var_screeninfo var; u32 dac; - int j, k; + int j, k, size; u8 chip_rev; const struct aty128_chip_info *aci = &aty128_pci_probe_list[0]; char *video_card = "Rage128"; @@ -1772,6 +1772,9 @@ aty128_init(struct fb_info_aty128 *info, const char *name) board_list = aty128_board_list_add(board_list, info); + size = (fb_display[con].var.bits_per_pixel <= 8) ? 256 : 32; + fb_alloc_cmap(info->fb_info.cmap, size, 0); + if (register_framebuffer(&info->fb_info) < 0) return 0; diff --git a/drivers/video/cfbcopyarea.c b/drivers/video/cfbcopyarea.c index 603afc5ae34c53f1448d8b3e971b71c0734509cb..5240cbd37ffaee27f85910c17180711ceb5eda54 100644 --- a/drivers/video/cfbcopyarea.c +++ b/drivers/video/cfbcopyarea.c @@ -31,7 +31,7 @@ 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 n, 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 *dst = NULL, *src = NULL; char *src1, *dst1; @@ -102,7 +102,7 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) end_mask = -1 << ((bpl - end_index) << 3); n -= end_index; } - n = n / bpl; + n /= bpl; if (n <= 0) { if (start_mask) { diff --git a/drivers/video/cfbimgblt.c b/drivers/video/cfbimgblt.c index 38d7f0a3cb8247f6701ac699b099c03c84f9e33f..9f68bd324f520cd5e52d1bab6aa8e23827e3074a 100644 --- a/drivers/video/cfbimgblt.c +++ b/drivers/video/cfbimgblt.c @@ -112,7 +112,7 @@ void cfb_imageblit(struct fb_info *p, struct fb_image *image) end_mask = 0; if (test_bit(l, src)) - end_mask |= (tmp >> (p->var.bits_per_pixel*(k-1))); + end_mask |= (tmp >> (p->var.bits_per_pixel*(j-1))); l--; if (l < 0) { l = 7; src++; } } @@ -125,9 +125,6 @@ void cfb_imageblit(struct fb_info *p, struct fb_image *image) } else { /* Draw the penguin */ n = ((image->width * p->var.bits_per_pixel) >> 3); - //shift = ((unsigned long) dst1 & (bpl -1)); end_mask = 0; - - // n = n/bpl; } } diff --git a/drivers/video/maxinefb.c b/drivers/video/maxinefb.c index 465c8b1e90f4475d1dabaf88c119c5f595e047c1..081bbc442e3bc1b50e4dbee347d2aff38b965cf5 100644 --- a/drivers/video/maxinefb.c +++ b/drivers/video/maxinefb.c @@ -41,13 +41,8 @@ /* whether are really running on a maxine, KM */ #include <asm/bootinfo.h> -#define arraysize(x) (sizeof(x)/sizeof(*(x))) - -static struct display disp; static struct fb_info fb_info; - -unsigned long fb_regs; -unsigned char fb_bitmask; +static struct display disp; static struct fb_var_screeninfo maxinefb_defined = { xres: 1024, @@ -108,10 +103,9 @@ static int maxinefb_setcolreg(unsigned regno, unsigned red, unsigned green, green >>= 8; /* wide, but the harware colormap */ blue >>= 8; /* registers are only 8 bits wide */ - hw_colorvalue = - (blue << 16) + (green << 8) + (red); - maxinefb_ims332_write_register(IMS332_REG_COLOR_PALETTE + - regno, + hw_colorvalue = (blue << 16) + (green << 8) + (red); + + maxinefb_ims332_write_register(IMS332_REG_COLOR_PALETTE + regno, hw_colorvalue); return 0; } @@ -179,6 +173,7 @@ int __init maxinefb_init(void) fb_info.updatevar = gen_update_var; fb_info.flags = FBINFO_FLAG_DEFAULT; + fb_alloc_cmap(&fb_info.cmap, 256, 0); gen_set_disp(-1, &fb_info); if (register_framebuffer(&fb_info) < 0) diff --git a/drivers/video/pmag-ba-fb.c b/drivers/video/pmag-ba-fb.c index 535c44df38cb993b9d60a0620aa5e2a31cb02478..5bea6b7eecb4c2bd3bd8dd19c9ec8b100e4587ea 100644 --- a/drivers/video/pmag-ba-fb.c +++ b/drivers/video/pmag-ba-fb.c @@ -37,12 +37,6 @@ #include "pmag-ba-fb.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> - -#define arraysize(x) (sizeof(x)/sizeof(*(x))) struct pmag_ba_ramdac_regs { unsigned char addr_low; @@ -54,316 +48,119 @@ struct pmag_ba_ramdac_regs { unsigned char cmap; }; -struct pmag_ba_my_fb_info { - struct fb_info info; - struct pmag_ba_ramdac_regs *bt459_regs; - unsigned long pmagba_fb_start; - unsigned long pmagba_fb_size; - unsigned long pmagba_fb_line_length; -}; - -static struct display disp; /* * Max 3 TURBOchannel slots -> max 3 PMAG-BA :) */ -static struct pmag_ba_my_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 = { - 0, 0, 0, 0, /* W,H, W, H (virtual) load xres,xres_virtual */ - 0, 0, /* virtual -> visible no offset */ - 0, /* depth -> load bits_per_pixel */ - 0, /* greyscale ? */ - {0, 0, 0}, /* R */ - {0, 0, 0}, /* G */ - {0, 0, 0}, /* B */ - {0, 0, 0}, /* transparency */ - 0, /* standard pixel format */ - FB_ACTIVATE_NOW, - 274, 195, /* 14" monitor */ - FB_ACCEL_NONE, - 0L, 0L, 0L, 0L, 0L, - 0L, 0L, 0, /* No sync info */ - FB_VMODE_NONINTERLACED, - {0, 0, 0, 0, 0, 0} -}; - -struct pmagbafb_par { -}; - -struct pmagbafb_par current_par; - -static void pmagbafb_encode_var(struct fb_var_screeninfo *var, - struct pmagbafb_par *par) -{ - int i = 0; - var->xres = 1024; - var->yres = 864; - var->xres_virtual = 1024; - var->yres_virtual = 864; - var->xoffset = 0; - var->yoffset = 0; - var->bits_per_pixel = 8; - var->grayscale = 0; - var->transp.offset = 0; - var->transp.length = 0; - var->transp.msb_right = 0; - var->nonstd = 0; - var->activate = 1; - var->height = -1; - var->width = -1; - var->vmode = FB_VMODE_NONINTERLACED; - var->pixclock = 0; - var->sync = 0; - var->left_margin = 0; - var->right_margin = 0; - var->upper_margin = 0; - var->lower_margin = 0; - var->hsync_len = 0; - var->vsync_len = 0; - for (i = 0; i < arraysize(var->reserved); i++) - var->reserved[i] = 0; -} - -static void pmagbafb_get_par(struct pmagbafb_par *par) -{ - *par = current_par; -} - -static int pmagba_fb_update_var(int con, struct fb_info *info) -{ - return 0; -} - -static int pmagba_do_fb_set_var(struct fb_var_screeninfo *var, - int isactive) -{ - struct pmagbafb_par par; - - pmagbafb_get_par(&par); - pmagbafb_encode_var(var, &par); - return 0; + xres: 1024, + yres: 864, + xres_virtual: 1024, + yres_virtual: 864, + bits_per_pixel: 8, + activate: FB_ACTIVATE_NOW, + height: 274, + width: 195, + accel: FB_ACCEL_NONE, + vmode: FB_VMODE_NONINTERLACED, +} + +static struct fb_fix_screeninfo pmagbafb_fix = { + id: "PMAG-BA", + smem_len: (1024 * 864), + type: FB_TYPE_PACKED_PIXELS, + visual: FB_VISUAL_PSEUDOCOLOR, + line_length: 1024, } /* * Turn hardware cursor off */ -void pmagbafb_erase_cursor(struct pmag_ba_my_fb_info *info) -{ - info->bt459_regs->addr_low = 0; - info->bt459_regs->addr_hi = 3; - info->bt459_regs->data = 0; -} - -/* - * Write to a Bt459 color map register - */ -void pmag_ba_bt459_write_colormap(struct pmag_ba_my_fb_info *info, - int reg, __u8 red, __u8 green, __u8 blue) -{ - info->bt459_regs->addr_low = (__u8) reg; - info->bt459_regs->addr_hi = 0; - info->bt459_regs->cmap = red; - info->bt459_regs->cmap = green; - info->bt459_regs->cmap = blue; -} - -/* - * Get the palette - */ - -static int pmagbafb_get_cmap(struct fb_cmap *cmap, int kspc, int con, - struct fb_info *info) +void pmagbafb_erase_cursor(struct pmag_ba_ramdac_regs *bt459_regs) { - unsigned int i; - unsigned int length; - - if (((cmap->start) + (cmap->len)) >= 256) { - length = 256 - (cmap->start); - } else { - length = cmap->len; - } - for (i = 0; i < length; i++) { - /* - * TODO - */ - } - return 0; + bt459_regs->addr_low = 0; + bt459_regs->addr_hi = 3; + bt459_regs->data = 0; } /* * Set the palette. */ -static int pmagbafb_set_cmap(struct fb_cmap *cmap, int kspc, int con, - struct fb_info *info) +static int pmagbafb_setcolreg(unsigned regno, unsigned red, unsigned green, + unsigned blue, unsigned transp, + struct fb_info *info) { - unsigned int i; - __u8 cmap_red, cmap_green, cmap_blue; - unsigned int length; - - if (((cmap->start) + (cmap->len)) >= 256) - length = 256 - (cmap->start); - else - length = cmap->len; + struct pmag_ba_ramdac_regs *bt459_regs = (struct pmag_ba_ramdac_regs *) info->par; - for (i = 0; i < length; i++) { - cmap_red = ((cmap->red[i]) >> 8); /* The cmap fields are 16 bits */ - cmap_green = ((cmap->green[i]) >> 8); /* wide, but the harware colormap */ - cmap_blue = ((cmap->blue[i]) >> 8); /* registers are only 8 bits wide */ - - pmag_ba_bt459_write_colormap((struct pmag_ba_my_fb_info *) - info, cmap->start + i, - cmap_red, cmap_green, - cmap_blue); - } - return 0; -} - -static int pmagbafb_get_var(struct fb_var_screeninfo *var, int con, - struct fb_info *info) -{ - struct pmagbafb_par par; - if (con == -1) { - pmagbafb_get_par(&par); - pmagbafb_encode_var(var, &par); - } else - *var = fb_display[con].var; - return 0; -} - - -static int pmagbafb_set_var(struct fb_var_screeninfo *var, int con, - struct fb_info *info) -{ - int err; - - if ((err = pmagba_do_fb_set_var(var, 1))) - return err; - return 0; -} - -static void pmagbafb_encode_fix(struct fb_fix_screeninfo *fix, - struct pmagbafb_par *par, - struct pmag_ba_my_fb_info *info) -{ - memset(fix, 0, sizeof(struct fb_fix_screeninfo)); - strcpy(fix->id, "PMAG-BA"); - - fix->smem_start = info->pmagba_fb_start; - fix->smem_len = info->pmagba_fb_size; - fix->type = FB_TYPE_PACKED_PIXELS; - fix->visual = FB_VISUAL_PSEUDOCOLOR; - fix->xpanstep = 0; - fix->ypanstep = 0; - fix->ywrapstep = 0; - fix->line_length = info->pmagba_fb_line_length; -} - -static int pmagbafb_get_fix(struct fb_fix_screeninfo *fix, int con, - struct fb_info *info) -{ - struct pmagbafb_par par; + if (regno >= info->cmap.len) + return 1; - pmagbafb_get_par(&par); - pmagbafb_encode_fix(fix, &par, (struct pmag_ba_my_fb_info *) info); + red >>= 8; /* The cmap fields are 16 bits */ + green >>= 8; /* wide, but the harware colormap */ + blue >>= 8; /* registers are only 8 bits wide */ + bt459_regs->addr_low = (__u8) regno; + bt459_regs->addr_hi = 0; + bt459_regs->cmap = red; + bt459_regs->cmap = green; + bt459_regs->cmap = blue; return 0; } -static int pmagbafb_switch(int con, struct fb_info *info) -{ - pmagba_do_fb_set_var(&fb_display[con].var, 1); - info->currcon = con; - return 0; -} - -static void pmagbafb_set_disp(int con, struct pmag_ba_my_fb_info *info) -{ - struct fb_fix_screeninfo fix; - struct display *display; - - if (con >= 0) - display = &fb_display[con]; - else - display = &disp; /* used during initialization */ - - pmagbafb_get_fix(&fix, con, (struct fb_info *) info); - - display->visual = fix.visual; - display->type = fix.type; - display->type_aux = fix.type_aux; - display->ypanstep = fix.ypanstep; - display->ywrapstep = fix.ywrapstep; - display->line_length = fix.line_length; - display->next_line = fix.line_length; - display->can_soft_blank = 0; - display->inverse = 0; - - display->dispsw = &fbcon_cfb8; -} - static struct fb_ops pmagbafb_ops = { owner: THIS_MODULE, - fb_get_fix: pmagbafb_get_fix, - fb_get_var: pmagbafb_get_var, - fb_set_var: pmagbafb_set_var, - fb_get_cmap: pmagbafb_get_cmap, - fb_set_cmap: pmagbafb_set_cmap, -}; + fb_get_fix: gen_get_fix, + fb_get_var: gen_get_var, + fb_set_var: gen_set_var, + fb_get_cmap: gen_get_cmap, + fb_set_cmap: gen_set_cmap, + fb_setcolreg: pmagbafb_setcolreg, + fb_fillrect: cfb_fillrect, + fb_copyarea: cfb_copyarea, + fb_imageblit: cfb_imageblit, +} int __init pmagbafb_init_one(int slot) { unsigned long base_addr = get_tc_base_addr(slot); - struct pmag_ba_my_fb_info *ip = - (struct pmag_ba_my_fb_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); - /* * Framebuffer display memory base address and friends */ - ip->bt459_regs = - (struct pmag_ba_ramdac_regs *) (base_addr + - PMAG_BA_BT459_OFFSET); - ip->pmagba_fb_start = base_addr + PMAG_BA_ONBOARD_FBMEM_OFFSET; - ip->pmagba_fb_size = 1024 * 864; - ip->pmagba_fb_line_length = 1024; + pmagbafb_fix.smem_start = base_addr + PMAG_BA_ONBOARD_FBMEM_OFFSET; + info->par = (base_addr + PMAG_BA_BT459_OFFSET); /* * Configure the Bt459 RAM DAC */ - pmagbafb_erase_cursor(ip); - - /* - * Fill in the available video resolution - */ - - pmagbafb_defined.xres = 1024; - pmagbafb_defined.yres = 864; - pmagbafb_defined.xres_virtual = 1024; - pmagbafb_defined.yres_virtual = 864; - pmagbafb_defined.bits_per_pixel = 8; + pmagbafb_erase_cursor((struct pmag_ba_ramdac_regs *) info->par); /* * Let there be consoles.. */ - strcpy(ip->info.modename, "PMAG-BA"); - ip->info.changevar = NULL; - ip->info.node = NODEV; - ip->info.fbops = &pmagbafb_ops; - ip->info.screen_base = ip->pmagba_fb_start; - ip->info.disp = &disp; - ip->info.currcon = -1; - ip->info.switch_con = &pmagbafb_switch; - ip->info.updatevar = &pmagba_fb_update_var; - ip->info.flags = FBINFO_FLAG_DEFAULT; - - pmagba_do_fb_set_var(&pmagbafb_defined, 1); - pmagbafb_get_var(&disp.var, -1, (struct fb_info *) ip); - pmagbafb_set_disp(-1, ip); + strcpy(info->modename, pmagbafb_fix.id); + info->changevar = NULL; + info->node = NODEV; + info->fbops = &pmagbafb_ops; + info->var = pmagbafb_defined; + info->fix = pmagbafb_fix; + info->screen_base = pmagbafb_fix.smem_start; + info->disp = &disp; + info->currcon = -1; + info->switch_con = gen_switch; + info->updatevar = gen_update_var; + info->flags = FBINFO_FLAG_DEFAULT; + + fb_alloc_cmap(&fb_info.cmap, 256, 0); + gen_set_disp(-1, info); - if (register_framebuffer((struct fb_info *) ip) < 0) + if (register_framebuffer(info) < 0) return 1; - return 0; } diff --git a/drivers/video/pmagb-b-fb.c b/drivers/video/pmagb-b-fb.c index 08e08b416288f829ad9ba0f2040f7af111fa09f6..8396ebf49a207c8f1dd2196b2a0503ee711fe273 100644 --- a/drivers/video/pmagb-b-fb.c +++ b/drivers/video/pmagb-b-fb.c @@ -40,12 +40,6 @@ #include "pmagb-b-fb.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> - -#define arraysize(x) (sizeof(x)/sizeof(*(x))) struct pmagb_b_ramdac_regs { unsigned char addr_low; @@ -57,317 +51,119 @@ struct pmagb_b_ramdac_regs { unsigned char cmap; }; -struct pmagb_b_my_fb_info { - struct fb_info info; - struct pmagb_b_ramdac_regs *bt459_regs; - unsigned long pmagbb_fb_start; - unsigned long pmagbb_fb_size; - unsigned long pmagbb_fb_line_length; -}; - -static struct display disp; /* * Max 3 TURBOchannel slots -> max 3 PMAGB-B :) */ -static struct pmagb_b_my_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 = { - 0, 0, 0, 0, /* W,H, W, H (virtual) load xres,xres_virtual */ - 0, 0, /* virtual -> visible no offset */ - 0, /* depth -> load bits_per_pixel */ - 0, /* greyscale ? */ - {0, 0, 0}, /* R */ - {0, 0, 0}, /* G */ - {0, 0, 0}, /* B */ - {0, 0, 0}, /* transparency */ - 0, /* standard pixel format */ - FB_ACTIVATE_NOW, - 274, 195, /* 14" monitor */ - FB_ACCEL_NONE, - 0L, 0L, 0L, 0L, 0L, - 0L, 0L, 0, /* No sync info */ - FB_VMODE_NONINTERLACED, - {0, 0, 0, 0, 0, 0} -}; - -struct pmagbbfb_par { + xres: 1280, + yres: 1024, + xres_virtual: 1280, + yres_virtual: 1024, + bits_per_pixel: 8, + activate: FB_ACTIVATE_NOW, + height: 274, + width: 195, + accel_flags: FB_ACCEL_NONE, + vmode: FB_VMODE_NONINTERLACED, }; -struct pmagbbfb_par current_par; - -static void pmagbbfb_encode_var(struct fb_var_screeninfo *var, - struct pmagbbfb_par *par) -{ - int i = 0; - var->xres = 1280; - var->yres = 1024; - var->xres_virtual = 1280; - var->yres_virtual = 1024; - var->xoffset = 0; - var->yoffset = 0; - var->bits_per_pixel = 8; - var->grayscale = 0; - var->transp.offset = 0; - var->transp.length = 0; - var->transp.msb_right = 0; - var->nonstd = 0; - var->activate = 1; - var->height = -1; - var->width = -1; - var->vmode = FB_VMODE_NONINTERLACED; - var->pixclock = 0; - var->sync = 0; - var->left_margin = 0; - var->right_margin = 0; - var->upper_margin = 0; - var->lower_margin = 0; - var->hsync_len = 0; - var->vsync_len = 0; - for (i = 0; i < arraysize(var->reserved); i++) - var->reserved[i] = 0; -} - -static void pmagbbfb_get_par(struct pmagbbfb_par *par) -{ - *par = current_par; -} - -static int pmagbb_fb_update_var(int con, struct fb_info *info) -{ - return 0; -} - -static int pmagbb_do_fb_set_var(struct fb_var_screeninfo *var, - int isactive) -{ - struct pmagbbfb_par par; - - pmagbbfb_get_par(&par); - pmagbbfb_encode_var(var, &par); - return 0; +static struct fb_fix_screeninfo pmagbafb_fix = { + id: "PMAGB-BA", + smem_len: (1280 * 1024), + type: FB_TYPE_PACKED_PIXELS, + visual: FB_VISUAL_PSEUDOCOLOR, + line_length: 1280, } /* * Turn hardware cursor off */ -void pmagbbfb_erase_cursor(struct pmagb_b_my_fb_info *info) +void pmagbbfb_erase_cursor(struct pmagb_b_ramdac_regs *bt459_regs) { - info->bt459_regs->addr_low = 0; - info->bt459_regs->addr_hi = 3; - info->bt459_regs->data = 0; -} - -/* - * Write to a Bt459 color map register - */ -void pmagb_b_bt459_write_colormap(struct pmagb_b_my_fb_info *info, - int reg, __u8 red, __u8 green, __u8 blue) -{ - info->bt459_regs->addr_low = (__u8) reg; - info->bt459_regs->addr_hi = 0; - info->bt459_regs->cmap = red; - info->bt459_regs->cmap = green; - info->bt459_regs->cmap = blue; -} - -/* - * Get the palette - */ - -static int pmagbbfb_get_cmap(struct fb_cmap *cmap, int kspc, int con, - struct fb_info *info) -{ - unsigned int i; - unsigned int length; - - if (((cmap->start) + (cmap->len)) >= 256) { - length = 256 - (cmap->start); - } else { - length = cmap->len; - } - for (i = 0; i < length; i++) { - /* - * TODO - */ - } - return 0; + bt459_regs->addr_low = 0; + bt459_regs->addr_hi = 3; + bt459_regs->data = 0; } /* * Set the palette. */ -static int pmagbbfb_set_cmap(struct fb_cmap *cmap, int kspc, int con, - struct fb_info *info) -{ - unsigned int i; - __u8 cmap_red, cmap_green, cmap_blue; - unsigned int length; - - if (((cmap->start) + (cmap->len)) >= 256) - length = 256 - (cmap->start); - else - length = cmap->len; - - for (i = 0; i < length; i++) { - cmap_red = ((cmap->red[i]) >> 8); /* The cmap fields are 16 bits */ - cmap_green = ((cmap->green[i]) >> 8); /* wide, but the harware colormap */ - cmap_blue = ((cmap->blue[i]) >> 8); /* registers are only 8 bits wide */ - - pmagb_b_bt459_write_colormap((struct pmagb_b_my_fb_info *) - info, cmap->start + i, - cmap_red, cmap_green, - cmap_blue); - } - return 0; -} - -static int pmagbbfb_get_var(struct fb_var_screeninfo *var, int con, - struct fb_info *info) -{ - struct pmagbbfb_par par; - if (con == -1) { - pmagbbfb_get_par(&par); - pmagbbfb_encode_var(var, &par); - } else - *var = fb_display[con].var; - return 0; -} - - -static int pmagbbfb_set_var(struct fb_var_screeninfo *var, int con, - struct fb_info *info) -{ - int err; - - if ((err = pmagbb_do_fb_set_var(var, 1))) - return err; - return 0; -} - -static void pmagbbfb_encode_fix(struct fb_fix_screeninfo *fix, - struct pmagbbfb_par *par, - struct pmagb_b_my_fb_info *info) -{ - memset(fix, 0, sizeof(struct fb_fix_screeninfo)); - strcpy(fix->id, "PMAGB-BA"); - - fix->smem_start = info->pmagbb_fb_start; - fix->smem_len = info->pmagbb_fb_size; - fix->type = FB_TYPE_PACKED_PIXELS; - fix->visual = FB_VISUAL_PSEUDOCOLOR; - fix->xpanstep = 0; - fix->ypanstep = 0; - fix->ywrapstep = 0; - fix->line_length = info->pmagbb_fb_line_length; -} - -static int pmagbbfb_get_fix(struct fb_fix_screeninfo *fix, int con, - struct fb_info *info) +static int pmagbbfb_setcolreg(unsigned regno, unsigned red, unsigned green, + unsigned blue, unsigned transp, + struct fb_info *info) { - struct pmagbbfb_par par; + struct pmagb_b_ramdac_regs *bt459_regs = (struct pmagb_b_ramdac_regs *) info->par; + + if (regno >= info->cmap.len) + return 1; - pmagbbfb_get_par(&par); - pmagbbfb_encode_fix(fix, &par, (struct pmagb_b_my_fb_info *) info); + red >>= 8; /* The cmap fields are 16 bits */ + green >>= 8; /* wide, but the harware colormap */ + blue >>= 8; /* registers are only 8 bits wide */ + bt459_regs->addr_low = (__u8) regno; + bt459_regs->addr_hi = 0; + bt459_regs->cmap = red; + bt459_regs->cmap = green; + bt459_regs->cmap = blue; return 0; } -static int pmagbbfb_switch(int con, struct fb_info *info) -{ - pmagbb_do_fb_set_var(&fb_display[con].var, 1); - info->currcon = con; - return 0; -} - -static void pmagbbfb_set_disp(int con, struct pmagb_b_my_fb_info *info) -{ - struct fb_fix_screeninfo fix; - struct display *display; - - if (con >= 0) - display = &fb_display[con]; - else - display = &disp; /* used during initialization */ - - pmagbbfb_get_fix(&fix, con, (struct fb_info *) info); - - display->visual = fix.visual; - display->type = fix.type; - display->type_aux = fix.type_aux; - display->ypanstep = fix.ypanstep; - display->ywrapstep = fix.ywrapstep; - display->line_length = fix.line_length; - display->next_line = fix.line_length; - display->can_soft_blank = 0; - display->inverse = 0; - - display->dispsw = &fbcon_cfb8; -} - static struct fb_ops pmagbbfb_ops = { owner: THIS_MODULE, - fb_get_fix: pmagbbfb_get_fix, - fb_get_var: pmagbbfb_get_var, - fb_set_var: pmagbbfb_set_var, - fb_get_cmap: pmagbbfb_get_cmap, - fb_set_cmap: pmagbbfb_set_cmap, + fb_get_fix: gen_get_fix, + fb_get_var: gen_get_var, + fb_set_var: gen_set_var, + fb_get_cmap: gen_get_cmap, + fb_set_cmap: gen_set_cmap, + fb_setcolreg: pmagbbfb_setcolreg, + fb_fillrect: cfb_fillrect, + fb_copyarea: cfb_copyarea, + fb_imageblit: cfb_imageblit, }; int __init pmagbbfb_init_one(int slot) { unsigned long base_addr = get_tc_base_addr(slot); - struct pmagb_b_my_fb_info *ip = - (struct pmagb_b_my_fb_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); - /* * Framebuffer display memory base address and friends */ - ip->bt459_regs = - (struct pmagb_b_ramdac_regs *) (base_addr + - PMAGB_B_BT459_OFFSET); - ip->pmagbb_fb_start = base_addr + PMAGB_B_ONBOARD_FBMEM_OFFSET; - ip->pmagbb_fb_size = 1280 * 1024; - ip->pmagbb_fb_line_length = 1280; - + pmagbbfb_fix.smem_start = base_addr + PMAGB_B_ONBOARD_FBMEM_OFFSET; + info->par = (base_addr + PMAGB_B_BT459_OFFSET); + /* * Configure the Bt459 RAM DAC */ - pmagbbfb_erase_cursor(ip); - - /* - * Fill in the available video resolution - */ - - pmagbbfb_defined.xres = 1280; - pmagbbfb_defined.yres = 1024; - pmagbbfb_defined.xres_virtual = 1280; - pmagbbfb_defined.yres_virtual = 1024; - pmagbbfb_defined.bits_per_pixel = 8; + pmagbbfb_erase_cursor((struct pmagb_b_ramdac_regs *) info->par); /* * Let there be consoles.. */ - strcpy(ip->info.modename, "PMAGB-BA"); - ip->info.changevar = NULL; - ip->info.node = NODEV; - ip->info.fbops = &pmagbbfb_ops; - ip->info.screen_base = (char *) ip->pmagbb_fb_start; - fix->smem_len = info->pmagbb_fb_size; - ip->info.disp = &disp; - ip->info.currcon = -1; - ip->info.switch_con = &pmagbbfb_switch; - ip->info.updatevar = &pmagbb_fb_update_var; - ip->info.flags = FBINFO_FLAG_DEFAULT; - - pmagbb_do_fb_set_var(&pmagbbfb_defined, 1); - pmagbbfb_get_var(&disp.var, -1, (struct fb_info *) ip); - pmagbbfb_set_disp(-1, ip); - - if (register_framebuffer((struct fb_info *) ip) < 0) + strcpy(info->modename, pmagbbfb_fix.id); + info->changevar = NULL; + info->node = NODEV; + info->fbops = &pmagbbfb_ops; + info->var = pmagbbfb_defined; + info->fix = pmagbbfb_fix; + info->screen_base = pmagbbfb_fix.smem_start; + info->disp = &disp; + info->currcon = -1; + info->switch_con = gen_switch; + info->updatevar = gen_update_var; + info->flags = FBINFO_FLAG_DEFAULT; + + fb_alloc_cmap(&fb_info.cmap, 256, 0); + gen_set_disp(-1, info); + + if (register_framebuffer(info) < 0) return 1; - return 0; } diff --git a/drivers/video/skeletonfb.c b/drivers/video/skeletonfb.c index 97571f74352bf8a89eab9220d4ea8d970153d4d3..0e231bc969ca1bdddefca9868539c0036cbb9709 100644 --- a/drivers/video/skeletonfb.c +++ b/drivers/video/skeletonfb.c @@ -298,7 +298,7 @@ static int xxxfb_setcolreg(unsigned regno, unsigned red, unsigned green, * Returns negative errno on error, or zero on success. * */ -static int xxxfb_pan_display(struct fb_var_screeninfo *var, +static int xxxfb_pan_display(struct fb_var_screeninfo *var, int con, const struct fb_info *info) { /* ... */ diff --git a/drivers/video/vfb.c b/drivers/video/vfb.c index 7edde06f69261350b01eef9dde2d07fc08aa7fa3..5c348a5914f097082cb219431438a57d4ba4b32c 100644 --- a/drivers/video/vfb.c +++ b/drivers/video/vfb.c @@ -90,7 +90,7 @@ static int vfb_check_var(struct fb_var_screeninfo *var, static int vfb_set_par(struct fb_info *info); static int vfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info); -static int vfb_pan_display(struct fb_var_screeninfo *var, +static int vfb_pan_display(struct fb_var_screeninfo *var, int con, struct fb_info *info); static int vfb_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma); @@ -358,7 +358,7 @@ static int vfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, * This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag */ -static int vfb_pan_display(struct fb_var_screeninfo *var, +static int vfb_pan_display(struct fb_var_screeninfo *var, int con, struct fb_info *info) { if (var->vmode & FB_VMODE_YWRAP) {