在搭載nk5.0 的2K工控板上添加Lcd輸出支持

經過驗證DVO0和DVO1都是能正常輸出的(在2K開發機上驗證),只是目前接的LCD 屏只支持1280x800 的分辨率。而當前系統中可選的分辨率只有1024x768和800x600兩種。所以首先想到的就是修改 xorg.conf 來添加分辨支持。通過在xorg.conf 中設置modeline 和 modes 這兩個參數來實現。
xorg.conf 默認在 /etc/X11 目錄下。但在/etc/X11 目錄下沒發現xorg.conf,只好自已動手豐衣足食了。Xorg 支持根據當前環境生成xorg.conf 文件。

生成xorg.conf 文件
# Xorg :1 -configure
默認在/root 下會生成一個xorg.conf.new 的文件。

要添加分辨率就得填上行場等相關參數,不過不用怕,有工具可以自動生成(真爽)。

生成分辨率的相應參數
# gtf 1280 800 60

將相應的參數填到剛剛生成的xorg.conf 文件中。
接下來測試一下參數有沒有問題,Ctrl+Alt+F2, 進入終端。

設置環境變量
export DISPLAY=:1

使用指定的xorg.conf 文件
xorg :1 -config xorg.conf

使用xrandr 來獲取當前的分辨率

Xorg 運行正常, 將xorg.conf 複製到/etc/X11目錄。
重啓電腦,結果發現沒變化(這個臉打的啪啪啪響呀)。

查看/var/log/Xorg.0.log,發現用的是/etc/X11/gpu.d/2h.conf 這個文件。套路呀,完全不按xorg 的規範來。這時只能用grep 大法了(grep 大法好)。
先在 /etc 下執行 grep “2h.conf” . -rin 結果一無所獲。一般情況下Linux 啓動X的流程都是調用startx 這個命令來的,所以到/usr/bin 下執行一下 grep “2h.conf” . -rin 哈哈,他來了,他來了 …。
原來是在Xorg 中指定了使用 /etc/X11/gpu.d/2h.conf。(濃眉大眼的中標真是不按套路出牌呀)。
接下來就是修改/etc/X11/gpu.d/2h.conf 文件了,加入modeline 和 modes 相關配置。重啓over

江湖路遠,大兄弟後會無期呀。

修改後的2h.conf:

#
# Sample /etc/X11/xorg.conf file
#

Section "ServerLayout"
        Identifier      "Default Layout"
        Screen          "Default Screen"
EndSection

Section "Module"
        Load            "dbe"
        Load            "extmod"
        Load            "freetype"
        Load            "glx"
        Load            "fbdevhw"
#        Load            "dri"
EndSection

Section "InputDevice"
        Identifier      "Generic Keyboard"
        Driver          "kbd"
        Option          "XkbLayout" "us"
        Option          "XkbModel" "pc105"
        Option          "XkbRules" "xorg"
EndSection

Section "InputDevice"
        Identifier      "Configured Mouse"
        Driver          "mouse"
        Option          "CorePointer"
EndSection

Section "Device"
        Identifier      "i.MX Accelerated Framebuffer Device"
#        Driver          "fbdev"
 	Driver          "vivante"
        Option          "fbdev"         "/dev/fb0"
        Option          "vivante_fbdev" "/dev/fb0"
        Option          "HWcursor"      "false"
	Option		"VivCacheMem"	"false"
EndSection

Section "Monitor"
        Identifier      "Configured Monitor"
	Modeline "1920x1080_60.00"  172.80  1920 2040 2248 2576  1080 1081 1084 1118  -HSync +Vsync
	Modeline "1280x800_60.00"  83.46  1280 1344 1480 1680  800 801 804 828  -HSync +Vsync
	Modeline "1280x1024_60.00"  108.88  1280 1360 1496 1712  1024 1025 1028 1060  -HSync +Vsync
EndSection



Section "Screen"
        Identifier      "Default Screen"
        Monitor         "Configured Monitor"
        Device          "i.MX Accelerated Framebuffer Device"
	SubSection "Display"
#		Viewport   0 0
		Depth    24
		Modes   "1280x800_60.00"  "1920x1080_60.00"  "1280x1024_60.00"
	EndSubSection
EndSection

#Section "DRI"
#        Mode 0666
#EndSection

參考鏈接:
https://www.xuebuyuan.com/729306.html
https://ubuntuforums.org/showthread.php?t=1824362

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章