Xrandr not working on Nvidia proprietary drivers

Hello Everyone,
First time here on the forum as i have a bit of a niche problem.

So, i finally made the switch from Windows to Zorin and i'm having a blast, but I'm also trying to port to Zorin one single feature that i used on Windows.
I own a Quest 2 and usually I use it with Immersed to work with multiple monitors, now, Immersed has an AppImage that works on Zorin and i have tested it (It works far better then on windows by the way). The only issue is that the multiscreen feature is missing.
I've found out that Immersed can only stream actual screens connected and i've found out that you can fool it in to thinking that there is multiple using xrandr to virtually split your screen.

The problem is that this solution dosn't work with the Nvidia proprietary drivers, looks like there is a bug in gnome that has been fixed only a couple of weeks ago.

Finally my question, does anyone know of an alternative way to xrandr that i might be missing?

This is the script i've tryed on X11

#!/bin/bash
if [ -z "$(xrandr --listactivemonitors | grep 'DP-4-1')" ]; then
    xrandr --output DP-4
    xrandr --setmonitor DP-4-1 1920/590x1080/330+0+0 DP-4
    xrandr --setmonitor DP-4-2 1920/590x1080/330+1920+0 none
    xrandr --fb 3840x1081
    xrandr --fb 3840x1080   # This should only need to be run once, since we're not changing fb size again

else
    xrandr --delmonitor DP-4-1
    xrandr --delmonitor DP-4-2
    xrandr --output DP-4

    xrandr --fb 3840x1081
    xrandr --fb 3840x1080
fi

For good measure i've also tryed this one on Wayland but if i'm not wrong Gnome does not implement wlroots, so it dosn't work too (this should be the previous one translated by chatGPT since it's my first time using wlr-randr so it may be wrong)

#!/bin/bash

output="DP-4"

if ! wlr-randr | grep "$output" > /dev/null; then
    wlr-randr --output "$output" --mode 1920x1080 --pos 0,0 --scale 1,1
    wlr-randr --output "$output" --mode 1920x1080 --pos 1920,0 --scale 1,1
else
    wlr-randr --output "$output" --off
fi

Hi RandomAccessGuy, and welcome to the forum! Please see if the solution posted in this LinuxMint forum thread helps:

https://forums.linuxmint.com/viewtopic.php?t=212098

Hi, Thanks for the suggestion, I forgot to add it but i already tried to use the
--addmode and --output command to try to add more screens but when trying to use addmode with the line returned by cvt it was returning an error. I honestly didn't investigated it much because i didn't want to mess with the supported resolutions but if i'm not wrong it had something to do with the monitor configuration in the xorg.conf that i think was missing a flag or something

How about:

or here:

Ok so, I had already tried the first one, while the second one looks a bit more promising but still fails with the proprietary drivers.

As cited in this comment, there should be a workaround to make it work on proprietary, but I'm unable to make it work.

image

As indicated in the solution, I should create a new configuration for the virtual monitors, but I'm having 2 problems:

the first one is that nvidia-settings is unable to create an xorg.conf file

Package xorg-server was not found in the pkg-config search path.
Perhaps you should add the directory containing `xorg-server.pc'
to the PKG_CONFIG_PATH environment variable
No package 'xorg-server' found
Error executing /usr/share/screen-resolution-extra/nvidia-polkit: Permission denied

ERROR: Unable to open X config file '/etc/X11/xorg.conf' for writing.

The second one is that if I create the file shown in the solution I lose access to Xorg, and I'm only able to log in from Wayland, deleting the file make Xorg available again.

Did you try the last post with 0 votes on that workaround thread?

Yes, but nvidia-xconfig throw out the same error I've attached in the previous post

This is old but wonder if xorg is corrupted when logging into Zorin on xorg:

http://www.ubuntugeek.com/ubuntu-tiphow-to-removeinstall-and-reconfigure-xorg-without-reinstalling-ubuntu.html

Also found another guide on the main issue:

Ok, reinstalling Xorg and running again nvidia-xconfig fixed the xorg.conf file.
Now, I'm a bit unsure about where to put the configurations of the work around.

/etc/X11/xorg.conf

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

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

suggested file from the workaround /etc/X11/xorg.conf.d/30-virtscreen.conf

Section "Device"
    Identifier  "nvidiagpu"
    Driver      "nvidia"
EndSection

Section "Screen"
    Identifier  "nvidiascreen"
    Device      "nvidiagpu"
    Option      "ConnectedMonitor" "LVDS-0,DP-1"
EndSection

I was thinking about adding it directly to xorg.conf like this mixing the workaround and the last guide you linked:

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

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
EndSection

Section "Device"
  Identifier "Device1"
  Driver "dummy"
  VideoRam 256000
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Screen"
  DefaultDepth 24
  Identifier "Screen1"
  Device "Device1"
  Monitor "Monitor0"
  SubSection "Display"
    Depth 24
    Modes "1920x1080_144.00"
  EndSubSection
EndSection

But I'm not sure if it could work or if it will break something.

Sorry if I'm keeping you busy with this use case :sweat_smile:

If I'm honest, my dalliance with xrandr just for normal usage when I couldn't get correct resolution it did not work. What I would advise is you use Rescuezilla to make an image of your drive or use Timeshift to take a snapshot of your system before playing any further with xrandr.

I understand, thanks anyway for the help. For now I've ordered some displayport dummies to buy time while waiting for the Gnome fix to arrive. If I manage to find a fix or workaround I will update this thread or create a new informative one if this one is closed.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.