Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window resize not always sent to clients #3040

Closed
AlanGriffiths opened this issue Sep 14, 2023 · 2 comments · Fixed by #3042
Closed

Window resize not always sent to clients #3040

AlanGriffiths opened this issue Sep 14, 2023 · 2 comments · Fixed by #3042
Assignees
Labels

Comments

@AlanGriffiths
Copy link
Collaborator

AlanGriffiths commented Sep 14, 2023

Failing to notify the client of a window resize is the root cause of canonical/ubuntu-frame-osk#58

Tis can be reproduced (intermittently - around 1 in 4) with:

snap set frame-it osk=enable
MIR_SERVER_WINDOW_MANAGEMENT_TRACE=1 frame-it ./wayland-debug-wrapper wpe-webkit-mir-kiosk.cog

Here's an extract from a log of the messages received by the client and the Mir log with --window-management-trace.

Note that the only [email protected]() is to the smaller size of (1268, 741), and occurs before the advise_application_zone_update updated=(0, 0, (1268, 994)), original=(0, 0, (1268, 741)).

Following the advise_application_zone_update() the Frame window manager correctly resizes the window to new_size=(1268, 994) but there is no corresponding [email protected]() event. As a result the client continues to submit (1268, 741) buffers (which is interpreted as a resize request which is overruled by the WM)

[545592.862] [email protected](1268, 741, array)
[545592.873] [email protected](9)
[545592.877]  -> [email protected]_configure(9)
[545592.881] [email protected](11, wl_surface@13, array)
[545592.888] [email protected](wl_surface@13)
[545601.569] [email protected]_id(24)
[545601.618] [email protected](290107331)
[545601.765] [email protected]_id(15)
[545601.779] [email protected]_id(13)
[545601.784] [email protected]_id(14)
[545601.788] [email protected](0)
Cog-Core-Message: 16:14:06.299: <https://mir-server.io/> Loading...
[2023-09-14 16:14:06.362411] < -warning- > mirserver: Ignoring layer shell protocol violation: wl_surface destroyed before associated zwlr_layer_surface_v1@28
[2023-09-14 16:14:06.362501] <information> miral::Window Management: advise_delete_window window_info={name=, type=freestyle, state=attached, top_left=0, 741, size=(1268, 253), restore_rect=(634, 310, (0, 126)), children={}, depth_layer=4, attached_edges=11, exclusive_rect=1, preferred_orientation=0xf, confine_pointer=0, output_id=1}
[2023-09-14 16:14:06.362538] <information> miral::Window Management: place_and_size_for_state modifications={state=maximized} window_info={name=, type=freestyle, state=fullscreen, top_left=0, 0, size=(1268, 741), restore_rect=(320, 256, (640, 512)), children={}, depth_layer=0, exclusive_rect=0, preferred_orientation=0xf, confine_pointer=0}
[2023-09-14 16:14:06.362551] <information> miral::Window Management: confirm_placement_on_display window_info={name=, type=freestyle, state=fullscreen, top_left=0, 0, size=(1268, 741), restore_rect=(320, 256, (640, 512)), children={}, depth_layer=0, exclusive_rect=0, preferred_orientation=0xf, confine_pointer=0}, new_state= maximized, new_placement= (0, 0, (1268, 741)) -> (0, 0, (1268, 741))
[2023-09-14 16:14:06.362576] <information> miral::Window Management: confirm_placement_on_display window_info={name=, type=freestyle, state=fullscreen, top_left=0, 0, size=(1268, 741), restore_rect=(320, 256, (640, 512)), children={}, depth_layer=0, exclusive_rect=0, preferred_orientation=0xf, confine_pointer=0}, new_state= fullscreen, new_placement= (0, 0, (1268, 994)) -> (0, 0, (1268, 741))
[2023-09-14 16:14:06.362585] <information> miral::Window Management: place_and_size_for_state modifications={state=maximized} window_info={name=Cog, type=freestyle, state=fullscreen, top_left=0, 0, size=(1268, 741), restore_rect=(317, 248, (634, 497)), children={}, exclusive_rect=0, preferred_orientation=0xf, confine_pointer=0}
[2023-09-14 16:14:06.362593] <information> miral::Window Management: confirm_placement_on_display window_info={name=Cog, type=freestyle, state=fullscreen, top_left=0, 0, size=(1268, 741), restore_rect=(317, 248, (634, 497)), children={}, exclusive_rect=0, preferred_orientation=0xf, confine_pointer=0}, new_state= maximized, new_placement= (0, 0, (1268, 741)) -> (0, 0, (1268, 741))
[2023-09-14 16:14:06.362601] <information> miral::Window Management: confirm_placement_on_display window_info={name=Cog, type=freestyle, state=fullscreen, top_left=0, 0, size=(1268, 741), restore_rect=(317, 248, (634, 497)), children={}, exclusive_rect=0, preferred_orientation=0xf, confine_pointer=0}, new_state= fullscreen, new_placement= (0, 0, (1268, 994)) -> (0, 0, (1268, 741))
[2023-09-14 16:14:06.362609] <information> miral::Window Management: advise_application_zone_update updated=(0, 0, (1268, 994)), original=(0, 0, (1268, 741))
[2023-09-14 16:14:06.362633] <information> miral::Window Management: for_each_application
[2023-09-14 16:14:06.362640] <information> miral::Window Management: info_for -> 
[2023-09-14 16:14:06.362648] <information> miral::Window Management: place_and_size_for_state modifications={state=maximized} window_info={name=, type=freestyle, state=fullscreen, top_left=0, 0, size=(1268, 741), restore_rect=(320, 256, (640, 512)), children={}, depth_layer=0, exclusive_rect=0, preferred_orientation=0xf, confine_pointer=0}
[2023-09-14 16:14:06.362656] <information> miral::Window Management: confirm_placement_on_display window_info={name=, type=freestyle, state=fullscreen, top_left=0, 0, size=(1268, 741), restore_rect=(320, 256, (640, 512)), children={}, depth_layer=0, exclusive_rect=0, preferred_orientation=0xf, confine_pointer=0}, new_state= maximized, new_placement= (0, 0, (1268, 994)) -> (0, 0, (1268, 994))
[2023-09-14 16:14:06.362665] <information> miral::Window Management: modify_window window_info={name=, type=freestyle, state=fullscreen, top_left=0, 0, size=(1268, 741), restore_rect=(320, 256, (640, 512)), children={}, depth_layer=0, exclusive_rect=0, preferred_orientation=0xf, confine_pointer=0}, modifications={top_left=0, 0, size=(1268, 994), state=fullscreen}
[2023-09-14 16:14:06.362673] <information> miral::Window Management: advise_resize window_info={name=, type=freestyle, state=fullscreen, top_left=0, 0, size=(1268, 741), restore_rect=(320, 256, (640, 512)), children={}, depth_layer=0, exclusive_rect=0, preferred_orientation=0xf, confine_pointer=0}, new_size=(1268, 994)
[2023-09-14 16:14:06.362710] <information> miral::Window Management: info_for -> Cog
[2023-09-14 16:14:06.362719] <information> miral::Window Management: place_and_size_for_state modifications={state=maximized} window_info={name=Cog, type=freestyle, state=fullscreen, top_left=0, 0, size=(1268, 741), restore_rect=(317, 248, (634, 497)), children={}, exclusive_rect=0, preferred_orientation=0xf, confine_pointer=0}
[2023-09-14 16:14:06.362728] <information> miral::Window Management: confirm_placement_on_display window_info={name=Cog, type=freestyle, state=fullscreen, top_left=0, 0, size=(1268, 741), restore_rect=(317, 248, (634, 497)), children={}, exclusive_rect=0, preferred_orientation=0xf, confine_pointer=0}, new_state= maximized, new_placement= (0, 0, (1268, 994)) -> (0, 0, (1268, 994))
[2023-09-14 16:14:06.362735] <information> miral::Window Management: modify_window window_info={name=Cog, type=freestyle, state=fullscreen, top_left=0, 0, size=(1268, 741), restore_rect=(317, 248, (634, 497)), children={}, exclusive_rect=0, preferred_orientation=0xf, confine_pointer=0}, modifications={top_left=0, 0, size=(1268, 994), state=fullscreen}
[2023-09-14 16:14:06.362743] <information> miral::Window Management: advise_resize window_info={name=Cog, type=freestyle, state=fullscreen, top_left=0, 0, size=(1268, 741), restore_rect=(317, 248, (634, 497)), children={}, exclusive_rect=0, preferred_orientation=0xf, confine_pointer=0}, new_size=(1268, 994)
[545827.949]  -> [email protected](new id wl_callback@13)
[545828.030] [email protected](0)
[545844.318]  -> [email protected](new id wl_callback@14)
[545844.361]  -> [email protected]_params(new id zwp_linux_buffer_params_v1@15)
[545844.391]  -> [email protected](fd 27, 0, 0, 5120, 16777216, 4)
[545844.407]  -> [email protected](fd 28, 1, 3932160, 256, 16777216, 4)
[545844.440]  -> [email protected]_immed(new id wl_buffer@17, 1268, 741, 875713089, 0)
[545844.453]  -> [email protected]()
[545844.457]  -> [email protected](wl_buffer@17, 0, 0)
[545844.466]  -> [email protected](0, 0, 2147483647, 2147483647)
[545845.076]  -> [email protected]()
[545845.269]  -> [email protected]_params(new id zwp_linux_buffer_params_v1@24)
[545845.318]  -> [email protected](fd 31, 0, 0, 5120, 16777216, 4)
[545845.334]  -> [email protected](fd 32, 1, 3932160, 256, 16777216, 4)
[545845.348]  -> [email protected]_immed(new id wl_buffer@22, 1268, 741, 875713089, 0)
[545845.360]  -> [email protected]()
[545845.363]  -> [email protected](wl_buffer@22, 0, 0)
[545845.371]  -> [email protected](0, 0, 1268, 741)
[545845.380]  -> [email protected](new id wl_callback@25)
[545845.385]  -> [email protected]()
[2023-09-14 16:14:06.534111] <information> miral::Window Management: handle_modify_window window_info={name=Cog, type=freestyle, state=fullscreen, top_left=0, 0, size=(1268, 994), restore_rect=(317, 248, (634, 497)), children={}, exclusive_rect=0, preferred_orientation=0xf, confine_pointer=0}, modifications={size=(1268, 741)}
[2023-09-14 16:14:06.534197] <information> miral::Window Management: place_and_size_for_state modifications={state=maximized} window_info={name=Cog, type=freestyle, state=fullscreen, top_left=0, 0, size=(1268, 994), restore_rect=(317, 248, (634, 497)), children={}, exclusive_rect=0, preferred_orientation=0xf, confine_pointer=0}
[2023-09-14 16:14:06.534245] <information> miral::Window Management: confirm_placement_on_display window_info={name=Cog, type=freestyle, state=fullscreen, top_left=0, 0, size=(1268, 994), restore_rect=(317, 248, (634, 497)), children={}, exclusive_rect=0, preferred_orientation=0xf, confine_pointer=0}, new_state= maximized, new_placement= (0, 0, (1268, 994)) -> (0, 0, (1268, 994))
[2023-09-14 16:14:06.534261] <information> miral::Window Management: modify_window window_info={name=Cog, type=freestyle, state=fullscreen, top_left=0, 0, size=(1268, 994), restore_rect=(317, 248, (634, 497)), children={}, exclusive_rect=0, preferred_orientation=0xf, confine_pointer=0}, modifications={top_left=0, 0, size=(1268, 994), state=fullscreen}
[2023-09-14 16:14:06.534275] <information> miral::Window Management: ====
[545846.131] [email protected]_id(24)
[545846.147] [email protected]_id(25)
[545846.154] [email protected]()
[545846.239]  -> [email protected]()
[545846.249] [email protected](290107576)
[545846.276] [email protected]_id(15)
[545846.335] [email protected]_id(13)
[545846.345] [email protected]_id(14)
[545846.353] [email protected](0)
[545862.622]  -> [email protected](new id wl_callback@13)
[545863.130] [email protected]()
[545863.139]  -> [email protected]()
[545863.143] [email protected](0)
[545866.277]  -> [email protected](new id wl_callback@14)

wpe-webkit-mir-kiosk.cog.log

$ cat wayland-debug-wrapper 
#!/bin/sh
WAYLAND_DEBUG=client exec "$@"
@AlanGriffiths AlanGriffiths self-assigned this Sep 14, 2023
@AlanGriffiths
Copy link
Collaborator Author

AlanGriffiths commented Sep 15, 2023

OK, have traced the logic through to:

void mf::WaylandSurfaceObserver::content_resized_to(ms::Surface const*, geom::Size const& content_size)
{
    log_debug("mf::WaylandSurfaceObserver::content_resized_to({%d, %d})", content_size.width.as_int(), content_size.height.as_int());

    run_on_wayland_thread_unless_window_destroyed(
        [content_size](Impl* impl, WindowWlSurfaceRole* window)
        {
            log_debug("mf::WaylandSurfaceObserver::content_resized_to(...) content_size {%d, %d}, window_size {%d, %d}",
                      content_size.width.as_int(), content_size.height.as_int(), impl->window_size.width.as_int(), impl->window_size.height.as_int());
            if (content_size != impl->window_size)
            {
                impl->requested_size = content_size;
                window->handle_resize(std::nullopt, content_size);
            }
        });
}

Where we drop the resize because:

[2023-09-15 12:12:50.502459] < - debug - > mirserver: mf::WaylandSurfaceObserver::content_resized_to(...) content_size {1280, 1024}, window_size {1280, 1024}

Now to figure out how window_size is set to (1280, 1024) without notifying the client...

@AlanGriffiths
Copy link
Collaborator Author

OK, the sequence of events:

The client has submitted a (1280, 1024) and we have resized to (1280, 741) and sent a configure() (order doesn't matter).

Then, before the client sends another buffer we resize to (1280, 1024) and don't send a configure() because the size of the last buffer was right.

After which we get (1280, 741) buffers which we interpret as a resize attempt which we ignore, but don't send a configure because we're expecting the client to eventually submit a buffer of the right size. (In response to the configure we didn't send above.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant