So, this could be a very good week or very bad. My old desktop started to behave very annoyingly, freezing every ten minutes is not the ideal scenario. Happily, I had a spare CPU I was using for Windows applications only, so I decided to take it. Because I have some spare AMD Radeon R9 290 GPUs, I decided to install one of them.

Again, I have been getting into photography so again, processing RAW files with the CPU is not a good idea. Not even if your desktop has twelve cores. So I had to figure out a way to make it work.

As I had described in the article where I made my discrete NVIDIA work with Darktable,  this software needs IMAGE support. So, the situation is the following:

  • only the proprietary AMDGPU PRO module offers IMAGE support, so no Radeon module.
  • the AMDGPU PRO requires X.Org 1.1xx, and Mageia 7 comes with X.Org 1.20.x

Here is what I did to make it work.

Configure X.org to use AMD GPU

The first step I did was to configure my X.Org to use the open-source AMD PRO module. Because my AMD R9 290 is not a very new card, MageĆ­a would offer the old flgrx module. Instead, I selected another card that showed the amdgpu module. My /etc/X11/xorg.conf file looks as follows:

It is important to use the amdgpu module.

# 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
   Option "DontZap" "False" # disable <Ctrl><Alt><BS> (server abort)
   #DontZoom # disable <Ctrl><Alt><KP_+>/<KP_-> (resolution switching)
EndSection

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

Section "Monitor"
   Identifier "monitor1"
   VendorName "Plug'n Play"
   ModelName "LG ULTRAWIDE"
   HorizSync 30-90
   VertRefresh 56-75
    
   # Monitor supported modeline (75.0 Hz vsync, 83.9 kHz hsync, ratio 2.37, 81 dpi)
   ModeLine "2560x1080" 228.25 2560 2608 2640 2720 1080 1083 1093 1119 -hsync +vsync
    
   # Monitor preferred modeline (60.0 Hz vsync, 66.6 kHz hsync, ratio 2.37, 81 dpi)
   ModeLine "2560x1080" 181.25 2560 2608 2640 2720 1080 1083 1093 1111 -hsync +vsync
    
   # 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
EndSection

Section "Device"
   Identifier "device1"
   BoardName "ATI Volcanic Islands and later (amdgpu/fglrx)"
   Driver "amdgpu"
   Option "DPMS"
   Option "TearFree" "true"
EndSection

Section "Screen"
   Identifier "screen1"
   Device "device1"
   Monitor "monitor1"
   DefaultColorDepth 24
EndSection

Section "ServerLayout"
   Identifier "layout1"
   Screen "screen1"
EndSection

Also, I added the file /etc/modprobe.d/amd.conf with the following content:

blacklist radeon
options amdgpu cik_support=1
options amdgpu si_support=1
options radeon cik_support=0
options radeon si_support=0

After that, I did a depmod -a and rebuilt the image with Dracut. I made sure the nokmsboot option was taken off the grub options. I restarted and that was it!, the GPU was working but Darktable was still not able to use the GPU for processing.

Install the AMDGPU PRO Modules

I went to the AMD website and downloaded the drivers of the RX 480 for CentOS 8. The website gave me a tarball and within there were a lot of RPMs. I extracted those RPMs.

After a long fail and try, I found that by installing only these RPMs it was enough:

  • opencl-orca-amdgpu-pro-icd-20.30-1109583.el8
  • libgl-amdgpu-pro-ext-20.30-1109583.el8
  • libgl-amdgpu-pro-20.30-1109583.el8
  • libdrm-amdgpu-2.4.100-1109583.el8
  • libegl-amdgpu-pro-20.30-1109583.el8
  • libgles-amdgpu-pro-20.30-1109583.el8
  • libdrm-amdgpu-common-1.0.0-1109583.el8
  • clinfo-amdgpu-pro-20.30-1109583.el8
  • ocl-icd-amdgpu-pro-20.30-1109583.el8
  • opencl-amdgpu-pro-20.30-1109583.el8

Finding what RPM's to install and which ones not to took me a few hours.

After that, X didn't start. I found that one of these RPMs (not sure which one) installed the /etc/ld.conf.so.d/10-amdgpu-pro-x86_64.conf with the following content:

/opt/amdgpu-pro/lib64

So I removed that file and run ldconfig. X started to run again, but Darktable still didn't work properly.

Tell X.Org to use the AMDGPU PRO

This was an easy one, I just used the LD_LIBRARY_PATH=/opt/amdgpu-pro/lib64, for example:

LD_LIBRARY_PATH=/opt/amdgpu-pro/lib64 darktable-cltest -d opencl

And I saw a successful test. I just edited the menu entry in my KDE environment and that was it.

Good luck!

";