[media] v4l: Copy timestamp source flags to destination on m2m devices
authorSakari Ailus <sakari.ailus@iki.fi>
Sat, 8 Feb 2014 17:21:35 +0000 (14:21 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Wed, 5 Mar 2014 19:47:15 +0000 (16:47 -0300)
Copy the flags containing the timestamp source from source buffer flags to
the destination buffer flags on memory-to-memory devices. This is analogous
to copying the timestamp field from source to destination.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/platform/coda.c
drivers/media/platform/exynos-gsc/gsc-m2m.c
drivers/media/platform/exynos4-is/fimc-m2m.c
drivers/media/platform/m2m-deinterlace.c
drivers/media/platform/mem2mem_testdev.c
drivers/media/platform/mx2_emmaprp.c
drivers/media/platform/s5p-g2d/g2d.c
drivers/media/platform/s5p-jpeg/jpeg-core.c
drivers/media/platform/s5p-mfc/s5p_mfc.c
drivers/media/platform/ti-vpe/vpe.c

index 81b6f7b1d6af7ca0b144a2f149fdcc9cf24c0e2c..3e5199ee5d2503c57f37276748f527aa00e8cc18 100644 (file)
@@ -2829,6 +2829,9 @@ static void coda_finish_encode(struct coda_ctx *ctx)
        }
 
        dst_buf->v4l2_buf.timestamp = src_buf->v4l2_buf.timestamp;
+       dst_buf->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+       dst_buf->v4l2_buf.flags |=
+               src_buf->v4l2_buf.flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
        dst_buf->v4l2_buf.timecode = src_buf->v4l2_buf.timecode;
 
        v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE);
index 3a842ee38f9366360e3ddcf0859912bc8a81cb20..d0ea94f58d6f5ce84e05dfc6efcdfd49f48f74ff 100644 (file)
@@ -90,6 +90,10 @@ void gsc_m2m_job_finish(struct gsc_ctx *ctx, int vb_state)
        if (src_vb && dst_vb) {
                dst_vb->v4l2_buf.timestamp = src_vb->v4l2_buf.timestamp;
                dst_vb->v4l2_buf.timecode = src_vb->v4l2_buf.timecode;
+               dst_vb->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+               dst_vb->v4l2_buf.flags |=
+                       src_vb->v4l2_buf.flags
+                       & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
 
                v4l2_m2m_buf_done(src_vb, vb_state);
                v4l2_m2m_buf_done(dst_vb, vb_state);
index bfc900d67a5995d79b66dc8e5d97d175b2ae126b..36971d915b530ac3ee284ec80d892459ef7e7333 100644 (file)
@@ -134,6 +134,9 @@ static void fimc_device_run(void *priv)
                goto dma_unlock;
 
        dst_vb->v4l2_buf.timestamp = src_vb->v4l2_buf.timestamp;
+       dst_vb->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+       dst_vb->v4l2_buf.flags |=
+               src_vb->v4l2_buf.flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
 
        /* Reconfigure hardware if the context has changed. */
        if (fimc->m2m.ctx != ctx) {
index 34161314ea0f2dc430c340c2e2a3b1d464282c1d..c21d14fd61db1a00aece5c6b38250d7c9336159c 100644 (file)
@@ -208,6 +208,9 @@ static void dma_callback(void *data)
        dst_vb = v4l2_m2m_dst_buf_remove(curr_ctx->m2m_ctx);
 
        dst_vb->v4l2_buf.timestamp = src_vb->v4l2_buf.timestamp;
+       dst_vb->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+       dst_vb->v4l2_buf.flags |=
+               src_vb->v4l2_buf.flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
        dst_vb->v4l2_buf.timecode = src_vb->v4l2_buf.timecode;
 
        v4l2_m2m_buf_done(src_vb, VB2_BUF_STATE_DONE);
index 02a40c541e4e8e91d750bec7953ca4bb4f3d4265..4bb5e883df8924be99bcd5a3bc6195c1e43e9157 100644 (file)
@@ -239,6 +239,9 @@ static int device_process(struct m2mtest_ctx *ctx,
        memcpy(&out_vb->v4l2_buf.timestamp,
                        &in_vb->v4l2_buf.timestamp,
                        sizeof(struct timeval));
+       out_vb->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+       out_vb->v4l2_buf.flags |=
+               in_vb->v4l2_buf.flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
 
        switch (ctx->mode) {
        case MEM2MEM_HFLIP | MEM2MEM_VFLIP:
index 6debb02ed501ff37f289f9e76d982626afcefad6..0b7480e821423898c8b6f80d849fda1d0cd57997 100644 (file)
@@ -378,6 +378,11 @@ static irqreturn_t emmaprp_irq(int irq_emma, void *data)
                        dst_vb = v4l2_m2m_dst_buf_remove(curr_ctx->m2m_ctx);
 
                        dst_vb->v4l2_buf.timestamp = src_vb->v4l2_buf.timestamp;
+                       dst_vb->v4l2_buf.flags &=
+                               ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+                       dst_vb->v4l2_buf.flags |=
+                               src_vb->v4l2_buf.flags
+                               & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
                        dst_vb->v4l2_buf.timecode = src_vb->v4l2_buf.timecode;
 
                        spin_lock_irqsave(&pcdev->irqlock, flags);
index bf7c9b38c088d58166b4ed9f4062c1960adfc80e..357af1ebaeda2791667e8f5c32b12fe7f45bf18a 100644 (file)
@@ -560,6 +560,9 @@ static irqreturn_t g2d_isr(int irq, void *prv)
 
        dst->v4l2_buf.timecode = src->v4l2_buf.timecode;
        dst->v4l2_buf.timestamp = src->v4l2_buf.timestamp;
+       dst->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+       dst->v4l2_buf.flags |=
+               src->v4l2_buf.flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
 
        v4l2_m2m_buf_done(src, VB2_BUF_STATE_DONE);
        v4l2_m2m_buf_done(dst, VB2_BUF_STATE_DONE);
index f5e987035fdbfe879f7b5e662ad88284d72ab2e7..da0ad886a5bfec97bd1312bef55e7add1fd55693 100644 (file)
@@ -1766,6 +1766,9 @@ static irqreturn_t s5p_jpeg_irq(int irq, void *dev_id)
 
        dst_buf->v4l2_buf.timecode = src_buf->v4l2_buf.timecode;
        dst_buf->v4l2_buf.timestamp = src_buf->v4l2_buf.timestamp;
+       dst_buf->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+       dst_buf->v4l2_buf.flags |=
+               src_buf->v4l2_buf.flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
 
        v4l2_m2m_buf_done(src_buf, state);
        if (curr_ctx->mode == S5P_JPEG_ENCODE)
index 0e8c171b3cbdefd6ac6bf7cc412527d90dcf6e4a..0c47199dbe0340aff1a93e40ce38cfcf3f43787a 100644 (file)
@@ -232,6 +232,11 @@ static void s5p_mfc_handle_frame_copy_time(struct s5p_mfc_ctx *ctx)
                                                src_buf->b->v4l2_buf.timecode;
                        dst_buf->b->v4l2_buf.timestamp =
                                                src_buf->b->v4l2_buf.timestamp;
+                       dst_buf->b->v4l2_buf.flags &=
+                               ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+                       dst_buf->b->v4l2_buf.flags |=
+                               src_buf->b->v4l2_buf.flags
+                               & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
                        switch (frame_type) {
                        case S5P_FIMV_DECODE_FRAME_I_FRAME:
                                dst_buf->b->v4l2_buf.flags |=
index 8ea3b89149cb32125bdf1a801316c109fd523068..7a77a5b7a0754edcdb04eb59aa7e15345e10c2b3 100644 (file)
@@ -1278,6 +1278,8 @@ static irqreturn_t vpe_irq(int irq_vpe, void *data)
        d_buf = &d_vb->v4l2_buf;
 
        d_buf->timestamp = s_buf->timestamp;
+       d_buf->flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+       d_buf->flags |= s_buf->flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
        if (s_buf->flags & V4L2_BUF_FLAG_TIMECODE) {
                d_buf->flags |= V4L2_BUF_FLAG_TIMECODE;
                d_buf->timecode = s_buf->timecode;