Carlos Rafael Giani
unread,May 26, 2021, 5:26:13 AM5/26/21Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to media-dev
I've been looking at the new VideoDecoder base class which has been
recommended to me as an alternative to the VideoDecodeAccelerator.
So far, this seems very interesting, since the hardware decoder I am
writing this code for does not actually need access to any GPU
resources. Instead, it decodes packetized elementary streams (that is,
it is _not_ slice-based) and writes the decoded frames into DMA-BUF buffers.
Now, I see the OutputCB callback in VideoDecoder. And, VideoFrame has
the WrapExternalDmabufs() function. My question now is: How do I know
when I can reuse a DMA-BUF buffer? In the VDA, there's
ReusePictureBuffer(). The PictureBufferManager in the VDAVideoDecoder
uses sync tokens that tie into the GPU. Is it possible for me to know
when I can reuse a DMA-BUF buffer without these GPU based mechanisms? I
realize that I can dup() a DMA-BUF FD, but with this decoder, I still
have to let it know when it can use a buffer again. That's because the
hardware decoder's driver does not directly use dma-buf. Instead, it
uses physical addresses, and thus does not know anything about buffer
sharing. (There are ways on that platform to get the physical address
from a DMA-BUF buffer, and I know having such addresses is very
insecure, but there's no other way on that platform, unfortunately.) So,
I must let the hw decoder know when Chromium is done with that picture.
On a related note, this also means that the buffer must not be reused by
the hw decoder until the GPU itself is fully done with that picture.
When I integrated that hw decoder using a VDA, I added code to manually
use an EGL fence to not return the picture until the EGL sync object was
signaled. With DMA-BUF buffers, do I still have to do something like that?
cheers