如何使用不超出范围的最高1920x分辨率?

如何使用不超出范围的最高1920x分辨率?

我发现没有切换到 1920x1080 的选项,尽管 Windows 支持它。Xrandr 可以在分辨率选择器中添加 60Hz 的 1920x 分辨率选项,但当我单击“应用”时,GPU 或内部显示器会拒绝它,分辨率会强制回到 1024x768@60Hz。

$ xrandr --verbose
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 16384 x 16384
VGA-1 connected primary 1024x768+0+0 (0x42) normal (normal left inverted right x axis y axis) 0mm x 0mm
    Identifier: 0x40
    Timestamp:  66227
    Subpixel:   unknown
    Gamma:      1.0:1.0:1.0
    Brightness: 1.0
    Clones:    
    CRTC:       0
    CRTCs:      0 1
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    link-status: Good 
        supported: Good, Bad
    CTM: 2591090 1 7737 0 2017 -2147483648 41175 -2147483648 -1154733 0 44695 -2147483648 45328 0 21316 -2147483648 
        3727858 1 
    CONNECTOR_ID: 61 
        supported: 61
    non-desktop: 0 
        range: (0, 1)
  1024x768 (0x42) 65.000MHz -HSync -VSync *current
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  800x600 (0x43) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  800x600 (0x44) 36.000MHz +HSync +VSync
        h: width   800 start  824 end  896 total 1024 skew    0 clock  35.16KHz
        v: height  600 start  601 end  603 total  625           clock  56.25Hz
  848x480 (0x45) 33.750MHz +HSync +VSync
        h: width   848 start  864 end  976 total 1088 skew    0 clock  31.02KHz
        v: height  480 start  486 end  494 total  517           clock  60.00Hz
  640x480 (0x46) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz
$ lspci -k | grep -EA3 'VGA|3D|Display'
00:02.0 VGA compatible controller: Intel Corporation 4th Generation Core Processor Family Integrated Graphics Controller (rev 06)
    Subsystem: Gigabyte Technology Co., Ltd 4th Generation Core Processor Family Integrated Graphics Controller
    Kernel driver in use: i915
    Kernel modules: i915
  • Intel® Core™ i3-4130 CPU @ 3.40GHz × 4
  • Mesa 英特尔® 高清显卡 4400 (HSW GT2)
  • 内存:4 GB

答案1

因此,经过 3 天的头疼和研究,我终于解决了这个问题。对于任何想要重现它的人:

  1. 在登录屏幕上切换到“Ubuntu on Xorg”
  2. 按照以下示例运行此脚本./xrandr.sh 1920 1080 50
#!/bin/bash
# Copyright © 2021 Chirag Bhatia
# SPDX-License-Identifier: MIT
# https://gist.github.com/chirag64/7853413

#If no argument is specified, ask for it and exit
if [[ -z "$@" ]];
then
    echo "An argument is needed to run this script";
    exit
else
    arg="$@"
    #Basic check to make sure argument number is valid. If not, display error and exit
    if [[ $(($(echo $arg | grep -o "\s" | wc --chars) / 2 )) -ne 2 ]];
    then
        echo "Invalid Parameters. You need to specify parameters in the format \"width height refreshRate\""
        echo "For example setResolution \"1920 1080 60\""
        exit
    fi
    
    #Save stuff in variables and then use xrandr with those variables
    modename=$(echo $arg | sed 's/\s/_/g')
    display=$(xrandr | grep -Po '.+(?=\sconnected)')
    if [[ "$(xrandr|grep $modename)" = "" ]];
    then
        xrandr --newmode $modename $(gtf $(echo $arg) | grep -oP '(?<="\s\s).+') &&
        xrandr --addmode $display $modename     
    fi
    xrandr --output $display --mode $modename

    #If no error occurred, display success message
    if [[ $? -eq 0 ]];
    then
        echo "Display changed successfully to $arg"
    fi
fi

<<COMMENT
#Manual steps with explanation ahead by @debloper
# First we need to get the modeline string for xrandr
# Luckily, the tool "gtf" will help you calculate it.
# All you have to do is to pass the resolution & the-
# refresh-rate as the command parameters:
gtf 1920 1080 60

# In this case, the horizontal resolution is 1920px the
# vertical resolution is 1080px & refresh-rate is 60Hz.
# IMPORTANT: BE SURE THE MONITOR SUPPORTS THE RESOLUTION

# Typically, it outputs a line starting with "Modeline"
# e.g. "1920x1080_60.00"  172.80  1920 2040 2248 2576  1080 1081 1084 1118  -HSync +Vsync
# Copy this entire string (except for the starting "Modeline")

# Now, use "xrandr" to make the system recognize a new
# display mode. Pass the copied string as the parameter
# to the --newmode option:
xrandr --newmode "1920x1080_60.00"  172.80  1920 2040 2248 2576  1080 1081 1084 1118  -HSync +Vsync

# Well, the string within the quotes is the nick/alias
# of the display mode - you can as well pass something
# as "MyAwesomeHDResolution". But, careful! :-|

# Then all you have to do is to add the new mode to the
# display you want to apply, like this:
xrandr --addmode VGA1 "1920x1080_60.00"

# VGA1 is the display name, it might differ for you.
# Run "xrandr" without any parameters to be sure.
# The last parameter is the mode-alias/name which
# you've set in the previous command (--newmode)

# It should add the new mode to the display & apply it.
# Usually unlikely, but if it doesn't apply automatically
# then force it with this command:
xrandr --output VGA1 --mode "1920x1080_60.00"

# That's it... Enjoy the new awesome high-res display!
COMMENT

就是这样。它无法在我的显示器上运行的唯一原因是与刷新率有关。虽然它在 Windows 上以 60Hz 运行,但 Ubuntu 可以以 50Hz 运行它。

这是获得自定义解决方案的少数几种方法之一。我感谢 DanielT 为我指明了正确的方向!他提到的帖子让我对问题出在哪里有了基本的了解。

答案2

我也尝试过使用 1920x 分辨率,但在 1920x1280 模式下尝试不同的时间仍然会出错。我仔细查看了一下,将 1280 改为 1080,成功了。我的显示器规格仅正式支持最高 1920x1080@60Hz。Windows 10 在显示 1920x1280 时不会报告真实情况。

相关内容