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

mac/vulkan: workaround for MoltenVK problem that causes flicker #13651

Merged
merged 2 commits into from
Mar 6, 2024

Conversation

Akemi
Copy link
Member

@Akemi Akemi commented Mar 6, 2024

first commit works around a broken workaround: https://github.com/KhronosGroup/MoltenVK/blame/b56c152a1245a95e7d4e8d64baca8ae42e85ae6a/MoltenVK/MoltenVK/GPUObjects/MVKSwapchain.mm#L274-L283

MoltenVK itself tries to work around a supposedly Metal problem that itself causes flicker, black screens or broken rendering. it sets the drawableSize to 1x1 to forcefully complete the presentation. though if 1x1 resolution frame is presented it causes a visual flicker or rather a solid coloured frame. it causes even more problems since sometimes it does not reset the drawableSize to the proper resolution and keeps rendering everything in 1x1.

work around this workaround by discarding drawableSize that are <=1 in any direction.

second commit is just some minor bugfix and optimisation.

Akemi added 2 commits March 6, 2024 22:10
MoltenVK itself tries to work around a supposedly Metal problem that
itself causes flicker, black screens or broken rendering. it sets the
drawableSize to 1x1 to forcefully complete the presentation. though if
1x1 resolution frame is presented it causes a visual flicker or rather
a solid coloured frame. it causes even more problems since sometimes it
does not reset the drawableSize to the proper resolution and keeps
rendering everything in 1x1.

work around this workaround by discarding drawableSize that are <=1 in
any direction.

Fixes mpv-player#13505
the render size cached in ctx->vo->dwidth/dheight can be outdated in
some circumstances at the time the context needs resizing. instead use
the current render size.
Copy link
Member

@jeeb jeeb left a comment

Choose a reason for hiding this comment

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

I absolutely dislike the first commit, but given the issue with https://github.com/KhronosGroup/MoltenVK/blame/b56c152a1245a95e7d4e8d64baca8ae42e85ae6a/MoltenVK/MoltenVK/GPUObjects/MVKSwapchain.mm#L274-L283 it's kind of required until upstream handles their stuff.

Copy link

github-actions bot commented Mar 6, 2024

Download the artifacts for this pull request:

Windows
macOS

@jeeb jeeb merged commit 68c61fd into mpv-player:master Mar 6, 2024
14 checks passed
@Akemi Akemi deleted the mac_vulkan_flicker branch March 7, 2024 00:04
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.

2 participants