歡迎您光臨本站 註冊首頁

在Linux下打開DRI(從敏老闆的鹹菜缸轉載)

←手機掃碼閱讀     火星人 @ 2014-03-23 , reply:0

作者:敏老闆的鹹菜缸

這個帖子是我今天安裝Compiz(一個類似Bery的3D桌面環境,但以後可能會被Bery取代)所經歷的過程。這其中描述的內容目前只針對我自己的工作環境:X24 + Fedora6 + gnome

Compiz是被包括在Fedora6中的,但原始的安裝盤自帶的Compiz版本太低,需要更新一下,我習慣先刪再安裝,以root身份運行:
yum remove compiz

yum install -y compiz

記得這個階段要聯網的。

在Gnome中開啟Compiz是這樣操作的:
系統->首選項->桌面效果
點擊「開啟桌面效果」,但報錯,說無法運行。

由於Compiz是基於XGL的,我在命令行下運行:

glxgears

正常,齒輪能動,但速度非常慢。
由於linux上的OpenGL是:Mesa,而它很依賴於底層的DirectRenderInterface(DRI)和顯卡驅動。

運行命令:
lsmod

能看到
DRM:Radeon

說明顯卡驅動正常,那麼就是DRI有問題了。
查看
/var/log/Xorg.0.log

發現如下信息:

。。。。
(==) RADEON(0): Using 24 bit depth buffer
(EE) RADEON(0): Static buffer allocation failed. Disabling DRI.
(EE) RADEON(0): At least 9216 kB of video memory needed at this resolution and depth.

。。。。
(WW) RADEON(0): Direct rendering disabled
。。。。

第3行明顯說明是由於X24顯卡的自帶內存(8M)不夠導致的,而對顯存的需求是由桌面設置的解析度和色彩數決定的,我目前的是:
1024x768 24bit色
我把24bit色換成16bit,重啟XWindow,問題解決。
(這裡要提示一下,記得以root身份手工在/etc/X11/xorg.conf文件尾部添加:
Section "DRI"
Group "video"
Mode 0660
EndSection

以確保所有用戶都能使用DRI.

由於DRI正常了,這是測試
glxgears
快了許多,再開啟
系統->首選項->桌面效果
一切正常了,可以以3D的方式轉動桌面,拖拽窗口的效果也生動多了。

真是太高興了,剛才終於知道問題出在哪裡了。
自己作了以下的嘗試:
1.[root@localhost /]# ln -s /usr/lib/dri/r300_dri.so /usr/lib/xorg/modules/dri/r300_dri.so

按照上面的說法有可能是我的dri沒配置好,但我用上述命令連接的時候,提示文件已經存在,所以應該不是這問題。還有就是我查看了一下/var/log下面的相關文件,看了一下出錯信息,dri部分是成功載入了的,不存在說路徑不對而載入不了。

2.[root@localhost luyaotang]# LIBGL_DEBUG=verbose glxinfo
name of display: :0.0
libGL: XF86DRIGetClientDriverName: 5.2.0 r300 (screen 0)
libGL: OpenDriver: trying /usr/lib/dri/r300_dri.so
libGL error: dlopen /usr/lib/dri/r300_dri.so failed (/usr/lib/dri/r300_dri.so: undefined symbol: _glapi_get_dispatch)
libGL error: unable to find driver: r300_dri.so
libGL: XF86DRIGetClientDriverName: 5.2.0 r300 (screen 0)
libGL: OpenDriver: trying /usr/lib/dri/r300_dri.so
libGL error: dlopen /usr/lib/dri/r300_dri.so failed (/usr/lib/dri/r300_dri.so: undefined symbol: _glapi_get_dispatch)
libGL error: unable to find driver: r300_dri.so
display: :0 screen: 0
direct rendering: No
server glx vendor string: SGI
server glx version string: 1.2.

那些庫文件的載入還是有問題,但不是路徑不存在問題,百度了一下,沒發現,反而是GOOGLE有發現,其實用Linux的話,Google是很必要的。說fglrx的配置,或者說驅動本身跟我們的radeon有衝突,要卸載。

3.[root@localhost luyaotang]# yum remove kmod-fglrx xorg-x11-drv-fglrx
做了這步之後,發現問題依舊。

4.抱著試試看的態度,在/etc/profile.d/裡面把跟fglrx有關的配置移出。
[root@localhost luyaotang]# mv /etc/profile.d/ati-fglrx.sh /btdown/

5.再試了一下,居然好了。
[luyaotang@localhost ~]$ glxinfo |grep direct
libGL warning: 3D driver claims to not support visual 0x4b
direct rendering: Yes
3D的加速已經成功的開啟了。

6.測試一下加速分數,不測試不知道,一測笑一笑,居然有3K多,以前沒配置好才1K多:
[luyaotang@localhost ~]$ glxgears
libGL warning: 3D driver claims to not support visual 0x4b
15743 frames in 5.0 seconds = 3148.550 FPS
16727 frames in 5.0 seconds = 3345.365 FPS
16730 frames in 5.0 seconds = 3345.780 FPS
16725 frames in 5.0 seconds = 3344.950 FPS
16719 frames in 5.0 seconds = 3343.772 FPS
16729 frames in 5.0 seconds = 3345.648 FPS
16730 frames in 5.0 seconds = 3345.866 FPS
16711 frames in 5.0 seconds = 3342.129 FPS
16729 frames in 5.0 seconds = 3345.748 FPS
/==============================/

/etc/X11/xorg.conf配置文件
Xorg configuration created by system-config-display

Section "ServerLayout"
Identifier "single head configuration"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
EndSection

Section "Module"
Load "dri"
Load "glx"
Load "drm"
Load "type1"
Load "extmod"
EndSection

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
EndSection

Section "Monitor"
Identifier "Monitor0"
HorizSync 30.0 - 80.1
VertRefresh 80.5 - 90.5
Option "VendorName" "ATI Proprietary Driver"
Option "ModelName" "Generic Autodetecting Monitor"
Option "DPMS" "true"
EndSection

Section "Device"
Identifier "Videocard0"
Driver "radeon"
Option "AGPMode" "8"
Option "EnablePageFlip" "on"
Option "XAANoOffscreenPixmaps" "true"
Option "XaaNoScanlineImageWriteRect"
Option "XaaNoScanlineCPUToScreenColorExpandFill"
BusID "PCI:1:0:0"
Screen 0
Option "DesktopSetup" "single"
Option "VideoOverlay" "on"
Option "OpenGLOverlay" "off"
Option "AddARGBGLXVisuals" "True"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Videocard0"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1024x768" "1024x768" "800x600" "800x600" "640x480" "640x480"
EndSubSection
Monitor "Monitor0"
EndSection

Section "Extensions"
Option "Composite" "Enable"
EndSection

Section "DRI"
Mode 0666
EndSection


安裝無誤后修改xorg.conf:
Section "Module"
# Load "GLcore"
Load "bitmap"
Load "ddc"
Load "dbe"
Load "dri"
Load "extmod"
Load "freetype"
Load "glx"
Load "int10"
Load "type1"
Load "vbe"
EndSection
----------------------------
Section "Device"
Identifier "Intel Corporation Intel Default Card"
Driver "i810"
Option "XAANoOffscreenPixmaps"
BusID "PCI:0:2:0"
EndSection
-------------------------
Section "ServerLayout"
Option "AIGLX" "true"
Identifier "Default Layout"
Screen "Default Screen"
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
InputDevice "Synaptics Touchpad"
EndSection

再修改/etc/gdm/gdm.conf-custom:
[servers]
0=aiglx

[server-aiglx]
name=aiglx server
command=/usr/bin/Xorg-air :0
flexible=true

退出,重新啟動gdm
sudo /etc/init.d/gdm restart

OK!不出意外的話你能看見和XGL一樣炫的3D桌面了!

[火星人 ] 在Linux下打開DRI(從敏老闆的鹹菜缸轉載)已經有722次圍觀

http://coctec.com/docs/linux/show-post-116405.html