<div dir="ltr">I am not sure if LibDRM got ported for the rockchip MESA drivers. I tip my hat to you. I tried getting GStreamer to work with my board and the only thing I could get working was the very low-level ffmpeg commands. Even that was touchy. If you need help testing it out, let me know. <div><br></div><div>Thanks,</div><div>~Ben</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 15, 2018 at 5:49 PM Nicolas Dufresne <<a href="mailto:nicolas@ndufresne.ca">nicolas@ndufresne.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Le lundi 15 octobre 2018 à 17:04 -0300, Ezequiel Garcia a écrit :<br>
> On Mon, 15 Oct 2018 at 10:07, Víctor Jáquez <<a href="mailto:vjaquez@igalia.com" target="_blank">vjaquez@igalia.com</a>><br>
> wrote:<br>
> > <br>
> > Hi,<br>
> > <br>
> > On Fri, 12 Oct 2018 at 16:58, Ezequiel Garcia wrote:<br>
> > > Victor,<br>
> > > <br>
> > > Found some time to pick up my investigation on vaapi on v4l,<br>
> > > using<br>
> > > bootlin's vaapi backend.<br>
> > > I am using gst-build to get latest sources, and set the env<br>
> > > variables<br>
> > > as you suggested.<br>
> > > The vaapi backend is properly detected:<br>
> > > <br>
> > > # gst-inspect-1.0 vaapi<br>
> > > Plugin Details:<br>
> > >   Name                     vaapi<br>
> > >   Description              VA-API based elements<br>
> > >   Filename<br>
> > > /root/gst-build/build/subprojects/gstreamer-<br>
> > > vaapi/gst/vaapi/libgstvaapi.so<br>
> > >   Version                  1.15.0.1<br>
> > >   License                  LGPL<br>
> > >   Source module            gstreamer-vaapi<br>
> > >   Binary package           gstreamer-vaapi<br>
> > >   Origin URL<br>
> > > <a href="http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer" rel="noreferrer" target="_blank">http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer</a><br>
> > > <br>
> > >   vaapimpeg2dec: VA-API MPEG2 decoder<br>
> > >   vaapipostproc: VA-API video postprocessing<br>
> > >   vaapidecodebin: VA-API Decode Bin<br>
> > >   vaapisink: VA-API sink<br>
> > > <br>
> > >   4 features:<br>
> > >   +-- 4 elements<br>
> > > <br>
> > > The pipeline I  am trying now is (see full log below):<br>
> > > <br>
> > > GST_DEBUG=vaapi*:4 gst-launch-1.0 filesrc<br>
> > > location=~/big_buck_bunny_480p_MPEG2_MP2_25fps_1800K.MPG !<br>
> > > mpegpsdemux<br>
> > > ! vaapimpeg2dec ! video/x-raw,width=854,height=480 ! kmssink<br>
> > > <br>
> > > Now, my question is: is it possible to connect a vaapi decoder to<br>
> > > a<br>
> > > non-vaapi sink? Judging from this traces:<br>
> > > <br>
> > > 0:00:01.230428590 32630   0x555350 INFO             vaapidecode<br>
> > > gstvaapipluginbase.c:959:gst_vaapi_plugin_base_decide_allocation:<br>
> > > <vaapidecode_mpeg2-0><br>
> > > ignoring non-VAAPI pool: <kmsbufferpool1><br>
> > > 0:00:01.270321791 32630   0x555350 ERROR                  vaapi<br>
> > > gstvaapibufferproxy.c:228:gst_vaapi_buffer_proxy_new_from_object:<br>
> > > failed to acquire the underlying VA buffer handle<br>
> > > 0:00:01.270796060 32630   0x555350 ERROR                default<br>
> > > gstvaapisurface_drm.c:54:gst_vaapi_surface_get_drm_buf_handle:<br>
> > > failed<br>
> > > to allocate export buffer proxy<br>
> > > <br>
> > > I think not. So, I need to add proper support for a vaapisink DRM<br>
> > > display, right?<br>
> > <br>
> > Nope, you should be capable to use (almost) any sink.<br>
> > <br>
> <br>
> OK, cool. So I have dig it further and managed to get some<br>
> results. Still not working fully.<br>
> <br>
> > For example, I have a blog post, using an atom board, playing a<br>
> > video with vaapi<br>
> > and kmssink<br>
> > <br>
> > <br>
<a href="https://blogs.igalia.com/vjaquez/2016/07/01/va-api-and-drmkms-in-minnowboard/" rel="noreferrer" target="_blank">https://blogs.igalia.com/vjaquez/2016/07/01/va-api-and-drmkms-in-minnowboard/</a><br>
> > <br>
> > If I understand correctly the logs, vaapi decides to use the dmabuf<br>
> > allocator<br>
> > for the src allocator but when the decode wants to use those<br>
> > surfaces, the<br>
> > cannot be allocated.<br>
> > <br>
> > I would recommend, as a test, to change the code to use the surface<br>
> > allocator<br>
> > and use the vaapi mapping when copying the frames to kmssink.<br>
> > <br>
> > <br>
<a href="https://cgit.freedesktop.org/gstreamer/gstreamer-vaapi/tree/gst/vaapi/gstvaapipluginbase.c#n532" rel="noreferrer" target="_blank">https://cgit.freedesktop.org/gstreamer/gstreamer-vaapi/tree/gst/vaapi/gstvaapipluginbase.c#n532</a><br>
> > <br>
> > Is dmabuf supported bye the v4l2 vaapi driver??<br>
> > <br>
> <br>
> Yes, it does.<br>
> <br>
> However, I found a few things that seemed off:<br>
> <br>
> 1. On this particular platform, the library requires<br>
> PRIME_2 buffer type for AcquireBufferHandle.<br>
> It's done only if the pixel format is tiled,<br>
> but I have relaxed the requirement, since it<br>
> doesn't seem needed to acquire the buffer.<br>
> <br>
> See: <br>
> <a href="https://github.com/bootlin/libva-v4l2-request/blob/master/src/buffer.c#L212" rel="noreferrer" target="_blank">https://github.com/bootlin/libva-v4l2-request/blob/master/src/buffer.c#L212</a><br>
> <br>
> 2. Also, since there is no GetImage implementation<br>
> I have enabled GST_VAAPI_ENABLE_DIRECT_RENDERING=1,<br>
> so DeriveImage is used.<br>
> <br>
> Although there are some artifacts, see image attached,<br>
> and also there's a SIGSEGV somewhere in v4l library.<br>
> <br>
> However, I think this will prevent proper zero-copy to work,<br>
> since DeriveImage is effectively memcpying<br>
> the surface into an image.<br>
> <br>
> Does gst-vaapi support zero-copy VAAPI to DRM ?<br>
<br>
Not at the moment. There is no VAAPI DRM backend, and the dmabuf<br>
exportation need to be ported to PRIME_2 in order to expose the<br>
modifiers. Whenever there is no modifiers, normal DMABuf will be used<br>
and then kmssink could work.<br>
<br>
> <br>
> Do you know what hooks should I implement in the vaapi backend?<br>
> GetImage is not implemented, but I suspect it would<br>
> be another memcpy, or am I wrong?<br>
> <br>
> Thanks a lot!<br>
> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</blockquote></div>