Score:0

Xorg configuration with hybrid graphics (amd / nvidia) and multiple monitors

dm flag

I have a Asus laptop, TUF566IV, running Kubuntu 23.04. It comes with a RTX 2060 and an integrated AMD gpu.

I initially had a single HDMI external monitor and the display was handled by the iGPU, using the RTX only for machine learning.

I added another monitor, which is plugged into the USB-C port (displayport compatible), so now I'm using all 3 displays : 2 external monitors and the laptop screen.

I apparently cannot make the USB-C monitor work unless the RTX handles the display, which causes the GPU to be constantly used (1% to 25% as per nvidia-smi), the fan constantly blowing more or less loudly, and more annoyingly, frequent crashes of kde/plasmashell which kill several applications like the browser, pycharm.

The Xorg process also constantly uses up about 7% of the CPU.

For reference, here is my current xorg.conf (I tested quite a bit of variations and this one works, i.e. all 3 monitors are active):

    Identifier     "Device0"
    Driver         "amdgpu"
    VendorName     "amd"
    BusID          "PCI:5:0:0"
    Option         "UseNvKmsCompositionPipeline" "false"
EndSection

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "0"
EndSection

Section "Files"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    Option         "DPMS"
EndSection

Section "Monitor"
    Identifier     "Monitor1"
    VendorName     "Unknown"
    ModelName      "Unknown"
    Option         "DPMS"
EndSection

Section "Monitor"
    Identifier     "Monitor2"
    VendorName     "Unknown"
    ModelName      "Unknown"
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device1"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BusID          "PCI:1:0:0"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device1"
    Monitor        "Monitor0"
    Option         "UseNvKmsCompositionPipeline" "false"
    Option         "ForceCompositionPipeline" "1"
EndSection

Section "Screen"
    Identifier     "Screen1"
    Device         "Device1"
    Monitor        "Monitor1"
    Option         "UseNvKmsCompositionPipeline" "false"
    Option         "ForceCompositionPipeline" "1"    
EndSection

Section "Screen"
    Identifier     "Screen2"
    Device         "Device1"
    Monitor        "Monitor2"
    Option         "UseNvKmsCompositionPipeline" "false"
    Option         "ForceCompositionPipeline" "1"  
EndSection```

And the nvidia-smi output:
```+---------------------------------------------+
| NVIDIA-SMI 530.30.02              Driver Version: 530.30.02    CUDA Version: 12.1     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                  Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf            Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce RTX 2060         Off| 00000000:01:00.0 Off |                  N/A |
| N/A   42C    P5                9W /  90W|    609MiB /  6144MiB |      3%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
                                                                                         
+---------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A      1347      G   /usr/lib/xorg/Xorg                          307MiB |
|    0   N/A  N/A      2346      G   /usr/bin/ksmserver                            2MiB |
|    0   N/A  N/A      2348      G   /usr/bin/kded5                                2MiB |
|    0   N/A  N/A      2351      G   /usr/bin/kwin_x11                            75MiB |
|    0   N/A  N/A      2391      G   /usr/bin/plasmashell                         28MiB |
|    0   N/A  N/A      2412      G   ...c/polkit-kde-authentication-agent-1        2MiB |
|    0   N/A  N/A      2461      G   /usr/bin/birdtray                             2MiB |
|    0   N/A  N/A      2471      G   ...86_64-linux-gnu/libexec/kdeconnectd        2MiB |
|    0   N/A  N/A      2485      G   /usr/bin/kaccess                              2MiB |
|    0   N/A  N/A      2490      G   ...-linux-gnu/libexec/DiscoverNotifier       12MiB |
|    0   N/A  N/A      2667      G   /usr/lib/thunderbird/thunderbird             90MiB |
|    0   N/A  N/A      2700      G   ...-gnu/libexec/xdg-desktop-portal-kde        2MiB |
|    0   N/A  N/A      3396      G   ...61807972,1722809804713501230,262144       66MiB |
|    0   N/A  N/A      3587      G   ...bin/plasma-browser-integration-host        2MiB |
|    0   N/A  N/A      3784      G   /usr/bin/konsole                              2MiB |
+---------------------------------------------+

I don't think I can use only the integrated gpu to have these 3 monitors as the USB-C output isn't physically wired to it, I suppose. However, I would like to find a way of improving the performance and avoiding these frequent crashes, if anyone can give me some pointers.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.