How to use VAAPI + appsink with zero copy / mmap ?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to use VAAPI + appsink with zero copy / mmap ?

Harms Hannes

Hi,

I have tied to use VAAPI + appsink  with zero copy via DMABuf / mmap.

Therefore I used the following pipeline:

application/x-rtp, encoding-name=JPEG,payload=26 ! rtpjpegdepay !
vaapijpegdec ! capsfilter caps=video/x-raw(memory:DMABuf),format=I420
! appsink name=sink

Code form the appsink:

GstMemory* mem = gst_buffer_peek_memory(buffer, 0);
int fd = gst_dmabuf_memory_get_fd(mem);
void* map_data =  mmap(NULL,size,PROT_READ |
PROT_WRITE,MAP_SHARED,fd,0);

However mmap fails with Permission Denied, because the buffer is not
writable.

I tried again with:

void* map_data =  mmap(NULL,size,PROT_READ,MAP_SHARED,fd,0);

However the mapped data contains only zeros.

What am I missing?

Hardware is a Intel Atom E3950. Gstreamer 1.14.1

I also tried to to use VASurface,
but it is still unclear to me how to access data of a VASurface within
a appsink.








_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to use VAAPI + appsink with zero copy / mmap ?

Victor Jaquez
Using memory:VASurface you can map it as a normal gst video frame:
gst_video_frame_map

Intel driver allocates the dmabuf without reading permission, if I recall
correctly. So, if you want to use dmabuf, you should import it as EGLImage,
as glupload does.

vmjl



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel