Subject: Re: xsrc/20560 (was Re: X doesn't work on my 164LX)
To: None <naoki@fukaumi.org>
From: mel kravitz <melk@switchpwr.com>
List: port-alpha
Date: 01/06/2004 12:09:44
Hi,
Your patch works, i tested with dec2 release of 4.4rc1 and you tested in
4.4rc2. Problem reported below is nv driver problem with FX5200, NOT
present with GeForce2 MX440 card, i just duplicated your problem, and
tested the MX440 succesfully(30 times xinit->exit->xinit). Report server
hang to 'devel' list at xfree86 for nv bug. Whats needed to get Xfree
really running on all alpha's in NetBSD is as outlined in :
http://docs.freebsd.org/cgi/getmsg.cgi?fetch=0+0+current/freebsd-alpha
-Mel

On Tue, 2004-01-06 at 11:48, naoki@fukaumi.org wrote:
> Hi,
> 
> At Mon, 05 Jan 2004 20:46:07 -0800,
> David Hopper wrote:
> > I think this patch is much cleaner than the (now dysfunctional) patch from
> > xsrc/20560.  I'm appending it to the bug report FWIW.
> 
> More simple patch (comment out "msb_set" again) is below.
> 
> But my patch is for CVS HEAD version of X source from XFree86.org. It
> may not be usable until xsrc is updated to XF86 4.4.0.
> 
> # Should send-pr to XFree86.org ?
> 
> And I found a problem on my machine.
> 
> Exec XFree86 twice gets screen corrupt.
> 
> e.g.
>   startx -> exit -> startx
>     or
>   startx -> switch console (Ctrl+Alt+Fn) -> switch back to X
> 
>   => X screen corrupted and lost control of video card (no screen update)
>      + Under some condition(?), XFree86 eats cpu power around 100% ;)
> 
> No screen update, but keyboard still works. So I can do:
> 
>   Ctrl+Alt+Fn (screen still broken) -> exec shutdown -r now
>     -> machine reboot and return normal state
> 
> My patch may not be enough to work correctly...
> 
> --
> FUKAUMI Naoki
> 
> Index: alpha_video.c
> ===================================================================
> RCS file: /home/fun/cvsroot/XFree86/xc/programs/Xserver/hw/xfree86/os-support/bsd/alpha_video.c,v
> retrieving revision 1.6
> diff -u -r1.6 alpha_video.c
> --- alpha_video.c	30 Dec 2003 15:18:30 -0000	1.6
> +++ alpha_video.c	6 Jan 2004 07:23:19 -0000
> @@ -117,6 +117,8 @@
>  #endif
>  }
>  #else /* __NetBSD__ */
> +static unsigned long hae_thresh = (1UL << 24);
> +static unsigned long hae_mask = 0xf8000000UL;
>  static struct alpha_bus_window *abw;
>  static int abw_count = -1;
>  
> @@ -558,22 +560,20 @@
>  readSparse8(pointer Base, register unsigned long Offset)
>  {
>      register unsigned long result, shift;
> -#ifndef __NetBSD__
>      register unsigned long msb;
> -#endif
>      mem_barrier();
>      Offset += (unsigned long)Base - (unsigned long)memBase;
>      shift = (Offset & 0x3) << 3;
> -#ifndef __NetBSD__
>        if (Offset >= (hae_thresh)) {
>          msb = Offset & hae_mask;
>          Offset -= msb;
> +#ifndef __NetBSD__
>  	if (msb_set != msb) {
>  	sethae(msb);
>  	msb_set = msb;
>  	}
> -      }
>  #endif
> +      }
>      result = *(vuip) ((unsigned long)memSBase + (Offset << 5));
>      result >>= shift;
>      return 0xffUL & result;
> @@ -583,23 +583,21 @@
>  readSparse16(pointer Base, register unsigned long Offset)
>  {
>      register unsigned long result, shift;
> -#ifndef __NetBSD__
>      register unsigned long msb;
> -#endif
>  
>      mem_barrier();
>      Offset += (unsigned long)Base - (unsigned long)memBase;
>      shift = (Offset & 0x2) << 3;
> -#ifndef __NetBSD__
>      if (Offset >= (hae_thresh)) {
>          msb = Offset & hae_mask;
>          Offset -= msb;
> +#ifndef __NetBSD__
>        if (msb_set != msb) {
>  	sethae(msb);
>  	msb_set = msb;
>        }
> -    }
>  #endif
> +    }
>      result = *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2)));
>      result >>= shift;
>      return 0xffffUL & result;
> @@ -615,46 +613,42 @@
>  static void
>  writeSparse8(int Value, pointer Base, register unsigned long Offset)
>  {
> -#ifndef __NetBSD__
>      register unsigned long msb;
> -#endif
>      register unsigned int b = Value & 0xffU;
>  
>      write_mem_barrier();
>      Offset += (unsigned long)Base - (unsigned long)memBase;
> -#ifndef __NetBSD__
>      if (Offset >= (hae_thresh)) {
>        msb = Offset & hae_mask;
>        Offset -= msb;
> +#ifndef __NetBSD__
>        if (msb_set != msb) {
>  	sethae(msb);
>  	msb_set = msb;
>        }
> -    }
>  #endif
> +    }
>      *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101;
>  }
>  
>  static void
>  writeSparse16(int Value, pointer Base, register unsigned long Offset)
>  {
> -#ifndef __NetBSD__
>      register unsigned long msb;
> -#endif
>      register unsigned int w = Value & 0xffffU;
>  
>      write_mem_barrier();
>      Offset += (unsigned long)Base - (unsigned long)memBase;
> -#ifndef __NetBSD__
>      if (Offset >= (hae_thresh)) {
>        msb = Offset & hae_mask;
>        Offset -= msb;
> +#ifndef __NetBSD__
>        if (msb_set != msb) {
>  	sethae(msb);
>  	msb_set = msb;
>        }
> -    }
>  #endif
> +    }
>      *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) =
>        w * 0x00010001;
>  
> @@ -671,44 +665,40 @@
>  static void
>  writeSparseNB8(int Value, pointer Base, register unsigned long Offset)
>  {
> -#ifndef __NetBSD__
>      register unsigned long msb;
> -#endif
>      register unsigned int b = Value & 0xffU;
>  
>      Offset += (unsigned long)Base - (unsigned long)memBase;
> -#ifndef __NetBSD__
>      if (Offset >= (hae_thresh)) {
>        msb = Offset & hae_mask;
>        Offset -= msb;
> +#ifndef __NetBSD__
>        if (msb_set != msb) {
>  	sethae(msb);
>  	msb_set = msb;
>        }
> -    }
>  #endif
> +    }
>      *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101;
>  }
>  
>  static void
>  writeSparseNB16(int Value, pointer Base, register unsigned long Offset)
>  {
> -#ifndef __NetBSD__
>      register unsigned long msb;
> -#endif
>      register unsigned int w = Value & 0xffffU;
>  
>      Offset += (unsigned long)Base - (unsigned long)memBase;
> -#ifndef __NetBSD__
>      if (Offset >= (hae_thresh)) {
>        msb = Offset & hae_mask ;
>        Offset -= msb;
> +#ifndef __NetBSD__
>        if (msb_set != msb) {
>  	sethae(msb);
>  	msb_set = msb;
>        }
> -    }
>  #endif
> +    }
>      *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) =
>        w * 0x00010001;
>  }
-- 
mel kravitz <melk@switchpwr.com>
switching power inc