联想 T540p、Nvidia GeForce GT 730M、19.10 Eoan、4K 第二显示器问题、无法自动检测 3840x2160 模式

联想 T540p、Nvidia GeForce GT 730M、19.10 Eoan、4K 第二显示器问题、无法自动检测 3840x2160 模式

我只希望我的 4K 显示器在插入电源时能够作为 4K 显示器工作。像素有帮助,但 FPS 则没那么大帮助。

基本上,正如标题所述,我办公室的屏幕通过 HDMI 转 Mini Display Port 电缆插入。显示器确实显示在视频设置中的位置和分辨率以及其他设置。但是,如果不发送 xrandr 命令或摆弄 /etc/X11/xorg.conf 文件,3840x2160 不是分辨率选项。

显示器 edid 信息确实有一个我认为在工厂嵌入模式列表中可以接受的模式。它使用 HDMI 1.4(而不是 2.0)。

无论如何,这是我的解决方法——你能找到更好的处理方法吗?

这是我的问题,如果硬件不能自动配置所有内容,是否有更好的内置方法来做到这一点?

#!/usr/bin/env bash

apt update

apt -y upgrade

apt -y autoremove

#ubuntu-drivers devices

##  Output:
##  == /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
##  modalias : pci:v000010DEd00001290sv000017AAsd0000221Ebc03sc00i00
##  vendor   : NVIDIA Corporation
##  model    : GK208M [GeForce GT 730M]
##  driver   : nvidia-340 - distro non-free
##  driver   : nvidia-driver-390 - distro non-free recommended
##  driver   : xserver-xorg-video-nouveau - distro free builtin
##  
##  == /sys/devices/pci0000:00/0000:00:1c.1/0000:04:00.0 ==
##  modalias : pci:v00008086d000008B2sv00008086sd0000C270bc02sc80i00
##  vendor   : Intel Corporation
##  model    : Wireless 7260 (Dual Band Wireless-AC 7260)
##  manual_install: True
##  driver   : backport-iwlwifi-dkms - distro free

ubuntu-drivers autoinstall

apt install -y get-edid

get-edid

##  Output:
##  This is read-edid version 3.0.2. Prepare for some fun.
##  Attempting to use i2c interface
##  No EDID on bus 1
##  No EDID on bus 2
##  No EDID on bus 3
##  No EDID on bus 4
##  No EDID on bus 6
##  No EDID on bus 8
##  No EDID on bus 9
##  3 potential busses found: 0 5 7
##  Will scan through until the first EDID is found.
##  Pass a bus number as an option to this program to go only for that one.
##  Bus 0 doesn't really have an EDID...
##  256-byte EDID successfully retrieved from i2c bus 5
##  ������N�▒�
##ץ�YJ�$PT�������@��t0�pZ��X�Ď!f!P�Q@p6?C!�LP
##        �W55
##           �5tS�_^] &     Pm
##                            < `�`a�rQ� n(UĎ!�▒q X,%Ď!��
##  Њ �->��!▒�
##  Looks like i2c was successful. Have a good day.
##  А @1 
##       @U�!▒5

### <!> As it turns out, I wanted the info on bus 5.
### <!> Let's get the Modelines

get-edid -b5 | parse-edid

##  Output:
##  5
##  This is read-edid version 3.0.2. Prepare for some fun.
##  Attempting to use i2c interface
##  Only trying 5 as per your request.
##  256-byte EDID successfully retrieved from i2c bus 5
##  Looks like i2c was successful. Have a good day.
##  Checksum Correct
##  
##  Section "Monitor"
##          Identifier "W55"
##          ModelName "W55"
##          VendorName "SPT"
##          # Monitor Manufactured week 24 of 2018
##          # EDID version 1.3
##          # Digital Display
##          # Display Physical Size not given. Normal for projectors.
##          Gamma 1.00
##          Option "DPMS" "false"
##          Horizsync 30-80
##          VertRefresh 30-76
##          # Maximum pixel clock is 300MHz
##          #Not giving standard mode: 1920x1080, 60Hz
##          #Not giving standard mode: 1680x1050, 60Hz
##          #Not giving standard mode: 1280x800, 60Hz
##          #Not giving standard mode: 1280x1024, 60Hz
##          #Not giving standard mode: 1280x960, 60Hz
##          #Not giving standard mode: 1280x720, 60Hz
##  
##          #Extension block found. Parsing...
##  #WARNING: I may have missed a mode (CEA mode 95)
##  #WARNING: I may have missed a mode (CEA mode 94)
##  #WARNING: I may have missed a mode (CEA mode 93)
##          Modeline        "Mode 18" 74.25 1280 1390 1430 1650 720 725 730 750 +hsync +vsync 
##          Modeline        "Mode 0" 297.00 3840 4016 4104 4400 2160 2168 2178 2250 +hsync +vsync 
##          Modeline        "Mode 1" 85.50 1360 1424 1536 1792 768 771 777 795 +hsync +vsync 
##          Modeline        "Mode 2" 148.500 1920 2008 2052 2200 1080 1084 1089 1125 +hsync +vsync
##          Modeline        "Mode 3" 74.250 1920 2008 2052 2200 1080 1082 1087 1125 +hsync +vsync interlace
##          Modeline        "Mode 4" 74.250 1280 1390 1420 1650 720 725 730 750 +hsync +vsync
##          Modeline        "Mode 5" 27.027 720 736 798 858 480 489 495 525 -hsync -vsync
##          Modeline        "Mode 6" 27.027 1440 1478 1602 1716 480 484 487 525 -hsync -vsync interlace
##          Modeline        "Mode 7" 27.027 720 736 798 858 480 489 495 525 -hsync -vsync
##          Modeline        "Mode 8" 27.027 1440 1478 1602 1716 480 484 487 525 -hsync -vsync interlace
##          Modeline        "Mode 9" 25.200 640 656 752 800 480 490 492 525 -hsync -vsync
##          Modeline        "Mode 10" 148.500 1920 2448 2492 2640 1080 1084 1089 1125 +hsync +vsync
##          Modeline        "Mode 11" 74.250 1920 2448 2492 2640 1080 1082 1089 1125 +hsync +vsync interlace
##          Modeline        "Mode 12" 74.250 1280 1720 1760 1980 720 725 730 750 +hsync +vsync
##          Modeline        "Mode 13" 27.000 720 732 796 864 576 581 586 625 -hsync -vsync
##          Modeline        "Mode 14" 27.000 1440 1464 1590 1728 576 578 581 625 -hsync -vsync interlace
##          Modeline        "Mode 15" 27.000 720 732 796 864 576 581 586 625 -hsync -vsync
##          Modeline        "Mode 16" 27.000 1440 1464 1590 1728 576 578 581 625 -hsync -vsync interlace
##          Modeline        "Mode 17" 74.250 1920 2558 2602 2750 1080 1084 1089 1125 +hsync +vsync
##          Modeline        "Mode 19" 74.25 1920 2008 2052 2200 540 542 547 562 +hsync +vsync interlace
##          Modeline        "Mode 20" 27.00 720 736 798 858 480 489 495 525 -hsync -vsync 
##          Modeline        "Mode 21" 27.00 720 732 796 864 576 581 586 625 -hsync -vsync 
##          Option "PreferredMode" "Mode 18"
##  EndSection


### <!> It did not work for me, but you can try generating Modelines with cvt

#cvt 3840 2160
##  Output:
##  # 3840x2160 59.98 Hz (CVT 8.29M9) hsync: 134.18 kHz; pclk: 712.75 MHz
##  Modeline "3840x2160_60.00"  712.75  3840 4160 4576 5312  2160 2163 2168 2237 -hsync +vsync

### <!> 60Hz is the default for cvt refresh rate parameter-- my screen is 60Hz...
### <!> A more specifica cvt refresh rate is the optional third parameter


### <!> The only line I see that is 4K is "Mode 0"
### <!> Modeline        "Mode 0" 297.00 3840 4016 4104 4400 2160 2168 2178 2250 +hsync +vsync 
### <!> The quoted part of the Modeline is just a label
### <!> Changing "Mode 0" to "3480x2160" for my own nitpicky self

xrandr --newmode "3840x2160" 297.00 3840 4016 4104 4400 2160 2168 2178 2250 +hsync +vsync

### <!> cvt generated mode
#xrandr --newmode "3840x2160_60.00"  712.75  3840 4160 4576 5312  2160 2163 2168 2237 -hsync +vsync

xrandr --addmode HDMI-1-1 "3840x2160"

### <!> cvt generated mode
#xrandr --addmode HDMI-1-1 "3840x2160_60.00"


### <!> To see what's what and the available modes for each
#xrandr -q


### <!> Used arandr for help with xrandr bash command that follows
#apt install arandr && arandr
#  ...save output file as xrandr-example.sh from GUI application
#tail xrandr-example.sh
##  Output:
##  #!/bin/sh
##  xrandr --output HDMI-1-2 --off --output HDMI-1-1 --mode 1920x1080 --pos 1920x0 --rotate normal --output eDP-1-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output VGA-1-1 --off --output DP-1-2 --off --output DP-1-1 --off

### <!> I took that "template" and substituted my own mode and positions

xrandr --output HDMI-1-1 --mode 3840x2160 --pos 0x0 --rotate normal --output HDMI-1-2 --off --output eDP-1-1 --primary --mode 1920x1080 pos 960x2160 --rotate normal --output VGA-1-1 --off --output DP-1-2 --off --output DP-1-1 --off


### <!> Now I want it to happen when I plug in my monitor
### <!> If W55 is seen, then run my xrandr command

#udevadm monitor

##  Output:
##  monitor will print the received events for:
##  UDEV - the event which udev sends out after rule processing
##  KERNEL - the kernel uevent
##  
##  KERNEL[10928.549817] change   /devices/pci0000:00/0000:00:02.0/drm/card1 (drm)
##  UDEV  [10928.551102] change   /devices/pci0000:00/0000:00:02.0/drm/card1 (drm)
##  KERNEL[10939.083981] change   /devices/pci0000:00/0000:00:02.0/drm/card1 (drm)
##  UDEV  [10939.085367] change   /devices/pci0000:00/0000:00:02.0/drm/card1 (drm)


### <!> So, it is a drm UDEV change
### <!> We can use the change to trigger a script

echo "SUBSYSTEM==\"drm\", ACTION==\"change\", RUN+=\"/usr/local/bin/xrandr-for-W55-monitor.sh\"" > /etc/udev/rules.d/xrandr-for-W55-monitor.rules

### <!> Create the script and make it executable

### <!> There's a second way to get edid info

ls -1 /sys/class/drm/*/edid

##  Output:
##  /sys/class/drm/card1-DP-1/edid
##  /sys/class/drm/card1-DP-2/edid
##  /sys/class/drm/card1-eDP-1/edid
##  /sys/class/drm/card1-HDMI-A-1/edid
##  /sys/class/drm/card1-HDMI-A-2/edid
##  /sys/class/drm/card1-VGA-1/edid


### <!> To get the bash script "heredoc" to respect indent spacing below, the indents must be tabs...


cat <<-EOF > /usr/local/bin/xrandr-for-W55-monitor.sh
#!/usr/bin/env bash

if [[ $(xrandr | grep "HDMI-1-1 connected" | wc -l) -gt 0 ]]
    then
        #echo $(date) "drm event HDMI-1-1 changed" >> /tmp/checkin.txt
        if [[ $(parse-edid < /sys/class/drm/card1-HDMI-A-1/edid | grep "Identifier \"W55\"" | wc -l) -gt 0 ]]
            then
                #echo "IT'S W55!!!" >> /tmp/checkin.txt

                xrandr --newmode "3840x2160" 297.00 3840 4016 4104 4400 2160 2168 2178 2250 +hsync +vsync

                xrandr --addmode HDMI-1-1 "3840x2160"

                xrandr --output HDMI-1-1 --mode 3840x2160 --pos 0x0 --rotate normal --output HDMI-1-2 --off --output eDP-1-1 --primary --mode 1920x1080 --pos 960x2160 --rotate normal --output VGA-1-1 --off --output DP-1-2 --off --output DP-1-1 --off
            else
                xrandr --output HDMI-1-1 --mode 1920x1080 --above eDP-1-1
        fi
    else
        xrandr --output HDMI-1-1 --off
fi
EOF

chmod 550 /usr/local/bin/xrandr-for-W55-monitor.sh

### <!> That ought to do it...

答案1

作为部分数据点,我已使用 HDMI 转 HDMI 电缆将三星 40 英寸电视(通过 HDMI 2.0 支持 4k60Hz 4:4:4)连接到 MacBookPro11,3(2014 年中 15 英寸 Macbook Pro),该电脑配有 Nvidia GT 750m,分辨率为 3840 x 2160(“4k”),运行 Ubuntu。我无需摆弄命令行,只需安装正确的 nvidia 驱动程序即可。我能够使用 Ubuntu 的 Gnome 显示设置工具以及 nvidia-settings(以使用 4:4:4)。由于我目前没有使用它,我无法查阅确切的版本,尽管我相信它是带有 38x 或 4xx nvidia 驱动程序的 Ubuntu 18.04.x(我依稀记得在更高的 nvidia 版本中存在暂停问题)。 GT 750m 不支持 HDMI 2.0,仅支持 1.4,因此无法以 4:4:4 实现 4k60Hz,尽管 4:2:0(对小彩色文本的渲染效果较差)是可能的。在电视的特定 HDMI 输入上(我不得不查阅其文档),我能够以 4:4:4 获得 4k 30Hz,而在其他端口上只能获得 24Hz。

显然,自动检测最适合您。至于为什么它不能自动检测您的情况,我推测这是由于 HDMI 到 DisplayPort 的转换。可能值得用另一个避免转换的显示器来测试您的笔记本电脑。

答案2

因此,显然我电视的所有输入都可以作为 4k 输入...但是,根据用户手册,HDMI2 应该是特殊的。HDMI2 默认工作,而我必须强制对 HDMI1、HDMI3 和 HDMI4 输入执行上述所有操作。

我能够在完全不同的笔记本电脑上重复完全相同的故障,并通过简单地连接到 HDMI2 解决完全相同的问题。

我仍然认为深入了解 xrandr 和视频子系统是一件好事。(虽然我可能不了解它就已经很幸福了……所以,算了。)

相关内容