wayland: Excessive surface reconfiguration on every end_frame
gdk_wayland_surface_sync
does various types of surface reconfiguration, some conditionally, some not.
This function is called on end_frame
from gl, cairo and vulkan contexts.
The same problem exists in GTK 3.24, but rather than gdk_wayland_surface_sync
and context-specific end_frame
, it is caused by gdk_window_impl_wayland_end_paint
and the appropriate call to end_paint
.
The end-result of this is that every frame from these contexts lead to surface reconfiguration, as can be seen in this debug snippet from Epiphany 3.35.2:
[1408846.320] wl_pointer@11.motion(2352542, 874.304688, 709.867188)
[1408846.353] wl_pointer@11.frame()
[1408846.496] wl_display@1.delete_id(46)
[1408846.519] wl_display@1.delete_id(52)
[1408848.333] wl_pointer@11.motion(2352550, 788.304688, 705.867188)
[1408848.382] wl_pointer@11.frame()
[1408853.417] wl_buffer@48.release()
[1408853.446] wl_callback@52.done(3924)
[1408865.588] -> xdg_toplevel@43.set_min_size(300, 87)
[1408865.661] -> xdg_toplevel@43.set_max_size(0, 0)
[1408865.672] -> xdg_surface@42.set_window_geometry(0, 0, 1918, 2158)
[1408865.694] -> wl_compositor@6.create_region(new id wl_region@52)
[1408865.714] -> wl_region@52.add(-10, -10, 1938, 2178)
[1408865.736] -> wl_surface@34.set_input_region(wl_region@52)
[1408865.752] -> wl_region@52.destroy()
[1408866.416] -> wl_surface@34.attach(wl_buffer@48, 0, 0)
[1408866.452] -> wl_surface@34.damage(0, 0, 2147483647, 2147483647)
[1408866.584] -> wl_surface@34.commit()
[1408866.595] -> wl_display@1.sync(new id wl_callback@46)
[1408866.830] wl_pointer@11.motion(2352558, 712.304688, 701.867188)
[1408866.865] wl_pointer@11.frame()
[1408866.894] wl_pointer@11.motion(2352566, 608.304688, 697.867188)
[1408866.919] wl_pointer@11.frame()
[1408867.041] wl_display@1.delete_id(52)
[1408867.052] wl_display@1.delete_id(46)
[1408870.226] wl_buffer@49.release()
[1408870.270] wl_callback@46.done(3924)
[1408880.570] -> xdg_toplevel@43.set_min_size(300, 87)
[1408880.607] -> xdg_toplevel@43.set_max_size(0, 0)
[1408880.617] -> xdg_surface@42.set_window_geometry(0, 0, 1918, 2158)
[1408880.634] -> wl_compositor@6.create_region(new id wl_region@46)
[1408880.645] -> wl_region@46.add(-10, -10, 1938, 2178)
[1408880.666] -> wl_surface@34.set_input_region(wl_region@46)
[1408880.674] -> wl_region@46.destroy()
[1408880.976] -> wl_surface@34.attach(wl_buffer@49, 0, 0)
[1408880.995] -> wl_surface@34.damage(0, 0, 2147483647, 2147483647)
[1408881.078] -> wl_surface@34.commit()
[1408881.086] -> wl_display@1.sync(new id wl_callback@52)
[1408881.247] wl_pointer@11.motion(2352574, 504.304688, 697.867188)
[1408881.279] wl_pointer@11.frame()
[1408881.302] wl_pointer@11.motion(2352582, 384.304688, 695.867188)
[1408881.327] wl_pointer@11.frame()
[1408881.423] wl_display@1.delete_id(46)
[1408881.433] wl_display@1.delete_id(52)
[1408887.709] wl_buffer@48.release()
[1408887.739] wl_callback@52.done(3924)
[1408888.100] -> xdg_toplevel@43.set_min_size(300, 87)
[1408888.122] -> xdg_toplevel@43.set_max_size(0, 0)
[1408888.139] -> xdg_surface@42.set_window_geometry(0, 0, 1918, 2158)
[1408888.165] -> wl_compositor@6.create_region(new id wl_region@52)
[1408888.177] -> wl_region@52.add(-10, -10, 1938, 2178)
[1408888.206] -> wl_surface@34.set_input_region(wl_region@52)
[1408888.215] -> wl_region@52.destroy()
[1408888.396] -> wl_surface@34.attach(wl_buffer@48, 0, 0)
[1408888.423] -> wl_surface@34.damage(0, 0, 2147483647, 2147483647)
[1408888.491] -> wl_surface@34.commit()
[1408888.501] -> wl_display@1.sync(new id wl_callback@46)
Applications tested
- Epiphany 3.35.2 (Devel, from gnome-nightly flatpak repo)
- Celluloid (https://github.com/celluloid-player/celluloid)
- GtkGLArea example (https://github.com/ebassi/glarea-example, tested by celluloid collaborator)
Steps to reproduce
- Start GL-using application from a terminal with WAYLAND_DEBUG=1
- Interact with interact with application (e.g. use Epiphany, play in Celluloid)
- Observe the work related to every frame in the terminal output
Current behavior
Every or almost every frame from these applications reconfigure size hints, window geometry and input region.
Expected outcome
No reconfiguration what-so-ever unless the window is actually reconfigured—there should only be attach, damage, frame, commit.
Additional details
- Compositor: sway
- Distro: Arch, but all GTK applications tested through flatpak gnome-nightly