[PATCH] Savage support for KDrive

jserv at linux2.cc.ntu.edu.tw jserv at linux2.cc.ntu.edu.tw
Tue Sep 14 19:41:53 PDT 2004


Dear all,

  I attempt to get S3 Savage built with KDrive, and here is
my patch against cvs head. After applying the patch, KDrive
can build Xsavage. But I fall into trouble with SegFault,
and GDB tell me it was located in s3ScreenInit() initialization.
It's strange that the following statement failed:

	S3CardInfo      *s3c = (S3CardInfo *) card->driver;

  Could you please give me a hint for workaround?
  Xsavage is important to me so that I can make sure if Kaffe's
AWT implementation works with KDrive.

Thanks,
Jim Huang <jserv @ kaffe.org>
-------------- next part --------------
diff -u -r1.7 s3cmap.c
--- hw/kdrive/savage/s3cmap.c	11 Sep 2003 05:12:51 -0000	1.7
+++ hw/kdrive/savage/s3cmap.c	8 Sep 2004 06:37:26 -0000
@@ -46,6 +46,7 @@
     }
 }
 
+#if 0
 #ifndef S3_TRIO
 #define Shift(v,d)  ((d) < 0 ? ((v) >> (-d)) : ((v) << (d)))
 
@@ -81,6 +82,7 @@
     }
 }
 #endif
+#endif
 
 void
 s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
@@ -92,12 +94,8 @@
     xColorItem	*chroma = 0;
     CARD32	key;
 
-#if 0
-    _s3WaitVRetrace (s3vga);
-#else
     S3Ptr   s3 = s3c->s3;
     _s3WaitVRetraceFast(s3);
-#endif
 #ifndef S3_TRIO
     if (pScreenPriv->screen->fb[1].depth)
     {
@@ -117,9 +115,12 @@
 	s3SetImm (s3vga, s3_dac_data, pdefs->blue >> 8);
 	pdefs++;
     }
+
+#if 0
 #ifndef S3_TRIO
     if (chroma && !pScreenPriv->closed)
 	s3SetTrueChromaKey (pScreen, fb, chroma);
 #endif
+#endif
 }
 
diff -u -r1.9 s3draw.c
--- hw/kdrive/savage/s3draw.c	11 Sep 2003 05:12:51 -0000	1.9
+++ hw/kdrive/savage/s3draw.c	8 Sep 2004 06:37:29 -0000
@@ -30,7 +30,7 @@
 #include	"s3.h"
 #include	"s3draw.h"
 
-#include	"Xmd.h"
+#include	<X11/Xmd.h>
 #include	"gcstruct.h"
 #include	"scrnintstr.h"
 #include	"pixmapstr.h"
@@ -2179,6 +2179,7 @@
     return TRUE;
 }
 
+#if 0
 Bool
 s3CreateWindow (WindowPtr pWin)
 {
@@ -2188,6 +2189,7 @@
     pWin->devPrivates[s3WindowPrivateIndex].ptr = 0;
     return KdCreateWindow (pWin);
 }
+#endif
 
 Bool
 s3DestroyWindow (WindowPtr pWin)
@@ -3112,7 +3114,7 @@
 	if (!AllocateGCPrivate(pScreen, s3GCPrivateIndex, sizeof (s3PrivGCRec)))
 	    return FALSE;
 	pScreen->CreateGC = s3CreateGC;
-	pScreen->CreateWindow = s3CreateWindow;
+	/* pScreen->CreateWindow = s3CreateWindow; */
 	pScreen->ChangeWindowAttributes = s3ChangeWindowAttributes;
 	pScreen->DestroyWindow = s3DestroyWindow;
 	pScreen->PaintWindowBackground = s3PaintWindow;
diff -u -r1.7 s3gc.c
--- hw/kdrive/savage/s3gc.c	11 Sep 2003 05:12:51 -0000	1.7
+++ hw/kdrive/savage/s3gc.c	8 Sep 2004 06:37:29 -0000
@@ -30,7 +30,7 @@
 #include	"s3.h"
 #include	"s3draw.h"
 
-#include	"Xmd.h"
+#include	<X11/Xmd.h>
 #include	"gcstruct.h"
 #include	"scrnintstr.h"
 #include	"pixmapstr.h"
diff -u -r1.7 s3stub.c
--- hw/kdrive/savage/s3stub.c	18 Nov 2003 04:53:16 -0000	1.7
+++ hw/kdrive/savage/s3stub.c	8 Sep 2004 06:37:29 -0000
@@ -40,14 +41,9 @@
     attr.address[1] = 0xba000000;		/* frame buffer */
     KdCardInfoAdd (&s3Funcs, &attr, 0);
 #else
-    CARD32	count;
-
-    count = 0;
-    while (LinuxFindPci (0x5333, 0x8a22, count, &attr))
-    {
-	KdCardInfoAdd (&s3Funcs, &attr, 0);
-	count++;
-    }
+    int j = 0;
+    while (LinuxFindPci (0x5333, 0x8d01, j++, &attr)) 
+        KdCardInfoAdd (&s3Funcs, &attr, 0);
 #endif
 }
 
--- /dev/null	1970-01-01 08:00:00.000000000 +0800
+++ hw/kdrive/savage/Makefile.am	2004-09-07 16:01:23.000000000 +0800
@@ -0,0 +1,37 @@
+INCLUDES = 					\
+	@KDRIVE_INCS@				\
+	-I$(top_srcdir)/hw/kdrive/vesa		\
+	@XSERVER_CFLAGS@
+
+bin_PROGRAMS = Xsavage
+
+if TSLIB
+TSLIB_FLAG = -lts
+endif
+
+noinst_LIBRARIES = libsavage.a
+
+libsavage_a_SOURCES = 	\
+	s3draw.c \
+	s3.c \
+	s3.h \
+	s3clock.c \
+	s3cmap.c \
+	s3curs.c \
+	s3gc.c \
+	s3reg.c
+
+Xsavage_SOURCES = \
+	s3stub.c
+	
+SAVAGE_LIBS =					\
+	libsavage.a 				\
+	$(top_builddir)/hw/kdrive/vesa/libvesa.a \
+	@KDRIVE_LIBS@
+
+Xsavage_LDADD = \
+	$(SAVAGE_LIBS)				\
+	@XSERVER_LIBS@                          \
+	$(TSLIB_FLAG)
+
+Xsavage_DEPENDENCIES = $(SAVAGE_LIBS) @KDRIVE_LIBS@
diff -u -r3.90 configure.ac
--- configure.ac	28 Jul 2004 07:55:34 -0000	3.90
+++ configure.ac	30 Aug 2004 03:25:07 -0000
@@ -538,6 +538,7 @@
 hw/kdrive/chips/Makefile
 hw/kdrive/fake/Makefile
 hw/kdrive/neomagic/Makefile
+hw/kdrive/savage/Makefile
 hw/kdrive/pm2/Makefile
 hw/kdrive/via/Makefile
 hw/kdrive/i810/Makefile
diff -u -r1.26 Makefile.am
--- hw/kdrive/Makefile.am	15 Jul 2004 09:56:39 -0000	1.26
+++ hw/kdrive/Makefile.am	30 Aug 2004 03:25:07 -0000
@@ -1,5 +1,5 @@
 if KDRIVEVESA
-VESA_SUBDIRS = vesa mach64 mga nvidia r128 smi chips pm2 via neomagic
+VESA_SUBDIRS = vesa mach64 mga nvidia r128 smi chips pm2 via neomagic savage
 endif
 
 if KDRIVEFBDEV


More information about the xorg mailing list