[SOLVED] dGPU is not used with java on Linux in my case Minecraft or more precisely the CurseForge Launcher

Edit:
The solution is in third post

Hi,

I’m a bit annoyed by the topic.
I’ve already searched the internet for a solution, but I can’t get any further.

A little more to start with… Yes, I did the installation according to the instructions from here made! And the dGPU also works quite well with steam :smiley:

About the system:
Ubuntu 22.04.04 LTS
Kernel 6.5.0-1018-oem

syscrash@framework16:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.4 LTS
Release:	22.04
Codename:	jammy
syscrash@framework16:~$ java --version
openjdk 11.0.22 2024-01-16
OpenJDK Runtime Environment (build 11.0.22+7-post-Ubuntu-0ubuntu222.04.1)
OpenJDK 64-Bit Server VM (build 11.0.22+7-post-Ubuntu-0ubuntu222.04.1, mixed mode, sharing)

Linux Framework16 6.5.0-1018-oem #19-Ubuntu SMP PREEMPT_DYNAMIC Thu Mar 14 21:40:46 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

I’ve tried the following so far:

  1. Start the CurseForge launch using
    "DRI_PRIME=1 "
    “DRI_PRIME=1!” # why is that! at the end? I read this in the forum in connection with steam here and also tried it out. On Steam, the version with an exclamation mark works for me.

  2. Start java using a script in the Minecraft Launcher options
    The script is from here.
    I tried both variants.

#!/bin/sh
DRI_PRIME=1 exec /usr/bin/java "$@"

and

#!/bin/sh
export DRI_PRIME=1
exec java "$@"
  1. Use another launcher (MultiMC5) that directly supports dGPU, such as steam.
    Here I failed to import the profile I had previously installed in CurseForge and gave up in frustration and am now writing to you in the hope of a solution

  2. Oh, I also tried to deactivate the internal graphics using the bios, but failed because of the missing option in the bios :frowning:

The output of “vulkaninfo | grep “GPU[0123]” -A 10” gives

syscrash@Framework16:~$ vulkaninfo |  grep "GPU[0123]" -A 10
WARNING: [Loader Message] Code 0 : terminator_CreateInstance: Failed to CreateInstance in ICD 0. Skipping ICD.
GPU0:
VkPhysicalDeviceProperties:
---------------------------
    apiVersion = 4206847 (1.3.255)
    driverVersion = 96477185 (0x5c02001)
    vendorID = 0x1002
    deviceID = 0x15bf
    deviceType = PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU
    deviceName = AMD Unknown (RADV GFX1103_R1)
    pipelineCacheUUID = e75ab6b8-f0a3-6b04-20f4-e8b7f1c24530

--
GPU1:
VkPhysicalDeviceProperties:
---------------------------
    apiVersion = 4206847 (1.3.255)
    driverVersion = 1 (0x0001)
    vendorID = 0x10005
    deviceID = 0x0000
    deviceType = PHYSICAL_DEVICE_TYPE_CPU
    deviceName = llvmpipe (LLVM 15.0.7, 256 bits)
    pipelineCacheUUID = 32332e32-2e31-2d31-7562-756e7475332e

--
GPU2:
VkPhysicalDeviceProperties:
---------------------------
    apiVersion = 4206847 (1.3.255)
    driverVersion = 96477185 (0x5c02001)
    vendorID = 0x1002
    deviceID = 0x7480
    deviceType = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
    deviceName = AMD Unknown (RADV GFX1102)
    pipelineCacheUUID = e10a6cab-7e01-d585-a6dc-927c1b1fd8cd

Why is my dGPU called “deviceName = AMD Unknown (RADV GFX1102)” instead of “AMD Radeon RX 7700S (RADV NAVI33)”?

When I search, I keep coming across the tip that I should set it under “Windows” in the graphics card settings so that this or that program should be tested with the dGPU… that of course doesn’t help me under Linux, nor this tip is almost always suggested in conjunction with an Nvidia and not for an AMD Radeon.

Is there something like this for Linux too? I read somewhere that there should be something like this in the XServer settings.

For example, I would also like to run other programs with the dGPU, for example my FreeCAD or the slicer for my 3D printer or GIMP simply where graphics and rendering of 3D images or video editing are involved.

Why doesn’t the system recognize that the CPU is running at 100 °C and switches to the dGPU instead of staying on the iGPU?

I’m attaching a few more pictures, if any data is still missing, please let me know.

PS: I’ve been using Linux (with a long break from Apple) for years (1999) only Debian or Gentoo and not Ubuntu, I’ve got that down for now so that it doesn’t fail because of something fundamental, I’m a bit rusty after all that years Mac OS X :wink:

When I inserted the script here as described on the website, I always got the same error when I tried to start Minecraft. I tried it with and without hooks.

The error message:

Here I tried to insert the line “DRI_PRIME=1 %command%” in all variations into the line, which had no effect.

No matter what I tried, it was always unsuccessful, even starting the entire launcher via the console, which showed that Java was supposedly using the dGPU, the iGPU remained active and the CPU briefly heated up to 100 ° C and then went to 70 -80 °C down.

And via console

I looked everywhere where I could update this database, but I finally went back to the root and updated it manually.
Current database on Github

The file must go to “/usr/share/libdrm/amdgpu.ids”

GPU0:
VkPhysicalDeviceProperties:
---------------------------
	apiVersion        = 4206847 (1.3.255)
	driverVersion     = 96477185 (0x5c02001)
	vendorID          = 0x1002
	deviceID          = 0x15bf
	deviceType        = PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU
	deviceName        = AMD Radeon 780M (RADV GFX1103_R1)
	pipelineCacheUUID = e75ab6b8-f0a3-6b04-20f4-e8b7f1c24530

--
GPU1:
VkPhysicalDeviceProperties:
---------------------------
	apiVersion        = 4206847 (1.3.255)
	driverVersion     = 1 (0x0001)
	vendorID          = 0x10005
	deviceID          = 0x0000
	deviceType        = PHYSICAL_DEVICE_TYPE_CPU
	deviceName        = llvmpipe (LLVM 15.0.7, 256 bits)
	pipelineCacheUUID = 32332e32-2e31-2d31-7562-756e7475332e

--
GPU2:
VkPhysicalDeviceProperties:
---------------------------
	apiVersion        = 4206847 (1.3.255)
	driverVersion     = 96477185 (0x5c02001)
	vendorID          = 0x1002
	deviceID          = 0x7480
	deviceType        = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
	deviceName        = AMD Radeon RX 7700S (RADV GFX1102)
	pipelineCacheUUID = e10a6cab-7e01-d585-a6dc-927c1b1fd8cd

In the meantime I also found out that choosing the CPU instead of the dGPU seems to be a BUG in Minecraft, but I’m still looking for a solution and am also following the other post here in the forum.

OK, I’ve solved it now!

The key was to leave the line unchanged, as it says in the Frame.work documentation, so leave it at “DRI_PRIME=1” even if with “vulkaninfo | grep “GPU[0123]” -A 10” the dGPU is the GPU2!
BUT !!!
I’ve expanded another thing, and it’s exactly the same in the documentation :rofl: I start it with this command:

DRI_PRIME=1 DXVK_FILTER_DEVICE_NAME="AMD Radeon RX 7700S (RADV NAVI33)" AppImage/CurseForge-0.244.4-16117.AppImage

In this example, the CurseForge client as an AppImage.

But it also works using a script, directly in the Minecraft starter as a Java path in the settings:

#!/bin/sh
DRI_PRIME=1 DXVK_FILTER_DEVICE_NAME="AMD Radeon RX 7700S (RADV NAVI33)" exec java "$@"

I just wanted to add this in case anyone else is having this problem with Minecraft.

Oh, by the way, it doesn’t matter whether the line is like this:

DRI_PRIME=1 DXVK_FILTER_DEVICE_NAME="AMD Radeon RX 7700S (RADV NAVI33)" AppImage/CurseForge-0.244.4-16117.AppImage

or something like this:

DRI_PRIME=1 DXVK_FILTER_DEVICE_NAME="AMD Radeon RX 7700S (RADV GFX1102)" AppImage/CurseForge-0.244.4-16117.AppImage

Both variants work, although my graphics card is called “GFX1102” in the new amdgpu.ids, it also works as “NAVI33”. The first part “AMD Radeon RX 7700S” is probably the crucial one.

Here are the pictures:
Start with the console with correct amdgpu.ids and wrong name of the dGPU (RADV GFX1102) instead of (RADV NAVI33) the dGPU is still used.

Start with the console with correct amdgpu.ids and correct name of the dGPU (RADV GFX1102) the dGPU is used.

Start with the console with incorrect (original) amdgpu.ids and unknown name of the dGPU, here too the dGPU is used again.

Then I documented the start using a script and the dGPU is also used correctly here:

I hope I could help :grin:

2 Likes

Hey thanks for posting this, as someone who just googled to figure out how to start curseforge on my framework 16!

1 Like

Just FYI, the default drivers on my Ubuntu install showed 3 GPU’s, and it sounds like yours does too. One discrete, one integrated and then one cpu emulated. After I installed the AMD drivers from the official page I only see two, like the documents mentioned and everything seems to work OK. YMMV.