GNOME Bugzilla – Bug 785436
wayland: First configure is wrong for subcomposited surfaces
Last modified: 2021-07-05 13:49:55 UTC
Created attachment 356407 [details] Wayland protocol dump illustrating the problem mutter seems to send out a "wrong" xdg-shell configure at startup when using subcomposited surfaces. The first configure upon creation of the surface has size 0x0, which is OK, but the second one that happens when first attaching a buffer has only the size of the main surface and does not include the subcomposited surfaces. Further configures then include the subcomposited surfaces in the size calculation. I realize that you can't call the sizes wrong per se for the fact that the compositor can configure any size it wants, but it strikes me as inconsistent and leads to visual flicker on application startup. I will attach a full protocol dump for reference, but these are the most interesting points: [...] [1731077.218] <= wl_compositor@15.create_surface(new_id 22) [1731077.223] <= wl_subcompositor@17.get_subsurface(new_id 25, obj 22, obj 11) [1731077.227] <= wl_compositor@15.create_surface(new_id 26) [1731077.231] <= wl_subcompositor@17.get_subsurface(new_id 27, obj 26, obj 11) [1731077.234] <= wl_compositor@15.create_surface(new_id 28) [1731077.238] <= wl_subcompositor@17.get_subsurface(new_id 29, obj 28, obj 11) [1731077.242] <= wl_compositor@15.create_surface(new_id 30) [1731077.245] <= wl_subcompositor@17.get_subsurface(new_id 31, obj 30, obj 11) [1731077.249] <= wl_shm@16.create_pool(new_id 32, fd 6, 144760) [1731077.255] <= wl_subsurface@25.set_position(-5, -38) [1731077.259] <= wl_subsurface@27.set_position(720, 0) [1731077.262] <= wl_subsurface@29.set_position(-5, 480) [1731077.266] <= wl_subsurface@31.set_position(-5, 0) [1731077.270] <= wl_shm_pool@32.create_buffer(new_id 33, 0, 730, 38, 2920, 0) [1731077.274] <= wl_compositor@15.create_region(new_id 34) [1731077.278] <= wl_region@34.add(0, 0, 730, 38) [1731077.282] <= wl_surface@22.set_opaque_region(obj 34) [1731077.286] <= wl_surface@22.set_buffer_scale(1) [1731077.289] <= wl_region@34.destroy() [1731077.292] <= wl_shm_pool@32.create_buffer(new_id 35, 110960, 5, 480, 20, 0) [1731077.296] <= wl_compositor@15.create_region(new_id 36) [1731077.300] <= wl_region@36.add(0, 0, 5, 480) [1731077.304] <= wl_surface@26.set_opaque_region(obj 36) [1731077.307] <= wl_surface@26.set_buffer_scale(1) [1731077.310] <= wl_region@36.destroy() [1731077.313] <= wl_shm_pool@32.create_buffer(new_id 37, 120560, 730, 5, 2920, 0) [1731077.318] <= wl_compositor@15.create_region(new_id 38) [1731077.321] <= wl_region@38.add(0, 0, 730, 5) [1731077.325] <= wl_surface@28.set_opaque_region(obj 38) [1731077.328] <= wl_surface@28.set_buffer_scale(1) [1731077.332] <= wl_region@38.destroy() [1731077.335] <= wl_shm_pool@32.create_buffer(new_id 39, 135160, 5, 480, 20, 0) [1731077.339] <= wl_compositor@15.create_region(new_id 40) [1731077.343] <= wl_region@40.add(0, 0, 5, 480) [1731077.346] <= wl_surface@30.set_opaque_region(obj 40) [1731077.350] <= wl_surface@30.set_buffer_scale(1) [1731077.353] <= wl_region@40.destroy() [1731077.356] <= wl_surface@22.attach(obj 33, 0, 0) [1731077.360] <= wl_surface@22.damage(0, 0, 730, 38) [1731077.364] <= wl_surface@22.commit() [1731077.367] <= wl_surface@26.attach(obj 35, 0, 0) [1731077.370] <= wl_surface@26.damage(0, 0, 5, 480) [1731077.374] <= wl_surface@26.commit() [1731077.377] <= wl_surface@28.attach(obj 37, 0, 0) [1731077.381] <= wl_surface@28.damage(0, 0, 730, 5) [1731077.385] <= wl_surface@28.commit() [1731077.388] <= wl_surface@30.attach(obj 39, 0, 0) [1731077.391] <= wl_surface@30.damage(0, 0, 5, 480) [1731077.395] <= wl_surface@30.commit() // Subsurfaces get created, buffers attached, and commited [...] [1731188.353] <= wl_drm@10.create_prime_buffer(new_id 34, fd 6, 720, 480, 875713112, 0, 2880, 0, 0, 0, 0) [1731188.362] <= wl_surface@11.attach(obj 34, 0, 0) [1731188.368] <= wl_surface@11.damage(0, 0, 2147483647, 2147483647) [1731188.374] <= wl_surface@11.commit() // This is the first visible commit on the main surface - note that all subsurfaces are already attached and placed around the surface at this point and that the buffer is sized 720x480 [1731255.147] => wl_buffer@33.release() [1731255.163] => wl_buffer@35.release() [1731255.166] => wl_buffer@37.release() [1731255.169] => wl_buffer@39.release() [1731255.172] => wl_surface@11.enter(obj 6) [1731255.176] => wl_surface@22.enter(obj 6) [1731255.179] => zxdg_toplevel_v6@21.configure(720, 480, array: 4) // This is the configure immediately following the commit that tells us that the window has state activated - but at size 720x480, which does not include the subsurfaces. Size should be either 0x0 to leave it up to the client (fwiw weston does this usually) or 730x523 (size including subsurfaces). [1731255.183] => zxdg_surface_v6@19.configure(36877) [...] [1731639.850] <= zxdg_surface_v6@19.ack_configure(36877) [1731639.853] <= wl_region@48.destroy() [1731647.197] <= wl_buffer@45.destroy() [1731647.213] <= wl_buffer@46.destroy() [1731647.217] <= wl_surface@11.frame(new_id 44) [1731647.220] <= wl_drm@10.create_prime_buffer(new_id 47, fd 6, 710, 437, 875713112, 0, 2880, 0, 0, 0, 0) [1731647.225] <= wl_surface@11.attach(obj 47, 0, 0) [1731647.228] <= wl_surface@11.damage(0, 0, 2147483647, 2147483647) [1731647.231] <= wl_surface@11.commit() // Main surface buffer gets resized to 710x437 because application thinks that it should resize to 720x480 including decorations [...] [1734008.341] => zxdg_toplevel_v6@21.configure(720, 480, array: 0) [1734008.360] => zxdg_surface_v6@19.configure(36880) // Later configures correctly include the subsurface size - configured size is 720x480 although main buffer is 710x437 [...] I can try to make a minimal example for reproduction if needed.
(In reply to k.philipp from comment #0) ... > > I can try to make a minimal example for reproduction if needed. That'd be very helpful.
Created attachment 357101 [details] Subcompositing example
Created attachment 357102 [details] Makefile for building example
Build and run the attached example. Actually there's two problems that you can see: 1. The window will be moved by the subcomposited surface offset after the opening animation has run. 2. You get first configure 0x0 (OK), then 250x250 (not OK), and when switching away from the window 290x310 (OK).
Created attachment 357105 [details] Subcompositing example Initial commit order was wrong - doesn't make a difference though
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/mutter/-/issues/ Thank you for your understanding and your help.