解決執行 Servo 只有白畫面問題

build 好 servo 之後執行 ./mach run -d tests/html/about-mozilla.html 視窗只出現白白的畫面。這怎麼看都不正常啊……ˊ(´;ω;`)

環境

  • LMDE 2 Cinnamon 64 bits
  • NVIDIA GeForce GTS 250
  • kernel 3.16.0-4-amd64

各種測試

build release 版後 ./mach run -r tests/html/about-mozilla.html 跟從 https://download.servo.org/ 抓 pre-built 版都白白的。

用 gdb 跑跑看

1
2
3
./mcah run -d --debug
gdb> r tests/html/about-mozilla.html
...blahblah

所以有在動啊……

./mach run -d tests/html/about-mozilla.html -o output.png 輸出圖檔,圖片也是一片白。

update 系統再 try 也不行。

用 VM LMDE 跑 pre-built 出現其他 error 0:1(10): error: GLSL 1.50 is not supported. Supported versions are 1.10, 1.20, 1.30, 1.00 ES, and 3.00 ES可能跟 VM 沒 support OpenGL 有關,有點岔題所以不管。

另一台電腦 Ubuntu 跑 pre-built,正常。

猜猜樂

pre-built 不會動表示不是我 build 的有問題。猜是 render 有問題,測輸出圖檔也不行,應該八九不離十是 render 問題。google 看不出所以然,Ubuntu 是好的但應該不至於 Ubuntu 可以 LMDE 卻不能用。

畫不出來,不然更新看看 driver。

先說結果,猜中了。(′‧ω‧‵)

檢查顯卡型號 & driver

1
2
$ lspci | grep VGA
01:00.0 VGA compatible controller: NVIDIA Corporation G92 [GeForce GTS 250] (rev a2)

看顯卡型號。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ glxinfo | OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTS 250/PCIe/SSE2
OpenGL core profile version string: 3.3.0 NVIDIA 340.101
OpenGL core profile shading language version string: 3.30 NVIDIA via Cg compiler
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.3.0 NVIDIA 340.101
OpenGL shading language version string: 3.30 NVIDIA via Cg compiler
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 2.0 NVIDIA 340.101 340.101
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.00
OpenGL ES profile extensions:

看顯卡 driver,這是已經換成 NVIDIA driver 的結果。如果 OpenGL renderer string 出現 Mesa 之類的表示不是用 NVIDIA 的 driver。

更新顯卡 driver

為了更新顯卡搞了半天……總結如下。

抓 NVIDIA driver

修改 /etc/default/grubGRUB_CMDLINE_LINUX_DEFAULT="nouveau.blacklist=1 quiet splash text",之後

1
2
3
$ sudo update-grub
$ sudo update-initramfs
$ sudo reboot

nouveau.blacklist=1 是 disable nouveau,nouveau 是 open source 社群做的 NVIDIA 顯卡的 driver。

text 則是開機不進 GUI,因為得關掉 X server 才能裝 driver,乾脆直接進文字模式裝。我以為是改 run level,但是 google 到一堆都這樣搞就這樣了。有人說用 recovery mode 也可以裝 driver,不過我沒試。

從 NVIDIA 抓下 NVIDIA-Linux-x86_64-340.101.run,是個 script,要用 root 權限跑。

1
2
# export CC=gcc-4.8
# sh NVIDIA-Linux-x86_64-340.101.run

需要設 CC 是因為我 gcc 預設版本是 4.9,但是 compile driver 需要 4.8。

安裝過程是 console 的互動介面(忘記這叫什麼了啦)就不細寫了。中間有問要不要 build 成什麼 module 之類的,選 yes 會 fail,懶得研究那是什麼東西,用 no 就安裝成功了。

最後,修改 /etc/default/grub 以 GUI 開機:GRUB_CMDLINE_LINUX_DEFAULT="nouveau.blacklist=1 quiet splash" 再 update grub 跟 reboot。

開 servo 終於正常了…\T_T/

Ref