<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mar. 12 janv. 2021 22 h 15, Bing Song <<a href="mailto:bing.song@nxp.com">bing.song@nxp.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="ZH-CN" link="blue" vlink="purple">
<div class="m_-7749704934577782545WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:DengXian">For video decoder output buffer, it can’t use out fence as video decoder output buffer reording.</span></p></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Hantro is a stateless decoder, reordering happens in userspace. For this reason, it is not affected by fence / queue ordering limitations.</div><div dir="auto"><br></div><div dir="auto">Of course, fences needs to be used inside the userspace decoder, so the you don't do lock step decoding inside your reordering queue. This is also true for current queue based decoding, I have patches pending to ensure that for V4L2codecs plugin.</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="ZH-CN" link="blue" vlink="purple"><div class="m_-7749704934577782545WordSection1"><p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:DengXian"> Video decoder output buffer can use input fence which from gl-render in Weston.
Can this use case improve performance?</span></p></div></div></blockquote></div></div><div dir="auto">I'm not sure how worthy having full duplex fence will benefit performance. Many GL stack uses implicit fences (only visible by kernel drivers, notably etnaviv). In that case, waiting for the fence is not about performance but correctness. I saw a kernel patch from Philipp Zabel that address this inside VB2 (which does not have any fence support), but the down side is that it blocks userspace inside qbuf ioctl. Implicit fence is strictly kernel. If it was explicit, we could wait or poll in userspace before reusing that buffer.</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="ZH-CN" link="blue" vlink="purple"><div class="m_-7749704934577782545WordSection1"><p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:DengXian"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:DengXian"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:DengXian">Regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:DengXian">Bing<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:DengXian"><u></u> <u></u></span></p>
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> gstreamer-devel <<a href="mailto:gstreamer-devel-bounces@lists.freedesktop.org" target="_blank" rel="noreferrer">gstreamer-devel-bounces@lists.freedesktop.org</a>>
<b>On Behalf Of </b>Nicolas Dufresne<br>
<b>Sent:</b> 2021</span><span style="font-family:SimSun">年</span><span lang="EN-US">1</span><span style="font-family:SimSun">月</span><span lang="EN-US">12</span><span style="font-family:SimSun">日</span><span lang="EN-US"> 22:19<br>
<b>To:</b> Discussion of the development of and with GStreamer <<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank" rel="noreferrer">gstreamer-devel@lists.freedesktop.org</a>><br>
<b>Subject:</b> [EXT] Re: V4L2 video decoder buffer fence<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p><b><span lang="EN-US" style="color:white;background:darkred">Caution: </span></b><span lang="EN-US" style="color:white;background:darkred">EXT Email
</span><span lang="EN-US"><u></u><u></u></span></p>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US"><u></u> <u></u></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">Le mar. 12 janv. 2021 02 h 15, Bing Song <<a href="mailto:bing.song@nxp.com" target="_blank" rel="noreferrer">bing.song@nxp.com</a>> a écrit :<u></u><u></u></span></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">Hi,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"> <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I want to implement v4l2 video decoder buffer fence. But I don</span><span style="font-family:DengXian">’</span><span lang="EN-US">t know why it can benefit performance?
Video HW decoder is one step decode. We use Hantro video decoder. CPU SW will parser SPS/PPS and slice header. HW will decode video frame within one step decode. How dma buf fence can benefit decode performance?<u></u><u></u></span></p>
</div>
</div>
</blockquote>
</div>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Fences alone don't save in performance. You need to combine these fences with a GPU or a display driver API to actually gain.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Fences in GPU and display driver are used to parallelize the processing without using extra threads, so without the context switch cost.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">With the fences, the driver can deliver incomplete frames and program the next job without blocking. This is equivalent to adding a render delay of 1 frame, but without the full frame latency.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Note that fences are not yet supported in V4L2 API, there was a proposal but with some limitations (ordering and timestamp related).<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
<div>
<div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal"><span lang="EN-US"> <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Bing<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US">_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank" rel="noreferrer">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fgstreamer-devel&data=04%7C01%7Cbing.song%40nxp.com%7C93e348942eed43cc95a208d8b70510e5%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637460579683369061%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=xqtnvbopz2%2BI41%2FELdtnB0JfJtJDMkMBIsdcBbu0eTs%3D&reserved=0" target="_blank" rel="noreferrer">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><u></u><u></u></span></p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank" rel="noreferrer">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</blockquote></div></div></div>