summaryrefslogtreecommitdiff
path: root/drivers/media/platform/coda/coda-bit.c
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2017-06-06 12:59:02 -0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-06-07 12:30:05 -0300
commitf903ebf751ddd58ee1a9c765888c0cad63176f4f (patch)
tree2a1fd47d664a3cce4e60294a2503b58cc789e2a1 /drivers/media/platform/coda/coda-bit.c
parent7e68c53387f1180745d6ef25d6425aef767b519e (diff)
[media] coda: copy headers in front of every I-frame
That way we don't have to rely on userspace to inject the headers on IDR requests, and there is always enough information to start decoding at an I-frame. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/platform/coda/coda-bit.c')
-rw-r--r--drivers/media/platform/coda/coda-bit.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c
index 22e4630f3671..2ec41375a896 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -1270,10 +1270,10 @@ static int coda_prepare_encode(struct coda_ctx *ctx)
coda_set_gdi_regs(ctx);
/*
- * Copy headers at the beginning of the first frame for H.264 only.
- * In MPEG4 they are already copied by the coda.
+ * Copy headers in front of the first frame and forced I frames for
+ * H.264 only. In MPEG4 they are already copied by the CODA.
*/
- if (src_buf->sequence == 0) {
+ if (src_buf->sequence == 0 || force_ipicture) {
pic_stream_buffer_addr =
vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0) +
ctx->vpu_header_size[0] +
@@ -1386,7 +1386,8 @@ static void coda_finish_encode(struct coda_ctx *ctx)
wr_ptr = coda_read(dev, CODA_REG_BIT_WR_PTR(ctx->reg_idx));
/* Calculate bytesused field */
- if (dst_buf->sequence == 0) {
+ if (dst_buf->sequence == 0 ||
+ src_buf->flags & V4L2_BUF_FLAG_KEYFRAME) {
vb2_set_plane_payload(&dst_buf->vb2_buf, 0, wr_ptr - start_ptr +
ctx->vpu_header_size[0] +
ctx->vpu_header_size[1] +