patch-2.1.124 linux/drivers/video/tgafb.c
Next file: linux/drivers/video/valkyriefb.c
Previous file: linux/drivers/video/tcxfb.c
Back to the patch index
Back to the overall index
- Lines: 223
- Date:
Thu Oct 1 10:02:21 1998
- Orig file:
v2.1.123/linux/drivers/video/tgafb.c
- Orig date:
Tue Aug 18 22:02:05 1998
diff -u --recursive --new-file v2.1.123/linux/drivers/video/tgafb.c linux/drivers/video/tgafb.c
@@ -15,7 +15,7 @@
/* KNOWN PROBLEMS/TO DO ===================================================== *
*
- * - How to set a single color register?
+ * - How to set a single color register on 24-plane cards?
*
* - Hardware cursor (useful for other graphics boards too)
*
@@ -38,9 +38,9 @@
#include <linux/selection.h>
#include <asm/io.h>
-#include "fbcon.h"
-#include "fbcon-cfb8.h"
-#include "fbcon-cfb32.h"
+#include <video/fbcon.h>
+#include <video/fbcon-cfb8.h>
+#include <video/fbcon-cfb32.h>
/* TGA hardware description (minimal) */
@@ -242,6 +242,7 @@
static struct display disp;
static struct fb_info fb_info;
static struct { u_char red, green, blue, pad; } palette[256];
+static u32 fbcon_cfb32_cmap[16];
static struct fb_fix_screeninfo fb_fix = { { "DEC TGA ", } };
static struct fb_var_screeninfo fb_var = { 0, };
@@ -404,13 +405,11 @@
struct fb_info *info)
{
if (con == currcon) /* current console? */
- return fb_get_cmap(cmap, &fb_display[con].var, kspc, tgafb_getcolreg,
- info);
+ return fb_get_cmap(cmap, kspc, tgafb_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(1<<fb_display[con].var.bits_per_pixel),
- cmap, kspc ? 0 : 2);
+ fb_copy_cmap(fb_default_cmap(256), cmap, kspc ? 0 : 2);
return 0;
}
@@ -424,15 +423,14 @@
int err;
if (!fb_display[con].cmap.len) { /* no colormap allocated? */
- if ((err = fb_alloc_cmap(&fb_display[con].cmap,
- 1<<fb_display[con].var.bits_per_pixel, 0)))
+ if ((err = fb_alloc_cmap(&fb_display[con].cmap, 256, 0)))
return err;
}
if (con == currcon) { /* current console? */
- err = fb_set_cmap(cmap, &fb_display[con].var, kspc, tgafb_setcolreg,
- info);
+ err = fb_set_cmap(cmap, kspc, tgafb_setcolreg, info);
#if 1
- tga_update_palette();
+ if (tga_type != 0)
+ tga_update_palette();
#endif
return err;
} else
@@ -681,9 +679,9 @@
TGA_WRITE_REG(temp & 0x000fffff, TGA_CURSOR_BASE_REG);
}
- /* finally, enable video scan & cursor
+ /* finally, enable video scan
(and pray for the monitor... :-) */
- TGA_WRITE_REG(0x05, TGA_VALID_REG); /* SCANNING and CURSOR */
+ TGA_WRITE_REG(0x01, TGA_VALID_REG); /* SCANNING */
fb_var.xres = fb_var.xres_virtual = 640;
fb_var.yres = fb_var.yres_virtual = 480;
@@ -748,10 +746,11 @@
case 1: /* 24-plane */
case 3: /* 24plusZ */
disp.dispsw = &fbcon_cfb32;
+ disp.dispsw_data = &fbcon_cfb32_cmap;
break;
#endif
default:
- disp.dispsw = NULL;
+ disp.dispsw = &fbcon_dummy;
}
disp.scrollmode = SCROLL_YREDRAW;
@@ -764,6 +763,7 @@
fb_info.switch_con = &tgafbcon_switch;
fb_info.updatevar = &tgafbcon_updatevar;
fb_info.blank = &tgafbcon_blank;
+ fb_info.flags = FBINFO_FLAG_DEFAULT;
tgafb_set_var(&fb_var, -1, &fb_info);
@@ -779,8 +779,7 @@
{
/* Do we have to save the colormap? */
if (fb_display[currcon].cmap.len)
- fb_get_cmap(&fb_display[currcon].cmap, &fb_display[currcon].var, 1,
- tgafb_getcolreg, info);
+ fb_get_cmap(&fb_display[currcon].cmap, 1, tgafb_getcolreg, info);
currcon = con;
/* Install new colormap */
@@ -804,7 +803,13 @@
static void tgafbcon_blank(int blank, struct fb_info *info)
{
- /* Nothing */
+ /* Should also do stuff here for vesa blanking -tor */
+
+ if (blank > 0) {
+ TGA_WRITE_REG(0x03, TGA_VALID_REG); /* SCANNING and BLANK */
+ } else {
+ TGA_WRITE_REG(0x01, TGA_VALID_REG); /* SCANNING */
+ }
}
/*
@@ -817,9 +822,10 @@
{
if (regno > 255)
return 1;
- *red = palette[regno].red;
- *green = palette[regno].green;
- *blue = palette[regno].blue;
+ *red = (palette[regno].red<<8) | palette[regno].red;
+ *green = (palette[regno].green<<8) | palette[regno].green;
+ *blue = (palette[regno].blue<<8) | palette[regno].blue;
+ *transp = 0;
return 0;
}
@@ -835,6 +841,9 @@
{
if (regno > 255)
return 1;
+ red >>= 8;
+ green >>= 8;
+ blue >>= 8;
palette[regno].red = red;
palette[regno].green = green;
palette[regno].blue = blue;
@@ -844,7 +853,14 @@
fbcon_cfb32_cmap[regno] = (red << 16) | (green << 8) | blue;
#endif
- /* How to set a single color register?? */
+ if (tga_type == 0) { /* 8-plane */
+ BT485_WRITE(regno, BT485_ADDR_PAL_WRITE);
+ TGA_WRITE_REG(BT485_DATA_PAL, TGA_RAMDAC_SETUP_REG);
+ TGA_WRITE_REG(red|(BT485_DATA_PAL<<8),TGA_RAMDAC_REG);
+ TGA_WRITE_REG(green|(BT485_DATA_PAL<<8),TGA_RAMDAC_REG);
+ TGA_WRITE_REG(blue|(BT485_DATA_PAL<<8),TGA_RAMDAC_REG);
+ }
+ /* How to set a single color register on 24-plane cards?? */
return 0;
}
@@ -852,31 +868,21 @@
#if 1
/*
- * FIXME: since I don't know how to set a single arbitrary color register,
- * all color palette registers have to be updated
+ * FIXME: since I don't know how to set a single arbitrary color register
+ * on 24-plane cards, all color palette registers have to be updated
*/
static void tga_update_palette(void)
{
int i;
- if (tga_type == 0) { /* 8-plane */
- BT485_WRITE(0x00, BT485_ADDR_PAL_WRITE);
- TGA_WRITE_REG(BT485_DATA_PAL, TGA_RAMDAC_SETUP_REG);
- for (i = 0; i < 256; i++) {
- TGA_WRITE_REG(palette[i].red|(BT485_DATA_PAL<<8),TGA_RAMDAC_REG);
- TGA_WRITE_REG(palette[i].green|(BT485_DATA_PAL<<8),TGA_RAMDAC_REG);
- TGA_WRITE_REG(palette[i].blue|(BT485_DATA_PAL<<8),TGA_RAMDAC_REG);
- }
- } else {
- BT463_LOAD_ADDR(0x0000);
- TGA_WRITE_REG((BT463_PALETTE<<2), TGA_RAMDAC_REG);
+ BT463_LOAD_ADDR(0x0000);
+ TGA_WRITE_REG((BT463_PALETTE<<2), TGA_RAMDAC_REG);
- for (i = 0; i < 256; i++) {
- TGA_WRITE_REG(palette[i].red|(BT463_PALETTE<<10), TGA_RAMDAC_REG);
- TGA_WRITE_REG(palette[i].green|(BT463_PALETTE<<10), TGA_RAMDAC_REG);
- TGA_WRITE_REG(palette[i].blue|(BT463_PALETTE<<10), TGA_RAMDAC_REG);
- }
+ for (i = 0; i < 256; i++) {
+ TGA_WRITE_REG(palette[i].red|(BT463_PALETTE<<10), TGA_RAMDAC_REG);
+ TGA_WRITE_REG(palette[i].green|(BT463_PALETTE<<10), TGA_RAMDAC_REG);
+ TGA_WRITE_REG(palette[i].blue|(BT463_PALETTE<<10), TGA_RAMDAC_REG);
}
}
#endif
@@ -886,14 +892,12 @@
if (con != currcon)
return;
if (fb_display[con].cmap.len)
- fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
- tgafb_setcolreg, info);
+ fb_set_cmap(&fb_display[con].cmap, 1, tgafb_setcolreg, info);
else
- fb_set_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel),
- &fb_display[con].var, 1, tgafb_setcolreg,
- info);
+ fb_set_cmap(fb_default_cmap(256), 1, tgafb_setcolreg, info);
#if 1
- tga_update_palette();
+ if (tga_type != 0)
+ tga_update_palette();
#endif
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov