summaryrefslogtreecommitdiff
authorNanxin Qin <nanxin.qin@amlogic.com>2020-06-11 09:23:17 (GMT)
committer Hui Zhang <hui.zhang@amlogic.com>2020-07-22 05:25:17 (GMT)
commit1e292335528ad03ba40f251a97dc48c5d66086e0 (patch)
tree799b68ba47d0ef22ad3219c0cd64b7896def26da
parentf28061a40159ea5cad115336a3c3f3eb99171210 (diff)
downloadmedia_modules-1e292335528ad03ba40f251a97dc48c5d66086e0.zip
media_modules-1e292335528ad03ba40f251a97dc48c5d66086e0.tar.gz
media_modules-1e292335528ad03ba40f251a97dc48c5d66086e0.tar.bz2
v4l: fixed the issue of timestamp with the first frame. [1/1]
PD#SWPL-27740 Problem: wrong of timestamp with the first frame. Solution: the first frame timestamp has not taken into consideration before therefore caused lost time information on the frame, so must be pass the timestamp into decoder. Android P,Q share CL. Verify: u212 Change-Id: I79e3f1fa5be6456af024806dd46cdb8dfd3eba42 Signed-off-by: Nanxin Qin <nanxin.qin@amlogic.com> (cherry picked from commit 372ed7e878427e0dd4cc82f5f760abc2a2bf861d)
Diffstat
-rw-r--r--drivers/amvdec_ports/aml_vcodec_dec.c8
-rw-r--r--drivers/amvdec_ports/aml_vcodec_util.h1
-rw-r--r--drivers/amvdec_ports/decoder/vdec_h264_if.c26
-rw-r--r--drivers/amvdec_ports/decoder/vdec_hevc_if.c26
-rw-r--r--drivers/amvdec_ports/decoder/vdec_mjpeg_if.c26
-rw-r--r--drivers/amvdec_ports/decoder/vdec_mpeg12_if.c26
-rw-r--r--drivers/amvdec_ports/decoder/vdec_mpeg4_if.c26
-rw-r--r--drivers/amvdec_ports/decoder/vdec_vp9_if.c26
-rw-r--r--drivers/amvdec_ports/vdec_drv_base.h2
-rw-r--r--drivers/amvdec_ports/vdec_drv_if.c6
-rw-r--r--drivers/amvdec_ports/vdec_drv_if.h4
11 files changed, 96 insertions, 81 deletions
diff --git a/drivers/amvdec_ports/aml_vcodec_dec.c b/drivers/amvdec_ports/aml_vcodec_dec.c
index c6b2b3c..1e2a073 100644
--- a/drivers/amvdec_ports/aml_vcodec_dec.c
+++ b/drivers/amvdec_ports/aml_vcodec_dec.c
@@ -847,6 +847,7 @@ static void aml_vdec_worker(struct work_struct *work)
buf.addr = vb2_dma_contig_plane_dma_addr(src_buf, 0);
buf.size = src_buf->planes[0].bytesused;
buf.model = src_buf->memory;
+ buf.timestamp = src_buf->timestamp;
if (!buf.vaddr && !buf.addr) {
v4l2_m2m_job_finish(dev->m2m_dev_dec, ctx->m2m_ctx);
@@ -865,7 +866,7 @@ static void aml_vdec_worker(struct work_struct *work)
/*v4l_dbg(ctx, V4L_DEBUG_CODEC_EXINFO,
"timestamp: 0x%llx\n", src_buf->timestamp);*/
- ret = vdec_if_decode(ctx, &buf, src_buf->timestamp, &res_chg);
+ ret = vdec_if_decode(ctx, &buf, &res_chg);
if (ret > 0) {
/*
* we only return src buffer with VB2_BUF_STATE_DONE
@@ -2083,9 +2084,9 @@ static void vb2ops_vdec_buf_queue(struct vb2_buffer *vb)
buf = container_of(vb2_v4l2, struct aml_video_dec_buf, vb);
v4l_dbg(ctx, V4L_DEBUG_CODEC_PROT,
- "%s, vb: %lx, type: %d, idx: %d, state: %d, used: %d\n",
+ "%s, vb: %lx, type: %d, idx: %d, state: %d, used: %d, ts: %llu\n",
__func__, (ulong) vb, vb->vb2_queue->type,
- vb->index, vb->state, buf->used);
+ vb->index, vb->state, buf->used, vb->timestamp);
/*
* check if this buffer is ready to be used after decode
*/
@@ -2151,6 +2152,7 @@ static void vb2ops_vdec_buf_queue(struct vb2_buffer *vb)
src_mem.addr = vb2_dma_contig_plane_dma_addr(vb, 0);
src_mem.size = vb->planes[0].bytesused;
src_mem.model = vb->memory;
+ src_mem.timestamp = vb->timestamp;
if (vdec_if_probe(ctx, &src_mem, NULL)) {
v4l2_m2m_src_buf_remove(ctx->m2m_ctx);
diff --git a/drivers/amvdec_ports/aml_vcodec_util.h b/drivers/amvdec_ports/aml_vcodec_util.h
index 8e479a6..312ee40 100644
--- a/drivers/amvdec_ports/aml_vcodec_util.h
+++ b/drivers/amvdec_ports/aml_vcodec_util.h
@@ -44,6 +44,7 @@ struct aml_vcodec_mem {
void *vaddr;
u32 bytes_used;
u32 offset;
+ u64 timestamp;
dma_addr_t dma_addr;
u32 model;
};
diff --git a/drivers/amvdec_ports/decoder/vdec_h264_if.c b/drivers/amvdec_ports/decoder/vdec_h264_if.c
index cc2d880..d462b36 100644
--- a/drivers/amvdec_ports/decoder/vdec_h264_if.c
+++ b/drivers/amvdec_ports/decoder/vdec_h264_if.c
@@ -559,12 +559,13 @@ static int vdec_search_startcode(u8 *buf, u32 range)
return pos;
}
-static int parse_stream_ucode(struct vdec_h264_inst *inst, u8 *buf, u32 size)
+static int parse_stream_ucode(struct vdec_h264_inst *inst,
+ u8 *buf, u32 size, u64 timestamp)
{
int ret = 0;
struct aml_vdec_adapt *vdec = &inst->vdec;
- ret = vdec_vframe_write(vdec, buf, size, 0);
+ ret = vdec_vframe_write(vdec, buf, size, timestamp);
if (ret < 0) {
v4l_dbg(inst->ctx, V4L_DEBUG_CODEC_ERROR,
"write frame data failed. err: %d\n", ret);
@@ -579,12 +580,12 @@ static int parse_stream_ucode(struct vdec_h264_inst *inst, u8 *buf, u32 size)
}
static int parse_stream_ucode_dma(struct vdec_h264_inst *inst,
- ulong buf, u32 size, u32 handle)
+ ulong buf, u32 size, u64 timestamp, u32 handle)
{
int ret = 0;
struct aml_vdec_adapt *vdec = &inst->vdec;
- ret = vdec_vframe_write_with_dma(vdec, buf, size, 0, handle);
+ ret = vdec_vframe_write_with_dma(vdec, buf, size, timestamp, handle);
if (ret < 0) {
v4l_dbg(inst->ctx, V4L_DEBUG_CODEC_ERROR,
"write frame data failed. err: %d\n", ret);
@@ -653,7 +654,8 @@ static int vdec_h264_probe(unsigned long h_vdec,
return -1;
if (inst->ctx->param_sets_from_ucode) {
- ret = parse_stream_ucode(inst, s->data, s->len);
+ ret = parse_stream_ucode(inst, s->data,
+ s->len, bs->timestamp);
} else {
skip_aud_data((u8 **)&s->data, &s->len);
ret = parse_stream_cpu(inst, s->data, s->len);
@@ -661,11 +663,11 @@ static int vdec_h264_probe(unsigned long h_vdec,
} else if (bs->model == VB2_MEMORY_DMABUF ||
bs->model == VB2_MEMORY_USERPTR) {
ret = parse_stream_ucode_dma(inst, bs->addr, size,
- BUFF_IDX(bs, bs->index));
+ bs->timestamp, BUFF_IDX(bs, bs->index));
}
} else {
if (inst->ctx->param_sets_from_ucode) {
- ret = parse_stream_ucode(inst, buf, size);
+ ret = parse_stream_ucode(inst, buf, size, bs->timestamp);
} else {
skip_aud_data(&buf, &size);
ret = parse_stream_cpu(inst, buf, size);
@@ -864,8 +866,8 @@ static bool monitor_res_change(struct vdec_h264_inst *inst, u8 *buf, u32 size)
return false;
}
-static int vdec_h264_decode(unsigned long h_vdec, struct aml_vcodec_mem *bs,
- u64 timestamp, bool *res_chg)
+static int vdec_h264_decode(unsigned long h_vdec,
+ struct aml_vcodec_mem *bs, bool *res_chg)
{
struct vdec_h264_inst *inst = (struct vdec_h264_inst *)h_vdec;
struct aml_vdec_adapt *vdec = &inst->vdec;
@@ -897,11 +899,11 @@ static int vdec_h264_decode(unsigned long h_vdec, struct aml_vcodec_mem *bs,
ret = vdec_vframe_write(vdec,
s->data,
s->len,
- timestamp);
+ bs->timestamp);
} else if (bs->model == VB2_MEMORY_DMABUF ||
bs->model == VB2_MEMORY_USERPTR) {
ret = vdec_vframe_write_with_dma(vdec,
- bs->addr, size, timestamp,
+ bs->addr, size, bs->timestamp,
BUFF_IDX(bs, bs->index));
}
} else {
@@ -917,7 +919,7 @@ static int vdec_h264_decode(unsigned long h_vdec, struct aml_vcodec_mem *bs,
return 0;
}
}
- ret = vdec_write_nalu(inst, buf, size, timestamp);
+ ret = vdec_write_nalu(inst, buf, size, bs->timestamp);
}
return ret;
diff --git a/drivers/amvdec_ports/decoder/vdec_hevc_if.c b/drivers/amvdec_ports/decoder/vdec_hevc_if.c
index e47acb9..43e1737 100644
--- a/drivers/amvdec_ports/decoder/vdec_hevc_if.c
+++ b/drivers/amvdec_ports/decoder/vdec_hevc_if.c
@@ -409,12 +409,13 @@ static void fill_vdec_params(struct vdec_hevc_inst *inst, struct h265_SPS_t *sps
dec->dpb_sz - margin, margin);
}
-static int parse_stream_ucode(struct vdec_hevc_inst *inst, u8 *buf, u32 size)
+static int parse_stream_ucode(struct vdec_hevc_inst *inst,
+ u8 *buf, u32 size, u64 timestamp)
{
int ret = 0;
struct aml_vdec_adapt *vdec = &inst->vdec;
- ret = vdec_vframe_write(vdec, buf, size, 0);
+ ret = vdec_vframe_write(vdec, buf, size, timestamp);
if (ret < 0) {
v4l_dbg(inst->ctx, V4L_DEBUG_CODEC_ERROR,
"write frame data failed. err: %d\n", ret);
@@ -429,12 +430,12 @@ static int parse_stream_ucode(struct vdec_hevc_inst *inst, u8 *buf, u32 size)
}
static int parse_stream_ucode_dma(struct vdec_hevc_inst *inst,
- ulong buf, u32 size, u32 handle)
+ ulong buf, u32 size, u64 timestamp, u32 handle)
{
int ret = 0;
struct aml_vdec_adapt *vdec = &inst->vdec;
- ret = vdec_vframe_write_with_dma(vdec, buf, size, 0, handle);
+ ret = vdec_vframe_write_with_dma(vdec, buf, size, timestamp, handle);
if (ret < 0) {
v4l_dbg(inst->ctx, V4L_DEBUG_CODEC_ERROR,
"write frame data failed. err: %d\n", ret);
@@ -493,18 +494,19 @@ static int vdec_hevc_probe(unsigned long h_vdec,
return -1;
if (inst->ctx->param_sets_from_ucode) {
- ret = parse_stream_ucode(inst, s->data, s->len);
+ ret = parse_stream_ucode(inst, s->data,
+ s->len, bs->timestamp);
} else {
ret = parse_stream_cpu(inst, s->data, s->len);
}
} else if (bs->model == VB2_MEMORY_DMABUF ||
bs->model == VB2_MEMORY_USERPTR) {
ret = parse_stream_ucode_dma(inst, bs->addr, size,
- BUFF_IDX(bs, bs->index));
+ bs->timestamp, BUFF_IDX(bs, bs->index));
}
} else {
if (inst->ctx->param_sets_from_ucode) {
- ret = parse_stream_ucode(inst, buf, size);
+ ret = parse_stream_ucode(inst, buf, size, bs->timestamp);
} else {
ret = parse_stream_cpu(inst, buf, size);
}
@@ -630,8 +632,8 @@ static bool monitor_res_change(struct vdec_hevc_inst *inst, u8 *buf, u32 size)
return false;
}
-static int vdec_hevc_decode(unsigned long h_vdec, struct aml_vcodec_mem *bs,
- u64 timestamp, bool *res_chg)
+static int vdec_hevc_decode(unsigned long h_vdec,
+ struct aml_vcodec_mem *bs, bool *res_chg)
{
struct vdec_hevc_inst *inst = (struct vdec_hevc_inst *)h_vdec;
struct aml_vdec_adapt *vdec = &inst->vdec;
@@ -663,11 +665,11 @@ static int vdec_hevc_decode(unsigned long h_vdec, struct aml_vcodec_mem *bs,
ret = vdec_vframe_write(vdec,
s->data,
s->len,
- timestamp);
+ bs->timestamp);
} else if (bs->model == VB2_MEMORY_DMABUF ||
bs->model == VB2_MEMORY_USERPTR) {
ret = vdec_vframe_write_with_dma(vdec,
- bs->addr, size, timestamp,
+ bs->addr, size, bs->timestamp,
BUFF_IDX(bs, bs->index));
}
} else {
@@ -676,7 +678,7 @@ static int vdec_hevc_decode(unsigned long h_vdec, struct aml_vcodec_mem *bs,
if ((*res_chg = monitor_res_change(inst, buf, size)))
return 0;
}
- ret = vdec_write_nalu(inst, buf, size, timestamp);
+ ret = vdec_write_nalu(inst, buf, size, bs->timestamp);
}
return ret;
diff --git a/drivers/amvdec_ports/decoder/vdec_mjpeg_if.c b/drivers/amvdec_ports/decoder/vdec_mjpeg_if.c
index c4c9fa7..68fc611 100644
--- a/drivers/amvdec_ports/decoder/vdec_mjpeg_if.c
+++ b/drivers/amvdec_ports/decoder/vdec_mjpeg_if.c
@@ -277,12 +277,13 @@ static void fill_vdec_params(struct vdec_mjpeg_inst *inst,
pic->visible_width, pic->visible_height, dec->dpb_sz);
}
-static int parse_stream_ucode(struct vdec_mjpeg_inst *inst, u8 *buf, u32 size)
+static int parse_stream_ucode(struct vdec_mjpeg_inst *inst,
+ u8 *buf, u32 size, u64 timestamp)
{
int ret = 0;
struct aml_vdec_adapt *vdec = &inst->vdec;
- ret = vdec_vframe_write(vdec, buf, size, 0);
+ ret = vdec_vframe_write(vdec, buf, size, timestamp);
if (ret < 0) {
v4l_dbg(inst->ctx, V4L_DEBUG_CODEC_ERROR,
"write frame data failed. err: %d\n", ret);
@@ -297,12 +298,12 @@ static int parse_stream_ucode(struct vdec_mjpeg_inst *inst, u8 *buf, u32 size)
}
static int parse_stream_ucode_dma(struct vdec_mjpeg_inst *inst,
- ulong buf, u32 size, u32 handle)
+ ulong buf, u32 size, u64 timestamp, u32 handle)
{
int ret = 0;
struct aml_vdec_adapt *vdec = &inst->vdec;
- ret = vdec_vframe_write_with_dma(vdec, buf, size, 0, handle);
+ ret = vdec_vframe_write_with_dma(vdec, buf, size, timestamp, handle);
if (ret < 0) {
v4l_dbg(inst->ctx, V4L_DEBUG_CODEC_ERROR,
"write frame data failed. err: %d\n", ret);
@@ -361,18 +362,19 @@ static int vdec_mjpeg_probe(unsigned long h_vdec,
return -1;
if (inst->ctx->param_sets_from_ucode) {
- ret = parse_stream_ucode(inst, s->data, s->len);
+ ret = parse_stream_ucode(inst, s->data,
+ s->len, bs->timestamp);
} else {
ret = parse_stream_cpu(inst, s->data, s->len);
}
} else if (bs->model == VB2_MEMORY_DMABUF ||
bs->model == VB2_MEMORY_USERPTR) {
ret = parse_stream_ucode_dma(inst, bs->addr, size,
- BUFF_IDX(bs, bs->index));
+ bs->timestamp, BUFF_IDX(bs, bs->index));
}
} else {
if (inst->ctx->param_sets_from_ucode) {
- ret = parse_stream_ucode(inst, buf, size);
+ ret = parse_stream_ucode(inst, buf, size, bs->timestamp);
} else {
ret = parse_stream_cpu(inst, buf, size);
}
@@ -458,8 +460,8 @@ static int vdec_write_nalu(struct vdec_mjpeg_inst *inst,
return ret;
}
-static int vdec_mjpeg_decode(unsigned long h_vdec, struct aml_vcodec_mem *bs,
- u64 timestamp, bool *res_chg)
+static int vdec_mjpeg_decode(unsigned long h_vdec,
+ struct aml_vcodec_mem *bs, bool *res_chg)
{
struct vdec_mjpeg_inst *inst = (struct vdec_mjpeg_inst *)h_vdec;
struct aml_vdec_adapt *vdec = &inst->vdec;
@@ -481,15 +483,15 @@ static int vdec_mjpeg_decode(unsigned long h_vdec, struct aml_vcodec_mem *bs,
ret = vdec_vframe_write(vdec,
s->data,
s->len,
- timestamp);
+ bs->timestamp);
} else if (bs->model == VB2_MEMORY_DMABUF ||
bs->model == VB2_MEMORY_USERPTR) {
ret = vdec_vframe_write_with_dma(vdec,
- bs->addr, size, timestamp,
+ bs->addr, size, bs->timestamp,
BUFF_IDX(bs, bs->index));
}
} else {
- ret = vdec_write_nalu(inst, buf, size, timestamp);
+ ret = vdec_write_nalu(inst, buf, size, bs->timestamp);
}
return ret;
diff --git a/drivers/amvdec_ports/decoder/vdec_mpeg12_if.c b/drivers/amvdec_ports/decoder/vdec_mpeg12_if.c
index 804296b..76d5e9f 100644
--- a/drivers/amvdec_ports/decoder/vdec_mpeg12_if.c
+++ b/drivers/amvdec_ports/decoder/vdec_mpeg12_if.c
@@ -296,12 +296,13 @@ static void fill_vdec_params(struct vdec_mpeg12_inst *inst,
pic->visible_width, pic->visible_height, dec->dpb_sz);
}
-static int parse_stream_ucode(struct vdec_mpeg12_inst *inst, u8 *buf, u32 size)
+static int parse_stream_ucode(struct vdec_mpeg12_inst *inst,
+ u8 *buf, u32 size, u64 timestamp)
{
int ret = 0;
struct aml_vdec_adapt *vdec = &inst->vdec;
- ret = vdec_vframe_write(vdec, buf, size, 0);
+ ret = vdec_vframe_write(vdec, buf, size, timestamp);
if (ret < 0) {
v4l_dbg(inst->ctx, V4L_DEBUG_CODEC_ERROR,
"write frame data failed. err: %d\n", ret);
@@ -316,12 +317,12 @@ static int parse_stream_ucode(struct vdec_mpeg12_inst *inst, u8 *buf, u32 size)
}
static int parse_stream_ucode_dma(struct vdec_mpeg12_inst *inst,
- ulong buf, u32 size, u32 handle)
+ ulong buf, u32 size, u64 timestamp, u32 handle)
{
int ret = 0;
struct aml_vdec_adapt *vdec = &inst->vdec;
- ret = vdec_vframe_write_with_dma(vdec, buf, size, 0, handle);
+ ret = vdec_vframe_write_with_dma(vdec, buf, size, timestamp, handle);
if (ret < 0) {
v4l_dbg(inst->ctx, V4L_DEBUG_CODEC_ERROR,
"write frame data failed. err: %d\n", ret);
@@ -380,18 +381,19 @@ static int vdec_mpeg12_probe(unsigned long h_vdec,
return -1;
if (inst->ctx->param_sets_from_ucode) {
- ret = parse_stream_ucode(inst, s->data, s->len);
+ ret = parse_stream_ucode(inst, s->data,
+ s->len, bs->timestamp);
} else {
ret = parse_stream_cpu(inst, s->data, s->len);
}
} else if (bs->model == VB2_MEMORY_DMABUF ||
bs->model == VB2_MEMORY_USERPTR) {
ret = parse_stream_ucode_dma(inst, bs->addr, size,
- BUFF_IDX(bs, bs->index));
+ bs->timestamp, BUFF_IDX(bs, bs->index));
}
} else {
if (inst->ctx->param_sets_from_ucode) {
- ret = parse_stream_ucode(inst, buf, size);
+ ret = parse_stream_ucode(inst, buf, size, bs->timestamp);
} else {
ret = parse_stream_cpu(inst, buf, size);
}
@@ -477,8 +479,8 @@ static int vdec_write_nalu(struct vdec_mpeg12_inst *inst,
return ret;
}
-static int vdec_mpeg12_decode(unsigned long h_vdec, struct aml_vcodec_mem *bs,
- u64 timestamp, bool *res_chg)
+static int vdec_mpeg12_decode(unsigned long h_vdec,
+ struct aml_vcodec_mem *bs, bool *res_chg)
{
struct vdec_mpeg12_inst *inst = (struct vdec_mpeg12_inst *)h_vdec;
struct aml_vdec_adapt *vdec = &inst->vdec;
@@ -500,15 +502,15 @@ static int vdec_mpeg12_decode(unsigned long h_vdec, struct aml_vcodec_mem *bs,
ret = vdec_vframe_write(vdec,
s->data,
s->len,
- timestamp);
+ bs->timestamp);
} else if (bs->model == VB2_MEMORY_DMABUF ||
bs->model == VB2_MEMORY_USERPTR) {
ret = vdec_vframe_write_with_dma(vdec,
- bs->addr, size, timestamp,
+ bs->addr, size, bs->timestamp,
BUFF_IDX(bs, bs->index));
}
} else {
- ret = vdec_write_nalu(inst, buf, size, timestamp);
+ ret = vdec_write_nalu(inst, buf, size, bs->timestamp);
}
return ret;
diff --git a/drivers/amvdec_ports/decoder/vdec_mpeg4_if.c b/drivers/amvdec_ports/decoder/vdec_mpeg4_if.c
index 660178c..80c0b18 100644
--- a/drivers/amvdec_ports/decoder/vdec_mpeg4_if.c
+++ b/drivers/amvdec_ports/decoder/vdec_mpeg4_if.c
@@ -306,12 +306,13 @@ static void fill_vdec_params(struct vdec_mpeg4_inst *inst,
pic->visible_width, pic->visible_height, dec->dpb_sz);
}
-static int parse_stream_ucode(struct vdec_mpeg4_inst *inst, u8 *buf, u32 size)
+static int parse_stream_ucode(struct vdec_mpeg4_inst *inst,
+ u8 *buf, u32 size, u64 timestamp)
{
int ret = 0;
struct aml_vdec_adapt *vdec = &inst->vdec;
- ret = vdec_vframe_write(vdec, buf, size, 0);
+ ret = vdec_vframe_write(vdec, buf, size, timestamp);
if (ret < 0) {
v4l_dbg(inst->ctx, V4L_DEBUG_CODEC_ERROR,
"write frame data failed. err: %d\n", ret);
@@ -326,12 +327,12 @@ static int parse_stream_ucode(struct vdec_mpeg4_inst *inst, u8 *buf, u32 size)
}
static int parse_stream_ucode_dma(struct vdec_mpeg4_inst *inst,
- ulong buf, u32 size, u32 handle)
+ ulong buf, u32 size, u64 timestamp, u32 handle)
{
int ret = 0;
struct aml_vdec_adapt *vdec = &inst->vdec;
- ret = vdec_vframe_write_with_dma(vdec, buf, size, 0, handle);
+ ret = vdec_vframe_write_with_dma(vdec, buf, size, timestamp, handle);
if (ret < 0) {
v4l_dbg(inst->ctx, V4L_DEBUG_CODEC_ERROR,
"write frame data failed. err: %d\n", ret);
@@ -390,18 +391,19 @@ static int vdec_mpeg4_probe(unsigned long h_vdec,
return -1;
if (inst->ctx->param_sets_from_ucode) {
- ret = parse_stream_ucode(inst, s->data, s->len);
+ ret = parse_stream_ucode(inst, s->data,
+ s->len, bs->timestamp);
} else {
ret = parse_stream_cpu(inst, s->data, s->len);
}
} else if (bs->model == VB2_MEMORY_DMABUF ||
bs->model == VB2_MEMORY_USERPTR) {
ret = parse_stream_ucode_dma(inst, bs->addr, size,
- BUFF_IDX(bs, bs->index));
+ bs->timestamp, BUFF_IDX(bs, bs->index));
}
} else {
if (inst->ctx->param_sets_from_ucode) {
- ret = parse_stream_ucode(inst, buf, size);
+ ret = parse_stream_ucode(inst, buf, size, bs->timestamp);
} else {
ret = parse_stream_cpu(inst, buf, size);
}
@@ -487,8 +489,8 @@ static int vdec_write_nalu(struct vdec_mpeg4_inst *inst,
return ret;
}
-static int vdec_mpeg4_decode(unsigned long h_vdec, struct aml_vcodec_mem *bs,
- u64 timestamp, bool *res_chg)
+static int vdec_mpeg4_decode(unsigned long h_vdec,
+ struct aml_vcodec_mem *bs, bool *res_chg)
{
struct vdec_mpeg4_inst *inst = (struct vdec_mpeg4_inst *)h_vdec;
struct aml_vdec_adapt *vdec = &inst->vdec;
@@ -510,15 +512,15 @@ static int vdec_mpeg4_decode(unsigned long h_vdec, struct aml_vcodec_mem *bs,
ret = vdec_vframe_write(vdec,
s->data,
s->len,
- timestamp);
+ bs->timestamp);
} else if (bs->model == VB2_MEMORY_DMABUF ||
bs->model == VB2_MEMORY_USERPTR) {
ret = vdec_vframe_write_with_dma(vdec,
- bs->addr, size, timestamp,
+ bs->addr, size, bs->timestamp,
BUFF_IDX(bs, bs->index));
}
} else {
- ret = vdec_write_nalu(inst, buf, size, timestamp);
+ ret = vdec_write_nalu(inst, buf, size, bs->timestamp);
}
return ret;
diff --git a/drivers/amvdec_ports/decoder/vdec_vp9_if.c b/drivers/amvdec_ports/decoder/vdec_vp9_if.c
index 2cb568d..fbaa894 100644
--- a/drivers/amvdec_ports/decoder/vdec_vp9_if.c
+++ b/drivers/amvdec_ports/decoder/vdec_vp9_if.c
@@ -439,11 +439,12 @@ static void fill_vdec_params(struct vdec_vp9_inst *inst,
dec->dpb_sz - margin, margin);
}
-static int parse_stream_ucode(struct vdec_vp9_inst *inst, u8 *buf, u32 size)
+static int parse_stream_ucode(struct vdec_vp9_inst *inst,
+ u8 *buf, u32 size, u64 timestamp)
{
int ret = 0;
- ret = vdec_write_nalu(inst, buf, size, 0);
+ ret = vdec_write_nalu(inst, buf, size, timestamp);
if (ret < 0) {
v4l_dbg(inst->ctx, V4L_DEBUG_CODEC_ERROR,
"write frame data failed. err: %d\n", ret);
@@ -458,12 +459,12 @@ static int parse_stream_ucode(struct vdec_vp9_inst *inst, u8 *buf, u32 size)
}
static int parse_stream_ucode_dma(struct vdec_vp9_inst *inst,
- ulong buf, u32 size, u32 handle)
+ ulong buf, u32 size, u64 timestamp, u32 handle)
{
int ret = 0;
struct aml_vdec_adapt *vdec = &inst->vdec;
- ret = vdec_vframe_write_with_dma(vdec, buf, size, 0, handle);
+ ret = vdec_vframe_write_with_dma(vdec, buf, size, timestamp, handle);
if (ret < 0) {
v4l_dbg(inst->ctx, V4L_DEBUG_CODEC_ERROR,
"write frame data failed. err: %d\n", ret);
@@ -522,18 +523,19 @@ static int vdec_vp9_probe(unsigned long h_vdec,
return -1;
if (inst->ctx->param_sets_from_ucode) {
- ret = parse_stream_ucode(inst, s->data, s->len);
+ ret = parse_stream_ucode(inst, s->data,
+ s->len, bs->timestamp);
} else {
ret = parse_stream_cpu(inst, s->data, s->len);
}
} else if (bs->model == VB2_MEMORY_DMABUF ||
bs->model == VB2_MEMORY_USERPTR) {
ret = parse_stream_ucode_dma(inst, bs->addr, size,
- BUFF_IDX(bs, bs->index));
+ bs->timestamp, BUFF_IDX(bs, bs->index));
}
} else {
if (inst->ctx->param_sets_from_ucode) {
- ret = parse_stream_ucode(inst, buf, size);
+ ret = parse_stream_ucode(inst, buf, size, bs->timestamp);
} else {
ret = parse_stream_cpu(inst, buf, size);
}
@@ -744,8 +746,8 @@ static bool monitor_res_change(struct vdec_vp9_inst *inst, u8 *buf, u32 size)
return false;
}
-static int vdec_vp9_decode(unsigned long h_vdec, struct aml_vcodec_mem *bs,
- u64 timestamp, bool *res_chg)
+static int vdec_vp9_decode(unsigned long h_vdec,
+ struct aml_vcodec_mem *bs, bool *res_chg)
{
struct vdec_vp9_inst *inst = (struct vdec_vp9_inst *)h_vdec;
struct aml_vdec_adapt *vdec = &inst->vdec;
@@ -779,11 +781,11 @@ static int vdec_vp9_decode(unsigned long h_vdec, struct aml_vcodec_mem *bs,
ret = vdec_vframe_write(vdec,
s->data,
s->len,
- timestamp);
+ bs->timestamp);
} else if (bs->model == VB2_MEMORY_DMABUF ||
bs->model == VB2_MEMORY_USERPTR) {
ret = vdec_vframe_write_with_dma(vdec,
- bs->addr, size, timestamp,
+ bs->addr, size, bs->timestamp,
BUFF_IDX(bs, bs->index));
}
} else {
@@ -792,7 +794,7 @@ static int vdec_vp9_decode(unsigned long h_vdec, struct aml_vcodec_mem *bs,
(*res_chg = monitor_res_change(inst, buf, size)))
return 0;
- ret = vdec_write_nalu(inst, buf, size, timestamp);
+ ret = vdec_write_nalu(inst, buf, size, bs->timestamp);
}
ATRACE_COUNTER("v4l2_decode_write", ret);
diff --git a/drivers/amvdec_ports/vdec_drv_base.h b/drivers/amvdec_ports/vdec_drv_base.h
index e192b20..990d406 100644
--- a/drivers/amvdec_ports/vdec_drv_base.h
+++ b/drivers/amvdec_ports/vdec_drv_base.h
@@ -43,7 +43,7 @@ struct vdec_common_if {
* @res_chg : [out] resolution change happen
*/
int (*decode)(unsigned long h_vdec, struct aml_vcodec_mem *bs,
- u64 pts, bool *res_chg);
+ bool *res_chg);
/**
* (*get_param)() - get driver's parameter
diff --git a/drivers/amvdec_ports/vdec_drv_if.c b/drivers/amvdec_ports/vdec_drv_if.c
index e870da4..3be48b9 100644
--- a/drivers/amvdec_ports/vdec_drv_if.c
+++ b/drivers/amvdec_ports/vdec_drv_if.c
@@ -76,8 +76,8 @@ int vdec_if_probe(struct aml_vcodec_ctx *ctx,
return ret;
}
-int vdec_if_decode(struct aml_vcodec_ctx *ctx, struct aml_vcodec_mem *bs,
- u64 timestamp, bool *res_chg)
+int vdec_if_decode(struct aml_vcodec_ctx *ctx,
+ struct aml_vcodec_mem *bs, bool *res_chg)
{
int ret = 0;
@@ -93,7 +93,7 @@ int vdec_if_decode(struct aml_vcodec_ctx *ctx, struct aml_vcodec_mem *bs,
return -EIO;
aml_vcodec_set_curr_ctx(ctx->dev, ctx);
- ret = ctx->dec_if->decode(ctx->drv_handle, bs, timestamp, res_chg);
+ ret = ctx->dec_if->decode(ctx->drv_handle, bs, res_chg);
aml_vcodec_set_curr_ctx(ctx->dev, NULL);
return ret;
diff --git a/drivers/amvdec_ports/vdec_drv_if.h b/drivers/amvdec_ports/vdec_drv_if.h
index a5ab735..bc053d9 100644
--- a/drivers/amvdec_ports/vdec_drv_if.h
+++ b/drivers/amvdec_ports/vdec_drv_if.h
@@ -129,8 +129,8 @@ void vdec_if_deinit(struct aml_vcodec_ctx *ctx);
*
* Return: 0 on success. -EIO on unrecoverable error.
*/
-int vdec_if_decode(struct aml_vcodec_ctx *ctx, struct aml_vcodec_mem *bs,
- u64 timestamp, bool *res_chg);
+int vdec_if_decode(struct aml_vcodec_ctx *ctx,
+ struct aml_vcodec_mem *bs, bool *res_chg);
/**
* vdec_if_get_param() - get driver's parameter