PRIME display is not detected after generating xorg.conf file

I have a laptop with NVIDIA GPU. I’m using external screen. Internal laptop screen is detected as PRIME Display in nvidia-settings.
To prevent tearing on the external screen I have to enable G-SYNC in nvidia-settings.
To keep the setting persistent after reboot I have to save the settings to X configuration file.

The problem is that the generated xorg.conf does not include the laptop screen. After reboot the laptop screen is not even detected.
My question is: is it possible to save NVIDIA settings for the external screen and keep the laptop screen working?

System info:
Distribution: KDE neon 5.21 User Edition (based on Ubuntu 20.04)
Kernel version: 5.8.0-44-generic
NVIDIA driver version: 460.39
Prime Configuration: nvidia
xorg.conf generated by nvidia-settings:

# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 460.39

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

Section "Files"

Section "Module"
    Load           "dbe"
    Load           "extmod"
    Load           "type1"
    Load           "freetype"
    Load           "glx"

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

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"

Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Samsung"
    HorizSync       223.0 - 223.0
    VertRefresh     120.0 - 144.0
    Option         "DPMS"

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce RTX 2070 with Max-Q Design"

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-3"
    Option         "metamodes" "nvidia-auto-select +1920+0 {AllowGSYNCCompatible=On}"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24

(you can see that the external screen is shifted by 1920 pixels because the laptop 1080p screen is enabled, however the laptop screen is not defined anywhere in the file )

Please delete xorg.conf and create a file /etc/X11/xorg.conf.d/20-nvidia-myoptions.conf

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
<insert options here>
1 Like

Thanks, that works!
One question though, what’s the difference between the file in /etc/X11/xorg.conf.d/ and ~/.nvidia-settings-rc?
Why can’t I store the info about displays in ~/.nvidia-settings-rc?

/etc/X11/xorg.conf.d/ contains regular Xserver config snippets, nvidia-settings-rc only nvidia-settings specific config.
Otherwise you’d have to create a script that uses nvidia-settings cli commands and have that autostarted.

1 Like

What would be an example of options that should be inserted? I have had this issue for about a year now and have gotten used to running a .sh for activating Full Composition Pipeline every log in. I am sick of it and would really appreciate help, if possible. I will attach my xorg.conf and will later attach anything needed.
Best regards, Joel
xorg.conf (1.6 KB)

Option "ForceFullCompositionPipeline" "true"


Alright thank you so much