v4l2: DmaBuf and MemFd are mostly the same

If the caller asks for MemFd, pass a DmaBuf because it is mostly
the same for v4l2.

Not very correct but it's not yet trivial to fall back to memfd.
And this way we have something to give to the clients that will work
when the client asks for MemFd or MemPtr.
This commit is contained in:
Wim Taymans 2021-06-28 14:55:05 +02:00
parent c68a7cd603
commit d6a569620c

View file

@ -1462,7 +1462,7 @@ mmap_init(struct impl *this,
if (port->have_expbuf &&
d[0].type != SPA_ID_INVALID &&
(d[0].type & (1u << SPA_DATA_DmaBuf))) {
(d[0].type & ((1u << SPA_DATA_DmaBuf)|(1u<<SPA_DATA_MemFd)))) {
struct v4l2_exportbuffer expbuf;
spa_zero(expbuf);
@ -1479,7 +1479,10 @@ mmap_init(struct impl *this,
spa_log_error(this->log, "v4l2: '%s' VIDIOC_EXPBUF: %m", this->props.device);
return -errno;
}
if (d[0].type & (1u<<SPA_DATA_DmaBuf))
d[0].type = SPA_DATA_DmaBuf;
else
d[0].type = SPA_DATA_MemFd;
d[0].flags = SPA_DATA_FLAG_READABLE;
d[0].fd = expbuf.fd;
d[0].data = NULL;