protonscr

GPU usage under 30% [nvapi issue]

protonclosed
ValveSoftware/Proton#1374 · opened 2018-09-10 by ghost · updated 2020-04-09 · 33 comments · github
?ghost 2018-09-10 github

When I open a native linux game my GPU works perfectly and will max performance.
Opening a game using steamplay, eveen if it appears to work flawlessly will run with low framerate, and GPU usage won't go over ~30%

Kernel: 4.15.0-33-generic
GPU: GTX 1070
CPU: i7-7700K
Proton: 3.7-6 beta (tried both latest and beta versions)
Driver: 396

@doitsujin Happens with every steamplay game I have, literally any that actually work gpu doesn't go over 30%

Ddoitsujin 2018-09-10 github

Without knowing which games you are testing, it is going to be a bit hard to determine the cause.

TTk-Glitch 2018-09-10 github

And also what GPU drivers were used.

Lliberodark 2018-09-11 github

Ok change your kernel is better with 4.18 !

Lliberodark 2018-09-11 github

The better is try with other linux you have ubuntu ?
Try Solus / Manjaro !

?ghost 2018-09-11 github

@liberodark I'm not changing my distro. ubuntu is the recommended OS and I'm using KDE neon.
I've been looking at the other threads it looks like it's an issue with nvapi and nvapi64. I've been trying to figure out how to disable them without compiling proton from source.

Aaqxa1 2018-09-12 github

If it's an nvapi issue, try creating a file named dxvk.conf and put it in the game's directory (the one that includes the main .exe file) with the following lines:
dxgi.customDeviceId = E366
dxgi.customVendorId = 1002

It will inform the game that your card is an AMD card, and disable the nvapi code path.

You should also make sure your 396 drivers are actually 396.54 or greater.

?ghost 2018-09-12 github

@thirdeyefunction I gave it a shot but nvapi is still called on, also yes I made sure what driver I'm using per protons recommendations for even installing it. I made sure to tick all the boxes.

Kkisak-valve maintainer 2018-09-12 github

@TheVampkid, please give concrete examples of which games are affected, preferably with proton logs.

?ghost 2018-09-12 github

It happens with all of them, but I've been testing with Dishonored. Here's my latest dishonored test
steam-205100.log
Tried with Deep Rock Galactic. like here #284
logs are too big to attach here.

Kkisak-valve maintainer 2018-09-12 github

As guessed, there's a lot of failed nvapi calls there. There are some other games trying to use nvapi that many have workarounds in the issue reports.

?ghost 2018-09-12 github

Yeah I did a ton of research after lieff mentioned the other thread. I'm certain it's the nvapi. I just don't get why the fake AMD method doesn't change anything.
would making a fake dll work? I don't have wine installed so I'd have to install it first.

Aaqxa1 2018-09-12 github

Dishonored is a D3D9 game so the AMD card override won't work (since DXVK does not support D3D9). There are ways to set an AMD card with wined3d, but I'm not sure of the specifics off the top of my head.

Aaqxa1 2018-09-12 github

The game breaks on my Nvidia card (possibly WM/fullscreen problems) so I can't test this myself but here's a reg file that may fix the problem for you:

dishonored_fake_amd_card.zip

It just applies the same changes as the fake amd card workaround for DXVK, but for wined3d instead.

You can apply it by running:
WINEPREFIX="steam library location"/steamapps/compatdata/205100/pfx regedit "reg file"

Replace "steam library location" and "reg file" with the corresponding location and the file I attached.

Ppchome 2018-09-12 github

@TheVampkid

would making a fake dll work?

You can try following hack:

  • copy 32bit nv*.dll.so files from wine-staging to .../Proton 3.7 Beta/dist/lib/wine/nvapi/ as *.dll
  • copy 64bit nv*.dll.so files from wine-staging to .../Proton 3.7 Beta/dist/lib64/wine/nvapi/ as *.dll
  • copy this proton-nvapi.patch.txt to .../Proton 3.7 Beta/
  • run $ patch -p1 < proton-nvapi.patch.txt in .../Proton 3.7 Beta/ directory
  • add "PROTON_USE_NVAPI": "1", to user_settings.py (copy user_settings.sample.py first, if no such file)

Now you have nvapi and able to switch it on and off.

According to PCGamingWiki Dishonored using PhysX, so you can even try to setup GPU PhysX mode. Also you may want install PhysX using $ winetricks physx (somehow).

Please note: this hack mostly copy dxvk related code and behaviour in proton, not tested further than 1st run. So use it at your own risk.

EDIT: Ok, I can confirm GPU PhysX can work using this hack and winetricks.
physx-proton
physx-proton_s

Wwhizse 2018-09-13 github

Carmageddon Max Damage #927 is another game with a similar problem. Low performance with Proton or regular Wine, good performance if nvapi stubs are used.

Disabling nvapi or faking an AMD card showed no difference for me.

Ppchome 2018-09-13 github

BTW: https://github.com/ValveSoftware/Proton/issues/165#issuecomment-421037376 - how to build nvapi separately from wine.

IMHO this two issues are similar, can be combined into one "nvapi problem" issue.

Ddragonfly-lover 2018-09-18 github

@doitsujin Tekken 7 and redout are both ue4 games that performs at 50% of Windows counterpart for a given hardware. How Can we verify if the problem resides in nvapi?

Ddoitsujin 2018-09-18 github

@dragonfly-lover have you tried the suggestion in this comment: https://github.com/ValveSoftware/Proton/issues/1374#issuecomment-420479640

I'm seriously considering reporting all Nvidia cards as AMD cards by default in order to work around these issues.

Ddragonfly-lover 2018-09-18 github

@doitsujin you are my Hero! After the treatment you suggested redout goes very Speedy even at Epic settings for most parameters! It seriously perform close to Windows counterpart. Unfortunately the same treatment has no luck for Tekken 7, which runs at 25-35 FPS anyway, far less than similar hardware under win10.

?ghost 2018-09-19 github

@pchome I only see this in wine-staging

@ ~/git/wine-staging$ tree |grep nvapi
│   ├── nvapi-Stub_DLL
│   │   ├── 0001-nvapi-First-implementation.patch
│   │   ├── 0002-nvapi-Add-stubs-for-NvAPI_EnumLogicalGPUs-and-undocu.patch
│   │   ├── 0003-nvapi-Add-NvAPI_GetPhysicalGPUsFromLogicalGPU.patch
│   │   ├── 0004-nvapi-Add-stub-for-NvAPI_EnumPhysicalGPUs.patch
│   │   ├── 0005-nvapi-Add-stubs-for-NvAPI_GPU_GetFullName.patch
│   │   ├── 0006-nvapi-Explicity-return-NULL-for-0x33c7358c-and-0x593.patch
│   │   ├── 0007-nvapi-Add-stub-for-NvAPI_DISP_GetGDIPrimaryDisplayId.patch
│   │   ├── 0008-nvapi-Add-stub-for-EnumNvidiaDisplayHandle.patch
│   │   ├── 0009-nvapi-Add-stub-for-NvAPI_SYS_GetDriverAndBranchVersi.patch
│   │   ├── 0010-nvapi-Add-stub-for-NvAPI_Unload.patch
│   │   ├── 0011-nvapi-Add-stub-for-NvAPI_D3D_GetCurrentSLIState.patch
│   │   ├── 0012-nvapi-tests-Use-structure-to-list-imports.patch
│   │   ├── 0013-nvapi-Add-stub-for-NvAPI_GetLogicalGPUFromDisplay.patch
│   │   ├── 0014-nvapi-Add-stub-for-NvAPI_D3D_GetObjectHandleForResou.patch
│   │   ├── 0015-nvapi-Add-stub-for-NvAPI_D3D9_RegisterResource.patch
│   │   ├── 0016-nvapi-Improve-NvAPI_D3D_GetCurrentSLIState.patch
│   │   ├── 0017-nvapi-Implement-NvAPI_GPU_Get-Physical-Virtual-Frame.patch
│   │   ├── 0018-nvapi-Add-stub-for-NvAPI_GPU_GetGpuCoreCount.patch
│   │   ├── 0019-nvapi-Implement-NvAPI_D3D11_SetDepthBoundsTest.patch
│   │   ├── 0020-nvapi-Implement-NvAPI_D3D11_CreateDevice-and-NvAPI_D.patch

Ppchome 2018-09-19 github

@TheVampkid
I mean already installed wine (staging) from your distribution (or wherever else), where all those patches applied and built into nv*.dll.so.

Or, if you lucky enough, you can try to build them manually, like described here: https://github.com/pchome/wine-playground/tree/master/nvapi

Ddarkpumpkins 2018-09-23 github

@doitsujin @dragonfly-lover ok i found interesting results in my investigations.
I did also encountered some low performances on Tekken 7 with my core i5 -2500k and my gtx 970.
Outside steam linux, on a wine 3.16 staging + dxvk 0.63 i reached 60fps with almost all ultra presents into graphics settings. I did investigate with the dxvk.conf and i was able to run the game the steam speed with steam proton.

We do not have to put the dxvk.conf into : steamapps/common/TEKKEN 7
but into : steamapps/common/TEKKEN 7/TekkenGame/Binaries/Win64

Ddragonfly-lover 2018-09-29 github

@doitsujin i don't know what happened but on Proton 3.7.7 nvapi issue has a worsening. I have redout that is again fallen down to 0-10fps (note that this time It also happens WITH the fake AMD card in dxvk.conf) and now also Tekken 7 is fallen to less then 10fps. Please help me. Only reverting back to 3.7.6 keeps games playable.

Ddavernos 2018-10-24 github

I've been trying the AMD Spoofing method on Tekken 7, but it's not getting any FPS improvement.
Latest stable (non beta) Steam client, Nvidia GTX 970, Ubuntu 18.10.

Ddarkpumpkins 2018-10-24 github

@davernos with the lastest proton version you need to specify the dxvk.conf path throught env var DXVK_CONFIG_FILE. Here is my launch option in steam.

DXVK_CONFIG_FILE="%path to your dxvkfile" %command%
I had a GTX 970 with core i5 2500k and i was able to reach 60fps most of the time.

Ddavernos 2018-10-24 github

I'm using the same launch options. Are you using % in the path to the .conf file? Maybe its just not reading the file. I had a little suspicion about that being the issue. Other variables like PROTON_LOG are working OK.

Also, have you tried the performance on the "Arctic Snowfall" stage?

Ddarkpumpkins 2018-10-24 github

No, my bad, there is not '%' in my path. Only the path of my dxvk file without quote or '%'.
I was running something like 50fps on that stage, now i'm having a 1070 ti and i'm having 55fps.

my whole option :
DXVK_CONFIG_FILE=/home/my_user_name/jeuxLinux/linkWineSteam/dxvk.conf %command%

with the following content into the dxvk.conf :
dxgi.customDeviceId = E366
dxgi.customVendorId = 1002

Ddavernos 2018-10-24 github

Ok, that's exactly my config, so that's not the problem.

1070ti and 55fps is pretty bad.
60 solid fps is a must on fighting games :(

Thanks a lot for answering @darkpumpkins ! :)

Ppchome 2018-10-24 github

I'm using nvapi w/o dx11 for a while.
Surely requires more testing, but no fps drops noticed using DXVK. + working PhysX using wined3d (dx9).

Mmassatt212 2018-12-10 github

When i use the AMD Card Hack game wont even launch justwont start

Kkisak-valve maintainer 2018-12-10 github

Hello @massatt212, please post game-specific issues with the game you are referencing. Your comment lacks context (and a proton log) here.

Ddragonfly-lover 2018-12-10 github

After Proton 3.16-4 all Nvidia cards are reported as AMD. This solves the nvapi issues for me in Redout, carmageddon max damage and a flame in the flood (all ue4 games).