Repository navigation
Conversation
AImage_delete() returns the buffer to the decoder right away, without a release fence. Unmapping right after submitting the draws that read from the image is fine as far as GL is concerned, but the decoder can then write the next frame into the buffer while the GPU is still reading from it, which shows up as tearing (parts of two different frames in one rendered frame). Record a fence in end_access() after each use of the image. On release, pass it to the decoder through AImage_deleteAsync() if EGL_ANDROID_native_fence_sync is available, so it waits for the GPU on its own. Otherwise, wait for the fence before calling AImage_delete(). This solves the same kind of problem as the semaphores in hwdec_vulkan. Fix mpv-android/mpv-android#1289 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
moi15moi
force-pushed
the
fix-aimagereader-release-fence
branch
from
November 26, 2026 02:30
cc26704 to
984e99c
Compare
Contributor
Author
|
You can ignore the force-pushed. |
kasper93
requested review from
sfan5
and
a balanced review from Copilot
and removed request for
Copilot
November 26, 2026 02:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AImage_delete() returns the buffer to the decoder right away, without a release fence. Unmapping right after submitting the draws that read from the image is fine as far as GL is concerned, but the decoder can then write the next frame into the buffer while the GPU is still reading from it, which shows up as tearing (parts of two different frames in one rendered frame).
Record a fence in end_access() after each use of the image. On release, pass it to the decoder through AImage_deleteAsync() if EGL_ANDROID_native_fence_sync is available, so it waits for the GPU on its own. Otherwise, wait for the fence before calling AImage_delete(). This solves the same kind of problem as the semaphores in hwdec_vulkan.
Fix mpv-android/mpv-android#1289
Note that this PR was assisted with a LLM (Claude Opus 5.5).