Subject: port-amiga/1811: new format GRFIOCGETVM support for the Retinae
To: None <gnats-bugs@gnats.netbsd.org>
From: Ignatios Souvatzis <is@beverly.rhein.de>
List: netbsd-bugs
Date: 12/05/1995 11:56:59
>Number:         1811
>Category:       port-amiga
>Synopsis:       new format GRFIOCGETVM support for the Retinae
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Dec  5 08:35:00 1995
>Last-Modified:
>Originator:     Ignatios Souvatzis
>Organization:
	
>Release:        1.1
>Environment:
	
System: NetBSD beverly.rhein.de 1.1 NetBSD 1.1 (INSTALL) #0: Fri Nov 24 13:47:14 EST 1995 chopps@coffee.emich.edu:/exp/src/sys/arch/amiga/compile/INSTALL amiga


>Description:
	Shortly before -1.1 feature freeze, a new, unified format for the GRFIOCGETVM ioctl
	was introduced (_cl,_cv and _ul drivers).
	This patch contains the support for the _rt and _rh drivers.
>How-To-Repeat:
	jj
>Fix:

--- /usr/local/NetBSD-1.1/source/usr/src/sys/arch/amiga/dev/grf_rt.c	Sat Oct 14 01:42:32 1995
+++ grf_rt.c	Tue Oct 17 09:19:22 1995
@@ -901,11 +901,35 @@
   vm->disp_width   = md->MW;
   vm->disp_height  = md->MH;
   vm->depth        = md->DEP;
-  vm->hblank_start = md->HBS;
-  vm->hblank_stop  = md->HBE;
-  vm->hsync_start  = md->HSS;
-  vm->hsync_stop   = md->HSE;
-  vm->htotal       = md->HT;
+
+  /*
+   * From observation of the monitor definition table above, I guess that
+   * the horizontal timings are in units of longwords. Hence, I get the
+   * pixels by multiplication with 32 and division by the depth.
+   * The text modes, apparently marked by depth == 4, are even more wierd.
+   * According to a comment above, they are computed from a depth==8 mode
+   * (thats for us: * 32 / 8) by applying another factor of 4 / font width.
+   * Reverse applying the latter formula most of the constants cancel
+   * themselves and we are left with a nice (* font width).
+   * That is, internal timings are in units of longwords for graphics  
+   * modes, or in units of characters widths for text modes.
+   * We better don't WRITE modes until this has been real live checked.
+   * 			- Ignatios Souvatzis
+   */
+
+  if (md->DEP == 4) {
+	vm->hblank_start = md->HBS * 32 / md->DEP;
+	vm->hblank_stop  = md->HBE * 32 / md->DEP;
+	vm->hsync_start  = md->HSS * 32 / md->DEP;
+	vm->hsync_stop   = md->HSE * 32 / md->DEP;
+	vm->htotal       = md->HT * 32 / md->DEP;
+  } else {
+	vm->hblank_start = md->HBS * md->FX;
+	vm->hblank_stop  = md->HBE * md->FX;
+	vm->hsync_start  = md->HSS * md->FX;
+	vm->hsync_stop   = md->HSE * md->FX;
+	vm->htotal       = md->HT * md->FX;
+  }
   vm->vblank_start = md->VBS;
   vm->vblank_stop  = md->VBE;
   vm->vsync_start  = md->VSS;
--- /usr/local/NetBSD-1.1/source/usr/src/sys/arch/amiga/dev/grf_rh.c	Sat Oct 14 01:42:30 1995
+++ grf_rh.c	Tue Oct 17 09:04:33 1995
@@ -1535,11 +1535,37 @@
         vm->disp_width   = (md->DEP == 4) ? md->MW : md->TX;
         vm->disp_height  = (md->DEP == 4) ? md->MH : md->TY;
 	vm->depth        = md->DEP;
-	vm->hblank_start = md->HBS;
-	vm->hblank_stop  = md->HBE;
-	vm->hsync_start  = md->HSS;
-	vm->hsync_stop   = md->HSE;
-	vm->htotal       = md->HT;
+
+	/* 
+	 * From observation of the monitor definition table above, I guess
+	 * that the horizontal timings are in units of longwords. Hence, I 
+	 * get the pixels by multiplication with 32 and division by the depth.
+	 * The text modes, apparently marked by depth == 4, are even more 
+	 * wierd. According to a comment above, they are computed from a 
+	 * depth==8 mode thats for us: * 32 / 8) by applying another factor 
+	 * of 4 / font width.
+	 * Reverse applying the latter formula most of the constants cancel	
+	 * themselves and we are left with a nice (* font width).
+	 * That is, internal timings are in units of longwords for graphics 
+	 * modes, or in units of characters widths for text modes.
+	 * We better don't WRITE modes until this has been real live checked.
+	 *                    - Ignatios Souvatzis
+	 */
+          
+	if (md->DEP == 4) {
+		vm->hblank_start = md->HBS * 32 / md->DEP;
+		vm->hblank_stop  = md->HBE * 32 / md->DEP;
+		vm->hsync_start  = md->HSS * 32 / md->DEP;    
+		vm->hsync_stop   = md->HSE * 32 / md->DEP;
+		vm->htotal       = md->HT * 32 / md->DEP;
+	} else {
+		vm->hblank_start = md->HBS * md->FX;
+		vm->hblank_stop  = md->HBE * md->FX;
+		vm->hsync_start  = md->HSS * md->FX;
+		vm->hsync_stop   = md->HSE * md->FX;
+		vm->htotal       = md->HT * md->FX;    
+	}
+
 	vm->vblank_start = md->VBS;
 	vm->vblank_stop  = md->VBE;
 	vm->vsync_start  = md->VSS;
>Audit-Trail:
>Unformatted: