Subject: xsrc/9171: xaa_no_color_exp fails to turn off all color expansion options
To: None <gnats-bugs@gnats.netbsd.org>
From: None <John.P.Darrow@wheaton.edu>
List: netbsd-bugs
Date: 01/11/2000 17:42:51
>Number:         9171
>Category:       xsrc
>Synopsis:       xaa_no_color_exp fails to turn off all color expansion options
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    xsrc-manager (NetBSD X11 bug manager)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 11 17:42:00 2000
>Last-Modified:
>Originator:     John Darrow
>Organization:
	Computing Services
	Wheaton College, Wheaton. IL
>Release:        current-20000111 including the newly-imported XFree86 3.3.6
>Environment:
System: NetBSD jdarrowpiii.wheaton.edu 1.4P NetBSD 1.4P (JDARROW) #0: Tue Jan 11 12:31:03 CST 2000 jdarrow@jdarrowpiii.wheaton.edu:/var/src/sys/arch/i386/compile/JDARROW i386


>Description:
(Bug report also submitted directly to XFree86)

The initial problem was that a newly-compiled XF86_SVGA (from NetBSD
xsrc, which just imported 3.3.6 yesterday) was giving text corruption 
on an ATI Rage 128.  Trying the XFree86-supplied server binary
yielded the same results.  After much man-page searching, I first   
tried the option "noaccel".  This yielded proper text, but was almost
unusable due to slowness.  I then saw the option "xaa_no_color_exp" on
the XF86_SVGA(1) man page, with the corresponding mention of "If you
see text rendering problems, try this."  I tried it.  It didn't help.
I noticed, however, that even with this option, the server startup log
still included the following line:
(--) SVGA: XAA: Indirect CPU to screen color expansion (imagetext, polytext)
Digging through the source code, I discovered that setting
xaa_no_color_exp turned off CPU-to-screen color expand and
Screen-to-screen color expand, but not Scanline screen-to-screen color
expand.  This disparity struck me as odd, so I added the conditional
!OFLG_ISSET(OPTION_XAA_NO_COL_EXP, ...) to the latter.  Voila, the
text was no longer corrupted!

>How-To-Repeat:
Build from new xsrc, hoping to finally utilize ATI Rage 128.  See text
corruption.  Try some options.  Look at source code.  Bang head on wall.

>Fix:
This fixes the xaa_no_color_exp problem (though it would be better
if color expansion didn't corrupt text in the first place.)  It also
changes some #if 0's to #if 1's followed by if (xf86Verbose),
because it's much harder to track down problems if the server won't
tell you what it's doing EVEN IF YOU'VE TOLD IT TO BE VERBOSE.

Index: /source/NetBSD-current/xsrc/xc/programs/Xserver/hw/xfree86/xaa/xf86initac.c
===================================================================
RCS file: /source/cvs/netbsd/current/xsrc/xc/programs/Xserver/hw/xfree86/xaa/xf86initac.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- xf86initac.c	1999/01/19 03:17:15	1.1.1.2
+++ xf86initac.c	2000/01/12 00:53:35	1.2
@@ -104,8 +104,9 @@
     !OFLG_ISSET(OPTION_XAA_NO_COL_EXP,
     &(xf86AccelInfoRec.ServerInfoRec->options))) {
         CPUToScreenColorExpand = TRUE;
-#if 0
+#if 1
         /* There's a more useful message below. */
+        if (xf86Verbose)
         ErrorF("%s %s: XAA: CPU-to-screen color expand\n",
             XCONFIG_PROBED, xf86AccelInfoRec.ServerInfoRec->name);
 #endif
@@ -115,15 +116,18 @@
     !OFLG_ISSET(OPTION_XAA_NO_COL_EXP,
     &(xf86AccelInfoRec.ServerInfoRec->options))) {
         ScreenToScreenColorExpand = TRUE;
-#if 0
+#if 1
+        if (xf86Verbose)
         ErrorF("%s %s: XAA: Screen-to-screen color expand\n",
             XCONFIG_PROBED, xf86AccelInfoRec.ServerInfoRec->name);
 #endif
     }
     if (xf86AccelInfoRec.SetupForScanlineScreenToScreenColorExpand &&
-    xf86AccelInfoRec.SubsequentScanlineScreenToScreenColorExpand) {
+    xf86AccelInfoRec.SubsequentScanlineScreenToScreenColorExpand &&
+    !OFLG_ISSET(OPTION_XAA_NO_COL_EXP,
+    &(xf86AccelInfoRec.ServerInfoRec->options))) {
         ScanlineScreenToScreenColorExpand = TRUE;
-#if 0
+#if 1
         if (xf86Verbose)
             ErrorF("%s %s: XAA: Scanline screen-to-screen color expand\n",
                 XCONFIG_PROBED, xf86AccelInfoRec.ServerInfoRec->name);

>Audit-Trail:
>Unformatted: