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

Blank window #2977

Closed
infinitebugs32 opened this issue Oct 11, 2023 · 16 comments
Closed

Blank window #2977

infinitebugs32 opened this issue Oct 11, 2023 · 16 comments
Labels
External Issue Not a Wails issue but something wrong with an external dependency Workaround Available

Comments

@infinitebugs32
Copy link

infinitebugs32 commented Oct 11, 2023

Description

Yesterday my app worked just fine. This morning, after making no changes to the code, I executed wails dev and it resulted in a full gray window. However when I randomly move my mouse on the window I can see the tooltips of my app.
Can't even open the dev tools in the wails window. Works in the browser though (wails dev --browser).
My main.go does correctly include the assets:

//go:embed frontend/dist
var assets embed.FS

Wails dev output:

INF | Serving assets from frontend DevServer URL: http://localhost:5173/
Overriding existing handler for signal 10. Set JSC_SIGNAL_FOR_GC if you want WebKit to use a different signal
DEB | [DevWebServer] Serving DevServer at http://localhost:34115
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
Failed to create GBM buffer of size 800x800: Permission denied
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
Failed to create GBM buffer of size 800x800: Permission `denied`
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
Failed to create GBM buffer of size 800x800: Permission denied

When I try to run the binary after building:

Overriding existing handler for signal 10. Set JSC_SIGNAL_FOR_GC if you want WebKit to use a different signal
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
Failed to create GBM buffer of size 800x800: Permission denied
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
Failed to create GBM buffer of size 800x800: Permission denied
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
Failed to create GBM buffer of size 800x800: Permission denied
Failed to create EGL images for DMABufs with file descriptors -1, -1 and -1
dom ready

My coworker's output:

└──>>>  Wed Oct 11 - 12:44:28  $ ./build/bin/testwebkit 
Overriding existing handler for signal 10. Set JSC_SIGNAL_FOR_GC if you want WebKit to use a different signal
src/nv_gbm.c:99: GBM-DRV error (nv_gbm_bo_create): DRM_IOCTL_NVIDIA_GEM_ALLOC_NVKMS_MEMORY failed (ret=-1)

Failed to create GBM buffer of size 1024x768: Invalid argument
src/nv_gbm.c:99: GBM-DRV error (nv_gbm_bo_create): DRM_IOCTL_NVIDIA_GEM_ALLOC_NVKMS_MEMORY failed (ret=-1)

Failed to create GBM buffer of size 1024x768: Invalid argument
src/nv_gbm.c:99: GBM-DRV error (nv_gbm_bo_create): DRM_IOCTL_NVIDIA_GEM_ALLOC_NVKMS_MEMORY failed (ret=-1)

Failed to create GBM buffer of size 1024x768: Invalid argument
Failed to create EGL images for DMABufs with file descriptors -1, -1 and -1

To Reproduce

wails init -n testwebkit
wails dev 

Expected behaviour

I expect a properly working Wails app window

Screenshots

wails dev --browser
image

Attempted Fixes

Remove webkit packages. Break my system. Cry. Reinstall webkit. Reinstall Gnome. No solution.

System Details

Me:
Kubuntu 22.04
Wails v2.4.1
Vite v3.1.8
Webkit: libwebkit2gtk-4.0-37 libwebkit2gtk-4.0-dev

My co-worker who has the same issue:
Arch Linux (kernel: 6.5.6-arch2-1)
Wails v2.6.0
Webkit: webkit2gtk 2.42.1-1 webkit2gtk-4.1 2.42.1-1 webkitgtk-6.0 2.42.1-1

Additional context

Similar to #2975 and #9

@infinitebugs32 infinitebugs32 added the Bug Something isn't working label Oct 11, 2023
@m4niac-0x
Copy link

m4niac-0x commented Oct 11, 2023

Same issue for every Wails project (with this Archlinux config). Not just for a new created project.

@leaanthony
Copy link
Member

I wonder if your systems silently upgraded some deps. There's no reason anything should change overnight with your code or deps....

@leaanthony
Copy link
Member

leaanthony commented Oct 11, 2023

Have you tried disabling compositing? https://bugs.webkit.org/show_bug.cgi?id=180739

You could also adjust this: https://wails.io/docs/reference/options/#webviewgpupolicy

@infinitebugs32
Copy link
Author

infinitebugs32 commented Oct 11, 2023

linux.WebviewGpuPolicyNever does the job . However I will keep looking into it to find a solution that doesn't require disabling hardware acceleration. Could you leave this issue open ?
Thank you !

@ShivamJoker
Copy link

What will be the permanent fix?

@leaanthony
Copy link
Member

Standardisation in Linux distros 😅

@zerollzeng
Copy link

I saw similar issue when open my cisco anyconnect client. so I search the error and I found this. I have a WAR that use WEBKIT_DISABLE_DMABUF_RENDERER=1 /opt/cisco/anyconnect/bin/vpnui or export WEBKIT_DISABLE_DMABUF_RENDERER=1 before launch the application. I'm managing to find a thorough solution.

@leaanthony
Copy link
Member

Thanks for the info. Sounds like an ecosystem wide issue 😞

@leaanthony
Copy link
Member

leaanthony commented Oct 13, 2023

If anyone who is having the issue is comfortable with local Dev, then setting this environment in this function might fix the issue: https://github.com/wailsapp/wails/blob/master/v2/internal/frontend/desktop/linux/frontend.go#L139

If it does we can make it a flag.

@db47h
Copy link
Contributor

db47h commented Nov 2, 2023

There are several webkit bug reports related to this:
https://bugs.webkit.org/show_bug.cgi?id=228268 and https://bugs.webkit.org/show_bug.cgi?id=261874#c32

This is clearly webkit/nvidia related and there's no real fix yet (even the nv drivers update mentioned in 281874 does not fix this bug for me).

IMO, the best way to tackle this in wails and its ecosystem is:

  • add a bool command line flag like -webkit-dmabuf-renderer set to false by default (which would set WEBKIT_DISABLE_DMABUF_RENDERER=1 by default on linux).
  • end users who can read a README and need better performance can then re-enable it.
  • keep this issue open until the upstream bug is resolved, then change the default flag value to true

This way, end-users won't even see the bug and this would put less pressure on devs.

@db47h
Copy link
Contributor

db47h commented Nov 2, 2023

Assuming that very little client code uses the options.App.Linux field, I my have an even simpler solution:

diff --git a/v2/internal/frontend/desktop/linux/window.go b/v2/internal/frontend/desktop/linux/window.go
index 82030f43..71516097 100644
--- a/v2/internal/frontend/desktop/linux/window.go
+++ b/v2/internal/frontend/desktop/linux/window.go
@@ -25,6 +25,7 @@ import (
        "github.com/wailsapp/wails/v2/internal/frontend"
        "github.com/wailsapp/wails/v2/pkg/menu"
        "github.com/wailsapp/wails/v2/pkg/options"
+       "github.com/wailsapp/wails/v2/pkg/options/linux"
 )
 
 func gtkBool(input bool) C.gboolean {
@@ -90,6 +91,9 @@ func NewWindow(appoptions *options.App, debug bool, devtoolsEnabled bool) *Windo
        var webviewGpuPolicy int
        if appoptions.Linux != nil {
                webviewGpuPolicy = int(appoptions.Linux.WebviewGpuPolicy)
+       } else {
+               // TODO: see https://github.com/wailsapp/wails/issues/2977
+               webviewGpuPolicy = int(linux.WebviewGpuPolicyNever)
        }

Then add a warning in the docs for linux.Options.WebviewGpuPolicy about the potential issues and the default behavior. The only problem I see is that not setting options.App.Linux would have a different behavior than providing an empty {}&linux.Options.

@leaanthony
Copy link
Member

leaanthony commented Nov 3, 2023

Happy to accept a PR on this. Agree - it's probably the best way forward.

db47h added a commit to db47h/wails that referenced this issue Nov 3, 2023
In NewWindow, set options.Linux.WebviewGpuPolicy to WebviewGpuPolicyNever
if options.Linux is nil, disabling GPU acceleration by default on linux
until the upstream bugs https://bugs.webkit.org/show_bug.cgi?id=228268
and https://bugs.webkit.org/show_bug.cgi?id=261874 are fixed.
db47h added a commit to db47h/wails that referenced this issue Nov 3, 2023
In NewWindow, set options.Linux.WebviewGpuPolicy to WebviewGpuPolicyNever
if options.Linux is nil, disabling GPU acceleration by default on linux
until the upstream bugs https://bugs.webkit.org/show_bug.cgi?id=228268
and https://bugs.webkit.org/show_bug.cgi?id=261874 are fixed.
@db47h
Copy link
Contributor

db47h commented Nov 3, 2023

Here you go #3027.

leaanthony pushed a commit that referenced this issue Nov 4, 2023
In NewWindow, set options.Linux.WebviewGpuPolicy to WebviewGpuPolicyNever
if options.Linux is nil, disabling GPU acceleration by default on linux
until the upstream bugs https://bugs.webkit.org/show_bug.cgi?id=228268
and https://bugs.webkit.org/show_bug.cgi?id=261874 are fixed.
@nobane
Copy link

nobane commented Mar 2, 2024

I ran into this issue trying use webkit2gtk on arch linux (with an nvidia card) and I was able to fix it without setting WEBKIT_DISABLE_DMABUF_RENDERER=1.

Here is how I fixed it:

  1. Check if you have modesetting enabled via

     cat /sys/module/nvidia_drm/parameters/modeset
    
  2. If you see printed N then you need to enable it with

     echo options nvidia_drm modeset=1 | sudo tee /etc/modprobe.d/nvidia_drm.conf
    
  3. Restart your computer

@ziontee113
Copy link

Thank you so much @nobane this works perfectly on my Arch machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
External Issue Not a Wails issue but something wrong with an external dependency Workaround Available
Projects
None yet
Development

No branches or pull requests

8 participants