Early this week, I bought an ATIXPERT 128 video card.
This card was destined to be part of the box I talked about in my previous article
about keyboards in headless boxes. The motherboard has an on-board S3 video card, but I failed to get that
working. I gave up, and bought the ATI upon the recommendation of someone who knows these things. So on
snow filled roads, I headed off to OEM Express and picked up the
card.
NOTE: since writing this article, I've had word from the XFree86 project that support for the
ATI XPERT 128 (which is a Rage 128 PP) is already in their CVS. The
FreeBSD Port
was updated on 5 January 2002 (PORTVERSION=4.1.0, PORTREVISION=3).
Until today, all the articles on this website about XFree86 were written by
contributing authors. I have previously installed XFree86 on my dual XEON.and actually
kept some notes on that adventure. It was never published because they would not have helped anyone. But in
combination with the ATI XPERT success, I figured it was time to write.
What is XFree86
XFree86 is a freely re-distributable open-source implementation of the
X Window System. It runs on many operating systems including the BSDs,
Mac OS X (aka Darwin), Solaris, and OS/2. It sits between the hardware and your graphical user interface.
It is important to note that XFree86 is a server. To use it, you must have a client.
KDE, GNOME,
Enlightenment, Blackbox,
AfterStep, twm
and fvwm are all XFree86 clients.
Installing XFree86
The installation of X was fairly straight forward since I had the ports tree installed.
cd /usr/ports/x11/XFree86-4
make install
I answered all the questions with the default answers (I think...). This was the easy part.
But before you do the above, you may wish to read the next section.
mega-port or sub-ports?
Pete Fritchman (a FreeBSD committer) wrote the following.
The installation of XFree86 4.1.0 is fairly easy. Some may choose to install
the XFree86-4 mega-port (in /usr/ports/x11/XFree86-4), but this port is soon
to be deprecated for the sub packages (XFree86-*-4.1.0). You need to install
at least the libraries, clients, and the X server (in 4.1.0, there is just one
X server instead of lots of smaller specific ones like in 3.3.6, ie XF86_SVGA).
cd /usr/ports/x11/XFree86-4-libraries && make install
cd /usr/ports/x11/XFree86-4-clients && make install
cd /usr/ports/x11-servers/XFree86-4-Server && make install
You should also install the various font packages. The default bitmaps are the
bare minimum:
cd /usr/ports/x11-fonts/XFree86-4-fontDefaultBitmaps && make install
There are some other XFree86 4.1.0 packages you may wish to install. Check
out their respective pkg-comment and pkg-descr files and decide if you wish
to use them:
Thanks Pete. I didn't know about the deprecation until after I had nearly finished the article
and was looking around for help about my mouse problem.
Tell everyone you're using XFree86-4
I've been told by more than one person that after installing XFree86-4, you should add
this entry to /etc/make.conf (create this file if it doesn't
already exist):
XFREE86_VERSION=4
Why? The answer is in /etc/defaults/make.conf (never change any file in
/etc/defaults):
# By default, the ports collection attempts to use XFree86 3.3.X. If
# you are running XFree86 4.X, uncomment this line.
That handy little line will ensure that in the future, when you install a port which depends on X,
it will use 4, not 3.
Configuration
I had a very hard time setting up X. No doubt about it. Your milage may vary.
Please don't assume that this article will have all the answers to your X configuration.
I'm only reporting what worked with me with my hardware. But I wish you well.
There are two ways I know of to configure X:
/usr/X11R6/bin/xf86config
XFree86 -configure
I started off with option #2, but immediately encountered a problem. The last part of the
error message is as follows:
# XFree86 -configure
[top part of output deleted]
Fatal server error:
XFree86 has found a valid card configuration.
Unfortunately the appropriate data has not been added to xf86PciInfo.h.
Please forward 'scanpci -v' output to XFree86 support team.
When reporting a problem related to a server crash, please send
the full server output, not just the last messages.
This can be found in the log file "/var/log/XFree86.8.log".
Please report problems to xfree86@xfree86.org.
That was not a particularly helpful start to the configuration. So I went on to the
other option (/usr/X11R6/bin/xf86config).
Monitor details
You will need
the horizontal and vertical refresh rates for your monitor. It is very important that
you get the correct values. Look in your owner manual. Look on the web. Get
the right information. You can damage your monitor if you do not specify the
correct values.
Card selection
At one point during the configuration, you will be asked to look at the card
database. Please do so. See if you can locate your card. Use that option.
Don't worry if you go past your card in the list. Just keep going and the
list scrolls through again. My card (ATI XPERT 128) was not listed. So I chose
one which looked similar (I think it was ATI Xpert 98).
Screen resolution
You will also have the opportunity to change the list of modes (screen resolutions).
That screen will look something like that:
For each depth, a list of modes (resolutions) is defined. The default
resolution that the server will start-up with will be the first listed
mode that can be supported by the monitor and card.
Currently it is set to:
"640x480" "800x600" "1024x768" for 8-bit
"640x480" "800x600" for 16-bit
"640x480" for 24-bit
Modes that cannot be supported due to monitor or clock constraints will
be automatically skipped by the server.
1 Change the modes for 8-bit (256 colors)
2 Change the modes for 16-bit (32K/64K colors)
3 Change the modes for 24-bit (24-bit color)
4 The modes are OK, continue.
Enter your choice:
X will take the first resolution which works. I modified the modes
to put the higher resolutions first. For example, "1024x768" "800x600" "640x480"
instead of "640x480" "800x600" "1024x768". This is also where you can choose to
have a virtual screen (desktop), which is screen area that is larger than the
physical screen. I chose not to.
For color depth, I chose 24 bits as the default.
'Tis the season to be wrapping...
XFree86-4 comes with a wrapper function. This allows non-root users to run X.
I didn't save the message which appears if you try to run X as non-root. If you
encounter that message, please save it in the message comments if someone else
hasn't already done that. Thank you.
To install the wrapper, I did this:
cd /usr/ports/x11/wrapper/
make install
Starting X
The rather aptly named command to start X is:
startx
Unfortunately, it wasn't that simple.
The problem behind the patch
I encountered the same message as when I tried to run XFree86 -configure:
# XFree86 -configure
[top part of output deleted]
Fatal server error:
XFree86 has found a valid card configuration.
Unfortunately the appropriate data has not been added to xf86PciInfo.h.
Please forward 'scanpci -v' output to XFree86 support team.
When reporting a problem related to a server crash, please send
the full server output, not just the last messages.
This can be found in the log file "/var/log/XFree86.8.log".
Please report problems to xfree86@xfree86.org.
Looking back at this now, it's easy to see that running the configuration
from the previous step wouldn't change what already existed. The X server didn't
recognize my card. And running a configuration routine would not change that fact.
I spent several hours tracking down documents via Google which
talked about ATI XPERT 128. They all said the card contained a RAGE 128 chipset and to use that.
I found very many references to two solutions. Unfortunately, both URLS were unreachable (I'm guessing
the documents no longer exist on the net).
I was resigned to buying another card which XFree86 supported directly. But then Chris Dillon suggested I patch
the code to add my card to the system. Hmmm, OK. At first I was very skeptical I could get that to work.
Chris Shumway was helping me through this part of it (thanks Chris, it was helpful) and asked
to see this output:
We knew what line to look for because of this entry found in the dmesg output:
pci0: <ATI model 5050 graphics accelerator> at 9.0 irq 10
Look at the second-to-last line in the pciconf output.
That is the none0@0:9:0 line. That matches the 9.0
found within the dmesg extract above.
You should also notice that 5050 appears in both outputs. We will be using that
in our patch.
The chip information field of pciconf output contains 0x50501002
5050 also appears in the dmesg output
You will see this information when you read about the patch in a later section of this
article.
The patch
It was Chris Dillon who guided me through this patch and it was his information which led me to the files
which needed modification. The patch is available at
/samples/ATIXPERT128XFree86-4.patch. This patch
is now included within the FreeBSD port. It has also been submitted to the XFree86 project. Initial
feedback from them indicated they had already patched their code. But I had a look at their CVS repository
and their patch appears to have been incompletely applied. If you want to see their code, see these links:
As you can see, r128_probe has been udpated. I'll update this when I hear back from them about the patch.
The first change was to xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h.
If you recall the error message I obtained when I first ran, it mentioned that I needed to update this
file. Instructions for doing so are located at the top of this file, but I found them rather
confusing. Luckily, I had Chris Dillon helping.
The line I added contains the card ID as shown in the previous section. Here's the line:
#define PCI_CHIP_RAGE128PP 0x5050
I made up the PE suffix. The entry before it was PD. The next change involves the card name etc:
{PCI_CHIP_RAGE128PP,"Rage 128 Xpert 128",0}
The remaining changes were in the directory xc/programs/Xserver/hw/xfree86/drivers/ati.
The changes to r128_probe.c.org involved adding the two entries for the card. In r128_driver.c, I just
added an entry for the card in two switches. And in r128_dri.c, my card was a PCI card, so added the
entry shown.
I have no idea if this patch is correct. I know it got my card working. It may not work for you.
In fact, I would not be surprised if your computer exploded given this patch. Be warned.
Running configure again
Adding this didn't mean I could still run XFree86 -configure. That still doesn't recognize the
code. I'm sure I need to recompile something there. Actually, I tried this:
cd /usr/ports/x11/XFree86-4/work/xc/programs/Xserver
make install
Then I reran the original configuration command:
XFree86 -configure
[lots of output snipped]
XFree86 detected your mouse at device /dev/mouse.
Please check your config if the mouse is still not
operational, as by default XFree86 tries to autodetect
the protocol.
Your XF86Config file is /home/dan/XF86Config.new
To test the server, run 'XFree86 -xf86config /home/dan/XF86Config.new'
I ran with that, it seemed to work fine. For your information, here's the
setting for my ATI XPERT 128 card:
That configuration worked for me. The configuration file I'm running with now is at
/samples/XF86Config.
Adding KDE
I wanted to add KDE as my window manager. So I did the following:
cd /usr/ports/x11/kde2 && make install && make distclean
cd /usr/ports/x11-wm/kdeartwork && make install && make distclean
cd /usr/ports/x11-wm/mosfet-liquid && make install && make distcleann
WARNING: Installing KDE2 will take quite a while. I prefer to instal
from source. It took overnight...
Actually, I couldn't get mosfet-liquid to install:
===> Configuring for mosfet-liquid-0.7
cd /usr/ports/x11-wm/mosfet-liquid/work/mosfet-liquid0.7; gmake -f Makefile.cvs
This Makefile is only for the CVS repository
This will be deleted before making the distribution
*** Concatenating configure tests into acinclude.m4
*** Creating list of subdirectories in subdirs
*** Searching for subdirectories...
*** Retrieving configure tests needed by configure.in
*** Scanning for include statements
./aclocal.m4:2695: error: m4_defn: undefined macro: _m4_divert_diversion
acfunctions.m4:1108: AM_FUNC_OBSTACK is expanded from...
./aclocal.m4:2695: the top level
autoconf: tracing failed
gmake[1]: *** [cvs] Error 1
gmake: *** [all] Error 2
*** Error code 2
Stop in /usr/ports/x11-wm/mosfet-liquid.
*** Error code 1
I haven't been able to figure that one out yet.
Starting KDE
After installing KDE, I again run startx. I was disappointed to
see the same old X I had the first time. No KDE. What happened?
You have to tell X to start KDE. You do that with this entry in ~/.xinitrc:
startkde
And then startx gave me KDE! And it looks good!
Installing fonts
You can install additional fonts and this will make your screen much more pleasant to look at.
Here are the fonts I installed:
cd /usr/ports/x11-fonts/freefonts && make install && make distclean
cd /usr/ports/x11-fonts/mozilla-fonts && make install && make distclean
cd /usr/ports/x11-fonts/sharefonts && make install && make distclean
cd /usr/ports/x11-fonts/webfonts && make install && make distclean
Then you need to tell XFree86 about the fonts. Here are the entries from
my /etc/X11/XF86Config file:
This screen shot (96 KB PNG) is what my screen looks like after
I installed kde and kdeartwork (see above). Here's another one
showing this website. After installing the fonts, here's what
the same screen looks like. Personally, I prefer the fonts
from the first two images.
Here are the font paths from my /etc/X11/XF86Config:
See also True Type fonts and XFree86 although it deals with mostly with
XFree86-3, there is a comment there which deals with XFree86-4. Those are the steps I performed
to get TrueType fonts going.
Here is what I have in /etc/X11/XftConfig:
dir "/usr/X11R6/lib/X11/fonts/TrueType"
dir "/usr/X11R6/lib/X11/fonts/mozilla"
dir "/usr/X11R6/lib/X11/fonts/sharefont"
dir "/usr/X11R6/lib/X11/fonts/webfonts"
#
# My additions
#
match any family == "Arial" edit antialias = true;
match any family == "Andale" edit antialias = true;
match any family == "Verdana" edit antialias = true;
match any family == "Trebuchet" edit antialias = true;
match any family == "Times" edit antialias = true;
[ the rest was unchanged.... ]
And here is my ~/.xftconfig which is included (if it exists) by
/etc/X11/XftConfig:
dir "/usr/X11R6/lib/X11/fonts/TrueType/"
dir "/usr/X11R6/lib/X11/fonts/webfonts/"
dir "/usr/X11R6/lib/X11/fonts/freefont/"
match
any size > 6
any size < 10
edit
antialias = false;
This prevents antialiasing on the smaller fonts.
Virtual consoles and X
I hope you know about virtual consoles. It's a way of having more than one
login session at the same time using the same console. The first console
is displayed when you press ALT-F1, the second when
you press ALT-F2, etc. To break out of X to a virtual
console, you must also press CONTROL. To get back into X, press ALT-F9.
This assumes you have eight virtual consoles (the default with FreeBSD).
For example, if you are in X, and you wish to go to the 5th virtual console, press
CONTROL-ALT-F5.
Screen saver/splash screen
As mentioned before, this box is destined to be used at an upcoming
Linux User Group meeting. I thought
a splash screen would be a good idea. This brilliant thought game to me
while I was browsing through the
The X Window System and Virtual Consoles
section of The FreeBSD FAQ.
I picked this splash screen from
http://www.baldwin.cx/splash/. This bitmap will expand to fill
your screen at boot time. It will remain displayed until you press a key or a screen saver loads. I also
found this screen kicks in as a screen saver if you are on a console. I'm sure X has its own screen saver.
I do like the look of KDE. What it gave me was good. The only other window manager I have used
was Enlightment. That was a bare bones install on my laptop. It worked OK.
But this KDE had a great deal of applications with it. A mini-office suite, editors, some graphics tools,
mail clients, etc. It seems like a great package.
I spent the first two days with a very annoying mouse problem. I had a great problem getting mouse clicks
to work. I thought it was the mouse. Then I tried another. Same problem. Grrr!
The click would not "take" unless I press and hold down the button, move the cursor slightly, then let go.
Then and only then would the click take. I asked around, and someone suggested it sounded like I was using
/dev/sysmouse with XFree86. I looked around and sure enough I was. I had this
in my /etc/X11/XF86Config:
It was recommended that I stop running moused and let XFree86-4 work directly on
/dev/psm0. That was fairly easy to do. Here is what I'm now using in
/etc/X11/XF86Config (I've put the changed values in bold):
I also commented out the section in my /etc/rc.conf pertaining to
moused (see above). Then I killed moused
killall -TERM moused
I stopped and started X. My mouse was great! Thanks tds-dmns.
Stuck in X? Get out now!
I didn't tell all when I mentioned my mouse problem above. My first attempt actually failed.
It gave me a mouse which didn't move. Technically speaking, the mouse moved, but the cursor on the
screen didn't. That's when this handy get-out-of-XFree tip comes in handy:
CONTROL-ALT-BACKSPACE
No fuss. No mess. No X. Then I was able to make the changes indicated above (correctly this time),
get back into X, and have a moving clicking mouse.
Various KDE/X Tips/Tricks31 December 2001
I've been playing with some KDE settings and I've found what I think is a fairly good setup.
The following are just a few tips/tricks I've found or been told about.
DisplaySize
This is a directive you can add to the monitor section of your /etc/X11/XF86Config.
The actual values depend upon your monitor. They represent width and height of your monitor picture,
measured in milimeters. I suggest you search Google for "DisplaySize"
and your monitor model. I didn't find my exact model, but I found one for my brand, Hitachi, and used that.
Here is the setting I used:
WARNING:Use the settings appropriate for your monitor. Using the wrong values may damage your monitor.
Compare the screen shots before and
after I made the above change.
The KDE menu
I had been searching for a way to invoke the KDE menu (that's the one with the K symbol on it; it is analogous
to the Windows Start menu) from the keyboard. I found it in the Control Center
under Look & Feel, in the Key Bindings section.
Look under Panel for Popup Launch Menu.
My setting was ALT-F1.
Yes, I use Microsoft. In fact, I'm typing this on an MS Natural Keyboard, with an MS IntelliEye mouse,
on an NT4 box, which is SSH's to my XEON. Use the tools which suit. If you don't want to use MS, don't.
But don't knock anyone who does want to use them. That's not good advocacy.
Here are the settings for my mouse when allowed me to get my mouse (which is a USB mouse but connected
using a PS/2 adaptor):
These settings allowed my mouse wheel to be used to scroll up and down. I tested it using KWord from KDE.
My thanks to Dial_tone for the mouse and DisplaySize help.
Back it up!
As was so correctly pointed out to me, once you have a working /etc/X11/XF86Config,
make sure you back it up in about 42 different places. Don't lose it! I would also backup
/etc/X11/XftConfig and ~/.xftconfig. In fact, I've put
mine on this website.... Just in case.
Like the website? Want to give back? Please visit my wish list!