Open belegdol opened 3 months ago
Downgrading the driver to 555.58.02 gets XWayland working - vulkan falls back to opengl, but opengl starts fine. It is probably because it seems to fall back to software rendering:
libEGL warning: egl: failed to create dri2 screen
../../../src/glcontext_egl.cpp (231): BGFX EGL info:
../../../src/glcontext_egl.cpp (233): BGFX APIs: OpenGL OpenGL_ES
../../../src/glcontext_egl.cpp (236): BGFX Vendor: Mesa Project
cc @BlockoS
I believe that there are two issues here in summary:
As to whether Vulkan via XWayland was ever working, I am not sure. I cannot test it anymore unfortunately as I cannot downgrade beyond 555 driver due to nvidia kernel module not building against 6.10 kernel.
Should I report this to nvidia in parallel?
Should I report this to nvidia in parallel?
Yes.
Should I report this to nvidia in parallel?
Yes.
Done: https://forums.developer.nvidia.com/t/explicit-sync-causes-bgfx-examples-to-crash/304484 https://forums.developer.nvidia.com/t/hardware-egl-not-working-on-wayland-libegl-warning-egl-failed-to-create-dri2-screen/262167
I ran the test case with WAYLAND_DEBUG=1
set. The following error was present for both renderers:
[1773620.575] {Display Queue} wl_display#1.error(wl_surface#42, 0, "DRM Syncobj surface object already created for surface 42")
I'm still on this driver, but haven't updated bgfx in a while. I fixed the Wayland support recently in bgfx. When I'm home, I'll update bgfx, and test again. However, for me, everthing was working fine under this driver (except Vulkan + XWayland being extremely slow, but that's a driver issue).
Thanks for the wayland fixes! When I originally fixed them up so that something is actually rendered, I was not really sure what I was doing. Apologies for causing work. In my defense, it used to work good enough until the explicit sync changes arrived. Regarding this issue: with current git (4bc652939ff400e424e17185d23b229a37d269e1) and 565.57.01 nvidia driver there is an improvement:
As this works (or used to work last time I tested) on AMD open drivers, it is entirely possible that this behaviour is at least partially caused by issues with the nvidia driver. From the egl-wayland issue:
The issue with that protocol error on Vulkan is a fix we have internally which will be in a future release. I can't reproduce any issues on GL native wayland or Xwayland (GL and Vulkan) however.
- Compile git master with
--with-sdl --with-wayland
added to the makefile
All of my recent work should have removed the --with-wayland
option, as Wayland is now always supported (even if you don't have it). So I'm guessing you are actually on an old version, and not really on git master. The error you are seeing is indeed the one I fixed, so I'm double suspicious. GENie is throwing an error if you pass an undefined flag, so now I'm triple suspicious.
I will double check later just to be sure. But I did run git pull
, had to remerge my changes to just include --with-sdl
and I rad git clean -xdf
just to be sure. Binary also had today's date on it. But then I have two small children so I am not sure what I am doing half the time 😉
Ok something is off, I need to investigate further:
$ __NV_DISABLE_EXPLICIT_SYNC=1 SDL_VIDEODRIVER=wayland ../../.build/linux64_gcc/bin/examplesDebug
../../../src/bgfx.cpp (3557): BGFX Init...
../../../src/bgfx.cpp (3564): BGFX Version 1.128.8816 (commit: 96391d0b595494176d5fd04e84a230ef92cb6d61)
Looks like the version shown in the console does not reflect the actual commit but needs to be bumped manually. My tree has only one difference against git master:
$ git diff
diff --git a/makefile b/makefile
index fbf3b6a88..73f8245f4 100644
--- a/makefile
+++ b/makefile
@@ -98,7 +98,7 @@ wasm-release: .build/projects/gmake-wasm ## Build - Emscripten Release
wasm: wasm-debug wasm-release ## Build - Emscripten Debug and Release
.build/projects/gmake-linux-gcc:
- $(GENIE) --with-tools --with-combined-examples --with-shared-lib --gcc=linux-gcc gmake
+ $(GENIE) --with-tools --with-combined-examples --with-shared-lib --with-sdl --gcc=linux-gcc gmake
linux-gcc-debug64: .build/projects/gmake-linux-gcc ## Build - Linux GCC x64 Debug
$(MAKE) -R -C .build/projects/gmake-linux-gcc config=debug64
linux-gcc-release64: .build/projects/gmake-linux-gcc ## Build - Linux GCC x64 Release
I recompiled everything using make -j12 linux-gcc-debug64
and can still see what I reported earlier today. My GPU is an RTX 2070 and I am using nvidia drivers from RPM Fusion in case this matters. The following comment just got added to the egl-wayland issue:
Are you sure bgfx is calling eglDestroySurface properly? I don't see any calls to wp_linux_drm_syncobj_surface_v1_destroy here (which we do in wlEglDestroySurface in egl-wayland to clean up) so it doesn't seem to be cleaning any surfaces up. If it creates a second EGLSurface for that wl_surface without destroying the first EGLSurface it would cause a bug like this.
That would also explain why this still happens on 565 with Vulkan, since the fix I mentioned previously is in that release.
Maybe my system is broken somehow or the RPM Fusion drivers do something weird.
So do you have a problem still?
Yes. I have installed latest egl-wayland and egl-x11 but the end result is still as listed in https://github.com/bkaradzic/bgfx/issues/3342#issuecomment-2470065740, except that the log is a bit different and gl on native wayland crashes instead of quitting. I will try to post updated logs later. I am on 69acf288137195f0b43394b198af69940a477cfc now.
Describe the bug On Fedora 40 x86_64 with latest nvidia driver and egl-wayland from updates testing, attempting to start examples under wayland crashes regardless of the renderer or the SDL videodriver.
To Reproduce Steps to reproduce the behavior:
--with-sdl --with-wayland
added to the makefilecd examples/runtime
../../.build/linux64_gcc/bin/examplesDebug
Expected behavior Examples start as normal
Additional context Changing
SDL_VIDEODRIVER
betweenx11
andwayland
, or renderer with--gl
or--vulkan
only changes the errors. Defining__NV_DISABLE_EXPLICIT_SYNC=1
allows both Vulkan and OpenGL renderers to work with wayland videodriver, but not with x11. Native Xorg session works with x11 videodriver (but not with wayland, obviously).