CachyOS / cachyos-calamares

CachyOS Calamares
GNU General Public License v3.0
9 stars 7 forks source link

Installing LXQt with an NVIDIA card does not correctly configure X11 on systems with iGPU. #29

Closed mainrs closed 4 months ago

mainrs commented 4 months ago

Hi! Thank you for helping improve Calamares. If you are seeing a problem in installing a specific distribution, you should probably report the problem in the distribution's bug tracker, first. That helps filter out issues with packaging, mis-configuration, etc. that Calamares has no control over. If you are a distribution packager or maintainer, this page is for you.

Describe the bug Once the installation is done and the device is rebooted, X11 might start on the iGPU, giving no output when connecting through the dGPU.

To Reproduce Steps to reproduce the behavior:

  1. Install new system
  2. Reboot
  3. Put HDMI cable into dGPU

Expected behavior System works.

Screenshots and Logs Not much I can provide here, as my system already runs.

Additional context I had to manually edit the /etc/X11/x11.conf file to specifically use my NVIDIA device for my monitor. I simply ran sudo nvidia-xconfig without any modifications to it. It might be useful to run this command too if the user decides to use an X11-based DE/WM.

This is not necessary for anything Wayland.

vnepogodin commented 4 months ago

Hi,

How's your dGPU reported to the system if you don't put HDMI cable in? Can you provide output of chwd without HDMI cable in your dGPU and with HDMI cable into your dGPU?

mainrs commented 4 months ago

With:

> 0000:00:02.0 (0300:8086:1912) VGA compatible controller Intel Corporation:

╭──────────┬─────────╮
│ Name     ┆ NonFree │
╞══════════╪═════════╡
│ intel    ┆ false   │
├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ fallback ┆ false   │
╰──────────┴─────────╯

> 0000:01:00.0 (0300:10de:1b81) VGA compatible controller NVIDIA Corporation:

╭─────────────┬─────────╮
│ Name        ┆ NonFree │
╞═════════════╪═════════╡
│ nvidia-dkms ┆ true    │
├╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ fallback    ┆ false   │
├╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
│ nouveau     ┆ false   │
╰─────────────┴─────────╯

Without I would have to change the config again for X11 to use my iGPU. I have to do that later.

What I can additionally provide as information is that I did some basic debugging before stumbling upon the X11 config stuff on the Arch wiki. The system detected both GPUs. The GPU was also loaded and configured correctly, the proprietary driver was used, too.

Here is some output from dmesg I can provide from before the configuration change fixed my system.

nvidia: loaded out-of-tree mdule taints kernel.
nvidia: module license 'NVIDIA' taints kernel.
nvidia: module verification failed; signature and/or required key missing - tainting kernel
nvidia: module license taints kernel
nvidia-nvlink: Nvlink Core is beng iniialized, major device 240
nvidia 0000:01:00.0: enabling device (0000 -> 0003)
nvidia 0000:01:00.0: vgaarbL VGA decodes changed: olddecodes=io+mem,decodes=none:owns=none
nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNX platforms  555.58.02   <date>
nvidia_uvm: module uses symbol nvUvmInterfaceDisableAccessCntr from proprietary module nvidia, inheriting taint.
nvidia_uvm: Loaded the UVM driver, major device number 238.
[drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
[drm] [initialized nvidia-drm 0.0.0 20160202 for 0000:01:00.0 minor 0]
nvidia 0000:01:00.0: [drm] fb1: nvidia-drmdrmfb frame buffer device
ptr1337 commented 4 months ago

@ventureoo

ventureoo commented 4 months ago

This is a known NVIDIA driver issue. If your HDMI port is controlled by dGPU, then the compositor you are using (like picom) or bare Xorg at runtime does not take into account the secondary GPU for displaying frames, causing the external monitor to either not respond or perform extremely poorly. This is fixed on the GNOME/KDE Plasma side, and probably not fixed on picom (not sure about the EGL backend)/other compositors side. As a workaround, just specify dGPU as main in the xorg config (example below). I don't consider using this config by default, because we can't know exactly what the configuration and user is and whether they will use external monitors, so this issue can only remain as unresolved until Nvidia fixes it or all compositors start handling it properly.

/etc/X11/xorg.conf.d/10-gpu.conf

Section "ServerLayout"
  Identifier "layout"
  Screen 0 "nvidia"
  Inactive "intel"
EndSection

Section "Device"
    Identifier  "nvidia"
    Driver      "nvidia"
    BusID       "PCI:1:0:0" # there is your PCI id
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "AllowEmptyInitialConfiguration"
EndSection

Section "Device"
    Identifier  "intel"
    Driver      "modesetting"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection
mainrs commented 4 months ago

I understand your point of view on this topic.

I want to add that I think an out of box, working user experience is key for any Linux distribution. Although reliably testing for desktop vs. laptop does not seem to be possible, I want to bring up an alternative that might be worth considering. Especially since the configuration file in my case did not even exist (/etc/X11/x11.conf). In my opinion, that also holds for Arch derivatives like Manjaro or CachyOS, even though the user base might be more technically inclined.

What about a simple checkbox a la Do you use a laptop?. If yes, then the installation requires custom configuration anyway through PRIME. If not, one can additionally provide an option to make the NVIDIA GPU the default one by overwriting the X11 configuration on LXQt specifically. Since there is no way to use it without external monitors.

As this will happen for any user that has two GPUs running LXQt. And the option can also only be shown in the installer if booting the NVIDIA proprietary driver ISO image. As a last step before finishing the installation.

I feel like this can be a fairly simple and easily maintainable middle ground. I volunteer to work on this if a PR would be accepted.

ventureoo commented 4 months ago

I understand your point of view on this topic.

I want to add that I think an out of box, working user experience is key for any Linux distribution. Although reliably testing for desktop vs. laptop does not seem to be possible, I want to bring up an alternative that might be worth considering. Especially since the configuration file in my case did not even exist (/etc/X11/x11.conf). In my opinion, that also holds for Arch derivatives like Manjaro or CachyOS, even though the user base might be more technically inclined.

What about a simple checkbox a la Do you use a laptop?. If yes, then the installation requires custom configuration anyway through PRIME. If not, one can additionally provide an option to make the NVIDIA GPU the default one by overwriting the X11 configuration on LXQt specifically. Since there is no way to use it without external monitors.

As this will happen for any user that has two GPUs running LXQt. And the option can also only be shown in the installer if booting the NVIDIA proprietary driver ISO image. As a last step before finishing the installation.

I feel like this can be a fairly simple and easily maintainable middle ground. I volunteer to work on this if a PR would be accepted.

Well, PRs are always welcome, it's just that in this case there really isn't much that we can do, but if you can add at least checkbox, why not :)

ventureoo commented 4 months ago

BTW, could you also try using picom with EGL backend? I'm not too sure about it, but maybe it would create some difference.