From 18b112bcfe7f0758afb3550ae0b10edb567d9b30 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 29 Jan 2024 16:10:36 +0100 Subject: [PATCH] v4l2: clear support for alloc_buffers on failure When we try to alloc buffers but EXPBUF is not supported, make sure to clear the alloc_buffers flag so that the caller can try again with allocated buffers instead. See #3821 --- spa/plugins/v4l2/v4l2-utils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spa/plugins/v4l2/v4l2-utils.c b/spa/plugins/v4l2/v4l2-utils.c index f1ef800df..0c7626eb3 100644 --- a/spa/plugins/v4l2/v4l2-utils.c +++ b/spa/plugins/v4l2/v4l2-utils.c @@ -1584,6 +1584,7 @@ mmap_init(struct impl *this, spa_log_debug(this->log, "data types %08x", d[0].type); +again: if (port->have_expbuf && d[0].type != SPA_ID_INVALID && (d[0].type & ((1u << SPA_DATA_DmaBuf)|(1u<log, "'%s' VIDIOC_EXPBUF not supported: %m", this->props.device); port->have_expbuf = false; - goto fallback; + goto again; } spa_log_error(this->log, "'%s' VIDIOC_EXPBUF: %m", this->props.device); return -errno; @@ -1614,7 +1615,6 @@ mmap_init(struct impl *this, spa_log_debug(this->log, "EXPBUF fd:%d", expbuf.fd); use_expbuf = true; } else if (d[0].type & (1u << SPA_DATA_MemPtr)) { -fallback: d[0].type = SPA_DATA_MemPtr; d[0].flags = SPA_DATA_FLAG_READABLE; d[0].fd = -1; @@ -1634,6 +1634,7 @@ fallback: use_expbuf = false; } else { spa_log_error(this->log, "unsupported data type:%08x", d[0].type); + port->alloc_buffers = false; return -ENOTSUP; } spa_v4l2_buffer_recycle(this, i);