在搭载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

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