Subject: Re: sfb (PMAGB-BB) patch for alternate fixed-frequencies
To: Jonathan Stone <jonathan@DSG.Stanford.EDU>
From: Michael L. Hitch <mhitch@lightning.oscs.montana.edu>
List: port-pmax
Date: 07/02/1998 16:16:36
On Jul  2,  2:23pm, Jonathan Stone wrote:
> 
> Could someone test this patch out on an SFB?
> 
> Any kind would do, but one of the PMAGB-BB cards jumpered for an
> alternate crystal -- 1024x876 or 1024x768, compatible with fixed-freq
> monitors for CFB or Persnal Decstation, respectively -- would be most
> useful.  It might even get rcons working on those machines, unless I
> made yet another dyslexic horizontal/vertical boo-booo...

  I think there is one slight error that may cause some problems.  There
are a couple of other entries that are dependant upon the height & width.

  Here's what I have been running with at home for a while now:

--- /c/src/sys/arch/pmax/dev/sfb.c	Tue Mar 31 05:21:09 1998
+++ sfb.c	Sat Jun 27 10:56:58 1998
@@ -246,18 +246,18 @@
 	/* Fill in main frame buffer info struct. */
 	fi->fi_unit = unit;
 	fi->fi_pixels = (caddr_t)(base + SFB_OFFSET_VRAM);
-	fi->fi_pixelsize = 1280 * 1024;
+	fi->fi_type.fb_height = *((int *)(base + SFB_VVERTICAL)) & 0x7ff;
+	fi->fi_type.fb_width = (*((int *)(base + SFB_VHORIZONTAL)) & 0x1ff) << 2;
+	fi->fi_pixelsize = fi->fi_type.fb_height * fi->fi_type.fb_width;
+	fi->fi_linebytes = fi->fi_type.fb_width;
 	fi->fi_base = (caddr_t)(base + SFB_ASIC_OFFSET);
 	fi->fi_vdac = (caddr_t)(base + SFB_OFFSET_BT459);
 	fi->fi_size = (fi->fi_pixels + SFB_FB_SIZE) - fi->fi_base;
-	fi->fi_linebytes = 1280;
 	fi->fi_driver = &sfb_driver;
 	fi->fi_blanked = 0;
 
 	/* Fill in Frame Buffer Type struct. */
 	fi->fi_type.fb_boardtype = PMAX_FBTYPE_SFB;
-	fi->fi_type.fb_height = 1024;
-	fi->fi_type.fb_width = 1280;
 	fi->fi_type.fb_depth = 8;
 	fi->fi_type.fb_cmsize = 256;
 	fi->fi_type.fb_size = SFB_FB_SIZE;
@@ -282,9 +282,11 @@
 		MIPS_PHYS_TO_KSEG1(MIPS_KSEG0_TO_PHYS(&sfbu));
 
 	/* This is glass-tty state but it's in the shared structure. Ick. */
-	fi->fi_fbu->scrInfo.max_row = 67;
+	if (fi->fi_type.fb_height == 1024)
+		fi->fi_fbu->scrInfo.max_row = 68;
+	else
+		fi->fi_fbu->scrInfo.max_row = 51;
 	fi->fi_fbu->scrInfo.max_col = 80;
-
 	init_pmaxfbu(fi);
 
 	/*

  Hmm - I wonder why I set fi->fi_fbu->scrInfo.max_row that way?

  Also, I think I ran into another place where the rows needed to be
calculated as well.  That was in qvss_compat.c, and I think making that
dynamic caused a little glitch in pm.c (hard coded row to 56, but the
calculated value was 57).  I've also got an adjustment in xcfb.c to
change the max_row from 50 to 51.

> Index: src/sys/arch/pmax/dev/sfb.c
> ===================================================================
> RCS file: /cvsroot/src/sys/arch/pmax/dev/sfb.c,v
> retrieving revision 1.24
> diff -c -r1.24 sfb.c
> *** sfb.c	1998/03/31 11:32:53	1.24
> --- sfb.c	1998/07/02 21:20:44
> ***************
> *** 105,110 ****
> --- 105,111 ----
>   #include <machine/pmioctl.h>
>   #include <pmax/dev/fbreg.h>
>   
> + #define SFBDEBUG
>   /*
>    * These need to be mapped into user space.
>    */
> ***************
> *** 223,228 ****
> --- 224,231 ----
>   	int silent;
>   {
>   
> + 	int h_setup, v_setup;
> + 
>   	/*
>   	 * If this device is being intialized as the console, malloc()
>   	 * is not yet up and we must use statically-allocated space.
> ***************
> *** 243,248 ****
> --- 246,254 ----
>   	if (badaddr(base + SFB_OFFSET_VRAM, 4))
>   		return (0);
>   
> + 	h_setup = * (u_int32_t*) ( ((caddr_t)fi->fi_base) + 0x0064);
> + 	v_setup = * (u_int32_t*) ( ((caddr_t)fi->fi_base) + 0x0068);
> + 
>   	/* Fill in main frame buffer info struct. */
>   	fi->fi_unit = unit;
>   	fi->fi_pixels = (caddr_t)(base + SFB_OFFSET_VRAM);
> ***************
> *** 256,267 ****
>   
>   	/* Fill in Frame Buffer Type struct. */
>   	fi->fi_type.fb_boardtype = PMAX_FBTYPE_SFB;
> ! 	fi->fi_type.fb_height = 1024;
> ! 	fi->fi_type.fb_width = 1280;
>   	fi->fi_type.fb_depth = 8;
>   	fi->fi_type.fb_cmsize = 256;
>   	fi->fi_type.fb_size = SFB_FB_SIZE;
>   
>   	/* Initialize the RAMDAC. */
>   	bt459init (fi);
>   
> --- 262,281 ----
>   
>   	/* Fill in Frame Buffer Type struct. */
>   	fi->fi_type.fb_boardtype = PMAX_FBTYPE_SFB;
> ! 	fi->fi_type.fb_height = (v_setup & 0x07ff);
> ! 	fi->fi_type.fb_width = 	(h_setup & 0x01ff) << 2;
>   	fi->fi_type.fb_depth = 8;
>   	fi->fi_type.fb_cmsize = 256;
>   	fi->fi_type.fb_size = SFB_FB_SIZE;
>   
> + #if defined(DEBUG) || defined(SFBDEBUG)
> + 	printf(" (%d x %d pixels) ", fi->fi_type.fb_height,
> + 	       	fi->fi_type.fb_width);
> + #endif
> + 
> +  	/* Initialize the RAMDAC. */
> +   	bt459init (fi);
> +   
>   	/* Initialize the RAMDAC. */
>   	bt459init (fi);
>   
> ***************
> *** 282,290 ****
>   		MIPS_PHYS_TO_KSEG1(MIPS_KSEG0_TO_PHYS(&sfbu));
>   
>   	/* This is glass-tty state but it's in the shared structure. Ick. */
> ! 	fi->fi_fbu->scrInfo.max_row = 67;
>   	fi->fi_fbu->scrInfo.max_col = 80;
>   
>   	init_pmaxfbu(fi);
>   
>   	/*
> --- 296,308 ----
>   		MIPS_PHYS_TO_KSEG1(MIPS_KSEG0_TO_PHYS(&sfbu));
>   
>   	/* This is glass-tty state but it's in the shared structure. Ick. */
> ! 	fi->fi_fbu->scrInfo.max_row = /*67*/ fi->fi_type.fb_width / 15;
>   	fi->fi_fbu->scrInfo.max_col = 80;
>   
> + #if defined(DEBUG) || defined(SFBDEBUG)
> + 	printf(" (tty %d rows by %d cols) ", 
> + 	       fi->fi_fbu->scrInfo.max_row, fi->fi_fbu->scrInfo.max_col);
> + #endif
>   	init_pmaxfbu(fi);
>   
>   	/*
-- End of excerpt from Jonathan Stone 


-- 
Michael L. Hitch			mhitch@montana.edu
Computer Consultant
Information Technology Center
Montana State University	Bozeman, MT	USA