#define DETECT_WRONG_MULTI_SLICE
+/*
+to enable DV of frame mode
+#define DOLBY_META_SUPPORT in ucode
+*/
#undef pr_info
#define pr_info printk
static int start_decode_buf_level = 0x4000;
static int pre_decode_buf_level = 0x1000;
static int stream_mode_start_num = 4;
-
#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
/*to make reorder size difference of bl and el not too big*/
static unsigned int reorder_dpb_size_margin_dv = 16;
hw_buf->prefix_aux_size;
}
if (dpb_is_debug(DECODE_ID(hw),
- PRINT_FLAG_DPB_DETAIL)) {
+ PRINT_FLAG_DEC_DETAIL)) {
dpb_print(DECODE_ID(hw), 0,
- "%s:old size %d count %d,suf %d dv_flag %d\r\n",
- __func__, AUX_DATA_SIZE(pic),
+ "%s:poc %d old size %d count %d,suf %d dv_flag %d\r\n",
+ __func__, pic->poc, AUX_DATA_SIZE(pic),
aux_count, suffix_flag, dv_meta_flag);
}
if (aux_size > 0 && aux_count > 0) {
h[7] = (padding_len) & 0xff;
}
if (dpb_is_debug(DECODE_ID(hw),
- PRINT_FLAG_DPB_DETAIL)) {
+ PRINT_FLAG_DEC_DETAIL)) {
dpb_print(DECODE_ID(hw), 0,
"aux: (size %d) suffix_flag %d\n",
AUX_DATA_SIZE(pic), suffix_flag);
PRINT_FLAG_DPB_DETAIL))
dump_aux_buf(hw);
#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
- if (vdec->dolby_meta_with_el || vdec->slave) {
+ if (vdec_frame_based(vdec)) {
+ if (hw->last_dec_picture)
+ set_aux_data(hw,
+ hw->last_dec_picture, 0, 0, NULL);
+ } else if (vdec->dolby_meta_with_el || vdec->slave) {
if (hw->last_dec_picture)
set_aux_data(hw, hw->last_dec_picture,
0, 0, NULL);
u32 param1, u32 param2, u32 param3, u32 param4,
struct aml_vdec_ps_infos *ps)
{
+#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
struct vdec_s *vdec = hw_to_vdec(hw);
+#endif
int mb_width, mb_total;
int mb_height = 0;
int active_buffer_spec_num;
if (vdec_is_support_4k()) {
if (get_cpu_major_id() >= AM_MESON_CPU_MAJOR_ID_TXLX) {
ammvdec_h264_profile.profile =
- "4k, dwrite, compressed";
+ "4k, dwrite, compressed, frame_dv";
} else if (get_cpu_major_id() >= AM_MESON_CPU_MAJOR_ID_GXTVBB) {
- ammvdec_h264_profile.profile = "4k";
+ ammvdec_h264_profile.profile = "4k, frame_dv";
}
}
#include "../utils/vdec_v4l2_buffer_ops.h"
#include <media/v4l2-mem2mem.h>
+/*
+to enable DV of frame mode
+#define DOLBY_META_SUPPORT in ucode
+*/
+
#define HEVC_8K_LFTOFFSET_FIX
#define CONSTRAIN_MAX_BUF_NUM
static u32 use_cma = 2;
#define AUX_BUF_ALIGN(adr) ((adr + 0xf) & (~0xf))
+/*
static u32 prefix_aux_buf_size = (16 * 1024);
static u32 suffix_aux_buf_size;
+*/
+static u32 prefix_aux_buf_size = (12 * 1024);
+static u32 suffix_aux_buf_size = (12 * 1024);
static u32 max_decoding_time;
/*
* bit 8, debug flag
*/
static u32 parser_sei_enable;
-#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
static u32 parser_dolby_vision_enable = 1;
+#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
static u32 dolby_meta_with_el;
static u32 dolby_el_flush_th = 2;
#endif
}
}
+#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
/* dv wait cur_pic all data get,
some data may get after picture output */
if ((vdec->master || vdec->slave)
(hevc->bypass_dvenl && !dolby_meta_with_el)
&& (!fisrt_pic_flag))
pic_display = NULL;
-
+#endif
if (pic_display) {
if ((num_pic_not_yet_display >
pic_display->num_reorder_pic)
union param_u *rpm_param,
int decode_pic_begin)
{
-#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
struct vdec_s *vdec = hw_to_vdec(hevc);
-#endif
int i;
int lcu_x_num_div;
int lcu_y_num_div;
WRITE_VREG(NAL_SEARCH_CTL,
READ_VREG(NAL_SEARCH_CTL)
| ((parser_sei_enable & 0x7) << 17));
-#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
+/*#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION*/
WRITE_VREG(NAL_SEARCH_CTL,
READ_VREG(NAL_SEARCH_CTL) |
((parser_dolby_vision_enable & 0x1) << 20));
-#endif
+/*#endif*/
config_decode_mode(hevc);
WRITE_VREG(DECODE_STOP_POS, udebug_flag);
unsigned int dec_status = hevc->dec_status;
int i, ret;
-#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
struct vdec_s *vdec = hw_to_vdec(hevc);
-#endif
if (hevc->eos)
return IRQ_HANDLED;
WRITE_VREG(NAL_SEARCH_CTL,
READ_VREG(NAL_SEARCH_CTL)
| ((parser_sei_enable & 0x7) << 17));
-#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
+/*#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION*/
WRITE_VREG(NAL_SEARCH_CTL,
READ_VREG(NAL_SEARCH_CTL) |
((parser_dolby_vision_enable & 0x1) << 20));
-#endif
+/*#endif*/
config_decode_mode(hevc);
/* search new nal */
WRITE_VREG(HEVC_DEC_STATUS_REG, HEVC_ACTION_DONE);
read_decode_info(hevc);
if (vdec_frame_based(hw_to_vdec(hevc))) {
hevc->empty_flag = 1;
+ /*suffix sei or dv meta*/
+ set_aux_data(hevc, hevc->cur_pic, 1, 0);
goto pic_done;
} else {
if (
if (vdec_frame_based(hw_to_vdec(hevc))) {
/*hevc->dec_result = DEC_RESULT_GET_DATA;*/
hevc->empty_flag = 1;
+ /*suffix sei or dv meta*/
+ set_aux_data(hevc, hevc->cur_pic, 1, 0);
goto pic_done;
} else {
hevc->dec_result = DEC_RESULT_AGAIN;
(READ_VREG(HEVC_PARSER_LCU_START) & 0xffffff) == 0
&& (hevc->lcu_x_num * hevc->lcu_y_num != 1))
hevc->cur_pic->error_mark = 1;
+#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
force_output:
+#endif
pic_display = output_pic(hevc, 1);
if (pic_display) {
if ((pic_display->error_mark &&
WRITE_VREG(NAL_SEARCH_CTL,
READ_VREG(NAL_SEARCH_CTL)
| ((parser_sei_enable & 0x7) << 17));
-#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
+/*#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION*/
WRITE_VREG(NAL_SEARCH_CTL,
READ_VREG(NAL_SEARCH_CTL) |
((parser_dolby_vision_enable & 0x1) << 20));
-#endif
+/*#endif*/
config_decode_mode(hevc);
}
WRITE_VREG(NAL_SEARCH_CTL,
READ_VREG(NAL_SEARCH_CTL)
| ((parser_sei_enable & 0x7) << 17));
-#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
+/*#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION*/
WRITE_VREG(NAL_SEARCH_CTL,
READ_VREG(NAL_SEARCH_CTL) |
((parser_dolby_vision_enable & 0x1) << 20));
-#endif
+/*#endif*/
WRITE_VREG(DECODE_STOP_POS, udebug_flag);
config_decode_mode(hevc);
MC_PU32("parser_sei_enable", &parser_sei_enable),
MC_PU32("start_decode_buf_level", &start_decode_buf_level),
MC_PU32("decode_timeout_val", &decode_timeout_val),
-#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
MC_PU32("parser_dolby_vision_enable", &parser_dolby_vision_enable),
+#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
MC_PU32("dv_toggle_prov_name", &dv_toggle_prov_name),
MC_PU32("dv_debug", &dv_debug),
#endif
amvdec_h265_profile.profile = "4k";
} else if (get_cpu_major_id() >= AM_MESON_CPU_MAJOR_ID_SM1) {
amvdec_h265_profile.profile =
- "8k, 8bit, 10bit, dwrite, compressed";
+ "8k, 8bit, 10bit, dwrite, compressed, frame_dv";
}else if (get_cpu_major_id() >= AM_MESON_CPU_MAJOR_ID_GXBB) {
amvdec_h265_profile.profile =
- "4k, 8bit, 10bit, dwrite, compressed";
+ "4k, 8bit, 10bit, dwrite, compressed, frame_dv";
} else if (get_cpu_major_id() >= AM_MESON_CPU_MAJOR_ID_MG9TV)
amvdec_h265_profile.profile = "4k";
}
module_param(parser_sei_enable, uint, 0664);
MODULE_PARM_DESC(parser_sei_enable, "\n parser_sei_enable\n");
-#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
module_param(parser_dolby_vision_enable, uint, 0664);
MODULE_PARM_DESC(parser_dolby_vision_enable,
"\n parser_dolby_vision_enable\n");
+#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
module_param(dolby_meta_with_el, uint, 0664);
MODULE_PARM_DESC(dolby_meta_with_el,
"\n dolby_meta_with_el\n");
static int last_read_wi;
static u32 ud_ready_vdec_flag;
-
+/*bit 1 force dual layer
+ *bit 2 force frame mode
+ */
+static u32 force_dv_mode;
static DEFINE_MUTEX(userdata_mutex);
.fops = &vbuf_fops,
.vformat = VFORMAT_HEVC,
},
+ {
+ .name = "amstream_dves_avc_frame",
+ .type = PORT_TYPE_ES | PORT_TYPE_VIDEO | PORT_TYPE_FRAME |
+ PORT_TYPE_DECODER_SCHED | PORT_TYPE_DUALDEC,
+ .fops = &vframe_fops,
+ },
+ {
+ .name = "amstream_dves_hevc_frame",
+ .type = PORT_TYPE_ES | PORT_TYPE_VIDEO | PORT_TYPE_HEVC | PORT_TYPE_FRAME |
+ PORT_TYPE_DECODER_SCHED | PORT_TYPE_DUALDEC,
+ .fops = &vframe_fops,
+ .vformat = VFORMAT_HEVC,
+ },
{
.name = "amstream_dves_av1",
.type = PORT_TYPE_ES | PORT_TYPE_VIDEO | PORT_TYPE_HEVC | PORT_TYPE_FRAME |
__LINE__);
return r;
}
-
+#if 0
if (vdec_dual(vdec)) {
if (port->vformat == VFORMAT_AV1) /* av1 dv only single layer */
return 0;
return r;
}
}
+#endif
return 0;
}
return -EBUSY;
}
}
+ /* force dv frame mode */
+ if ((force_dv_mode & 0x2) &&
+ (get_cpu_major_id() >= AM_MESON_CPU_MAJOR_ID_SC2)) {
+ port->type |= PORT_TYPE_FRAME;
+ port->fops = &vframe_fops;
+ pr_debug("%s, dobly vision force frame mode.\n", __func__);
+ }
+
+ /* esplayer stream mode force dv */
+ if (force_dv_mode & 0x1)
+ port->type |= PORT_TYPE_DUALDEC;
/* check other ports conflicts for audio */
for (s = &ports[0], i = 0; i < amstream_port_num; i++, s++) {
pr_err("amstream: vdec creation failed\n");
return -ENOMEM;
}
-
- if ((port->type & PORT_TYPE_DUALDEC) ||
- (vdec_get_debug_flags() & 0x100)) {
- priv->vdec->slave = vdec_create(port, priv->vdec);
-
- if (priv->vdec->slave == NULL) {
- vdec_release(priv->vdec);
- port->flag = 0;
- kfree(priv);
- pr_err("amstream: sub vdec creation failed\n");
- return -ENOMEM;
+ if (!(port->type & PORT_TYPE_FRAME)) {
+ if ((port->type & PORT_TYPE_DUALDEC) ||
+ (vdec_get_debug_flags() & 0x100)) {
+ priv->vdec->slave = vdec_create(port, priv->vdec);
+
+ if (priv->vdec->slave == NULL) {
+ vdec_release(priv->vdec);
+ port->flag = 0;
+ kfree(priv);
+ pr_err("amstream: sub vdec creation failed\n");
+ return -ENOMEM;
+ }
}
}
}
module_init(amstream_module_init);
module_exit(amstream_module_exit);
+module_param(force_dv_mode, uint, 0664);
+MODULE_PARM_DESC(force_dv_mode,
+ "\n force_dv_mode \n");
+
module_param(def_4k_vstreambuf_sizeM, uint, 0664);
MODULE_PARM_DESC(def_4k_vstreambuf_sizeM,
"\nDefault video Stream buf size for 4K MByptes\n");