Describe the bug
When my video player application runs, it stutters and eventually hangs.
To Reproduce
I am unable to reproduce it with the simple examples. However, I traced the problem to two functions. First, the stuttering happens in:
Fl_Gl_Wayland_Gl_Window_Driver::swap_buffers() when it calls:
wl_display_read_events(fl_wl_display()); // this stops the event loop for some seconds and then continues.
The hanging, happens eventually when calling fd_callback() in:
wl_display_dispatch()
It is unclear to me if one is the reason for the other.
I commented all the Wayland code in swap_buffers() right before eglSwapBuffers and replaced wl_display_dispatch for wl_display_dispatch_pending and then I was able to play my movie without stuttering or blocking. This, of course, is not the solution as the demo programs became unresponsive to the mouse and my application would crash sometimes when leaving the main window and entering it again.
Expected behavior
I expect Wayland to work as X11 does, playing my movie without stuttering or blocking.
Screenshots
I don't have screenshots, but I have my application free to download and compile with just a simple runme.sh script. It takes about 20 mins to compile, thou.
https://github.com/ggarra13/mrv2
FLTK Version
- Version: 1.4.0 HEAD
- Installed as package from: git
b26db74dd0be8e4f4728e976144cb15e64b677a5
FLTK Configure / Build Options
include( ExternalProject )
set( FLTK_TAG master )
set( patch_cmd )
if (APPLE OR WIN32)
set( wayland OFF )
set( pango OFF )
else()
set( wayland ON ) # we'll leave it on, albet it is way too buggy.
set( pango ON )
endif()
ExternalProject_Add(
FLTK
GIT_REPOSITORY "https://github.com/fltk/fltk.git"
GIT_TAG ${FLTK_TAG}
GIT_PROGRESS 1
PATCH_COMMAND ${patch_cmd}
CMAKE_ARGS
-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DFLTK_BUILD_EXAMPLES=OFF
-DFLTK_BUILD_TEST=OFF
-DOPTION_BUILD_SHARED_LIBS=0
-DOPTION_USE_SYSTEM_ZLIB=0
-DOPTION_USE_SYSTEM_LIBJPEG=0
-DOPTION_USE_SYSTEM_LIBPNG=0
-DOPTION_USE_PANGO=${pango}
-DOPTION_USE_WAYLAND=${wayland}
)
Operating System / Platform:
Linux.
Ubuntu 22.04 on Wayland
Linux/Unix Runtime, if applicable:
Additional context
Add any other context about the problem here.
Platform: Wayland