Skip to content

wayland: wait for initial surface configure before attaching buffer - #18350

Merged
Dudemanguy merged 1 commit into
mpv-player:masterfrom
llyyr:fix/surface-configure-race
Aug 9, 2026
Merged

Dudemanguy merged 1 commit into
mpv-player:masterfrom
llyyr:fix/surface-configure-race

Conversation

@llyyr

@llyyr llyyr commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #18347

@llyyr llyyr mentioned this pull request Aug 7, 2026
Comment thread video/out/wayland_common.c Outdated
@llyyr
llyyr force-pushed the fix/surface-configure-race branch from 5f369fe to 0fb4f13 Compare August 7, 2026 11:19
@thkoch2001

Copy link
Copy Markdown

This change fixes issue #18347 for me.

During testing I noticed that mpv apparently does not exit with an error code when the issue happens, or am I holding my bash wrong?

while mpv --length=0.1 --mute=yes $VIDEOFILE ; do true; done

@Dudemanguy Dudemanguy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess this is what has to be done here.

Comment on lines -4700 to -4702
/* Do another roundtrip to ensure all of the above is initialized
* before mpv does anything else. */
wl_display_roundtrip(wl->display);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this removed? wl_display_dispatch by itself does not ensure this.

@llyyr llyyr Aug 8, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

roundtrip ensures the compositor has seen previous requests. The compositor can't actually configure our surface if it hasn't seen previous requests, so I think dispatching until surface configure implies it.

Receiving the initial configure means the initial commit was processed, and because requests are processed in order, everything preceding that commit was processed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Please add some comments so no one will insert any requests between wl_surface_commit and this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wl_display_roundtrip internally does wl_display_dispatch.

@llyyr
llyyr force-pushed the fix/surface-configure-race branch from 0fb4f13 to b74231f Compare August 8, 2026 02:37
@Dudemanguy
Dudemanguy merged commit 513d340 into mpv-player:master Aug 9, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wayland race condition

5 participants