Subject: Re: X behaving badly
To: Jaap Boender <jaapb@kerguelen.org>
From: Andrey Petrov <petrov@netbsd.org>
List: port-sparc64
Date: 11/27/2003 13:24:41
On Thu, Nov 27, 2003 at 04:19:17PM +0100, Jaap Boender wrote:
> Hi all,
> 
> I've recently gotten an Ultra1, with Creator3D and all, and decided to run 
> NetBSD on it. So I did, compiled -current on it, got X to run from Andrey 
> Petrov's files, compiled KDE3 (which works fine, only it seems that artsd 
> makes the whole thing hang beyond repair after about half an hour, but I 
> don't need sound anyway). Only I noticed that things sometimes go wrong with 
> font rendering (not sure what that's about, words with umlauts and such in 
> them become quite a mess). So I decided to compile X anew; I downloaded the 
> source from CVS, applied Andrey's patches and added the wsfb driver, and 
> presto. A freshly compiled X.
> 
> Only now there is a very strange problem. The mouse pointer is only half as 
> high as it should be, and all the KDE icons are rendered strangely, too (they 
> are recognizable, but there are lots of pixels missing). But everything else 
> (text rendering, windows, buttons, ...) looks okay. I tried disabling the 
> hardware cursor, but that doesn't help. (I'm using the original XF86Config 
> file from ftp://ftp.netbsd.org/pub/NetBSD/misc/petrov/X/XF86Config)
> 
> Does anyone else have this problem? Or could someone give me a pointer as to 
> where the problem might be located?
> 

Cool, so it found some use. Here is another patch I distilled from openbsd.
It fixed quite a bit of problems for me. It should go into repository
but I think I need to test it on other platforms first.

	Andrey


Index: cfb/cfbglblt8.c
===================================================================
RCS file: /cvsroot/xsrc/xfree/xc/programs/Xserver/cfb/cfbglblt8.c,v
retrieving revision 1.3
diff -u -p -r1.3 cfbglblt8.c
--- cfb/cfbglblt8.c	19 Jan 2002 23:19:32 -0000	1.3
+++ cfb/cfbglblt8.c	23 Nov 2003 22:03:40 -0000
@@ -60,8 +60,6 @@ in this Software without prior written a
 
 #if GLYPHPADBYTES != 4
 #define USE_LEFTBITS
-#elif (BITMAP_BIT_ORDER == MSBFirst) && (PGSZ == 64)
-#define USE_LEFTBITS
 #endif
 
 #ifdef USE_LEFTBITS
Index: include/servermd.h
===================================================================
RCS file: /cvsroot/xsrc/xfree/xc/programs/Xserver/include/servermd.h,v
retrieving revision 1.5
diff -u -p -r1.5 servermd.h
--- include/servermd.h	28 Feb 2003 21:49:45 -0000	1.5
+++ include/servermd.h	23 Nov 2003 22:03:47 -0000
@@ -230,33 +230,11 @@ SOFTWARE.
 # define BITMAP_BIT_ORDER	MSBFirst
 #endif
 
-#if defined(sparc) || defined(__sparc__) || defined(__sparc_v9__)
+#ifdef sparc
 # define AVOID_MEMORY_READ
 # define LARGE_INSTRUCTION_CACHE
 # define FAST_CONSTANT_OFFSET_MODE
-# if !defined(__sparc_v9__) && !defined(__arch64__)
-#  define SHARED_IDCACHE
-# else
-#  define LARGE_INSTRUCTION_CACHE   
-#  define PLENTIFUL_REGISTERS
-# endif
-#endif
-
-#if defined(__sparc_v9__) || ((defined(__sparc__) || defined(sparc)) && defined(__arch64__))
-/* pad scanline to a longword */
-#define BITMAP_SCANLINE_UNIT                   64
-
-#define BITMAP_SCANLINE_PAD                    64
-#define LOG2_BITMAP_PAD                                6
-#define LOG2_BYTES_PER_SCANLINE_PAD            3
-
-/* Add for handling protocol XPutImage and XGetImage; see comment below */
-#define INTERNAL_VS_EXTERNAL_PADDING
-#define BITMAP_SCANLINE_UNIT_PROTO             32
-
-#define BITMAP_SCANLINE_PAD_PROTO              32
-#define LOG2_BITMAP_PAD_PROTO                  5
-#define LOG2_BYTES_PER_SCANLINE_PAD_PROTO      2
+# define SHARED_IDCACHE
 #endif
 
 #ifdef mc68020
Index: mfb/maskbits.h
===================================================================
RCS file: /cvsroot/xsrc/xfree/xc/programs/Xserver/mfb/maskbits.h,v
retrieving revision 1.3
diff -u -p -r1.3 maskbits.h
--- mfb/maskbits.h	28 Feb 2003 21:49:45 -0000	1.3
+++ mfb/maskbits.h	23 Nov 2003 22:03:48 -0000
@@ -523,30 +523,26 @@ extern PixelType mask[];
 #endif
 
 #if GETLEFTBITS_ALIGNMENT == 1
-#if (BITMAP_BIT_ORDER == MSBFirst && PPW == 64)
-#define getleftbits(psrc, w, dst)      dst = SCRLEFT(*((CARD32 *) psrc), PPW - 32)
-#else
-#define getleftbits(psrc, w, dst)      dst = *((CARD32 *) psrc)
-#endif
+#define getleftbits(psrc, w, dst)	dst = *((CARD32 *)(pointer) psrc)
 #endif /* GETLEFTBITS_ALIGNMENT == 1 */
 
 #if GETLEFTBITS_ALIGNMENT == 2
 #define getleftbits(psrc, w, dst) \
     { \
-	if ( ((long)(psrc)) & 0x01 ) \
-		getbits( ((PixelType *)(((char *)(psrc))-1)), 8, (w), (dst) ); \
+	if ( ((int)(psrc)) & 0x01 ) \
+		getbits( ((CARD32 *)(((char *)(psrc))-1)), 8, (w), (dst) ); \
 	else \
-		getbits((PixelType *)psrc, 0, w, dst); \
+		getbits(psrc, 0, w, dst); \
     }
 #endif /* GETLEFTBITS_ALIGNMENT == 2 */
 
 #if GETLEFTBITS_ALIGNMENT == 4
 #define getleftbits(psrc, w, dst) \
     { \
-	long off, off_b; \
-	off_b = (off = ( ((long)(psrc)) & 0x03)) << 3; \
+	int off, off_b; \
+	off_b = (off = ( ((int)(psrc)) & 0x03)) << 3; \
 	getbits( \
-               (PixelType *)( ((char *)(psrc)) - off), \
+		(CARD32 *)( ((char *)(psrc)) - off), \
 		(off_b), (w), (dst) \
 	       ); \
     }
Index: mfb/mfbtegblt.c
===================================================================
RCS file: /cvsroot/xsrc/xfree/xc/programs/Xserver/mfb/mfbtegblt.c,v
retrieving revision 1.3
diff -u -p -r1.3 mfbtegblt.c
--- mfb/mfbtegblt.c	19 Jan 2002 23:19:37 -0000	1.3
+++ mfb/mfbtegblt.c	23 Nov 2003 22:03:49 -0000
@@ -156,9 +156,6 @@ typedef unsigned short	*glyphPointer;
 
 #if GLYPHPADBYTES == 4
 typedef unsigned int	*glyphPointer;
-#if (BITMAP_BIT_ORDER == MSBFirst) && (PGSZ == 64)
-#define USE_LEFTBITS
-#endif
 #endif
 
 #ifdef USE_LEFTBITS