aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2019-01-30 09:02:14 (GMT)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2019-01-30 09:10:18 (GMT)
commitf3e6145eb0b9f51a8e593cc589adfac71d92eb6e (patch)
treea89dad42488fc499667550ab671fae5dd7f73c25
parent92120ddcbaca524cd90154ff482f4b326c68de09 (diff)
(c)v4l-helpers.h: add v4l_queue_buffer_update()
The existing v4l_queue_buffer_init() clears all fields of a buffer, but that's not what is needed when queueing an output buffer: in that case the values returned by QUERYBUF should be kept, and only the relevant fields for MEMORY_USERPTR and MEMORY_DMABUF should be updated. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--utils/common/cv4l-helpers.h8
-rw-r--r--utils/common/v4l-helpers.h10
2 files changed, 16 insertions, 2 deletions
diff --git a/utils/common/cv4l-helpers.h b/utils/common/cv4l-helpers.h
index 1928d6f..1cd2b6b 100644
--- a/utils/common/cv4l-helpers.h
+++ b/utils/common/cv4l-helpers.h
@@ -809,6 +809,10 @@ public:
{
v4l_queue_buffer_init(this, &buf, index);
}
+ void buffer_update(v4l_buffer &buf, unsigned index) const
+ {
+ v4l_queue_buffer_update(this, &buf, index);
+ }
int queue_all(cv4l_fd *fd);
};
@@ -842,6 +846,10 @@ public:
if (v4l_type_is_planar(g_type()))
buf.m.planes = planes;
}
+ void update(const cv4l_queue &q, unsigned index = 0)
+ {
+ q.buffer_update(*this, index);
+ }
__u32 g_index() const { return v4l_buffer_g_index(this); }
void s_index(unsigned index) { v4l_buffer_s_index(this, index); }
diff --git a/utils/common/v4l-helpers.h b/utils/common/v4l-helpers.h
index a4739cb..59d8566 100644
--- a/utils/common/v4l-helpers.h
+++ b/utils/common/v4l-helpers.h
@@ -1728,11 +1728,11 @@ static inline void v4l_queue_free(struct v4l_fd *f, struct v4l_queue *q)
v4l_queue_reqbufs(f, q, 0);
}
-static inline void v4l_queue_buffer_init(const struct v4l_queue *q, struct v4l_buffer *buf, unsigned index)
+static inline void v4l_queue_buffer_update(const struct v4l_queue *q,
+ struct v4l_buffer *buf, unsigned index)
{
unsigned p;
- v4l_buffer_init(buf, v4l_queue_g_type(q), v4l_queue_g_memory(q), index);
if (v4l_type_is_planar(q->type)) {
buf->buf.length = v4l_queue_g_num_planes(q);
buf->buf.m.planes = buf->planes;
@@ -1753,6 +1753,12 @@ static inline void v4l_queue_buffer_init(const struct v4l_queue *q, struct v4l_b
}
}
+static inline void v4l_queue_buffer_init(const struct v4l_queue *q, struct v4l_buffer *buf, unsigned index)
+{
+ v4l_buffer_init(buf, v4l_queue_g_type(q), v4l_queue_g_memory(q), index);
+ v4l_queue_buffer_update(q, buf, index);
+}
+
static inline int v4l_query_ext_ctrl(v4l_fd *f, struct v4l2_query_ext_ctrl *qec,
bool next_ctrl, bool next_compound)
{

Privacy Policy