Date: Wed, 24 Sep 1997 13:05:40 +0200 (MET DST)
From: juergen.orschiedt@zx.basf-ag.de
Subject: L68K: fix for atafb.c - external:xres_virtual
To: linux-m68k@lists.linux-m68k.org
Sender: owner-linux-m68k@phil.uni-sb.de
Reply-To: juergen.orschiedt@zx.basf-ag.de

Here's, i think, one of the last enhancements for atafb.c:

an additional parameter xres_virtual for the external driver.
It is neccessary for cards like ProMST, which has a fixed physical
xres_virtual of 2048.

It should work without problems for 2.0.x and 2.1.x kernels.
Tested on ET4000 with xres-virtual enabled (800x600phys, 1600x600 virt).

--- drivers/video/atafb.c.~1~	Tue Aug 12 23:38:39 1997
+++ drivers/video/atafb.c	Tue Sep 23 20:24:13 1997
@@ -25,7 +25,9 @@
  *                "R<x>;<y>;<depth>". (Makes sense only on Falcon)
  *                Video mode switch on Falcon now done at next VBL interrupt
  *                to avoid the annoying right shift of the screen.
- *
+ *   - 23 Sep 97: Juergen: added xres_virtual for cards like ProMST
+ *                The external-part is legacy, therefore hardware-specific functions
+ *                like panning/hardwarescrolling/blanking isn't supported.
  *
  * To do:
  *   - For the Falcon it is not possible to set random video modes on
@@ -161,7 +163,12 @@
 /* external video handling */
 
 static unsigned			external_xres;
+static unsigned			external_xres_virtual;
 static unsigned			external_yres;
+/* not needed - atafb will never support panning/hardwarescroll with external
+ * static unsigned		external_yres_virtual;	
+*/
+
 static unsigned			external_depth;
 static int				external_pmode;
 static unsigned long	external_addr = 0;
@@ -2159,6 +2166,7 @@
 	
 	if (var->bits_per_pixel > myvar->bits_per_pixel ||
 		var->xres > myvar->xres ||
+		var->xres_virtual > myvar->xres_virtual ||
 		var->yres > myvar->yres ||
 		var->xoffset > 0 ||
 		var->yoffset > 0)
@@ -2193,13 +2201,13 @@
 
 	var->xres = external_xres;
 	var->yres = external_yres;
+	var->xres_virtual = external_xres_virtual;
 	var->bits_per_pixel = external_depth;
 	
 	var->blue=var->green=var->red;
 	var->transp.offset=0;
 	var->transp.length=0;
 	var->transp.msb_right=0;
-	var->xres_virtual=var->xres;
 	var->yres_virtual=var->yres;
 	var->xoffset=0;
 	var->yoffset=0;
@@ -2307,6 +2315,7 @@
 	struct atari_fb_par dummy_par;
 
 	myvar->xres = external_xres;
+	myvar->xres_virtual = external_xres_virtual;
 	myvar->yres = external_yres;
 	myvar->bits_per_pixel = external_depth;
 	ext_encode_var(myvar, &dummy_par);
@@ -2846,6 +2855,10 @@
 	atari_fb_set_disp(-1);
 	printk("Determined %dx%d, depth %d\n",
 	       disp.var.xres, disp.var.yres, disp.var.bits_per_pixel);
+	if ((disp.var.xres != disp.var.xres_virtual) ||
+	    (disp.var.yres != disp.var.yres_virtual))
+	   printk("   virtual %dx%d\n",
+			  disp.var.xres_virtual, disp.var.yres_virtual);
 	do_install_cmap(0);
 	printk("%s frame buffer device, using %dK of video memory\n",
 	       fb_info.modename, screen_len>>10);
@@ -2988,16 +3001,22 @@
 
 #ifdef ATAFB_EXT
     if (*ext_str) {
-	int		xres, yres, depth, planes;
+	int		xres, xres_virtual, yres, depth, planes;
 	unsigned long addr, len;
 	char *p;
 
 	/* Format is: <xres>;<yres>;<depth>;<plane organ.>;
 	 *            <screen mem addr>
-	 *	      [;<screen mem length>[;<vgaiobase>[;<colorreg-type>]]]
+	 *	      [;<screen mem length>[;<vgaiobase>[;<bits-per-col>[;<colorreg-type>
+	 *	      [;<xres-virtual>]]]]]
+	 *
+	 * 09/23/97	Juergen
+	 * <xres_virtual>:	hardware's x-resolution (f.e. ProMST)
+	 *
+	 * Even xres_virtual is available, we neither support panning nor hw-scrolling!
 	 */
 	if (!(p = strtoke(ext_str, ";")) ||!*p) goto ext_invalid;
-	xres = simple_strtoul(p, NULL, 10);
+	xres_virtual = xres = simple_strtoul(p, NULL, 10);
 	if (xres <= 0) goto ext_invalid;
 
 	if (!(p = strtoke(NULL, ";")) ||!*p) goto ext_invalid;
@@ -3030,8 +3049,9 @@
 	else
 		len = simple_strtoul(p, NULL, 0);
 
-	if ((p = strtoke(NULL, ";")) && *p)
+	if ((p = strtoke(NULL, ";")) && *p) {
 		external_vgaiobase=simple_strtoul(p, NULL, 0);
+	}
 
 	if ((p = strtoke(NULL, ";")) && *p) {
 		external_bitspercol = simple_strtoul(p, NULL, 0);
@@ -3042,13 +3062,22 @@
 	}
 	
 	if ((p = strtoke(NULL, ";")) && *p) {
-		if (!strcmp(this_opt, "vga"))
+		if (!strcmp(p, "vga"))
 			external_card_type = IS_VGA;
-		if (!strcmp(this_opt, "mv300"))
+		if (!strcmp(p, "mv300"))
 			external_card_type = IS_MV300;
 	}
 
+	if ((p = strtoke(NULL, ";")) && *p) {
+		xres_virtual = simple_strtoul(p, NULL, 10);
+		if (xres_virtual < xres)
+			xres_virtual = xres;
+		if (xres_virtual*yres*depth/8 > len)
+			len=xres_virtual*yres*depth/8;
+	}
+
 	external_xres  = xres;
+	external_xres_virtual  = xres_virtual;
 	external_yres  = yres;
 	external_depth = depth;
 	external_pmode = planes;

--- Documentation/m68k/kernel-options.txt.~1~	Tue Sep 23 20:30:42 1997
+++ Documentation/m68k/kernel-options.txt	Tue Sep 23 20:36:55 1997
@@ -420,7 +420,7 @@
 
 Syntax:
   external:<xres>;<yres>;<depth>;<org>;<scrmem>[;<scrlen>[;<vgabase>\
-           [;<colw>[;<coltype>]]]]
+           [;<colw>[;<coltype>[;<xres_virtual>]]]]]
 
 [I had to break this line...]
 
@@ -495,6 +495,14 @@
 about the color register model of your gfx board. Currently, the types
 "vga" (which is also the default) and "mv300" (SANG MV300) are
 implemented.
+
+  Parameter <xres_virtual> is required for ProMST or ET4000 cards where
+the physical linelength differs from the visible length. With ProMST, 
+xres_virtual must be set to 2048. For ET4000, xres_virtual depends on the
+initialisation of the video-card.
+If you're missing a corresponding yres_virtual: the external part is legacy,
+therefore we don't support hardware-dependend functions like hardware-scroll,
+panning or blanking.
 
 4.1.8) eclock:
 --------------

--
rfc822: Juergen.Orschiedt@zx.basf-ag.de                Juergen Orschiedt
X.400:	G=juergen; S=orschiedt; OU1=zx;          BASF Aktiengesellschaft
	P=basf-ag; A=dpb; C=de                           ZX/MB   C10-423
Phone:	+49-621-60-41468                            D-67056 Ludwigshafen

