更高解析度的鏡像螢幕 (Ubuntu)

更高解析度的鏡像螢幕 (Ubuntu)

在 Ubuntu 20.04 上,我有 2 個螢幕,一台 4K (3840x2160) 電視和一台 1080p 顯示器。我想讓它們鏡像,電視作為主螢幕,1080p 作為備份。我希望圖像在兩個螢幕上都以 4k 渲染,以便它們顯示完全相同。透過顯示設定我只能選擇兩者最高1080p,所以我一直在嘗試使用xrandr,但沒有成功。我最多能實現的是在兩個螢幕上渲染 4k,但 1080p 螢幕會裁剪圖像並僅顯示圖像的 1/4。

xrandr --prop

HDMI-0 connected (normal left inverted right x axis y axis)
    CTM: 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 
        0 1 
    CscMatrix: 65536 0 0 0 0 65536 0 0 0 0 65536 0 
    EDID: 
        00ffffffffffff0061a4e20001000000
        0a1d0103806f3e780acf74a3574cb023
        09484c21080081804540614095000101
        010101010101023a801871382d40582c
        4500c48e2100001e662150b051001b30
        40703600c48e2100001e000000fc004d
        692054560a20202020202020000000fd
        00324b1e5017000a2020202020200150
        02033df251010304050790121314161f
        5d5e5f6263642f097f07150750570600
        3d06c05f7e01830100006e030c001000
        b83c20008001020304e3060501011d00
        bc52d01e20b8285540c48e2100001e01
        1d80d0721c1620102c2580c48e210000
        9e000000000000000000000000000000
        000000000000000000000000000000bc
    BorderDimensions: 4 
        supported: 4
    Border: 0 0 0 0 
        range: (0, 65535)
    SignalFormat: TMDS 
        supported: TMDS
    ConnectorType: HDMI 
    ConnectorNumber: 1 
    _ConnectorLocation: 1 
    non-desktop: 0 
        supported: 0, 1
   1920x1080     60.00 +  59.94    50.00    60.00    50.04  
   4096x2160     29.97    25.00    24.00    23.98  
   3840x2160     29.97    25.00    23.98    23.98  
   1440x900      59.89  
   1360x768      60.02  
   1280x1024     60.02  
   1280x720      59.94    50.00  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       59.94    59.93  
HDMI-1-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 527mm x 296mm
    _MUTTER_PRESENTATION_OUTPUT: 0 
    EDID: 
        00ffffffffffff0010acdad042394435
        2b1d010380351e78ea0565a756529c27
        0f5054a54b00714f8180a9c0d1c00101
        010101010101023a801871382d40582c
        45000f282100001e000000ff00484c36
        593159320a2020202020000000fc0044
        454c4c205032343139480a20000000fd
        00384c1e5311000a20202020202001fb
        020317b14c9005040302071601141f12
        1365030c001000023a801871382d4058
        2c45000f282100001e011d8018711c16
        20582c25000f282100009e011d007251
        d01e206e2855000f282100001e8c0ad0
        8a20e02d10103e96000f282100001800
        00000000000000000000000000000000
        0000000000000000000000000000003d
    PRIME Synchronization: 0 
        supported: 0, 1
    HDCP Content Type: HDCP Type0 
        supported: HDCP Type0, HDCP Type1
    Content Protection: Undesired 
        supported: Undesired, Desired, Enabled
    max bpc: 12 
        range: (8, 12)
    content type: No Data 
        supported: No Data, Graphics, Photo, Cinema, Game
    Colorspace: Default 
        supported: Default, SMPTE_170M_YCC, BT709_YCC, XVYCC_601, XVYCC_709, SYCC_601, opYCC_601, opRGB, BT2020_CYCC, BT2020_RGB, BT2020_YCC, DCI-P3_RGB_D65, DCI-P3_RGB_Theater
    aspect ratio: Automatic 
        supported: Automatic, 4:3, 16:9
    Broadcast RGB: Automatic 
        supported: Automatic, Full, Limited 16:235
    audio: auto 
        supported: force-dvi, off, auto, on
    link-status: Good 
        supported: Good, Bad
    CONNECTOR_ID: 74 
        supported: 74
    non-desktop: 0 
        range: (0, 1)
   1920x1080     60.00*+  50.00    59.94  
   1920x1080i    60.00    50.00    59.94  
   1600x900      60.00  
   1280x1024     75.02    60.02  
   1152x864      75.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   720x576       50.00  
   720x576i      50.00  
   720x480       60.00    59.94  
   720x480i      60.00    59.94  
   640x480       75.00    60.00    59.94  
   720x400       70.08  
   3840x2160_60.00  60.00
   3840x2160_29.97  29.97

我試過:

xrandr --fb 3840x2160 --output HDMI-0 --rate 29.97 --mode 3840x2160 --output HDMI-1-1 --rate 29.97 --mode 1920x1080 --panning 0x0 --scale 2x2

也:

xrandr --fb 3840x2160 --output HDMI-0 --rate 29.97 --mode 3840x2160 --output HDMI-1-1 --rate 29.97 --mode "3840x2160_29.97" --panning 0x0

其中「3840x2160_29.97」是以下結果gtf

gtf 3840 2160 29.97

我的目標可以達成嗎xrandr?我該怎麼做?而且,如果不可能xrandr,還有其他方法嗎?

答案1

#!/bin/bash

mode="3840x2160_60.00"
screen="HDMI1"
cvt_res="712.75  3840 4160 4576 5312  2160 2163 2168 2237 -hsync +vsync"

if [[ "$(xrandr|grep $mode)" ="" ]];
then
  xrandr --newmode $mode $cvt_res &&
  xrandr --addmode $screen $mode
fi

xrandr --output HDMI-0 --mode "3840x2160" --output $screen --mode "1920x1080" --scale 2.0x2.0 --panning 3840x2160

執行上述操作後,UHD 螢幕中的內容會縮放,但螢幕的 3/4 是黑色的。之後,我手動進入顯示設定並將兩個顯示器變更為鏡像 3840x2160,此時就達到了所需的結果。然而不幸的是,這需要在每次啟動時完成!

PS:這是來源我用了。

編輯:看起來是自動生成的(由 Nvidia 提供)xorg.conf導致了問題!

相關內容