From turutani@scphys.kyoto-u.ac.jp  Sat Jan 27 08:47:06 2007
Return-Path: <turutani@scphys.kyoto-u.ac.jp>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id E7FD916A401
	for <FreeBSD-gnats-submit@FreeBSD.org>; Sat, 27 Jan 2007 08:47:04 +0000 (UTC)
	(envelope-from turutani@scphys.kyoto-u.ac.jp)
Received: from polymer3.scphys.kyoto-u.ac.jp (polymer3.scphys.kyoto-u.ac.jp [130.54.55.55])
	by mx1.freebsd.org (Postfix) with ESMTP id 0506713C489
	for <FreeBSD-gnats-submit@FreeBSD.org>; Sat, 27 Jan 2007 08:47:03 +0000 (UTC)
	(envelope-from turutani@scphys.kyoto-u.ac.jp)
Received: from h116.65.226.10.32118.vlan.kuins.net (h116.65.226.10.32118.vlan.kuins.net [10.226.65.116])
	by polymer3.scphys.kyoto-u.ac.jp (8.13.8/8.13.8/20060227-1) with ESMTP id l0R8HA3L006801;
	Sat, 27 Jan 2007 17:17:10 +0900 (JST)
	(envelope-from turutani@scphys.kyoto-u.ac.jp)
Received: from h116.65.226.10.32118.vlan.kuins.net (localhost [127.0.0.1])
	by h116.65.226.10.32118.vlan.kuins.net (8.13.8/8.13.8) with ESMTP id l0R8HB6S049728;
	Sat, 27 Jan 2007 17:17:11 +0900 (JST)
	(envelope-from turutani@h116.65.226.10.32118.vlan.kuins.net)
Received: (from turutani@localhost)
	by h116.65.226.10.32118.vlan.kuins.net (8.13.8/8.13.8/Submit) id l0R8HBRk049727;
	Sat, 27 Jan 2007 17:17:11 +0900 (JST)
	(envelope-from turutani)
Message-Id: <200701270817.l0R8HBRk049727@h116.65.226.10.32118.vlan.kuins.net>
Date: Sat, 27 Jan 2007 17:17:11 +0900 (JST)
From: Tsurutani Naoki <turutani@scphys.kyoto-u.ac.jp>
Reply-To: Tsurutani Naoki <turutani@scphys.kyoto-u.ac.jp>
To: FreeBSD-gnats-submit@FreeBSD.org
Subject: net/vnc does not works. 
X-Send-Pr-Version: 3.113
X-GNATS-Notify: james@now.ie

>Number:         108413
>Category:       ports
>Synopsis:       [patch] net/vnc does not works.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    itetcu
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 27 08:50:16 GMT 2007
>Closed-Date:    Tue May 06 18:09:48 UTC 2008
>Last-Modified:  Tue May  6 18:10:02 UTC 2008
>Originator:     Tsurutani Naoki
>Release:        FreeBSD 6.2-STABLE amd64
>Organization:
>Environment:
System: FreeBSD h116.65.226.10.32118.vlan.kuins.net 6.2-STABLE FreeBSD 6.2-STABLE #9: Thu Jan 18 21:40:21 JST 2007 turutani@h116.65.226.10.32118.vlan.kuins.net:/usr/local/work/usr/obj/usr/src/sys/POLYMER13 amd64


	
>Description:
	net/vnc does not works on FreeBSD/amd64.
	it works on i386 well, but only vncviewer can work on amd64.
	vncserver works, but no clients starts, and only a gray window appears
	on vncviewer.
	
>How-To-Repeat:
	% vncserver :1
	
	New 'h116.65.226.10.32118.vlan.kuins.net:1 (turutani)' desktop is h116.65.226.10.32118.vlan.kuins.net:1
	
	Starting applications specified in /home/turutani/.vnc/xstartup
	Log file is /home/turutani/.vnc/h116.65.226.10.32118.vlan.kuins.net:1.log
	
	% cat .vnc/h116.65.226.10.32118.vlan.kuins.net:1.log
	
	Xvnc Free Edition 4.1.2 - built Jan 27 2007 16:48:12
	Copyright (C) 2002-2005 RealVNC Ltd.
	See http://www.realvnc.com for information on VNC.
	Underlying X server release 40300000, The XFree86 Project, Inc
	
	
	Sat Jan 27 17:02:18 2007
	 vncext:      VNC extension running!
	 vncext:      Listening for VNC connections on port 5901
	 vncext:      Listening for HTTP connections on port 5801
	 vncext:      created VNC server for screen 0
	Could not init font path element /usr/X11R6/lib/X11/fonts/Speedo/, removing from list!
	Could not init font path element /usr/X11R6/lib/X11/fonts/CID/, removing from list!
	xset:  bad font path element (#38), possible causes are:
	    Directory does not exist or has wrong permissions
	    Directory missing fonts.dir
	    Incorrect font server address or syntax
	X Error of failed request:  BadValue (integer parameter out of range for operation)
	  Major opcode of failed request:  1 (X_CreateWindow)
	  Value in failed request:  0x21
	  Serial number of failed request:  32
	  Current serial number in output stream:  40
	X Error of failed request:  BadValue (integer parameter out of range for operation)
	  Major opcode of failed request:  1 (X_CreateWindow)
	  Value in failed request:  0x21
	  Serial number of failed request:  35
	  Current serial number in output stream:  38
	X Error of failed request:  BadValue (integer parameter out of range for operation)
	  Major opcode of failed request:  1 (X_CreateWindow)
	  Value in failed request:  0x21
	  Serial number of failed request:  56
	  Current serial number in output stream:  64
	Warning: Missing charsets in String to FontSet conversion
	Warning: Unable to load any usable fontset
	The program 'gkrellm' received an X Window System error.
	This probably reflects a bug in the program.
	The error was 'BadValue (integer parameter out of range for operation)'.
	  (Details: serial 10 error_code 2 request_code 2 minor_code 0)
	  (Note to programmers: normally, X errors are reported asynchronously;
	   that is, you will receive the error a while after causing it.
	   To debug your program, run it with the --sync command line
	   option to change this behavior. You can then get a meaningful
	   backtrace from your debugger if you break on the gdk_x_error() function.)
	X Error of failed request:  BadValue (integer parameter out of range for operation)
	  Major opcode of failed request:  1 (X_CreateWindow)
	  Value in failed request:  0x21
	  Serial number of failed request:  50
	  Current serial number in output stream:  58
	% ps -ax | grep vnc
	49580  p0  I      0:00.41 Xvnc :1 -desktop h116.65.226.10.32118.vlan.kuins.net:
	%	
	
>Fix:
	i do not know.
	


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: edwin 
State-Changed-When: Sat Jan 27 08:50:29 UTC 2007 
State-Changed-Why:  
Awaiting maintainers feedback 

http://www.freebsd.org/cgi/query-pr.cgi?pr=108413 

From: James Raftery <james@now.ie>
To: bug-followup@FreeBSD.org, turutani@scphys.kyoto-u.ac.jp
Cc:  
Subject: Re: ports/108413: net/vnc does not works.
Date: Mon, 5 Feb 2007 14:28:46 +0000

 Hi,
 
 Xvnc is running, so we need to find out why it's not starting any
 programs. Could you show the contents of /home/turutani/.vnc/xstartup
 please?
 
 	cat /home/turutani/.vnc/xstartup
 
 
 Thanks,
 james
 -- 
 Times flies like an arrow. Fruit flies like bananas.

From: Tsurutani Naoki <turutani@scphys.kyoto-u.ac.jp>
To: James Raftery <james@now.ie>
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/108413: net/vnc does not works.
Date: Tue, 06 Feb 2007 13:54:10 +0900

 % cat /home/turutani/.vnc/xstartup
 #!/bin/sh
 xterm
 %
 This simple scripts causes error...

From: James Raftery <james@now.ie>
To: Tsurutani Naoki <turutani@scphys.kyoto-u.ac.jp>
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/108413: net/vnc does not works.
Date: Tue, 6 Feb 2007 11:41:47 +0000

 On Tue, Feb 06, 2007 at 01:54:10PM +0900, Tsurutani Naoki wrote:
 > % cat /home/turutani/.vnc/xstartup
 > #!/bin/sh
 > xterm
 > %
 > This simple scripts causes error...
 
 Oh dear.
 
 Looks like you're not alone:
 
 http://lists.freebsd.org/pipermail/freebsd-questions/2006-June/125172.html
 http://www.bsdforums.org/forums/archive/index.php/t-37899.html
 
 I don't have access to an AMD64 system so I didn't know this was a problem.
 Would you mind testing if the i386 package works please?
 
  ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/6.2-RELEASE/packages/net/vnc-4.1.2.tbz
  (or your nearest  mirror)
 
 Some Googling suggests that XFree86 4.3, on which VNC is built, has problems
 on AMD64.
 
 Thanks,
 james
 -- 
 Times flies like an arrow. Fruit flies like bananas.

From: Tsurutani Naoki <turutani@scphys.kyoto-u.ac.jp>
To: James Raftery <james@now.ie>
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/108413: net/vnc does not works.
Date: Sat, 10 Feb 2007 18:17:15 +0900

 James Raftery:
 >Looks like you're not alone:
 >
 >http://lists.freebsd.org/pipermail/freebsd-questions/2006-June/125172.html
 >http://www.bsdforums.org/forums/archive/index.php/t-37899.html
 (snip)
 >Some Googling suggests that XFree86 4.3, on which VNC is built, has problems
 >on AMD64.
 
 I know that is the well known problem.
 I think we should mark "BROKEN" without "WITHOUT_SERVER" knob on ARCH=amd64, if
 it does not work fine.
 
 I tried as the others do, but I couldn't...

From: James Raftery <james@now.ie>
To: Tsurutani Naoki <turutani@scphys.kyoto-u.ac.jp>
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/108413: net/vnc does not works.
Date: Mon, 12 Feb 2007 23:09:37 +0000

 Hi,
 
 On Sat, Feb 10, 2007 at 06:17:15PM +0900, Tsurutani Naoki wrote:
 > I know that is the well known problem.
 > I think we should mark "BROKEN" without "WITHOUT_SERVER" knob on ARCH=amd64, if
 > it does not work fine.
 > I tried as the others do, but I couldn't...
 
 Did you try the i386 package? Did it work for you?
 
 I leave for three week's vacation tomorrow so I will look again at this when I
 return.
 
 
 Thanks,
 james
 -- 
 Times flies like an arrow. Fruit flies like bananas.

From: Tsurutani Naoki <turutani@scphys.kyoto-u.ac.jp>
To: james@now.ie
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/108413: net/vnc does not works.
Date: Tue, 13 Feb 2007 08:52:58 +0900

 From: James Raftery <james@now.ie>
 Subject: Re: ports/108413: net/vnc does not works.
 Date: Mon, 12 Feb 2007 23:09:37 +0000
 
 > Did you try the i386 package? Did it work for you?
 > 
 > I leave for three week's vacation tomorrow so I will look again at this when I
 > return.
 
 I didn't try... for I cannot believe the depending library and its search path
 are not treated correctly.
 But I made "hybrid" package of net/tightvnc instead of net/vnc; it contains
 vncserver for i386 and vncviewer for amd64, and also contains required 
 library and corrected description for ldconfig.  It works fine.
 
 It is not supported to build i386 package on amd64 host today, therefore
 some messages are required for amd64 users to build from ports.
 
 ---
 Tsurutani Naoki
 turutani@scphys.kyoto-u.ac.jp

From: Tsurutani Naoki <turutani@scphys.kyoto-u.ac.jp>
To: bug-followup@FreeBSD.org,  turutani@scphys.kyoto-u.ac.jp
Cc:  
Subject: Re: ports/108413: net/vnc does not works.
Date: Mon, 10 Sep 2007 12:19:58 +0900

 Here is a fix for net/vnc:
 --- Makefile.orig	2007-06-16 23:11:25.000000000 +0900
 +++ Makefile	2007-09-10 11:22:37.000000000 +0900
 @@ -53,6 +53,7 @@
  EXTRA_PATCHES+=	${WRKSRC}/xc.patch \
  		${PATCHDIR}/vnc.def-patch \
  		${PATCHDIR}/FreeBSD.cf-patch \
 +		${PATCHDIR}/xfree86-patch \
  		${PATCHDIR}/extra-patch-fix_Xvnc_no_valid_address
 
  MAN1+=		Xvnc.1 \
 @@ -79,6 +80,7 @@
  	@${REINPLACE_CMD} -e 's|%%X11BASE%%|${X11BASE}|g' \
  		${WRKSRC}/xc/config/cf/vnc.def
  	@${REINPLACE_CMD} -e 's|%%CC%%|${CC}|g' -e 's|%%CXX%%|${CXX}|g' \
 +		-e 's|%%CFLAGS%%|${CFLAGS}|g' \
  		${WRKSRC}/xc/config/cf/FreeBSD.cf
  .endif
 
 --- files/FreeBSD.cf-patch.orig	2005-05-26 22:08:37.000000000 +0900
 +++ files/FreeBSD.cf-patch	2007-09-10 11:19:23.000000000 +0900
 @@ -1,5 +1,5 @@
 ---- xc/config/cf/FreeBSD.cf.orig	Mon May 16 17:11:31 2005
 -+++ xc/config/cf/FreeBSD.cf	Mon May 16 17:11:58 2005
 +--- xc/config/cf/FreeBSD.cf.orig	2003-01-15 11:52:12.000000000 +0900
 ++++ xc/config/cf/FreeBSD.cf	2007-09-09 22:04:24.000000000 +0900
  @@ -162,11 +162,11 @@
    *    ld: warning: libXThrStub.so.6, needed by libX11.so, not found
    */
 @@ -14,5 +14,53 @@
  +# define CcCmd			%%CC%%
  +# define CplusplusCmd		%%CXX%%
   #endif
 +
 + #define CppCmd                 /usr/bin/cpp
 +@@ -223,7 +223,9 @@
 +  */
 + #ifndef BuildXF86DRI
 + #if OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 1)
 ++#ifndef x86_64Architecture
 + #define BuildXF86DRI		YES
 ++#endif
 + #endif
 + #endif
 +
 +@@ -231,7 +233,7 @@
 +  * 4.1/i386 and 5.0/i386 have the AGP driver.
 +  */
 + #ifndef HasAgpGart
 +-#if defined(i386Architecture) && \
 ++#if (defined(i386Architecture) || defined(x86_64Architecture)) && \
 + 	(OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 1))
 + #define HasAgpGart		YES
 + #endif
 +@@ -241,7 +241,7 @@
 +  * SSE and 3DNow will be autodetected, so binutils is the only
 +  * requirement for enabling this.  By 4.2 they were all supported.
 +  */
 +-#if defined(i386Architecture) && \
 ++#if (defined(i386Architecture) || defined(x86_64Architecture)) && \
 + 	(OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 2))
 + # define HasX86Support          YES
 + # define HasMMXSupport		YES
 +@@ -455,6 +455,10 @@
 + #ifdef i386Architecture
 + #define ServerExtraDefines GccGasOption XFree86ServerDefines
 + #endif
 ++#ifdef x86_64Architecture
 ++# define ServerOSDefines         XFree86ServerOSDefines -DDDXTIME
 ++# define ServerExtraDefines      GccGasOption XFree86ServerDefines
 -D_XSERVER64
 ++#endif /* x86_64Architecture */
 + #ifdef AlphaArchitecture
 + #define ServerExtraDefines GccGasOption XFree86ServerDefines -D_XSERVER64
 + #endif
 +@@ -492,7 +496,7 @@
 + #ifdef i386Architecture
 + # define OptimizedCDebugFlags DefaultGcc2i386Opt
 + #else
 +-# define OptimizedCDebugFlags -O
 ++# define OptimizedCDebugFlags %%CFLAGS%%
 + #endif
 
 - #define CppCmd			/usr/bin/cpp
 + #ifndef PreIncDir
 --- files/xfree86-patch.orig	1970-01-01 09:00:00.000000000 +0900
 +++ files/xfree86-patch	2007-09-10 11:21:21.000000000 +0900
 @@ -0,0 +1,802 @@
 +--- ../common/boilerplate.mk.orig	2004-07-14 02:23:21.000000000 +0900
 ++++ ../common/boilerplate.mk	2007-09-09 22:12:55.000000000 +0900
 +@@ -12,10 +12,10 @@
 + top_srcdir = @top_srcdir@
 + @SET_MAKE@
 + CC = @CC@
 +-CFLAGS = @CFLAGS@ $(DIR_CFLAGS)
 ++CFLAGS = @CFLAGS@ -fPIC $(DIR_CFLAGS)
 + CCLD = $(CC)
 + CXX = @CXX@
 +-CXXFLAGS = @CXXFLAGS@
 ++CXXFLAGS = @CXXFLAGS@ -fPIC
 + CXXLD = $(CXX)
 + CPPFLAGS = @CPPFLAGS@
 + DEFS = @DEFS@
 +--- xc/config/cf/Imake.cf.orig	2003-02-19 01:51:45.000000000 +0900
 ++++ xc/config/cf/Imake.cf	2007-09-09 20:16:12.000000000 +0900
 +@@ -223,6 +223,19 @@
 + #  define i386Architecture
 + #  undef i386
 + # endif
 ++# if defined(__x86_64__) || defined(x86_64)
 ++#  ifndef __x86_64__
 ++#   define __x86_64__
 ++#  endif
 ++#  ifndef x86_64Architecture
 ++#   define x86_64Architecture
 ++#  endif
 ++#  define x86_64BsdArchitecture
 ++#  undef x86_64
 ++#  undef i386
 ++#  undef i386Architecture
 ++#  undef i386BsdArchitecture
 ++# endif
 + # ifdef __alpha__
 + #  define AlphaBsdArchitecture
 + #  define AlphaArchitecture
 +--- xc/config/cf/xfree86.cf.orig	2003-02-27 05:07:59.000000000 +0900
 ++++ xc/config/cf/xfree86.cf	2007-09-09 20:40:56.000000000 +0900
 +@@ -1167,7 +1167,7 @@
 +  * The default is to install the X servers setuid-root on most OSs.
 +  * It the servers are only started by xdm, they should not be setuid-root.
 +  */
 +-#if !defined(i386MachArchitecture) && !defined(OS2Architecture)
 ++#if !defined(i386MachArchitecture) && !defined(OS2Architecture) &&
 !defined(x86_64Architecture)
 + # ifndef InstallXserverSetUID
 + #  define InstallXserverSetUID	YES
 + # endif
 +@@ -1688,7 +1688,8 @@
 + # if SystemV || SystemV4 || \
 +     (defined(LinuxArchitecture) && !defined(Mc68020Architecture)) || \
 +     defined(i386BsdArchitecture) || defined(LynxOSArchitecture) || \
 +-    defined(OS2Architecture) || defined(GNUMachArchitecture)
 ++    defined(OS2Architecture) || defined(GNUMachArchitecture) || \
 ++    defined(x86_64Architecture)
 + #   define BuildScanpci		YES
 + # else
 + #   define BuildScanpci		NO
 +@@ -1801,7 +1802,7 @@
 + #endif
 +
 + #ifndef XFree86ConsoleDefines
 +-# if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture)
 ++# if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture) ||
 defined(x86_64BsdArchitecture)
 + #  define XFree86ConsoleDefines	-DPCCONS_SUPPORT -DSYSCONS_SUPPORT
 -DPCVT_SUPPORT
 + # else
 + #  define XFree86ConsoleDefines	/**/
 +@@ -1995,7 +1996,7 @@
 +
 + #ifndef Egcs112Bug
 +   /* Not exactly precise, but it'll do for now... */
 +-# if HasGcc2 && defined(i386Architecture) && \
 ++# if HasGcc2 && (defined(i386Architecture) || defined(x86_64Architecture))
 && \
 +      (GccMajorVersion == 2) && (GccMinorVersion > 8)
 + #  define Egcs112Bug YES
 + # else
 +@@ -2012,7 +2013,7 @@
 + #define HasGlibc21Sigsetjmp NO
 + #endif
 +
 +-#ifdef i386Architecture
 ++#if defined(i386Architecture) || defined(x86_64Architecture)
 + # ifndef HasX86Support
 + #  define HasX86Support YES
 + # endif
 +--- xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile.orig	2003-02-18
 01:37:19.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile	2007-09-07
 06:38:14.000000000 +0900
 +@@ -150,6 +150,9 @@
 + #elif defined(Sparc64Architecture)
 + VIDEO_SRC = sparc64_video.c
 + VIDEO_OBJ = sparc64_video.o
 ++#elif defined(x86_64Architecture)
 ++VIDEO_SRC = i386_video.c
 ++VIDEO_OBJ = i386_video.o
 + #else
 + #error Unknown architecture !
 + #endif
 +--- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c.orig
 2002-05-23 06:38:29.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c	2007-09-08
 20:35:51.000000000 +0900
 +@@ -18,7 +18,7 @@
 +
 + #ifdef INCLUDE_XF86_NO_DOMAIN
 +
 +-#if defined(__alpha__) || defined(__sparc64__)
 ++#if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__)
 +
 + resPtr
 + xf86BusAccWindowsFromOS(void)
 +--- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.h.orig	2002-10-11
 10:40:34.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.h	2007-09-09
 11:44:01.000000000 +0900
 +@@ -2,4 +2,5 @@
 +
 + extern void KbdGetMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms,
 + 				CARD8 *pModMap);
 +-
 ++#include <sys/kbio.h>
 ++#include <sys/consio.h>
 +--- xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile.orig	2003-02-24
 05:26:49.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile	2007-09-09
 22:21:16.000000000 +0900
 +@@ -80,7 +80,7 @@
 + PCIDRVRSRC = ix86Pci.c linuxPci.c
 + PCIDRVROBJ = ix86Pci.o linuxPci.o
 +
 +-#elif defined(FreeBSDArchitecture) && defined(AlphaArchitecture)
 ++#elif defined(FreeBSDArchitecture) && (defined(AlphaArchitecture) ||
 defined(x86_64Architecture))
 +
 +
 + XCOMM generic FreeBSD PCI driver (using /dev/pci)
 +--- xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h.orig	2002-12-24
 00:37:26.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h	2007-09-09
 22:21:25.000000000 +0900
 +@@ -230,6 +230,10 @@
 + #  define ARCH_PCI_INIT linuxPciInit
 + #  define INCLUDE_XF86_MAP_PCI_MEM
 + #  define INCLUDE_XF86_NO_DOMAIN
 ++# elif defined(FreeBSD)
 ++#  define ARCH_PCI_INIT freebsdPciInit
 ++#  define INCLUDE_XF86_MAP_PCI_MEM
 ++#  define INCLUDE_XF86_NO_DOMAIN
 + # endif
 + # define XF86SCANPCI_WRAPPER ia64ScanPCIWrapper
 + #elif defined(__i386__)
 +@@ -291,14 +295,20 @@
 + # elif defined(sun)
 + #  define ARCH_PCI_INIT sparcPciInit
 + #  define INCLUDE_XF86_MAP_PCI_MEM
 +-# elif defined(__OpenBSD__) && defined(__sparc64__)
 ++# elif (defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__sparc64__)
 + #  define  ARCH_PCI_INIT freebsdPciInit
 + #  define INCLUDE_XF86_MAP_PCI_MEM
 + #  define INCLUDE_XF86_NO_DOMAIN
 + # endif
 +-# define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge
 ++# if !defined(__FreeBSD__)
 ++#  define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge
 ++# endif
 + #elif defined(__x86_64__)
 +-# define ARCH_PCI_INIT ix86PciInit
 ++# if defined(__FreeBSD__)
 ++#  define ARCH_PCI_INIT freebsdPciInit
 ++# else
 ++#  define ARCH_PCI_INIT ix86PciInit
 ++# endif
 + # define INCLUDE_XF86_MAP_PCI_MEM
 + # define INCLUDE_XF86_NO_DOMAIN
 + # if defined(linux)
 +--- xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c.orig
 2002-08-28 07:07:07.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c	2007-09-09
 22:21:33.000000000 +0900
 +@@ -84,7 +84,7 @@
 + /* bridge      */	NULL
 + };
 +
 +-#if !defined(__OpenBSD__)
 ++#if !defined(__OpenBSD__) && !defined(__FreeBSD__)
 + #if X_BYTE_ORDER == X_BIG_ENDIAN
 + #ifdef __sparc__
 + #ifndef ASI_PL
 +--- xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h.orig
 2002-05-23 06:38:30.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h	2007-09-09
 22:21:43.000000000 +0900
 +@@ -35,7 +35,13 @@
 + #elif defined(__OpenBSD__) && defined(__sparc64__)
 + /* XXX */
 + #elif defined(CSRG_BASED)
 ++#if defined(__FreeBSD__)
 ++#include <sys/types.h>
 ++#include <sys/fbio.h>
 ++#include <dev/ofw/openpromio.h>
 ++#else
 + #include <machine/fbio.h>
 ++#endif
 + #else
 + #include <sun/fbio.h>
 + #endif
 +--- xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c.orig
 2003-02-22 15:00:39.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c
 2007-09-09 22:23:14.000000000 +0900
 +@@ -480,7 +480,7 @@
 +     if (flags & XF86_MAP_FIXED)		f |= MAP_FIXED;
 +     if (flags & XF86_MAP_SHARED)	f |= MAP_SHARED;
 +     if (flags & XF86_MAP_PRIVATE)	f |= MAP_PRIVATE;
 +-#ifdef __x86_64__
 ++#if defined(__x86_64__) && defined(linux)
 +     if (flags & XF86_MAP_32BIT)	        f |= MAP_32BIT;
 + #endif
 +     if (prot  & XF86_PROT_EXEC)		p |= PROT_EXEC;
 +--- xc/programs/Xserver/hw/xfree86/common/Imakefile.orig	2003-02-18
 02:06:41.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/common/Imakefile	2007-09-09
 22:24:34.000000000 +0900
 +@@ -18,7 +18,8 @@
 + #endif /* GNUMachArchitecture */
 + #else
 + # if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture) \
 +-	|| defined(OpenBSDArchitecture) || defined(NetBSDArchitecture)
 ++	|| defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) \
 ++	|| defined(FreeBSDArchitecture)
 +         KBD = xf86KbdBSD
 + # else
 + #  ifdef LinuxArchitecture
 +--- xc/programs/Xserver/hw/xfree86/common/xf86Events.c.orig	2003-02-20
 13:20:52.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/common/xf86Events.c	2007-09-09
 22:24:56.000000000 +0900
 +@@ -315,7 +315,7 @@
 + 	    CloseDownClient(server);
 + 	}
 + 	break;
 +-#if !defined(__SOL8__) && (!defined(sun) || defined(i386))
 ++#if !defined(__SOL8__) && (!defined(sun) || defined(i386)) &&
 defined(VT_ACTIVATE)
 +     case ACTION_SWITCHSCREEN:
 + 	if (VTSwitchEnabled && !xf86Info.dontVTSwitch && arg) {
 + 	    int vtno = *((int *) arg);
 +--- xc/programs/Xserver/hw/xfree86/loader/Imakefile.orig	2003-02-27
 08:32:12.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/loader/Imakefile	2007-09-09
 22:27:05.000000000 +0900
 +@@ -34,7 +34,7 @@
 +   SETJMPDEFINES = -DHAS_GLIBC_SIGSETJMP=1
 + #endif
 +
 +-#if defined (x86_64Architecture)
 ++#if defined (x86_64Architecture) && defined(linux)
 + ARCHDEFINES = -DDoMMAPedMerge -DMmapPageAlign
 + #endif
 +
 +--- xc/programs/Xserver/hw/xfree86/loader/elfloader.c.orig	2003-01-25
 02:26:35.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/loader/elfloader.c	2007-09-09
 22:27:13.000000000 +0900
 +@@ -73,7 +73,7 @@
 + # if !defined(linux)
 + #  error    No MAP_ANON?
 + # endif
 +-# if !defined (__x86_64__)
 ++# if !defined (__x86_64__) || !defined(__linux__)
 + # define MMAP_FLAGS     (MAP_PRIVATE | MAP_ANON)
 + # else
 + # define MMAP_FLAGS     (MAP_PRIVATE | MAP_ANON | MAP_32BIT)
 +--- xc/config/cf/bsdLib.rules.orig	2007-09-10 08:00:14.000000000 +0900
 ++++ xc/config/cf/bsdLib.rules	2007-09-10 08:00:38.000000000 +0900
 +@@ -450,4 +450,14 @@
 + #endif
 +
 +
 ++#ifdef FreeBSDArchitecture YES
 ++#define NormalLibraryObjectRule()                                       @@\
 ++.c.Osuf:                                                                @@\
 ++	NormalSharedLibObjCompile($(_NOOP_))
 ++
 ++#define NormalCplusplusObjectRule()                                     @@\
 ++.CCsuf.Osuf:                                                            @@\
 ++	NormalSharedLibObjCplusplusCompile($(_NOOP_))
 ++#endif
 ++
 + #endif /* UseElfFormat */
 +--- xc/lib/font/FreeType/ftfuncs.c.orig	2003-02-13 12:01:45.000000000 +0900
 ++++ xc/lib/font/FreeType/ftfuncs.c	2007-09-10 09:30:44.000000000 +0900
 +@@ -959,11 +959,11 @@
 +         int underlinePosition, underlineThickness;
 +
 +         if(post) {
 +-            underlinePosition = TRANSFORM_FUNITS_Y(post->underlinePosition);
 ++            underlinePosition = TRANSFORM_FUNITS_Y(-post->underlinePosition);
 +             underlineThickness = TRANSFORM_FUNITS_Y(post->underlineThickness);
 +         } else {
 +             underlinePosition =
 +-                TRANSFORM_FUNITS_Y(t1info->underline_position);
 ++                TRANSFORM_FUNITS_Y(-t1info->underline_position);
 +             underlineThickness =
 +                 TRANSFORM_FUNITS_Y(t1info->underline_thickness);
 +         }
 +--- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c.orig	2003-02-09
 06:26:58.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c	2007-09-10
 09:39:58.000000000 +0900
 +@@ -1359,6 +1359,7 @@
 +    if (pMga->irq) {
 +       drmCtlUninstHandler(pMga->drmFD);
 +       pMga->irq = 0;
 ++      pMga->reg_ien = 0;
 +    }
 +
 +    /* Cleanup DMA */
 +--- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c.orig	2003-02-11
 08:42:51.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c	2007-09-10
 09:42:07.000000000 +0900
 +@@ -178,6 +178,7 @@
 +  */
 +
 + static const char *vgahwSymbols[] = {
 ++    "vgaHWUnmapMem",
 +     "vgaHWDPMSSet",
 +     "vgaHWFreeHWRec",
 +     "vgaHWGetHWRec",
 +--- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c.orig	2003-02-11
 08:42:51.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c	2007-09-10
 09:45:41.000000000 +0900
 +@@ -24,7 +24,7 @@
 + /* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen
 +    <jpaana@s2.org> */
 +
 +-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c,v 1.27
 2003/02/10 23:42:51 mvojkovi Exp $ */
 ++/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c,v 1.28
 2003/03/12 21:27:18 mvojkovi Exp $ */
 +
 + #include "nv_include.h"
 +
 +@@ -416,6 +416,9 @@
 +         break;
 +     }
 +
 ++    if(pNv->riva.Architecture == 3)
 ++       pNv->riva.PCRTC0 = pNv->riva.PGRAPH;
 ++
 +     if(pNv->SecondCRTC) {
 +        pNv->riva.PCIO = pNv->riva.PCIO0 + 0x2000;
 +        pNv->riva.PCRTC = pNv->riva.PCRTC0 + 0x800;
 +@@ -484,7 +487,6 @@
 +                                      frameBase+0x00C00000, 0x00008000);
 +
 +     NVCommonSetup(pScrn);
 +-    pNv->riva.PCRTC = pNv->riva.PCRTC0 = pNv->riva.PGRAPH;
 + }
 +
 + void
 +--- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c.orig
 2003-02-19 10:19:41.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c	2007-09-10
 09:48:30.000000000 +0900
 +@@ -275,6 +275,7 @@
 +     "drmAddMap",
 +     "drmAgpAcquire",
 +     "drmAgpAlloc",
 ++    "drmAgpBase",
 +     "drmAgpBind",
 +     "drmAgpDeviceId",
 +     "drmAgpEnable",
 +@@ -288,8 +289,11 @@
 +     "drmCommandRead",
 +     "drmCommandWrite",
 +     "drmCommandWriteRead",
 ++    "drmCtlInstHandler",
 ++    "drmCtlUninstHandler",
 +     "drmFreeBufs",
 +     "drmFreeVersion",
 ++    "drmGetInterruptFromBusID",
 +     "drmGetLibVersion",
 +     "drmGetVersion",
 +     "drmMap",
 +@@ -307,6 +311,7 @@
 +     "DRICreateInfoRec",
 +     "DRIDestroyInfoRec",
 +     "DRIFinishScreenInit",
 ++    "DRIGetDeviceInfo",
 +     "DRIGetSAREAPrivate",
 +     "DRILock",
 +     "DRIQueryVersion",
 +--- xc/lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S.orig	2002-11-08
 03:31:59.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S	2007-09-10
 09:57:23.000000000 +0900
 +@@ -28,7 +28,7 @@
 +
 + #define GLOBL( x )	\
 + .globl x;		\
 +-x##:
 ++x:
 +
 + .data
 + .align 4
 +--- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c.orig
 2003-02-25 05:34:55.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c	2007-09-10
 09:59:44.000000000 +0900
 +@@ -370,7 +370,7 @@
 +     }
 +
 +     if (info->IsSecondary || info->Clone) {
 +-	save2 = INREG(RADEON_CRTC_GEN_CNTL) & ~(CARD32) (3 << 20);
 ++	save2 = INREG(RADEON_CRTC2_GEN_CNTL) & ~(CARD32) (3 << 20);
 + 	save2 |= (CARD32) (2 << 20);
 + 	OUTREG(RADEON_CRTC2_GEN_CNTL, save2 & (CARD32)~RADEON_CRTC2_CUR_EN);
 +     }
 +--- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c.orig	2003-02-19
 18:17:30.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c	2007-09-10
 10:01:06.000000000 +0900
 +@@ -1585,6 +1585,7 @@
 +     if (info->irq) {
 + 	drmCtlUninstHandler(info->drmFD);
 + 	info->irq = 0;
 ++	info->ModeReg.gen_int_cntl = 0;
 +     }
 +
 + 				/* De-allocate vertex buffers */
 +--- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h.orig	2003-02-08
 03:08:59.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h	2007-09-10
 10:02:33.000000000 +0900
 +@@ -879,7 +879,7 @@
 + #       define RADEON_P2PLL_REF_DIV_MASK    0x03ff
 + #       define RADEON_P2PLL_ATOMIC_UPDATE_R (1 << 15) /* same as _W */
 + #       define RADEON_P2PLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */
 +-#       define R300_PPLL_REF_DIV_ACC_MASK   (0x3ff < 18)
 ++#       define R300_PPLL_REF_DIV_ACC_MASK   (0x3ff << 18)
 + #       define R300_PPLL_REF_DIV_ACC_SHIFT  18
 + #define RADEON_PALETTE_DATA                 0x00b4
 + #define RADEON_PALETTE_30_DATA              0x00b8
 +--- xc/lib/GL/mesa/src/drv/radeon/radeon_vtxtmp_x86.S.orig	2002-11-08
 03:32:00.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/radeon/radeon_vtxtmp_x86.S	2007-09-10
 10:03:57.000000000 +0900
 +@@ -28,7 +28,7 @@
 +
 + #define GLOBL( x )	\
 + .globl x;		\
 +-x##:
 ++x:
 +
 + .data
 + .align 4
 +--- xc/lib/GL/mesa/src/drv/r200/r200_context.c.orig	2002-12-17
 01:18:53.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/r200/r200_context.c	2007-09-10
 10:05:57.000000000 +0900
 +@@ -391,6 +391,7 @@
 +     */
 +    _tnl_destroy_pipeline( ctx );
 +    _tnl_install_pipeline( ctx, r200_pipeline );
 ++   ctx->Driver.FlushVertices = r200FlushVertices;
 +
 +    /* Try and keep materials and vertices separate:
 +     */
 +--- xc/lib/GL/mesa/src/drv/r200/r200_swtcl.c.orig	2002-12-24
 00:29:26.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/r200/r200_swtcl.c	2007-09-10 10:08:12.000000000
 +0900
 +@@ -46,6 +46,7 @@
 + #include "math/m_translate.h"
 + #include "tnl/tnl.h"
 + #include "tnl/t_context.h"
 ++#include "tnl/t_imm_exec.h"
 + #include "tnl/t_pipeline.h"
 +
 + #include "r200_context.h"
 +@@ -1223,6 +1224,14 @@
 + }
 +
 +
 ++void r200FlushVertices( GLcontext *ctx, GLuint flags )
 ++{
 ++   _tnl_flush_vertices( ctx, flags );
 ++
 ++   if (flags & FLUSH_STORED_VERTICES)
 ++      R200_FIREVERTICES( R200_CONTEXT( ctx ) );
 ++}
 ++
 + /**********************************************************************/
 + /*                            Initialization.                         */
 + /**********************************************************************/
 +--- xc/lib/GL/mesa/src/drv/r200/r200_swtcl.h.orig	2002-12-17
 01:18:55.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/r200/r200_swtcl.h	2007-09-10 10:09:23.000000000
 +0900
 +@@ -42,6 +42,7 @@
 + extern void r200InitSwtcl( GLcontext *ctx );
 + extern void r200DestroySwtcl( GLcontext *ctx );
 +
 ++extern void r200FlushVertices( GLcontext *ctx, GLuint flags );
 + extern void r200ChooseRenderState( GLcontext *ctx );
 + extern void r200ChooseVertexState( GLcontext *ctx );
 +
 +--- xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c.orig	2002-12-17
 01:18:55.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c	2007-09-10 10:13:18.000000000
 +0900
 +@@ -38,6 +38,7 @@
 + #include "r200_ioctl.h"
 + #include "r200_tex.h"
 + #include "r200_tcl.h"
 ++#include "r200_swtcl.h"
 + #include "r200_vtxfmt.h"
 +
 + #include "api_noop.h"
 +@@ -59,7 +60,7 @@
 +
 + struct r200_vb vb;
 +
 +-static void r200FlushVertices( GLcontext *, GLuint );
 ++static void r200VtxFmtFlushVertices( GLcontext *, GLuint );
 +
 + static void count_func( const char *name,  struct dynfn *l )
 + {
 +@@ -357,12 +358,13 @@
 +       fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
 +
 +    if (ctx->Driver.NeedFlush)
 +-      r200FlushVertices( ctx, ctx->Driver.NeedFlush );
 ++      r200VtxFmtFlushVertices( ctx, ctx->Driver.NeedFlush );
 +
 +    if (ctx->NewState)
 +       _mesa_update_state( ctx ); /* clear state so fell_back sticks */
 +
 +    _tnl_wakeup_exec( ctx );
 ++   ctx->Driver.FlushVertices = r200FlushVertices;
 +
 +    assert( rmesa->dma.flush == 0 );
 +    rmesa->vb.fell_back = GL_TRUE;
 +@@ -404,6 +406,7 @@
 +    prim = rmesa->vb.prim[0];
 +    ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1;
 +    _tnl_wakeup_exec( ctx );
 ++   ctx->Driver.FlushVertices = r200FlushVertices;
 +
 +    assert(rmesa->dma.flush == 0);
 +    rmesa->vb.fell_back = GL_TRUE;
 +@@ -756,7 +759,7 @@
 + 	    fprintf(stderr, "reinstall (new install)\n");
 +
 + 	 _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
 +-	 ctx->Driver.FlushVertices = r200FlushVertices;
 ++	 ctx->Driver.FlushVertices = r200VtxFmtFlushVertices;
 + 	 ctx->Driver.NewList = r200NewList;
 + 	 rmesa->vb.installed = GL_TRUE;
 + 	 vb.context = ctx;
 +@@ -772,6 +775,7 @@
 + 	 if (rmesa->dma.flush)
 + 	    rmesa->dma.flush( rmesa );
 + 	 _tnl_wakeup_exec( ctx );
 ++	 ctx->Driver.FlushVertices = r200FlushVertices;
 + 	 rmesa->vb.installed = GL_FALSE;
 + 	 vb.context = 0;
 +       }
 +@@ -931,7 +935,7 @@
 +    return GL_TRUE;
 + }
 +
 +-static void r200FlushVertices( GLcontext *ctx, GLuint flags )
 ++static void r200VtxFmtFlushVertices( GLcontext *ctx, GLuint flags )
 + {
 +    r200ContextPtr rmesa = R200_CONTEXT( ctx );
 +
 +--- xc/lib/GL/mesa/src/drv/radeon/radeon_context.c.orig	2003-02-09
 06:26:45.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/radeon/radeon_context.c	2007-09-10
 10:14:38.000000000 +0900
 +@@ -382,6 +382,7 @@
 +     */
 +    _tnl_destroy_pipeline( ctx );
 +    _tnl_install_pipeline( ctx, radeon_pipeline );
 ++   ctx->Driver.FlushVertices = radeonFlushVertices;
 +
 +    /* Try and keep materials and vertices separate:
 +     */
 +--- xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.c.orig	2003-02-16
 07:18:48.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.c	2007-09-10
 10:17:15.000000000 +0900
 +@@ -45,6 +45,7 @@
 + #include "math/m_translate.h"
 + #include "tnl/tnl.h"
 + #include "tnl/t_context.h"
 ++#include "tnl/t_imm_exec.h"
 + #include "tnl/t_pipeline.h"
 +
 + #include "radeon_context.h"
 +@@ -1134,6 +1135,14 @@
 + }
 +
 +
 ++void radeonFlushVertices( GLcontext *ctx, GLuint flags )
 ++{
 ++   _tnl_flush_vertices( ctx, flags );
 ++
 ++   if (flags & FLUSH_STORED_VERTICES)
 ++      RADEON_FIREVERTICES( RADEON_CONTEXT( ctx ) );
 ++}
 ++
 + /**********************************************************************/
 + /*                            Initialization.                         */
 + /**********************************************************************/
 +--- xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.h.orig	2002-10-30
 21:51:57.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.h	2007-09-10
 10:18:31.000000000 +0900
 +@@ -43,6 +43,7 @@
 + extern void radeonInitSwtcl( GLcontext *ctx );
 + extern void radeonDestroySwtcl( GLcontext *ctx );
 +
 ++extern void radeonFlushVertices( GLcontext *ctx, GLuint flags );
 + extern void radeonChooseRenderState( GLcontext *ctx );
 + extern void radeonChooseVertexState( GLcontext *ctx );
 +
 +--- xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c.orig	2002-12-17
 01:18:59.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c	2007-09-10
 10:22:20.000000000 +0900
 +@@ -38,6 +38,7 @@
 + #include "radeon_ioctl.h"
 + #include "radeon_tex.h"
 + #include "radeon_tcl.h"
 ++#include "radeon_swtcl.h"
 + #include "radeon_vtxfmt.h"
 +
 + #include "api_noop.h"
 +@@ -59,7 +60,7 @@
 +
 + struct radeon_vb vb;
 +
 +-static void radeonFlushVertices( GLcontext *, GLuint );
 ++static void radeonVtxfmtFlushVertices( GLcontext *, GLuint );
 +
 + static void count_func( const char *name,  struct dynfn *l )
 + {
 +@@ -336,12 +337,13 @@
 +       fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
 +
 +    if (ctx->Driver.NeedFlush)
 +-      radeonFlushVertices( ctx, ctx->Driver.NeedFlush );
 ++      radeonVtxfmtFlushVertices( ctx, ctx->Driver.NeedFlush );
 +
 +    if (ctx->NewState)
 +       _mesa_update_state( ctx ); /* clear state so fell_back sticks */
 +
 +    _tnl_wakeup_exec( ctx );
 ++   ctx->Driver.FlushVertices = radeonFlushVertices;
 +
 +    assert( rmesa->dma.flush == 0 );
 +    rmesa->vb.fell_back = GL_TRUE;
 +@@ -382,6 +384,7 @@
 +    prim = rmesa->vb.prim[0];
 +    ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1;
 +    _tnl_wakeup_exec( ctx );
 ++   ctx->Driver.FlushVertices = radeonFlushVertices;
 +
 +    assert(rmesa->dma.flush == 0);
 +    rmesa->vb.fell_back = GL_TRUE;
 +@@ -731,7 +734,7 @@
 + 	    fprintf(stderr, "reinstall (new install)\n");
 +
 + 	 _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
 +-	 ctx->Driver.FlushVertices = radeonFlushVertices;
 ++	 ctx->Driver.FlushVertices = radeonVtxfmtFlushVertices;
 + 	 ctx->Driver.NewList = radeonNewList;
 + 	 rmesa->vb.installed = GL_TRUE;
 + 	 vb.context = ctx;
 +@@ -747,6 +750,7 @@
 + 	 if (rmesa->dma.flush)
 + 	    rmesa->dma.flush( rmesa );
 + 	 _tnl_wakeup_exec( ctx );
 ++	 ctx->Driver.FlushVertices = radeonFlushVertices;
 + 	 rmesa->vb.installed = GL_FALSE;
 + 	 vb.context = 0;
 +       }
 +@@ -905,7 +909,7 @@
 +    return GL_TRUE;
 + }
 +
 +-static void radeonFlushVertices( GLcontext *ctx, GLuint flags )
 ++static void radeonVtxfmtFlushVertices( GLcontext *ctx, GLuint flags )
 + {
 +    radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
 +
 +--- xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h.orig	2003-02-08
 05:41:11.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h	2007-09-10
 10:25:56.000000000 +0900
 +@@ -498,21 +498,34 @@
 + #define PCI_CHIP_TRIO64V2_DXGX		0x8901
 + #define PCI_CHIP_PLATO_PX		0x8902
 + #define PCI_CHIP_Trio3D			0x8904
 +-#define PCI_CHIP_Trio3D_2X		0x8A13
 + #define PCI_CHIP_VIRGE_DXGX		0x8A01
 + #define PCI_CHIP_VIRGE_GX2		0x8A10
 ++#define PCI_CHIP_Trio3D_2X		0x8A13
 + #define PCI_CHIP_SAVAGE3D		0x8A20
 + #define PCI_CHIP_SAVAGE3D_MV		0x8A21
 + #define PCI_CHIP_SAVAGE4		0x8A22
 +-#define PCI_CHIP_VIRGE_MX		0x8C01
 +-#define PCI_CHIP_VIRGE_MXPLUS		0x8C01
 +-#define PCI_CHIP_VIRGE_MXP		0x8C03
 + #define PCI_CHIP_PROSAVAGE_PM		0x8A25
 + #define PCI_CHIP_PROSAVAGE_KM		0x8A26
 ++#define PCI_CHIP_VIRGE_MX		0x8C01
 ++#define PCI_CHIP_VIRGE_MXPLUS		0x8C02
 ++#define PCI_CHIP_VIRGE_MXP		0x8C03
 + #define PCI_CHIP_SAVAGE_MX_MV		0x8C10
 + #define PCI_CHIP_SAVAGE_MX		0x8C11
 + #define PCI_CHIP_SAVAGE_IX_MV		0x8C12
 + #define PCI_CHIP_SAVAGE_IX		0x8C13
 ++#define PCI_CHIP_SUPSAV_MX128		0x8C22
 ++#define PCI_CHIP_SUPSAV_MX64		0x8C24
 ++#define PCI_CHIP_SUPSAV_MX64C		0x8C26
 ++#define PCI_CHIP_SUPSAV_IX128SDR	0x8C2A
 ++#define PCI_CHIP_SUPSAV_IX128DDR	0x8C2B
 ++#define PCI_CHIP_SUPSAV_IX64SDR		0x8C2C
 ++#define PCI_CHIP_SUPSAV_IX64DDR		0x8C2D
 ++#define PCI_CHIP_SUPSAV_IXCSDR		0x8C2E
 ++#define PCI_CHIP_SUPSAV_IXCDDR		0x8C2F
 ++#define PCI_CHIP_S3TWISTER_P		0x8D01
 ++#define PCI_CHIP_S3TWISTER_K		0x8D02
 ++#define PCI_CHIP_PROSAVAGE_DDR		0x8D03
 ++#define PCI_CHIP_PROSAVAGE_DDRK		0x8D04
 + #define PCI_CHIP_SAVAGE2000		0x9102
 +
 + /* ARK Logic */
 +--- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h.orig
 2002-10-03 05:39:55.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h	2007-09-10
 10:27:32.000000000 +0900
 +@@ -3,30 +3,6 @@
 + #ifndef _SAVAGE_REGS_H
 + #define _SAVAGE_REGS_H
 +
 +-/* These are here until xf86PciInfo.h is updated. */
 +-
 +-#ifndef PCI_CHIP_S3TWISTER_P
 +-#define PCI_CHIP_S3TWISTER_P	0x8d01
 +-#endif
 +-#ifndef PCI_CHIP_S3TWISTER_K
 +-#define PCI_CHIP_S3TWISTER_K	0x8d02
 +-#endif
 +-#ifndef PCI_CHIP_SUPSAV_MX128
 +-#define PCI_CHIP_SUPSAV_MX128		0x8c22
 +-#define PCI_CHIP_SUPSAV_MX64		0x8c24
 +-#define PCI_CHIP_SUPSAV_MX64C		0x8c26
 +-#define PCI_CHIP_SUPSAV_IX128SDR	0x8c2a
 +-#define PCI_CHIP_SUPSAV_IX128DDR	0x8c2b
 +-#define PCI_CHIP_SUPSAV_IX64SDR		0x8c2c
 +-#define PCI_CHIP_SUPSAV_IX64DDR		0x8c2d
 +-#define PCI_CHIP_SUPSAV_IXCSDR		0x8c2e
 +-#define PCI_CHIP_SUPSAV_IXCDDR		0x8c2f
 +-#endif
 +-#ifndef PCI_CHIP_PROSAVAGE_DDR
 +-#define PCI_CHIP_PROSAVAGE_DDR	0x8d03
 +-#define PCI_CHIP_PROSAVAGE_DDRK	0x8d04
 +-#endif
 +-
 + #define S3_SAVAGE3D_SERIES(chip)  ((chip>=S3_SAVAGE3D) &&
 (chip<=S3_SAVAGE_MX))
 +
 + #define S3_SAVAGE4_SERIES(chip)   ((chip==S3_SAVAGE4) || (chip==S3_PROSAVAGE))
 +--- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c.orig
 2003-02-25 13:08:21.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c
 2007-09-10 10:28:45.000000000 +0900
 +@@ -123,8 +123,8 @@
 +     { PCI_CHIP_SAVAGE_IX,	"Savage/IX" },
 +     { PCI_CHIP_PROSAVAGE_PM,	"ProSavage PM133" },
 +     { PCI_CHIP_PROSAVAGE_KM,	"ProSavage KM133" },
 +-    { PCI_CHIP_S3TWISTER_P,	"ProSavage PN133" },
 +-    { PCI_CHIP_S3TWISTER_K,	"ProSavage KN133" },
 ++    { PCI_CHIP_S3TWISTER_P,	"Twister PN133" },
 ++    { PCI_CHIP_S3TWISTER_K,	"Twister KN133" },
 +     { PCI_CHIP_SUPSAV_MX128,	"SuperSavage/MX 128" },
 +     { PCI_CHIP_SUPSAV_MX64,	"SuperSavage/MX 64" },
 +     { PCI_CHIP_SUPSAV_MX64C,	"SuperSavage/MX 64C" },
 +--- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c.orig
 2003-02-06 02:45:29.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c
 2007-09-10 10:30:31.000000000 +0900
 +@@ -1410,7 +1410,7 @@
 + 	ENTER_PROC("SMI_Save");
 +
 + 	/* Save the standard VGA registers */
 +-	vgaHWSave(pScrn, vgaSavePtr, VGA_SR_MODE);
 ++	vgaHWSave(pScrn, vgaSavePtr, VGA_SR_ALL);
 + 	save->smiDACMask = VGAIN8(pSmi, VGA_DAC_MASK);
 + 	VGAOUT8(pSmi, VGA_DAC_READ_ADDR, 0);
 + 	for (i = 0; i < 256; i++)
 +@@ -1601,7 +1601,7 @@
 + 		VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0xA0, restore->SRA0);
 +
 + 		/* Restore the standard VGA registers */
 +-		vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_MODE);
 ++		vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_ALL);
 + 		if (restore->smiDACMask)
 + 		{
 + 			VGAOUT8(pSmi, VGA_DAC_MASK, restore->smiDACMask);
 +@@ -1672,7 +1672,7 @@
 + 		}
 +
 + 		if (restore->modeInit)
 +-		    vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_MODE);
 ++		    vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_ALL);
 +
 + 		if (!SMI_LYNXM_SERIES(pSmi->Chipset))
 + 		{
 +--- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c.orig
 2003-01-12 12:55:49.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c
 2007-09-10 10:31:51.000000000 +0900
 +@@ -277,7 +277,7 @@
 +     {XvSettable | XvGettable,        0,             1, XV_INTERLACED_NAME},
 + };
 +
 +-static XF86AttributeRec SMI_VideoAttributes[N_ATTRS] = {
 ++static XF86AttributeRec SMI_VideoAttributes[2] = {
 +     {XvSettable | XvGettable,        0,           255, XV_BRIGHTNESS_NAME},
 +     {XvSettable | XvGettable, 0x000000,      0xFFFFFF, XV_COLORKEY_NAME},
 + };
 +--- xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile.orig	2002-09-17
 03:06:01.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile	2007-09-10
 10:34:37.000000000 +0900
 +@@ -49,7 +49,7 @@
 + #define FFBsObjectRule(name)						@@\
 + name.o: name.s								@@\
 + 	$(RM) $@							@@\
 +-	$(CPP) $*.s | $(AS) $(GCCVISOPTION) -o $@ -
 ++	$(CC) -c -x assembler-with-cpp $(GCCVISOPTION) $*.s -o $@
 + #endif
 + #else
 + VISOBJS =
 +--- xc/programs/Xserver/xkb/xkbInit.c.orig	2003-02-09 15:29:20.000000000 +0900
 ++++ xc/programs/Xserver/xkb/xkbInit.c	2007-09-10 10:42:15.000000000 +0900
 +@@ -713,7 +713,7 @@
 +     if (names->types) names->types = _XkbDupString(names->types);
 +     if (names->compat) names->compat = _XkbDupString(names->compat);
 +     if (names->geometry) names->geometry = _XkbDupString(names->geometry);
 +-    if (names->symbols) names->geometry = _XkbDupString(names->symbols);
 ++    if (names->symbols) names->symbols = _XkbDupString(names->symbols);
 +
 +     if (defs.model && defs.layout && rules) {
 + 	XkbComponentNamesRec	rNames;
 +--- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c.orig	2003-01-30
 04:29:49.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c	2007-09-10
 10:43:51.000000000 +0900
 +@@ -304,7 +304,10 @@
 +     "drmAgpVendorId",
 +     "drmCommandNone",
 +     "drmCommandWrite",
 ++    "drmCtlInstHandler",
 ++    "drmCtlUninstHandler",
 +     "drmFreeVersion",
 ++    "drmGetInterruptFromBusID",
 +     "drmGetLibVersion",
 +     "drmGetVersion",
 +     "drmMap",
 
 
 Fix about net/tightvnc(see ports/108414) is now under review.
 Patch file contains fixes about amd64, and other fixes used
 at x11-servers/XFree86-4-Server (v4.3.0).
 I confirmed on FreeBSD/i386 6-STABLE and FreeBSD/amd64 6-STABLE.
 
State-Changed-From-To: feedback->open 
State-Changed-By: linimon 
State-Changed-When: Sun Mar 2 06:34:18 UTC 2008 
State-Changed-Why:  
Note that feedback, with a patch, was received some time ago. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=108413 

From: Tsurutani Naoki <turutani@scphys.kyoto-u.ac.jp>
To: bug-followup@FreeBSD.org
Cc: james@now.ie, freebsd-ports-bugs@FreeBSD.org
Subject: Re: ports/108413: [patch] net/vnc does not works.
Date: Thu, 13 Mar 2008 13:56:58 +0900

 Hi,
 
 The patch I sent previously was wrong, for it containes unexpected line feed, etc.
 Here is a correct one to the ports/net/vnc:
 
 --- Makefile.orig	2007-06-16 23:11:25.000000000 +0900
 +++ Makefile	2007-09-10 11:22:37.000000000 +0900
 @@ -54,6 +54,7 @@
  EXTRA_PATCHES+=	${WRKSRC}/xc.patch \
  		${PATCHDIR}/vnc.def-patch \
  		${PATCHDIR}/FreeBSD.cf-patch \
 +		${PATCHDIR}/xfree86-patch \
  		${PATCHDIR}/extra-patch-fix_Xvnc_no_valid_address
  
  MAN1+=		Xvnc.1 \
 @@ -80,6 +81,7 @@
  	@${REINPLACE_CMD} -e 's|%%X11BASE%%|${X11BASE}|g' \
  		${WRKSRC}/xc/config/cf/vnc.def
  	@${REINPLACE_CMD} -e 's|%%CC%%|${CC}|g' -e 's|%%CXX%%|${CXX}|g' \
 +		-e 's|%%CFLAGS%%|${CFLAGS}|g' \
  		${WRKSRC}/xc/config/cf/FreeBSD.cf
  .endif
  
 --- files/FreeBSD.cf-patch.orig	2005-05-26 22:08:37.000000000 +0900
 +++ files/FreeBSD.cf-patch	2007-09-10 11:19:23.000000000 +0900
 @@ -1,5 +1,5 @@
 ---- xc/config/cf/FreeBSD.cf.orig	Mon May 16 17:11:31 2005
 -+++ xc/config/cf/FreeBSD.cf	Mon May 16 17:11:58 2005
 +--- xc/config/cf/FreeBSD.cf.orig	2003-01-15 11:52:12.000000000 +0900
 ++++ xc/config/cf/FreeBSD.cf	2007-09-09 22:04:24.000000000 +0900
  @@ -162,11 +162,11 @@
    *    ld: warning: libXThrStub.so.6, needed by libX11.so, not found
    */
 @@ -16,3 +16,51 @@
   #endif
   
   #define CppCmd			/usr/bin/cpp
 +@@ -223,7 +223,9 @@
 +  */
 + #ifndef BuildXF86DRI
 + #if OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 1)
 ++#ifndef x86_64Architecture
 + #define BuildXF86DRI		YES
 ++#endif
 + #endif
 + #endif
 + 
 +@@ -231,7 +233,7 @@
 +  * 4.1/i386 and 5.0/i386 have the AGP driver.
 +  */
 + #ifndef HasAgpGart
 +-#if defined(i386Architecture) && \
 ++#if (defined(i386Architecture) || defined(x86_64Architecture)) && \
 + 	(OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 1))
 + #define HasAgpGart		YES
 + #endif
 +@@ -241,7 +241,7 @@
 +  * SSE and 3DNow will be autodetected, so binutils is the only 
 +  * requirement for enabling this.  By 4.2 they were all supported.
 +  */
 +-#if defined(i386Architecture) && \
 ++#if (defined(i386Architecture) || defined(x86_64Architecture)) && \
 + 	(OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 2))
 + # define HasX86Support          YES
 + # define HasMMXSupport		YES
 +@@ -455,6 +455,10 @@
 + #ifdef i386Architecture
 + #define ServerExtraDefines GccGasOption XFree86ServerDefines
 + #endif
 ++#ifdef x86_64Architecture
 ++# define ServerOSDefines         XFree86ServerOSDefines -DDDXTIME
 ++# define ServerExtraDefines      GccGasOption XFree86ServerDefines -D_XSERVER64
 ++#endif /* x86_64Architecture */
 + #ifdef AlphaArchitecture
 + #define ServerExtraDefines GccGasOption XFree86ServerDefines -D_XSERVER64
 + #endif
 +@@ -492,7 +496,7 @@
 + #ifdef i386Architecture
 + # define OptimizedCDebugFlags DefaultGcc2i386Opt
 + #else
 +-# define OptimizedCDebugFlags -O
 ++# define OptimizedCDebugFlags %%CFLAGS%% 
 + #endif
 + 
 + #ifndef PreIncDir
 --- files/xfree86-patch.orig	1970-01-01 09:00:00.000000000 +0900
 +++ files/xfree86-patch	2007-09-10 11:21:21.000000000 +0900
 @@ -0,0 +1,802 @@
 +--- ../common/boilerplate.mk.orig	2004-07-14 02:23:21.000000000 +0900
 ++++ ../common/boilerplate.mk	2007-09-09 22:12:55.000000000 +0900
 +@@ -12,10 +12,10 @@
 + top_srcdir = @top_srcdir@
 + @SET_MAKE@
 + CC = @CC@
 +-CFLAGS = @CFLAGS@ $(DIR_CFLAGS)
 ++CFLAGS = @CFLAGS@ -fPIC $(DIR_CFLAGS)
 + CCLD = $(CC)
 + CXX = @CXX@
 +-CXXFLAGS = @CXXFLAGS@
 ++CXXFLAGS = @CXXFLAGS@ -fPIC
 + CXXLD = $(CXX)
 + CPPFLAGS = @CPPFLAGS@
 + DEFS = @DEFS@
 +--- xc/config/cf/Imake.cf.orig	2003-02-19 01:51:45.000000000 +0900
 ++++ xc/config/cf/Imake.cf	2007-09-09 20:16:12.000000000 +0900
 +@@ -223,6 +223,19 @@
 + #  define i386Architecture
 + #  undef i386
 + # endif
 ++# if defined(__x86_64__) || defined(x86_64)
 ++#  ifndef __x86_64__
 ++#   define __x86_64__
 ++#  endif
 ++#  ifndef x86_64Architecture
 ++#   define x86_64Architecture
 ++#  endif
 ++#  define x86_64BsdArchitecture
 ++#  undef x86_64
 ++#  undef i386
 ++#  undef i386Architecture
 ++#  undef i386BsdArchitecture
 ++# endif
 + # ifdef __alpha__
 + #  define AlphaBsdArchitecture
 + #  define AlphaArchitecture
 +--- xc/config/cf/xfree86.cf.orig	2003-02-27 05:07:59.000000000 +0900
 ++++ xc/config/cf/xfree86.cf	2007-09-09 20:40:56.000000000 +0900
 +@@ -1167,7 +1167,7 @@
 +  * The default is to install the X servers setuid-root on most OSs.
 +  * It the servers are only started by xdm, they should not be setuid-root.
 +  */
 +-#if !defined(i386MachArchitecture) && !defined(OS2Architecture)
 ++#if !defined(i386MachArchitecture) && !defined(OS2Architecture) && !defined(x86_64Architecture)
 + # ifndef InstallXserverSetUID
 + #  define InstallXserverSetUID	YES
 + # endif
 +@@ -1688,7 +1688,8 @@
 + # if SystemV || SystemV4 || \
 +     (defined(LinuxArchitecture) && !defined(Mc68020Architecture)) || \
 +     defined(i386BsdArchitecture) || defined(LynxOSArchitecture) || \
 +-    defined(OS2Architecture) || defined(GNUMachArchitecture)
 ++    defined(OS2Architecture) || defined(GNUMachArchitecture) || \
 ++    defined(x86_64Architecture)
 + #   define BuildScanpci		YES
 + # else
 + #   define BuildScanpci		NO
 +@@ -1801,7 +1802,7 @@
 + #endif
 + 
 + #ifndef XFree86ConsoleDefines
 +-# if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture)
 ++# if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture) || defined(x86_64BsdArchitecture)
 + #  define XFree86ConsoleDefines	-DPCCONS_SUPPORT -DSYSCONS_SUPPORT -DPCVT_SUPPORT
 + # else
 + #  define XFree86ConsoleDefines	/**/
 +@@ -1995,7 +1996,7 @@
 + 
 + #ifndef Egcs112Bug
 +   /* Not exactly precise, but it'll do for now... */
 +-# if HasGcc2 && defined(i386Architecture) && \
 ++# if HasGcc2 && (defined(i386Architecture) || defined(x86_64Architecture)) && \
 +      (GccMajorVersion == 2) && (GccMinorVersion > 8)
 + #  define Egcs112Bug YES
 + # else
 +@@ -2012,7 +2013,7 @@
 + #define HasGlibc21Sigsetjmp NO
 + #endif
 + 
 +-#ifdef i386Architecture
 ++#if defined(i386Architecture) || defined(x86_64Architecture)
 + # ifndef HasX86Support
 + #  define HasX86Support YES
 + # endif
 +--- xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile.orig	2003-02-18 01:37:19.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile	2007-09-07 06:38:14.000000000 +0900
 +@@ -150,6 +150,9 @@
 + #elif defined(Sparc64Architecture)
 + VIDEO_SRC = sparc64_video.c
 + VIDEO_OBJ = sparc64_video.o
 ++#elif defined(x86_64Architecture)
 ++VIDEO_SRC = i386_video.c
 ++VIDEO_OBJ = i386_video.o
 + #else
 + #error Unknown architecture !
 + #endif
 +--- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c.orig	2002-05-23 06:38:29.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c	2007-09-08 20:35:51.000000000 +0900
 +@@ -18,7 +18,7 @@
 + 
 + #ifdef INCLUDE_XF86_NO_DOMAIN
 + 
 +-#if defined(__alpha__) || defined(__sparc64__)
 ++#if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__)
 + 
 + resPtr
 + xf86BusAccWindowsFromOS(void)
 +--- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.h.orig	2002-10-11 10:40:34.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.h	2007-09-09 11:44:01.000000000 +0900
 +@@ -2,4 +2,5 @@
 + 
 + extern void KbdGetMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms,
 + 				CARD8 *pModMap);
 +-
 ++#include <sys/kbio.h>
 ++#include <sys/consio.h>
 +--- xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile.orig	2003-02-24 05:26:49.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile	2007-09-09 22:21:16.000000000 +0900
 +@@ -80,7 +80,7 @@
 + PCIDRVRSRC = ix86Pci.c linuxPci.c
 + PCIDRVROBJ = ix86Pci.o linuxPci.o
 + 
 +-#elif defined(FreeBSDArchitecture) && defined(AlphaArchitecture)
 ++#elif defined(FreeBSDArchitecture) && (defined(AlphaArchitecture) || defined(x86_64Architecture))
 + 
 + 
 + XCOMM generic FreeBSD PCI driver (using /dev/pci)
 +--- xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h.orig	2002-12-24 00:37:26.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h	2007-09-09 22:21:25.000000000 +0900
 +@@ -230,6 +230,10 @@
 + #  define ARCH_PCI_INIT linuxPciInit
 + #  define INCLUDE_XF86_MAP_PCI_MEM
 + #  define INCLUDE_XF86_NO_DOMAIN
 ++# elif defined(FreeBSD)
 ++#  define ARCH_PCI_INIT freebsdPciInit
 ++#  define INCLUDE_XF86_MAP_PCI_MEM
 ++#  define INCLUDE_XF86_NO_DOMAIN
 + # endif
 + # define XF86SCANPCI_WRAPPER ia64ScanPCIWrapper
 + #elif defined(__i386__)
 +@@ -291,14 +295,20 @@
 + # elif defined(sun)
 + #  define ARCH_PCI_INIT sparcPciInit
 + #  define INCLUDE_XF86_MAP_PCI_MEM
 +-# elif defined(__OpenBSD__) && defined(__sparc64__)
 ++# elif (defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__sparc64__)
 + #  define  ARCH_PCI_INIT freebsdPciInit
 + #  define INCLUDE_XF86_MAP_PCI_MEM
 + #  define INCLUDE_XF86_NO_DOMAIN
 + # endif
 +-# define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge
 ++# if !defined(__FreeBSD__)
 ++#  define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge
 ++# endif
 + #elif defined(__x86_64__)
 +-# define ARCH_PCI_INIT ix86PciInit
 ++# if defined(__FreeBSD__)
 ++#  define ARCH_PCI_INIT freebsdPciInit
 ++# else
 ++#  define ARCH_PCI_INIT ix86PciInit
 ++# endif
 + # define INCLUDE_XF86_MAP_PCI_MEM
 + # define INCLUDE_XF86_NO_DOMAIN
 + # if defined(linux)
 +--- xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c.orig	2002-08-28 07:07:07.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c	2007-09-09 22:21:33.000000000 +0900
 +@@ -84,7 +84,7 @@
 + /* bridge      */	NULL
 + };
 + 
 +-#if !defined(__OpenBSD__)
 ++#if !defined(__OpenBSD__) && !defined(__FreeBSD__)
 + #if X_BYTE_ORDER == X_BIG_ENDIAN
 + #ifdef __sparc__
 + #ifndef ASI_PL
 +--- xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h.orig	2002-05-23 06:38:30.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h	2007-09-09 22:21:43.000000000 +0900
 +@@ -35,7 +35,13 @@
 + #elif defined(__OpenBSD__) && defined(__sparc64__)
 + /* XXX */
 + #elif defined(CSRG_BASED)
 ++#if defined(__FreeBSD__)
 ++#include <sys/types.h>
 ++#include <sys/fbio.h>
 ++#include <dev/ofw/openpromio.h>
 ++#else
 + #include <machine/fbio.h>
 ++#endif
 + #else
 + #include <sun/fbio.h>
 + #endif
 +--- xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c.orig	2003-02-22 15:00:39.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c	2007-09-09 22:23:14.000000000 +0900
 +@@ -480,7 +480,7 @@
 +     if (flags & XF86_MAP_FIXED)		f |= MAP_FIXED;
 +     if (flags & XF86_MAP_SHARED)	f |= MAP_SHARED;
 +     if (flags & XF86_MAP_PRIVATE)	f |= MAP_PRIVATE;
 +-#ifdef __x86_64__
 ++#if defined(__x86_64__) && defined(linux)
 +     if (flags & XF86_MAP_32BIT)	        f |= MAP_32BIT;
 + #endif
 +     if (prot  & XF86_PROT_EXEC)		p |= PROT_EXEC;
 +--- xc/programs/Xserver/hw/xfree86/common/Imakefile.orig	2003-02-18 02:06:41.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/common/Imakefile	2007-09-09 22:24:34.000000000 +0900
 +@@ -18,7 +18,8 @@
 + #endif /* GNUMachArchitecture */
 + #else
 + # if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture) \
 +-	|| defined(OpenBSDArchitecture) || defined(NetBSDArchitecture)
 ++	|| defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) \
 ++	|| defined(FreeBSDArchitecture)
 +         KBD = xf86KbdBSD
 + # else
 + #  ifdef LinuxArchitecture
 +--- xc/programs/Xserver/hw/xfree86/common/xf86Events.c.orig	2003-02-20 13:20:52.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/common/xf86Events.c	2007-09-09 22:24:56.000000000 +0900
 +@@ -315,7 +315,7 @@
 + 	    CloseDownClient(server);
 + 	}
 + 	break;
 +-#if !defined(__SOL8__) && (!defined(sun) || defined(i386))
 ++#if !defined(__SOL8__) && (!defined(sun) || defined(i386)) && defined(VT_ACTIVATE)
 +     case ACTION_SWITCHSCREEN:
 + 	if (VTSwitchEnabled && !xf86Info.dontVTSwitch && arg) {
 + 	    int vtno = *((int *) arg);
 +--- xc/programs/Xserver/hw/xfree86/loader/Imakefile.orig	2003-02-27 08:32:12.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/loader/Imakefile	2007-09-09 22:27:05.000000000 +0900
 +@@ -34,7 +34,7 @@
 +   SETJMPDEFINES = -DHAS_GLIBC_SIGSETJMP=1
 + #endif
 + 
 +-#if defined (x86_64Architecture)
 ++#if defined (x86_64Architecture) && defined(linux)
 + ARCHDEFINES = -DDoMMAPedMerge -DMmapPageAlign
 + #endif
 + 
 +--- xc/programs/Xserver/hw/xfree86/loader/elfloader.c.orig	2003-01-25 02:26:35.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/loader/elfloader.c	2007-09-09 22:27:13.000000000 +0900
 +@@ -73,7 +73,7 @@
 + # if !defined(linux)
 + #  error    No MAP_ANON?
 + # endif
 +-# if !defined (__x86_64__)
 ++# if !defined (__x86_64__) || !defined(__linux__)
 + # define MMAP_FLAGS     (MAP_PRIVATE | MAP_ANON)
 + # else
 + # define MMAP_FLAGS     (MAP_PRIVATE | MAP_ANON | MAP_32BIT)
 +--- xc/config/cf/bsdLib.rules.orig	2007-09-10 08:00:14.000000000 +0900
 ++++ xc/config/cf/bsdLib.rules	2007-09-10 08:00:38.000000000 +0900
 +@@ -450,4 +450,14 @@
 + #endif
 + 
 + 
 ++#ifdef FreeBSDArchitecture YES
 ++#define NormalLibraryObjectRule()                                       @@\
 ++.c.Osuf:                                                                @@\
 ++	NormalSharedLibObjCompile($(_NOOP_))
 ++
 ++#define NormalCplusplusObjectRule()                                     @@\
 ++.CCsuf.Osuf:                                                            @@\
 ++	NormalSharedLibObjCplusplusCompile($(_NOOP_))
 ++#endif
 ++
 + #endif /* UseElfFormat */
 +--- xc/lib/font/FreeType/ftfuncs.c.orig	2003-02-13 12:01:45.000000000 +0900
 ++++ xc/lib/font/FreeType/ftfuncs.c	2007-09-10 09:30:44.000000000 +0900
 +@@ -959,11 +959,11 @@
 +         int underlinePosition, underlineThickness;
 + 
 +         if(post) {
 +-            underlinePosition = TRANSFORM_FUNITS_Y(post->underlinePosition);
 ++            underlinePosition = TRANSFORM_FUNITS_Y(-post->underlinePosition);
 +             underlineThickness = TRANSFORM_FUNITS_Y(post->underlineThickness);
 +         } else {
 +             underlinePosition = 
 +-                TRANSFORM_FUNITS_Y(t1info->underline_position);
 ++                TRANSFORM_FUNITS_Y(-t1info->underline_position);
 +             underlineThickness = 
 +                 TRANSFORM_FUNITS_Y(t1info->underline_thickness);
 +         }
 +--- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c.orig	2003-02-09 06:26:58.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c	2007-09-10 09:39:58.000000000 +0900
 +@@ -1359,6 +1359,7 @@
 +    if (pMga->irq) {
 +       drmCtlUninstHandler(pMga->drmFD);
 +       pMga->irq = 0;
 ++      pMga->reg_ien = 0;
 +    }
 + 
 +    /* Cleanup DMA */
 +--- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c.orig	2003-02-11 08:42:51.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c	2007-09-10 09:42:07.000000000 +0900
 +@@ -178,6 +178,7 @@
 +  */
 + 
 + static const char *vgahwSymbols[] = {
 ++    "vgaHWUnmapMem",
 +     "vgaHWDPMSSet",
 +     "vgaHWFreeHWRec",
 +     "vgaHWGetHWRec",
 +--- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c.orig	2003-02-11 08:42:51.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c	2007-09-10 09:45:41.000000000 +0900
 +@@ -24,7 +24,7 @@
 + /* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen
 +    <jpaana@s2.org> */
 + 
 +-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c,v 1.27 2003/02/10 23:42:51 mvojkovi Exp $ */
 ++/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c,v 1.28 2003/03/12 21:27:18 mvojkovi Exp $ */
 + 
 + #include "nv_include.h"
 + 
 +@@ -416,6 +416,9 @@
 +         break;
 +     }
 + 
 ++    if(pNv->riva.Architecture == 3)
 ++       pNv->riva.PCRTC0 = pNv->riva.PGRAPH;
 ++
 +     if(pNv->SecondCRTC) {
 +        pNv->riva.PCIO = pNv->riva.PCIO0 + 0x2000;
 +        pNv->riva.PCRTC = pNv->riva.PCRTC0 + 0x800;
 +@@ -484,7 +487,6 @@
 +                                      frameBase+0x00C00000, 0x00008000);
 +             
 +     NVCommonSetup(pScrn);
 +-    pNv->riva.PCRTC = pNv->riva.PCRTC0 = pNv->riva.PGRAPH;
 + }
 + 
 + void
 +--- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c.orig	2003-02-19 10:19:41.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c	2007-09-10 09:48:30.000000000 +0900
 +@@ -275,6 +275,7 @@
 +     "drmAddMap",
 +     "drmAgpAcquire",
 +     "drmAgpAlloc",
 ++    "drmAgpBase",
 +     "drmAgpBind",
 +     "drmAgpDeviceId",
 +     "drmAgpEnable",
 +@@ -288,8 +289,11 @@
 +     "drmCommandRead",
 +     "drmCommandWrite",
 +     "drmCommandWriteRead",
 ++    "drmCtlInstHandler",
 ++    "drmCtlUninstHandler",
 +     "drmFreeBufs",
 +     "drmFreeVersion",
 ++    "drmGetInterruptFromBusID",
 +     "drmGetLibVersion",
 +     "drmGetVersion",
 +     "drmMap",
 +@@ -307,6 +311,7 @@
 +     "DRICreateInfoRec",
 +     "DRIDestroyInfoRec",
 +     "DRIFinishScreenInit",
 ++    "DRIGetDeviceInfo",
 +     "DRIGetSAREAPrivate",
 +     "DRILock",
 +     "DRIQueryVersion",
 +--- xc/lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S.orig	2002-11-08 03:31:59.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S	2007-09-10 09:57:23.000000000 +0900
 +@@ -28,7 +28,7 @@
 + 
 + #define GLOBL( x )	\
 + .globl x;		\
 +-x##:
 ++x:
 + 
 + .data
 + .align 4
 +--- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c.orig	2003-02-25 05:34:55.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c	2007-09-10 09:59:44.000000000 +0900
 +@@ -370,7 +370,7 @@
 +     }
 + 
 +     if (info->IsSecondary || info->Clone) {
 +-	save2 = INREG(RADEON_CRTC_GEN_CNTL) & ~(CARD32) (3 << 20);
 ++	save2 = INREG(RADEON_CRTC2_GEN_CNTL) & ~(CARD32) (3 << 20);
 + 	save2 |= (CARD32) (2 << 20);
 + 	OUTREG(RADEON_CRTC2_GEN_CNTL, save2 & (CARD32)~RADEON_CRTC2_CUR_EN);
 +     }
 +--- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c.orig	2003-02-19 18:17:30.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c	2007-09-10 10:01:06.000000000 +0900
 +@@ -1585,6 +1585,7 @@
 +     if (info->irq) {
 + 	drmCtlUninstHandler(info->drmFD);
 + 	info->irq = 0;
 ++	info->ModeReg.gen_int_cntl = 0;
 +     }
 + 
 + 				/* De-allocate vertex buffers */
 +--- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h.orig	2003-02-08 03:08:59.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h	2007-09-10 10:02:33.000000000 +0900
 +@@ -879,7 +879,7 @@
 + #       define RADEON_P2PLL_REF_DIV_MASK    0x03ff
 + #       define RADEON_P2PLL_ATOMIC_UPDATE_R (1 << 15) /* same as _W */
 + #       define RADEON_P2PLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */
 +-#       define R300_PPLL_REF_DIV_ACC_MASK   (0x3ff < 18)
 ++#       define R300_PPLL_REF_DIV_ACC_MASK   (0x3ff << 18)
 + #       define R300_PPLL_REF_DIV_ACC_SHIFT  18
 + #define RADEON_PALETTE_DATA                 0x00b4
 + #define RADEON_PALETTE_30_DATA              0x00b8
 +--- xc/lib/GL/mesa/src/drv/radeon/radeon_vtxtmp_x86.S.orig	2002-11-08 03:32:00.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/radeon/radeon_vtxtmp_x86.S	2007-09-10 10:03:57.000000000 +0900
 +@@ -28,7 +28,7 @@
 + 
 + #define GLOBL( x )	\
 + .globl x;		\
 +-x##:
 ++x:
 + 
 + .data
 + .align 4
 +--- xc/lib/GL/mesa/src/drv/r200/r200_context.c.orig	2002-12-17 01:18:53.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/r200/r200_context.c	2007-09-10 10:05:57.000000000 +0900
 +@@ -391,6 +391,7 @@
 +     */
 +    _tnl_destroy_pipeline( ctx );
 +    _tnl_install_pipeline( ctx, r200_pipeline );
 ++   ctx->Driver.FlushVertices = r200FlushVertices;
 + 
 +    /* Try and keep materials and vertices separate:
 +     */
 +--- xc/lib/GL/mesa/src/drv/r200/r200_swtcl.c.orig	2002-12-24 00:29:26.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/r200/r200_swtcl.c	2007-09-10 10:08:12.000000000 +0900
 +@@ -46,6 +46,7 @@
 + #include "math/m_translate.h"
 + #include "tnl/tnl.h"
 + #include "tnl/t_context.h"
 ++#include "tnl/t_imm_exec.h"
 + #include "tnl/t_pipeline.h"
 + 
 + #include "r200_context.h"
 +@@ -1223,6 +1224,14 @@
 + }
 + 
 + 
 ++void r200FlushVertices( GLcontext *ctx, GLuint flags )
 ++{
 ++   _tnl_flush_vertices( ctx, flags );
 ++
 ++   if (flags & FLUSH_STORED_VERTICES) 
 ++      R200_FIREVERTICES( R200_CONTEXT( ctx ) );
 ++}
 ++
 + /**********************************************************************/
 + /*                            Initialization.                         */
 + /**********************************************************************/
 +--- xc/lib/GL/mesa/src/drv/r200/r200_swtcl.h.orig	2002-12-17 01:18:55.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/r200/r200_swtcl.h	2007-09-10 10:09:23.000000000 +0900
 +@@ -42,6 +42,7 @@
 + extern void r200InitSwtcl( GLcontext *ctx );
 + extern void r200DestroySwtcl( GLcontext *ctx );
 + 
 ++extern void r200FlushVertices( GLcontext *ctx, GLuint flags );
 + extern void r200ChooseRenderState( GLcontext *ctx );
 + extern void r200ChooseVertexState( GLcontext *ctx );
 + 
 +--- xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c.orig	2002-12-17 01:18:55.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c	2007-09-10 10:13:18.000000000 +0900
 +@@ -38,6 +38,7 @@
 + #include "r200_ioctl.h"
 + #include "r200_tex.h"
 + #include "r200_tcl.h"
 ++#include "r200_swtcl.h"
 + #include "r200_vtxfmt.h"
 + 
 + #include "api_noop.h"
 +@@ -59,7 +60,7 @@
 + 
 + struct r200_vb vb;
 + 
 +-static void r200FlushVertices( GLcontext *, GLuint );
 ++static void r200VtxFmtFlushVertices( GLcontext *, GLuint );
 + 
 + static void count_func( const char *name,  struct dynfn *l )
 + {
 +@@ -357,12 +358,13 @@
 +       fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
 + 
 +    if (ctx->Driver.NeedFlush) 
 +-      r200FlushVertices( ctx, ctx->Driver.NeedFlush );
 ++      r200VtxFmtFlushVertices( ctx, ctx->Driver.NeedFlush );
 + 
 +    if (ctx->NewState)
 +       _mesa_update_state( ctx ); /* clear state so fell_back sticks */
 + 
 +    _tnl_wakeup_exec( ctx );
 ++   ctx->Driver.FlushVertices = r200FlushVertices;
 + 
 +    assert( rmesa->dma.flush == 0 );
 +    rmesa->vb.fell_back = GL_TRUE;
 +@@ -404,6 +406,7 @@
 +    prim = rmesa->vb.prim[0];
 +    ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1;
 +    _tnl_wakeup_exec( ctx );
 ++   ctx->Driver.FlushVertices = r200FlushVertices;
 + 
 +    assert(rmesa->dma.flush == 0);
 +    rmesa->vb.fell_back = GL_TRUE;
 +@@ -756,7 +759,7 @@
 + 	    fprintf(stderr, "reinstall (new install)\n");
 + 
 + 	 _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
 +-	 ctx->Driver.FlushVertices = r200FlushVertices;
 ++	 ctx->Driver.FlushVertices = r200VtxFmtFlushVertices;
 + 	 ctx->Driver.NewList = r200NewList;
 + 	 rmesa->vb.installed = GL_TRUE;
 + 	 vb.context = ctx;
 +@@ -772,6 +775,7 @@
 + 	 if (rmesa->dma.flush)
 + 	    rmesa->dma.flush( rmesa );
 + 	 _tnl_wakeup_exec( ctx );
 ++	 ctx->Driver.FlushVertices = r200FlushVertices;
 + 	 rmesa->vb.installed = GL_FALSE;
 + 	 vb.context = 0;
 +       }
 +@@ -931,7 +935,7 @@
 +    return GL_TRUE;
 + }
 + 
 +-static void r200FlushVertices( GLcontext *ctx, GLuint flags )
 ++static void r200VtxFmtFlushVertices( GLcontext *ctx, GLuint flags )
 + {
 +    r200ContextPtr rmesa = R200_CONTEXT( ctx );
 + 
 +--- xc/lib/GL/mesa/src/drv/radeon/radeon_context.c.orig	2003-02-09 06:26:45.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/radeon/radeon_context.c	2007-09-10 10:14:38.000000000 +0900
 +@@ -382,6 +382,7 @@
 +     */
 +    _tnl_destroy_pipeline( ctx );
 +    _tnl_install_pipeline( ctx, radeon_pipeline );
 ++   ctx->Driver.FlushVertices = radeonFlushVertices;
 + 
 +    /* Try and keep materials and vertices separate:
 +     */
 +--- xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.c.orig	2003-02-16 07:18:48.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.c	2007-09-10 10:17:15.000000000 +0900
 +@@ -45,6 +45,7 @@
 + #include "math/m_translate.h"
 + #include "tnl/tnl.h"
 + #include "tnl/t_context.h"
 ++#include "tnl/t_imm_exec.h"
 + #include "tnl/t_pipeline.h"
 + 
 + #include "radeon_context.h"
 +@@ -1134,6 +1135,14 @@
 + }
 + 
 + 
 ++void radeonFlushVertices( GLcontext *ctx, GLuint flags )
 ++{
 ++   _tnl_flush_vertices( ctx, flags );
 ++
 ++   if (flags & FLUSH_STORED_VERTICES) 
 ++      RADEON_FIREVERTICES( RADEON_CONTEXT( ctx ) );
 ++}
 ++
 + /**********************************************************************/
 + /*                            Initialization.                         */
 + /**********************************************************************/
 +--- xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.h.orig	2002-10-30 21:51:57.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.h	2007-09-10 10:18:31.000000000 +0900
 +@@ -43,6 +43,7 @@
 + extern void radeonInitSwtcl( GLcontext *ctx );
 + extern void radeonDestroySwtcl( GLcontext *ctx );
 + 
 ++extern void radeonFlushVertices( GLcontext *ctx, GLuint flags );
 + extern void radeonChooseRenderState( GLcontext *ctx );
 + extern void radeonChooseVertexState( GLcontext *ctx );
 + 
 +--- xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c.orig	2002-12-17 01:18:59.000000000 +0900
 ++++ xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c	2007-09-10 10:22:20.000000000 +0900
 +@@ -38,6 +38,7 @@
 + #include "radeon_ioctl.h"
 + #include "radeon_tex.h"
 + #include "radeon_tcl.h"
 ++#include "radeon_swtcl.h"
 + #include "radeon_vtxfmt.h"
 + 
 + #include "api_noop.h"
 +@@ -59,7 +60,7 @@
 + 
 + struct radeon_vb vb;
 + 
 +-static void radeonFlushVertices( GLcontext *, GLuint );
 ++static void radeonVtxfmtFlushVertices( GLcontext *, GLuint );
 + 
 + static void count_func( const char *name,  struct dynfn *l )
 + {
 +@@ -336,12 +337,13 @@
 +       fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
 + 
 +    if (ctx->Driver.NeedFlush) 
 +-      radeonFlushVertices( ctx, ctx->Driver.NeedFlush );
 ++      radeonVtxfmtFlushVertices( ctx, ctx->Driver.NeedFlush );
 + 
 +    if (ctx->NewState)
 +       _mesa_update_state( ctx ); /* clear state so fell_back sticks */
 + 
 +    _tnl_wakeup_exec( ctx );
 ++   ctx->Driver.FlushVertices = radeonFlushVertices;
 + 
 +    assert( rmesa->dma.flush == 0 );
 +    rmesa->vb.fell_back = GL_TRUE;
 +@@ -382,6 +384,7 @@
 +    prim = rmesa->vb.prim[0];
 +    ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1;
 +    _tnl_wakeup_exec( ctx );
 ++   ctx->Driver.FlushVertices = radeonFlushVertices;
 + 
 +    assert(rmesa->dma.flush == 0);
 +    rmesa->vb.fell_back = GL_TRUE;
 +@@ -731,7 +734,7 @@
 + 	    fprintf(stderr, "reinstall (new install)\n");
 + 
 + 	 _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
 +-	 ctx->Driver.FlushVertices = radeonFlushVertices;
 ++	 ctx->Driver.FlushVertices = radeonVtxfmtFlushVertices;
 + 	 ctx->Driver.NewList = radeonNewList;
 + 	 rmesa->vb.installed = GL_TRUE;
 + 	 vb.context = ctx;
 +@@ -747,6 +750,7 @@
 + 	 if (rmesa->dma.flush)
 + 	    rmesa->dma.flush( rmesa );
 + 	 _tnl_wakeup_exec( ctx );
 ++	 ctx->Driver.FlushVertices = radeonFlushVertices;
 + 	 rmesa->vb.installed = GL_FALSE;
 + 	 vb.context = 0;
 +       }
 +@@ -905,7 +909,7 @@
 +    return GL_TRUE;
 + }
 + 
 +-static void radeonFlushVertices( GLcontext *ctx, GLuint flags )
 ++static void radeonVtxfmtFlushVertices( GLcontext *ctx, GLuint flags )
 + {
 +    radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
 + 
 +--- xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h.orig	2003-02-08 05:41:11.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h	2007-09-10 10:25:56.000000000 +0900
 +@@ -498,21 +498,34 @@
 + #define PCI_CHIP_TRIO64V2_DXGX		0x8901
 + #define PCI_CHIP_PLATO_PX		0x8902
 + #define PCI_CHIP_Trio3D			0x8904
 +-#define PCI_CHIP_Trio3D_2X		0x8A13
 + #define PCI_CHIP_VIRGE_DXGX		0x8A01
 + #define PCI_CHIP_VIRGE_GX2		0x8A10
 ++#define PCI_CHIP_Trio3D_2X		0x8A13
 + #define PCI_CHIP_SAVAGE3D		0x8A20
 + #define PCI_CHIP_SAVAGE3D_MV		0x8A21
 + #define PCI_CHIP_SAVAGE4		0x8A22
 +-#define PCI_CHIP_VIRGE_MX		0x8C01
 +-#define PCI_CHIP_VIRGE_MXPLUS		0x8C01
 +-#define PCI_CHIP_VIRGE_MXP		0x8C03
 + #define PCI_CHIP_PROSAVAGE_PM		0x8A25
 + #define PCI_CHIP_PROSAVAGE_KM		0x8A26
 ++#define PCI_CHIP_VIRGE_MX		0x8C01
 ++#define PCI_CHIP_VIRGE_MXPLUS		0x8C02
 ++#define PCI_CHIP_VIRGE_MXP		0x8C03
 + #define PCI_CHIP_SAVAGE_MX_MV		0x8C10
 + #define PCI_CHIP_SAVAGE_MX		0x8C11
 + #define PCI_CHIP_SAVAGE_IX_MV		0x8C12
 + #define PCI_CHIP_SAVAGE_IX		0x8C13
 ++#define PCI_CHIP_SUPSAV_MX128		0x8C22
 ++#define PCI_CHIP_SUPSAV_MX64		0x8C24
 ++#define PCI_CHIP_SUPSAV_MX64C		0x8C26
 ++#define PCI_CHIP_SUPSAV_IX128SDR	0x8C2A
 ++#define PCI_CHIP_SUPSAV_IX128DDR	0x8C2B
 ++#define PCI_CHIP_SUPSAV_IX64SDR		0x8C2C
 ++#define PCI_CHIP_SUPSAV_IX64DDR		0x8C2D
 ++#define PCI_CHIP_SUPSAV_IXCSDR		0x8C2E
 ++#define PCI_CHIP_SUPSAV_IXCDDR		0x8C2F
 ++#define PCI_CHIP_S3TWISTER_P		0x8D01
 ++#define PCI_CHIP_S3TWISTER_K		0x8D02
 ++#define PCI_CHIP_PROSAVAGE_DDR		0x8D03
 ++#define PCI_CHIP_PROSAVAGE_DDRK		0x8D04
 + #define PCI_CHIP_SAVAGE2000		0x9102
 + 
 + /* ARK Logic */
 +--- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h.orig	2002-10-03 05:39:55.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h	2007-09-10 10:27:32.000000000 +0900
 +@@ -3,30 +3,6 @@
 + #ifndef _SAVAGE_REGS_H
 + #define _SAVAGE_REGS_H
 + 
 +-/* These are here until xf86PciInfo.h is updated. */
 +-
 +-#ifndef PCI_CHIP_S3TWISTER_P
 +-#define PCI_CHIP_S3TWISTER_P	0x8d01
 +-#endif
 +-#ifndef PCI_CHIP_S3TWISTER_K
 +-#define PCI_CHIP_S3TWISTER_K	0x8d02
 +-#endif
 +-#ifndef PCI_CHIP_SUPSAV_MX128
 +-#define PCI_CHIP_SUPSAV_MX128		0x8c22
 +-#define PCI_CHIP_SUPSAV_MX64		0x8c24
 +-#define PCI_CHIP_SUPSAV_MX64C		0x8c26
 +-#define PCI_CHIP_SUPSAV_IX128SDR	0x8c2a
 +-#define PCI_CHIP_SUPSAV_IX128DDR	0x8c2b
 +-#define PCI_CHIP_SUPSAV_IX64SDR		0x8c2c
 +-#define PCI_CHIP_SUPSAV_IX64DDR		0x8c2d
 +-#define PCI_CHIP_SUPSAV_IXCSDR		0x8c2e
 +-#define PCI_CHIP_SUPSAV_IXCDDR		0x8c2f
 +-#endif
 +-#ifndef PCI_CHIP_PROSAVAGE_DDR
 +-#define PCI_CHIP_PROSAVAGE_DDR	0x8d03
 +-#define PCI_CHIP_PROSAVAGE_DDRK	0x8d04
 +-#endif
 +-
 + #define S3_SAVAGE3D_SERIES(chip)  ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE_MX))
 + 
 + #define S3_SAVAGE4_SERIES(chip)   ((chip==S3_SAVAGE4) || (chip==S3_PROSAVAGE))
 +--- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c.orig	2003-02-25 13:08:21.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c	2007-09-10 10:28:45.000000000 +0900
 +@@ -123,8 +123,8 @@
 +     { PCI_CHIP_SAVAGE_IX,	"Savage/IX" },
 +     { PCI_CHIP_PROSAVAGE_PM,	"ProSavage PM133" },
 +     { PCI_CHIP_PROSAVAGE_KM,	"ProSavage KM133" },
 +-    { PCI_CHIP_S3TWISTER_P,	"ProSavage PN133" },
 +-    { PCI_CHIP_S3TWISTER_K,	"ProSavage KN133" },
 ++    { PCI_CHIP_S3TWISTER_P,	"Twister PN133" },
 ++    { PCI_CHIP_S3TWISTER_K,	"Twister KN133" },
 +     { PCI_CHIP_SUPSAV_MX128,	"SuperSavage/MX 128" },
 +     { PCI_CHIP_SUPSAV_MX64,	"SuperSavage/MX 64" },
 +     { PCI_CHIP_SUPSAV_MX64C,	"SuperSavage/MX 64C" },
 +--- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c.orig	2003-02-06 02:45:29.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c	2007-09-10 10:30:31.000000000 +0900
 +@@ -1410,7 +1410,7 @@
 + 	ENTER_PROC("SMI_Save");
 + 
 + 	/* Save the standard VGA registers */
 +-	vgaHWSave(pScrn, vgaSavePtr, VGA_SR_MODE);
 ++	vgaHWSave(pScrn, vgaSavePtr, VGA_SR_ALL);
 + 	save->smiDACMask = VGAIN8(pSmi, VGA_DAC_MASK);
 + 	VGAOUT8(pSmi, VGA_DAC_READ_ADDR, 0);
 + 	for (i = 0; i < 256; i++)
 +@@ -1601,7 +1601,7 @@
 + 		VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0xA0, restore->SRA0);
 + 
 + 		/* Restore the standard VGA registers */
 +-		vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_MODE);
 ++		vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_ALL);
 + 		if (restore->smiDACMask)
 + 		{
 + 			VGAOUT8(pSmi, VGA_DAC_MASK, restore->smiDACMask);
 +@@ -1672,7 +1672,7 @@
 + 		} 
 + 
 + 		if (restore->modeInit)
 +-		    vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_MODE);
 ++		    vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_ALL);
 + 
 + 		if (!SMI_LYNXM_SERIES(pSmi->Chipset))
 + 		{
 +--- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c.orig	2003-01-12 12:55:49.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c	2007-09-10 10:31:51.000000000 +0900
 +@@ -277,7 +277,7 @@
 +     {XvSettable | XvGettable,        0,             1, XV_INTERLACED_NAME},
 + };
 + 
 +-static XF86AttributeRec SMI_VideoAttributes[N_ATTRS] = {
 ++static XF86AttributeRec SMI_VideoAttributes[2] = {
 +     {XvSettable | XvGettable,        0,           255, XV_BRIGHTNESS_NAME},
 +     {XvSettable | XvGettable, 0x000000,      0xFFFFFF, XV_COLORKEY_NAME},
 + };
 +--- xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile.orig	2002-09-17 03:06:01.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile	2007-09-10 10:34:37.000000000 +0900
 +@@ -49,7 +49,7 @@
 + #define FFBsObjectRule(name)						@@\
 + name.o: name.s								@@\
 + 	$(RM) $@							@@\
 +-	$(CPP) $*.s | $(AS) $(GCCVISOPTION) -o $@ -
 ++	$(CC) -c -x assembler-with-cpp $(GCCVISOPTION) $*.s -o $@
 + #endif
 + #else
 + VISOBJS =
 +--- xc/programs/Xserver/xkb/xkbInit.c.orig	2003-02-09 15:29:20.000000000 +0900
 ++++ xc/programs/Xserver/xkb/xkbInit.c	2007-09-10 10:42:15.000000000 +0900
 +@@ -713,7 +713,7 @@
 +     if (names->types) names->types = _XkbDupString(names->types);
 +     if (names->compat) names->compat = _XkbDupString(names->compat);
 +     if (names->geometry) names->geometry = _XkbDupString(names->geometry);
 +-    if (names->symbols) names->geometry = _XkbDupString(names->symbols);
 ++    if (names->symbols) names->symbols = _XkbDupString(names->symbols);
 + 
 +     if (defs.model && defs.layout && rules) {
 + 	XkbComponentNamesRec	rNames;
 +--- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c.orig	2003-01-30 04:29:49.000000000 +0900
 ++++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c	2007-09-10 10:43:51.000000000 +0900
 +@@ -304,7 +304,10 @@
 +     "drmAgpVendorId",
 +     "drmCommandNone",
 +     "drmCommandWrite",
 ++    "drmCtlInstHandler",
 ++    "drmCtlUninstHandler",
 +     "drmFreeVersion",
 ++    "drmGetInterruptFromBusID",
 +     "drmGetLibVersion",
 +     "drmGetVersion",
 +     "drmMap",

Date: Sat, 3 May 2008 23:32:17 -0400
From: "Josh Carroll" <josh.carroll@gmail.com>

 The patch works for me on 7.0-RELEASE-p1/amd64. Just thought I'd
 provide some positive feedback of the patch. Can it be committed to
 the port?
 
 Thanks
 Josh
Responsible-Changed-From-To: freebsd-ports-bugs->itetcu 
Responsible-Changed-By: itetcu 
Responsible-Changed-When: Mon May 5 09:06:30 UTC 2008 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=108413 
State-Changed-From-To: open->feedback 
State-Changed-By: itetcu 
State-Changed-When: Mon May 5 09:06:44 UTC 2008 
State-Changed-Why:  
Ask for maintainer approval. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=108413 
State-Changed-From-To: feedback->closed 
State-Changed-By: itetcu 
State-Changed-When: Tue May 6 18:09:47 UTC 2008 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=108413 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/108413: commit references a PR
Date: Tue,  6 May 2008 18:09:43 +0000 (UTC)

 itetcu      2008-05-06 18:09:38 UTC
 
   FreeBSD ports repository
 
   Modified files:
     net/vnc              Makefile 
     net/vnc/files        FreeBSD.cf-patch 
   Added files:
     net/vnc/files        extra-patch-xfree86 
   Log:
   Fix vnc server on amd64 by patching it from XFree86-4-Server (v4.3.0)
   
   PR:             ports/108413
   Submitted by:   Tsurutani Naoki <turutani@scphys.kyoto-u.ac.jp>
   Tested by:      "Josh Carroll" <josh.carroll@gmail.com>
   Approved by:    maintainer
   
   Revision  Changes    Path
   1.56      +2 -1      ports/net/vnc/Makefile
   1.2       +50 -2     ports/net/vnc/files/FreeBSD.cf-patch
   1.1       +802 -0    ports/net/vnc/files/extra-patch-xfree86 (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
