提高 nvidia 显卡驱动性能

在用了3个月的 nvidia 8600GT 后,发觉其 2d 性能相对于以前的 ATI 7500 没有多少的提升,而且在某些应用上还不升反降。例如 Firefox ,平时使用时简直就像以前用奔腾2装winxp一样,慢得一塌糊涂,标签页间的切换要等,Ctrl+T要等,上下拖动网页也要等,-_-,起初还以为 Linux 版的 Firefox 问题,还一度用了 opera 一段时间,但是问题依然存在。
如果你和我一样正在使用 GF8600GT 显卡(或者更新的9000系列),同样碰到以下的问题(包括但不限于-_-)

  • Firefox 缓慢
  • 平时拖动窗口会有延迟的现象
  • compiz的部分特性缓慢,例如 3D Windows、Animations、窗口最大化和卷起时很卡等

那么恭喜你,你和我一样遇到了 nvidia 驱动一个非常严重的 bug 了-_- ,目前并没有有效的解决方法,只能希望 nvidia 能在下一个驱动解决。大家也可以用下面提到的方法缓解该症状

最后贴上我的 xorg.conf 文件中的 Device 段,Firefox 的缓慢现象有比较明显的改善。

Section "Device"
Identifier "Card0"
Driver "nvidia"
VendorName "nVidia Corporation"
BoardName "GeForce 8600 GT"
BusID "PCI:6:0:0"
Option "NoLogo" "True"
Option "RenderAccel" "True"
Option "DamageEvents" "True"
Option "BackingStore" "True"
Option "UseCompositeWrapper" "True"
Option "TripleBuffer" "True"
Option "PixmapCacheSize" "300000"
Option "OnDemandVBlankInterrupts" "True"
EndSection

用 iptables 实现端口映射

由于我这里是几台 Windows 连接网关通过ADSL共享上网的,网关为 Archlinux ,单网卡,有两个网络接口,eth0链接内网,地址192.168.1.2;ppp0为ADSL拨号连接,地址自动分配,内网网段为 192.168.1.0/24 。
下图为物理拓扑图

物理拓扑图

比如内网上的pc1这台机想要BT下载,由于p2p的工作原理,我们必须在网关上打开到pc1的端口映射,这里假设pc1的ip地址为192.168.1.11,bt下载端口为11197。

# iptables -t nat -A PREROUTING -p tcp -i ppp0 --dport 11197 -j DNAT --to-destination 192.168.1.11:11197
# iptables-save -c > /etc/iptables/iptables.rules(这条命令不能用sudo,可以先执行su命令。不执行这条命令的后果是重启机器后要重新执行上一条命令)

就是这么简单,你现在已经打开了pc1的端口映射,而电驴的 HighID 问题也可以参考这个方法。附上一张内网BT下载的截图。(为啥我的下载速度这么慢?大家都限速了??)

utorrent-2008-07-25.JPG

HowTo:搭建家用下载&路由服务器

其实这篇文章不能说是 HowTo ,最多只能说是我自己的安装笔记而已。该服务器主要用来下载和实现共享上网,有空还可以用它来研究iptables。整个系统没有鼠标键盘显示器,全都日常维护都是用SSH进行,所以使用了密钥的验证方式确保安全。下载方面用mldonkey实现,通过局域网内其他电脑用网页方式管理,唯一的不足是对BT下载支持不够。由于服务器基本上都是24小时运作的,所有在上面弄了个dnsmasq,实现DNS缓存和DHCP,局域网的其他机器ip都是自动获取,接上网线就能上网,十分方便。

先说说用到的软件

  • ArchLinux
  • ssh
  • iptables
  • dnsmasq
  • mldonkey

ArchLinux
选择安装包时只选择 base 组,加上 support 组中 re-pppoe,sudo,iptables等几个包,安装一个最小系统。安装完后运行

# pacman-optimize
# sync
# pacman -Syu mldonkey dnsmasq

ssh
为了安全,我这里设置了只允许用密钥验证,以下是我的 /etc/ssh/sshd_config 文件的内容

Port 22
ListenAddress 0.0.0.0
Protocol 2

KeyRegenerationInterval 1h
ServerKeyBits 768

LoginGraceTime 2m
PermitRootLogin yes

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no
PermitEmptyPasswords no

ChallengeResponseAuthentication no
UsePAM yes
Subsystem sftp /usr/lib/ssh/sftp-server

iptables
由于服务器上只有一张网卡连接到交换机,再通过交换机连接到 ADSL Modem 上,所以需要共享服务器上的ppp0链接让局域网上的其他机器上网。

# iptables -F INPUT
# iptables -F FORWARD
# iptables -F POSTROUTING -t nat
# iptables -t nat -F
# iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o ppp0 -j MASQUERADE
# iptables-save -c > /etc/iptables/iptables.rules

dnsmasq
这个主要是用来做 dns 缓存和 dhcp 服务,参考了 firefoxmmx 写的这篇教程《提高ADSL(pppoe)上网速度

# vi /etc/dnsmasq.conf

找到下面这一项

#resolv-file=

用下面的一条语句替换

resolv-file=/etc/resolv_dnsmasq.conf

将下面两句前的注释符号删除

interface=eth0
dhcp-range=192.168.1.10,192.168.1.20,255.255.255.0,24h

创建新的dns配置文件,把自己常用的DNS添加到/etc/resolv_dnsmasq.conf中

# cp /etc/resolv.conf /etc/resolv_dnsmasq.conf

编辑 /etc/ppp/pppoe.conf

# vi /etc/ppp/pppoe.conf

找到下列一行

PEERDNS=NO

并在该行下面添加

DNS1 = 127.0.0.1

mldonkey
这里要注意 mldonkey 默认只允许 127.0.0.1 访问,要首先设置允许其他网段访问。~/.mldonkey/downloads.ini 文件的第37行就是设置的地方。再配合《导入 amule/emule 的设置到 Mldonkey》和《让 MLDonkey 导入 amule/emule 的临时文件》两篇文章,驴子基本上能全速运行了,如果你遇到中文文件名变成下划线的问题,可以参考这篇文章《 解决 Mldonkey 中文文件变下划线问题 》。

最后启动服务
# /etc/rc.d/iptables start
# /etc/rc.d/sshd start
# /etc/rc.d/samba start
# /etc/rc.d/dnsmasq start
# /etc/rc.d/mldonkey start

或者编辑 /etc/rc.conf 文件,添加到 daemon 段中。

ok,收工,enjoy it。

打开 AMD cpu 的 Cool'n'Quiet

Q:什么是 AMD cpu 的 Cool'n'Quiet?
A:这个是用来根据所执行的运算工作来改变自己的频率,降低处理器的发热量并降低功耗,这在我们平时浏览网页时尤为明显。

首先需要确保你的 CPU 支持 Cool'n'Quiet 并在 BIOS 中打开了相应的选项,然后用下列的命令查看内核是否支持

# dmesg | grep powernow

如果输出结果应该类似于下面的

powernow-k8: Found 1 AMD Athlon 64 / Opteron processors (version 1.60.2)
powernow-k8: 0 : fid 0x10 (2400 MHz), vid 0x2 (1500 mV)
powernow-k8: 1 : fid 0xe (2200 MHz), vid 0x6 (1400 mV)
powernow-k8: 2 : fid 0xc (2000 MHz), vid 0xa (1300 mV)
powernow-k8: 3 : fid 0xa (1800 MHz), vid 0xe (1200 mV)
powernow-k8: 4 : fid 0x2 (1000 MHz), vid 0x12 (1100 mV)

使用 cpudyn 来进行频率调整

# pacman -S acpid cpudyn

编辑 /etc/rc.conf ,在 MODULES 一行中加入下列模块

powernow-k8 cpufreq_powersave cpufreq_userspace cpufreq_conservative cpufreq_ondemand freq_table

在 DAEMONS 一行中加入

cpudyn

现在只要重启系统即可。

推荐台式机 7.10 用户使用 realtime 内核

realtime 内核(下面简称 rt)其实就是 Ubuntu Studio 默认使用的内核,这个内核经过优化,可以加快打开程序的速度,开启 compiz 后看视频会花屏的现象得到改善。我使用后的第一感觉是,响应速度明显加快了,尤其是打开 nautilus 的速度。缺点就是不适合用于笔记本电脑,会增加用电量的,而且也不适用于服务器版本。

suxixb@su:~$ uname -srvm
Linux 2.6.22-14-rt #1 SMP PREEMPT RT Tue Feb 12 09:57:10 UTC 2008 i686

安装 rt 内核

sudo apt-get install linux-backports-modules-rt linux-headers-2.6.22-14-rt linux-headers-rt linux-image-2.6.22-14-rt linux-image-rt linux-restricted-modules-rt linux-rt

安装完成后,重启,在 GRUB 处会叫您选择启动 rt 内核还是 generic 内核,选择 rt 项。

另外,Ubuntu 源内已经有不少编译好的内核了,其实完全可以挑一个自己喜欢的使用,平时用的 generic 内核属于通用内核。

suxixb@su:~$ apt-cache search linux-image
alsa-base - ALSA driver configuration files
linux-image - Generic Linux kernel image.
linux-image-386 - Linux kernel image on 386.
linux-image-debug-386 - Linux kernel debug image for 386 kernel image
linux-image-debug-generic - Linux kernel debug image for generic kernel image
linux-image-debug-server - Linux kernel debug image for server kernel image
linux-image-generic - Generic Linux kernel image
linux-image-server - Linux kernel image on Server Equipment.
linux-image-virtual - Linux kernel image geared towards virtualised hardware
linux-image-debug-ume - Linux kernel debug image for ume kernel image
linux-image-rt - Linux kernel image on realtime kernel
linux-image-ume - Linux kernel image on 386 Embedded/Mobile
linux-image-xen - Linux kernel image on Xen
rt2400-source - source for rt2400 wireless network driver
rt2500-source - source for rt2500 wireless network driver
virtualbox-ose-modules-2.6.22-14-generic - virtualbox-ose modules for linux-image-2.6.22-14-generic
virtualbox-ose-modules-2.6.22-14-server - virtualbox-ose modules for linux-image-2.6.22-14-server
xen-image-2.6.19-4-generic - Linux 2.6.19 image on PPro/Celeron/PII/PIII/P4
xen-image-2.6.19-4-server - Linux xen 2.6.19 image on x86.
linux-image-2.6.22-14-386 - Linux kernel image for version 2.6.22 on i386
linux-image-2.6.22-14-generic - Linux kernel image for version 2.6.22 on x86/x86_64
linux-image-2.6.22-14-server - Linux kernel image for version 2.6.22 on x86/x86_64
linux-image-2.6.22-14-virtual - Linux kernel image for version 2.6.22 on x86
linux-image-debug-2.6.22-14-386 - Linux kernel debug image for version 2.6.22 on i386
linux-image-debug-2.6.22-14-generic - Linux kernel debug image for version 2.6.22 on x86/x86_64
linux-image-debug-2.6.22-14-server - Linux kernel debug image for version 2.6.22 on x86/x86_64
linux-image-debug-2.6.22-14-virtual - Linux kernel debug image for version 2.6.22 on x86
linux-image-2.6.22-14-rt - Linux kernel image for version 2.6.22 on RT kernel
linux-image-2.6.22-14-ume - Linux kernel image for version 2.6.22 on Ubuntu Moblie and Embedded
linux-image-2.6.22-14-xen - Linux kernel image for version 2.6.22 on This kernel can be used for Xen dom0 and domU

在 Ubuntu 7.10 上安装 ATI Driver 8.03 和 compiz 0.6.99 (update 2008/3/6)

(更新于 08-3-6)
下载:ATI Driver 8.03,并假设放到 “/home/我的用户名/” 下

我的硬件环境:

  • CPU:AMD DualCore Athlon 64 X2, 2000 MHz (10 x 200) 3800+
  • 主板:Biostar(映泰) TForce 570 U
  • 显卡:ATI Radeon X1600 Pro (RV530)
  • 硬盘:西数 WD1600JB-00REA0
  • 网卡:主板自带
  • 声卡:主板自带

删除旧有驱动
如果您的是新装的系统,可以忽略该步,否则输入

sudo lrm-manager
sudo apt-get autoremove --purge fglrx*

安装必须的编译环境

sudo apt-get update
sudo apt-get install module-assistant build-essential fakeroot dh-make debhelper debconf libstdc++5 linux-headers-$(uname -r)

屏蔽fglrx核心模块

sudo gedit /etc/default/linux-restricted-modules-common

将里面的

DISABLED_MODULES=""

改为

DISABLED_MODULES="fglrx"

创建deb包并安装

bash *.run --buildpkg Ubuntu/gutsy
sudo dpkg -i *.deb
sudo apt-get -f install

配置驱动

sudo aticonfig --initial -f
sudo aticonfig --ovt=Xv

编辑 xorg.conf

sudo gedit /etc/X11/xorg.conf

在文件尾端添加

Section "Module"
load "dri"
load "dbe"
load "glx"
EndSection

Section "DRI"
Mode 0666
EndSection

Section "Extensions"
Option "RENDER" "true"
Option "DAMAGE" "true"
Option "Composite" "true"
Option "XVideo" "true"
EndSection

Section "ServerFlags"
Option "AIGLX" "Enable"
EndSection

找到 Section "Device" 并添加

Option "XAANoOffscreenPixmaps" "on"
Option "TexturedVideo" "on"
Option "Textured2D" "on"
Option "TexturedXrender" "on"
Option "BackingStore" "on"

ok,可以重启系统了,确认一下自己的驱动是否安装成功

fglrxinfo
glxinfo | grep render

如果出现以下的结果说明安装成功

suxixb@su:~$ fglrxinfo
display: :0.0 screen: 0
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: Radeon X1600 Series
OpenGL version string: 2.1.7412 Release

suxixb@su:~$

suxixb@su:~$ glxinfo | grep render
direct rendering: Yes
OpenGL renderer string: Radeon X1600 Series
suxixb@su:~$

以下是我的测试成绩

suxixb@su:~$ glxgears
34023 frames in 5.0 seconds = 6804.570 FPS
36599 frames in 5.0 seconds = 7319.708 FPS
36467 frames in 5.0 seconds = 7293.291 FPS
36344 frames in 5.0 seconds = 7268.694 FPS
36448 frames in 5.0 seconds = 7289.572 FPS
36506 frames in 5.0 seconds = 7301.147 FPS

suxixb@su:~$

安装 compiz fusion
到此,我们已经安装好 ATI 驱动并能正常使用了,是时候开始安装 compiz fusion,首先添加下列的源

deb http://kwatrow.nl/repo Gutsy compiz-fusion-git
wget http://kwatrow.nl/repo/Quattro.gpg -O- | sudo apt-key add -

执行一次更新

sudo apt-get update
sudo apt-get upgrade

首先把系统自带的 compiz 删除干净,去新立得里搜索 compiz ,把已经安装了的包全部彻底删除,或者用下面的命令

sudo apt-get autoremove --purge compiz compiz-*

安装新的 compiz

sudo apt-get install compiz compiz-core compiz-fusion-plugins-extra compiz-fusion-plugins-unsupported

等待安装完成以后,到 “系统” ─ “首选项” ─ “外观” ─ “视觉效果” ,选择一个您喜欢的特效,怎样,效果还可以吧。当然,我们还需要更多的设置选项,继续下面的安装。

sudo apt-get install compizconfig-settings-manager emerald emerald-themes

让 compiz 使用 emerald 的主题

sudo gedit /usr/bin/compiz

找到下面的内容

# Defines the decorator and arguments.
# Set it to empty to make the script use the best decorator for your environment
DECORATOR=""
DECORATORARGS=""

改为下面的内容

# Defines the decorator and arguments.
# Set it to empty to make the script use the best decorator for your environment
DECORATOR="emerald"
DECORATORARGS="--replace"

ok,登出并重新登录 X ,世界变得更美妙了。

screenshot-desktop01-2008-03-04.png

screenshot-desktop02-2008-03-04.png

参考资料

  1. AIGLX
  2. 提升ati8.2驱动在compiz下的性能 by zhuqin_83
  3. ati官方驱动(非开源)的安装配置 by zhuqin_83
  4. gutsy下安装最新的 compiz 0.6.99(源) by zhuqin_83
  1. 订阅

    • 订阅 我的 Blog
    • Feedsky 订阅数
    订阅到iGoogle或Google Reader 订阅到鲜果 订阅到抓虾 订阅到飞鸽 订阅到Bloglines 订阅到我的雅虎 订阅到NetVibes 订阅到Newsgatar 订阅到Rojo 订阅到网易有道 通过哪吒订阅到MSN,Gtalk,Skype 订阅到QQ邮箱
     

  2. 重要公告

    目前该博客(www.shareitem.org,以下简称该博客)是建立在Yo2优博网上的,由于一些众所周知的原因,本人(suxixb)决定于2008年8月1日起陆续将该博客上的所有文章转移到新网站上,地址为http://shareitem.org,并改名为ShareItem.org(简称siog),原来的订阅地址(feed.shareitem.org)将保持不变,可继续使用。在转移成功后,该博客仍然保留到到期为止(2008年11月18日),在到期后,将不能再通过www.shareitem.org来访问该博客,本人也不在该博客上进行更新和发布文章,所有的新文章将统一在新网站上发表。谢谢各位的支持。

  3. 最新评论

  4. 最新日志

  5. 阅读共享

  6. 标签

  7. 存档

  8. Logo