Date: Fri, 27 Mar 1998 16:57:32 +0100 (CET)
From: Geert Uytterhoeven <Geert.Uytterhoeven@cs.kuleuven.ac.be>
To: Linux/m68k <linux-m68k@lists.linux-m68k.org>
Sender: owner-linux-m68k@phil.uni-sb.de


Here are some more video patches:

  - removed set_mode function pointer as we don't need it

  - var.accel_flags contains `hints' for acceleration:

      o programs that want to mmap MMIO have to disable FB_ACCELF_TEXT first

      o graphics board that have a builtin hardware text mode may use it if
	FB_ACCELF_TEXT is set, and should fill in a correct type in fix.type

Please test this on the boards that have supported acceleration.

Caveat: fbset doesn't set the FB_ACCELF_TEXT hint, so it disables acceleration.

Sorry for this late patch (and still missing Bernd's changes to atyfb). My
excuses:

  - days are too short, and conferences last too long

  - due to a power failure, some files in my local CVS repository were
    corrupted

diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/char/fbmem.c m68k/drivers/char/fbmem.c
--- m68k-2.1.90-current/drivers/char/fbmem.c	Tue Mar 24 18:54:48 1998
+++ m68k/drivers/char/fbmem.c	Tue Mar 24 20:50:18 1998
@@ -351,6 +351,10 @@
 		len = fix.smem_len;
 	} else {
 		/* memory mapped io */
+		struct fb_var_screeninfo var;
+		fb->fb_get_var(&var, PROC_CONSOLE(), info);
+		if (var.accel_flags)
+			return -EINVAL;
 		start = fix.mmio_start;
 		len = fix.mmio_len;
 		vma->vm_offset -= fix.smem_len;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/char/vt.c m68k/drivers/char/vt.c
--- m68k-2.1.90-current/drivers/char/vt.c	Tue Mar 24 18:54:49 1998
+++ m68k/drivers/char/vt.c	Wed Mar 25 23:36:16 1998
@@ -34,10 +34,6 @@
 #include <linux/vt_kern.h>
 #include <linux/kbd_diacr.h>
 #include <linux/selection.h>
-#ifdef CONFIG_ABSTRACT_CONSOLE
-#include <linux/console.h>
-#include <linux/console_struct.h>
-#endif
 
 char vt_dont_switch = 0;
 extern struct tty_driver console_driver;
@@ -661,10 +657,6 @@
 		if (vt_cons[console]->vc_mode == (unsigned char) arg)
 			return 0;
 		vt_cons[console]->vc_mode = (unsigned char) arg;
-#ifdef CONFIG_ABSTRACT_CONSOLE
-		vc_cons[console].d->vc_sw->con_set_mode(vc_cons[console].d,
-							arg);
-#endif
 		if (console != fg_console)
 			return 0;
 		/*
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/S3triofb.c m68k/drivers/video/S3triofb.c
--- m68k-2.1.90-current/drivers/video/S3triofb.c	Tue Mar 24 18:54:50 1998
+++ m68k/drivers/video/S3triofb.c	Thu Mar 26 22:55:43 1998
@@ -143,7 +143,7 @@
 
 static struct fb_ops s3trio_ops = {
     s3trio_open, s3trio_release, s3trio_get_fix, s3trio_get_var, s3trio_set_var,
-    s3trio_get_cmap, s3trio_set_cmap, s3trio_pan_display, NULL, s3trio_ioctl
+    s3trio_get_cmap, s3trio_set_cmap, s3trio_pan_display, s3trio_ioctl
 };
 
 
@@ -430,7 +430,7 @@
     fb_fix.smem_start = ioremap(address,64*1024*1024);
     fb_fix.type = FB_TYPE_PACKED_PIXELS;
     fb_fix.type_aux = 0;
-
+    fb_fix.accel = FB_ACCEL_S3_TRIO64;
 
     s3trio_resetaccel();
 
@@ -512,7 +512,8 @@
     fb_var.nonstd = 0;
     fb_var.activate = 0;
     fb_var.height = fb_var.width = -1;
-    fb_var.accel = 5;
+    fb_var.text_accel = FB_ACCELF_TEXT;
+#warning FIXME: always obey fb_var.text_accel
     fb_var.pixclock = 1;
     fb_var.left_margin = fb_var.right_margin = 0;
     fb_var.upper_margin = fb_var.lower_margin = 0;
@@ -534,7 +535,10 @@
     disp.can_soft_blank = 1;
     disp.inverse = 0;
 #ifdef CONFIG_FBCON_CFB8
-    disp.dispsw = &fbcon_trio8;
+    if (fb_var.text_accel & FB_ACCELF_TEXT)
+	disp.dispsw = &fbcon_trio8;
+    else
+	disp.dispsw = &fbcon_cfb8;
 #else
     disp.dispsw = NULL;
 #endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/amifb.c m68k/drivers/video/amifb.c
--- m68k-2.1.90-current/drivers/video/amifb.c	Tue Mar 24 18:54:51 1998
+++ m68k/drivers/video/amifb.c	Thu Mar 26 22:55:43 1998
@@ -1245,7 +1245,7 @@
 static struct fb_ops amifb_ops = {
 	amifb_open, amifb_release, amifb_get_fix, amifb_get_var,
 	amifb_set_var, amifb_get_cmap, amifb_set_cmap,
-	amifb_pan_display, NULL, amifb_ioctl
+	amifb_pan_display, amifb_ioctl
 };
 
 
@@ -2543,7 +2543,8 @@
                           struct amifb_par *par)
 {
 	u_short clk_shift, line_shift;
-	int i;
+
+	memset(var, 0, sizeof(struct fb_var_screeninfo));
 
 	clk_shift = par->clk_shift;
 	line_shift = par->line_shift;
@@ -2625,9 +2626,6 @@
 		var->sync |= FB_SYNC_EXT;
 	if (par->vmode & FB_VMODE_YWRAP)
 		var->vmode |= FB_VMODE_YWRAP;
-
-	for (i = 0; i < arraysize(var->reserved); i++)
-		var->reserved[i] = 0;
 
 	return 0;
 }
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/atafb.c m68k/drivers/video/atafb.c
--- m68k-2.1.90-current/drivers/video/atafb.c	Tue Mar 24 18:54:51 1998
+++ m68k/drivers/video/atafb.c	Thu Mar 26 22:55:43 1998
@@ -492,6 +492,7 @@
 	fix->ypanstep=1;
 	fix->ywrapstep=0;
 	fix->line_length = 0;
+	fix->accel = FB_ACCEL_ATARIBLITT;
 	return 0;
 }
 
@@ -580,7 +581,8 @@
 static int tt_encode_var( struct fb_var_screeninfo *var,
 						  struct atafb_par *par )
 {
-	int linelen, i;
+	int linelen;
+	memset(var, 0, sizeof(struct fb_var_screeninfo));
 	var->red.offset=0;
 	var->red.length=4;
 	var->red.msb_right=0;
@@ -668,8 +670,6 @@
 	var->nonstd=0;
 	var->activate=0;
 	var->vmode=FB_VMODE_NONINTERLACED;
-	for (i=0; i<arraysize(var->reserved); i++)
-		var->reserved[i]=0;
 	return 0;
 }
 
@@ -816,6 +816,7 @@
 		fix->xpanstep = 2;
 	}
 	fix->line_length = 0;
+	fix->accel = FB_ACCEL_ATARIBLITT;
 	return 0;
 }
 
@@ -1306,11 +1307,12 @@
 							  struct atafb_par *par )
 {
 /* !!! only for VGA !!! */
-	int linelen, i;
+	int linelen;
 	int prescale, plen;
 	int hdb_off, hde_off, base_off;
 	struct falcon_hw *hw = &par->hw.falcon;
 
+	memset(var, 0, sizeof(struct fb_var_screeninfo));
 	/* possible frequencies: 25.175 or 32MHz */
 	var->pixclock = hw->sync & 0x1 ? fext.t :
 	                hw->vid_control & VCO_CLOCK25 ? f25.t : f32.t;
@@ -1461,8 +1463,6 @@
 		var->yoffset=0;
 	var->nonstd=0;	/* what is this for? */
 	var->activate=0;
-	for (i=0; i<arraysize(var->reserved); i++)
-		var->reserved[i]=0;
 	return 0;
 }
 
@@ -1773,6 +1773,7 @@
 	}
 	fix->ywrapstep = 0;
 	fix->line_length = 0;
+	fix->accel = FB_ACCEL_ATARIBLITT;
 	return 0;
 }
 
@@ -1838,7 +1839,8 @@
 static int stste_encode_var( struct fb_var_screeninfo *var,
 						  struct atafb_par *par )
 {
-	int linelen, i;
+	int linelen;
+	memset(var, 0, sizeof(struct fb_var_screeninfo));
 	var->red.offset=0;
 	var->red.length = ATARIHW_PRESENT(EXTD_SHIFTER) ? 4 : 3;
 	var->red.msb_right=0;
@@ -1908,8 +1910,6 @@
 	var->nonstd=0;
 	var->activate=0;
 	var->vmode=FB_VMODE_NONINTERLACED;
-	for (i=0; i<arraysize(var->reserved); i++)
-		var->reserved[i]=0;
 	return 0;
 }
 
@@ -2145,8 +2145,7 @@
 static int ext_encode_var( struct fb_var_screeninfo *var,
 						   struct atafb_par *par )
 {
-	int i;
-
+	memset(var, 0, sizeof(struct fb_var_screeninfo));
 	var->red.offset=0;
 	var->red.length=(external_pmode == -1) ? external_depth/3 : 
 			(external_vgaiobase ? external_bitspercol : 0);
@@ -2181,8 +2180,6 @@
 	var->nonstd=0;
 	var->activate=0;
 	var->vmode=FB_VMODE_NONINTERLACED;
-	for (i=0; i<arraysize(var->reserved); i++)
-		var->reserved[i]=0;
 	return 0;
 }
 
@@ -2642,7 +2639,7 @@
 static struct fb_ops atafb_ops = {
 	atafb_open, atafb_release, atafb_get_fix, atafb_get_var,
 	atafb_set_var, atafb_get_cmap, atafb_set_cmap,
-	atafb_pan_display, NULL, atafb_ioctl	
+	atafb_pan_display, atafb_ioctl	
 };
 
 static void
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/atyfb.c m68k/drivers/video/atyfb.c
--- m68k-2.1.90-current/drivers/video/atyfb.c	Tue Mar 24 18:54:51 1998
+++ m68k/drivers/video/atyfb.c	Thu Mar 26 22:55:43 1998
@@ -62,6 +62,7 @@
     u_int vyres;
     int xoffset;	/* virtual screen position */
     int yoffset;
+    int accel;
 };
 
 
@@ -182,6 +183,7 @@
 	{0x72d, VMODE_832_624_75},	/* 16" RGB (Goldfish) */
 	{0x730, VMODE_768_576_50I},	/* PAL (Alternate) */
 	{0x73a, VMODE_1152_870_75},	/* 3rd party 19" */
+	{0x73f, VMODE_640_480_67},	/* no sense lines connected at all */
 	{-1,	VMODE_640_480_60},	/* catch-all, must be last */
 };
 
@@ -357,7 +359,7 @@
 
 static struct fb_ops atyfb_ops = {
     atyfb_open, atyfb_release, atyfb_get_fix, atyfb_get_var, atyfb_set_var,
-    atyfb_get_cmap, atyfb_set_cmap, atyfb_pan_display, NULL, atyfb_ioctl
+    atyfb_get_cmap, atyfb_set_cmap, atyfb_pan_display, atyfb_ioctl
 };
 
 
@@ -722,18 +724,20 @@
     aty_st_le32(CRTC_GEN_CNTL, CRTC_EXT_DISP_EN | CRTC_ENABLE | i);
 
 #ifdef CONFIG_FB_COMPAT_XPMAC
-    display_info.height = vmode_attrs[par->vmode-1].vres;
-    display_info.width = vmode_attrs[par->vmode-1].hres;
-    display_info.depth = 8<<par->cmode;
-    display_info.pitch = par->vxres<<par->cmode;
-    display_info.mode = par->vmode;
-    strcpy(display_info.name, atyfb_name);
-    display_info.fb_address =
-	iopa(((chip_type != MACH64_GT_ID) ?
-	     frame_buffer + init->offset[par->cmode] : frame_buffer));
-    display_info.cmap_adr_address = iopa((unsigned long)&aty_cmap_regs->windex);
-    display_info.cmap_data_address = iopa((unsigned long)&aty_cmap_regs->lut);
-    display_info.disp_reg_address = iopa(ati_regbase);
+    if (console_fb_info == &fb_info) {
+	display_info.height = vmode_attrs[par->vmode-1].vres;
+	display_info.width = vmode_attrs[par->vmode-1].hres;
+	display_info.depth = 8<<par->cmode;
+	display_info.pitch = par->vxres<<par->cmode;
+	display_info.mode = par->vmode;
+	strcpy(display_info.name, atyfb_name);
+	display_info.fb_address =
+	    iopa(((chip_type != MACH64_GT_ID) ?
+		 frame_buffer + init->offset[par->cmode] : frame_buffer));
+	display_info.cmap_adr_address = iopa((unsigned long)&aty_cmap_regs->windex);
+	display_info.cmap_data_address = iopa((unsigned long)&aty_cmap_regs->lut);
+	display_info.disp_reg_address = iopa(ati_regbase);
+    }
 #endif /* CONFIG_FB_COMPAT_XPMAC) */
 }
 
@@ -788,6 +792,7 @@
     fix->ywrapstep = 0;
     fix->xpanstep = 8;
     fix->ypanstep = 1;
+    fix->accel = FB_ACCEL_ATI_MACH64;
 
     return 0;
 }
@@ -843,13 +848,19 @@
     if (par->xoffset+xres > par->vxres || par->yoffset+yres > par->vyres)
 	return -EINVAL;
 
-    if (bpp <= 8)
+    if (bpp <= 8) {
 	par->cmode = CMODE_8;
-    else if (bpp <= 16)
+	if (var->accel_flags & FB_ACCELF_TEXT)
+	    par->accel = FB_ACCELF_TEXT;
+	else
+	    par->accel = 0;
+    } else if (bpp <= 16) {
 	par->cmode = CMODE_16;
-    else if (bpp <= 32)
+	par->accel = 0;
+    } else if (bpp <= 32) {
 	par->cmode = CMODE_32;
-    else
+	par->accel = 0;
+    } else
 	return -EINVAL;
 
     if (aty_vram_reqd(par) > total_vram)
@@ -927,8 +938,8 @@
     var->activate = 0;
     var->height = -1;
     var->width = -1;
-    var->accel = /* FB_ACCEL_ATY */ 0;
     var->vmode = FB_VMODE_NONINTERLACED;
+    var->accel_flags = par->accel;
     var->left_margin = var->right_margin = 64;	/* guesses */
     var->upper_margin = var->lower_margin = 32;
     var->hsync_len = 64;
@@ -986,7 +997,7 @@
     if (con == -1)
 	encode_var(var, &default_par);
     else
-	*var=fb_display[con].var;
+	*var = fb_display[con].var;
     return 0;
 }
 
@@ -1038,11 +1049,11 @@
 	    display->inverse = 0;
 	    switch (par.cmode) {
 		case CMODE_8:
-#if 1
-		    display->dispsw = &fbcon_cfb8;
-#else
-		    display->dispsw = &fbcon_aty8;
-#endif
+		    if (par.accel & FB_ACCELF_TEXT) {
+			display->dispsw = &fbcon_aty8;
+#warning FIXME: We should reinit the graphics engine here
+		    } else
+			display->dispsw = &fbcon_cfb8;
 		    break;
 		case CMODE_16:
 		    display->dispsw = &fbcon_cfb16;
@@ -1645,6 +1656,9 @@
 
     /*
      *  Backward compatibility mode for Xpmac
+     *
+     *  This should move to offb.c once this driver supports arbitrary video
+     *  modes
      */
 
 static int atyfb_console_setmode(struct vc_mode *mode, int doit)
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/cyberfb.c m68k/drivers/video/cyberfb.c
--- m68k-2.1.90-current/drivers/video/cyberfb.c	Wed Mar 25 21:23:33 1998
+++ m68k/drivers/video/cyberfb.c	Thu Mar 26 22:55:43 1998
@@ -62,6 +62,7 @@
    int xres;
    int yres;
    int bpp;
+   int accel;
 };
 
 static struct cyberfb_par current_par;
@@ -134,49 +135,49 @@
 	"640x480-8", {		/* Cybervision 8 bpp */
 	    640, 480, 640, 480, 0, 0, 8, 0,
 	    {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-	    0, 0, -1, -1, FB_ACCEL_NONE, CYBER8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
+	    0, 0, -1, -1, FB_ACCELF_TEXT, CYBER8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
 	    FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
 	}
     }, {
 	"800x600-8", {		/* Cybervision 8 bpp */
 	    800, 600, 800, 600, 0, 0, 8, 0,
 	    {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-	    0, 0, -1, -1, FB_ACCEL_NONE, CYBER8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
+	    0, 0, -1, -1, FB_ACCELF_TEXT, CYBER8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
 	    FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
 	}
     }, {
 	"1024x768-8", {		/* Cybervision 8 bpp */
 	    1024, 768, 1024, 768, 0, 0, 8, 0,
 	    {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-	    0, 0, -1, -1, FB_ACCEL_NONE, CYBER8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
+	    0, 0, -1, -1, FB_ACCELF_TEXT, CYBER8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
 	    FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
 	}
     }, {
 	"1152x886-8", {		/* Cybervision 8 bpp */
 	    1152, 886, 1152, 886, 0, 0, 8, 0,
 	    {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-	    0, 0, -1, -1, FB_ACCEL_NONE, CYBER8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
+	    0, 0, -1, -1, FB_ACCELF_TEXT, CYBER8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
 	    FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
 	}
     }, {
 	"1280x1024-8", {	/* Cybervision 8 bpp */
 	    1280, 1024, 1280, 1024, 0, 0, 8, 0,
 	    {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-	    0, 0, -1, -1, FB_ACCEL_NONE, CYBER8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
+	    0, 0, -1, -1, FB_ACCELF_TEXT, CYBER8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
 	    FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
 	}
     }, {
 	"1600x1200-8", {	/* Cybervision 8 bpp */
 	    1600, 1200, 1600, 1200, 0, 0, 8, 0,
 	    {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-	    0, 0, -1, -1, FB_ACCEL_NONE, CYBER8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
+	    0, 0, -1, -1, FB_ACCELF_TEXT, CYBER8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
 	    FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
 	}
     }, {
 	"800x600-16", {		/* Cybervision 16 bpp */
 	    800, 600, 800, 600, 0, 0, 16, 0,
 	    {11, 5, 0}, {5, 6, 0}, {0, 5, 0}, {0, 0, 0},
-	    0, 0, -1, -1, FB_ACCEL_NONE, CYBER16_PIXCLOCK, 64, 96, 35, 12, 112, 2,
+	    0, 0, -1, -1, FB_ACCELF_TEXT, CYBER16_PIXCLOCK, 64, 96, 35, 12, 112, 2,
 	    FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
 	}
     }
@@ -372,8 +373,7 @@
 static int Cyber_encode_fix(struct fb_fix_screeninfo *fix,
 			    struct cyberfb_par *par)
 {
-	int i;
-
+	memset(fix, 0, sizeof(struct fb_fix_screeninfo));
 	strcpy(fix->id, cyberfb_name);
 	fix->smem_start = (caddr_t)CyberMem;
 	fix->smem_len = CyberSize;
@@ -391,9 +391,7 @@
 	fix->ypanstep = 0;
 	fix->ywrapstep = 0;
 	fix->line_length = 0;
-
-	for (i = 0; i < arraysize(fix->reserved); i++)
-		fix->reserved[i] = 0;
+	fix->accel = FB_ACCEL_S3_TRIO64;
 
 	return(0);
 }
@@ -411,6 +409,10 @@
 	par->xres = var->xres;
 	par->yres = var->yres;
 	par->bpp = var->bits_per_pixel;
+	if (var->accel_flags & FB_ACCELF_TEXT)
+	    par->accel = FB_ACCELF_TEXT;
+	else
+	    par->accel = 0;
 #else
 	if (Cyberfb_Cyber8) {
 		par->xres = CYBER8_WIDTH;
@@ -434,8 +436,6 @@
 static int Cyber_encode_var(struct fb_var_screeninfo *var,
 			    struct cyberfb_par *par)
 {
-	int i;
-
 	var->xres = par->xres;
 	var->yres = par->yres;
 	var->xres_virtual = par->xres;
@@ -472,8 +472,7 @@
 	var->height = -1;
 	var->width = -1;
 
-	var->accel = FB_ACCEL_CYBERVISION;
-	DPRINTK("accel CV64\n");
+	var->accel_flags = (par->accel && par->bpp == 8) ? FB_ACCELF_TEXT : 0;
 
 	var->vmode = FB_VMODE_NONINTERLACED;
 
@@ -491,9 +490,6 @@
 	var->hsync_len = 112;
 	var->vsync_len = 2;
 
-	for (i = 0; i < arraysize(var->reserved); i++)
-		var->reserved[i] = 0;
-
 	return(0);
 }
 
@@ -859,7 +855,11 @@
 	switch (display->var.bits_per_pixel) {
 #ifdef CONFIG_FBCON_CFB8
 	    case 8:
-		display->dispsw = &fbcon_cyber8;
+		if (display->var.accel_flags & FB_ACCELF_TEXT) {
+		    display->dispsw = &fbcon_cyber8;
+#warning FIXME: We should reinit the graphics engine here
+		} else
+		    display->dispsw = &fbcon_cfb8;
 		break;
 #endif
 #ifdef CONFIG_FBCON_CFB16
@@ -881,7 +881,7 @@
 static int cyberfb_set_var(struct fb_var_screeninfo *var, int con,
 			   struct fb_info *info)
 {
-	int err, oldxres, oldyres, oldvxres, oldvyres, oldbpp;
+	int err, oldxres, oldyres, oldvxres, oldvyres, oldbpp, oldaccel;
 
 	if ((err = do_fb_set_var(var, con == currcon)))
 		return(err);
@@ -891,11 +891,13 @@
 		oldvxres = fb_display[con].var.xres_virtual;
 		oldvyres = fb_display[con].var.yres_virtual;
 		oldbpp = fb_display[con].var.bits_per_pixel;
+		oldaccel = fb_display[con].var.accel_flags;
 		fb_display[con].var = *var;
 		if (oldxres != var->xres || oldyres != var->yres ||
 		    oldvxres != var->xres_virtual ||
 		    oldvyres != var->yres_virtual ||
-		    oldbpp != var->bits_per_pixel) {
+		    oldbpp != var->bits_per_pixel ||
+		    oldaccel != var->accel_flags) {
 			cyberfb_set_disp(con, info);
 			(*fb_info.changevar)(con);
 			fb_alloc_cmap(&fb_display[con].cmap, 0, 0);
@@ -976,7 +978,7 @@
 static struct fb_ops cyberfb_ops = {
 	cyberfb_open, cyberfb_release, cyberfb_get_fix, cyberfb_get_var,
 	cyberfb_set_var, cyberfb_get_cmap, cyberfb_set_cmap,
-	cyberfb_pan_display, NULL, cyberfb_ioctl
+	cyberfb_pan_display, cyberfb_ioctl
 };
 
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/dnfb.c m68k/drivers/video/dnfb.c
--- m68k-2.1.90-current/drivers/video/dnfb.c	Tue Mar 24 18:54:51 1998
+++ m68k/drivers/video/dnfb.c	Thu Mar 26 22:55:43 1998
@@ -142,7 +142,7 @@
 static struct fb_info fb_info;
 static struct fb_ops dnfb_ops = { 
 	dnfb_open,dnfb_release, dnfb_get_fix, dnfb_get_var, dnfb_set_var,
-	dnfb_get_cmap, dnfb_set_cmap, dnfb_pan_display, NULL, dnfb_ioctl
+	dnfb_get_cmap, dnfb_set_cmap, dnfb_pan_display, dnfb_ioctl
 };
 
 static int currcon=0;
@@ -187,6 +187,7 @@
 static int dnfb_get_var(struct fb_var_screeninfo *var, int con,
 			struct fb_info *info)
 {
+	memset(var, 0, sizeof(struct fb_var_screeninfo));
 	var->xres=1280;
 	var->yres=1024;
 	var->xres_virtual=2048;
@@ -206,7 +207,6 @@
 	var->vsync_len=0;
 	var->sync=0;
 	var->vmode=FB_VMODE_NONINTERLACED;
-	var->accel=FB_ACCEL_NONE;
 
 	return 0;
 
@@ -248,8 +248,6 @@
 	if(var->sync!=0)
 		return -EINVAL;
 	if(var->vmode!=FB_VMODE_NONINTERLACED)
-		return -EINVAL;
-	if(var->accel!=FB_ACCEL_NONE)
 		return -EINVAL;
 
 	return 0;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/fbcon-cfb16.c m68k/drivers/video/fbcon-cfb16.c
--- m68k-2.1.90-current/drivers/video/fbcon-cfb16.c	Wed Mar 25 21:23:33 1998
+++ m68k/drivers/video/fbcon-cfb16.c	Thu Mar 26 22:55:43 1998
@@ -37,7 +37,7 @@
 
 void fbcon_cfb16_setup(struct display *p)
 {
-    p->next_line = p->var.xres_virtual<<1;
+    p->next_line = p->line_length ? p->line_length : p->var.xres_virtual<<1;
     p->next_plane = 0;
 }
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/fbcon-cfb8.c m68k/drivers/video/fbcon-cfb8.c
--- m68k-2.1.90-current/drivers/video/fbcon-cfb8.c	Wed Mar 25 21:23:33 1998
+++ m68k/drivers/video/fbcon-cfb8.c	Thu Mar 26 22:55:43 1998
@@ -41,7 +41,7 @@
 
 void fbcon_cfb8_setup(struct display *p)
 {
-    p->next_line = p->var.xres_virtual;
+    p->next_line = p->line_length ? p->line_length : p->var.xres_virtual;
     p->next_plane = 0;
 }
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/fbcon-iplan2p2.c m68k/drivers/video/fbcon-iplan2p2.c
--- m68k-2.1.90-current/drivers/video/fbcon-iplan2p2.c	Tue Mar 24 18:54:51 1998
+++ m68k/drivers/video/fbcon-iplan2p2.c	Thu Mar 26 22:55:43 1998
@@ -14,7 +14,6 @@
 #include <linux/tty.h>
 #include <linux/console.h>
 #include <linux/string.h>
-#include <linux/config.h>
 #include <linux/fb.h>
 
 #include <asm/byteorder.h>
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/fbcon-iplan2p4.c m68k/drivers/video/fbcon-iplan2p4.c
--- m68k-2.1.90-current/drivers/video/fbcon-iplan2p4.c	Tue Mar 24 18:54:51 1998
+++ m68k/drivers/video/fbcon-iplan2p4.c	Thu Mar 26 22:55:43 1998
@@ -14,7 +14,6 @@
 #include <linux/tty.h>
 #include <linux/console.h>
 #include <linux/string.h>
-#include <linux/config.h>
 #include <linux/fb.h>
 
 #include <asm/byteorder.h>
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/fbcon-iplan2p8.c m68k/drivers/video/fbcon-iplan2p8.c
--- m68k-2.1.90-current/drivers/video/fbcon-iplan2p8.c	Tue Mar 24 18:54:51 1998
+++ m68k/drivers/video/fbcon-iplan2p8.c	Thu Mar 26 22:55:43 1998
@@ -14,7 +14,6 @@
 #include <linux/tty.h>
 #include <linux/console.h>
 #include <linux/string.h>
-#include <linux/config.h>
 #include <linux/fb.h>
 
 #include <asm/byteorder.h>
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/fbcon.c m68k/drivers/video/fbcon.c
--- m68k-2.1.90-current/drivers/video/fbcon.c	Tue Mar 24 18:54:51 1998
+++ m68k/drivers/video/fbcon.c	Thu Mar 26 22:55:43 1998
@@ -165,7 +165,6 @@
 static int fbcon_set_font(struct vc_data *conp, int w, int h, char *data);
 static int fbcon_set_palette(struct vc_data *conp, unsigned char *table);
 static int fbcon_scrolldelta(int lines);
-static int fbcon_set_mode(struct vc_data *conp, int mode);
 
 
 /*
@@ -1092,20 +1091,6 @@
 }
 
 
-    /*
-     *  Switch between `text' (emulated and accelerated) and `graphics'
-     *  (unaccelerated text) mode
-     */
-
-static int fbcon_set_mode(struct vc_data *conp, int mode)
-{
-    struct display *p = &fb_display[conp->vc_num];
-    struct fb_ops *ops = p->fb_info->fbops;
-
-    return ops->fb_set_mode ? ops->fb_set_mode(mode, p->fb_info) : 0;
-}
-
-
 #define LOGO_H			80
 #define LOGO_W			80
 #define LOGO_LINE	(LOGO_W/8)
@@ -1121,14 +1106,19 @@
     int i, j, n, x1, y1;
     int logo_depth, done = 0;
 	
-    /* Set colors if visual is PSEUDOCOLOR and we have enough colors */
-    if (p->visual == FB_VISUAL_PSEUDOCOLOR && depth >= 4) {
-	int first_col = depth >= 8 ? 32 : depth > 4 ? 16 : 0;
-	int num_cols = depth >= 8 ? LINUX_LOGO_COLORS : 16;
+    /* Set colors if visual is PSEUDOCOLOR and we have enough colors, or for
+     * TRUECOLOR */
+    if ((p->visual == FB_VISUAL_PSEUDOCOLOR && depth >= 4) ||
+	p->visual == FB_VISUAL_TRUECOLOR) {
+	int is_truecolor = (p->visual == FB_VISUAL_TRUECOLOR);
+	int use_256 = (!is_truecolor && depth >= 8) ||
+		      (is_truecolor && depth >= 24);
+	int first_col = use_256 ? 32 : depth > 4 ? 16 : 0;
+	int num_cols = use_256 ? LINUX_LOGO_COLORS : 16;
 	unsigned char *red, *green, *blue;
 	int old_cmap_len;
 	
-	if (depth >= 8) {
+	if (use_256) {
 	    red   = linux_logo_red;
 	    green = linux_logo_green;
 	    blue  = linux_logo_blue;
@@ -1142,7 +1132,7 @@
 	/* dirty trick to avoid setcmap calling kmalloc which isn't
 	 * initialized yet... */
 	old_cmap_len = fb_display[fg_console].cmap.len;
-	fb_display[fg_console].cmap.len = 1 << depth;
+	fb_display[fg_console].cmap.len = 1 << (depth/(is_truecolor ? 3 : 1));
 	
 	for( i = 0; i < num_cols; i += n ) {
 	    n = num_cols - i;
@@ -1161,7 +1151,7 @@
 	}
 	fb_display[fg_console].cmap.len = old_cmap_len;
     }
-
+	
     if (depth >= 8) {
 	logo = linux_logo;
 	logo_depth = 8;
@@ -1194,9 +1184,9 @@
 	    for( y1 = 0; y1 < LOGO_H; y1++ ) {
 		dst = fb + y1*line;
 		for( x1 = 0; x1 < LOGO_W; x1++, src++ ) {
-		val = ((linux_logo_red[*src]   & redmask)   << redshift) |
-		      ((linux_logo_green[*src] & greenmask) << greenshift) |
-		      ((linux_logo_blue[*src]  & bluemask)  << blueshift);
+		    val = (*src << redshift) |
+			  (*src << greenshift) |
+			  (*src << blueshift);
 		    for( i = bdepth-1; i >= 0; --i )
 			*dst++ = val >> (i*8);
 		}
@@ -1254,7 +1244,7 @@
 		val = ((linux_logo_red[*src]   & redmask)   << redshift) |
 		      ((linux_logo_green[*src] & greenmask) << greenshift) |
 		      ((linux_logo_blue[*src]  & bluemask)  << blueshift);
-		for( i = 0; i < bdepth; ++i )
+		for( i = bdepth-1; i >= 0; --i )
 		    *dst++ = val >> (i*8);
 	    }
 	}
@@ -1359,7 +1349,7 @@
     fbcon_startup, fbcon_init, fbcon_deinit, fbcon_clear, fbcon_putc,
     fbcon_putcs, fbcon_cursor, fbcon_scroll, fbcon_bmove, fbcon_switch,
     fbcon_blank, fbcon_get_font, fbcon_set_font, fbcon_set_palette,
-    fbcon_scrolldelta, fbcon_set_mode
+    fbcon_scrolldelta
 };
 
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/macfb.c m68k/drivers/video/macfb.c
--- m68k-2.1.90-current/drivers/video/macfb.c	Tue Mar 24 18:54:51 1998
+++ m68k/drivers/video/macfb.c	Thu Mar 26 22:55:43 1998
@@ -44,7 +44,7 @@
 	0,		/* standard pixel format */
 	FB_ACTIVATE_NOW,
 	274,195,	/* 14" monitor *Mikael Nykvist's anyway* */
-	FB_ACCEL_NONE,	/* The only way to accelerate a mac is .. */
+	0,		/* The only way to accelerate a mac is .. */
 	0L,0L,0L,0L,0L,
 	0L,0L,0,	/* No sync info */
 	FB_VMODE_NONINTERLACED,
@@ -94,7 +94,7 @@
 static void macfb_encode_var(struct fb_var_screeninfo *var, 
 				struct macfb_par *par)
 {
-	int i=0;
+	memset(var, 0, sizeof(struct fb_var_screeninfo));
 	var->xres=mac_xres;
 	var->yres=mac_yres;
 	var->xres_virtual=mac_vxres;
@@ -110,7 +110,6 @@
 	var->activate=0;
 	var->height= -1;
 	var->width= -1;
-	var->accel=0;
 	var->vmode=FB_VMODE_NONINTERLACED;
 	var->pixclock=0;
 	var->sync=0;
@@ -120,8 +119,6 @@
 	var->lower_margin=0;
 	var->hsync_len=0;
 	var->vsync_len=0;
-	for(i=0;i<arraysize(var->reserved);i++)
-		var->reserved[i]=0;
 	return;
 }
 
@@ -155,8 +152,6 @@
 static void macfb_encode_fix(struct fb_fix_screeninfo *fix, 
 				struct macfb_par *par)
 {
-	int i;
-
 	memset(fix, 0, sizeof(struct fb_fix_screeninfo));
 	strcpy(fix->id,"Macintosh");
 
@@ -323,14 +318,12 @@
 	macfb_get_cmap,
 	macfb_set_cmap,
 	macfb_pan_display,
-	NULL,
 	macfb_ioctl
 };
 
 void macfb_setup(char *options, int *ints)
 {
     char *this_opt;
-    int temp;
 
     fb_info.fontname[0] = '\0';
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/offb.c m68k/drivers/video/offb.c
--- m68k-2.1.90-current/drivers/video/offb.c	Tue Mar 24 18:54:51 1998
+++ m68k/drivers/video/offb.c	Thu Mar 26 22:55:43 1998
@@ -85,6 +85,7 @@
 #ifdef CONFIG_FB_COMPAT_XPMAC
 int console_getmode(struct vc_mode *);
 int console_setmode(struct vc_mode *, int);
+int console_setcmap(int, unsigned char *, unsigned char *, unsigned char *);
 int console_powermode(int);
 struct fb_info *console_fb_info = NULL;
 int (*console_setmode_ptr)(struct vc_mode *, int) = NULL;
@@ -116,7 +117,7 @@
 
 static struct fb_ops offb_ops = {
     offb_open, offb_release, offb_get_fix, offb_get_var, offb_set_var,
-    offb_get_cmap, offb_set_cmap, offb_pan_display, NULL, offb_ioctl
+    offb_get_cmap, offb_set_cmap, offb_pan_display, offb_ioctl
 };
 
 
@@ -379,7 +380,6 @@
 	var->nonstd = 0;
 	var->activate = 0;
 	var->height = var->width = -1;
-	var->accel = FB_ACCEL_NONE;
 	var->pixclock = 10000;
 	var->left_margin = var->right_margin = 16;
 	var->upper_margin = var->lower_margin = 16;
@@ -593,6 +593,7 @@
      *    - console_setmode() should fill in a struct fb_var_screeninfo (using
      *	    the MacOS video mode database) and simply call a decode_var()
      *	    function, so console_setmode_ptr is no longer needed.
+     *	    console_getmode() should convert in the other direction.
      *
      *    - instead of using the console_* stuff (filled in by the frame
      *      buffer), we should use the correct struct fb_info for the
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/retz3fb.c m68k/drivers/video/retz3fb.c
--- m68k-2.1.90-current/drivers/video/retz3fb.c	Tue Mar 24 18:54:51 1998
+++ m68k/drivers/video/retz3fb.c	Thu Mar 26 22:55:43 1998
@@ -81,6 +81,8 @@
 	int hsync_len;	/* length of horizontal sync	*/
 	int vsync_len;	/* length of vertical sync	*/
 	int vmode;
+
+	int accel;
 };
 
 struct display_data {
@@ -196,7 +198,7 @@
 	"640x480", {		/* 640x480, 8 bpp */
 	    640, 480, 640, 480, 0, 0, 8, 0,
 	    {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-	    0, 0, -1, -1, FB_ACCEL_NCR77C32BLT, 38461, 28, 32, 12, 10, 96, 2,
+	    0, 0, -1, -1, FB_ACCELF_TEXT, 38461, 28, 32, 12, 10, 96, 2,
 	    FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
 	}
     },
@@ -208,7 +210,7 @@
 	"800x600", {		/* 800x600, 8 bpp */
 	    800, 600, 800, 600, 0, 0, 8, 0,
 	    {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-	    0, 0, -1, -1, FB_ACCEL_NCR77C32BLT, 27778, 64, 24, 22, 1, 120, 2,
+	    0, 0, -1, -1, FB_ACCELF_TEXT, 27778, 64, 24, 22, 1, 120, 2,
 	    FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
 	}
     },
@@ -220,21 +222,21 @@
 	"1024x768i", {		/* 1024x768, 8 bpp, interlaced */
 	    1024, 768, 1024, 768, 0, 0, 8, 0,
 	    {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-	    0, 0, -1, -1, FB_ACCEL_NCR77C32BLT, 22222, 40, 40, 32, 9, 160, 8,
+	    0, 0, -1, -1, FB_ACCELF_TEXT, 22222, 40, 40, 32, 9, 160, 8,
 	    FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_INTERLACED
 	}
     }, {
 	"640x480-16", {		/* 640x480, 16 bpp */
 	    640, 480, 640, 480, 0, 0, 16, 0,
 	    {11, 5, 0}, {5, 6, 0}, {0, 5, 0}, {0, 0, 0},
-	    0, 0, -1, -1, FB_ACCEL_NCR77C32BLT, 38461/2, 28, 32, 12, 10, 96, 2,
+	    0, 0, -1, -1, 0, 38461/2, 28, 32, 12, 10, 96, 2,
 	    FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
 	}
     }, {
 	"640x480-24", {		/* 640x480, 24 bpp */
 	    640, 480, 640, 480, 0, 0, 24, 0,
 	    {8, 8, 8}, {8, 8, 8}, {8, 8, 8}, {0, 0, 0},
-	    0, 0, -1, -1, FB_ACCEL_NCR77C32BLT, 38461/3, 28, 32, 12, 10, 96, 2,
+	    0, 0, -1, -1, 0, 38461/3, 28, 32, 12, 10, 96, 2,
 	    FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
 	}
     },
@@ -834,8 +836,7 @@
 static int retz3_encode_fix(struct fb_fix_screeninfo *fix,
 			    struct retz3fb_par *par)
 {
-	short i;
-
+	memset(fix, 0, sizeof(struct fb_fix_screeninfo));
 	strcpy(fix->id, retz3fb_name);
 	fix->smem_start = (char *)z3_fbmem;
 	fix->smem_len = z3_size;
@@ -854,10 +855,7 @@
 	fix->ywrapstep = 0;
 	fix->line_length = 0;
 
-	fix->accel = FB_ACCEL_NCR77C32BLT;
-
-	for (i = 0; i < arraysize(fix->reserved); i++)
-		fix->reserved[i] = 0;
+	fix->accel = FB_ACCEL_NCR_77C32BLT;
 
 	return 0;
 }
@@ -891,6 +889,11 @@
 	par->hsync_len = var->hsync_len;
 	par->vsync_len = var->vsync_len;
 
+	if (var->accel_flags & FB_ACCELF_TEXT)
+	    par->accel = FB_ACCELF_TEXT;
+	else
+	    par->accel = 0;
+
 	return 0;
 }
 
@@ -903,8 +906,7 @@
 static int retz3_encode_var(struct fb_var_screeninfo *var,
 			    struct retz3fb_par *par)
 {
-	short i;
-
+	memset(var, 0, sizeof(struct fb_var_screeninfo));
 	var->xres = par->xres;
 	var->yres = par->yres;
 	var->xres_virtual = par->xres_vir;
@@ -926,7 +928,7 @@
 	var->height = -1;
 	var->width = -1;
 
-	var->accel = FB_ACCEL_NCR77C32BLT;
+	var->accel_flags = (par->accel && par->bpp == 8) ? FB_ACCELF_TEXT : 0;
 
 	var->pixclock = par->pixclock;
 
@@ -938,9 +940,6 @@
 	var->hsync_len = par->hsync_len;
 	var->vsync_len = par->vsync_len;
 
-	for (i = 0; i < arraysize(var->reserved); i++)
-		var->reserved[i] = 0;
-
 	var->vmode = par->vmode;
 	return 0;
 }
@@ -1283,7 +1282,11 @@
 	switch (display->var.bits_per_pixel) {
 #ifdef CONFIG_FBCON_CFB8
 	case 8:
-		display->dispsw = &fbcon_retz3_8;
+		if (display->var.accel_flags & FB_ACCELF_TEXT) {
+		    display->dispsw = &fbcon_retz3_8;
+#warning FIXME: We should reinit the graphics engine here
+		} else
+		    display->dispsw = &fbcon_cfb8;
 		break;
 #endif
 #ifdef CONFIG_FBCON_CFB16
@@ -1305,7 +1308,7 @@
 static int retz3fb_set_var(struct fb_var_screeninfo *var, int con,
 			   struct fb_info *info)
 {
-	int err, oldxres, oldyres, oldvxres, oldvyres, oldbpp;
+	int err, oldxres, oldyres, oldvxres, oldvyres, oldbpp, oldaccel;
 	struct display *display;
 
 	if (con >= 0)
@@ -1326,12 +1329,14 @@
 		oldvxres = display->var.xres_virtual;
 		oldvyres = display->var.yres_virtual;
 		oldbpp = display->var.bits_per_pixel;
+		oldaccel = display->var.accel_flags;
 		display->var = *var;
 
 		if (oldxres != var->xres || oldyres != var->yres ||
 		    oldvxres != var->xres_virtual ||
 		    oldvyres != var->yres_virtual ||
-		    oldbpp != var->bits_per_pixel) {
+		    oldbpp != var->bits_per_pixel ||
+		    oldaccel != var->accel_flags) {
 
 			struct fb_fix_screeninfo fix;
 			retz3fb_get_fix(&fix, con, info);
@@ -1348,7 +1353,11 @@
 			switch (display->var.bits_per_pixel) {
 #ifdef CONFIG_FBCON_CFB8
 			case 8:
-				display->dispsw = &fbcon_retz3_8;
+				if (var->accel_flags & FB_ACCELF_TEXT) {
+					display->dispsw = &fbcon_retz3_8;
+#warning FIXME: We should reinit the graphics engine here
+				} else
+					display->dispsw = &fbcon_cfb8;
 				break;
 #endif
 #ifdef CONFIG_FBCON_CFB16
@@ -1448,7 +1457,7 @@
 static struct fb_ops retz3fb_ops = {
 	retz3fb_open, retz3fb_release, retz3fb_get_fix, retz3fb_get_var,
 	retz3fb_set_var, retz3fb_get_cmap, retz3fb_set_cmap,
-	retz3fb_pan_display, NULL, retz3fb_ioctl
+	retz3fb_pan_display, retz3fb_ioctl
 };
 
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/skeletonfb.c m68k/drivers/video/skeletonfb.c
--- m68k-2.1.90-current/drivers/video/skeletonfb.c	Wed Mar 25 21:23:33 1998
+++ m68k/drivers/video/skeletonfb.c	Thu Mar 26 22:55:43 1998
@@ -365,7 +365,7 @@
 
 static struct fb_ops xxxfb_ops = {
     xxxfb_open, xxxfb_release, fbgen_get_fix, fbgen_get_var, fbgen_set_var,
-    fbgen_get_cmap, fbgen_set_cmap, fbgen_pan_display, NULL, fbgen_ioctl
+    fbgen_get_cmap, fbgen_set_cmap, fbgen_pan_display, fbgen_ioctl
 };
 
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/tgafb.c m68k/drivers/video/tgafb.c
--- m68k-2.1.90-current/drivers/video/tgafb.c	Tue Mar 24 18:54:51 1998
+++ m68k/drivers/video/tgafb.c	Thu Mar 26 22:55:43 1998
@@ -296,7 +296,7 @@
 
 static struct fb_ops tgafb_ops = {
     tgafb_open, tgafb_release, tgafb_get_fix, tgafb_get_var, tgafb_set_var,
-    tgafb_get_cmap, tgafb_set_cmap, tgafb_pan_display, NULL, tgafb_ioctl
+    tgafb_get_cmap, tgafb_set_cmap, tgafb_pan_display, tgafb_ioctl
 };
 
 
@@ -695,6 +695,7 @@
     fb_fix.type_aux = 0;
     fb_fix.mmio_start = (unsigned char *)tga_regs_base;
     fb_fix.mmio_len = 0x1000;		/* Is this sufficient? */
+    fb_fix.accel = FB_ACCEL_DEC_TGA;
 
     fb_var.xoffset = fb_var.yoffset = 0;
     fb_var.grayscale = 0;
@@ -714,7 +715,7 @@
     fb_var.nonstd = 0;
     fb_var.activate = 0;
     fb_var.height = fb_var.width = -1;
-    fb_var.accel = FB_ACCEL_TGA;
+    fb_var.accel_flags = 0;
     fb_var.pixclock = 39722;
     fb_var.left_margin = 40;
     fb_var.right_margin = 24;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/txtcon.c m68k/drivers/video/txtcon.c
--- m68k-2.1.90-current/drivers/video/txtcon.c	Tue Mar 24 18:54:51 1998
+++ m68k/drivers/video/txtcon.c	Thu Mar 26 22:55:43 1998
@@ -44,7 +44,6 @@
 static int txtcon_set_font(struct vc_data *conp, int w, int h, char *data);
 static int txtcon_set_palette(struct vc_data *conp, unsigned char *table);
 static int txtcon_scrolldelta(int lines);
-static int txtcon_set_mode(struct vc_data *conp, int mode);
 
 
 static unsigned long txtcon_startup(unsigned long kmem_start,
@@ -146,12 +145,6 @@
     return -ENOSYS;
 }
 
-static int txtcon_set_mode(struct vc_data *conp, int mode)
-{
-    return -ENOSYS;
-}
-
-
 /* ====================================================================== */
 
     /*
@@ -174,5 +167,4 @@
     txtcon_set_font,
     txtcon_set_palette,
     txtcon_scrolldelta,
-    txtcon_set_mode
 };
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/vfb.c m68k/drivers/video/vfb.c
--- m68k-2.1.90-current/drivers/video/vfb.c	Tue Mar 24 18:54:51 1998
+++ m68k/drivers/video/vfb.c	Thu Mar 26 22:55:43 1998
@@ -56,7 +56,7 @@
     /* 640x480, 8 bpp */
     640, 480, 640, 480, 0, 0, 8, 0,
     {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-    0, 0, -1, -1, FB_ACCEL_NONE, 20000, 64, 64, 32, 32, 64, 2,
+    0, 0, -1, -1, 0, 20000, 64, 64, 32, 32, 64, 2,
     0, FB_VMODE_NONINTERLACED
 };
 
@@ -114,7 +114,7 @@
 
 static struct fb_ops vfb_ops = {
     vfb_open, vfb_release, vfb_get_fix, vfb_get_var, vfb_set_var, vfb_get_cmap,
-    vfb_set_cmap, vfb_pan_display, NULL, vfb_ioctl
+    vfb_set_cmap, vfb_pan_display, vfb_ioctl
 };
 
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/vgacon.c m68k/drivers/video/vgacon.c
--- m68k-2.1.90-current/drivers/video/vgacon.c	Tue Mar 24 18:54:51 1998
+++ m68k/drivers/video/vgacon.c	Thu Mar 26 22:55:43 1998
@@ -104,7 +104,6 @@
 static int vgacon_set_font(struct vc_data *conp, int w, int h, char *data);
 static int vgacon_set_palette(struct vc_data *conp, unsigned char *table);
 static int vgacon_scrolldelta(int lines);
-static int vgacon_set_mode(struct vc_data *conp, int mode);
 
 
 /*
@@ -557,12 +556,6 @@
     return -ENOSYS;
 }
 
-static int vgacon_set_mode(struct vc_data *conp, int mode)
-{
-    return -ENOSYS;
-}
-
-
 __initfunc(static int vgacon_show_logo( void ))
 {
     int height = 0;
@@ -585,5 +578,5 @@
     vgacon_startup, vgacon_init, vgacon_deinit, vgacon_clear, vgacon_putc,
     vgacon_putcs, vgacon_cursor, vgacon_scroll, vgacon_bmove, vgacon_switch,
     vgacon_blank, vgacon_get_font, vgacon_set_font, vgacon_set_palette,
-    vgacon_scrolldelta, vgacon_set_mode
+    vgacon_scrolldelta
 };
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/drivers/video/virgefb.c m68k/drivers/video/virgefb.c
--- m68k-2.1.90-current/drivers/video/virgefb.c	Tue Mar 24 18:54:51 1998
+++ m68k/drivers/video/virgefb.c	Thu Mar 26 22:55:43 1998
@@ -90,6 +90,7 @@
    int xres;
    int yres;
    int bpp;
+   int accel;
 };
 
 static struct virgefb_par current_par;
@@ -163,49 +164,49 @@
 	"640x480-8", {		/* Cybervision 8 bpp */
 	    640, 480, 640, 480, 0, 0, 8, 0,
 	    {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-	    0, 0, -1, -1, FB_ACCEL_NONE, VIRGE8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
+	    0, 0, -1, -1, FB_ACCELF_TEXT, VIRGE8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
 	    FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
 	}
     }, {
 	"800x600-8", {		/* Cybervision 8 bpp */
 	    800, 600, 800, 600, 0, 0, 8, 0,
 	    {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-	    0, 0, -1, -1, FB_ACCEL_NONE, VIRGE8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
+	    0, 0, -1, -1, FB_ACCELF_TEXT, VIRGE8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
 	    FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
 	}
     }, {
 	"1024x768-8", {		/* Cybervision 8 bpp */
 	    1024, 768, 1024, 768, 0, 0, 8, 0,
 	    {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-	    0, 0, -1, -1, FB_ACCEL_NONE, VIRGE8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
+	    0, 0, -1, -1, FB_ACCELF_TEXT, VIRGE8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
 	    FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
 	}
     }, {
 	"1152x886-8", {		/* Cybervision 8 bpp */
 	    1152, 886, 1152, 886, 0, 0, 8, 0,
 	    {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-	    0, 0, -1, -1, FB_ACCEL_NONE, VIRGE8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
+	    0, 0, -1, -1, FB_ACCELF_TEXT, VIRGE8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
 	    FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
 	}
     }, {
 	"1280x1024-8", {	/* Cybervision 8 bpp */
 	    1280, 1024, 1280, 1024, 0, 0, 8, 0,
 	    {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-	    0, 0, -1, -1, FB_ACCEL_NONE, VIRGE8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
+	    0, 0, -1, -1, FB_ACCELF_TEXT, VIRGE8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
 	    FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
 	}
     }, {
 	"1600x1200-8", {	/* Cybervision 8 bpp */
 	    1600, 1200, 1600, 1200, 0, 0, 8, 0,
 	    {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-	    0, 0, -1, -1, FB_ACCEL_NONE, VIRGE8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
+	    0, 0, -1, -1, FB_ACCELF_TEXT, VIRGE8_PIXCLOCK, 64, 96, 35, 12, 112, 2,
 	    FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
 	}
     }, {
 	"800x600-16", {		/* Cybervision 16 bpp */
 	    800, 600, 800, 600, 0, 0, 16, 0,
 	    {11, 5, 0}, {5, 6, 0}, {0, 5, 0}, {0, 0, 0},
-	    0, 0, -1, -1, FB_ACCEL_NONE, VIRGE16_PIXCLOCK, 64, 96, 35, 12, 112, 2,
+	    0, 0, -1, -1, 0, VIRGE16_PIXCLOCK, 64, 96, 35, 12, 112, 2,
 	    FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
 	}
     }
@@ -370,8 +371,7 @@
 static int Cyber_encode_fix(struct fb_fix_screeninfo *fix,
 			    struct virgefb_par *par)
 {
-	int i;
-
+	memset(fix, 0, sizeof(struct fb_fix_screeninfo));
 	strcpy(fix->id, virgefb_name);
 	fix->smem_start = (caddr_t)CyberMem;
 	fix->smem_len = CyberSize;
@@ -389,10 +389,7 @@
 	fix->ypanstep = 0;
 	fix->ywrapstep = 0;
 	fix->line_length = 0;
-
-	for (i = 0; i < arraysize(fix->reserved); i++)
-		fix->reserved[i] = 0;
-
+	fix->accel = FB_ACCEL_S3_VIRGE;
 	return(0);
 }
 
@@ -409,6 +406,10 @@
 	par->xres = var->xres;
 	par->yres = var->yres;
 	par->bpp = var->bits_per_pixel;
+	if (var->accel_flags & FB_ACCELF_TEXT)
+	    par->accel = FB_ACCELF_TEXT;
+	else
+	    par->accel = 0;
 #else
 	if (Cyberfb_Cyber8) {
 		par->xres = VIRGE8_WIDTH;
@@ -432,8 +433,7 @@
 static int Cyber_encode_var(struct fb_var_screeninfo *var,
 			    struct virgefb_par *par)
 {
-	int i;
-
+	memset(var, 0, sizeof(struct fb_var_screeninfo));
 	var->xres = par->xres;
 	var->yres = par->yres;
 	var->xres_virtual = par->xres;
@@ -470,7 +470,7 @@
 	var->height = -1;
 	var->width = -1;
 
-	var->accel = FB_ACCEL_S3VIRGE;
+	var->accel_flags = (par->accel && par->bpp == 8) ? FB_ACCELF_TEXT : 0;
 	DPRINTK("accel CV64/3D\n");
 
 	var->vmode = FB_VMODE_NONINTERLACED;
@@ -489,9 +489,6 @@
 	var->hsync_len = 112;
 	var->vsync_len = 2;
 
-	for (i = 0; i < arraysize(var->reserved); i++)
-		var->reserved[i] = 0;
-
 	return(0);
 }
 
@@ -852,7 +849,11 @@
 	switch (display->var.bits_per_pixel) {
 #ifdef CONFIG_FBCON_CFB8
 	    case 8:
-		display->dispsw = &fbcon_virge8;
+		if (display->var.accel_text & FB_ACCELF_TEXT) {
+		    display->dispsw = &fbcon_virge8;
+#warning FIXME: We should reinit the graphics engine here
+		} else
+		    display->dispsw = &fbcon_virge8;
 		break;
 #endif
 #ifdef CONFIG_FBCON_CFB16
@@ -874,7 +875,7 @@
 static int virgefb_set_var(struct fb_var_screeninfo *var, int con,
 			   struct fb_info *info)
 {
-	int err, oldxres, oldyres, oldvxres, oldvyres, oldbpp;
+	int err, oldxres, oldyres, oldvxres, oldvyres, oldbpp, oldaccel;
 
 	if ((err = do_fb_set_var(var, con == currcon)))
 		return(err);
@@ -884,11 +885,13 @@
 		oldvxres = fb_display[con].var.xres_virtual;
 		oldvyres = fb_display[con].var.yres_virtual;
 		oldbpp = fb_display[con].var.bits_per_pixel;
+		oldaccel = fb_display[con].var.accel_flags;
 		fb_display[con].var = *var;
 		if (oldxres != var->xres || oldyres != var->yres ||
 		    oldvxres != var->xres_virtual ||
 		    oldvyres != var->yres_virtual ||
-		    oldbpp != var->bits_per_pixel) {
+		    oldbpp != var->bits_per_pixel ||
+		    oldaccel != var->accel_flags) {
 			virgefb_set_disp(con, info);
 			(*fb_info.changevar)(con);
 			fb_alloc_cmap(&fb_display[con].cmap, 0, 0);
@@ -969,7 +972,7 @@
 static struct fb_ops virgefb_ops = {
 	virgefb_open, virgefb_release, virgefb_get_fix, virgefb_get_var,
 	virgefb_set_var, virgefb_get_cmap, virgefb_set_cmap,
-	virgefb_pan_display, NULL, virgefb_ioctl
+	virgefb_pan_display, virgefb_ioctl
 };
 
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/include/linux/console.h m68k/include/linux/console.h
--- m68k-2.1.90-current/include/linux/console.h	Tue Mar 24 18:54:53 1998
+++ m68k/include/linux/console.h	Wed Mar 25 23:35:56 1998
@@ -42,7 +42,6 @@
 	int	(*con_set_font)(struct vc_data *, int, int, char *);
 	int	(*con_set_palette)(struct vc_data *, unsigned char *);
 	int	(*con_scrolldelta)(int);
-	int	(*con_set_mode)(struct vc_data *, int);
 };
 
 extern struct consw *conswitchp;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.90-current/include/linux/fb.h m68k/include/linux/fb.h
--- m68k-2.1.90-current/include/linux/fb.h	Wed Mar 25 21:23:34 1998
+++ m68k/include/linux/fb.h	Wed Mar 25 21:25:16 1998
@@ -30,6 +30,8 @@
 #define FB_TYPE_PACKED_PIXELS		0	/* Packed Pixels	*/
 #define FB_TYPE_PLANES			1	/* Non interleaved planes */
 #define FB_TYPE_INTERLEAVED_PLANES	2	/* Interleaved planes	*/
+#define FB_TYPE_VGA_TEXT		3	/* VGA text/attributes	*/
+#define FB_TYPE_S3_MMIO_TEXT		4	/* S3 MMIO text		*/
 
 #define FB_VISUAL_MONO01		0	/* Monochr. 1=Black 0=White */
 #define FB_VISUAL_MONO10		1	/* Monochr. 1=White 0=Black */
@@ -37,7 +39,15 @@
 #define FB_VISUAL_PSEUDOCOLOR		3	/* Pseudo color (like atari) */
 #define FB_VISUAL_DIRECTCOLOR		4	/* Direct color */
 #define FB_VISUAL_STATIC_PSEUDOCOLOR	5	/* Pseudo color readonly */
-#define FB_VISUAL_STATIC_DIRECTCOLOR	6	/* Direct color readonly */
+
+#define FB_ACCEL_NONE		0	/* no hardware accelerator	*/
+#define FB_ACCEL_ATARIBLITT	1	/* Atari Blitter		*/
+#define FB_ACCEL_AMIGABLITT	2	/* Amiga Blitter                */
+#define FB_ACCEL_S3_TRIO64	3	/* Cybervision64 (S3 Trio64)    */
+#define FB_ACCEL_NCR_77C32BLT	4	/* RetinaZ3 (NCR 77C32BLT)      */
+#define FB_ACCEL_S3_VIRGE	5	/* Cybervision64/3D (S3 ViRGE)	*/
+#define FB_ACCEL_ATI_MACH64	6	/* ATI Mach 64			*/
+#define FB_ACCEL_DEC_TGA	7	/* DEC 21030 TGA		*/
 
 struct fb_fix_screeninfo {
 	char id[16];			/* identification string eg "TT Builtin" */
@@ -56,6 +66,12 @@
 	__u16 reserved[3];		/* Reserved for future compatibility */
 };
 
+/* Interpretation of offset for color fields: All offsets are from the right,
+ * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you
+ * can use the offset as right argument to <<). A pixel afterwards is a bit
+ * stream and is written to video memory as that unmodified. This implies
+ * big-endian byte order if bits_per_pixel is greater than 8.
+ */
 struct fb_bitfield {
 	__u32 offset;			/* beginning of bitfield	*/
 	__u32 length;			/* length of bitfield		*/
@@ -73,15 +89,7 @@
 #define FB_ACTIVATE_VBL	       16	/* activate values on next vbl  */
 #define FB_CHANGE_CMAP_VBL     32	/* change colormap on vbl	*/
 
-#define FB_ACCEL_NONE		0	/* no hardware accelerator	*/
-#define FB_ACCEL_ATARIBLITT	1	/* Atari Blitter		*/
-#define FB_ACCEL_AMIGABLITT	2	/* Amiga Blitter                */
-#define FB_ACCEL_S3TRIO64	3	/* Cybervision64 (S3 Trio64)    */
-#define FB_ACCEL_NCR77C32BLT	4	/* RetinaZ3 (NCR77C32BLT)       */
-#define FB_ACCEL_S3VIRGE	5	/* Cybervision64/3D (S3 ViRGE)	*/
-#define FB_ACCEL_MACH64		6	/* ATI Mach 64			*/
-#define FB_ACCEL_TGA		7	/* DEC 21030 TGA		*/
-#define FB_ACCEL_ATY		8	/* atyfb (ATI Mach64)		*/
+#define FB_ACCELF_TEXT		1	/* text mode acceleration */
 
 #define FB_SYNC_HOR_HIGH_ACT	1	/* horizontal sync high active	*/
 #define FB_SYNC_VERT_HIGH_ACT	2	/* vertical sync high active	*/
@@ -124,7 +132,7 @@
 	__u32 height;			/* height of picture in mm    */
 	__u32 width;			/* width of picture in mm     */
 
-	__u32 accel;			/* see FB_ACCEL_*		*/
+	__u32 accel_flags;		/* acceleration flags (hints)	*/
 
 	/* Timing: All values in pixclocks, except pixclock (of course) */
 	__u32 pixclock;			/* pixel clock in ps (pico seconds) */
@@ -154,10 +162,10 @@
 };
 
 struct fb_monspecs {
-	unsigned int hfmin;		/* hfreq lower limit (Hz) */
-	unsigned int hfmax; 		/* hfreq upper limit (Hz) */
-	unsigned short vfmin;		/* vfreq lower limit (Hz) */
-	unsigned short vfmax;		/* vfreq upper limit (Hz) */
+	__u32 hfmin;			/* hfreq lower limit (Hz) */
+	__u32 hfmax; 			/* hfreq upper limit (Hz) */
+	__u16 vfmin;			/* vfreq lower limit (Hz) */
+	__u16 vfmax;			/* vfreq upper limit (Hz) */
 	unsigned dpms : 1;		/* supports DPMS */
 };
 
@@ -196,8 +204,6 @@
     /* pan display */
     int (*fb_pan_display)(struct fb_var_screeninfo *var, int con,
 			  struct fb_info *info);
-    /* switch between text and graphics mode */
-    int (*fb_set_mode)(int mode, struct fb_info *info);
     /* perform fb specific ioctl */
     int (*fb_ioctl)(struct inode *inode, struct file *file, unsigned int cmd,
 		    unsigned long arg, int con, struct fb_info *info);

Greetings,

						Geert

--
Geert Uytterhoeven                     Geert.Uytterhoeven@cs.kuleuven.ac.be
Wavelets, Linux/{m68k~Amiga,PPC~CHRP}  http://www.cs.kuleuven.ac.be/~geert/
Department of Computer Science -- Katholieke Universiteit Leuven -- Belgium

