Wednesday, June 20, 2007

Fedora 7, Compiz, Nvidia

I play games on linux (q3, q4, doom3 etc.) with the nvidia drivers fine tuned with 'nvidia-settings' for anti-aliasing, v-sync, texture sharpening, digital vibrancy etc.. As I installed Fedora 7 some days back, I started using the wonderful desktop effects (compiz) as well.

Problem is that all this doesn't coincide with each other. Quake3 (or any other 3d-application) cannot run together with compiz desktop. Moreover Nvidia high quality settings may slow down compiz.

For this what I need is that compiz should stop when I run a 3d application. I also need nvidia high quality settings loaded only/exclusively for the application and not for the desktop.

Settings this up is very simple. Write a script "stopcompizfor.sh" which stops compiz, runs the application, and when it finishes, starts compiz again. (Note below is only for gnome)

#!/bin/sh
app=$@
if test -z "$app"
then
  echo "usage: stopcompizfor <3d-application>"
  exit
else
  compizpid=`ps -C compiz -o pid=`
  if test -z "$compizpid"
  then
    echo "Compiz not running anyway, continuing normally."
    $app
  else
    echo "Disabling Desktop Effects for [ $app ]"
    killall -9 compiz
    killall -9 gtk-window-decorator
    metacity --replace &
    $app
    echo "Starting Desktop Effects"
    killall -9 metacity
    gtk-window-decorator --replace &
    compiz --replace gconf &
  fi
fi


Kaur posted some changes to the dark blue part for KDE and Beryl, thanks :)

killall -9 beryl
killall -9 emerald
kwin --replace &
$app
echo "Starting Desktop Effects"
killall -9 kwin
beryl --replace &
emerald --replace &


Start 'nvidia-settings' and fine tune the settings upto your choice, this will create a file ~/.nvidia-settings-rc, save it in some other location. Run 'nvidia-settings' again and restore normal settings. Now, write a script "nvhqfor.sh" (nvidia high quality for) which loads the high quality settings, runs the application, and when it finishes, loads the default settings again.

#!/bin/sh
app=$@
if test -z "$app"
then
  echo "usage: nvhqfor <3d-application>"
  exit
else
  echo "Loading NVIDIA High Quality Settings"
  nvidia-settings --load-config-only
    --config=/home/user/.nv-high-quality-settings

  $app
  echo "Restoring NVIDIA Default settings"
  nvidia-settings --load-config-only
    ##--config=/home/user/.nv-low-quality-settings

fi


Now its all set, to run quake3 with compiz automatically stopped all I have to do is,

stopcompizfor quake3

and it runs like charm, if I wish to run quake3 with high quality settings, then I run,

stopcompizfor nvhqfor quake3
or
nvhqfor stopcompizfor quake3


not only this, I am a graphics programmer, and compiz effects (live thumbnail and expose) are helpful while programming. So my scripts are helpful there as well,
stopcompizfor ./renderer configs/puget-sound.cfg

w00t!

Monday, June 11, 2007

Fedora 7 reviewed, it's l33t

I have been using Fedora Core 4 and recently I installed Fedora 7, and I must say that Linux has come a really long way. I am not writing this as a Linux fanboy/g33k; I use what is useful, convenient, and what does the work... F7 seems perfect! I wrote this post because F7 is very new, help does exist on the web, but "you won't feel lucky" while searching on Google.

First of all the best part is the install size, you can safely turn down the packages you don't want to install. I installed a total of only 2.8GB while including all important packages like X11, vi, gnome, open office, Gimp, tetex, gstreamer, various servers, most programming stuff blah blah etc (I didn't include KDE, stupid Linux games, firewalls, printer stuff etc).

Access good quality of screenshot from local network here

In terms of features, what I liked most is that F7 includes ntfs-3g (enables read/WRITE support on NTFS drives), Firefox-2.0, pidgin, compiz, BitTorrent Client (though not useful for us), Remote Desktop (fancy name for VNC), rhythmbox (was available earlier as well); i.e. you don't have to painstakingly install them from third party sources.

But some softwares you DO have to install from third party locations they being commercial softwares or non-GPL followers. These softwares are:
1. nvidia/ati drivers
2. third party yum repositories
3. xmms and its mp3 support / mp3 support for rhythmbox.
4. mplayer / vlc
5. flash plugin for Firefox & other extensions
6. realplayer (if you need it) (may be necessary for South Park fans)

Before I get to detail, first start you network and setup proxy. Put your ip-address through setup or system-config-network. This will enable pinging your local network and Firefox to work. Put DNS so that pidgin can work. Put these line in /root/.bashrc,
export http_proxy=192.168.36.204:8080
export ftp_proxy=192.168.36.204:8080
This will enable wget and yum to harness the internet.

1. Get the nvidia drivers from nvidia.com and install it in init 3 mode. However this wont help, it will give errors. To fix this you must see Kulbir Saini posts here. Thanks Kulbir.

2. You should install yum repositories other than default fedora ones otherwise you wont get third party stuff. You should at least install livna repository. Setup your yum properly. Its explained really well here in short. Once IIIT-H's repository starts featuring F7, it will be even better.

3. mp3 problem: I have been using xmms, but since in windows I use Media Player 11 media library, I chose Rhythmbox as it features a decent media library management. I Read from here & here and just did,
yum -y install libmad libid3tag
    gstreamer-plugins-ugly gstreamer-plugins-bad
    gstreamer-plugins-mp3

I left it for the whole night, it installed well without the Linux's bad habit of crying in everything.

4. yum -y install mplayer
It installed without problems, but mplayer didn't run as it failed to load some libraries. This may depend on the package you discarded while installing F7, for me I was getting "shared library 404" error for aalib, xvidcore, fibidi etc. Just yum install these small libraries and mplayer is good to go.

5. flash for Firefox, get it from adobe's website. Extensions which you may need are Mouse gestures, Video Downloader, Delicious Bookmarks and DownThemAll (quite similar to flashget)

6. Just get the real player 10 gold rpm from real's website.

SMB, ftp, http etc. work as usual, no issues, they always worked good in Linux. It seemed as if SMB is faster than netbios (windows file sharing). Seems opposite, because netbios possibly uses DMA (thus should be faster), and SMB (i think) is an emulation. Please correct me if I am wrong.

Now one thing remains for graphics card people. That is compiz.
1. You can access it from "Desktop Effects" feature from the menu. IF you enable it your window decorations may disappear. This page explains really well what to do to solve this.

2. Desktop effects are through compiz and not beryl. You have to install beryl if you really want to, but I think compiz is good enough.

3. one thing about compiz is that you should not run 3D applications with a compiz desktop, it will run slow and jerky. This is something similar which happens in Windows Vista, though Vista takes care of it by putting the desktop in non-3d mode leaving the 3d hardware for the application. In F7 you should manually turn off "desktop effects" to run the 3d apps properly.

4. Emerald theme manager, which is theme manager of compiz, is not installed by default. This means you will be able to install only Metacity themes (normal gnome themes). To get the emerald thingy working you must install beryl. The theme on my screen shot is Metacity theme "Vista Look".

Other than above what I liked, are these things:

1. my drives are soft linked with various ids in /dev/disk/. For eg. they were linked with my drive labels I kept in windows. if I used label "LocalDisk1" for C:, then I can mount it directly through /dev/disk/by-label/LocalDisk1. Quite intuitive.

2. Rhythmbox is accepting all special keys of my multimedia keyboard. Without focusing rhythmbox I can go to next/previous song, mute, play/pause/stop music. I use these keys in windows to the fullest, now will in Linux as well.

3. Sound driver is amazing! You don't have to worry about your xmms/rhythmbox locking the driver for other softwares. All softwares sound are running simultaneously. Sound driver used is ALSA which worked like charm on first shot.

4. I was just browsing through menus and got my glance on "Remote Desktop". It is originally VNC. Best part was that I did some few clicks on the simple GUI and my VNC server was setup for my SAME LOCAL DESKTOP. It is totally similar to "Remote Desktop" feature of windows. You must be thinking VNC was always there, but earlier it had to be something other than system:0 desktop and it had to be setup manually which I don't like to do usually.


Earlier is used to be like this:
Mike: Hey man, do you know fedora released its new version!
John: Hmm, what? I heard they released yesterday fedora4 or was it 5?
Mike: No man this one is 6.
John: yeah whatever, I bet during your installation, another version will come out.

But Fedora 7 is some real good work, and is not yet another fedora release. Bravo! wonderful, fedora people, my applause!