[Libva] multi-threading

Zhao Yakui yakui.zhao at intel.com
Mon Dec 21 16:13:42 PST 2015


On 12/22/2015 06:51 AM, Julien Isorce wrote:
> Hi,
>
> Should the application assume that vaapi is thread safe ? Like for vdpau:
> http://cgit.freedesktop.org/vdpau/libvdpau/tree/include/vdpau/vdpau.h#n209 .
> Or is the thread safety delegated to the vaapi user like many libraries ?

What is the scenario of using multi-thread?

>
> I cannot see anything about thread in
> http://cgit.freedesktop.org/vaapi/libva/tree/va/va.h .
> Though in the intel driver
> http://cgit.freedesktop.org/vaapi/intel-driver/ there are some mutex:
>
> i965->pp_mutex : post processing
> i965->render_mutex : vaPutSurface
> intel->ctxmutex : does not seem to be used
> heap->mutex: (object_heap_allocate / object_heap_lookup ... )
>

As we know, the va is mainly used for the decoding/encoding/VPP, which 
is executed in one context(This is created by calling vaCreateContext).
And it will be better that the operation related with the specific 
context is handled in one thread(For example: the creation/release of 
the parameter buffer).

And the mutex is used for the container of object IDs. So the object Ids 
is thread safe. This is as what you mentioned.

But the object is not thread-safe. For example: one thread creates one 
object buffer and another thread tries to access it. If the buffer is 
destroyed, maybe the access will fail.

Thanks

>  From that it means that the operations on the container of object IDs
> is thread safe. But no assumptions on the objects them-self.
>
> Any clarification in general ?
>
> Thx in advance
> Julien
>
>
>
>
>
>
>
> _______________________________________________
> Libva mailing list
> Libva at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libva



More information about the Libva mailing list