Screen flashes when running under XWayland
parkerlreed opened this issue · 11 comments
Arch Linux with KDE Plasma Wayland.
PumpkinOS output flashes especially when the terminal is open.
Does not happen when running in the X11 session.
2024-09-01.01-15-02.mp4
Tested forcing Wayland with SDL_VIDEODRIVER=wayland
Window scales for HiDPI but still exhibits the flashing.
2024-09-01.01-27-37.mp4
SDL_RENDER_DRIVER=software
works as expected.
Seems only opengl
has this behavior (under XWayland)
Thanks for the report. There is a problem with PumpkinOS running SDL/OpenGL under some Linux installations.
The problem is related to multi-threading: only the thread that creates a OpenGL surface can draw to the surface.
I do not have a solution yet, but am working on it.
Could you please test it again ?
The latest changes may have helped fix this problem.
Still doing it. Wiped the folder and did a fresh clone to make sure I wasn't using old files.
Regarding Linux, I test PumpkinOS on Debian 12 with Xfce or on WSL2, so no Wayland here. I am seeking options to test Wayland other that installing a full Gnone or KDE Plasma on my lightweight Debian environment, but haven't found any. But just to be sure I understand it correctly:
SDL->Wayland: flicker.
SDL->XWayland: flicker.
SDL->X: no flicker.
SDL->Software: no flicker.
Is that correct ?
Yep.
Wayland flicker
XWayland flicker
X11 session OpenGL no flicker
Software rendering anywhere no flicker
Weston is your most bare bones Wayland shell that should have a terminal by default. I'll try in that real quick to see if it behaves the same.
EDIT: Yep same thing within Weston
As for some hardware/OS specs
780M GPU with all open AMDGPU kernel/drivers
Arch Linux with mesa 1:24.2.2-1 and sdl2 2.30.7-1
Nothing too crazy I hope.
I have installed weston on my Debian 12 and gave it a try. I opened the terminal in weston and from there started pumpkin.sh.
Here is the relevant debug output from weston:
[17:11:32.597] weston 10.0.1
[17:11:32.597] Loading module '/usr/lib/x86_64-linux-gnu/libweston-10/x11-backend.so'
[17:11:32.599] Loading module '/usr/lib/x86_64-linux-gnu/libweston-10/gl-renderer.so'
[17:11:32.620] EGL version: 1.5
[17:11:32.620] EGL vendor: Mesa Project
[17:11:32.620] EGL client APIs: OpenGL OpenGL_ES
[17:11:32.622] GL version: OpenGL ES 3.2 Mesa 22.3.6
[17:11:32.622] GLSL version: OpenGL ES GLSL ES 3.20
[17:11:32.622] GL vendor: nouveau
[17:11:32.622] GL renderer: NV137
[17:11:32.627] Using gl renderer
[17:11:32.637] Loading module '/usr/lib/x86_64-linux-gnu/weston/desktop-shell.so'
[17:11:32.638] launching '/usr/lib/x86_64-linux-gnu/weston-desktop-shell'
PumpkinOS experienced no flicker, but I am not sure what exactly is going on in this scenario.
I have a feeling it is just using Debian's X all the way.
Ok, at least now I can reproduce the problem. From the weston terminal, I have set SDL_VIDEODRIVER=wayland before
starting pumpkin.sh, like you did. And it gave me horrible flashing:
2024-09-14.17-31-04.mp4
I have made some changes to address the issues when running under Wayland. I tested only with Weston, though. In order to try it, first you should do a full rebuild of the latest master branch. Then add the 'fullrefresh' parameter to your pumpkin_linux.lua script, so that pumpkin.start looks like this (of course you can choose different dimensions):
pumpkin.start {
width = 1024,
height = 768,
depth = 16,
fullrefresh = true,
launcher = "Launcher"
}
Finally, the shell starting pumpkin.sh must set the WAYLAND_DISPLAY environment variable. Weston does this already, and I suspect other Wayland environments also do this. Another option is to force SDL_VIDEODRIVER=wayland like you mentioned.
Yep that worked! Thank you.