OptiScaler icon indicating copy to clipboard operation
OptiScaler copied to clipboard

FSR4 Support For Linux

Open Astyyyyy opened this issue 9 months ago • 35 comments

It was already discussed a bit in the FSR4 Support? thread, but I wanted to upload logs and have Linux use be a seperate thread.

I'm running Fedora 41 with latest kernel 6.13.5, latest mesa 25, and latest firmware and using proton experimental. My 9070 XT works as it should.

In Kingdom Come Deliverance 2 I loaded optiscaler by renaming the dll to dxgi.dll loading it for the game with the laucnh command WINEDLLOVERRIDES="dxgi=n,b"

Optiscaler shows up correctly in the game, however when I choose FSR3.X I can't select FSR4 from the FSR version dropdown.

FSR4update is set to true in the ini

Wine prefix is set to windows 11, but that didn't help (Reports of issues on windows 10 made me attempt this)

Below are my Optiscaler log and Proton Log. (I had to delete the latter part of the optiscaler log as I played for only 5 minutes but the file got over 160 MB and it wouldn't let me upload. Hopefully not the whole thing is needed to diagnose.) - Willow of the wisp

Optiscaler.log Proton.log

Astyyyyy avatar Mar 12 '25 20:03 Astyyyyy

also have my own testing with cyberpunk 2077, on cachyos linux-cachyos 6.13.6-2 mesa-git 25.1.0_devel.203062.e3fdb72a0ee.d41d8cd-1 linux-firmware-git 20250311.b69d4b74-1 wine - proton_tkg_10.3.r1.gc0e113dd (wine upstream with proton)

Launch command for Cyberpunk 2077 - VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/amd_pro_icd32.json:/usr/share/vulkan/icd.d/amd_pro_icd64.json WINEFSYNC=0 WINEESYNC=0 WINEPREFIX=/home/user/Documents/Wine-Prefixes/cisco-app WINEARCH=win64 VKD3D_CONFIG=dxr WINEDLLOVERRIDES="version.dll,winmm.dll,RED4ext.dll,dxgi,amdxc64.dll,wintrust.dll,amdxcffx64.dll=n,b" mangohud .local/share/Steam/compatibilitytools.d/proton_tkg_10.3.r1.gc0e113dd/files/bin/wine /run/media/user/New\ Volume/SteamLibrary/steamapps/common/Cyberpunk\ 2077/bin/x64/Cyberpunk2077.exe

game crashes when it tries to load fsr4, i have amdxc64.dll and amdxcffx64.dll in same folder as exe

OptiScaler.log

cyberpunk-fsr4-testing.log

Astyyyyy avatar Mar 12 '25 20:03 Astyyyyy

FSR4 is not yet supported on Linux.

It will need direct support by Linux drivers and/or something like dxvk-nvapi for AMD.

FSR4 SDK is also not publicly available and it won't be until Q3 or Q4 of this year.

Uklosk avatar Mar 12 '25 20:03 Uklosk

Are you sure about that?

I think I got it working with god of war ragnarok but the UI seems not work anymore on Linux so I can’t confirm.

Also tried with Final fantasy rebirth seems to work.

Hogwarts legacy seems to get stuck in 30-40fps for some odd reason when using optiscaler.

To clarify I created the ini file on windows side and then went to run it on Linux.

https://github.com/cdozdil/OptiScaler/issues/243

gylli251 avatar Mar 12 '25 23:03 gylli251

@gylli251 you sure its not just fsr3.1 running, you need amdxc64.dll and amdxcffx64.dll in game files for optiscaler to find fsr4 on linux from my testing.

Astyyyyy avatar Mar 13 '25 03:03 Astyyyyy

As I said I can’t confirm but I got those DLL from my windows install and put them with the game files yes. I think it’s fsr4 based on quality difference

gylli251 avatar Mar 13 '25 11:03 gylli251

i see, ill see if i can get it working on god of war ragnarok too then

Astyyyyy avatar Mar 13 '25 11:03 Astyyyyy

Hi,

Current flow for Fsr4Update is like this:

  1. amd_fidelityfx_dx12.dll loads amdxc64.dll
  2. Using AmdExtD3DCreateInterface from amdxc64.dll query IAmdExtFfxApi
  3. OptiScaler intercepts this call and returns a custom implementation of IAmdExtFfxApi
  4. amd_fidelityfx_dx12.dll calls UpdateFfxApiProvider method of OptiScaler's custom IAmdExtFfxApi
  5. OptiScaler loads amdxcffx64.dll and returns result of amdxcffx64.dll's UpdateFfxApiProvider method

For testing FSR4 on Linux at least you should put amdxc64.dll and amdxcffx64.dll into game folder so OptiScaler can load and use them.

cdozdil avatar Mar 13 '25 11:03 cdozdil

Thanks @cdozdil.

Do you know if those dlls come bundled with the drivers? For extracting them from Linux.

Uklosk avatar Mar 13 '25 12:03 Uklosk

They are in system32

gylli251 avatar Mar 13 '25 12:03 gylli251

I have found them, they are in the driver package under "Packages/Drivers/Display/WT6A_INF/B413137/"

Uklosk avatar Mar 13 '25 12:03 Uklosk

Hi,

Current flow for Fsr4Update is like this:

1. `amd_fidelityfx_dx12.dll` loads `amdxc64.dll`

2. Using `AmdExtD3DCreateInterface` from `amdxc64.dll` query `IAmdExtFfxApi`

3. OptiScaler intercepts this call and returns a custom implementation of `IAmdExtFfxApi`

4. `amd_fidelityfx_dx12.dll` calls `UpdateFfxApiProvider` method of OptiScaler's custom `IAmdExtFfxApi`

5. OptiScaler loads `amdxcffx64.dll` and returns result of `amdxcffx64.dll`'s `UpdateFfxApiProvider` method

For testing FSR4 on Linux at least you should put amdxc64.dll and amdxcffx64.dll into game folder so OptiScaler can load and use them.

I did a quick test with Hogwarts Legacy:

[13:46:29.982428] [D] FfxApiProxy::InitFfxDx12 Loading amd_fidelityfx_dx12.dll methods [13:46:29.982438] [I] FfxApiProxy::InitFfxDx12 Trying to load Z:\home\user.local\share\Steam\steamapps\common\Hogwarts Legacy\Phoenix\Binaries\Win64\amd_fidelityfx_dx12.optidll [13:46:29.982450] [I] LoadLibraryCheckW Internal dll load call: z:\home\user.local\share\steam\steamapps\common\hogwarts legacy\phoenix\binaries\win64\amd_fidelityfx_dx12.dll [13:46:29.984734] [I] FfxApiProxy::InitFfxDx12 LoadResult: true [13:46:29.984752] [I] FfxApiProxy::VersionDx12 FfxApi Dx12 version: 3.1.3 [13:46:29.984773] [D] hkGetProcAddress Trying to get process address of CreateDXGIFactory [13:46:29.984892] [I] CheckForGPU Adapter: AMD Radeon Graphics (RADV GFX1201), VRAM: 16304 MB [13:46:29.984907] [I] CheckForGPU Fsr4Update: false

With mesa main branch built yesterday.

Uklosk avatar Mar 13 '25 12:03 Uklosk

Hi,

First try setting Fsr4Update=true from OptiScaler.ini.

If game crashes copy D3D12_Optiscaler folder in OptiScaler archive to games exe folder and set FsrAgilitySDKUpgrade=true in OptiScaler.ini and try again.

cdozdil avatar Mar 13 '25 13:03 cdozdil

I found that i needed to go into windows boot the game, use the UI to configure the ini file correctly then go back into linux and boot the game with that ini.

gylli251 avatar Mar 13 '25 13:03 gylli251

Hi,

First try setting Fsr4Update=true from OptiScaler.ini.

If game crashes copy D3D12_Optiscaler folder in OptiScaler archive to games exe folder and set FsrAgilitySDKUpgrade=true in OptiScaler.ini and try again.

EDIT: NVM I replaced the ini by mistake with the original, sorry for the confusion, will test again.

Uklosk avatar Mar 13 '25 13:03 Uklosk

Here is the log after setting those to true and upscaling method to fsr31, the game crashes.

[14:33:17.364587] [D] NVSDK_NGX_DLSS_GetStatsCallback NVSDK_NGX_DLSS_GetStatsCallback [14:33:17.389880] [D] NVNGX_Parameters::getT ('RayReconstruction.Hint.Render.Preset.DLAA', FAIL) [14:33:17.389933] [D] NVNGX_Parameters::getT ('RayReconstruction.Hint.Render.Preset.Quality', FAIL) [14:33:17.389948] [D] NVNGX_Parameters::getT ('RayReconstruction.Hint.Render.Preset.Balanced', FAIL) [14:33:17.389961] [D] NVNGX_Parameters::getT ('RayReconstruction.Hint.Render.Preset.Performance', FAIL) [14:33:17.389974] [D] NVNGX_Parameters::getT ('RayReconstruction.Hint.Render.Preset.UltraQuality', FAIL) [14:33:17.389988] [D] NVNGX_Parameters::getT ('RayReconstruction.Hint.Render.Preset.UltraPerformance', FAIL) [14:33:17.390004] [I] NVSDK_NGX_D3D12_CreateFeature HandleId: 1000000 [14:33:17.390016] [D] NVNGX_Parameters::getT ('DLSSEnabler.Available', FAIL) [14:33:17.390027] [D] NVNGX_Parameters::getT ('DLSSEnabler.Logging', FAIL) [14:33:17.390039] [D] NVNGX_Parameters::getT ('DLSSEnabler.Dx12Backend', FAIL) [14:33:17.390050] [I] NVSDK_NGX_D3D12_CreateFeature DLSS Enabler does not set any upscaler using ini: fsr31 [14:33:17.390063] [I] NVSDK_NGX_D3D12_CreateFeature upscalerChoice: 4 [14:33:17.390091] [I] IFeature::SetHandle Handle: 1000000 [14:33:17.390107] [I] IFeature::SetInitParameters Render Resolution: 853x480, Display Resolution 2560x1440, Quality: 3 [14:33:17.390118] [I] FSR31FeatureDx12::FSR31FeatureDx12 amd_fidelityfx_dx12.dll methods loaded! [14:33:17.390130] [I] NVSDK_NGX_D3D12_CreateFeature creating new FSR 3.X feature [14:33:17.390142] [D] FSR31FeatureDx12::Init FSR31FeatureDx12::Init [14:33:17.390157] [I] AmdExtFfxApi::UpdateFfxApiProvider UpdateFfxApiProvider called [14:33:17.390175] [I] AmdExtFfxApi::UpdateFfxApiProvider UpdateFfxApiProvider called [14:33:17.390194] [I] FSR31FeatureDx12::InitFSR3 contextDesc.initFlags (DepthInverted) 1000 [14:33:17.390205] [I] FSR31FeatureDx12::InitFSR3 contextDesc.initFlags (AutoExposure) 101000 [14:33:17.390216] [I] FSR31FeatureDx12::InitFSR3 contextDesc.initFlags (HDR) 101001 [14:33:17.390228] [I] FSR31FeatureDx12::InitFSR3 contextDesc.initFlags (!LowResMV) 101011 [14:33:17.390238] [D] FSR31FeatureDx12::InitFSR3 _createContext! [14:33:17.390250] [I] AmdExtFfxApi::UpdateFfxApiProvider UpdateFfxApiProvider called

Uklosk avatar Mar 13 '25 13:03 Uklosk

Could you send whole log?

cdozdil avatar Mar 13 '25 13:03 cdozdil

Could you send whole log?

Yes, here you have it:

OptiScaler.zip

Uklosk avatar Mar 13 '25 14:03 Uklosk

with_amdxc64.dll.log

without_amdxc64.dll.log

If it helps here are two logs, when i put the amdxc64.dll into the folder it crashes on boot. without it runs fine it seems. will be able to confirm with UI working.

god of war ragnarok newest optiscaler version

gylli251 avatar Mar 13 '25 14:03 gylli251

Have you done this?

If game crashes copy D3D12_Optiscaler folder in OptiScaler archive to games exe folder and set FsrAgilitySDKUpgrade=true in OptiScaler.ini and try again.

cdozdil avatar Mar 13 '25 14:03 cdozdil

Have you done this?

If game crashes copy D3D12_Optiscaler folder in OptiScaler archive to games exe folder and set FsrAgilitySDKUpgrade=true in OptiScaler.ini and try again.

Yes:

Image

Uklosk avatar Mar 13 '25 14:03 Uklosk

According to logs Agility SDK not used/called. Not sure if this is the reason of crash but games crash on Windows 10 without Agility SDK too. Feels similar.

cdozdil avatar Mar 13 '25 14:03 cdozdil

from a proton log game seems to crash at this line (game tested was panicore) 4083.475:0134:01ec:fixme:x11drv:X11DRV_D3DKMTQueryAdapterInfo desc 0x2fad7250, type 1 stub

might make a issue on proton git about it see if they can help

steam-2695940.log

Astyyyyy avatar Mar 13 '25 14:03 Astyyyyy

https://github.com/ValveSoftware/Proton/issues/8519 made the issue, hopefully proton devs can help out

Astyyyyy avatar Mar 13 '25 15:03 Astyyyyy

I don't think it's the problem. Maybe Wine/Proton does not support Agility SDK stuff required by FSR4.

cdozdil avatar Mar 13 '25 15:03 cdozdil

I got some more logs from proton with more testing. maybe this helps.

wine: Unhandled page fault on read access to 0000000000001060 at address 00006FFFF3FB1371 (thread 0178), starting debugger... 1755.012:0128:0174:err:vkd3d-proton:vkd3d_dxil_log_callback: dxil-spirv: Unsupported AGS magic instruction 0x29 (immediate 0). 1755.012:0128:0174:err:vkd3d-proton:vkd3d_dxil_log_callback: dxil-spirv: Failed DXIL opcode 79. 1755.012:0128:0174:err:vkd3d-proton:vkd3d_dxil_log_callback: dxil-spirv: Failed to emit instruction. 1755.012:0128:0174:err:vkd3d-proton:vkd3d_dxil_log_callback: dxil-spirv: Failed to convert function. 1755.013:0128:0174:warn:vkd3d-proton:vkd3d_compile_shader_stage: Failed to compile shader, vkd3d result -3. 1755.013:0128:0174:warn:vkd3d-proton:d3d12_pipeline_state_init_compute: Failed to create Vulkan compute pipeline, hr 0x80070057.

BACKTRACE: 0x006ffff3fb1371 in d3d12core (+0x1d1371) 1 0x006ffff2c19f53 in amdxcffx64 (+0x39f53) 2 0x006ffff2c17724 in amdxcffx64 (+0x37724) 3 0x006ffff2bf73b7 in amdxcffx64 (+0x173b7) 4 0x006ffff2be1e71 in amdxcffx64 (+0x1e71) 5 0x006ffffbb80d0e in dxgi (+0x50d0e)

to confirm the DLL are loaded without errors:

012c:trace:loaddll:build_module Loaded L"Z:\mnt\gamedisk\SteamLibrary\steamapps\common\God of War Ragnarok\amdxc64.dll" at 00006FFFF6010000: native 012c:trace:loaddll:build_module Loaded L"Z:\mnt\gamedisk\SteamLibrary\steamapps\common\God of War Ragnarok\amdxcffx64.dll" at 00006FFFF2BE0000: native

i get the same error as imapotatook: 012c:fixme:x11drv:X11DRV_D3DKMTQueryAdapterInfo desc 0x41f098, type 1 stub

I think it more likely to be the AGS stuff not supported by vkd3d-proton right?

maybe we should make an issue there instead.

fyi: https://github.com/ValveSoftware/Proton/issues/8519

gylli251 avatar Mar 13 '25 23:03 gylli251

As I thought, no FSR4 on Linux until AMD support or someone reverse engineers it:

https://github.com/HansKristian-Work/vkd3d-proton/issues/2398#issuecomment-2724582035

Let's hope AMD fixes their shit soon.

Uklosk avatar Mar 14 '25 13:03 Uklosk

Okay, so it seems VKD3D is finishing the work and mesa hacks are already underway. Maybe Mesa 25.1 will support fp8?

Lawstorant avatar May 02 '25 11:05 Lawstorant

Haha Great Success! Control + FSR4 + OptiFG with Hud Fix 1... On Linux!

Screenshot

Image

Lawstorant avatar May 02 '25 12:05 Lawstorant

  1. amd_fidelityfx_dx12.dll loads amdxc64.dll

Unfortunately this doesn't work in games like Frostpunk 2 where they actually utilise FidelityFX (AMD sponsorship). In this case, replacing the DLL with Optiscaler's bundled copy causes visual errors on terrain while using the one bundled with the game simply crashes (FSR4 or no). On the beta that was just released for the game it crashes in both instances.

R1chterScale avatar May 02 '25 21:05 R1chterScale

Check this ini option.

; Override path of amd_fidelityfx_dx12.dll
; Example - C:\Program Files\Rockstar Games\Grand Theft Auto V Enhanced\Altdll\amd_fidelityfx_dx12.dll
; Default (auto) is same folder as mod dll 
FfxDx12Path=auto

cdozdil avatar May 03 '25 08:05 cdozdil