<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 22 December 2015 at 00:13, Zhao Yakui <span dir="ltr"><<a href="mailto:yakui.zhao@intel.com" target="_blank">yakui.zhao@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span>On 12/22/2015 06:51 AM, Julien Isorce wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Hi,<br>
<br>
Should the application assume that vaapi is thread safe ? Like for vdpau:<br>
<a href="http://cgit.freedesktop.org/vdpau/libvdpau/tree/include/vdpau/vdpau.h#n209" rel="noreferrer" target="_blank">http://cgit.freedesktop.org/vdpau/libvdpau/tree/include/vdpau/vdpau.h#n209</a> .<br>
Or is the thread safety delegated to the vaapi user like many libraries ?<br>
</blockquote>
<br></span>
What is the scenario of using multi-thread?<span><br></span></blockquote><div><br><a href="https://github.com/mpv-player/mpv" target="_blank">https://github.com/mpv-player/mpv</a> or gstvaapidecode ! queue ! gstvaapipostproc ! queue ! vaapisink<br><br></div><div>Currently it relatively easy to crash the Gallium vaapi backend with these 2 examples. It does not crash with the intel-vaapi-driver.<br></div><div>That's why Christian submitted a patch recently: <a href="http://patchwork.freedesktop.org/patch/68461/">http://patchwork.freedesktop.org/patch/68461/</a> (It is the v1 but there will be a v2 to address small remarks)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I cannot see anything about thread in<br>
<a href="http://cgit.freedesktop.org/vaapi/libva/tree/va/va.h" rel="noreferrer" target="_blank">http://cgit.freedesktop.org/vaapi/libva/tree/va/va.h</a> .<br>
Though in the intel driver<br>
<a href="http://cgit.freedesktop.org/vaapi/intel-driver/" rel="noreferrer" target="_blank">http://cgit.freedesktop.org/vaapi/intel-driver/</a> there are some mutex:<br>
<br>
i965->pp_mutex : post processing<br>
i965->render_mutex : vaPutSurface<br>
intel->ctxmutex : does not seem to be used<br>
heap->mutex: (object_heap_allocate / object_heap_lookup ... )<br>
<br>
</blockquote>
<br></span>
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).<br>
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).</blockquote><div><br></div><div>Thx for the clarification, I believe these recommendations (for user and provider) should be in the libva doc.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
And the mutex is used for the container of object IDs. So the object Ids is thread safe. This is as what you mentioned.<br>
<br>
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.<br></blockquote><div><br></div><div>Make sense, also this is what Christian did in the above patch, thx.<br><br></div><div>Cheers<br></div><div>Julien<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Thanks<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span>
From that it means that the operations on the container of object IDs<br>
is thread safe. But no assumptions on the objects them-self.<br>
<br>
Any clarification in general ?<br>
<br>
Thx in advance<br>
Julien<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br></span>
_______________________________________________<br>
Libva mailing list<br>
<a href="mailto:Libva@lists.freedesktop.org" target="_blank">Libva@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/libva" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/libva</a><br>
</blockquote>
<br>
</blockquote></div><br></div></div>