2

Note: I think this should be distro-agnostic, but if it is relevant, I am using Arch Linux with KDE Plasma 5 and SDDM.

I'll try to keep this brief and keep only the absolutely relevant details.

I did a clean install of Arch Linux, and I wanted to set up Bumblebee for Optimus/Prime functionality (I have an optimus laptop - Asus X550V). I encountered some issues with bumblebee, and during the following experimentation to sort it out, I realized I still don't understand how xorg and graphics drivers work (please note that I think I have a muxless solution with the hybrid graphics - at least I cannot change the active card in BIOS).

What I thought how it works:

1) If the proprietary drivers are not installed, the system will load both the intel and the nouveau drivers, use intel by default, and use nouveau when DRI_PRIME=1 is passed to a command.

2) If the proprietary drivers ARE installed, the system will not load them unless the xorg configuration is set up the way it is detailed here (https://wiki.archlinux.org/index.php/NVIDIA_Optimus - the "using nvidia" part).

3) If the proprietary drivers are installed, and the proper xorg config is set up, then the system will try to use the nvidia drivers and the nvidia GPU but will give a black screen, as the nvidia GPU is not connected to the display - two xrandr lines are necessary in either ~/.xinitrc (if using startx) or in the display managers config files to tell xorg to use offloading.

What actually happened:

To investigate my bumblebee issues I uninstalled everything related to nvidia or bumblebee, and I installed the nvidia drivers only.

To my surprise, upon boot, SDDM failed to appear. I switched to a free tty, killed sddm (sudo systemctl stop sddm), and used startx (.xinitrc was set up with exec startkde but not with the two xrandr lines). To my (once again) suprise, KDE started. My fonts appeared small/low resolution, but otherwise it was fine, and a glxinfo | grep NVIDIA confirmed that I am using nvidia.

Afterwards, I appended the two xrandr lines to /usr/share/sddm/scripts/Xsetup, and then SDDM started without problem, and I could log in to Plasma. Fonts were still screwed, but it worked and with nvidia.

Questions:

  • Why on Earth did my system use the Nvidia drivers, if I didn't even have a xorg.conf file at all? (xorg.conf.d was also empty, save for a keyboard file) If it uses the Nvidia drivers by default then why tell everywhere (Arch Wiki, Nvidia docs) to create a xorg.conf file for the nvidia drivers if I want to use them? More importantly, how is it that when bumblebee is installed, the system will use Intel by default? The /etc/X11 folder has the same content in both cases with no xorg.conf file. Alternatively, the same thing happens on Ubuntu when the in-built PRIME applet is used - there is a xorg.conf file used when you switch to NVIDIA, but that xorg.conf is disabled when using Intel. How come it doesn't use NVIDIA then, if it uses NVIDIA in my case, even though there is no xorg.conf file telling xorg to use NVIDIA?

  • Why did I managed to run Plasma on NVIDIA, without having the xrandr lines in my startx? Only SDDM had problems. Running with startx was possible. I thought the offloading should only happen if those lines are there?

1

How they work depends on the distribution in question. What you've described as the actual behavior matches how most distros behave, but there a few odd cases like Gentoo (which requires you to manually blacklist the in-kernel drivers to have the proprietary ones load) that don't do things that way.

As to why it behaves that way, modern X servers will auto detect most things correctly without any of the config files you mention. In fact, the best current practices are to explicitly not have those config files unless your setup does not work correctly out of the box with the autodetection, so that changing the hardware around (for example, installing a different video card) doesn't break your X config. It's also worth noting that a lot of documentation has not caught up to this yet, and Arch in particular recommends that you do have those files so you get exactly the behavior you want (which may or may not be the best option). The important thing here though is that X will use whatever video driver is loaded by your kernel by default, and it will (usually) fall back to the auto-detected defaults if the provided config makes no sense (or doesn't apply to the hardware).

This then brings up the question of why your kernel loaded the proprietary drivers instead of nouveau. Without significant amounts of information about your exact configuration, I can't tell you exactly why this happened, but I would be willing to bet that the current behavior on Arch matches most distributions, and will preferentially use the proprietary drivers instead of nouveau. Assuming this is the case, you (may) be able to force use of nouveau by adding the following to the kernel command-line in the bootloader:

modules_blacklist=nvidia

This will prevent the proprietary drivers from loading at all (even when you explicitly tell them too with tools like modprobe -f), which should cause nouveau to load instead.

  • Thanks for the response. I have a feeling X got too smart for its own good, though I can imagine in many situations, that's exactly what is good. I am not so much suprised that the system doesn't use the nouveau drivers per se, since the installation of the proprietary drivers automatically blacklists them. I am hoping, however, that I can get the system to use the intel drivers/GPU by blacklisting the nvidia ones not in the kernel params, but in /etc/modprobe.d, since I'd want to make a script that switches GPUs. Without bbswitch it will need a reboot, but its an acceptable loss. – Bence Racskó Oct 10 '17 at 8:11
  • However, I am still vexed by the fact that I could launch an nvidia session without using xrandr --setprovideroutputsource modesetting NVIDIA-0 && xrandr --auto. By all intends and purposes it shouldn't behave that way. – Bence Racskó Oct 10 '17 at 8:12
  • @Uldreth Is the Intel GPU even visible from Linux? I know some OEM systems disable them when they have another GPU. As far as switching, look into bbswitch (github.com/Bumblebee-Project/bbswitch). As long as you've got a laptop with NVIDIA Optimus support, that should work. – Austin Hemmelgarn Oct 10 '17 at 11:59
  • It is visible. If I'm on nouveau it also does use the usual PRIME setup (Intel unmodified, nouveau with DRI_PRIME=1), I could use Ubuntu's PRIME switch properly (incl. using Intel), and in the past I could use bumblebee without problem. Sadly, it is precisely bbswitch that has been not working properly for me... – Bence Racskó Oct 10 '17 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.