MODULE_PARM_DESC(dolby_vision_tunning_mode, "\n dolby_vision_tunning_mode\n");
#ifdef V2_4
-#define DV_LL_OUTPUT_BITS 12
-/* bit0 ~ bit7: output mode, bit8 ~ bit15: output bits */
-static unsigned int dv_ll_output_mode =
- (DV_LL_OUTPUT_BITS << 8) | DOLBY_VISION_OUTPUT_MODE_HDR10;
+static unsigned int dv_ll_output_mode = DOLBY_VISION_OUTPUT_MODE_HDR10;
module_param(dv_ll_output_mode, uint, 0664);
MODULE_PARM_DESC(dv_ll_output_mode, "\n dv_ll_output_mode\n");
static u32 vsync_count;
#define FLAG_VSYNC_CNT 10
+static bool is_osd_off;
+static bool force_reset_core2;
+
module_param(vtotal_add, uint, 0664);
MODULE_PARM_DESC(vtotal_add, "\n vtotal_add\n");
module_param(vpotch, uint, 0664);
pr_info("DOLBY ERROR: " fmt, ## args)
#define dump_enable \
((debug_dolby_frame >= 0xffff) || (debug_dolby_frame == frame_count))
-#define is_graphics_output_off() 0
- /*(!(READ_VPP_REG(VPP_MISC) & (1<<12)))*/
+static int is_graphics_output_off(void)
+{
+ if (is_meson_g12a())
+ return !(READ_VPP_REG(OSD1_BLEND_SRC_CTRL) & (1<<8));
+ else
+ return (!(READ_VPP_REG(VPP_MISC) & (1<<12)));
+}
#define single_step_enable \
(((debug_dolby_frame >= 0xffff) || \
((debug_dolby_frame + 1) == frame_count)) && \
static uint64_t stb_core1_lut[STB_DMA_TBL_SIZE];
static bool tv_mode;
-static bool is_meson_gxm(void)
+bool is_meson_gxm(void)
{
if (dv_meson_dev.cpu_id == _CPU_MAJOR_ID_GXM)
return true;
return false;
}
-static bool is_meson_txlx(void)
+bool is_meson_txlx(void)
{
if (dv_meson_dev.cpu_id == _CPU_MAJOR_ID_TXLX)
return true;
return false;
}
-static bool is_meson_txlx_tvmode(void)
+bool is_meson_txlx_tvmode(void)
{
if ((is_meson_txlx()) && (tv_mode == 1))
return true;
return false;
}
-static bool is_meson_txlx_stbmode(void)
+bool is_meson_txlx_stbmode(void)
{
if ((is_meson_txlx()) && (tv_mode == 0))
return true;
return false;
}
-static bool is_meson_g12a(void)
+bool is_meson_g12a(void)
{
if (dv_meson_dev.cpu_id == _CPU_MAJOR_ID_G12A)
return true;
if (dolby_vision_run_mode != 0xff)
run_mode = dolby_vision_run_mode;
else {
- run_mode = (0x7 << 6) | (el_41_mode << 3) | bypass_flag;
+ run_mode = (0x7 << 6) |
+ ((el_41_mode ? 3 : 1) << 2) |
+ bypass_flag;
if (dolby_vision_on_count < dolby_vision_run_mode_delay) {
run_mode |= 1;
VSYNC_WR_MPEG_REG(VPP_VD1_CLIP_MISC0,
if (reset)
VSYNC_WR_MPEG_REG(DOLBY_TV_REG_START + 1, run_mode);
- VSYNC_WR_MPEG_REG(DOLBY_TV_SWAP_CTRL5, 0x6);
+ /* 962e work around to fix the uv swap issue when bl:el = 1:1 */
+ if (el_41_mode)
+ VSYNC_WR_MPEG_REG(DOLBY_TV_SWAP_CTRL5, 0x6);
+ else
+ VSYNC_WR_MPEG_REG(DOLBY_TV_SWAP_CTRL5, 0xa);
/* axi dma for reg table */
reg_size = prepare_stb_dolby_core1_reg(
if (dolby_vision_flags & FLAG_DISABLE_COMPOSER)
composer_enable = 0;
+ if (dolby_vision_on_count
+ == dolby_vision_run_mode_delay)
+ reset = true;
+
if ((!dolby_vision_on || reset) && bl_enable) {
VSYNC_WR_MPEG_REG(VIU_SW_RESET, 1 << 9);
VSYNC_WR_MPEG_REG(VIU_SW_RESET, 0);
reset = true;
}
- if ((dolby_vision_flags & FLAG_CERTIFICAION)
- || (frame_count < 10))
+ if (dolby_vision_flags & FLAG_CERTIFICAION)
reset = true;
if (stb_core_setting_update_flag & FLAG_CHANGE_TC)
VIU_MISC_CTRL1,
1, 16, 1);
} else {
- VSYNC_WR_MPEG_REG(
- VPP_VD1_CLIP_MISC0,
- (0x3ff << 20) |
- (0x3ff << 10) |
- 0x3ff);
- VSYNC_WR_MPEG_REG(
- VPP_VD1_CLIP_MISC1,
- 0);
+ if (dolby_vision_on_count >
+ dolby_vision_run_mode_delay) {
+ VSYNC_WR_MPEG_REG(
+ VPP_VD1_CLIP_MISC0,
+ (0x3ff << 20) |
+ (0x3ff << 10) |
+ 0x3ff);
+ VSYNC_WR_MPEG_REG(
+ VPP_VD1_CLIP_MISC1,
+ 0);
+ }
if (dolby_vision_core1_on
&& !bypass_core1) {
if (is_meson_g12a())
&& (dolby_vision_flags &
FLAG_DISABE_CORE_SETTING))
return 0;
- if (!dolby_vision_on) {
+
+ if (!dolby_vision_on || force_reset_core2) {
VSYNC_WR_MPEG_REG(VIU_SW_RESET, (1 << 10));
VSYNC_WR_MPEG_REG(VIU_SW_RESET, 0);
+ force_reset_core2 = false;
reset = true;
}
- if ((dolby_vision_flags & FLAG_CERTIFICAION)
- || (frame_count < 10))
+ if (dolby_vision_flags & FLAG_CERTIFICAION)
reset = true;
if (stb_core_setting_update_flag & FLAG_CHANGE_TC2)
VSYNC_WR_MPEG_REG(DOLBY_CORE2A_CLKGATE_CTRL, 0);
VSYNC_WR_MPEG_REG(DOLBY_CORE2A_SWAP_CTRL0, 0);
if (is_meson_gxm() ||
- is_meson_g12a() ||
- (dolby_vision_flags & FLAG_CERTIFICAION)) {
+ is_meson_g12a() || reset) {
VSYNC_WR_MPEG_REG(DOLBY_CORE2A_SWAP_CTRL1,
((hsize + g_htotal_add) << 16)
| (vsize + g_vtotal_add + g_vsize_add));
(g_hpotch << 16) | g_vpotch);
if (is_meson_txlx_stbmode() || force_stb_mode)
VSYNC_WR_MPEG_REG(DOLBY_CORE2A_SWAP_CTRL5, 0xf8000000);
- else
+ else if (is_meson_g12a())
VSYNC_WR_MPEG_REG(DOLBY_CORE2A_SWAP_CTRL5, 0xa8000000);
+ else
+ VSYNC_WR_MPEG_REG(DOLBY_CORE2A_SWAP_CTRL5, 0x0);
VSYNC_WR_MPEG_REG(DOLBY_CORE2A_DMA_CTRL, 0x0);
VSYNC_WR_MPEG_REG(DOLBY_CORE2A_REG_START + 2, 1);
VSYNC_WR_MPEG_REG(DOLBY_CORE2A_REG_START + 1, 2);
for (i = 0; i < count; i++)
if (reset ||
(p_core2_dm_regs[i] !=
- last_dm[i]))
+ last_dm[i])) {
VSYNC_WR_MPEG_REG(
DOLBY_CORE2A_REG_START + 6 + i,
p_core2_dm_regs[i]);
+ set_lut = true;
+ }
/* core2 metadata program done */
VSYNC_WR_MPEG_REG(DOLBY_CORE2A_REG_START + 3, 1);
FLAG_DISABE_CORE_SETTING))
return 0;
- if (!dolby_vision_on)
- reset = true;
-
- if ((dolby_vision_flags & FLAG_CERTIFICAION)
- || (frame_count < 10))
+ if (!dolby_vision_on ||
+ (dolby_vision_flags & FLAG_CERTIFICAION))
reset = true;
#ifdef V2_4
if (((cur_dv_mode == DOLBY_VISION_OUTPUT_MODE_IPT_TUNNEL)
memcmp(&p_core3_dm_regs[18],
&last_dm[18], 32)))
enable_rgb_to_yuv_matrix_for_dvll(
- 1, &p_core3_dm_regs[18],
- (dv_ll_output_mode >> 8) & 0xff);
+ 1, &p_core3_dm_regs[18], 12);
#endif
VSYNC_WR_MPEG_REG(DOLBY_CORE3_CLKGATE_CTRL, 0);
graphics_w = dv_cert_graphic_width;
graphics_h = dv_cert_graphic_height;
}
+ if (is_meson_txlx_package_962E()
+ || force_stb_mode) {
+ if ((vinfo->width >= 1920) &&
+ (vinfo->height >= 1080) &&
+ (vinfo->field_height >= 1080))
+ dma_start_line = 0x400;
+ else
+ dma_start_line = 0x180;
+ /* adjust core2 setting to work around*/
+ /* fixing with 1080p24hz and 480p60hz */
+ if ((vinfo->width < 1280) &&
+ (vinfo->height < 720) &&
+ (vinfo->field_height < 720))
+ g_vpotch = 0x60;
+ else
+ g_vpotch = 0x20;
+ }
if (mask & 1) {
- if (is_meson_txlx_stbmode()
+ if (is_meson_txlx_package_962E()
|| force_stb_mode) {
- if ((vinfo->width >= 1920) &&
- (vinfo->height >= 1080) &&
- (vinfo->field_height >= 1080))
- dma_start_line = 0x400;
- else
- dma_start_line = 0x180;
stb_dolby_core1_set(
27, 173, 256 * 5,
(uint32_t *)&new_dovi_setting.dm_reg1,
VSYNC_WR_MPEG_REG_BITS(
VPP_DOLBY_CTRL, 1, 1, 2);
enable_rgb_to_yuv_matrix_for_dvll(
- 1, ®[18],
- (dv_ll_output_mode >> 8)
- & 0xff);
+ 1, ®[18], 12);
} else
enable_rgb_to_yuv_matrix_for_dvll(
0, NULL, 12);
VPP_DOLBY_CTRL,
3, 6, 2); /* post matrix */
enable_rgb_to_yuv_matrix_for_dvll(
- 1, ®[18],
- (dv_ll_output_mode >> 8)
- & 0xff);
+ 1, ®[18], 12);
} else
enable_rgb_to_yuv_matrix_for_dvll(
0, NULL, 12);
p = (uint32_t *)&setting->comp_reg;
for (i = 0; i < 173; i++)
pr_info("%08x\n", p[i]);
- pr_info("core1 swap\n");
- for (i = DOLBY_CORE1_CLKGATE_CTRL;
- i <= DOLBY_CORE1_DMA_PORT; i++)
- pr_info("[0x%4x] = 0x%x\n",
- i, READ_VPP_REG(i));
- pr_info("core1 real reg\n");
- for (i = DOLBY_CORE1_REG_START;
- i <= DOLBY_CORE1_REG_START + 5; i++)
- pr_info("[0x%4x] = 0x%x\n",
- i, READ_VPP_REG(i));
- pr_info("core1 composer real reg\n");
- for (i = 0; i < 173 ; i++)
- pr_info("%08x\n",
- READ_VPP_REG(
- DOLBY_CORE1_REG_START
- + 50 + i));
+ if (is_meson_gxm()) {
+ pr_info("core1 swap\n");
+ for (i = DOLBY_CORE1_CLKGATE_CTRL;
+ i <= DOLBY_CORE1_DMA_PORT; i++)
+ pr_info("[0x%4x] = 0x%x\n",
+ i, READ_VPP_REG(i));
+ pr_info("core1 real reg\n");
+ for (i = DOLBY_CORE1_REG_START;
+ i <= DOLBY_CORE1_REG_START + 5;
+ i++)
+ pr_info("[0x%4x] = 0x%x\n",
+ i, READ_VPP_REG(i));
+ pr_info("core1 composer real reg\n");
+ for (i = 0; i < 173 ; i++)
+ pr_info("%08x\n",
+ READ_VPP_REG(
+ DOLBY_CORE1_REG_START
+ + 50 + i));
+ } else if (is_meson_txlx()) {
+ pr_info("core1 swap\n");
+ for (i = DOLBY_TV_SWAP_CTRL0;
+ i <= DOLBY_TV_STATUS1; i++)
+ pr_info("[0x%4x] = 0x%x\n",
+ i, READ_VPP_REG(i));
+ pr_info("core1 real reg\n");
+ for (i = DOLBY_TV_REG_START;
+ i <= DOLBY_CORE1_REG_START + 5;
+ i++)
+ pr_info("[0x%4x] = 0x%x\n",
+ i, READ_VPP_REG(i));
+ }
}
if ((debug_flag & 0x20) && dump_enable) {
pr_dolby_dbg("metadata parser init OK\n");
}
} else {
- if (p_funcs->metadata_parser_reset
- (metadata_parser_reset_flag) == 0)
+ if (p_funcs->metadata_parser_reset(
+ metadata_parser_reset_flag) == 0)
metadata_parser_reset_flag = 0;
parser_ready = 1;
}
| (9 << 16) /* bt2020 */
| (0x10 << 8) /* bt2020-10 */
| (10 << 0);/* bt2020c */
+ /* need invert to g,b,r */
if (hdr10_data.primaries[0][0] !=
- ((p_hdr->display_primaries_x_0_MSB << 8)
- | p_hdr->display_primaries_x_0_LSB))
- flag = true;
- hdr10_data.primaries[0][0] =
- (p_hdr->display_primaries_x_0_MSB << 8)
- | p_hdr->display_primaries_x_0_LSB;
-
- if (hdr10_data.primaries[0][1] !=
- ((p_hdr->display_primaries_y_0_MSB << 8)
- | p_hdr->display_primaries_y_0_LSB))
- flag = true;
- hdr10_data.primaries[0][1] =
- (p_hdr->display_primaries_y_0_MSB << 8)
- | p_hdr->display_primaries_y_0_LSB;
-
- if (hdr10_data.primaries[1][0] !=
((p_hdr->display_primaries_x_1_MSB << 8)
| p_hdr->display_primaries_x_1_LSB))
flag = true;
- hdr10_data.primaries[1][0] =
+ hdr10_data.primaries[0][0] =
(p_hdr->display_primaries_x_1_MSB << 8)
| p_hdr->display_primaries_x_1_LSB;
- if (hdr10_data.primaries[1][1] !=
+ if (hdr10_data.primaries[0][1] !=
((p_hdr->display_primaries_y_1_MSB << 8)
| p_hdr->display_primaries_y_1_LSB))
flag = true;
- hdr10_data.primaries[1][1] =
+ hdr10_data.primaries[0][1] =
(p_hdr->display_primaries_y_1_MSB << 8)
| p_hdr->display_primaries_y_1_LSB;
- if (hdr10_data.primaries[2][0] !=
+ if (hdr10_data.primaries[1][0] !=
((p_hdr->display_primaries_x_2_MSB << 8)
| p_hdr->display_primaries_x_2_LSB))
flag = true;
- hdr10_data.primaries[2][0] =
+ hdr10_data.primaries[1][0] =
(p_hdr->display_primaries_x_2_MSB << 8)
| p_hdr->display_primaries_x_2_LSB;
- if (hdr10_data.primaries[2][1] !=
+ if (hdr10_data.primaries[1][1] !=
((p_hdr->display_primaries_y_2_MSB << 8)
| p_hdr->display_primaries_y_2_LSB))
flag = true;
- hdr10_data.primaries[2][1] =
+ hdr10_data.primaries[1][1] =
(p_hdr->display_primaries_y_2_MSB << 8)
| p_hdr->display_primaries_y_2_LSB;
+ if (hdr10_data.primaries[2][0] !=
+ ((p_hdr->display_primaries_x_0_MSB << 8)
+ | p_hdr->display_primaries_x_0_LSB))
+ flag = true;
+ hdr10_data.primaries[2][0] =
+ (p_hdr->display_primaries_x_0_MSB << 8)
+ | p_hdr->display_primaries_x_0_LSB;
+
+ if (hdr10_data.primaries[2][1] !=
+ ((p_hdr->display_primaries_y_0_MSB << 8)
+ | p_hdr->display_primaries_y_0_LSB))
+ flag = true;
+ hdr10_data.primaries[2][1] =
+ (p_hdr->display_primaries_y_0_MSB << 8)
+ | p_hdr->display_primaries_y_0_LSB;
if (hdr10_data.white_point[0] !=
((p_hdr->white_point_x_MSB << 8)
} else if (meta_flag_bl && meta_flag_el) {
total_md_size = last_total_md_size;
total_comp_size = last_total_comp_size;
- el_flag = dovi_setting.el_flag;
+ if (is_dolby_vision_stb_mode())
+ el_flag = dovi_setting.el_flag;
+ else
+ el_flag = ((struct tv_dovi_setting_s *)
+ tv_dovi_setting)->el_flag;
meta_flag_bl = 0;
}
if ((src_format == FORMAT_DOVI)
if (is_graphics_output_off()) {
graphic_min = 0;
graphic_max = 0;
+ is_osd_off = true;
} else {
- graphic_min =
- dolby_vision_graphic_min;
-#ifdef V2_4
- if (dolby_vision_flags & FLAG_CERTIFICAION)
- graphic_max = 500;
- else
- graphic_max =
- dolby_vision_graphic_max;
-#else
+ graphic_min = dolby_vision_graphic_min;
graphic_max = dolby_vision_graphic_max;
-#endif
+ /* force reset core2 when osd off->on */
+ /* TODO: 962e need ? */
+ if (is_osd_off)
+ force_reset_core2 = true;
+ is_osd_off = false;
}
if (dolby_vision_flags & FLAG_USE_SINK_MIN_MAX) {
if (vinfo->vout_device->dv_info->ieeeoui == 0x00d046) {
&& (vinfo->vout_device->dv_info
->block_flag == CORRECT)) {
if (new_dovi_setting.vsvdb_len
- != vinfo->vout_device->dv_info->length)
+ != vinfo->vout_device->dv_info->length + 1)
new_dovi_setting.vsvdb_changed = 1;
else if (memcmp(&new_dovi_setting.vsvdb_tbl[0],
&vinfo->vout_device->dv_info->rawdata[0],
- vinfo->vout_device->dv_info->length))
+ vinfo->vout_device->dv_info->length + 1))
new_dovi_setting.vsvdb_changed = 1;
memset(&new_dovi_setting.vsvdb_tbl[0],
0, sizeof(new_dovi_setting.vsvdb_tbl));
memcpy(&new_dovi_setting.vsvdb_tbl[0],
&vinfo->vout_device->dv_info->rawdata[0],
- vinfo->vout_device->dv_info->length);
+ vinfo->vout_device->dv_info->length + 1);
new_dovi_setting.vsvdb_len =
- vinfo->vout_device->dv_info->length;
+ vinfo->vout_device->dv_info->length + 1;
+ if (new_dovi_setting.vsvdb_changed
+ && new_dovi_setting.vsvdb_len) {
+ int k = 0;
+
+ pr_dolby_dbg(
+ "new vsvdb[%d]:\n",
+ new_dovi_setting.vsvdb_len);
+ pr_dolby_dbg(
+ "---%02x, %02x, %02x, %02x, %02x, %02x, %02x, %02x\n",
+ new_dovi_setting.vsvdb_tbl[k + 0],
+ new_dovi_setting.vsvdb_tbl[k + 1],
+ new_dovi_setting.vsvdb_tbl[k + 2],
+ new_dovi_setting.vsvdb_tbl[k + 3],
+ new_dovi_setting.vsvdb_tbl[k + 4],
+ new_dovi_setting.vsvdb_tbl[k + 5],
+ new_dovi_setting.vsvdb_tbl[k + 6],
+ new_dovi_setting.vsvdb_tbl[k + 7]);
+ k += 8;
+ pr_dolby_dbg(
+ "---%02x, %02x, %02x, %02x, %02x, %02x, %02x, %02x\n",
+ new_dovi_setting.vsvdb_tbl[k + 0],
+ new_dovi_setting.vsvdb_tbl[k + 1],
+ new_dovi_setting.vsvdb_tbl[k + 2],
+ new_dovi_setting.vsvdb_tbl[k + 3],
+ new_dovi_setting.vsvdb_tbl[k + 4],
+ new_dovi_setting.vsvdb_tbl[k + 5],
+ new_dovi_setting.vsvdb_tbl[k + 6],
+ new_dovi_setting.vsvdb_tbl[k + 7]);
+ k += 8;
+ pr_dolby_dbg(
+ "---%02x, %02x, %02x, %02x, %02x, %02x, %02x, %02x\n",
+ new_dovi_setting.vsvdb_tbl[k + 0],
+ new_dovi_setting.vsvdb_tbl[k + 1],
+ new_dovi_setting.vsvdb_tbl[k + 2],
+ new_dovi_setting.vsvdb_tbl[k + 3],
+ new_dovi_setting.vsvdb_tbl[k + 4],
+ new_dovi_setting.vsvdb_tbl[k + 5],
+ new_dovi_setting.vsvdb_tbl[k + 6],
+ new_dovi_setting.vsvdb_tbl[k + 7]);
+ k += 8;
+ pr_dolby_dbg(
+ "---%02x, %02x, %02x, %02x, %02x, %02x, %02x, %02x\n",
+ new_dovi_setting.vsvdb_tbl[k + 0],
+ new_dovi_setting.vsvdb_tbl[k + 1],
+ new_dovi_setting.vsvdb_tbl[k + 2],
+ new_dovi_setting.vsvdb_tbl[k + 3],
+ new_dovi_setting.vsvdb_tbl[k + 4],
+ new_dovi_setting.vsvdb_tbl[k + 5],
+ new_dovi_setting.vsvdb_tbl[k + 6],
+ new_dovi_setting.vsvdb_tbl[k + 7]);
+ }
} else {
if (new_dovi_setting.vsvdb_len)
new_dovi_setting.vsvdb_changed = 1;
dovi_setting_video_flag = video_frame;
if (debug_dolby & 1) {
if (el_flag)
- pr_dolby_dbg("setting %d->%d(T:%d-%d): flag=%02x,md=%d,comp=%d\n",
+ pr_dolby_dbg("setting %d->%d(T:%d-%d): flag=%02x,md=%d,comp=%d, frame:%d\n",
src_format, dst_format,
dolby_vision_target_min,
dolby_vision_target_max[src_format][dst_format],
flag,
- total_md_size, total_comp_size);
+ total_md_size, total_comp_size,
+ frame_count);
else
- pr_dolby_dbg("setting %d->%d(T:%d-%d): flag=%02x,md=%d\n",
+ pr_dolby_dbg("setting %d->%d(T:%d-%d): flag=%02x,md=%d, frame:%d\n",
src_format, dst_format,
dolby_vision_target_min,
dolby_vision_target_max[src_format][dst_format],
flag,
- total_md_size);
+ total_md_size, frame_count);
}
dump_setting(&new_dovi_setting, frame_count, debug_dolby);
el_mode = el_flag;
int ret = 0;
unsigned int mode;
- if (single_step_enable)
+ if (single_step_enable) {
if (dolby_vision_flags & FLAG_SINGLE_STEP)
/* wait fake el for "step" */
return 1;
- if (single_step_enable)
- if (!(dolby_vision_flags & FLAG_SINGLE_STEP))
+ else
dolby_vision_flags |= FLAG_SINGLE_STEP;
+ }
+
if (dolby_vision_flags & FLAG_CERTIFICAION) {
bool ott_mode = true;
&& !video_off_handled) {
dolby_vision_set_toggle_flag(1);
frame_count = 0;
- pr_dolby_dbg("video off\n");
- if (debug_dolby)
+ if (debug_dolby & 2) {
video_off_handled = 1;
+ pr_dolby_dbg("video off\n");
+ }
}
if (last_dolby_vision_policy != dolby_vision_policy) {
pq_config_fake = (struct pq_config_s *)pq_config;
dovi_setting = vmalloc(sizeof(dovi_setting));
tv_dovi_setting = (struct tv_dovi_setting_s *)dovi_setting;
+ /* adjust core2 setting to work around fixing with 1080p24hz */
+ if (is_meson_txlx())
+ g_vpotch = 0x20;
+ else
+ g_vpotch = 0x8;
}
return ret;
}
CLEAR_VCBUS_REG_MASK(VPP_MISC + cur_dev->vpp_off, \
VPP_VD2_POSTBLEND | VPP_VD2_PREBLEND | \
(0x1ff << VPP_VD2_ALPHA_BIT)); \
+ VIDEO_LAYER2_OFF(); \
VD2_MEM_POWER_OFF(); \
} while (0)
#endif
/* config */
static struct vframe_s *cur_dispbuf;
static struct vframe_s *cur_dispbuf2;
+static bool need_disable_vd2;
void update_cur_dispbuf(void *buf)
{
cur_dispbuf = buf;
(zoom_start_x_lines - l_aligned);
content_r = content_l + content_w - 1;
VSYNC_WR_MPEG_REG(AFBC_PIXEL_HOR_SCOPE,
- (content_l << 16) | content_r);
+ (((content_l << 16)) | content_r) / h_skip);
} else
#endif
{
VSYNC_WR_MPEG_REG(AFBC_PIXEL_HOR_SCOPE,
- ((zoom_start_x_lines - l_aligned) << 16) |
- (zoom_end_x_lines - l_aligned));
+ (((zoom_start_x_lines - l_aligned) << 16) |
+ (zoom_end_x_lines - l_aligned)) / h_skip);
}
VSYNC_WR_MPEG_REG(AFBC_SIZE_IN,
(VSYNC_RD_MPEG_REG(AFBC_SIZE_IN) & 0xffff) |
canvas_config_config(*canvas_index, cfg);
}
+/* for sdr/hdr/single dv switch with dual dv */
+static u32 last_el_status;
+/* for dual dv switch with different el size */
+static u32 last_el_w;
bool has_enhanced_layer(struct vframe_s *vf)
{
struct provider_aux_req_s req;
(cur_dispbuf->ratio_control != vf->ratio_control) ||
((cur_dispbuf->type_backup & VIDTYPE_INTERLACE) !=
(vf->type_backup & VIDTYPE_INTERLACE)) ||
+ (last_el_status != vf_with_el) ||
(cur_dispbuf->type != vf->type)
))) {
last_process_3d_type = process_3d_type;
/* #endif */
}
+ last_el_status = vf_with_el;
if (((vf->type & VIDTYPE_NO_VIDEO_ENABLE) == 0) &&
((!property_changed_true) || (vf != cur_dispbuf))) {
VD2_MEM_POWER_ON();
else if (vf_with_el)
EnableVideoLayer2();
+ else if (need_disable_vd2)
+ DisableVideoLayer2();
}
}
if (cur_dispbuf && (cur_dispbuf->type != vf->type)) {
VD2_MEM_POWER_ON();
else if (vf_with_el)
EnableVideoLayer2();
- else
+ else if (need_disable_vd2)
DisableVideoLayer2();
}
}
<< VFORMATTER_PHASE_BIT) | VFORMATTER_EN);
}
+ if ((is_meson_txlx_cpu()
+ || is_meson_g12a())
+ && is_dolby_vision_on()
+ && is_dolby_vision_stb_mode()
+ && (vf->source_type ==
+ VFRAME_SOURCE_TYPE_OTHERS))
+ VSYNC_WR_MPEG_REG_BITS(
+ VIU_VD1_FMT_CTRL + cur_dev->viu_off,
+ 1, 29, 1);
+
/* LOOP/SKIP pattern */
pat = vpat[frame_par->vscale_skip_count];
u32 type = vf->type, bit_mode = 0;
pr_debug("set dcu for vd2 %p, type:0x%x\n", vf, type);
+ last_el_w = (vf->type
+ & VIDTYPE_COMPRESS) ?
+ vf->compWidth :
+ vf->width;
if (get_cpu_type() >= MESON_CPU_MAJOR_ID_GXBB) {
if (type & VIDTYPE_COMPRESS) {
r = (3 << 24) |
/*is_dolby_vision_on()*/0);
}
}
+
+ if ((is_meson_txlx_cpu()
+ || is_meson_g12a())
+ && is_dolby_vision_on()
+ && is_dolby_vision_stb_mode()
+ && (vf->source_type ==
+ VFRAME_SOURCE_TYPE_OTHERS))
+ VSYNC_WR_MPEG_REG_BITS(
+ VIU_VD2_FMT_CTRL + cur_dev->viu_off,
+ 1, 29, 1);
/* LOOP/SKIP pattern */
pat = vpat[frame_par->vscale_skip_count];
return 1;
return 0;
}
-
/* patch for 4k2k bandwidth issue, skiw mali and vpu mif */
-static void dmc_adjust_for_mali_vpu(unsigned int width, unsigned int height)
+static void dmc_adjust_for_mali_vpu(unsigned int width,
+ unsigned int height, bool force_adjust)
{
if (toggle_count == last_toggle_count)
toggle_same_count++;
}
/*avoid 3840x2160 crop*/
if ((width >= 2000) && (height >= 1400) &&
- (dmc_config_state != 1) &&
- (toggle_same_count < 30)) {
- if (is_dolby_vision_enable()) {
+ (((dmc_config_state != 1) && (toggle_same_count < 30))
+ || force_adjust)) {
+ if (0) {/* if (is_dolby_vision_enable()) { */
/* vpu dmc */
WRITE_DMCREG(
DMC_AM0_CHAN_CTRL,
DMC_AXI2_HOLD_CTRL,
0x08040804);
} else {
+ /* vpu dmc */
+ WRITE_DMCREG(
+ DMC_AM1_CHAN_CTRL,
+ 0x43028);
+ WRITE_DMCREG(
+ DMC_AM1_HOLD_CTRL,
+ 0x18101818);
+ WRITE_DMCREG(
+ DMC_AM3_CHAN_CTRL,
+ 0x85f403f4);
+ WRITE_DMCREG(
+ DMC_AM4_CHAN_CTRL,
+ 0x85f403f4);
/* mali dmc */
WRITE_DMCREG(
DMC_AXI1_HOLD_CTRL,
0x8FF003C4);
WRITE_DMCREG(
DMC_AM1_CHAN_CTRL,
- 0x8FF003C4);
+ 0x3028);
+ WRITE_DMCREG(
+ DMC_AM1_HOLD_CTRL,
+ 0x18101810);
WRITE_DMCREG(
DMC_AM2_CHAN_CTRL,
0x8FF003C4);
+ WRITE_DMCREG(
+ DMC_AM2_HOLD_CTRL,
+ 0x3028);
+ WRITE_DMCREG(
+ DMC_AM3_CHAN_CTRL,
+ 0x85f003f4);
+ WRITE_DMCREG(
+ DMC_AM4_CHAN_CTRL,
+ 0x85f003f4);
/* mali dmc */
WRITE_DMCREG(
}
}
+static bool is_sc_enable_before_pps(struct vpp_frame_par_s *par)
+{
+ bool ret = false;
+
+ if (par) {
+ if (par->supsc0_enable &&
+ ((par->supscl_path == CORE0_PPS_CORE1)
+ || (par->supscl_path == CORE0_BEFORE_PPS)))
+ ret = true;
+ else if (par->supsc1_enable &&
+ (par->supscl_path == CORE1_BEFORE_PPS))
+ ret = true;
+ else if ((par->supsc0_enable || par->supsc1_enable)
+ && (par->supscl_path == CORE0_CORE1_PPS))
+ ret = true;
+ }
+ return ret;
+}
+
void correct_vd1_mif_size_for_DV(struct vpp_frame_par_s *par)
{
u32 aligned_mask = 0xfffffffe;
u32 old_len;
-
- if ((is_dolby_vision_on() == true) &&
- (par->VPP_line_in_length_ > 0)) {
+ if ((is_dolby_vision_on() == true)
+ && (par->VPP_line_in_length_ > 0)
+ && !is_sc_enable_before_pps(par)) {
+ /* work around to skip the size check when sc enable */
if (cur_dispbuf2) {
/*
*if (cur_dispbuf2->type
{
int width_bl, width_el, line_in_length;
int shift;
-
- if ((is_dolby_vision_on() == true) &&
- (par->VPP_line_in_length_ > 0)) {
+ if ((is_dolby_vision_on() == true)
+ && (par->VPP_line_in_length_ > 0)
+ && !is_sc_enable_before_pps(par)) {
+ /* work around to skip the size check when sc enable */
width_el = (cur_dispbuf2->type
& VIDTYPE_COMPRESS) ?
cur_dispbuf2->compWidth :
struct vframe_s *toggle_vf = NULL;
struct vframe_s *toggle_frame = NULL;
int video1_off_req = 0;
+ int video2_off_req = 0;
struct vframe_s *cur_dispbuf_back = cur_dispbuf;
static struct vframe_s *pause_vf;
vsync_enter_line_max = enc_line;
if (is_meson_txlx_cpu() && dmc_adjust) {
+ bool force_adjust = false;
+
+ if (vf)
+ force_adjust =
+ ((vf->type & (VIDTYPE_VIU_444
+ | VIDTYPE_PIC))
+ == (VIDTYPE_VIU_444
+ | VIDTYPE_PIC)) ? true : false;
+ else if (cur_dispbuf)
+ force_adjust =
+ ((cur_dispbuf->type & (VIDTYPE_VIU_444
+ | VIDTYPE_PIC))
+ == (VIDTYPE_VIU_444
+ | VIDTYPE_PIC)) ? true : false;
if (vf)
dmc_adjust_for_mali_vpu(
- vf->width, vf->height);
+ vf->width, vf->height, force_adjust);
else if (cur_dispbuf)
dmc_adjust_for_mali_vpu(
cur_dispbuf->width,
- cur_dispbuf->height);
+ cur_dispbuf->height,
+ force_adjust);
else
dmc_adjust_for_mali_vpu(
- 0, 0);
+ 0, 0, force_adjust);
}
#ifdef CONFIG_AMLOGIC_MEDIA_VSYNC_RDMA
vsync_rdma_config_pre();
cur_dispbuf, 2, false);
dolby_vision_set_toggle_flag(1);
}
+/* pause mode was moved to video display property */
+#if 0
/* force toggle in pause mode */
if (cur_dispbuf
&& (cur_dispbuf != &vf_local)
&& !toggle_vf
- && is_dolby_vision_on()) {
+ && is_dolby_vision_on()
+ && !for_dolby_vision_certification()) {
toggle_vf = cur_dispbuf;
dolby_vision_parse_metadata(
cur_dispbuf, 0, false);
dolby_vision_set_toggle_flag(1);
}
+#endif
if (cur_frame_par) {
if (cur_frame_par->VPP_hd_start_lines_
>= cur_frame_par->VPP_hd_end_lines_)
if (cur_dispbuf2)
vd2_set_dcu(cur_frame_par,
cur_dispbuf2);
+ } else if (cur_dispbuf2) {
+ u32 new_el_w =
+ (cur_dispbuf2->type
+ & VIDTYPE_COMPRESS) ?
+ cur_dispbuf2->compWidth :
+ cur_dispbuf2->width;
+ if (new_el_w != last_el_w) {
+ pr_info("reset vd2 dcu for el change, %d->%d, %p--%p\n",
+ last_el_w, new_el_w,
+ cur_dispbuf, cur_dispbuf2);
+ vd2_set_dcu(cur_frame_par,
+ cur_dispbuf2);
+ }
+ } else {
+ last_el_w = 0;
+ last_el_status = 0;
}
}
{
&& cur_dispbuf &&
(cur_dispbuf->type & VIDTYPE_VIU_FIELD)) {
VSYNC_WR_MPEG_REG_BITS(VIU_VD1_FMT_CTRL +
- cur_dev->viu_off, 0, 20, 1);
+ cur_dev->viu_off, 1, 20, 1);
/* HFORMATTER_EN */
VSYNC_WR_MPEG_REG_BITS(VIU_VD2_FMT_CTRL +
- cur_dev->viu_off, 0, 20, 1);
+ cur_dev->viu_off, 1, 20, 1);
/* HFORMATTER_EN */
}
if (process_3d_type & MODE_3D_OUT_FA_MASK) {
VPP_HSC_START_PHASE_STEP + cur_dev->vpp_off);
v_phase_step = READ_VCBUS_REG(
VPP_VSC_START_PHASE_STEP + cur_dev->vpp_off);
- if ((vpp_filter->vpp_hsc_start_phase_step != h_phase_step) ||
+ if ((vpp_filter->vpp_hf_start_phase_step != h_phase_step) ||
(vpp_filter->vpp_vsc_start_phase_step != v_phase_step)) {
video_property_changed = true;
/*pr_info("frame info register rdma write fail!\n");*/
if (debug_flag & DEBUG_FLAG_BLACKOUT)
pr_info("VsyncDisableVideoLayer2\n");
+ video2_off_req = 1;
}
spin_unlock_irqrestore(&video2_onoff_lock, flags);
}
vpp_misc_set);
/*vpp_misc_set maybe have same,but need off.*/
+ /* if vd1 off, disable vd2 also */
+ if (video2_off_req || video1_off_req) {
+ if ((debug_flag & DEBUG_FLAG_BLACKOUT)
+ && video2_off_req)
+ pr_info("VD2 AFBC off now.\n");
+ VSYNC_WR_MPEG_REG(VD2_AFBC_ENABLE, 0);
+ VSYNC_WR_MPEG_REG(
+ VD2_IF0_GEN_REG + cur_dev->viu_off, 0);
+ if (!legacy_vpp) {
+ VSYNC_WR_MPEG_REG(
+ VD2_BLEND_SRC_CTRL + cur_dev->vpp_off, 0);
+ }
+ last_el_w = 0;
+ last_el_status = 0;
+ if (cur_dispbuf2 && (cur_dispbuf2 == &vf_local2))
+ cur_dispbuf2 = NULL;
+ need_disable_vd2 = false;
+ }
if (video1_off_req) {
/*
* video layer off, swith off afbc,
if (debug_flag & DEBUG_FLAG_BLACKOUT)
pr_info("AFBC off now.\n");
VSYNC_WR_MPEG_REG(AFBC_ENABLE, 0);
- VSYNC_WR_MPEG_REG(VD2_AFBC_ENABLE, 0);
VSYNC_WR_MPEG_REG(
VD1_IF0_GEN_REG + cur_dev->viu_off, 0);
- VSYNC_WR_MPEG_REG(
- VD2_IF0_GEN_REG + cur_dev->viu_off, 0);
if (!legacy_vpp) {
VSYNC_WR_MPEG_REG(
VD1_BLEND_SRC_CTRL + cur_dev->vpp_off, 0);
- VSYNC_WR_MPEG_REG(
- VD2_BLEND_SRC_CTRL + cur_dev->vpp_off, 0);
}
- }
-
+ if (is_dolby_vision_enable()) {
+ if (is_meson_txlx_stbmode() ||
+ is_meson_gxm())
+ VSYNC_WR_MPEG_REG_BITS(
+ VIU_MISC_CTRL1,
+ 1, 16, 1); /* bypass core1 */
+ else if (is_meson_g12a())
+ VSYNC_WR_MPEG_REG_BITS(
+ DOLBY_PATH_CTRL,
+ 1, 0, 1);
+ }
+ if (cur_dispbuf && (cur_dispbuf == &vf_local))
+ cur_dispbuf = NULL;
+ }
#ifdef CONFIG_AMLOGIC_MEDIA_VSYNC_RDMA
cur_rdma_buf = cur_dispbuf;
/* vsync_rdma_config(); */
cur_dispbuf = &vf_local;
cur_dispbuf->video_angle = 0;
}
+ if (cur_dispbuf2)
+ need_disable_vd2 = true;
if (is_dolby_vision_enable()) {
if (cur_dispbuf2 == &vf_local2)
cur_dispbuf2 = NULL;
video_property_changed = true;
try_free_keep_video(0);
} else {
- if (cur_dispbuf && (cur_dispbuf != &vf_local))
+ if (cur_dispbuf && (cur_dispbuf != &vf_local)) {
EnableVideoLayer();
+ video_property_changed = true;
+ }
}
return 0;