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

video/vdpau: change is_preempted bool to atomic #15997

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kasper93
Copy link
Contributor

@kasper93 kasper93 commented Mar 3, 2025

And eliminate recursive lock. This doesn't have to be guarded by mutex, if for some reason preemption happens while we are handling preemption, we remember the flag and do the dance gain. This is even nicer than locking preemption callback.

@kasper93 kasper93 marked this pull request as ready for review March 3, 2025 18:46
Copy link

github-actions bot commented Mar 3, 2025

Download the artifacts for this pull request:

Windows
macOS

@kasper93 kasper93 force-pushed the vdpau_atomic branch 2 times, most recently from 0ea653d to af99baa Compare March 3, 2025 20:00
@Dudemanguy
Copy link
Member

Pinging @DanOscarsson. Sorry to bug but could you check if this PR works for you?

@DanOscarsson
Copy link
Contributor

As I normally never gets preemption it is not that easy to test. Also have just upgraded my os so will take some time before I can compile and test.
Looking at the diff I think it looks ok.
The only thing I can see is that win_x11_init_vdpau_procs will probably give a message it did not before, if creating device fails. This because is_preempted is now reset in beginning of handle_preemption.
As I have not had a preemption that I remember I cannot say if
this would be annoying. It should not change the handling, from what I can see in the code.
That is what I see by just looking at the code and the diff.

@kasper93
Copy link
Contributor Author

kasper93 commented Mar 4, 2025

The only thing I can see is that win_x11_init_vdpau_procs will probably give a message it did not before, if creating device fails.

Yes, it would trigger different log message. I've seen that, but wasn't too concerned about it. It wasn't even synchronized before, but since win_x11_init_vdpau_procs suppose to be called only in two places, I can make it not check the flag at all.

EDIT:

Fixed log message.

And eliminate recursive lock. This doesn't have to be guarded by mutex,
if for some reason preemption happens while we are handling preemption,
we remember the flag and do the dance gain. This is even nicer than
locking preemption callback.
@kasper93 kasper93 added this to the Release v0.41.0 milestone Mar 6, 2025
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.

3 participants