Sunday, August 5, 2007

Enabling DRI for Intel 945G/GMA950

Update for Slackware 12.1
In Slackware 12.1, don't have to do all the changes in xorg.conf, except setting the driver to the right one (mine is "intel").

However, I observed some slowness in firefox in 12.1. After setting the following option for the intel driver, the problem goes away. Seems it is caused by the new acceleration method EXA, which is the default.

Option "AccelMethod" "XAA"

xorg的i810(或者新的intel)驱动支持945G/GMA950. 实际上,i810驱动支持所有这些intel chipset:
i810, i810-DC100, i810e, i815, 830M, 845G, 852GM, 855GM, 865G, 915G, 915GM, 945G, 945GM
虽然man page里只提到915G和915GM。可以man i810看具体情况.

关键就是打开DRI. 我参照了以下文章。
http://dri.freedesktop.org/wiki/DriTroubleshooting

这篇文章很有帮助,告诉你如何一步一步确定DRI的问题的原因。建议有需要的看一看。

1. 我确定了我的内核(Slackware 12.0缺省huge smp内核)有Intel i810及以后芯片组的AGPGART和DRM的支持。

2. 我发现要在X里打开DRI.

编辑 xorg.conf
...
Section "Module"
...
# This loads the DRI module 载入DRI模块
Load "dri"

# This loads the GLX module 载入GLX模块
Load "glx"
...
EndSection
...
# 建一个用i810驱动的设备
Section "Device"
Identifier "i810"
Driver "i810"
# Alternative to Load "dri" 这个Option与Load "dri"等效
# Option "DRI" "true"
EndSection
...
# 使用i810设备
Section "Screen"
Identifier "Screen 1"
Device "i810"
Monitor "Samsung 710N"
...

# 让普通用户也可以使用DRI. 如果没有这个,只有root可以用。
Section "DRI"
Mode 0666
EndSection

之前:
x@slackx:~$ glxinfo
name of display: :0.0
display: :0 screen: 0
direct rendering: No
server glx vendor string: SGI

x@slackx:~$ glxgears
4246 frames in 5.1 seconds = 840.647 FPS
4200 frames in 5.0 seconds = 835.972 FPS
4605 frames in 5.1 seconds = 901.136 FPS
4920 frames in 5.1 seconds = 961.904 FPS
5160 frames in 5.0 seconds = 1027.514 FPS
5160 frames in 5.0 seconds = 1027.391 FPS
5160 frames in 5.0 seconds = 1028.289 FPS
5160 frames in 5.0 seconds = 1028.484 FPS
5160 frames in 5.0 seconds = 1027.678 FPS
5173 frames in 5.0 seconds = 1027.146 FPS
...

重起X之后:
x@slackx:~$ glxinfo
name of display: :0.0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: SGI

x@slackx:~$ glxgears
7591 frames in 5.0 seconds = 1518.076 FPS
7774 frames in 5.0 seconds = 1554.788 FPS
17984 frames in 5.0 seconds = 3596.714 FPS
17536 frames in 5.0 seconds = 3507.012 FPS
17372 frames in 5.0 seconds = 3474.314 FPS
18021 frames in 5.0 seconds = 3604.041 FPS