-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Misc display sync fixes #15259
base: master
Are you sure you want to change the base?
Misc display sync fixes #15259
Conversation
into get_display_synced_frame_end. Used in next commit.
Download the artifacts for this pull request: |
video/out/vo.c
Outdated
@@ -489,11 +489,14 @@ static void update_vsync_timing_after_swap(struct vo *vo, | |||
} | |||
|
|||
in->num_successive_vsyncs++; | |||
if (in->num_successive_vsyncs <= DELAY_VSYNC_SAMPLES) | |||
if (in->num_successive_vsyncs <= DELAY_VSYNC_SAMPLES) { | |||
in->base_vsync += in->vsync_interval; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is correct to increment base_vsync
here. It is updated in update_vsync_timing_after_swap
and this function makes sure valid value is used. base_vsync is last valid point, incrementing with with interval will accumulate a lot of drift, making this value unreliable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it makes more sense to set it to the actual vsync instead of incrementing by nominal vsync interval. Updated the patch
This is still used for caclulating a/v sync and delay remaining even for initial samples, so we should always update it with nominal vsync interval. And if we receive bogus values, also reset it to 0 along with prev_vsync.
2c6e957
to
0e15601
Compare
First two commits are entirely theoretical, it's more correct but it probably doesn't matter much because this code is only used to detect underruns and to wait for a frame to finish before applying new image_params.
Third commit fixes a real world problem with bad drivers that I encountered while testing various wip fifo-v1/commit-timing implementations. By not always updating base_vsync, we could potentially end up in a permanent underflow state and never recover from it even once the driver has stopped giving us bogus values.