User Rating: 5 / 5

Star Active Star Active Star Active Star Active Star Active

As I have written before, after more than five years it was time to retire from hard work my trust old laptop. I decided to get an HP Omen. I must say the hardware is quite amazing and to get the best of it I installed Mageia 7 (current version when writing the articles).

Recently I have been getting into photography (I will write about that later) and of course, getting the software to develop RAW files is a must. I think Darktable is the best for it; however, this kind of software is really heavy, even this super powerful laptop with 12 cores at 3+ GHz got dizzy. Fortunately for us, Darktable supports GPU processing which offloads the CPU and displays the images almost right away.

Configuration to make this possible is kind of tricky. I will put here my notes hoping it will help other fellows Linux photographers. My notes are on Mageia but I am confident that anyone could apply them to their own Linux distribution.

It took me weeks to figure it out.

Bumblebee? No thanks!

If you have done your research, you have already read about Bumblebee. This project allows you to run specific software under the discrete NVIDIA GPU instead of using the main Intel. You will find that running optirun darktable-cltest -d opencl will give you an error like missing IMAGE support.

My first step is to uninstall bumblebee. I made sure the changes that are done in the /etc/modprobe.d/ directory were undone. After that, I had to run depmod -a and dracut to rebuild the image.

Use the Proprietary NVIDIA Module

I can't confirm this, but after doing research a lot of people claim that the opensource nouveau modules do not support IMAGE. I had to install all the NVIDIA and blacklist the nouveau and i915 modules (both). Mageia ships with Nvidia-current packages currently in its version 430. I did this by adding a file /etc/modprobe.d/nvidia.conf with the following content:

blacklist i915
options i915 enable_guc=1
options i915 enable_fbc=1
​blacklist nouveau

After switching to the proprietary modules, I did depmod -a. The i915 module would still load but not when booting. In the specific case of Mageia, because it uses alternatives, I had to run XFdrake to configure the first time the NVIDIA. When it asked what chipset to configure, I selected only NVIDIA with proprietary modules. XFdrake installed all the missing RPM's and it created a lot of symlinks. At this point, the configuration is quite useless but I found that I needed those symlinks.

I recreated the images by rerunning dracut and made sure I didn't have the nokmsboot options in the grub command line. Make sure you check this each time you update a kernel RPM, Mageia will restore the nokmsboot parameter. After this, I did a restart and stayed in runlevel 3. When I typed lsmod, I was able to see the nvidia modules loaded, also the dmesg showed me that the nvidia modules took control over the GPU.

After that, I created the /etc/X11/xorg.conf.d/nvidia.conf with the following content:

Section "OutputClass"
       Identifier "nvidia"
       MatchDriver "nvidia-drm"
       Driver "nvidia"
       Option "AllowEmptyInitialConfiguration"
       Option "SLI" "Auto"
       Option "BaseMosaic" "on"
       Option "PrimaryGPU" "yes"

Section "ServerLayout"
       Identifier "layout0"
       Option "AllowNVIDIAGPUScreens"
       Option "PrimaryGPU" "yes"

I do not know why Mageia doesn't include it, but everybody who claims to succeed had this file. I did the experiment and without this definition, my procedure didn't work. After that, I just edit the /etc/X11/xorg.conf file with the following content.

# File generated by XFdrake (rev 262502)

# **********************************************************************
# Refer to the xorg.conf man page for details about the format of
# this file.
# **********************************************************************

Section "ServerFlags"
   AllowMouseOpenFail # allows the server to start up even if the mouse does not work
   #DontZoom # disable <Ctrl><Alt><KP_+>/<KP_-> (resolution switching)
   Option "DontZap" "False" # disable <Ctrl><Alt><BS> (server abort)

Section "Module"
   Load "v4l" # Video for Linux

Section "ServerLayout"
   Identifier "layout0"
   Screen  0 "nvidia" 0 0
   Inactive "intel"
   Option "AllowNVIDIAGPUScreens"
   Option "PrimaryGPU" "yes"

Section "Monitor"
   Identifier "monitor1"
   VendorName "Plug'n Play"
   # Apple iMac modes
   ModeLine "1024x768"   78.525 1024 1049 1145 1312   768  769  772  800 +hsync +vsync
   ModeLine "800x600"    62.357  800  821  901 1040   600  601  604  632 +hsync +vsync
   ModeLine "640x480"    49.886  640  661  725  832   480  481  484  514 +hsync +vsync
   # Apple monitors tend to do 832x624
   ModeLine "832x624"    57      832  876  940 1152   624  625  628  667 -hsync -vsync
   # Apple PowerBook G3
   ModeLine "800x600"    100     800  816  824  840   600  616  624  640 -hsync -vsync
   # Apple TI Powerbook
   ModeLine "1152x768"   78.741 1152 1173 1269 1440   768  769  772  800 +vsync +vsync
   # Pismo Firewire G3
   ModeLine "1024x768"   65     1024 1032 1176 1344   768  771  777  806 -hsync -vsync
   # iBook2
   ModeLine "1024x768"   65     1024 1048 1184 1344   768  771  777  806 -hsync -vsync
   # 17" Apple Studio Display
   ModeLine "1024x768"   112.62 1024 1076 1248 1420 768 768 780 808 +hsync +vsync
   # HiRes Apple Studio Display
   ModeLine "1280x1024"  135    1280 1288 1392 1664  1024 1027 1030 1064
   # Another variation
   ModeLine "1280x1024"  134.989 1280 1317 1429 1688  1024 1025 1028 1066 +hsync +vsync
   # TV fullscreen mode or DVD fullscreen output.
   # 768x576 @ 79 Hz, 50 kHz hsync
   ModeLine "768x576"     50.00  768  832  846 1000   576  590  595  630
   # 768x576 @ 100 Hz, 61.6 kHz hsync
   ModeLine "768x576"     63.07  768  800  960 1024   576  578  590  616

Section "Device"
   Identifier "nvidia"
   VendorName "NVIDIA Corporation"
   BoardName "NVIDIA GeForce 635 series and later"
   Driver "nvidia"
   BusID "PCI:1:0:0"
   Option "ConstrainCoursor" "off"
   Option "PrimaryGPU" "yes"
   Option "Overlay" "true"

Section "Screen"
   Identifier "nvidia"
   Device "nvidia"
   Monitor "monitor1"
   DefaultColorDepth 24
   Option "AllowEmptyInitialConfiguration" "on"
   Option "IgnoreDisplayDevices" "CRT"
   Option "UseDisplayDevice" "none"

Section "Device"
   Identifier "intel"
   VendorName "Intel Corporation"
   BoardName "Intel 810 and later"
   Driver "modesetting"
   BusID "PCI:0:2:0"
   Option "DPMS"
   Option "Overlay" "true"

Section "Screen"
   Identifier "intel"
   Device "intel"
   Monitor "monitor1"
   DefaultColorDepth 24

Note that is very important to put first the Nvidia definitions, then the Intel ones. I found this the hard way. If you are following my guide, make yourself a favour and copy and paste as it is.

At this point, if I ran startx, my X server was able to start and the Darktable OpenCL test was passed. Also, glxgears worked for me. But I haven't finished.

When I typed xrandr --listproviders, I was able to see two providers: NVIDIA-0 and modesetting (Intel).

Automatic Sing In

After I restarted your computer in runlevel 5, I found that it got stuck with a black screen. X was running and if I typed my password I was able to log. This gave me the clue that for a reason, SDDM didn't take video configuration values until the session started. I was not able to fix it, so the easy workaround is to enable the auto-login. Some people say that putting the following script in the /usr/share/sddm/scripts would fix it, but it didn't work for me. I also tried to put it in /etc/X11/xinit.d/ but it didn't work eighter in my case. Here it is the script:

/usr/bin/xrandr --setprovideroutputsource modesetting NVIDIA-0
/usr/bin/xrandr --auto

If someone knows how to fix it, I would appreciate a comment.

Enjoy your laptop!

blog comments powered by Disqus


Read about IT, Migration, Business, Money, Marketing and other subjects.

Some subjects: FusionPBX, FreeSWITCH, Linux, Security, Canada, Cryptocurrency, Trading.