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

movit module may deadlock in multiple threads #1053

Open
liubailin2017 opened this issue Nov 19, 2024 · 6 comments
Open

movit module may deadlock in multiple threads #1053

liubailin2017 opened this issue Nov 19, 2024 · 6 comments
Labels

Comments

@liubailin2017
Copy link

This tracker is for defects only! For feature requests, you can submit a pull
request with the changes.

If you’re reporting a defect, make it as detailed as possible, and include both your operating system and MLT versions (e.g. macOS 10.16; MLT v7.4.0).

Line 504 of filter_glsl_manager.cpp. glFlush(); should be placed after glFenceSync(line510). Avoid deadlocks in multiple threads
I'm not sure.

@ddennedy
Copy link
Member

Please some evidence or proof.

@liubailin2017
Copy link
Author

liubailin2017 commented Nov 20, 2024

The glFlush() and glFenceSync() functions might operate in different contexts.That could be a potential problem.
in addition,I tried to open the GPU's transition in shotcut with sharecontext.A deadlock occurs,It is because there is a glFenceSync in the MOVIT project without glFlush.
“Therefore, not only must you perform a flush, you must perform that flush on the same context that created the sync object.”(https://www.khronos.org/opengl/wiki/Sync_Object )
My English is very poor, I hope you can understand what I mean.

@ddennedy ddennedy changed the title may deadlocks in multiple threads movit module may deadlock in multiple threads Nov 20, 2024
@ddennedy
Copy link
Member

might operate in different contexts

Why would there be different contexts? You are only supposed to use one with MLT and its Movit module, named the "render context" in this help page: https://mltframework.org/docs/opengl/
It also talks a lot about threads. Have you read that?
If you want to make an improvement or fix submit a pull request.

@liubailin2017
Copy link
Author

liubailin2017 commented Nov 21, 2024

When there is a producer in the preview interface and a producer in the main interface, wouldn't there be two contexts?
For example, in shotcut.
There is code like "if (Settings.playerGPU()) return;" in the shotcut project Producerpreviewwidget.cpp. Is it because mlt does not support multiple contexts? I'm now trying to enable the preview feature and it's working. But i need to modify the code of the movit project. I don't know where to pull.
I don’t know if it’s appropriate to discuss shotcut here.

@ddennedy
Copy link
Member

You can contact the author of Movit by email. He does not use a system like GitHub or gitlab.

@ddennedy
Copy link
Member

glFlush(); should be placed after glFenceSync

The order of the lines is not important; it is the order of the calls. The glFlush() does occur after the glFenceSync() on the current sync object prev_sync. Pay attention to the iteration. On the first iteration C++ member variable prev_sync is NULL, then it is created with glFenceSync() and saved. On the next iteration, prev_sync is not NULL, and then glFlush() is called.

Is it because mlt does not support multiple contexts?

The movit module does not support multiple contexts, mainly due to the glsl.manager filter, which is a global object. This is already being used by the player in Shotcut. Shotcut does not have a way to suspend the player to release its usage of MLT movit in order to use it with a different context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants