Debian Sarge on a Sony Vaio PCG-FX 805


This document describes setting up Debian Sarge on a Sony Vaio PCG-FX 805 laptop. It is a work in progress; I plan to add more details as I keep changing my setup. Expect frequent changes to this document.


XFree86

I had been running Debian Woody on this machine. The current version of the X Window System on Woody is 4.1.0. The ati driver in XFree86 4.1.0 does not support the XVideo extension necessary for DVD and video stream playback on X11. Therefore I installed the ati.2 driver from gatos.sourceforge.net over the default X11 installation.

Upgrading to XFree86 4.3.0

Recently I decided to dist-upgrade to Debian Sarge. The current XFree86 on Sarge (a.k.a. "testing") is 4.2.1. There is no precompiled ati.2 driver for XFree86 4.2.1, so I started to look for an alternative. www.retinalburn.net has a driver that is based on the GATOS driver and incorporates DRI (direct rendering interface) and TV-out capabilities as well (I haven't yet tried the latter). The XFree86 4.3.0 version of this driver includes the drm kernel module which needs to be loaded before starting X11. I decided to upgrade my X Window System installation to 4.3.0 using the Debian packages for Sid (a.k.a. "unstable"). These are the packages I installed on my system:
libdps1_4.3.0-5_i386.deb
libice6_4.3.0-5_i386.deb
libice-dev_4.3.0-5_i386.deb
libsm6_4.3.0-5_i386.deb
libsm-dev_4.3.0-5_i386.deb
libx11-6_4.3.0-5_i386.deb
libx11-dev_4.3.0-5_i386.deb
libxaw7_4.3.0-5_i386.deb
libxext6_4.3.0-5_i386.deb
libxext-dev_4.3.0-5_i386.deb
libxft1_4.3.0-5_i386.deb
libxi6_4.3.0-5_i386.deb
libxi-dev_4.3.0-5_i386.deb
libxmu6_4.3.0-5_i386.deb
libxmu-dev_4.3.0-5_i386.deb
libxmuu1_4.3.0-5_i386.deb
libxmuu-dev_4.3.0-5_i386.deb
libxp6_4.3.0-5_i386.deb
libxp-dev_4.3.0-5_i386.deb
libxpm4_4.3.0-5_i386.deb
libxpm-dev_4.3.0-5_i386.deb
libxrandr2_4.3.0-5_i386.deb
libxrandr-dev_4.3.0-5_i386.deb
libxt6_4.3.0-5_i386.deb
libxt-dev_4.3.0-5_i386.deb
libxtrap6_4.3.0-5_i386.deb
libxtrap-dev_4.3.0-5_i386.deb
libxtst6_4.3.0-5_i386.deb
libxtst-dev_4.3.0-5_i386.deb
libxv1_4.3.0-5_i386.deb
libxv-dev_4.3.0-5_i386.deb
pm-dev_4.3.0-5_all.deb
twm_4.3.0-5_i386.deb
xbase-clients_4.3.0-5_i386.deb
x-dev_4.3.0-5_all.deb
xfonts-100dpi_4.3.0-5_all.deb
xfonts-75dpi_4.3.0-5_all.deb
xfonts-base_4.3.0-5_all.deb
xfree86-common_4.3.0-5_all.deb
xfs_4.3.0-5_i386.deb
xlibmesa-gl_4.3.0-5_i386.deb
xlibmesa-gl-dev_4.3.0-5_i386.deb
xlibmesa-glu_4.3.0-5_i386.deb
xlibmesa-glu-dev_4.3.0-5_i386.deb
xlibs_4.3.0-5_all.deb
xlibs-data_4.3.0-5_all.deb
xlibs-dev_4.3.0-5_all.deb
xlibs-pic_4.3.0-5_all.deb
xlibs-static-dev_4.3.0-5_i386.deb
xlibs-static-pic_4.3.0-5_i386.deb
xserver-common_4.3.0-5_i386.deb
xserver-xfree86_4.3.0-5_i386.deb
xterm_4.3.0-5_i386.deb
xutils_4.3.0-5_i386.deb

Adding DRI and XVideo support

To install the patched driver, unpack the mach64-dri-xv-20030413.i386.tar.bz2 archive and call install.sh as root. (You can restore your previous installation by calling the script as install.sh restore. Don't forget to do so before upgrading with apt-get.) This installs new modules into your X11R6 tree. It also compiles the mach64.o kernel module and copies it into your kernel modules directory (/lib/modules/`uname -r`/kernel/drivers/char/drm/).

If you compiled your kernel with CONFIG_AGP=y and CONFIG_AGP_VIA=y, you can now load the mach64.o module with modprobe mach64. This enables DRI/GLX kernel support for X11.

As I was still using a 2.4.25 kernel that I compiled (with gcc 2.95) before upgrading to Sarge, I got a warning in /var/log/XFree86.0.log. You need to make sure that the mach64.o module is compiled with the same gcc version you used for compiling your current kernel. I recompiled the kernel with gcc 3.3.3 and restarted X.

DRI configuration

The PCG-FX 805's display supports a resolution of up to 1400x1050. However, its ATI Rage Mobility graphics card has only 8MB of video memory. If you try to load DRI at 1400x1050@24bpp, you will get a warning in /var/log/XFree86.0.log:
(WW) ATI(0): DRI static buffer allocation failed -- need at least 14437 kB video memory
I found that the maximum resolution @24bpp is 1024x768, resulting in a meager 183fps as reported by glxgears. At 1280x1024@16bpp, I got 287fps. For a slightly better result, start X @16bpp and 800x600. 315fps may not be much, but tuxracer becomes at least playable. If you need DRI, I recommend setting "DefaultDepth" in the "Screen" section of your XF86Config-4 to "16" and disabling "1400x1050".

XVideo support

To check whether XVideo support is working, run xvinfo. Here's the output on my system:
X-Video Extension version 2.2
screen #0
Adaptor #0: "ATI mach64 Video Overlay"
number of ports: 1
port base: 61
operations supported: PutImage
supported visuals:
depth 24, visualID 0x23
depth 24, visualID 0x24
depth 24, visualID 0x25
depth 24, visualID 0x26
depth 24, visualID 0x27
depth 24, visualID 0x28
depth 24, visualID 0x29
depth 24, visualID 0x2a
number of attributes: 17
"XV_DEVICE_ID" (range 0 to -1)
client gettable attribute (current value is 307)
"XV_LOCATION_ID" (range 0 to -1)
client gettable attribute (current value is 308)
"XV_INSTANCE_ID" (range 0 to -1)
client gettable attribute (current value is 309)
"XV_SET_DEFAULTS" (range 0 to 1)
client settable attribute
"XV_AUTOPAINT_COLORKEY" (range 0 to 1)
client settable attribute
client gettable attribute (current value is 1)
"XV_COLORKEY" (range 0 to -1)
client settable attribute
client gettable attribute (current value is 197120)
"XV_DOUBLE_BUFFER" (range 0 to 1)
client settable attribute
client gettable attribute (current value is 1)
"XV_ENCODING" (range 0 to 12)
client settable attribute
client gettable attribute (current value is 1)
"XV_FREQ" (range 0 to -1)
client settable attribute
client gettable attribute (current value is 1000)
"XV_TUNER_STATUS" (range -1000 to 1000)
client gettable attribute (current value is 4)
"XV_MUTE" (range 0 to 1)
client settable attribute
client gettable attribute (current value is 1)
"XV_VOLUME" (range -1000 to 1000)
client settable attribute
client gettable attribute (current value is -1000)
"XV_BRIGHTNESS" (range -1000 to 1000)
client settable attribute
client gettable attribute (current value is 0)
"XV_CONTRAST" (range -1000 to 1000)
client settable attribute
client gettable attribute (current value is 0)
"XV_SATURATION" (range -1000 to 1000)
client settable attribute
client gettable attribute (current value is 16)
"XV_COLOR" (range -1000 to 1000)
client settable attribute
client gettable attribute (current value is 16)
"XV_HUE" (range -1000 to 1000)
client settable attribute
client gettable attribute (current value is 0)
maximum XvImage size: 2048 x 2048
Number of image formats: 4
id: 0x32595559 (YUY2)
guid: 59555932-0000-0010-8000-00aa00389b71
bits per pixel: 16
number of planes: 1
type: YUV (packed)
id: 0x59565955 (UYVY)
guid: 55595659-0000-0010-8000-00aa00389b71
bits per pixel: 16
number of planes: 1
type: YUV (packed)
id: 0x32315659 (YV12)
guid: 59563132-0000-0010-8000-00aa00389b71
bits per pixel: 12
number of planes: 3
type: YUV (planar)
id: 0x30323449 (I420)
guid: 49343230-0000-0010-8000-00aa00389b71
bits per pixel: 12
number of planes: 3
type: YUV (planar)

Now mplayer
runs smoothly with the -vo xv command line option. You can switch to and from full screen mode with the "f" key. (The superb mplayer is still not included in Debian, but you can get Christian Marillat's Debian packages from ftp.nerim.net).

TV-out

In the "Device" section in /etc/X11/XF86Config-4, add the following lines:
Option    "TVOut"
Option   "TVStandard"   "PAL"

For an NTSC monitor, you would use "NTSC", of course. See http://www.retinalburn.net/linux/tvout.html for further options. 24bpp does not work with the driver. You need to configure X to run at 1024x768@16bpp or 800x600@16bpp.

It should be possible to switch between the LCD screen of the FX 805 and the TV monitor with the Fn+F8 key combination. However, this did not work for me. I had to switch back to a text console with Ctrl+Alt+F[1..6], then switch between LCD and TV monitor with Fn+F8, then go back to X with Alt+F7. You either get an image on the LCD or the TV screen, never both at a time.

For XVideo playback on the TV monitor, start mplayer while the latter is active. The -fs option will play the video stream in full screen mode. It actually looks much better than on the LCD.

Theoretically it should be possible to configure the ATI rage mobility graphics adapter to run in dual head mode, so that you could run mplayer's interface (text or graphics, I prefer the former) on the LCD while sending the video stream to the TV screen. The mach64-dri-xv driver does not support this, though.

My current /etc/X11/XF86Config-4

Section "Files"
FontPath "unix/:7100"
EndSection

Section "Module"
Load "freetype"
Load "speedo"
Load "type1"
Load "xtt"
SubSection "extmod"
Option "omit SYNC"
EndSubSection
Load "glx"
Load "dri"
Load "dbe"
Load "xtrap"
Load "record"
EndSection

Section "InputDevice"
Identifier "Generic Keyboard"
Driver "keyboard"
Option "CoreKeyboard"
Option "XkbRules" "xfree86"
Option "XkbModel" "pc105"
Option "XkbLayout" "de"
EndSection

Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/psaux"
Option "Protocol" "PS/2"
Option "Emulate3Buttons" "true"
Option "SendCoreEvents" "true"
EndSection

Section "InputDevice"
Identifier "USBmouse"
Driver "mouse"
Option "SendCoreEvents" "true"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "ZAxisMapping" "4 5"
Option "Buttons" "5"
EndSection

Section "Device"
Identifier "ATI Rage Mobility"
Driver "ati"
BusID "PCI:01:00:0"
EndSection

Section "Monitor"
Identifier "Sony FX805"
HorizSync 30-92
VertRefresh 50-85
Option "DPMS"
EndSection

Section "Screen"
Identifier "Default Screen"
Device "ATI Rage Mobility"
Monitor "Sony FX805"
DefaultDepth 24
SubSection "Display"
Depth 16
Modes "1024x768" "800x600"
EndSubSection
SubSection "Display"
Depth 24
Modes "1400x1050" "1280x1024" "1280x960" "1024x768" "800x600"
EndSubSection
EndSection

Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen"
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
InputDevice "USBmouse"
EndSection

Section "DRI"
Mode 0666
EndSection

PCMCIA/Cardbus

Install the pcmcia-cs package, compile the kernel with CONFIG_ISA=y (you need this to assign an interrupt to 16bit cards), CONFIG_PCMCIA=m, and CONFIG_CARDBUS=y. Set PCIC=yenta_socket in /etc/default/pcmcia, start PCMCIA support with the command /etc/init.d/pcmcia start, and insert your card(s). I've successfully used Ethernet, SCSI, USB 2.0, CF, and several WLAN PCMCIA adapters in both slots.

FireWire

You need to load the ieee1394 and ohci1394 kernel modules, plus any additional modules required by your FireWire devices. See www.linux1394.org for details. For storage devices, you will have to load the sbp2 kernel module plus the corresponding SCSI driver (sd_mod for a harddisk, sg for a DVD burner and so on). Afterwards you need to register your devices with procfs. Make sure you have the following line in your /etc/fstab:
proc    /proc   proc    defaults    0    0
Assuming that your DVD/CD-RW is registered as a SCSI device (in which case you will have a file /proc/scsi/ide-scsi/0), the sbp2 module will be SCSI host 1. Enter the following command at the console prompt:
echo "scsi add-single-device 1 0 0 0" > /proc/scsi/scsi
If you have more than one device on the firewire bus, continue with
echo "scsi add-single-device 1 0 1 0" > /proc/scsi/scsi
and so on. The first number is the SCSI host, the second the bus (usually 0), the third the target on the sbp2 host, the fourth is its LUN (usually 0). Following this example, you'll be able to address the FireWire harddisk as /dev/sda and the DVD burner as /dev/scd1.

Alternatively, just run the script rescan-scsi-bus.sh from the scsitools package. If you prefer your FireWire devices to be handled by hotplug, you should write a script /etc/hotplug/ieee1394/sbp2 which runs rescan-scsi-bus.sh automatically when a FireWire storage device is plugged in. In this case, it is sufficient to list ohci1394 in /etc/modules, all other modules will be loaded by hotplug. You might take the script that can be found at www.linux1394.org as a template, or, somewhat more foolproof, the one included with SuSE 9.0.

Sound (VIA VT82C686 AC97)

I'm using the commercial version of the Open Sound System. You can download the driver from www.opensound.com. It will run for a limited time before you need to buy a license. As this is not free software, you may prefer to install the Alsa driver, but I haven't tried it myself. One advantage of the commercial OSS drivers is the virtual mixer feature which allows you to run KDE's artsd sound daemon on /dev/dsp2, for example, while mplayer outputs its audio stream to /dev/dsp3.

Ethernet

CONFIG_8139TOO is your friend. There's not much too say about it; the driver works reliably.

Software modem

Works with the Conexant HSF softmodem driver from Linuxant . See www.linuxant.com for details.

USB 1.1

You need the UHCI kernel driver (CONFIG_USB_UHCI=m). modprobe usb_uhci is all you need to get this to work. It's recommended to compile the kernel with usbdevfs support (CONFIG_USB_DEVICEFS=y). Add the following line to /etc/fstab:
none    /proc/bus/usb    usbfs    defaults    0    0
Once you've mounted /proc/bus/usb/, you can use the lsusb command to list connected devices. The procedure for mounting storage devices is similar to FireWire. modprobe usb-storage will create yet another virtual SCSI host which you will find under /proc/scsi/usb-storage-0/2 (following the previous examples). To register a USB memory stick as /dev/sdb (remember we already have a FireWire hard disk as /dev/sda), enter the following command:
echo "scsi add-single-device 2 0 0 0" > /proc/scsi/scsi
You can remove the device with this command:
echo "scsi remove-single-device 2 0 0 0" > /proc/scsi/scsi
None of this is needed if you installed the hotplug package. It will automatically load the kernel modules and attach the emulated SCSI devices.

This is what the output of /proc/scsi/scsi should look like now:
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: MATSHITA Model: UJDA730 DVD/CDRW Rev: 1.00
  Type:   CD-ROM                           ANSI SCSI revision: 02
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: SONY     Model: DVD RW DRU-500A  Rev: 2.0h
  Type:   CD-ROM                           ANSI SCSI revision: 02
Host: scsi1 Channel: 00 Id: 01 Lun: 00
  Vendor: Maxtor   Model: 5000DV           Rev: 0100
  Type:   Direct-Access                    ANSI SCSI revision: 06
Host: scsi2 Channel: 00 Id: 00 Lun: 00
  Vendor: Sony     Model: Storage Media    Rev: PROL
  Type:   Direct-Access                    ANSI SCSI revision: 02

ACPI

You need the following kernel configuration options for ACPI on this machine:
CONFIG_ACPI=y
CONFIG_ACPI_BOOT=y
CONFIG_ACPI_BUS=y
CONFIG_ACPI_INTERPRETER=y
CONFIG_ACPI_EC=y
CONFIG_ACPI_POWER=y
CONFIG_ACPI_PCI=y
CONFIG_ACPI_SLEEP=y
CONFIG_ACPI_SYSTEM=y
CONFIG_ACPI_AC=y
CONFIG_ACPI_BATTERY=y
CONFIG_ACPI_BUTTON=y
CONFIG_ACPI_FAN=y
CONFIG_ACPI_PROCESSOR=y
CONFIG_ACPI_THERMAL=y
This makes a lot of information available in /proc/acpi/. You do need this information, especially the output of /proc/acpi/battery/BAT?/state, if you're travelling with your laptop. I have a second battery instead of the floppy drive, and serious work (like compiling new kernels) still drains the batteries in less than two hours (the batteries are heavy, so I'm seing an orthopedist now).

/proc/acpi/info claims that states S0, S3, S4, and S5 are supported. In fact neither suspend-to-RAM nor suspend-to-disk work. I had software suspend configured for an earlier kernel some time ago, but haven't used it since. See swsusp.sourceforge.net for details. I like to install new kernels as they appear, but the software suspend kernel patch is always one or two kernel versions behind, so I've stopped using it.

ACPI power off works well. Another nice feature are ACPI events (pressing the power button, closing the lid, or plugging and unplugging the power cord). Install acpid and define your own actions for ACPI events, such as shutting down the system when the power button is pressed (highly practical whenever your keyboard freezes which of course should never happen).




For corrections and/or suggestions, please send me an email.

TuxMobil - Linux on Laptops, PDAs and mobile Phones

Last revision: March 15, 2004.