画面を高解像度でミラーリングする (Ubuntu)

画面を高解像度でミラーリングする (Ubuntu)

Ubuntu 20.04 には、4K (3840x2160) テレビと 1080p モニターの 2 つの画面があります。テレビをメイン画面、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 にミラーリングするように変更すると、目的の結果が得られます。ただし、残念ながら、これは起動のたびに実行する必要があります。

追伸:こちらはソース使用しました。

編集: 自動生成 (Nvidia による) がxorg.conf問題を引き起こしていたようです。

関連情報