wayland: ensure configure sequence is acked before mapping a surface [chromium/src : main]

231 views
Skip to first unread message

Nick Yamane (Gerrit)

unread,
Jun 1, 2022, 5:00:27 PM6/1/22
to ozone-...@chromium.org, Maksim Sisov, Antonio Gomes, Kramer Ge

Attention is currently required from: Kramer Ge.

Nick Yamane has uploaded this change for review.

View Change

wayland: ensure configure sequence is acked before mapping a surface

In order to avoid "xdg_surface has never been configured" fatal protocol
errors, like in the linked crbug, we must ensure the initial configure
sequence is acked before trying to attach a buffer to that xdg_surface's
wl_surface.

Due to the multi-process async-oriented of Chrome graphics, the current
configure handling may be done both:

1. Instantly, upon xdg_surface.configure event (simple case), and
2. Deferred to be notified to the Wayland compositor
(set_window_geometry + ack_configure requests, amongst others) just
before attaching the buffer corresponding to the new frame.

In the second case, some obscure problems were observed in the wild,
where the configure sequence is not acked before trying to attach the
first buffer (surface mapping), resulting in crashes due to fatal
protocol error. However, as the spec says:

> A client is not required to commit immediately after sending an
> ack_configure request - it may even ack_configure several times before
> its next surface commit.
>
> A client may send multiple ack_configure requests before committing,
> but only the last request sent before a commit indicates which configure
> event the client really is responding to.

This fix proposes to send ack_configure immediately even in scenario (2),
for not-yet-configured surfaces.

[1] https://wayland.app/protocols/xdg-shell#xdg_surface:request:ack_configure

R=fang...@chromium.org

Bug: 1313023
Change-Id: Ia35f789d2e3452260be47b77062dd4715654fff0
---
M ui/ozone/platform/wayland/host/wayland_window.cc
1 file changed, 53 insertions(+), 0 deletions(-)

diff --git a/ui/ozone/platform/wayland/host/wayland_window.cc b/ui/ozone/platform/wayland/host/wayland_window.cc
index 153812a7..4163da2c5 100644
--- a/ui/ozone/platform/wayland/host/wayland_window.cc
+++ b/ui/ozone/platform/wayland/host/wayland_window.cc
@@ -979,6 +979,16 @@
// PlatformWindowDelegate at most once per frame.
if (pending_configures_.size() <= 1)
ApplyPendingBounds();
+ // Ensure this configure sequence is acked, even if the visual update
+ // (as well as an additional set_window_geometry/ack_configure for this
+ // sequence) happens when rendering the next frame. As per the spec,
+ // multiple acks can be sent for a single configure sequence, which in our
+ // case might avoid issues like https://crbug.com/1313023. More details:
+ // https://wayland.app/protocols/xdg-shell#xdg_surface:request:ack_configure
+ if (!IsSurfaceConfigured()) {
+ AckConfigure(serial);
+ connection()->ScheduleFlush();
+ }
}
}


To view, visit change 3647289. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia35f789d2e3452260be47b77062dd4715654fff0
Gerrit-Change-Number: 3647289
Gerrit-PatchSet: 3
Gerrit-Owner: Nick Yamane <nick...@igalia.com>
Gerrit-Reviewer: Kramer Ge <fang...@chromium.org>
Gerrit-Reviewer: Nick Yamane <nick...@igalia.com>
Gerrit-CC: Antonio Gomes <toni...@igalia.com>
Gerrit-CC: Hunter Freyer <hjfr...@google.com>
Gerrit-CC: Maksim Sisov <msi...@igalia.com>
Gerrit-Attention: Kramer Ge <fang...@chromium.org>
Gerrit-MessageType: newchange

Nick Yamane (Gerrit)

unread,
Jun 1, 2022, 5:00:34 PM6/1/22
to ozone-...@chromium.org, Maksim Sisov, Antonio Gomes, Chromium LUCI CQ, Kramer Ge, chromium...@chromium.org, Hunter Freyer

Attention is currently required from: Kramer Ge.

Patch set 3:Commit-Queue +1

View Change

1 comment:

To view, visit change 3647289. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia35f789d2e3452260be47b77062dd4715654fff0
Gerrit-Change-Number: 3647289
Gerrit-PatchSet: 3
Gerrit-Owner: Nick Yamane <nick...@igalia.com>
Gerrit-Reviewer: Kramer Ge <fang...@chromium.org>
Gerrit-Reviewer: Nick Yamane <nick...@igalia.com>
Gerrit-CC: Antonio Gomes <toni...@igalia.com>
Gerrit-CC: Hunter Freyer <hjfr...@google.com>
Gerrit-CC: Maksim Sisov <msi...@igalia.com>
Gerrit-Attention: Kramer Ge <fang...@chromium.org>
Gerrit-Comment-Date: Wed, 01 Jun 2022 21:00:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

Kramer Ge (Gerrit)

unread,
Jun 2, 2022, 11:28:24 AM6/2/22
to Nick Yamane, ozone-...@chromium.org, Maksim Sisov, Antonio Gomes, Chromium LUCI CQ, chromium...@chromium.org, Hunter Freyer

Attention is currently required from: Nick Yamane.

Patch set 3:Code-Review +1

View Change

2 comments:

  • Patchset:

    • Patch Set #3:

      Makes sense to me. This should always happen in the first configure? Should probably enforce DCHECK_EQ(pending_configures_.size(), 1u);

  • File ui/ozone/platform/wayland/host/wayland_window.cc:

    • Patch Set #3, Line 989: AckConfigure(serial);

      What happens if the next incoming frame doesn't use this pending_configure.bounds, but the serial ack will be committed anyways b/c it is already sent.

      Then a following frame coming that use the pending_configure.bounds will commit the same serial again, I'm not sure if certain wayland compositor will complain. I don't think they will as there's no error enum associated with it but we should watch out for it.

To view, visit change 3647289. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia35f789d2e3452260be47b77062dd4715654fff0
Gerrit-Change-Number: 3647289
Gerrit-PatchSet: 3
Gerrit-Owner: Nick Yamane <nick...@igalia.com>
Gerrit-Reviewer: Kramer Ge <fang...@chromium.org>
Gerrit-Reviewer: Nick Yamane <nick...@igalia.com>
Gerrit-CC: Antonio Gomes <toni...@igalia.com>
Gerrit-CC: Hunter Freyer <hjfr...@google.com>
Gerrit-CC: Maksim Sisov <msi...@igalia.com>
Gerrit-Attention: Nick Yamane <nick...@igalia.com>
Gerrit-Comment-Date: Thu, 02 Jun 2022 15:28:06 +0000

Nick Yamane (Gerrit)

unread,
Jun 3, 2022, 4:19:06 PM6/3/22
to ozone-...@chromium.org, Kramer Ge, Maksim Sisov, Antonio Gomes, Chromium LUCI CQ, chromium...@chromium.org, Hunter Freyer

Attention is currently required from: Kramer Ge.

View Change

1 comment:

To view, visit change 3647289. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia35f789d2e3452260be47b77062dd4715654fff0
Gerrit-Change-Number: 3647289
Gerrit-PatchSet: 3
Gerrit-Owner: Nick Yamane <nick...@igalia.com>
Gerrit-Reviewer: Kramer Ge <fang...@chromium.org>
Gerrit-Reviewer: Nick Yamane <nick...@igalia.com>
Gerrit-CC: Antonio Gomes <toni...@igalia.com>
Gerrit-CC: Hunter Freyer <hjfr...@google.com>
Gerrit-CC: Maksim Sisov <msi...@igalia.com>
Gerrit-Attention: Kramer Ge <fang...@chromium.org>
Gerrit-Comment-Date: Fri, 03 Jun 2022 20:18:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Nick Yamane (Gerrit)

unread,
Aug 10, 2022, 12:35:49 PM8/10/22
to ozone-...@chromium.org, Maksim Sisov, Antonio Gomes, Chromium LUCI CQ, chromium...@chromium.org, Hunter Freyer

Nick Yamane abandoned this change.

View Change

Abandoned superseded by https://crrev.com/c/3697539

To view, visit change 3647289. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia35f789d2e3452260be47b77062dd4715654fff0
Gerrit-Change-Number: 3647289
Gerrit-PatchSet: 4
Gerrit-Owner: Nick Yamane <nick...@igalia.com>
Gerrit-Reviewer: Kramer Ge <fang...@chromium.org>
Gerrit-Reviewer: Nick Yamane <nick...@igalia.com>
Gerrit-CC: Antonio Gomes <toni...@igalia.com>
Gerrit-CC: Hunter Freyer <hjfr...@google.com>
Gerrit-CC: Maksim Sisov <msi...@igalia.com>
Gerrit-MessageType: abandon
Reply all
Reply to author
Forward
0 new messages