On 22 December 2015 at 00:13, Zhao Yakui <[email protected]> wrote:
> 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? > https://github.com/mpv-player/mpv or gstvaapidecode ! queue ! gstvaapipostproc ! queue ! vaapisink Currently it relatively easy to crash the Gallium vaapi backend with these 2 examples. It does not crash with the intel-vaapi-driver. That's why Christian submitted a patch recently: http://patchwork.freedesktop.org/patch/68461/ (It is the v1 but there will be a v2 to address small remarks) > > >> 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). Thx for the clarification, I believe these recommendations (for user and provider) should be in the libva doc. > > 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. > Make sense, also this is what Christian did in the above patch, thx. Cheers Julien > > 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 >> [email protected] >> http://lists.freedesktop.org/mailman/listinfo/libva >> > >
_______________________________________________ Libva mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libva
