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/avs2/vavs2.c b/drivers/frame_provider/decoder/avs2/vavs2.c
index f90fee6..9da22f9 100644
--- a/drivers/frame_provider/decoder/avs2/vavs2.c
+++ b/drivers/frame_provider/decoder/avs2/vavs2.c
@@ -4136,7 +4136,7 @@ static struct vframe_s *vavs2_vf_get(void *op_arg)
if (kfifo_get(&dec->display_q, &vf)) {
uint8_t index = vf->index & 0xff;
- if (index >= 0 && index < dec->used_buf_num) {
+ if (index < dec->used_buf_num) {
struct avs2_frame_s *pic = get_pic_by_index(dec, index);
if (pic == NULL &&
(debug & AVS2_DBG_PIC_LEAK)) {
@@ -4186,8 +4186,7 @@ static void vavs2_vf_put(struct vframe_s *vf, void *op_arg)
__func__, vf->index,
dec->vf_put_count);
- if (index >= 0
- && index < dec->used_buf_num) {
+ if (index < dec->used_buf_num) {
unsigned long flags;
struct avs2_frame_s *pic;
@@ -4258,7 +4257,10 @@ static void fill_frame_info(struct AVS2Decoder_s *dec,
/*
#define SHOW_QOS_INFO
*/
- vframe_qos->size = framesize;
+ if (input_frame_based(hw_to_vdec(dec)))
+ vframe_qos->size = pic->frame_size;
+ else
+ vframe_qos->size = framesize;
vframe_qos->pts = pts;
#ifdef SHOW_QOS_INFO
avs2_print(dec, 0, "slice:%d\n", pic->slice_type);
@@ -4297,8 +4299,6 @@ static void fill_frame_info(struct AVS2Decoder_s *dec,
vframe_qos->num++;
- if (dec->frameinfo_enable)
- vdec_fill_frame_info(vframe_qos, 1);
}
static void set_vframe(struct AVS2Decoder_s *dec,
@@ -4306,7 +4306,7 @@ static void set_vframe(struct AVS2Decoder_s *dec,
{
unsigned long flags;
int stream_offset;
- unsigned int frame_size;
+ unsigned int frame_size = 0;
int pts_discontinue;
stream_offset = pic->stream_offset;
avs2_print(dec, AVS2_DBG_BUFMGR,
@@ -4534,6 +4534,22 @@ static void set_vframe(struct AVS2Decoder_s *dec,
dec->vf_pre_count++;
}
+static inline void dec_update_gvs(struct AVS2Decoder_s *dec)
+{
+ if (dec->gvs->frame_height != dec->frame_height) {
+ dec->gvs->frame_width = dec->frame_width;
+ dec->gvs->frame_height = dec->frame_height;
+ }
+ if (dec->gvs->frame_dur != dec->frame_dur) {
+ dec->gvs->frame_dur = dec->frame_dur;
+ if (dec->frame_dur != 0)
+ dec->gvs->frame_rate = 96000 / dec->frame_dur;
+ else
+ dec->gvs->frame_rate = -1;
+ }
+ dec->gvs->status = dec->stat | dec->fatal_error;
+}
+
static int avs2_prepare_display_buf(struct AVS2Decoder_s *dec)
{
@@ -4541,6 +4557,7 @@ static int avs2_prepare_display_buf(struct AVS2Decoder_s *dec)
struct vframe_s *vf = NULL;
/*unsigned short slice_type;*/
struct avs2_frame_s *pic;
+ struct vdec_s *pvdec = hw_to_vdec(dec);
while (1) {
pic = get_disp_pic(dec);
if (pic == NULL)
@@ -4575,17 +4592,22 @@ static int avs2_prepare_display_buf(struct AVS2Decoder_s *dec)
}
if (vf) {
+ struct vdec_info tmp4x;
+ int stream_offset = pic->stream_offset;
set_vframe(dec, vf, pic, 0);
- decoder_do_frame_check(hw_to_vdec(dec), vf);
+ decoder_do_frame_check(pvdec, vf);
kfifo_put(&dec->display_q, (const struct vframe_s *)vf);
ATRACE_COUNTER(MODULE_NAME, vf->pts);
- #ifndef CONFIG_AMLOGIC_MEDIA_MULTI_DEC
+ dec_update_gvs(dec);
/*count info*/
- gvs->frame_dur = dec->frame_dur;
- vdec_count_info(gvs, 0, stream_offset);
- #endif
- hw_to_vdec(dec)->vdec_fps_detec(hw_to_vdec(dec)->id);
+ vdec_count_info(dec->gvs, 0, stream_offset);
+ memcpy(&tmp4x, dec->gvs, sizeof(struct vdec_info));
+ tmp4x.bit_depth_luma = bit_depth_luma;
+ tmp4x.bit_depth_chroma = bit_depth_chroma;
+ tmp4x.double_write_mode = get_double_write_mode(dec);
+ vdec_fill_vdec_frame(pvdec, &dec->vframe_qos, &tmp4x, vf, pic->hw_decode_time);
+ pvdec->vdec_fps_detec(pvdec->id);
if (without_display_mode == 0) {
vf_notify_receiver(dec->provider_name,
VFRAME_EVENT_PROVIDER_VFRAME_READY, NULL);
@@ -4774,12 +4796,18 @@ we can call this function to get qos info*/
static void get_picture_qos_info(struct AVS2Decoder_s *dec)
{
struct avs2_frame_s *picture = dec->avs2_dec.hc.cur_pic;
+ struct vdec_s *vdec = hw_to_vdec(dec);
if (!picture) {
avs2_print(dec, AVS2_DBG_BUFMGR_MORE,
"%s decode picture is none exist\n");
return;
}
+ if (vdec->mvfrm) {
+ picture->frame_size = vdec->mvfrm->frame_size;
+ picture->hw_decode_time =
+ local_clock() - vdec->mvfrm->hw_decode_start;
+ }
/*
#define DEBUG_QOS
@@ -5133,55 +5161,55 @@ static void get_picture_qos_info(struct AVS2Decoder_s *dec)
#endif
picture->min_mv = mv_lo;
+#ifdef DEBUG_QOS
/* {mvy_L0_max, mvy_L0_min} */
rdata32 = READ_VREG(HEVC_PIC_QUALITY_DATA);
mv_hi = (rdata32>>16)&0xffff;
if (mv_hi & 0x8000)
mv_hi = 0x8000 - mv_hi;
-#ifdef DEBUG_QOS
avs2_print(dec, 0, "[Picture %d Quality] MVY_L0 MAX : %d\n",
pic_number, mv_hi);
-#endif
+
mv_lo = (rdata32>>0)&0xffff;
if (mv_lo & 0x8000)
mv_lo = 0x8000 - mv_lo;
-#ifdef DEBUG_QOS
+
avs2_print(dec, 0, "[Picture %d Quality] MVY_L0 MIN : %d\n",
pic_number, mv_lo);
-#endif
+
/* {mvx_L1_max, mvx_L1_min} */
rdata32 = READ_VREG(HEVC_PIC_QUALITY_DATA);
mv_hi = (rdata32>>16)&0xffff;
if (mv_hi & 0x8000)
mv_hi = 0x8000 - mv_hi;
-#ifdef DEBUG_QOS
+
avs2_print(dec, 0, "[Picture %d Quality] MVX_L1 MAX : %d\n",
pic_number, mv_hi);
-#endif
+
mv_lo = (rdata32>>0)&0xffff;
if (mv_lo & 0x8000)
mv_lo = 0x8000 - mv_lo;
-#ifdef DEBUG_QOS
+
avs2_print(dec, 0, "[Picture %d Quality] MVX_L1 MIN : %d\n",
pic_number, mv_lo);
-#endif
+
/* {mvy_L1_max, mvy_L1_min} */
rdata32 = READ_VREG(HEVC_PIC_QUALITY_DATA);
mv_hi = (rdata32>>16)&0xffff;
if (mv_hi & 0x8000)
mv_hi = 0x8000 - mv_hi;
-#ifdef DEBUG_QOS
+
avs2_print(dec, 0, "[Picture %d Quality] MVY_L1 MAX : %d\n",
pic_number, mv_hi);
-#endif
+
mv_lo = (rdata32>>0)&0xffff;
if (mv_lo & 0x8000)
mv_lo = 0x8000 - mv_lo;
-#ifdef DEBUG_QOS
+
avs2_print(dec, 0, "[Picture %d Quality] MVY_L1 MIN : %d\n",
pic_number, mv_lo);
#endif
@@ -5440,6 +5468,7 @@ static irqreturn_t vavs2_isr_thread_fn(int irq, void *data)
debug_buffer_mgr_more(dec);
get_frame_rate(&dec->avs2_dec.param, dec);
+#if 0 // The video_signal_type is type of uint16_t and result false, so comment it out.
if (dec->avs2_dec.param.p.video_signal_type
& (1<<30)) {
union param_u *pPara;
@@ -5512,6 +5541,7 @@ static irqreturn_t vavs2_isr_thread_fn(int irq, void *data)
"max_pic_average:0x%x\n",
dec->vf_dp.content_light_level.max_pic_average);
}
+#endif
if (dec->video_ori_signal_type !=
@@ -6111,19 +6141,17 @@ int vavs2_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus)
vstatus->error_count = 0;
vstatus->status = dec->stat | dec->fatal_error;
vstatus->frame_dur = dec->frame_dur;
-#ifndef CONFIG_AMLOGIC_MEDIA_MULTI_DEC
- vstatus->bit_rate = gvs->bit_rate;
- vstatus->frame_data = gvs->frame_data;
- vstatus->total_data = gvs->total_data;
- vstatus->frame_count = gvs->frame_count;
- vstatus->error_frame_count = gvs->error_frame_count;
- vstatus->drop_frame_count = gvs->drop_frame_count;
- vstatus->total_data = gvs->total_data;
- vstatus->samp_cnt = gvs->samp_cnt;
- vstatus->offset = gvs->offset;
+ vstatus->bit_rate = dec->gvs->bit_rate;
+ vstatus->frame_data = dec->gvs->frame_data;
+ vstatus->total_data = dec->gvs->total_data;
+ vstatus->frame_count = dec->gvs->frame_count;
+ vstatus->error_frame_count = dec->gvs->error_frame_count;
+ vstatus->drop_frame_count = dec->gvs->drop_frame_count;
+ vstatus->total_data = dec->gvs->total_data;
+ vstatus->samp_cnt = dec->gvs->samp_cnt;
+ vstatus->offset = dec->gvs->offset;
snprintf(vstatus->vdec_name, sizeof(vstatus->vdec_name),
"%s", DRIVER_NAME);
-#endif
return 0;
}
@@ -6209,7 +6237,7 @@ static int vavs2_set_trickmode(struct vdec_s *vdec, unsigned long trickmode)
(struct AVS2Decoder_s *)vdec->private;
if (i_only_flag & 0x100)
return 0;
- if (trickmode == TRICKMODE_I)
+ if (trickmode == TRICKMODE_I || trickmode == TRICKMODE_I_HEVC)
dec->i_only = 0x3;
else if (trickmode == TRICKMODE_NONE)
dec->i_only = 0x0;
@@ -6292,6 +6320,8 @@ static s32 vavs2_init(struct vdec_s *vdec)
if (vavs2_local_init(dec) < 0)
return -EBUSY;
+ vdec_set_vframe_comm(vdec, DRIVER_NAME);
+
fw = vmalloc(sizeof(struct firmware_s) + fw_size);
if (IS_ERR_OR_NULL(fw))
return -ENOMEM;
@@ -7055,6 +7085,8 @@ static void run(struct vdec_s *vdec, unsigned long mask,
WRITE_VREG(HEVC_SHIFT_BYTE_COUNT, 0);
r = dec->chunk->size +
(dec->chunk->offset & (VDEC_FIFO_ALIGN - 1));
+ if (vdec->mvfrm)
+ vdec->mvfrm->frame_size = dec->chunk->size;
}
WRITE_VREG(HEVC_DECODE_SIZE, r);
@@ -7072,6 +7104,8 @@ static void run(struct vdec_s *vdec, unsigned long mask,
mod_timer(&dec->timer, jiffies);
dec->stat |= STAT_TIMER_ARM;
dec->stat |= STAT_ISR_REG;
+ if (vdec->mvfrm)
+ vdec->mvfrm->hw_decode_start = local_clock();
amhevc_start();
dec->stat |= STAT_VDEC_RUN;
}
@@ -7311,7 +7345,7 @@ static int ammvdec_avs2_probe(struct platform_device *pdev)
dec->stat |= VP9_TRIGGER_FRAME_ENABLE;
#if 1
if ((debug & IGNORE_PARAM_FROM_CONFIG) == 0 &&
- pdata->config && pdata->config_len) {
+ pdata->config_len) {
/*use ptr config for doubel_write_mode, etc*/
avs2_print(dec, 0, "pdata->config=%s\n", pdata->config);
if (get_config_int(pdata->config, "avs2_double_write_mode",
@@ -7402,13 +7436,6 @@ static int ammvdec_avs2_probe(struct platform_device *pdev)
dec->first_sc_checked = 0;
dec->fatal_error = 0;
dec->show_frame_num = 0;
- if (pdata == NULL) {
- pr_info("\namvdec_avs2 memory resource undefined.\n");
- uninit_mmu_buffers(dec);
- /* devm_kfree(&pdev->dev, (void *)dec); */
- vfree((void *)dec);
- return -EFAULT;
- }
if (debug) {
pr_info("===AVS2 decoder mem resource 0x%lx size 0x%x\n",