wtorek, czerwca 09, 2009

Catalyst on Archlinux

Recently I bought myself a laptop - Acer Aspire 5670 - with a ATI Radeon Mobility x1400 graphic card. Although the open-source drivers radeon and radeonhd worked I was still unsatisfied with their performance. So I had to go the long, stony road of installing ATI's proprietary Catalyst driver. Why long and stony? Because ATI dropped support for my graphic card (I think since Catalyst 9.4). As a long-time NVIDIA user on a Linux box I was used to that regardless if it was an old GeForce 3 or an GeForce 9600 GSO that I'm currently using on my pc the drivers worked perfectly. All that TV-out, cloning, TwinView etc. worked on the fly. On this laptop however, everything xorg & drivers related that you could possibly imagine to go wrong, went wrong since the beginning. But finally I managed to make everything to work as I wanted. Here's how I did it. I encountered two major problems so I had to ask myself:
  1. How do I fix the wrong DPI settings?
  2. How do I install a working for my card catalyst driver?
What do I mean by "wrong DPI"? It's better I explain It by showing a screenshot of my desktop. Those really big fonts are actually icon labels. And yes, that thing that takes more then the half of the panel is the clock. Well, actually it's only 1/8 of the clock... I experienced this with both the proprietary and the open-source drivers. To fix this I followed the ArchWiki entry on Xorg. First I modified /etc/X11/xinit/xserverrc so it now looks so: exec /usr/bin/X -nolisten tcp -dpi 96 This didn't help. After adding this two entries to xorg.conf
Section "Device"
 Identifier "Card1"
        ...
        Option   "NoDDC" "true"
        ...
EndSection

Section "Monitor"
        Identifier "Monitor0"
        ...
        DisplaySize 336 210 # 96 DPI @ 1280x800
        ...
EndSection
and restarting X my desktop finally looked normal again. Now for the difficult part - installation of catalyst. There are two packages in the AUR I've downloaded - catalyst-old and catalyst-utils-old. The problem is they depend on xorg-server-1.5, but currently there is a newer version, xorg-server-1.6, in the repositories. I tried to figure out how to downgrade when I stumbled on the Project ARM site. ARM stands for Arch Rollback Machine. It's a mirror that syncs every day with other mirrors but keeps the old packages so a rollback can be made very easy. Package snapshots are ordered by date. I wanted to revert my xorg packages to the state of this years April's Fools Day and because xorg packages are in the extra repo all I had to do was make some temporary changes in /etc/pacman.conf.
#[extra]
# Add your preferred servers here, they will be used first
#Include = /etc/pacman.d/mirrorlist

[extra::2009-4-1]
Server = http://arm.kh.nu/$repo/os/i686/
After that I had to remove the xorg-server package # pacman -Rd xorg-server and synchronize with the new mirror # pacman -Sy xorg-server xf86-input-keyboard xf86-input-mouse xf86-video-v4l After that I restored the original pacman.conf file and added xorg-server to the list of ignored packages
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
IgnorePkg   = xorg-server libgl                                                   
IgnoreGroup = xorg
Then I builded the two packages from AUR and was almost ready to go. Just a quick new Device section entry in /etc/X11/xorg.conf
Section "Device"
        Identifier  "Card0"
        Driver      "radeonhd"
        VendorName  "All"
        BoardName   "All"
EndSection

Section "Device"
        Identifier  "Card1"
        Driver      "fglrx"
        VendorName  "ATI Technologies Inc"
        BoardName   "Radeon Mobility X1400"
        BusID       "PCI:1:0:0"
        Option      "NoDDC" "true"
        Option      "Centermode" "off"
        Option      "VideoOverlay" "on"
        Option      "OpenGLOverlay" "off"
        Option      "OverlayOnCRTC2" "0"
        Option      "PseudoColorVisuals" "off"
        Option      "UseFastTLS" "off"
EndSection

Section "Screen"
        Identifier "Screen0"
        Device     "Card1"
        ...
EndSection
With all that trouble with the drivers I decided to have two Device sections - one for the proprietary and one for the open-source driver - just in case something goes wrong again. Ok, here is a summary of the performance of those 3 drivers: radeon (xf86-video-ati)
[lightnir@chochlik2 ~]$ glxgears
Xlib:  extension "Generic Event Extension" missing on display ":0.0".
Xlib:  extension "Generic Event Extension" missing on display ":0.0".
3990 frames in 5.0 seconds = 797.868 FPS
4216 frames in 5.0 seconds = 843.131 FPS
4220 frames in 5.0 seconds = 843.895 FPS
4437 frames in 5.0 seconds = 887.220 FPS
4117 frames in 5.0 seconds = 823.276 FPS
4162 frames in 5.0 seconds = 832.351 FPS
radeonhd (xf86-video-radeonhd)
[lightnir@chochlik2 ~]$ glxgears
Xlib:  extension "Generic Event Extension" missing on display ":0.0".
493 frames in 5.0 seconds = 98.524 FPS
567 frames in 5.0 seconds = 113.289 FPS
564 frames in 5.0 seconds = 112.653 FPS
561 frames in 5.0 seconds = 112.165 FPS
567 frames in 5.0 seconds = 113.364 FPS
566 frames in 5.0 seconds = 113.013 FPS
583 frames in 5.0 seconds = 116.580 FPS
564 frames in 5.0 seconds = 112.645 FPS
fglrx (catalyst-old)
[lightnir@chochlik2 ~]$ glxgears
Xlib:  extension "Generic Event Extension" missing on display ":0.0".
Xlib:  extension "Generic Event Extension" missing on display ":0.0".
Xlib:  extension "Generic Event Extension" missing on display ":0.0".
Xlib:  extension "Generic Event Extension" missing on display ":0.0".
Xlib:  extension "Generic Event Extension" missing on display ":0.0".
Xlib:  extension "Generic Event Extension" missing on display ":0.0".
Xlib:  extension "Generic Event Extension" missing on display ":0.0".
Running synchronized to the vertical refresh.  The frame rate should be
approximately 1/1103892 the monitor refresh rate.
5782 frames in 5.0 seconds = 1155.215 FPS
5648 frames in 5.0 seconds = 1129.482 FPS
5983 frames in 5.0 seconds = 1196.399 FPS
6010 frames in 5.0 seconds = 1201.413 FPS
6024 frames in 5.0 seconds = 1204.585 FPS
5910 frames in 5.0 seconds = 1181.958 FPS
I also tested the catalyst driver performance with Neverwinter Nights Diamond Edition running in wine. The frame rate was about 25 FPS with full-screen and all graphic options set to max.

piątek, czerwca 05, 2009

one... two... three

Trójka to w wielu kulturach liczba magiczna. Jest liczbą pierwszą, liczbą Fibonacciego, liczbą Fermata oraz liczbą Mersenne'a. Przez wielu starożytnych filozofów poczytywana była za doskonałą. Pitagorejczycy wierzyli w istnienie trzech światów - Niższego, Wyższego, Najwyższego, a uczniowie Sokratesa i Platona wyznawali trzy wielkie zasady: Materię, Ideę, Boga. W wielu religiach bóstwa były związane z tą liczbą: Trójca Święta, Trimurti, 3 Mojry/Parki, Hekate itd. Żyjemy w przestrzeni trójwymiarowej. Atomy są zbudowane z trzech cząstek elementarnych. Możemy tak sobie wyliczać bez końca przykłady na obecność trójki w wszechświecie. Ja jednak skończę na przykładzie powiedzenia "do trzech razy sztuka". Czemu? Ano temu, że tyle razy w ubiegłym tygodniu instalowałem Linuksa na tym laptopie. Zrządzenie losu? Złośliwość rzeczy martwych? Błąd ludzki? Ja bym powiedział, że kombinacja wszystkich tych czynników. Przede wszystkim problemy zaczęły się od tego, że chciałem mieć Windowsa i Linuksa. Instalację Windows XP argumentowałem tak:
  1. tworząc strony internetowe muszę też sprawdzić jak wyglądają na takich gównianych przeglądarkach jak Internet Explorer 6
  2. mam słabość do Diablo 2 oraz Neverwinter Nights
Gdy kupiłem maszynę była na niej tylko jedna partycja zajmująca cały dysk. Jak dla mnie to chory pomysł chociażby ze względów utraty danych w przypadku zajechania win-grozy i konieczności formatowania partycji. Chciałem sobie ułatwić pracę z instalacją pingwina, więc poszedłem po najmniejszej linii oporu - chciałem skurczyć partycję NTFS używając stosownych narzędzi. Niestety jak się okazało dysk miał parę badsectorów i system się już nie podniósł po nieudanej próbie zmiany rozmiaru partycji. Olałem Windowsa i zainstalowałem Archa tworząc podczas instalacji miejsce na dwie partycje na potrzeby Windowsa (systemowa i dane). Zawsze przecież można zainstalować Windowsa później, prawda? A właśnie, że nie! Instalator Windows zawieszał się zaraz na starcie (czarny ekran). Zajęło mi to sporo czasu zanim doszedłem do tego czemu się tak dzieje (włączając w to wymontowanie dysku). Instalatorowi nie podobały się po prostu partycje stworzone przez cfdisk. Skończyło się na tym, że musiałem nadpisać MBR # dd if=/dev/zero of=/dev/sda bs=512 count=1 niszcząc sobie pieczołowicie skonfigurowanego pingwina tylko po to by przekonać się, że ten durny system po instalacji nie ma nawet sterowników do karty sieciowej. Wszystkie sterowniki musiałem pobrać na pingwinku. To właśnie w nim lubię - może nie być trybu graficznego, dźwięk może nie działać, pendrive'y mogą nie być montowane automatycznie, ale na działającym terminalu i sterownikach do kart ethernetowych można zawsze polegać. Co prawda jest to dość wyboista droga, ale jest ona do przejścia. W każdym razie teraz mam już oba działające systemy. Tak podsumowując. Dowiedziałem się na własnej skórze, dlaczego w przypadku dual-bootu należy instalować systemy poczynając od Windowsa, a kończąc na Linuksie. Szkoda po prostu nerwów i czasu.