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/frame_provider/decoder/mpeg4/vmpeg4_multi.c b/drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c
index c098a5e..aa73613 100644
--- a/drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c
+++ b/drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c
@@ -200,6 +200,8 @@ struct pic_info_t {
u32 duration;
u32 repeat_cnt;
ulong v4l_ref_buf_addr;
+ u32 hw_decode_time;
+ u32 frame_size; // For frame base mode;
};
struct vdec_mpeg4_hw_s {
@@ -305,6 +307,7 @@ struct vdec_mpeg4_hw_s {
bool v4l_params_parsed;
u32 buf_num;
u32 dynamic_buf_num_margin;
+ u32 i_only;
};
static void vmpeg4_local_init(struct vdec_mpeg4_hw_s *hw);
static int vmpeg4_hw_ctx_restore(struct vdec_mpeg4_hw_s *hw);
@@ -611,7 +614,20 @@ static int prepare_display_buf(struct vdec_mpeg4_hw_s * hw,
{
struct vframe_s *vf = NULL;
struct vdec_s *vdec = hw_to_vdec(hw);
+ struct aml_vcodec_ctx * v4l2_ctx = hw->v4l2_ctx;
+ ulong nv_order = VIDTYPE_VIU_NV21;
int index = pic->index;
+ bool pb_skip = false;
+
+ /* swap uv */
+ if (hw->is_used_v4l) {
+ if ((v4l2_ctx->cap_pix_fmt == V4L2_PIX_FMT_NV12) ||
+ (v4l2_ctx->cap_pix_fmt == V4L2_PIX_FMT_NV12M))
+ nv_order = VIDTYPE_VIU_NV12;
+ }
+
+ if (hw->i_only)
+ pb_skip = 1;
if (pic->pic_info & INTERLACE_FLAG) {
if (kfifo_get(&hw->newframe_q, &vf) == 0) {
@@ -642,7 +658,7 @@ static int prepare_display_buf(struct vdec_mpeg4_hw_s * hw,
vf->type = (pic->pic_info & TOP_FIELD_FIRST_FLAG) ?
VIDTYPE_INTERLACE_TOP : VIDTYPE_INTERLACE_BOTTOM;
#ifdef NV21
- vf->type |= VIDTYPE_VIU_NV21;
+ vf->type |= nv_order;
#endif
set_frame_info(hw, vf, pic->index);
@@ -651,7 +667,7 @@ static int prepare_display_buf(struct vdec_mpeg4_hw_s * hw,
"field0: pts %d, pts64 %lld, w %d, h %d, dur %d\n",
vf->pts, vf->pts_us64, vf->width, vf->height, vf->duration);
- if ((hw->first_i_frame_ready == 0)
+ if (((hw->first_i_frame_ready == 0) || pb_skip)
&& (pic->pic_type != I_PICTURE)) {
hw->drop_frame_count++;
hw->vfbuf_use[index]--;
@@ -694,7 +710,7 @@ static int prepare_display_buf(struct vdec_mpeg4_hw_s * hw,
vf->type = (pic->pic_info & TOP_FIELD_FIRST_FLAG) ?
VIDTYPE_INTERLACE_BOTTOM : VIDTYPE_INTERLACE_TOP;
#ifdef NV21
- vf->type |= VIDTYPE_VIU_NV21;
+ vf->type |= nv_order;
#endif
set_frame_info(hw, vf, pic->index);
@@ -702,8 +718,8 @@ static int prepare_display_buf(struct vdec_mpeg4_hw_s * hw,
mmpeg4_debug_print(DECODE_ID(hw), PRINT_FLAG_TIMEINFO,
"filed1: pts %d, pts64 %lld, w %d, h %d, dur: %d\n",
vf->pts, vf->pts_us64, vf->width, vf->height, vf->duration);
- if ((hw->first_i_frame_ready == 0) &&
- (pic->pic_type != I_PICTURE)) {
+ if (((hw->first_i_frame_ready == 0) || pb_skip)
+ && (pic->pic_type != I_PICTURE)) {
hw->drop_frame_count++;
hw->vfbuf_use[index]--;
kfifo_put(&hw->newframe_q,
@@ -755,7 +771,7 @@ static int prepare_display_buf(struct vdec_mpeg4_hw_s * hw,
pic->duration;
#ifdef NV21
vf->type = VIDTYPE_PROGRESSIVE |
- VIDTYPE_VIU_FIELD | VIDTYPE_VIU_NV21;
+ VIDTYPE_VIU_FIELD | nv_order;
#else
vf->type = VIDTYPE_PROGRESSIVE |
VIDTYPE_VIU_FIELD;
@@ -767,13 +783,15 @@ static int prepare_display_buf(struct vdec_mpeg4_hw_s * hw,
"prog: pts %d, pts64 %lld, w %d, h %d, dur %d\n",
vf->pts, vf->pts_us64, vf->width, vf->height, vf->duration);
- if ((hw->first_i_frame_ready == 0) &&
- (pic->pic_type != I_PICTURE)) {
+ if (((hw->first_i_frame_ready == 0) || pb_skip)
+ && (pic->pic_type != I_PICTURE)) {
hw->drop_frame_count++;
hw->vfbuf_use[index]--;
kfifo_put(&hw->newframe_q,
(const struct vframe_s *)vf);
} else {
+ struct vdec_info vinfo;
+
vf->mem_handle =
decoder_bmmu_box_get_mem_handle(
hw->mm_blk_handle, index);
@@ -784,6 +802,9 @@ static int prepare_display_buf(struct vdec_mpeg4_hw_s * hw,
decoder_do_frame_check(vdec, vf);
hw->frame_num++;
+ vdec->dec_status(vdec, &vinfo);
+ vdec_fill_vdec_frame(vdec, NULL,
+ &vinfo, vf, pic->hw_decode_time);
if (without_display_mode == 0) {
vf_notify_receiver(vdec->vf_provider_name,
VFRAME_EVENT_PROVIDER_VFRAME_READY, NULL);
@@ -949,6 +970,11 @@ static irqreturn_t vmpeg4_isr_thread_fn(struct vdec_s *vdec, int irq)
}
hw->dec_result = DEC_RESULT_DONE;
dec_pic = &hw->pic[index];
+ if (vdec->mvfrm) {
+ dec_pic->frame_size = vdec->mvfrm->frame_size;
+ dec_pic->hw_decode_time =
+ local_clock() - vdec->mvfrm->hw_decode_start;
+ }
dec_pic->pts_valid = false;
dec_pic->pts = 0;
dec_pic->pts64 = 0;
@@ -978,9 +1004,6 @@ static irqreturn_t vmpeg4_isr_thread_fn(struct vdec_s *vdec, int irq)
hw->v4l_params_parsed = true;
vdec_v4l_set_ps_infos(ctx, &ps);
}
-
- if (!ctx->v4l_codec_ready)
- return IRQ_HANDLED;
}
if (hw->vmpeg4_amstream_dec_info.rate == 0) {
@@ -1518,13 +1541,8 @@ static int vmpeg4_canvas_init(struct vdec_mpeg4_hw_s *hw)
decbuf_size =
ALIGN(align_w * align_h * 3/2, SZ_64K);
} else { /*1080p*/
- if (h > w) {
- canvas_width = 1088;
- canvas_height = 1920;
- } else {
- canvas_width = 1920;
- canvas_height = 1088;
- }
+ canvas_width = 1920;
+ canvas_height = 1088;
decbuf_y_size = 0x200000;
decbuf_size = 0x300000;
}
@@ -1770,8 +1788,6 @@ static void check_timer_func(unsigned long arg)
}
if (((debug_enable & PRINT_FLAG_TIMEOUT_STATUS) == 0) &&
- (vdec_frame_based(vdec) ||
- ((u32)READ_VREG(VLD_MEM_VIFIFO_LEVEL) > 0x100)) &&
(timeout_val > 0) &&
(hw->start_process_time > 0) &&
((1000 * (jiffies - hw->start_process_time) / HZ)
@@ -2205,6 +2221,8 @@ static void run(struct vdec_s *vdec, unsigned long mask,
size = hw->chunk_size +
(hw->chunk_offset & (VDEC_FIFO_ALIGN - 1));
WRITE_VREG(VIFF_BIT_CNT, size * 8);
+ if (vdec->mvfrm)
+ vdec->mvfrm->frame_size = hw->chunk->size;
}
hw->input_empty = 0;
hw->last_vld_level = 0;
@@ -2213,6 +2231,8 @@ static void run(struct vdec_s *vdec, unsigned long mask,
/* wmb before ISR is handled */
wmb();
+ if (vdec->mvfrm)
+ vdec->mvfrm->hw_decode_start = local_clock();
amvdec_start();
hw->stat |= STAT_VDEC_RUN;
hw->init_flag = 1;
@@ -2250,6 +2270,23 @@ static void reset(struct vdec_s *vdec)
hw->ctx_valid = 0;
}
+static int vmpeg4_set_trickmode(struct vdec_s *vdec, unsigned long trickmode)
+{
+ struct vdec_mpeg4_hw_s *hw =
+ (struct vdec_mpeg4_hw_s *)vdec->private;
+ if (!hw)
+ return 0;
+
+ if (trickmode == TRICKMODE_I) {
+ hw->i_only = 0x3;
+ trickmode_i = 1;
+ } else if (trickmode == TRICKMODE_NONE) {
+ hw->i_only = 0x0;
+ trickmode_i = 0;
+ }
+ return 0;
+}
+
static int ammvdec_mpeg4_probe(struct platform_device *pdev)
{
struct vdec_s *pdata = *(struct vdec_s **)pdev->dev.platform_data;
@@ -2274,6 +2311,7 @@ static int ammvdec_mpeg4_probe(struct platform_device *pdev)
pdata->private = hw;
pdata->dec_status = dec_status;
/* pdata->set_trickmode = set_trickmode; */
+ pdata->set_trickmode = vmpeg4_set_trickmode;
pdata->run_ready = run_ready;
pdata->run = run;
pdata->reset = reset;
@@ -2348,6 +2386,8 @@ static int ammvdec_mpeg4_probe(struct platform_device *pdev)
}
vdec_set_prepare_level(pdata, start_decode_buf_level);
+ vdec_set_vframe_comm(pdata, DRIVER_NAME);
+
if (pdata->parallel_dec == 1)
vdec_core_request(pdata, CORE_MASK_VDEC_1);
else {