flathub / md.obsidian.Obsidian

https://flathub.org/apps/details/md.obsidian.Obsidian
42 stars 13 forks source link

How to enable gpu sandbox with nvidia driver ? #339

Closed userrand closed 1 week ago

userrand commented 1 week ago

Additional feature, program, sandbox permission, etc

Is it possible to add an option to enable the gpu sandbox even if one has an nvidia driver ? I am not sure why it is disabled but I would like to enable it to see if obsidian still works well with it enabled.

joshua-stone commented 1 week ago

@userrand Disabling the GPU sandbox is common among Electron applications running on Wayland with Nvidia GPUs:

https://github.com/search?q=org%3Aflathub++--disable-gpu-sandbox&type=code

That being said, it might no longer be necessary to have an Nvidia-specific code path with newer driver versions and newer Electron versions:

https://github.com/flathub/com.discordapp.Discord/commit/48212a07d473502aa50c7c32ede1fe40b40d428b https://github.com/flathub/com.discordapp.Discord/commit/5fd294d592a023b00213ce8745235a8d73207c40

If you have time, please test Obsidian launcher arguments to see how well Obsidian behaves, like so:

$ flatpak run --nosocket=x11 --socket=wayland --command=zypak-wrapper md.obsidian.Obsidian /app/obsidian --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime
userrand commented 1 week ago

@joshua-stone the computer I tested that on has both an amd and a nvidia gpu.

I tested :

I did not see any rendering or slowing down issues but maybe that is because it is using the amd gpu rather than the nvidia gpu (which maybe ideally one would add an exception for computers that have both if the computer uses mainly the amd gpu)

joshua-stone commented 1 week ago

@userrand Can you test this build?

$ flatpak install --user https://dl.flathub.org/build-repo/116527/md.obsidian.Obsidian.flatpakref
$ flatpak run --user --nosocket=x11 --socket=wayland md.obsidian.Obsidian//test
userrand commented 1 week ago

@joshua-stone I have not tested the build but I am not sure if my experience would be representative of most nvidia users as I would expect that the nvidia driver on the computer only gets used for intense gpu calculations like gaming, 3d modeling or neural network related computations. As such, changing the code based on my experience might lead a lot of people with nvidia gpus to have issues with the obsidian flatpak.

joshua-stone commented 1 week ago

@userrand I've merged the changes to the script Nvidia has significantly improved Wayland support and Discord doesn't appear to have experienced major regressions since dropping Nvidia-specific arguments.

If anyone reports regressions, then I'll revert these changes.