aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2014-07-11 05:36:33 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-07-22 11:09:01 -0400
commitcb2c02821c44522f7284fcd57a7f11e11657255b (patch)
tree4b4d48878d7bb2cce8c27ac8c24aa8ed44f645b3 /drivers/media/platform
parent410e5e493895ad9018f19dfbca92d65e1eadcbbe (diff)
[media] coda: add sequence counter offset
The coda h.264 decoder also counts PIC_RUNs where no frame was decoded but a frame was rotated out / marked as ready to be displayed. This causes an offset between the incoming encoded frame's sequence number and the decode sequence number returned by the coda. This patch introduces a sequence counter offset variable to keep track of the difference. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r--drivers/media/platform/coda.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index d4e700391bba..d20343b32eed 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -222,6 +222,7 @@ struct coda_ctx {
222 u32 isequence; 222 u32 isequence;
223 u32 qsequence; 223 u32 qsequence;
224 u32 osequence; 224 u32 osequence;
225 u32 sequence_offset;
225 struct coda_q_data q_data[2]; 226 struct coda_q_data q_data[2];
226 enum coda_inst_type inst_type; 227 enum coda_inst_type inst_type;
227 struct coda_codec *codec; 228 struct coda_codec *codec;
@@ -2621,6 +2622,7 @@ static void coda_stop_streaming(struct vb2_queue *q)
2621 ctx->streamon_cap = 0; 2622 ctx->streamon_cap = 0;
2622 2623
2623 ctx->osequence = 0; 2624 ctx->osequence = 0;
2625 ctx->sequence_offset = 0;
2624 } 2626 }
2625 2627
2626 if (!ctx->streamon_out && !ctx->streamon_cap) { 2628 if (!ctx->streamon_out && !ctx->streamon_cap) {
@@ -3126,7 +3128,9 @@ static void coda_finish_decode(struct coda_ctx *ctx)
3126 3128
3127 if (decoded_idx == -1) { 3129 if (decoded_idx == -1) {
3128 /* no frame was decoded, but we might have a display frame */ 3130 /* no frame was decoded, but we might have a display frame */
3129 if (display_idx < 0 && ctx->display_idx < 0) 3131 if (display_idx >= 0 && display_idx < ctx->num_internal_frames)
3132 ctx->sequence_offset++;
3133 else if (ctx->display_idx < 0)
3130 ctx->prescan_failed = true; 3134 ctx->prescan_failed = true;
3131 } else if (decoded_idx == -2) { 3135 } else if (decoded_idx == -2) {
3132 /* no frame was decoded, we still return the remaining buffers */ 3136 /* no frame was decoded, we still return the remaining buffers */
@@ -3138,10 +3142,11 @@ static void coda_finish_decode(struct coda_ctx *ctx)
3138 struct coda_timestamp, list); 3142 struct coda_timestamp, list);
3139 list_del(&ts->list); 3143 list_del(&ts->list);
3140 val = coda_read(dev, CODA_RET_DEC_PIC_FRAME_NUM) - 1; 3144 val = coda_read(dev, CODA_RET_DEC_PIC_FRAME_NUM) - 1;
3141 if (val != ts->sequence) { 3145 val -= ctx->sequence_offset;
3146 if (val != (ts->sequence & 0xffff)) {
3142 v4l2_err(&dev->v4l2_dev, 3147 v4l2_err(&dev->v4l2_dev,
3143 "sequence number mismatch (%d != %d)\n", 3148 "sequence number mismatch (%d(%d) != %d)\n",
3144 val, ts->sequence); 3149 val, ctx->sequence_offset, ts->sequence);
3145 } 3150 }
3146 ctx->frame_timestamps[decoded_idx] = *ts; 3151 ctx->frame_timestamps[decoded_idx] = *ts;
3147 kfree(ts); 3152 kfree(ts);