Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Universal toggles for Feral GameMode and Prime Render Offload #326

Closed
TheRealDannyBoy opened this issue Dec 3, 2019 · 15 comments

Comments

@TheRealDannyBoy
Copy link

These are two features that most users would probably want enabled for all of their games. If each had a simple switch in settings, such as Lutris has, applying these settings would be much less tedious. Another toggle in game properties could allow controlling these settings on a game-by-game basis.

@OvermindDL1
Copy link

What are these two settings? I've not run across them before.

@TheRealDannyBoy
Copy link
Author

PRIME Render Offload is a technology that allows users with NVIDIA Optimus switchable graphics to render individual applications with the NVIDIA GPU on demand instead of having to choose to render the entire display with either the Intel or NVIDIA GPU. Feral GameMode allows a set of CPU optimizations to be applied on demand to a specific game process.

Here's a screenshot of the options in Lutris:
image

@OvermindDL1
Copy link

Ah, thanks for the description, that would be why I'd not heard of it as I don't run nvidia due to lacking driver quality (used to be good 5+ years ago...).

If such things are added they definitely need to be explained in-gui, so people know what they do and what they are for.

@TheRealDannyBoy
Copy link
Author

Us laptop users don't have much of a choice with regards to GPU when it comes to gaming. An explanation in GUI, even a tooltip, would be welcome indeed.

@Hedronmx
Copy link

Hedronmx commented Jan 5, 2020

Having gamemode activation would be a treat! I am struggling to run it with gamehub since putting the command on the argument section is not working.

@tkashkin
Copy link
Owner

tkashkin commented Jan 9, 2020

I'm thinking about removing current compatibility tool options (checkboxes in compatibility options dialog) and implementing Tweaks instead.

It should work similarly to how additional DOSBox configs currently work: GameHub would ship built-in Tweaks as json files, packagers and users can add own tweaks by creating files in data dirs or in UI.


I'm still thinking about details and possible implementation, that's how I see it now:

  • Tweaks should be able to set environment variables
  • Tweaks should be able to override command line same way it's currently possible in game properties
  • Global list of tweaks will be applied to all games automatically if game doesn't have specific tweaks configured
Example of some of built-in tweaks

/usr/share/com.github.tkashkin.gamehub/tweaks/gamemode.json

{
	"id": "gamemode",
	"name": "GameMode",
	"description": "Temporarily apply a set of optimizations to a game process and OS. Requires Feral GameMode to be installed",
	"command": "gamemoderun ${command}"
}

/usr/share/com.github.tkashkin.gamehub/tweaks/proton.json

[
	{
		"id": "dx_dxvk_hud",
		"name": "Show DXVK HUD",
		"description": "Enable DXVK HUD",
		"applicable_to": {
			"platforms": ["windows"],
			"compat": ["wine", "proton"]
		},
		"env": {
			"DXVK_HUD": "devinfo,fps"
		}
	},
	{
		"id": "proton_dx_d9vk",
		"name": "Proton: Use D9VK",
		"description": "Use Vulkan-based D9VK instead of OpenGL-based WineD3D for D3D9",
		"applicable_to": {
			"platforms": ["windows"],
			"compat": ["proton"]
		},
		"env": {
			"PROTON_USE_D9VK": "1"
		}
	},
	{
		"id": "proton_dx_wined3d",
		"name": "Proton: Use WineD3D",
		"description": "Use OpenGL-based WineD3D for D3D11 and D3D10 instead of Vulkan-based DXVK",
		"applicable_to": {
			"platforms": ["windows"],
			"compat": ["proton"]
		},
		"env": {
			"PROTON_USE_WINED3D": "1"
		}
	},
	{
		"id": "proton_no_esync",
		"name": "Proton: Disable esync",
		"description": "Disable eventfd-based in-process synchronization primitives",
		"applicable_to": {
			"platforms": ["windows"],
			"compat": ["proton"]
		},
		"env": {
			"PROTON_NO_ESYNC": "1"
		}
	},
	{
		"id": "proton_no_fsync",
		"name": "Proton: Disable fsync",
		"description": "Disable futex-based in-process synchronization primitives",
		"applicable_to": {
			"platforms": ["windows"],
			"compat": ["proton"]
		},
		"env": {
			"PROTON_NO_FSYNC": "1"
		}
	}
]

Any feedback or suggestions?

@neuromancer
Copy link
Contributor

This sounds like a good idea. Using a separated github repository just for tweaks seems like a reasonable approach since user don't need to know how GameHub works in order to extend it with new tweaks.

tkashkin added a commit that referenced this issue Jan 12, 2020
`Utils.run*` refactoring
@tkashkin
Copy link
Owner

c0f42a5 implements Tweaks.

GameHub will load Tweaks from data directories in order (see Settings > Tweaks).
You can add custom tweaks to any of data directories that are listed in Settings.

Global tweaks list should be applied to all games automatically unless game has its own list configured. Use Tweaks entry in game's context menu to configure.

It may not work somewhere if I missed something.
This commit also refactors Utils.run* functions so something may be broken by that as well.

@tkashkin
Copy link
Owner

@TheRealDannyBoy, @OvermindDL1, @neuromancer, @Hedronmx

So, does it actually work? Are there any issues or missing functionality? Did it break anything?

@Hedronmx
Copy link

I tested this yestarday and i couldnt find any problems. Game mode runs good

@TheRealDannyBoy
Copy link
Author

Sorry it took so long to test; I haven't had much time to game lately. It worked for me (AppImage version.)

@tkashkin
Copy link
Owner

tkashkin commented Feb 2, 2020

If you know some useful tweaks, send a PR with them to https://github.com/tkashkin/GameHub/tree/dev/data/share/tweaks. Format should be self-explanatory.

@tkashkin tkashkin closed this as completed Feb 2, 2020
@Lucki
Copy link
Contributor

Lucki commented Mar 22, 2020

So, does it actually work? Are there any issues […]?

I've tested a bit around and found a few issues.

The first one is about visibility, I've found the global tweaks and thought it would be nice to be able to set them per game. I never use the context menu so I completely missed the per game options. I would expect the tweaks section somewhere in the games option page (same with overlays btw). This is probably related to #304

To understand the next ones: I've set up a custom emulator as described here.

  • It seems like global tweaks are ignored by custom emulators.
  • It's not possible to set specific tweaks per custom emulator.
  • Games using a custom emulator don't have the options available which the compatibility layer behind the custom emulator supports.

Despite the file stating it needs an amd gpu for the ACO-tweak I am able to activate this option with a nvidia gpu.

"applicable_to": {
"kmod": ["amdgpu"]

[…] or missing functionality ?

As an idea what to add which is probably overkill and can be handled by the custom environment input:
Group tweaks. Some tweaks allow lists or multiple occurrences like WINEDEBUG (WINEDEBUG="-all,+fps") or DXVK_HUD (DXVK_HUD=compiler,fps,DXVK_HUD=1,DXVK_HUD=full).

@tkashkin
Copy link
Owner

I would expect the tweaks section somewhere in the games option page (same with overlays btw)

I want to move properties like tweaks and overlays into preferences dialog in future.

To understand the next ones: I've set up a custom emulator as described here.

Tweaks are currently not fully implemented for emulators.

Despite the file stating it needs an amd gpu for the ACO-tweak I am able to activate this option with a nvidia gpu.

kmod check is not implemented yet, but will be in future.

As an idea what to add which is probably overkill and can be handled by the custom environment input: Group tweaks.

Interesting idea, I'll think how to do it.

@Lucki Lucki mentioned this issue Mar 22, 2020
@Lucki
Copy link
Contributor

Lucki commented Mar 22, 2020

Not sure if global tweaks are getting picked up at all. I've tested with SteamGameId=gamehub PROTON_LOG=1 and only get a log file if the tweak is set up for the specific game. It's not printing the log file if the tweak is only enabled in the global section.

Maybe the default games "off" state overrides the global one?

Edit: It's not even checked? The global tweak works with something like this but obviously isn't the solution since intentionally turned off switches aren't recognized or saved.

https://github.com/tkashkin/GameHub/blob/ae211801176f60fb4d99e1753f236496f872838f/src/data/Game.vala#L681-L687

			foreach(var tweak in all_tweaks.values)
			{
				if(tweak.is_enabled(this) && tweak.is_applicable_to(this, tool))
				{
					enabled_tweaks += tweak;
+				} else if(tweak.is_enabled() && tweak.is_applicable_to(this, tool)) {
+					// override with global enabled status
+					enabled_tweaks += tweak;
				}
+				// TODO: Save and display when a setting is intentionally in a different state compared to the global status.
+				// It's also necessary to be able to revert into the default from this state
			}

[…] or missing functionality ?

Maybe it's useful to see the global tweak status in the games tweak panel as a predefined state of the switches?

Lucki pushed a commit to Lucki/GameHub that referenced this issue Oct 30, 2021
`Utils.run*` refactoring


Former-commit-id: c0f42a5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants