summaryrefslogtreecommitdiff
Diffstat
-rw-r--r--[-rwxr-xr-x]Media.mk1
-rw-r--r--drivers/amvdec_ports/Makefile1
-rw-r--r--drivers/amvdec_ports/aml_vcodec_adapt.c112
-rw-r--r--drivers/amvdec_ports/aml_vcodec_adapt.h5
-rw-r--r--drivers/amvdec_ports/aml_vcodec_dec.c992
-rw-r--r--drivers/amvdec_ports/aml_vcodec_dec.h2
-rw-r--r--drivers/amvdec_ports/aml_vcodec_dec_drv.c122
-rw-r--r--drivers/amvdec_ports/aml_vcodec_dec_pm.c206
-rw-r--r--drivers/amvdec_ports/aml_vcodec_dec_pm.h34
-rw-r--r--drivers/amvdec_ports/aml_vcodec_drv.h188
-rw-r--r--drivers/amvdec_ports/aml_vcodec_util.c34
-rw-r--r--drivers/amvdec_ports/aml_vcodec_util.h90
-rw-r--r--drivers/amvdec_ports/aml_vcodec_vfm.c28
-rw-r--r--drivers/amvdec_ports/decoder/aml_h264_parser.c81
-rw-r--r--drivers/amvdec_ports/decoder/aml_h264_parser.h1
-rw-r--r--drivers/amvdec_ports/decoder/aml_hevc_parser.c133
-rw-r--r--drivers/amvdec_ports/decoder/aml_hevc_parser.h1
-rw-r--r--drivers/amvdec_ports/decoder/aml_mjpeg_parser.c34
-rw-r--r--drivers/amvdec_ports/decoder/aml_mjpeg_parser.h1
-rw-r--r--drivers/amvdec_ports/decoder/aml_mpeg12_parser.h1
-rw-r--r--drivers/amvdec_ports/decoder/aml_mpeg4_parser.c178
-rw-r--r--drivers/amvdec_ports/decoder/aml_mpeg4_parser.h1
-rw-r--r--drivers/amvdec_ports/decoder/aml_vp9_parser.c26
-rw-r--r--drivers/amvdec_ports/decoder/aml_vp9_parser.h1
-rw-r--r--drivers/amvdec_ports/decoder/vdec_h264_if.c223
-rw-r--r--drivers/amvdec_ports/decoder/vdec_hevc_if.c194
-rw-r--r--drivers/amvdec_ports/decoder/vdec_mjpeg_if.c210
-rw-r--r--drivers/amvdec_ports/decoder/vdec_mpeg12_if.c304
-rw-r--r--drivers/amvdec_ports/decoder/vdec_mpeg4_if.c209
-rw-r--r--drivers/amvdec_ports/decoder/vdec_vp9_if.c195
-rw-r--r--drivers/amvdec_ports/vdec_drv_if.c6
-rw-r--r--drivers/amvdec_ports/vdec_drv_if.h21
-rw-r--r--drivers/common/chips/chips.c1
-rw-r--r--drivers/common/chips/decoder_cpu_ver_info.c8
-rw-r--r--drivers/common/chips/decoder_cpu_ver_info.h1
-rw-r--r--drivers/common/firmware/firmware_drv.c9
-rw-r--r--drivers/common/firmware/firmware_type.c1
-rw-r--r--drivers/common/firmware/firmware_type.h1
-rw-r--r--drivers/common/media_clock/clk/clk.c3
-rw-r--r--drivers/common/media_clock/clk/clkg12.c5
-rw-r--r--drivers/frame_provider/decoder/Makefile1
-rw-r--r--drivers/frame_provider/decoder/avs/avs.c60
-rw-r--r--drivers/frame_provider/decoder/avs2/avs2_bufmgr.c12
-rw-r--r--drivers/frame_provider/decoder/avs2/avs2_global.h3
-rw-r--r--drivers/frame_provider/decoder/avs2/vavs2.c115
-rw-r--r--drivers/frame_provider/decoder/avs_multi/Makefile2
-rw-r--r--drivers/frame_provider/decoder/avs_multi/avs_multi.c1633
-rw-r--r--drivers/frame_provider/decoder/avs_multi/avsp_trans_multi.c5065
-rw-r--r--drivers/frame_provider/decoder/h264/vh264.c58
-rw-r--r--drivers/frame_provider/decoder/h264_multi/h264_dpb.c50
-rw-r--r--drivers/frame_provider/decoder/h264_multi/h264_dpb.h34
-rw-r--r--drivers/frame_provider/decoder/h264_multi/vmh264.c1043
-rw-r--r--drivers/frame_provider/decoder/h265/vh265.c707
-rw-r--r--drivers/frame_provider/decoder/mjpeg/vmjpeg_multi.c60
-rw-r--r--drivers/frame_provider/decoder/mpeg12/vmpeg12_multi.c595
-rw-r--r--drivers/frame_provider/decoder/mpeg4/vmpeg4.c5
-rw-r--r--drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c80
-rw-r--r--drivers/frame_provider/decoder/utils/amvdec.c5
-rw-r--r--drivers/frame_provider/decoder/utils/frame_check.c178
-rw-r--r--drivers/frame_provider/decoder/utils/frame_check.h4
-rw-r--r--drivers/frame_provider/decoder/utils/vdec.c530
-rw-r--r--drivers/frame_provider/decoder/utils/vdec.h18
-rw-r--r--drivers/frame_provider/decoder/utils/vdec_input.c12
-rw-r--r--drivers/frame_provider/decoder/utils/vdec_input.h3
-rw-r--r--drivers/frame_provider/decoder/utils/vdec_v4l2_buffer_ops.c92
-rw-r--r--drivers/frame_provider/decoder/utils/vdec_v4l2_buffer_ops.h7
-rw-r--r--drivers/frame_provider/decoder/vav1/Makefile2
-rw-r--r--drivers/frame_provider/decoder/vav1/aom_av1_define.h171
-rw-r--r--drivers/frame_provider/decoder/vav1/av1_bufmgr.c3392
-rw-r--r--drivers/frame_provider/decoder/vav1/av1_global.h2310
-rw-r--r--drivers/frame_provider/decoder/vav1/vav1.c9946
-rw-r--r--drivers/frame_provider/decoder/vav1/vav1.h22
-rw-r--r--drivers/frame_provider/decoder/vc1/vvc1.c46
-rw-r--r--drivers/frame_provider/decoder/vp9/vvp9.c449
-rw-r--r--drivers/frame_sink/encoder/h264/encoder.c2
-rw-r--r--drivers/stream_input/Makefile5
-rw-r--r--drivers/stream_input/amports/amstream.c263
-rw-r--r--drivers/stream_input/parser/demux/aml_dvb.h5
-rw-r--r--drivers/stream_input/parser/demux/hw_demux/demod_gt.h62
-rw-r--r--drivers/stream_input/parser/demux/hw_demux/frontend.c293
-rw-r--r--drivers/stream_input/parser/dvb_common.c17
-rw-r--r--drivers/stream_input/parser/dvb_common.h26
-rw-r--r--drivers/stream_input/parser/esparser.c15
-rw-r--r--drivers/stream_input/parser/hw_demux/aml_demod_gt.h87
-rw-r--r--drivers/stream_input/parser/hw_demux/aml_dmx.c270
-rw-r--r--drivers/stream_input/parser/hw_demux/aml_dvb.c445
-rw-r--r--drivers/stream_input/parser/hw_demux/aml_dvb.h32
-rw-r--r--drivers/stream_input/parser/streambuf.c9
-rw-r--r--drivers/stream_input/parser/tsdemux.c14
-rw-r--r--drivers/stream_input/parser/tsdemux.h1
-rw-r--r--drivers/stream_input/tv_frontend/Makefile16
-rw-r--r--drivers/stream_input/tv_frontend/aml_fe.c1372
-rw-r--r--drivers/stream_input/tv_frontend/aml_fe.h213
-rw-r--r--drivers/stream_input/tv_frontend/atv_demod/atvdemod_frontend.c791
-rw-r--r--drivers/stream_input/tv_frontend/atv_demod/atvdemod_func.c2163
-rw-r--r--drivers/stream_input/tv_frontend/atv_demod/atvdemod_func.h323
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/aml_demod.c725
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/amlfrontend.c1402
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/demod_func.c2996
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/dvbc_func.c1331
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/dvbt_func.c2188
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/i2c_func.c42
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/acf_filter_coefficient.h414
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/addr_dtmb_che.h77
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/addr_dtmb_che_bit.h266
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/addr_dtmb_front.h70
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/addr_dtmb_front_bit.h331
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/addr_dtmb_sync.h53
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/addr_dtmb_sync_bit.h110
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/addr_dtmb_top.h90
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/addr_dtmb_top_bit.h178
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/aml_dtv_demod_reg.h28
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/amlfrontend.h86
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/demod_func.h626
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/tuner_func.c189
-rw-r--r--firmware/video_ucode.bin14148
116 files changed, 25845 insertions, 36303 deletions
diff --git a/drivers/amvdec_ports/aml_vcodec_adapt.c b/drivers/amvdec_ports/aml_vcodec_adapt.c
index da5637d..b87d0c8 100644
--- a/drivers/amvdec_ports/aml_vcodec_adapt.c
+++ b/drivers/amvdec_ports/aml_vcodec_adapt.c
@@ -52,8 +52,6 @@
#define PTS_OUTSIDE (1)
#define SYNC_OUTSIDE (2)
-#define USE_V4L_PORTS (0x80)
-#define SCATTER_MEM (0x100)
//#define DATA_DEBUG
@@ -114,9 +112,8 @@ extern bool aml_set_vfm_enable, aml_set_vdec_type_enable;
static void set_default_params(struct aml_vdec_adapt *vdec)
{
- ulong sync_mode = (PTS_OUTSIDE | SYNC_OUTSIDE | USE_V4L_PORTS);
+ ulong sync_mode = (PTS_OUTSIDE | SYNC_OUTSIDE);
- sync_mode |= vdec->ctx->scatter_mem_enable ? SCATTER_MEM : 0;
vdec->dec_prop.param = (void *)sync_mode;
vdec->dec_prop.format = vdec->format;
vdec->dec_prop.width = 1920;
@@ -201,7 +198,7 @@ static void change_vbufsize(struct vdec_s *vdec,
struct stream_buf_s *pvbuf)
{
if (pvbuf->buf_start != 0) {
- pr_info("streambuf is alloced before\n");
+ v4l_dbg(0, V4L_DEBUG_CODEC_ERROR, "streambuf is alloced before\n");
return;
}
@@ -261,7 +258,7 @@ static int audio_component_init(struct stream_port_s *port,
int r;
if ((port->flag & PORT_FLAG_AFORMAT) == 0) {
- pr_err("aformat not set\n");
+ v4l_dbg(0, V4L_DEBUG_CODEC_ERROR, "aformat not set\n");
return 0;
}
@@ -335,7 +332,7 @@ static int video_component_init(struct stream_port_s *port,
struct vdec_s *vdec = ada_ctx->vdec;
if ((vdec->port_flag & PORT_FLAG_VFORMAT) == 0) {
- pr_err("vformat not set\n");
+ v4l_dbg(ada_ctx->ctx, V4L_DEBUG_CODEC_ERROR, "vformat not set\n");
return -EPERM;
}
@@ -351,7 +348,7 @@ static int video_component_init(struct stream_port_s *port,
if (port->type & PORT_TYPE_FRAME) {
ret = vdec_init(vdec, pbuf->for_4k);
if (ret < 0) {
- pr_err("video_component_init %d, failed\n", __LINE__);
+ v4l_dbg(ada_ctx->ctx, V4L_DEBUG_CODEC_ERROR, "failed\n");
video_component_release(port, pbuf, 2);
return ret;
}
@@ -372,14 +369,14 @@ static int video_component_init(struct stream_port_s *port,
ret = stbuf_init(pbuf, vdec, false);
if (ret < 0) {
- pr_err("video_component_init %d, stbuf_init failed\n", __LINE__);
+ v4l_dbg(ada_ctx->ctx, V4L_DEBUG_CODEC_ERROR, "stbuf_init failed\n");
return ret;
}
/* todo: set path based on port flag */
ret = vdec_init(vdec, pbuf->for_4k);
if (ret < 0) {
- pr_err("video_component_init %d, vdec_init failed\n", __LINE__);
+ v4l_dbg(ada_ctx->ctx, V4L_DEBUG_CODEC_ERROR, "vdec_init failed\n");
video_component_release(port, pbuf, 2);
return ret;
}
@@ -387,8 +384,7 @@ static int video_component_init(struct stream_port_s *port,
if (vdec_dual(vdec)) {
ret = vdec_init(vdec->slave, pbuf->for_4k);
if (ret < 0) {
- pr_err("video_component_init %d, vdec_init failed\n",
- __LINE__);
+ v4l_dbg(ada_ctx->ctx, V4L_DEBUG_CODEC_ERROR, "vdec_init failed\n");
video_component_release(port, pbuf, 2);
return ret;
}
@@ -398,7 +394,7 @@ static int video_component_init(struct stream_port_s *port,
ret = esparser_init(pbuf, vdec);
if (ret < 0) {
video_component_release(port, pbuf, 3);
- pr_err("esparser_init() failed\n");
+ v4l_dbg(ada_ctx->ctx, V4L_DEBUG_CODEC_ERROR, "esparser_init() failed\n");
return ret;
}
}
@@ -476,33 +472,25 @@ static void set_vdec_properity(struct vdec_s *vdec,
/* set video format, sys info and vfm map.*/
vdec->port->vformat = vdec->format;
vdec->port->type |= PORT_TYPE_VIDEO;
- vdec->port_flag |= PORT_FLAG_VFORMAT;
+ vdec->port_flag |= (vdec->port->flag | PORT_FLAG_VFORMAT);
if (vdec->slave) {
vdec->slave->format = ada_ctx->dec_prop.format;
vdec->slave->port_flag |= PORT_FLAG_VFORMAT;
}
- if (vdec->port->type & PORT_FLAG_DRM) {
- vdec->type = VDEC_TYPE_STREAM_PARSER;
- vdec->port->type |= PORT_TYPE_ES;
- vdec->frame_base_video_path = FRAME_BASE_PATH_V4L_VIDEO;
- } else {
- vdec->type = VDEC_TYPE_FRAME_BLOCK;
- vdec->port->type |= PORT_TYPE_FRAME;
- vdec->frame_base_video_path = FRAME_BASE_PATH_V4L_OSD;
- }
+ vdec->type = VDEC_TYPE_FRAME_BLOCK;
+ vdec->port->type |= PORT_TYPE_FRAME;
+ vdec->frame_base_video_path = FRAME_BASE_PATH_V4L_OSD;
if (aml_set_vdec_type_enable) {
if (aml_set_vdec_type == VDEC_TYPE_STREAM_PARSER) {
vdec->type = VDEC_TYPE_STREAM_PARSER;
vdec->port->type &= ~PORT_TYPE_FRAME;
vdec->port->type |= PORT_TYPE_ES;
- ada_ctx->ctx->is_stream_mode = true;
} else if (aml_set_vdec_type == VDEC_TYPE_FRAME_BLOCK) {
vdec->type = VDEC_TYPE_FRAME_BLOCK;
vdec->port->type &= ~PORT_TYPE_ES;
vdec->port->type |= PORT_TYPE_FRAME;
- ada_ctx->ctx->is_stream_mode = false;
}
}
@@ -537,7 +525,7 @@ static int vdec_ports_init(struct aml_vdec_adapt *ada_ctx)
/* init hw and gate*/
ret = enable_hardware(vdec->port);
if (ret < 0) {
- pr_info("enable hw fail.\n");
+ v4l_dbg(ada_ctx->ctx, V4L_DEBUG_CODEC_ERROR, "enable hw fail.\n");
goto error1;
}
@@ -548,7 +536,7 @@ static int vdec_ports_init(struct aml_vdec_adapt *ada_ctx)
&& (vdec->port_flag & PORT_FLAG_AFORMAT)) {
ret = audio_component_init(vdec->port, pabuf);
if (ret < 0) {
- pr_err("audio_component_init failed\n");
+ v4l_dbg(ada_ctx->ctx, V4L_DEBUG_CODEC_ERROR, "audio_component_init failed\n");
goto error1;
}
}
@@ -564,7 +552,7 @@ static int vdec_ports_init(struct aml_vdec_adapt *ada_ctx)
ret = video_component_init(vdec->port, pvbuf);
if (ret < 0) {
- pr_err("video_component_init failed\n");
+ v4l_dbg(ada_ctx->ctx, V4L_DEBUG_CODEC_ERROR, "video_component_init failed\n");
goto error2;
}
@@ -592,7 +580,7 @@ int video_decoder_init(struct aml_vdec_adapt *vdec)
/* init the buffer work space and connect vdec.*/
ret = vdec_ports_init(vdec);
if (ret < 0) {
- pr_info("vdec ports init fail.\n");
+ v4l_dbg(vdec->ctx, V4L_DEBUG_CODEC_ERROR, "vdec ports init fail.\n");
goto out;
}
out:
@@ -606,14 +594,14 @@ int video_decoder_release(struct aml_vdec_adapt *vdec)
ret = vdec_ports_release(port);
if (ret < 0) {
- pr_info("vdec ports release fail.\n");
+ v4l_dbg(vdec->ctx, V4L_DEBUG_CODEC_ERROR, "vdec ports release fail.\n");
goto out;
}
/* disable gates */
ret = disable_hardware(port);
if (ret < 0) {
- pr_info("disable hw fail.\n");
+ v4l_dbg(vdec->ctx, V4L_DEBUG_CODEC_ERROR, "disable hw fail.\n");
goto out;
}
out:
@@ -652,14 +640,15 @@ int vdec_vbuf_write(struct aml_vdec_adapt *ada_ctx,
} while (ret == -EAGAIN && try_cnt--);
if (slow_input) {
- pr_info("slow_input: es codec write size %x\n", ret);
+ v4l_dbg(ada_ctx->ctx, V4L_DEBUG_CODEC_PRINFO,
+ "slow_input: es codec write size %x\n", ret);
msleep(10);
}
#ifdef DATA_DEBUG
/* dump to file */
//dump_write(vbuf, size);
- //pr_info("vbuf: %p, size: %u, ret: %d\n", vbuf, size, ret);
+ //v4l_dbg(ada_ctx->ctx, V4L_DEBUG_CODEC_PRINFO, "vbuf: %p, size: %u, ret: %d\n", vbuf, size, ret);
#endif
return ret;
@@ -684,7 +673,8 @@ int vdec_vframe_write(struct aml_vdec_adapt *ada_ctx,
ret = vdec_write_vframe(vdec, buf, count);
if (slow_input) {
- pr_info("slow_input: frame codec write size %d\n", ret);
+ v4l_dbg(ada_ctx->ctx, V4L_DEBUG_CODEC_PRINFO,
+ "slow_input: frame codec write size %d\n", ret);
msleep(30);
}
@@ -692,8 +682,33 @@ int vdec_vframe_write(struct aml_vdec_adapt *ada_ctx,
/* dump to file */
dump_write(buf, count);
#endif
- aml_v4l2_debug(3, "[%d] write frames, vbuf: %p, size: %u, ret: %d, crc: %x",
- ada_ctx->ctx->id, buf, count, ret, crc32_le(0, buf, count));
+ v4l_dbg(ada_ctx->ctx, V4L_DEBUG_CODEC_INPUT,
+ "write frames, vbuf: %p, size: %u, ret: %d, crc: %x\n",
+ buf, count, ret, crc32_le(0, buf, count));
+
+ return ret;
+}
+
+int vdec_vframe_write_with_dma(struct aml_vdec_adapt *ada_ctx,
+ ulong addr, u32 count, u64 timestamp, u32 handle)
+{
+ int ret = -1;
+ struct vdec_s *vdec = ada_ctx->vdec;
+
+ /* set timestamp */
+ vdec_set_timestamp(vdec, timestamp);
+
+ ret = vdec_write_vframe_with_dma(vdec, addr, count, handle);
+
+ if (slow_input) {
+ v4l_dbg(ada_ctx->ctx, V4L_DEBUG_CODEC_PRINFO,
+ "slow_input: frame codec write size %d\n", ret);
+ msleep(30);
+ }
+
+ v4l_dbg(ada_ctx->ctx, V4L_DEBUG_CODEC_INPUT,
+ "write frames, vbuf: %lx, size: %u, ret: %d\n",
+ addr, count, ret);
return ret;
}
@@ -712,13 +727,23 @@ int aml_codec_reset(struct aml_vdec_adapt *ada_ctx, int *mode)
int ret = 0;
if (vdec) {
- vdec_set_eos(vdec, false);
-
+ if (!ada_ctx->ctx->q_data[AML_Q_DATA_SRC].resolution_changed)
+ vdec_set_eos(vdec, false);
if (*mode == V4L_RESET_MODE_NORMAL &&
- vdec->input.have_frame_num == 0)
+ vdec->input.have_frame_num == 0) {
+ v4l_dbg(ada_ctx->ctx, V4L_DEBUG_CODEC_PRINFO,
+ "no input reset mode: %d\n", *mode);
*mode = V4L_RESET_MODE_LIGHT;
-
- aml_v4l2_debug(2, "%s, reset mode: %d\n", __func__, *mode);
+ }
+ if (ada_ctx->ctx->param_sets_from_ucode &&
+ *mode == V4L_RESET_MODE_NORMAL &&
+ ada_ctx->ctx->q_data[AML_Q_DATA_SRC].resolution_changed == true) {
+ v4l_dbg(ada_ctx->ctx, V4L_DEBUG_CODEC_PRINFO,
+ "resolution_changed reset mode: %d\n", *mode);
+ *mode = V4L_RESET_MODE_LIGHT;
+ }
+ v4l_dbg(ada_ctx->ctx, V4L_DEBUG_CODEC_PRINFO,
+ "reset mode: %d\n", *mode);
ret = vdec_v4l2_reset(vdec, *mode);
*mode = V4L_RESET_MODE_NORMAL;
@@ -761,3 +786,8 @@ void v4l2_config_vdec_parm(struct aml_vdec_adapt *ada_ctx, u8 *data, u32 len)
memcpy(vdec->config, data, vdec->config_len);
}
+u32 aml_recycle_buffer(struct aml_vdec_adapt *adaptor)
+{
+ return vdec_input_get_freed_handle(adaptor->vdec);
+}
+