Subject: Test this Quadra Patch
To: None <port-mac68k@NetBSD.ORG>
From: Michael R Zucca <mrz5149@cs.rit.edu>
List: port-mac68k
Date: 04/18/1998 12:12:11
Ok folks. Here's a patch for Quadra intvid that should hopefully do
the following:

1. Fix the "shitfted" video problem some users get in X
2. Enable fast block copying to video ram

So if some kind soul with a Quadra could build a kernel with the
diff I've included below and test it, I'd appreciate it.

To test it do two things:
1. Start X and make sure that works
2. Test if there's any speed up on video operations by doing the
   following:

   - Boot with an unpatched kernel. Find a really big directory
     and time an ls -l on the console (scrolling uses lots of
     block operations)
   - Boot with the patched kernel and do the same thing.
   - Run any other graphical tests you can think of
     (Compile and run some Mesa programs :-)

   Hopefully there will be an appreciable difference in speed.
   
One last note: This is *not* a newbie project! If you've never
built a kernel before please wait until I get this into the
regular source. It may not work so I need experienced and
adventurous people to do this. If the patch works then I
will do a send-pr with the patch and it will make it into
the official -current sources.

Thanks!


*** grf_iv.c.orig       Mon Mar 23 07:13:43 1998
--- grf_iv.c    Sat Apr 18 02:43:51 1998
***************
*** 82,87 ****
--- 82,88 ----
        bus_space_handle_t bsh;
        int found, sense;
        u_int base;
+       u_long vbase1, vbase2 ;

        found = 1;

***************
*** 109,115 ****
                if (sense == 0)
                        found = 0;
  #endif
-
                /* Set "Turbo SCSI" configuration to default */
                bus_space_write_4(oa->oa_tag, bsh, 0x24, 0x1d1); /* ch0 */
                bus_space_write_4(oa->oa_tag, bsh, 0x28, 0x1d1); /* ch1 */
--- 110,115 ----
***************
*** 121,126 ****
--- 121,135 ----
                bus_space_write_4(oa->oa_tag, bsh, 0x10C, 0);
                bus_space_write_4(oa->oa_tag, bsh, 0x110, 0);
                bus_space_write_4(oa->oa_tag, bsh, 0x114, 0);
+
+               /* Enable "fast" video operations */
+               bus_space_write_4(oa->oa_tag, bsh, 0x14, 0x1) ;
+
+               /* Compute the current frame buffer base address */
+               vbase1 = bus_space_read_4(oa->oa_tag, bsh, 0x0) & 0xfff ;
+               vbase2 = bus_space_read_4(oa->oa_tag, bsh, 0x4) & 0xf ;
+               mac68k_vidphys = 0xf9000000 ;
+               mac68k_vidphys += ((vbase1 << 9) | (vbase2 << 5)) ;

                bus_space_unmap(oa->oa_tag, bsh, 0x1000);
                break;