aboutsummaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2013-06-03 03:23:48 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2013-07-26 09:00:33 -0400
commit33bdd5a88a0fb7fbd08947261b243fcec4ff089d (patch)
tree60d667ab66261be2cf361c648a7eff54ba0b920a /include/media
parentc859e6ef33ac0c9a5e9e934fe11a2232752b4e96 (diff)
[media] mem2mem: add support for hardware buffered queue
On mem2mem decoders with a hardware bitstream ringbuffer, to drain the buffer at the end of the stream, remaining frames might need to be decoded from the bitstream buffer without additional input buffers being provided. To achieve this, allow a queue to be marked as buffered by the driver, and allow scheduling of device_runs when buffered ready queues are empty. This also allows a driver to copy input buffers into their bitstream ringbuffer and immediately mark them as done to be dequeued. The motivation for this patch is hardware assisted h.264 reordering support in the coda driver. For high profile streams, the coda can hold back out-of-order frames, causing a few mem2mem device runs in the beginning, that don't produce any decompressed buffer at the v4l2 capture side. At the same time, the last few frames can be decoded from the bitstream with mem2mem device runs that don't need a new input buffer at the v4l2 output side. The decoder command ioctl can be used to put the decoder into the ringbuffer draining end-of-stream mode. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'include/media')
-rw-r--r--include/media/v4l2-mem2mem.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
index 0f4555b2a31b..44542a20ab81 100644
--- a/include/media/v4l2-mem2mem.h
+++ b/include/media/v4l2-mem2mem.h
@@ -60,6 +60,7 @@ struct v4l2_m2m_queue_ctx {
60 struct list_head rdy_queue; 60 struct list_head rdy_queue;
61 spinlock_t rdy_spinlock; 61 spinlock_t rdy_spinlock;
62 u8 num_rdy; 62 u8 num_rdy;
63 bool buffered;
63}; 64};
64 65
65struct v4l2_m2m_ctx { 66struct v4l2_m2m_ctx {
@@ -134,6 +135,18 @@ struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(struct v4l2_m2m_dev *m2m_dev,
134 void *drv_priv, 135 void *drv_priv,
135 int (*queue_init)(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq)); 136 int (*queue_init)(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq));
136 137
138static inline void v4l2_m2m_set_src_buffered(struct v4l2_m2m_ctx *m2m_ctx,
139 bool buffered)
140{
141 m2m_ctx->out_q_ctx.buffered = buffered;
142}
143
144static inline void v4l2_m2m_set_dst_buffered(struct v4l2_m2m_ctx *m2m_ctx,
145 bool buffered)
146{
147 m2m_ctx->cap_q_ctx.buffered = buffered;
148}
149
137void v4l2_m2m_ctx_release(struct v4l2_m2m_ctx *m2m_ctx); 150void v4l2_m2m_ctx_release(struct v4l2_m2m_ctx *m2m_ctx);
138 151
139void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, struct vb2_buffer *vb); 152void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, struct vb2_buffer *vb);